From patchwork Fri May 26 06:35:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guodong Xu X-Patchwork-Id: 100548 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp112901qge; Thu, 25 May 2017 23:36:03 -0700 (PDT) X-Received: by 10.99.98.66 with SMTP id w63mr452538pgb.223.1495780563322; Thu, 25 May 2017 23:36:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495780563; cv=none; d=google.com; s=arc-20160816; b=KSxSUTyYK+A1GJUDKzWrYcdXBpYPbdN+hnKj9mhywPTTFA/arin6BOSBHPkGgzkoTK JqSl++qk0A3PhVPSc6x0Y5kABwJGfATMfP+cqTBMzh8UTTcUtIsLXNKzbDljaGqJOw4W mmSj25Fh+HLzYhS5A31rnFhgq58iSjFl0KY8R/4+kHS8z+W+CsWJrU7pXgLK8zBZaTAS aCOJvGdFPChELNPDXbIwf4RepIgFRW/G+xTEXm5foQEGfiwGP3+f1c9Earz6/QwzQNxt DetIMa0khVO+YK92aqzv96lwxIgI9cZm7EMa9Mqec3rT1aYkS/5j9D/Iea5LqRXBsKkS 3jyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=0VlL8A3daGvF6UOaYwQt2zx07GeXlVpgbISDHCg759s=; b=AXlm3MHhCKDvkSXara2BkvTsxPql9lYdUYl40YID4gP23Se3JNPavoA8uZf36TsyYz nawSZkWNDdyXU+gfyO+4ly98ne1/U9AxMuYDDbtUK6P6PypsxqgFGOCgJydeUiWsxopG 7qAlhd0wR/IB8oqcEZ0GYeKu7dhOManEe+DMjVxC2D7TMdkZ1OcjjFn2/DWQiK5d9Fic HlrZggbYqBhoNeCnrSWAxnV1OdA+RaZRX1wxr3a8YSoVaLg5/ogNF/v4oKvCEfLr6UP5 cVUHLnOYdlKziwt2I2YTKSHyq7f+FSKfE6FN9JihmEMNcQokpenxvgM6z0IsfUYToUua ObdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w90si31562355pfj.142.2017.05.25.23.36.02; Thu, 25 May 2017 23:36:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946939AbdEZGf4 (ORCPT + 25 others); Fri, 26 May 2017 02:35:56 -0400 Received: from mail-pf0-f174.google.com ([209.85.192.174]:34183 "EHLO mail-pf0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163654AbdEZGfx (ORCPT ); Fri, 26 May 2017 02:35:53 -0400 Received: by mail-pf0-f174.google.com with SMTP id 9so2628229pfj.1 for ; Thu, 25 May 2017 23:35:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0VlL8A3daGvF6UOaYwQt2zx07GeXlVpgbISDHCg759s=; b=MBAudS3xaE63pfaxCC3QQRMLH78M6JXgDUR5prlBGGUEBrtaFPClJrMKszpc9WGEeh n8Owq3Krc38WDtUB/f7ifz9H8iAEm3zOI0Q1eh3D62NGtbzDXu2HWhvFTRHr16YB8f/d vHwcOqc56QPTUnTzt0D/UBWgDdv2t5LphjEao= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0VlL8A3daGvF6UOaYwQt2zx07GeXlVpgbISDHCg759s=; b=LCnT7Mt0/Nmu/krKIHE0MxRxS3dM98lfn4H/gZMNKmaPX/EUSsR8embzlBw2/b8E73 wqh7Dgi509NYsTB3CRXKy8joqVbVltg+TV+ScDBnNKcGU7f7Nlf0WLqhfj98hloqSRNN vAhJFkkhUOwMNf3cLS1yOC4Qc55MDPP5gPaJY7P+WM3UprwULQbFqwAPrPoohOWyYo1+ CWMsPPbzdbYo92BQMCTifchkmCURpW8/RLi0wpyJHtLK54tJgAGRgodPWKF8nn3f1iUg z8P/GorESh78J9Cm3HPrS6qKBe0tDdXXAY6s3xTsAAJultgL4LTBy5uy3dN/L9l0z0UX hDvg== X-Gm-Message-State: AODbwcAaGrLnKLvVwAcekPWqsB71IRCUq8KcwOqtSNYTW1xlzn2WaTHM loSY0RWTo+7m/e31 X-Received: by 10.99.115.90 with SMTP id d26mr484338pgn.198.1495780547546; Thu, 25 May 2017 23:35:47 -0700 (PDT) Received: from docularxu-ThinkPad-T440p.219.146.1.66 ([45.56.159.222]) by smtp.gmail.com with ESMTPSA id j11sm11420635pgn.38.2017.05.25.23.35.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 25 May 2017 23:35:46 -0700 (PDT) From: Guodong Xu To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, xuwei5@hisilicon.com, catalin.marinas@arm.com, will.deacon@arm.com, lgirdwood@gmail.com, broonie@kernel.org, khilman@baylibre.com, arnd@arndb.de, gregory.clement@free-electrons.com, olof@lixom.net, thomas.petazzoni@free-electrons.com, yamada.masahiro@socionext.com, riku.voipio@linaro.org, treding@nvidia.com, krzk@kernel.org, eric@anholt.net, damm+renesas@opensource.se, ard.biesheuvel@linaro.org, linus.walleij@linaro.org, geert+renesas@glider.be Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, hw.wangxiaoyin@hisilicon.com, Guodong Xu Subject: [PATCH 2/6] mfd: hi6421-pmic: move hi6421_regmap_config definition to header file Date: Fri, 26 May 2017 14:35:14 +0800 Message-Id: <20170526063518.21246-3-guodong.xu@linaro.org> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170526063518.21246-1-guodong.xu@linaro.org> References: <20170526063518.21246-1-guodong.xu@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move hi6421_regmap_config definition from c code to common header: - include/linux/mfd/hi6421-pmic.h This is to improve code re-use for upcoming hi6421 series of MFD driver. Signed-off-by: Guodong Xu --- drivers/mfd/hi6421-pmic-core.c | 7 ------- include/linux/mfd/hi6421-pmic.h | 6 ++++++ 2 files changed, 6 insertions(+), 7 deletions(-) -- 2.10.2 diff --git a/drivers/mfd/hi6421-pmic-core.c b/drivers/mfd/hi6421-pmic-core.c index 3fd703f..dc1b5cf 100644 --- a/drivers/mfd/hi6421-pmic-core.c +++ b/drivers/mfd/hi6421-pmic-core.c @@ -35,13 +35,6 @@ static const struct mfd_cell hi6421_devs[] = { { .name = "hi6421-regulator", }, }; -static const struct regmap_config hi6421_regmap_config = { - .reg_bits = 32, - .reg_stride = 4, - .val_bits = 8, - .max_register = HI6421_REG_TO_BUS_ADDR(HI6421_REG_MAX), -}; - static int hi6421_pmic_probe(struct platform_device *pdev) { struct hi6421_pmic *pmic; diff --git a/include/linux/mfd/hi6421-pmic.h b/include/linux/mfd/hi6421-pmic.h index 587273e..f4674ff 100644 --- a/include/linux/mfd/hi6421-pmic.h +++ b/include/linux/mfd/hi6421-pmic.h @@ -38,4 +38,10 @@ struct hi6421_pmic { struct regmap *regmap; }; +static const struct regmap_config hi6421_regmap_config = { + .reg_bits = 32, + .reg_stride = 4, + .val_bits = 8, + .max_register = HI6421_REG_TO_BUS_ADDR(HI6421_REG_MAX), +}; #endif /* __HI6421_PMIC_H */ From patchwork Fri May 26 06:35:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guodong Xu X-Patchwork-Id: 100549 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp112930qge; Thu, 25 May 2017 23:36:10 -0700 (PDT) X-Received: by 10.84.141.129 with SMTP id 1mr56389640plv.75.1495780570373; Thu, 25 May 2017 23:36:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495780570; cv=none; d=google.com; s=arc-20160816; b=V2epsEFgAwUx8/SdI3tVMNv1LdAe1vDLp630QBNJytgh/M4Ft6/YgzUrkUhoFAAShu nWu+CeJmMp3ALjLMn4ADydLTPaJUvpZiacAPLPn+8Cwyb6plRmPW5QeYbOSMbasnABrN Os3wzVHS8J7bc3GN2UJMOkdmSvKWI8YEDRYJkepmKoJocxsQG5B33VlixtA1CvOOYZ+v uCG4OWDm7e2OzEkuIRAnGzA/cSPNkwvQRt1gxcA3mfE+0hRChklka9++CUadxxlHqlLi 2GuDs/LC+iZhZx6u4H3k3pAm6L6v1A25EZ7FSclsEfAlG7J1Kg+aLFC9aqI2TUlutm7R HLOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=+3HQbhw8C8hS/qVfO28FlT0RDc1VqoUEWuqAtucyWcc=; b=kReInFQiGqxFFQQZ2YiAjWdzn+Lkfa52mCrwo8Gx1fqzcsUgFTvQJCFAhNHudlIAm/ xmwGctc1xYDWAL94mJ0w0CODRNa8Lg5/7EOslH+7vbJcUIDISpSuwFQ4KjYYY2/jk82/ aPG7u/XGox/Ihu6S7LF2e4Jo1DJLA7NehV5uTcfQX1YmhcLjivwru3lSv8nvByHyu8HO SOxQMUMLdhM3FqtGvIR9+JdwnMXrer9hY2AoYJVcQyJ4XPr3imYq13PDfxOtYdU4jHw3 7yioa8pvp+xo6Cf/u0A8RgpcQ6waozM3O7OIufLUS0kfF8vxvjCTqxR5J2Kh9YQo99VB MFNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w90si31562355pfj.142.2017.05.25.23.36.10; Thu, 25 May 2017 23:36:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946957AbdEZGgH (ORCPT + 25 others); Fri, 26 May 2017 02:36:07 -0400 Received: from mail-pf0-f176.google.com ([209.85.192.176]:36252 "EHLO mail-pf0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163654AbdEZGgB (ORCPT ); Fri, 26 May 2017 02:36:01 -0400 Received: by mail-pf0-f176.google.com with SMTP id m17so2579602pfg.3 for ; Thu, 25 May 2017 23:36:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+3HQbhw8C8hS/qVfO28FlT0RDc1VqoUEWuqAtucyWcc=; b=iMYyKCLPdHfLrmByuSJUaEt3m5p9jDjGfP9/WPHWMyPdfQF6SZh2hihH0IoHeHDrRX fUqQ2UlvOx6ZnzZ4oPcmMRVKKyaGyTgtMPmyK2HT5tneu+rQizZPlWXpYu9UL+q1C9z2 e5INwuXcHDL0KY9H1InraMLOuAvtRF6J9Hxvg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+3HQbhw8C8hS/qVfO28FlT0RDc1VqoUEWuqAtucyWcc=; b=CtyZjYp4BxsBF3eldM91PHf6SQeBORq2gEPDBdWrsF38yRuDUDwQIR+vXQ48iRwxw1 +P3cM/6uARSDYljg/uOfV9U6mEt6c73MpeOSiFwTwWcErivT/SUNA/K0ybckcFrSQBlS 1Ch7LINGmYqiXFUZlKg7ov05yt8rocBzqZB082y0Tr5LQecn1ynjLSpqzrU50btw+Ncm MjvrSJFT9WtJ+F3wli+ShFdcwu2yf/Ibr4I9YjvncDSraShw25xAJYm6XVMucI35rIe6 dM0j58GY39JXQOX2iRkzv91XIJ91E4J9fiFr4Q22K/z5OxfvVb/qmkJjqZRABayd67eK g7Jg== X-Gm-Message-State: AODbwcB4JM7hBen2dim2/JEjROhd4ZJK0VLcTdVme8UOrvbv+qHAAIHH F3renrkM3ukdUZza X-Received: by 10.99.112.3 with SMTP id l3mr477704pgc.13.1495780555652; Thu, 25 May 2017 23:35:55 -0700 (PDT) Received: from docularxu-ThinkPad-T440p.219.146.1.66 ([45.56.159.222]) by smtp.gmail.com with ESMTPSA id j11sm11420635pgn.38.2017.05.25.23.35.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 25 May 2017 23:35:55 -0700 (PDT) From: Guodong Xu To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, xuwei5@hisilicon.com, catalin.marinas@arm.com, will.deacon@arm.com, lgirdwood@gmail.com, broonie@kernel.org, khilman@baylibre.com, arnd@arndb.de, gregory.clement@free-electrons.com, olof@lixom.net, thomas.petazzoni@free-electrons.com, yamada.masahiro@socionext.com, riku.voipio@linaro.org, treding@nvidia.com, krzk@kernel.org, eric@anholt.net, damm+renesas@opensource.se, ard.biesheuvel@linaro.org, linus.walleij@linaro.org, geert+renesas@glider.be Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, hw.wangxiaoyin@hisilicon.com, Guodong Xu Subject: [PATCH 3/6] mfd: hi6421v530: add support for HiSilicon Hi6421v530 Date: Fri, 26 May 2017 14:35:15 +0800 Message-Id: <20170526063518.21246-4-guodong.xu@linaro.org> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170526063518.21246-1-guodong.xu@linaro.org> References: <20170526063518.21246-1-guodong.xu@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support for HiSilicon Hi6421v530 PMIC. Hi6421v530 communicates with main SoC via memory-mapped I/O. Hi6421v530 and Hi6421 are PMIC chips from the same vendor, HiSilicon, but at different revisions. They share the same memory-mapped I/O design. They differ in regulator details, eg. LDO voltage points. Signed-off-by: Guodong Xu Signed-off-by: Wang Xiaoyin --- drivers/mfd/Kconfig | 9 +++++ drivers/mfd/Makefile | 1 + drivers/mfd/hi6421v530-pmic.c | 92 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+) create mode 100644 drivers/mfd/hi6421v530-pmic.c -- 2.10.2 diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 3eb5c93..bdc8304 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -388,6 +388,15 @@ config MFD_HI6421_PMIC menus in order to enable them. We communicate with the Hi6421 via memory-mapped I/O. +config MFD_HI6421V530_PMIC + tristate "HiSilicon Hi6421v530 PMU/Codec IC" + depends on OF + select MFD_CORE + select REGMAP_MMIO + help + Add support for HiSilicon Hi6421v530 PMIC. Hi6421v530 communicates + with main SoC via memory-mapped I/O. + config MFD_HI655X_PMIC tristate "HiSilicon Hi655X series PMU/Codec IC" depends on ARCH_HISI || COMPILE_TEST diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index c16bf1e..cde62fc 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -206,6 +206,7 @@ obj-$(CONFIG_MFD_STW481X) += stw481x.o obj-$(CONFIG_MFD_IPAQ_MICRO) += ipaq-micro.o obj-$(CONFIG_MFD_MENF21BMC) += menf21bmc.o obj-$(CONFIG_MFD_HI6421_PMIC) += hi6421-pmic-core.o +obj-$(CONFIG_MFD_HI6421V530_PMIC) += hi6421v530-pmic.o obj-$(CONFIG_MFD_HI655X_PMIC) += hi655x-pmic.o obj-$(CONFIG_MFD_DLN2) += dln2.o obj-$(CONFIG_MFD_RT5033) += rt5033.o diff --git a/drivers/mfd/hi6421v530-pmic.c b/drivers/mfd/hi6421v530-pmic.c new file mode 100644 index 0000000..651659a --- /dev/null +++ b/drivers/mfd/hi6421v530-pmic.c @@ -0,0 +1,92 @@ +/* + * Device driver for Hi6421 IC + * + * Copyright (c) <2017> HiSilicon Technologies Co., Ltd. + * http://www.hisilicon.com + * Copyright (c) <2017> Linaro Ltd. + * http://www.linaro.org + * + * Author: Wang Xiaoyin + * Guodong Xu + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +static const struct mfd_cell hi6421v530_devs[] = { + { .name = "hi6421v530-regulator", }, +}; + +static int hi6421v530_pmic_probe(struct platform_device *pdev) +{ + struct hi6421_pmic *pmic; + struct resource *res; + void __iomem *base; + int ret; + + pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL); + if (!pmic) + return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(base)) + return PTR_ERR(base); + + pmic->regmap = devm_regmap_init_mmio_clk(&pdev->dev, NULL, base, + &hi6421_regmap_config); + if (IS_ERR(pmic->regmap)) { + dev_err(&pdev->dev, + "regmap init failed: %ld\n", PTR_ERR(pmic->regmap)); + return PTR_ERR(pmic->regmap); + } + + platform_set_drvdata(pdev, pmic); + + ret = devm_mfd_add_devices(&pdev->dev, 0, hi6421v530_devs, + ARRAY_SIZE(hi6421v530_devs), NULL, 0, NULL); + if (ret) { + dev_err(&pdev->dev, "add mfd devices failed: %d\n", ret); + return ret; + } + + return 0; +} + +static const struct of_device_id of_hi6421v530_pmic_match_tbl[] = { + { .compatible = "hisilicon,hi6421v530-pmic", }, + { }, +}; +MODULE_DEVICE_TABLE(of, of_hi6421v530_pmic_match_tbl); + +static struct platform_driver hi6421v530_pmic_driver = { + .driver = { + .name = "hi6421v530_pmic", + .of_match_table = of_hi6421v530_pmic_match_tbl, + }, + .probe = hi6421v530_pmic_probe, +}; +module_platform_driver(hi6421v530_pmic_driver); + +MODULE_AUTHOR("Guodong Xu "); +MODULE_DESCRIPTION("Hi6421v530 PMIC driver"); +MODULE_LICENSE("GPL v2");