Add Support for Hi6220 PMIC Hi6553 MFD Core
Subsystems (4)
v8 cover Add Support for Hi6220 PMIC Hi6553 MFD Core
The patch sets add support for Hi6220 PMIC Hi655x MFD core and its regulator driver.
Current testing and support board is Hikey which is one of 96boards. It is an arm64 open source board. For more information about this board, please access https://www.96boards.org.
This is hardware layout for access PMIC Hi655x from AP SoC Hi6220. Between PMIC Hi655x and Hi6220, the physical signal channel is SSI. We can use memory-mapped I/O to communicate.
+----------------+ +-------------+ | | | | | Hi6220 | SSI bus | Hi655x | | |-------------| | | |(REGMAP_MMIO)| | +----------------+ +-------------+
V2: Code refactoring of regulator.
V3: Drop mtcmos from this patch and use regmap-irq.
V4: Move the vset-table to driver code and donot open code for it.
V5: Use regulators_node and of_match, donot open code fot it.
V7: Change the constraints into hikey.dts and fix code in PMIC.
V8: Change format in document, and fix bit mask in regulator.
Chen Feng (5):
mfd: hi655x: Add document for mfd hi665x PMIC
regulator: hi655x: Document for hi655x regulator
mfd: hi655x: Add MFD driver for hi655x
regulator: hi655x: enable regulator for hi655x PMIC
arm64: dts: hisilicon: Add hi655x pmic dts node
.../devicetree/bindings/mfd/hisilicon,hi655x.txt | 27 +++ .../regulator/hisilicon,hi655x-regulator.txt | 29 +++ arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts | 87 ++++++++ drivers/mfd/Kconfig | 10 + drivers/mfd/Makefile | 1 + drivers/mfd/hi655x-pmic.c | 162 +++++++++++++++ drivers/regulator/Kconfig | 8 + drivers/regulator/Makefile | 1 + drivers/regulator/hi655x-regulator.c | 227 +++++++++++++++++++++ include/linux/mfd/hi655x-pmic.h | 55 +++++ 10 files changed, 607 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt create mode 100644 Documentation/devicetree/bindings/regulator/hisilicon,hi655x-regulator.txt create mode 100644 drivers/mfd/hi655x-pmic.c create mode 100644 drivers/regulator/hi655x-regulator.c create mode 100644 include/linux/mfd/hi655x-pmic.h
Signature · 1 line
1.9.1
PATCH v8 1/5 mfd: hi655x: Add document for mfd hi665x PMIC
DT bindings for hisilicon hi655x MFD PMIC chip.
--- .../devicetree/bindings/mfd/hisilicon,hi655x.txt | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +27 -0
@@ -0,0 +1,27 @@ +Hisilicon Hi655x Power Management Integrated Circuit (PMIC) + +The hardware layout for access PMIC Hi655x from AP SoC Hi6220. +Between PMIC Hi655x and Hi6220, the physical signal channel is SSI. +We can use memory-mapped I/O to communicate. + ++----------------+ +-------------+ +| | | | +| Hi6220 | SSI bus | Hi655x | +| |-------------| | +| |(REGMAP_MMIO)| | ++----------------+ +-------------+ + +Required properties: +- compatible: Should be "hisilicon,hi655x-pmic". +- reg: Base address of PMIC on Hi6220 SoC. +- interrupt-controller: Hi655x has internal IRQs (has own IRQ domain). +- pmic-gpios: The GPIO used by PMIC IRQ. + +Example: + pmic: pmic@f8000000 { + compatible = "hisilicon,hi655x-pmic"; + reg = <0x0 0xf8000000 0x0 0x1000>; + interrupt-controller; + #interrupt-cells = <2>; + pmic-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; + }
Signature · 1 line
1.9.1
Re: [PATCH v8 1/5] mfd: hi655x: Add document for mfd hi665x PMIC
Quoted 10 lines · Chen Feng
DT bindings for hisilicon hi655x MFD PMIC chip.
Signed-off-by Chen Feng <[email protected]>Signed-off-by Fei Wang <[email protected]>Signed-off-by Xinwei Kong <[email protected]>Reviewed-by Haojian Zhuang <[email protected]>--- .../devicetree/bindings/mfd/hisilicon,hi655x.txt | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt
For my own reference:
Quoted 33 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +27
-0@@ -0,0 +1,27 @@ +Hisilicon Hi655x Power Management Integrated Circuit (PMIC) + +The hardware layout for access PMIC Hi655x from AP SoC Hi6220. +Between PMIC Hi655x and Hi6220, the physical signal channel is SSI. +We can use memory-mapped I/O to communicate. + ++----------------+ +-------------+ +| | | | +| Hi6220 | SSI bus | Hi655x | +| |-------------| | +| |(REGMAP_MMIO)| | ++----------------+ +-------------+ + +Required properties: +- compatible: Should be "hisilicon,hi655x-pmic". +- reg: Base address of PMIC on Hi6220 SoC. +- interrupt-controller: Hi655x has internal IRQs (has own IRQ domain). +- pmic-gpios: The GPIO used by PMIC IRQ. + +Example: + pmic: pmic@f8000000 { + compatible = "hisilicon,hi655x-pmic"; + reg = <0x0 0xf8000000 0x0 0x1000>; + interrupt-controller; + #interrupt-cells = <2>; + pmic-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; + }
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH v8 1/5] mfd: hi655x: Add document for mfd hi665x PMIC
Lee,
Thanks for your review.
Quoted 13 lines · Lee Jones
Quoted 10 lines · Chen Feng
DT bindings for hisilicon hi655x MFD PMIC chip.
Signed-off-by Chen Feng <[email protected]>Signed-off-by Fei Wang <[email protected]>Signed-off-by Xinwei Kong <[email protected]>Reviewed-by Haojian Zhuang <[email protected]>--- .../devicetree/bindings/mfd/hisilicon,hi655x.txt | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt
Quoted 3 lines
For my own reference:
Acked-by Lee Jones <[email protected]>
Will you merge this into your git-repo?
git git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git
I saw mark already merged the part of regulator into his git tree.
Hi Wei,
Could you help merge the DTS part of these patch sets.
Quoted 34 lines
Quoted 33 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +27
-0@@ -0,0 +1,27 @@ +Hisilicon Hi655x Power Management Integrated Circuit (PMIC) + +The hardware layout for access PMIC Hi655x from AP SoC Hi6220. +Between PMIC Hi655x and Hi6220, the physical signal channel is SSI. +We can use memory-mapped I/O to communicate. + ++----------------+ +-------------+ +| | | | +| Hi6220 | SSI bus | Hi655x | +| |-------------| | +| |(REGMAP_MMIO)| | ++----------------+ +-------------+ + +Required properties: +- compatible: Should be "hisilicon,hi655x-pmic". +- reg: Base address of PMIC on Hi6220 SoC. +- interrupt-controller: Hi655x has internal IRQs (has own IRQ domain). +- pmic-gpios: The GPIO used by PMIC IRQ. + +Example: + pmic: pmic@f8000000 { + compatible = "hisilicon,hi655x-pmic"; + reg = <0x0 0xf8000000 0x0 0x1000>; + interrupt-controller; + #interrupt-cells = <2>; + pmic-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; + }
Wei Xu
maintainerRe: [PATCH v8 1/5] mfd: hi655x: Add document for mfd hi665x PMIC
Hi Leo,
Quoted 25 lines · Chen Feng
Lee,
Thanks for your review.Quoted 13 lines · Lee Jones
Quoted 10 lines · Chen Feng
DT bindings for hisilicon hi655x MFD PMIC chip.
Signed-off-by Chen Feng <[email protected]>Signed-off-by Fei Wang <[email protected]>Signed-off-by Xinwei Kong <[email protected]>Reviewed-by Haojian Zhuang <[email protected]>--- .../devicetree/bindings/mfd/hisilicon,hi655x.txt | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txtQuoted 3 lines
For my own reference:
Acked-by Lee Jones <[email protected]>Will you merge this into your git-repo?
git
git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git
Quoted 8 lines
I saw mark already merged the part of regulator into his git tree.
Hi Wei,
Could you help merge the DTS part of these patch sets.
Applied the 5th patch into the hisilicon soc tree. Thanks!
Best Regards,
Wei
Quoted 39 lines
Quoted 26 lines
Quoted 26 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +19
-0@@ -0,0 +1,27 @@ +Hisilicon Hi655x Power Management Integrated Circuit (PMIC) + +The hardware layout for access PMIC Hi655x from AP SoC Hi6220. +Between PMIC Hi655x and Hi6220, the physical signal channel is SSI. +We can use memory-mapped I/O to communicate. + ++----------------+ +-------------+ +| | | | +| Hi6220 | SSI bus | Hi655x | +| |-------------| | +| |(REGMAP_MMIO)| | ++----------------+ +-------------+ + +Required properties: +- compatible: Should be "hisilicon,hi655x-pmic". +- reg: Base address of PMIC on Hi6220 SoC. +- interrupt-controller: Hi655x has internal IRQs (has own IRQ domain). +- pmic-gpios: The GPIO used by PMIC IRQ. +Quoted 9 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 27
Quoted 8 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +8
-0+Example: + pmic: pmic@f8000000 { + compatible = "hisilicon,hi655x-pmic"; + reg = <0x0 0xf8000000 0x0 0x1000>; + interrupt-controller; + #interrupt-cells = <2>; + pmic-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; + }.
Lee Jones
AppliedRe: [PATCH v8 1/5] mfd: hi655x: Add document for mfd hi665x PMIC
In reply to Chen FengQuoted 10 lines · Chen Feng
DT bindings for hisilicon hi655x MFD PMIC chip.
Signed-off-by Chen Feng <[email protected]>Signed-off-by Fei Wang <[email protected]>Signed-off-by Xinwei Kong <[email protected]>Reviewed-by Haojian Zhuang <[email protected]>--- .../devicetree/bindings/mfd/hisilicon,hi655x.txt | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt
Applied, thanks.
Quoted 33 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +27
-0@@ -0,0 +1,27 @@ +Hisilicon Hi655x Power Management Integrated Circuit (PMIC) + +The hardware layout for access PMIC Hi655x from AP SoC Hi6220. +Between PMIC Hi655x and Hi6220, the physical signal channel is SSI. +We can use memory-mapped I/O to communicate. + ++----------------+ +-------------+ +| | | | +| Hi6220 | SSI bus | Hi655x | +| |-------------| | +| |(REGMAP_MMIO)| | ++----------------+ +-------------+ + +Required properties: +- compatible: Should be "hisilicon,hi655x-pmic". +- reg: Base address of PMIC on Hi6220 SoC. +- interrupt-controller: Hi655x has internal IRQs (has own IRQ domain). +- pmic-gpios: The GPIO used by PMIC IRQ. + +Example: + pmic: pmic@f8000000 { + compatible = "hisilicon,hi655x-pmic"; + reg = <0x0 0xf8000000 0x0 0x1000>; + interrupt-controller; + #interrupt-cells = <2>; + pmic-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; + }
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v8 2/5 regulator: hi655x: Document for hi655x regulator
In reply to Chen FengThis patch adds the device tree binding documentation for hi655x PMIC regulator.
--- .../regulator/hisilicon,hi655x-regulator.txt | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/hisilicon,hi655x-regulator.txt
Documentation/devicetree/bindings/regulator/hisilicon,hi655x-regulator.txt new file +29 -0
@@ -0,0 +1,29 @@ +Hisilicon Hi655x Voltage regulators + +Note: +The Hi655x regulator control is managed by Hi655x PMIC. +So the node of this regulator must be child node of Hi655x +PMIC node. + +The driver uses the regulator core framework, so please also +take the bindings of regulator.txt for reference. + +The valid names for regulators are: + +LDO2_2V8 LDO7_SDIO LDO10_2V85 LDO13_1V8 LDO14_2V8 +LDO15_1V8 LDO17_2V5 LDO19_3V0 LDO21_1V8 LDO22_1V2 + +Example: + pmic: pmic@f8000000 { + compatible = "hisilicon,hi655x-pmic"; + ... + regulators { + ldo2: LDO2@a21 { + regulator-name = "LDO2_2V8"; + regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <3200000>; + regulator-enable-ramp-delay = <120>; + }; + ... + } + }
Signature · 1 line
1.9.1
PATCH v8 3/5 mfd: hi655x: Add MFD driver for hi655x
In reply to Chen FengAdd PMIC MFD driver to support hisilicon hi665x.
--- drivers/mfd/Kconfig | 10 +++ drivers/mfd/Makefile | 1 + drivers/mfd/hi655x-pmic.c | 162 ++++++++++++++++++++++++++++++++++++++++ include/linux/mfd/hi655x-pmic.h | 55 ++++++++++++++ 4 files changed, 228 insertions(+) create mode 100644 drivers/mfd/hi655x-pmic.c create mode 100644 include/linux/mfd/hi655x-pmic.h
drivers/mfd/Kconfig +10 -0
@@ -284,6 +284,16 @@ config MFD_HI6421_PMIC menus in order to enable them. We communicate with the Hi6421 via memory-mapped I/O. +config MFD_HI655X_PMIC + tristate "HiSilicon Hi655X series PMU/Codec IC" + depends on ARCH_HISI || COMPILE_TEST + depends on OF + select MFD_CORE + select REGMAP_MMIO + select REGMAP_IRQ + help + Select this option to enable Hisilicon hi655x series pmic driver. + config HTC_EGPIO bool "HTC EGPIO support" depends on GPIOLIB && ARM
drivers/mfd/Makefile +1 -0
@@ -190,6 +190,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_HI655X_PMIC) += hi655x-pmic.o obj-$(CONFIG_MFD_DLN2) += dln2.o obj-$(CONFIG_MFD_RT5033) += rt5033.o obj-$(CONFIG_MFD_SKY81452) += sky81452.o
drivers/mfd/hi655x-pmic.c new file +162 -0
162 lines not on this page · raw message
include/linux/mfd/hi655x-pmic.h new file +55 -0
55 lines not on this page · raw message
Signature · 1 line
1.9.1
Lee Jones
AppliedRe: [PATCH v8 3/5] mfd: hi655x: Add MFD driver for hi655x
Quoted 7 lines · Chen Feng
Add PMIC MFD driver to support hisilicon hi665x.
Signed-off-by Chen Feng <[email protected]>Signed-off-by Fei Wang <[email protected]>Signed-off-by Xinwei Kong <[email protected]>Reviewed-by Haojian Zhuang <[email protected]>Acked-by Lee Jones <[email protected]>
Quoted 8 lines
--- drivers/mfd/Kconfig | 10 +++ drivers/mfd/Makefile | 1 + drivers/mfd/hi655x-pmic.c | 162 ++++++++++++++++++++++++++++++++++++++++ include/linux/mfd/hi655x-pmic.h | 55 ++++++++++++++ 4 files changed, 228 insertions(+) create mode 100644 drivers/mfd/hi655x-pmic.c create mode 100644 include/linux/mfd/hi655x-pmic.h
Applied, thanks.
Quoted 262 lines
drivers/mfd/Kconfig +10
-0@@ -284,6 +284,16 @@ config MFD_HI6421_PMIC menus in order to enable them. We communicate with the Hi6421 via memory-mapped I/O. +config MFD_HI655X_PMIC + tristate "HiSilicon Hi655X series PMU/Codec IC" + depends on ARCH_HISI || COMPILE_TEST + depends on OF + select MFD_CORE + select REGMAP_MMIO + select REGMAP_IRQ + help + Select this option to enable Hisilicon hi655x series pmic driver. + config HTC_EGPIO bool "HTC EGPIO support" depends on GPIOLIB && ARMdrivers/mfd/Makefile +1
-0@@ -190,6 +190,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_HI655X_PMIC) += hi655x-pmic.o obj-$(CONFIG_MFD_DLN2) += dln2.o obj-$(CONFIG_MFD_RT5033) += rt5033.o obj-$(CONFIG_MFD_SKY81452) += sky81452.odrivers/mfd/hi655x-pmic.c new file +162
-0@@ -0,0 +1,162 @@ +/* +* Device driver for MFD hi655x PMIC +* +* Copyright (c) 2016 Hisilicon. +* +* Authors: +* Chen Feng <[email protected]> +* Fei Wang <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#include <linux/gpio.h> +#include <linux/io.h> +#include <linux/interrupt.h> +#include <linux/init.h> +#include <linux/mfd/core.h> +#include <linux/mfd/hi655x-pmic.h> +#include <linux/module.h> +#include <linux/of_gpio.h> +#include <linux/of_platform.h> +#include <linux/platform_device.h> +#include <linux/regmap.h> + +static const struct mfd_cell hi655x_pmic_devs[] = { + { .name ="hi655x-regulator" , }, +}; + +static const struct regmap_irq hi655x_irqs[] = { + { .reg_offset =0 , .mask =OTMP_D1R_INT }, + { .reg_offset =0 , .mask =VSYS_2P5_R_INT }, + { .reg_offset =0 , .mask =VSYS_UV_D3R_INT }, + { .reg_offset =0 , .mask =VSYS_6P0_D200UR_INT }, + { .reg_offset =0 , .mask =PWRON_D4SR_INT }, + { .reg_offset =0 , .mask =PWRON_D20F_INT }, + { .reg_offset =0 , .mask =PWRON_D20R_INT }, + { .reg_offset =0 , .mask =RESERVE_INT }, +}; + +static const struct regmap_irq_chip hi655x_irq_chip = { + .name ="hi655x-pmic" , + .irqs = hi655x_irqs, + .num_regs =1 , + .num_irqs =ARRAY_SIZE (hi655x_irqs), + .status_base =HI655X_IRQ_STAT_BASE , + .mask_base =HI655X_IRQ_MASK_BASE , +}; + +static struct regmap_config hi655x_regmap_config = { + .reg_bits =32 , + .reg_stride =HI655X_STRIDE , + .val_bits =8 , + .max_register =HI655X_BUS_ADDR (0xFFF ), +}; + +static void hi655x_local_irq_clear (struct regmap *map) +{ +int i; + +regmap_write (map,HI655X_ANA_IRQM_BASE ,HI655X_IRQ_CLR ); +for (i =0 ; i <HI655X_IRQ_ARRAY ; i++) { +regmap_write (map,HI655X_IRQ_STAT_BASE + i *HI655X_STRIDE , +HI655X_IRQ_CLR ); + } +} + +static int hi655x_pmic_probe (struct platform_device *pdev) +{ +int ret; +struct hi655x_pmic *pmic; +struct device *dev = &pdev->dev; +struct device_node *np = dev->of_node; +void __iomem *base; + + pmic =devm_kzalloc (dev,sizeof (*pmic),GFP_KERNEL ); +if (!pmic) +return -ENOMEM ; + pmic->dev = dev; + + pmic->res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!pmic->res) +return -ENOENT ; + + base =devm_ioremap_resource (dev, pmic->res); +if (!base) +return -ENOMEM ; + + pmic->regmap =devm_regmap_init_mmio_clk (dev,NULL , base, + &hi655x_regmap_config); + +regmap_read (pmic->regmap,HI655X_BUS_ADDR (HI655X_VER_REG ), &pmic->ver); +if ((pmic->ver <PMU_VER_START ) || (pmic->ver >PMU_VER_END )) { +dev_warn (dev,"PMU version %d unsupported\n" , pmic->ver); +return -EINVAL ; + } + +hi655x_local_irq_clear (pmic->regmap); + + pmic->gpio =of_get_named_gpio (np,"pmic-gpios" ,0 ); +if (!gpio_is_valid (pmic->gpio)) { +dev_err (dev,"Failed to get the pmic-gpios\n" ); +return -ENODEV ; + } + + ret =devm_gpio_request_one (dev, pmic->gpio,GPIOF_IN , +"hi655x_pmic_irq" ); +if (ret <0 ) { +dev_err (dev,"Failed to request gpio %d ret = %d\n" , + pmic->gpio, ret); +return ret; + } + + ret =regmap_add_irq_chip (pmic->regmap,gpio_to_irq (pmic->gpio), +IRQF_TRIGGER_LOW |IRQF_NO_SUSPEND ,0 , + &hi655x_irq_chip, &pmic->irq_data); +if (ret) { +dev_err (dev,"Failed to obtain 'hi655x_pmic_irq' %d\n" , ret); +return ret; + } + +platform_set_drvdata (pdev, pmic); + + ret =mfd_add_devices (dev,PLATFORM_DEVID_AUTO , hi655x_pmic_devs, +ARRAY_SIZE (hi655x_pmic_devs),NULL ,0 ,NULL ); +if (ret) { +dev_err (dev,"Failed to register device %d\n" , ret); +regmap_del_irq_chip (gpio_to_irq (pmic->gpio), pmic->irq_data); +return ret; + } + +return 0 ; +} + +static int hi655x_pmic_remove (struct platform_device *pdev) +{ +struct hi655x_pmic *pmic =platform_get_drvdata (pdev); + +regmap_del_irq_chip (gpio_to_irq (pmic->gpio), pmic->irq_data); +mfd_remove_devices (&pdev->dev); +return 0 ; +} + +static const struct of_device_id hi655x_pmic_match[] = { + { .compatible ="hisilicon,hi655x-pmic" , }, + {}, +}; + +static struct platform_driver hi655x_pmic_driver = { + .driver = { + .name ="hi655x-pmic" , + .of_match_table =of_match_ptr (hi655x_pmic_match), + }, + .probe = hi655x_pmic_probe, + .remove = hi655x_pmic_remove, +}; +module_platform_driver (hi655x_pmic_driver); + +MODULE_AUTHOR ("Chen Feng <[email protected]>" ); +MODULE_DESCRIPTION ("Hisilicon hi655x PMIC driver" ); +MODULE_LICENSE ("GPL v2" );include/linux/mfd/hi655x-pmic.h new file +55
-0@@ -0,0 +1,55 @@ +/* +* Device driver for regulators in hi655x IC +* +* Copyright (c) 2016 Hisilicon. +* +* Authors: +* Chen Feng <[email protected]> +* Fei Wang <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef __HI655X_PMIC_H +#define __HI655X_PMIC_H + +/* Hi655x registers are mapped to memory bus in 4 bytes stride */ +#define HI655X_STRIDE 4 +#define HI655X_BUS_ADDR (x) ((x) << 2) + +#define HI655X_BITS 8 + +#define HI655X_NR_IRQ 32 + +#define HI655X_IRQ_STAT_BASE (0x003 << 2) +#define HI655X_IRQ_MASK_BASE (0x007 << 2) +#define HI655X_ANA_IRQM_BASE (0x1b5 << 2) +#define HI655X_IRQ_ARRAY 4 +#define HI655X_IRQ_MASK 0xFF +#define HI655X_IRQ_CLR 0xFF +#define HI655X_VER_REG 0x00 + +#define PMU_VER_START 0x10 +#define PMU_VER_END 0x38 + +#define RESERVE_INT BIT(7) +#define PWRON_D20R_INT BIT(6) +#define PWRON_D20F_INT BIT(5) +#define PWRON_D4SR_INT BIT(4) +#define VSYS_6P0_D200UR_INT BIT(3) +#define VSYS_UV_D3R_INT BIT(2) +#define VSYS_2P5_R_INT BIT(1) +#define OTMP_D1R_INT BIT(0) + +struct hi655x_pmic { +struct resource *res; +struct device *dev; +struct regmap *regmap; +int gpio; +unsigned int ver; +struct regmap_irq_chip_data *irq_data; +}; + +#endif
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: Re: [PATCH v8 3/5] mfd: hi655x: Add MFD driver for hi655x
Quoted 28 lines · Chen Feng
-------- Forwarded Message --------
Subject: Re: [PATCH v8 3/5] mfd: hi655x: Add MFD driver for hi655x
Date: Mon, 11 Apr 2016 11:41:06 +0100
From: Lee Jones <[email protected]>
To: Chen Feng <[email protected]>
CC: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]Quoted 7 lines · Chen Feng
Add PMIC MFD driver to support hisilicon hi665x.
Signed-off-by Chen Feng <[email protected]>Signed-off-by Fei Wang <[email protected]>Signed-off-by Xinwei Kong <[email protected]>Reviewed-by Haojian Zhuang <[email protected]>Acked-by Lee Jones <[email protected]>Quoted 8 lines
--- drivers/mfd/Kconfig | 10 +++ drivers/mfd/Makefile | 1 + drivers/mfd/hi655x-pmic.c | 162 ++++++++++++++++++++++++++++++++++++++++ include/linux/mfd/hi655x-pmic.h | 55 ++++++++++++++ 4 files changed, 228 insertions(+) create mode 100644 drivers/mfd/hi655x-pmic.c create mode 100644 include/linux/mfd/hi655x-pmic.h
Quoted 1 line
Applied, thanks.
Hi, Lee, Mark
I still didn't see this patch in linux-next (next-20160418) since your replied "Applied". Are you expecting anything else? Dependencies?
I didn't see any unsolved review comments actually. But if there is, please let us know, so I can send an updated version.
-Guodong
Quoted 275 lines
Quoted 253 lines
drivers/mfd/Kconfig +10
-0@@ -284,6 +284,16 @@ config MFD_HI6421_PMIC menus in order to enable them. We communicate with the Hi6421 via memory-mapped I/O. +config MFD_HI655X_PMIC + tristate "HiSilicon Hi655X series PMU/Codec IC" + depends on ARCH_HISI || COMPILE_TEST + depends on OF + select MFD_CORE + select REGMAP_MMIO + select REGMAP_IRQ + help + Select this option to enable Hisilicon hi655x series pmic driver. + config HTC_EGPIO bool "HTC EGPIO support" depends on GPIOLIB && ARMdrivers/mfd/Makefile +1
-0@@ -190,6 +190,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_HI655X_PMIC) += hi655x-pmic.o obj-$(CONFIG_MFD_DLN2) += dln2.o obj-$(CONFIG_MFD_RT5033) += rt5033.o obj-$(CONFIG_MFD_SKY81452) += sky81452.odrivers/mfd/hi655x-pmic.c new file +162
-0@@ -0,0 +1,162 @@ +/* +* Device driver for MFD hi655x PMIC +* +* Copyright (c) 2016 Hisilicon. +* +* Authors: +* Chen Feng <[email protected]> +* Fei Wang <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#include <linux/gpio.h> +#include <linux/io.h> +#include <linux/interrupt.h> +#include <linux/init.h> +#include <linux/mfd/core.h> +#include <linux/mfd/hi655x-pmic.h> +#include <linux/module.h> +#include <linux/of_gpio.h> +#include <linux/of_platform.h> +#include <linux/platform_device.h> +#include <linux/regmap.h> + +static const struct mfd_cell hi655x_pmic_devs[] = { + { .name ="hi655x-regulator" , }, +}; + +static const struct regmap_irq hi655x_irqs[] = { + { .reg_offset =0 , .mask =OTMP_D1R_INT }, + { .reg_offset =0 , .mask =VSYS_2P5_R_INT }, + { .reg_offset =0 , .mask =VSYS_UV_D3R_INT }, + { .reg_offset =0 , .mask =VSYS_6P0_D200UR_INT }, + { .reg_offset =0 , .mask =PWRON_D4SR_INT }, + { .reg_offset =0 , .mask =PWRON_D20F_INT }, + { .reg_offset =0 , .mask =PWRON_D20R_INT }, + { .reg_offset =0 , .mask =RESERVE_INT }, +}; + +static const struct regmap_irq_chip hi655x_irq_chip = { + .name ="hi655x-pmic" , + .irqs = hi655x_irqs, + .num_regs =1 , + .num_irqs =ARRAY_SIZE (hi655x_irqs), + .status_base =HI655X_IRQ_STAT_BASE , + .mask_base =HI655X_IRQ_MASK_BASE , +}; + +static struct regmap_config hi655x_regmap_config = { + .reg_bits =32 , + .reg_stride =HI655X_STRIDE , + .val_bits =8 , + .max_register =HI655X_BUS_ADDR (0xFFF ), +}; + +static void hi655x_local_irq_clear (struct regmap *map) +{ +int i; + +regmap_write (map,HI655X_ANA_IRQM_BASE ,HI655X_IRQ_CLR ); +for (i =0 ; i <HI655X_IRQ_ARRAY ; i++) { +regmap_write (map,HI655X_IRQ_STAT_BASE + i *HI655X_STRIDE , +HI655X_IRQ_CLR ); + } +} + +static int hi655x_pmic_probe (struct platform_device *pdev) +{ +int ret; +struct hi655x_pmic *pmic; +struct device *dev = &pdev->dev; +struct device_node *np = dev->of_node; +void __iomem *base; + + pmic =devm_kzalloc (dev,sizeof (*pmic),GFP_KERNEL ); +if (!pmic) +return -ENOMEM ; + pmic->dev = dev; + + pmic->res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!pmic->res) +return -ENOENT ; + + base =devm_ioremap_resource (dev, pmic->res); +if (!base) +return -ENOMEM ; + + pmic->regmap =devm_regmap_init_mmio_clk (dev,NULL , base, + &hi655x_regmap_config); + +regmap_read (pmic->regmap,HI655X_BUS_ADDR (HI655X_VER_REG ), &pmic->ver); +if ((pmic->ver <PMU_VER_START ) || (pmic->ver >PMU_VER_END )) { +dev_warn (dev,"PMU version %d unsupported\n" , pmic->ver); +return -EINVAL ; + } + +hi655x_local_irq_clear (pmic->regmap); + + pmic->gpio =of_get_named_gpio (np,"pmic-gpios" ,0 ); +if (!gpio_is_valid (pmic->gpio)) { +dev_err (dev,"Failed to get the pmic-gpios\n" ); +return -ENODEV ; + } + + ret =devm_gpio_request_one (dev, pmic->gpio,GPIOF_IN , +"hi655x_pmic_irq" ); +if (ret <0 ) { +dev_err (dev,"Failed to request gpio %d ret = %d\n" , + pmic->gpio, ret); +return ret; + } + + ret =regmap_add_irq_chip (pmic->regmap,gpio_to_irq (pmic->gpio), +IRQF_TRIGGER_LOW |IRQF_NO_SUSPEND ,0 , + &hi655x_irq_chip, &pmic->irq_data); +if (ret) { +dev_err (dev,"Failed to obtain 'hi655x_pmic_irq' %d\n" , ret); +return ret; + } + +platform_set_drvdata (pdev, pmic); + + ret =mfd_add_devices (dev,PLATFORM_DEVID_AUTO , hi655x_pmic_devs, +ARRAY_SIZE (hi655x_pmic_devs),NULL ,0 ,NULL ); +if (ret) { +dev_err (dev,"Failed to register device %d\n" , ret); +regmap_del_irq_chip (gpio_to_irq (pmic->gpio), pmic->irq_data); +return ret; + } + +return 0 ; +} + +static int hi655x_pmic_remove (struct platform_device *pdev) +{ +struct hi655x_pmic *pmic =platform_get_drvdata (pdev); + +regmap_del_irq_chip (gpio_to_irq (pmic->gpio), pmic->irq_data); +mfd_remove_devices (&pdev->dev); +return 0 ; +} + +static const struct of_device_id hi655x_pmic_match[] = { + { .compatible ="hisilicon,hi655x-pmic" , }, + {}, +}; + +static struct platform_driver hi655x_pmic_driver = { + .driver = { + .name ="hi655x-pmic" , + .of_match_table =of_match_ptr (hi655x_pmic_match), + }, + .probe = hi655x_pmic_probe, + .remove = hi655x_pmic_remove, +}; +module_platform_driver (hi655x_pmic_driver); + +MODULE_AUTHOR ("Chen Feng <[email protected]>" ); +MODULE_DESCRIPTION ("Hisilicon hi655x PMIC driver" ); +MODULE_LICENSE ("GPL v2" );include/linux/mfd/hi655x-pmic.h new file +45
-0@@ -0,0 +1,55 @@ +/* +* Device driver for regulators in hi655x IC +* +* Copyright (c) 2016 Hisilicon. +* +* Authors: +* Chen Feng <[email protected]> +* Fei Wang <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef __HI655X_PMIC_H +#define __HI655X_PMIC_H + +/* Hi655x registers are mapped to memory bus in 4 bytes stride */ +#define HI655X_STRIDE 4 +#define HI655X_BUS_ADDR (x) ((x) << 2) + +#define HI655X_BITS 8 + +#define HI655X_NR_IRQ 32 + +#define HI655X_IRQ_STAT_BASE (0x003 << 2) +#define HI655X_IRQ_MASK_BASE (0x007 << 2) +#define HI655X_ANA_IRQM_BASE (0x1b5 << 2) +#define HI655X_IRQ_ARRAY 4 +#define HI655X_IRQ_MASK 0xFF +#define HI655X_IRQ_CLR 0xFF +#define HI655X_VER_REG 0x00 + +#define PMU_VER_START 0x10 +#define PMU_VER_END 0x38 + +#define RESERVE_INT BIT(7) +#define PWRON_D20R_INT BIT(6) +#define PWRON_D20F_INT BIT(5) +#define PWRON_D4SR_INT BIT(4) +#define VSYS_6P0_D200UR_INT BIT(3) +#define VSYS_UV_D3R_INT BIT(2) +#define VSYS_2P5_R_INT BIT(1) +#define OTMP_D1R_INT BIT(0) +include/linux/mfd/hi655x-pmic.h line 55
Quoted 10 lines
include/linux/mfd/hi655x-pmic.h new file +10
-0+struct hi655x_pmic { +struct resource *res; +struct device *dev; +struct regmap *regmap; +int gpio; +unsigned int ver; +struct regmap_irq_chip_data *irq_data; +}; + +#endif --
Lee Jones
Linaro STMicroelectronics Landing Team LeadLinaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog.
Re: Re: [PATCH v8 3/5] mfd: hi655x: Add MFD driver for hi655x
Quoted 31 lines · Guodong Xu
Quoted 28 lines · Chen Feng
-------- Forwarded Message --------
Subject: Re: [PATCH v8 3/5] mfd: hi655x: Add MFD driver for hi655x
Date: Mon, 11 Apr 2016 11:41:06 +0100
From: Lee Jones <[email protected]>
To: Chen Feng <[email protected]>
CC: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]Quoted 7 lines · Chen Feng
Add PMIC MFD driver to support hisilicon hi665x.
Signed-off-by Chen Feng <[email protected]>Signed-off-by Fei Wang <[email protected]>Signed-off-by Xinwei Kong <[email protected]>Reviewed-by Haojian Zhuang <[email protected]>Acked-by Lee Jones <[email protected]>Quoted 8 lines
--- drivers/mfd/Kconfig | 10 +++ drivers/mfd/Makefile | 1 + drivers/mfd/hi655x-pmic.c | 162 ++++++++++++++++++++++++++++++++++++++++ include/linux/mfd/hi655x-pmic.h | 55 ++++++++++++++ 4 files changed, 228 insertions(+) create mode 100644 drivers/mfd/hi655x-pmic.c create mode 100644 include/linux/mfd/hi655x-pmic.hQuoted 1 line
Applied, thanks.
Quoted 7 lines
Hi, Lee, Mark
I still didn't see this patch in linux-next (next-20160418) since your replied "Applied". Are you expecting anything else? Dependencies?
I didn't see any unsolved review comments actually. But if there is, please let us know, so I can send an updated version.
When I applied your patch, I also added ~40 other patches. I haven't yet got around to editing and pushing them all to -next. I will put some time aside this morning in order to complete the push.
Quoted 269 lines
Quoted 269 lines
Quoted 252 lines
drivers/mfd/Kconfig +10
-0@@ -284,6 +284,16 @@ config MFD_HI6421_PMIC menus in order to enable them. We communicate with the Hi6421 via memory-mapped I/O. +config MFD_HI655X_PMIC + tristate "HiSilicon Hi655X series PMU/Codec IC" + depends on ARCH_HISI || COMPILE_TEST + depends on OF + select MFD_CORE + select REGMAP_MMIO + select REGMAP_IRQ + help + Select this option to enable Hisilicon hi655x series pmic driver. + config HTC_EGPIO bool "HTC EGPIO support" depends on GPIOLIB && ARMdrivers/mfd/Makefile +1
-0@@ -190,6 +190,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_HI655X_PMIC) += hi655x-pmic.o obj-$(CONFIG_MFD_DLN2) += dln2.o obj-$(CONFIG_MFD_RT5033) += rt5033.o obj-$(CONFIG_MFD_SKY81452) += sky81452.odrivers/mfd/hi655x-pmic.c new file +162
-0@@ -0,0 +1,162 @@ +/* +* Device driver for MFD hi655x PMIC +* +* Copyright (c) 2016 Hisilicon. +* +* Authors: +* Chen Feng <[email protected]> +* Fei Wang <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#include <linux/gpio.h> +#include <linux/io.h> +#include <linux/interrupt.h> +#include <linux/init.h> +#include <linux/mfd/core.h> +#include <linux/mfd/hi655x-pmic.h> +#include <linux/module.h> +#include <linux/of_gpio.h> +#include <linux/of_platform.h> +#include <linux/platform_device.h> +#include <linux/regmap.h> + +static const struct mfd_cell hi655x_pmic_devs[] = { + { .name ="hi655x-regulator" , }, +}; + +static const struct regmap_irq hi655x_irqs[] = { + { .reg_offset =0 , .mask =OTMP_D1R_INT }, + { .reg_offset =0 , .mask =VSYS_2P5_R_INT }, + { .reg_offset =0 , .mask =VSYS_UV_D3R_INT }, + { .reg_offset =0 , .mask =VSYS_6P0_D200UR_INT }, + { .reg_offset =0 , .mask =PWRON_D4SR_INT }, + { .reg_offset =0 , .mask =PWRON_D20F_INT }, + { .reg_offset =0 , .mask =PWRON_D20R_INT }, + { .reg_offset =0 , .mask =RESERVE_INT }, +}; + +static const struct regmap_irq_chip hi655x_irq_chip = { + .name ="hi655x-pmic" , + .irqs = hi655x_irqs, + .num_regs =1 , + .num_irqs =ARRAY_SIZE (hi655x_irqs), + .status_base =HI655X_IRQ_STAT_BASE , + .mask_base =HI655X_IRQ_MASK_BASE , +}; + +static struct regmap_config hi655x_regmap_config = { + .reg_bits =32 , + .reg_stride =HI655X_STRIDE , + .val_bits =8 , + .max_register =HI655X_BUS_ADDR (0xFFF ), +}; + +static void hi655x_local_irq_clear (struct regmap *map) +{ +int i; + +regmap_write (map,HI655X_ANA_IRQM_BASE ,HI655X_IRQ_CLR ); +for (i =0 ; i <HI655X_IRQ_ARRAY ; i++) { +regmap_write (map,HI655X_IRQ_STAT_BASE + i *HI655X_STRIDE , +HI655X_IRQ_CLR ); + } +} + +static int hi655x_pmic_probe (struct platform_device *pdev) +{ +int ret; +struct hi655x_pmic *pmic; +struct device *dev = &pdev->dev; +struct device_node *np = dev->of_node; +void __iomem *base; + + pmic =devm_kzalloc (dev,sizeof (*pmic),GFP_KERNEL ); +if (!pmic) +return -ENOMEM ; + pmic->dev = dev; + + pmic->res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!pmic->res) +return -ENOENT ; + + base =devm_ioremap_resource (dev, pmic->res); +if (!base) +return -ENOMEM ; + + pmic->regmap =devm_regmap_init_mmio_clk (dev,NULL , base, + &hi655x_regmap_config); + +regmap_read (pmic->regmap,HI655X_BUS_ADDR (HI655X_VER_REG ), &pmic->ver); +if ((pmic->ver <PMU_VER_START ) || (pmic->ver >PMU_VER_END )) { +dev_warn (dev,"PMU version %d unsupported\n" , pmic->ver); +return -EINVAL ; + } + +hi655x_local_irq_clear (pmic->regmap); + + pmic->gpio =of_get_named_gpio (np,"pmic-gpios" ,0 ); +if (!gpio_is_valid (pmic->gpio)) { +dev_err (dev,"Failed to get the pmic-gpios\n" ); +return -ENODEV ; + } + + ret =devm_gpio_request_one (dev, pmic->gpio,GPIOF_IN , +"hi655x_pmic_irq" ); +if (ret <0 ) { +dev_err (dev,"Failed to request gpio %d ret = %d\n" , + pmic->gpio, ret); +return ret; + } + + ret =regmap_add_irq_chip (pmic->regmap,gpio_to_irq (pmic->gpio), +IRQF_TRIGGER_LOW |IRQF_NO_SUSPEND ,0 , + &hi655x_irq_chip, &pmic->irq_data); +if (ret) { +dev_err (dev,"Failed to obtain 'hi655x_pmic_irq' %d\n" , ret); +return ret; + } + +platform_set_drvdata (pdev, pmic); + + ret =mfd_add_devices (dev,PLATFORM_DEVID_AUTO , hi655x_pmic_devs, +ARRAY_SIZE (hi655x_pmic_devs),NULL ,0 ,NULL ); +if (ret) { +dev_err (dev,"Failed to register device %d\n" , ret); +regmap_del_irq_chip (gpio_to_irq (pmic->gpio), pmic->irq_data); +return ret; + } + +return 0 ; +} + +static int hi655x_pmic_remove (struct platform_device *pdev) +{ +struct hi655x_pmic *pmic =platform_get_drvdata (pdev); + +regmap_del_irq_chip (gpio_to_irq (pmic->gpio), pmic->irq_data); +mfd_remove_devices (&pdev->dev); +return 0 ; +} + +static const struct of_device_id hi655x_pmic_match[] = { + { .compatible ="hisilicon,hi655x-pmic" , }, + {}, +}; + +static struct platform_driver hi655x_pmic_driver = { + .driver = { + .name ="hi655x-pmic" , + .of_match_table =of_match_ptr (hi655x_pmic_match), + }, + .probe = hi655x_pmic_probe, + .remove = hi655x_pmic_remove, +}; +module_platform_driver (hi655x_pmic_driver); + +MODULE_AUTHOR ("Chen Feng <[email protected]>" ); +MODULE_DESCRIPTION ("Hisilicon hi655x PMIC driver" ); +MODULE_LICENSE ("GPL v2" );include/linux/mfd/hi655x-pmic.h new file +45
-0@@ -0,0 +1,55 @@ +/* +* Device driver for regulators in hi655x IC +* +* Copyright (c) 2016 Hisilicon. +* +* Authors: +* Chen Feng <[email protected]> +* Fei Wang <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef __HI655X_PMIC_H +#define __HI655X_PMIC_H + +/* Hi655x registers are mapped to memory bus in 4 bytes stride */ +#define HI655X_STRIDE 4 +#define HI655X_BUS_ADDR (x) ((x) << 2) + +#define HI655X_BITS 8 + +#define HI655X_NR_IRQ 32 + +#define HI655X_IRQ_STAT_BASE (0x003 << 2) +#define HI655X_IRQ_MASK_BASE (0x007 << 2) +#define HI655X_ANA_IRQM_BASE (0x1b5 << 2) +#define HI655X_IRQ_ARRAY 4 +#define HI655X_IRQ_MASK 0xFF +#define HI655X_IRQ_CLR 0xFF +#define HI655X_VER_REG 0x00 + +#define PMU_VER_START 0x10 +#define PMU_VER_END 0x38 + +#define RESERVE_INT BIT(7) +#define PWRON_D20R_INT BIT(6) +#define PWRON_D20F_INT BIT(5) +#define PWRON_D4SR_INT BIT(4) +#define VSYS_6P0_D200UR_INT BIT(3) +#define VSYS_UV_D3R_INT BIT(2) +#define VSYS_2P5_R_INT BIT(1) +#define OTMP_D1R_INT BIT(0) +include/linux/mfd/hi655x-pmic.h line 55
Quoted 10 lines
include/linux/mfd/hi655x-pmic.h new file +10
-0+struct hi655x_pmic { +struct resource *res; +struct device *dev; +struct regmap *regmap; +int gpio; +unsigned int ver; +struct regmap_irq_chip_data *irq_data; +}; + +#endif .
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: Re: [PATCH v8 3/5] mfd: hi655x: Add MFD driver for hi655x
Quoted 38 lines · Lee Jones
Quoted 36 lines · Guodong Xu
Quoted 28 lines · Chen Feng
-------- Forwarded Message --------
Subject: Re: [PATCH v8 3/5] mfd: hi655x: Add MFD driver for hi655x
Date: Mon, 11 Apr 2016 11:41:06 +0100
From: Lee Jones <[email protected]>
To: Chen Feng <[email protected]>
CC: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]Quoted 7 lines · Chen Feng
Add PMIC MFD driver to support hisilicon hi665x.
Signed-off-by Chen Feng <[email protected]>Signed-off-by Fei Wang <[email protected]>Signed-off-by Xinwei Kong <[email protected]>Reviewed-by Haojian Zhuang <[email protected]>Acked-by Lee Jones <[email protected]>Quoted 8 lines
--- drivers/mfd/Kconfig | 10 +++ drivers/mfd/Makefile | 1 + drivers/mfd/hi655x-pmic.c | 162 ++++++++++++++++++++++++++++++++++++++++ include/linux/mfd/hi655x-pmic.h | 55 ++++++++++++++ 4 files changed, 228 insertions(+) create mode 100644 drivers/mfd/hi655x-pmic.c create mode 100644 include/linux/mfd/hi655x-pmic.hQuoted 1 line
Applied, thanks.
Hi, Lee, Mark
I still didn't see this patch in linux-next (next-20160418) since your replied "Applied". Are you expecting anything else? Dependencies?
Quoted 6 lines
Quoted 2 lines
I didn't see any unsolved review comments actually. But if there is, please let us know, so I can send an updated version.
When I applied your patch, I also added ~40 other patches. I haven't yet got around to editing and pushing them all to -next. I will put some time aside this morning in order to complete the push.
Thanks, Lee.
-Guodong
Quoted 276 lines
Quoted 262 lines
Quoted 262 lines
Quoted 262 lines
drivers/mfd/Kconfig +10
-0@@ -284,6 +284,16 @@ config MFD_HI6421_PMIC menus in order to enable them. We communicate with the Hi6421 via memory-mapped I/O. +config MFD_HI655X_PMIC + tristate "HiSilicon Hi655X series PMU/Codec IC" + depends on ARCH_HISI || COMPILE_TEST + depends on OF + select MFD_CORE + select REGMAP_MMIO + select REGMAP_IRQ + help + Select this option to enable Hisilicon hi655x series pmic driver. + config HTC_EGPIO bool "HTC EGPIO support" depends on GPIOLIB && ARMdrivers/mfd/Makefile +1
-0@@ -190,6 +190,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_HI655X_PMIC) += hi655x-pmic.o obj-$(CONFIG_MFD_DLN2) += dln2.o obj-$(CONFIG_MFD_RT5033) += rt5033.o obj-$(CONFIG_MFD_SKY81452) += sky81452.odrivers/mfd/hi655x-pmic.c new file +162
-0@@ -0,0 +1,162 @@ +/* +* Device driver for MFD hi655x PMIC +* +* Copyright (c) 2016 Hisilicon. +* +* Authors: +* Chen Feng <[email protected]> +* Fei Wang <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#include <linux/gpio.h> +#include <linux/io.h> +#include <linux/interrupt.h> +#include <linux/init.h> +#include <linux/mfd/core.h> +#include <linux/mfd/hi655x-pmic.h> +#include <linux/module.h> +#include <linux/of_gpio.h> +#include <linux/of_platform.h> +#include <linux/platform_device.h> +#include <linux/regmap.h> + +static const struct mfd_cell hi655x_pmic_devs[] = { + { .name ="hi655x-regulator" , }, +}; + +static const struct regmap_irq hi655x_irqs[] = { + { .reg_offset =0 , .mask =OTMP_D1R_INT }, + { .reg_offset =0 , .mask =VSYS_2P5_R_INT }, + { .reg_offset =0 , .mask =VSYS_UV_D3R_INT }, + { .reg_offset =0 , .mask =VSYS_6P0_D200UR_INT }, + { .reg_offset =0 , .mask =PWRON_D4SR_INT }, + { .reg_offset =0 , .mask =PWRON_D20F_INT }, + { .reg_offset =0 , .mask =PWRON_D20R_INT }, + { .reg_offset =0 , .mask =RESERVE_INT }, +}; + +static const struct regmap_irq_chip hi655x_irq_chip = { + .name ="hi655x-pmic" , + .irqs = hi655x_irqs, + .num_regs =1 , + .num_irqs =ARRAY_SIZE (hi655x_irqs), + .status_base =HI655X_IRQ_STAT_BASE , + .mask_base =HI655X_IRQ_MASK_BASE , +}; + +static struct regmap_config hi655x_regmap_config = { + .reg_bits =32 , + .reg_stride =HI655X_STRIDE , + .val_bits =8 , + .max_register =HI655X_BUS_ADDR (0xFFF ), +}; + +static void hi655x_local_irq_clear (struct regmap *map) +{ +int i; + +regmap_write (map,HI655X_ANA_IRQM_BASE ,HI655X_IRQ_CLR ); +for (i =0 ; i <HI655X_IRQ_ARRAY ; i++) { +regmap_write (map,HI655X_IRQ_STAT_BASE + i *HI655X_STRIDE , +HI655X_IRQ_CLR ); + } +} + +static int hi655x_pmic_probe (struct platform_device *pdev) +{ +int ret; +struct hi655x_pmic *pmic; +struct device *dev = &pdev->dev; +struct device_node *np = dev->of_node; +void __iomem *base; + + pmic =devm_kzalloc (dev,sizeof (*pmic),GFP_KERNEL ); +if (!pmic) +return -ENOMEM ; + pmic->dev = dev; + + pmic->res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!pmic->res) +return -ENOENT ; + + base =devm_ioremap_resource (dev, pmic->res); +if (!base) +return -ENOMEM ; + + pmic->regmap =devm_regmap_init_mmio_clk (dev,NULL , base, + &hi655x_regmap_config); + +regmap_read (pmic->regmap,HI655X_BUS_ADDR (HI655X_VER_REG ), &pmic->ver); +if ((pmic->ver <PMU_VER_START ) || (pmic->ver >PMU_VER_END )) { +dev_warn (dev,"PMU version %d unsupported\n" , pmic->ver); +return -EINVAL ; + } + +hi655x_local_irq_clear (pmic->regmap); + + pmic->gpio =of_get_named_gpio (np,"pmic-gpios" ,0 ); +if (!gpio_is_valid (pmic->gpio)) { +dev_err (dev,"Failed to get the pmic-gpios\n" ); +return -ENODEV ; + } + + ret =devm_gpio_request_one (dev, pmic->gpio,GPIOF_IN , +"hi655x_pmic_irq" ); +if (ret <0 ) { +dev_err (dev,"Failed to request gpio %d ret = %d\n" , + pmic->gpio, ret); +return ret; + } + + ret =regmap_add_irq_chip (pmic->regmap,gpio_to_irq (pmic->gpio), +IRQF_TRIGGER_LOW |IRQF_NO_SUSPEND ,0 , + &hi655x_irq_chip, &pmic->irq_data); +if (ret) { +dev_err (dev,"Failed to obtain 'hi655x_pmic_irq' %d\n" , ret); +return ret; + } + +platform_set_drvdata (pdev, pmic); + + ret =mfd_add_devices (dev,PLATFORM_DEVID_AUTO , hi655x_pmic_devs, +ARRAY_SIZE (hi655x_pmic_devs),NULL ,0 ,NULL ); +if (ret) { +dev_err (dev,"Failed to register device %d\n" , ret); +regmap_del_irq_chip (gpio_to_irq (pmic->gpio), pmic->irq_data); +return ret; + } + +return 0 ; +} + +static int hi655x_pmic_remove (struct platform_device *pdev) +{ +struct hi655x_pmic *pmic =platform_get_drvdata (pdev); + +regmap_del_irq_chip (gpio_to_irq (pmic->gpio), pmic->irq_data); +mfd_remove_devices (&pdev->dev); +return 0 ; +} + +static const struct of_device_id hi655x_pmic_match[] = { + { .compatible ="hisilicon,hi655x-pmic" , }, + {}, +}; + +static struct platform_driver hi655x_pmic_driver = { + .driver = { + .name ="hi655x-pmic" , + .of_match_table =of_match_ptr (hi655x_pmic_match), + }, + .probe = hi655x_pmic_probe, + .remove = hi655x_pmic_remove, +}; +module_platform_driver (hi655x_pmic_driver); + +MODULE_AUTHOR ("Chen Feng <[email protected]>" ); +MODULE_DESCRIPTION ("Hisilicon hi655x PMIC driver" ); +MODULE_LICENSE ("GPL v2" );include/linux/mfd/hi655x-pmic.h new file +54
-0@@ -0,0 +1,55 @@ +/* +* Device driver for regulators in hi655x IC +* +* Copyright (c) 2016 Hisilicon. +* +* Authors: +* Chen Feng <[email protected]> +* Fei Wang <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef __HI655X_PMIC_H +#define __HI655X_PMIC_H + +/* Hi655x registers are mapped to memory bus in 4 bytes stride */ +#define HI655X_STRIDE 4 +#define HI655X_BUS_ADDR (x) ((x) << 2) + +#define HI655X_BITS 8 + +#define HI655X_NR_IRQ 32 + +#define HI655X_IRQ_STAT_BASE (0x003 << 2) +#define HI655X_IRQ_MASK_BASE (0x007 << 2) +#define HI655X_ANA_IRQM_BASE (0x1b5 << 2) +#define HI655X_IRQ_ARRAY 4 +#define HI655X_IRQ_MASK 0xFF +#define HI655X_IRQ_CLR 0xFF +#define HI655X_VER_REG 0x00 + +#define PMU_VER_START 0x10 +#define PMU_VER_END 0x38 + +#define RESERVE_INT BIT(7) +#define PWRON_D20R_INT BIT(6) +#define PWRON_D20F_INT BIT(5) +#define PWRON_D4SR_INT BIT(4) +#define VSYS_6P0_D200UR_INT BIT(3) +#define VSYS_UV_D3R_INT BIT(2) +#define VSYS_2P5_R_INT BIT(1) +#define OTMP_D1R_INT BIT(0) + +struct hi655x_pmic { +struct resource *res; +struct device *dev; +struct regmap *regmap; +int gpio; +unsigned int ver; +struct regmap_irq_chip_data *irq_data; +}; +Quoted 8 lines
Quoted 8 lines
include/linux/mfd/hi655x-pmic.h line 55
Quoted 1 line
include/linux/mfd/hi655x-pmic.h new file +1
-0+#endif .
--
Lee Jones
Linaro STMicroelectronics Landing Team LeadLinaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: Re: [PATCH v8 3/5] mfd: hi655x: Add MFD driver for hi655x
In reply to Lee JonesQuoted 39 lines · Lee Jones
Quoted 36 lines · Guodong Xu
Quoted 28 lines · Chen Feng
-------- Forwarded Message --------
Subject: Re: [PATCH v8 3/5] mfd: hi655x: Add MFD driver for hi655x
Date: Mon, 11 Apr 2016 11:41:06 +0100
From: Lee Jones <[email protected]>
To: Chen Feng <[email protected]>
CC: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]Quoted 7 lines · Chen Feng
Add PMIC MFD driver to support hisilicon hi665x.
Signed-off-by Chen Feng <[email protected]>Signed-off-by Fei Wang <[email protected]>Signed-off-by Xinwei Kong <[email protected]>Reviewed-by Haojian Zhuang <[email protected]>Acked-by Lee Jones <[email protected]>Quoted 8 lines
--- drivers/mfd/Kconfig | 10 +++ drivers/mfd/Makefile | 1 + drivers/mfd/hi655x-pmic.c | 162 ++++++++++++++++++++++++++++++++++++++++ include/linux/mfd/hi655x-pmic.h | 55 ++++++++++++++ 4 files changed, 228 insertions(+) create mode 100644 drivers/mfd/hi655x-pmic.c create mode 100644 include/linux/mfd/hi655x-pmic.hQuoted 1 line
Applied, thanks.
Hi, Lee, Mark
I still didn't see this patch in linux-next (next-20160418) since your replied "Applied". Are you expecting anything else? Dependencies?
Quoted 6 lines
Quoted 2 lines
I didn't see any unsolved review comments actually. But if there is, please let us know, so I can send an updated version.
When I applied your patch, I also added ~40 other patches. I haven't yet got around to editing and pushing them all to -next. I will put some time aside this morning in order to complete the push.
Hi, Lee
As of this morning, I still cannot see hi655x in your for-mfd-next branch and in linux-next (next-20160517)
I saw this patch integrated on Apr/19:
mfd: hi655x: Add document for hi665x PMIC
But apparently missing this one:
[PATCH v8 3/5] mfd: hi655x: Add MFD driver for hi655x
Would you please have a check? Sorry if I'm asking something stupid. Look forward to seeing it in v4.7-rcs.
Thank you.
-Guodong
Quoted 277 lines
Quoted 263 lines
Quoted 263 lines
Quoted 263 lines
drivers/mfd/Kconfig +10
-0@@ -284,6 +284,16 @@ config MFD_HI6421_PMIC menus in order to enable them. We communicate with the Hi6421 via memory-mapped I/O. +config MFD_HI655X_PMIC + tristate "HiSilicon Hi655X series PMU/Codec IC" + depends on ARCH_HISI || COMPILE_TEST + depends on OF + select MFD_CORE + select REGMAP_MMIO + select REGMAP_IRQ + help + Select this option to enable Hisilicon hi655x series pmic driver. + config HTC_EGPIO bool "HTC EGPIO support" depends on GPIOLIB && ARMdrivers/mfd/Makefile +1
-0@@ -190,6 +190,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_HI655X_PMIC) += hi655x-pmic.o obj-$(CONFIG_MFD_DLN2) += dln2.o obj-$(CONFIG_MFD_RT5033) += rt5033.o obj-$(CONFIG_MFD_SKY81452) += sky81452.odrivers/mfd/hi655x-pmic.c new file +162
-0@@ -0,0 +1,162 @@ +/* +* Device driver for MFD hi655x PMIC +* +* Copyright (c) 2016 Hisilicon. +* +* Authors: +* Chen Feng <[email protected]> +* Fei Wang <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#include <linux/gpio.h> +#include <linux/io.h> +#include <linux/interrupt.h> +#include <linux/init.h> +#include <linux/mfd/core.h> +#include <linux/mfd/hi655x-pmic.h> +#include <linux/module.h> +#include <linux/of_gpio.h> +#include <linux/of_platform.h> +#include <linux/platform_device.h> +#include <linux/regmap.h> + +static const struct mfd_cell hi655x_pmic_devs[] = { + { .name ="hi655x-regulator" , }, +}; + +static const struct regmap_irq hi655x_irqs[] = { + { .reg_offset =0 , .mask =OTMP_D1R_INT }, + { .reg_offset =0 , .mask =VSYS_2P5_R_INT }, + { .reg_offset =0 , .mask =VSYS_UV_D3R_INT }, + { .reg_offset =0 , .mask =VSYS_6P0_D200UR_INT }, + { .reg_offset =0 , .mask =PWRON_D4SR_INT }, + { .reg_offset =0 , .mask =PWRON_D20F_INT }, + { .reg_offset =0 , .mask =PWRON_D20R_INT }, + { .reg_offset =0 , .mask =RESERVE_INT }, +}; + +static const struct regmap_irq_chip hi655x_irq_chip = { + .name ="hi655x-pmic" , + .irqs = hi655x_irqs, + .num_regs =1 , + .num_irqs =ARRAY_SIZE (hi655x_irqs), + .status_base =HI655X_IRQ_STAT_BASE , + .mask_base =HI655X_IRQ_MASK_BASE , +}; + +static struct regmap_config hi655x_regmap_config = { + .reg_bits =32 , + .reg_stride =HI655X_STRIDE , + .val_bits =8 , + .max_register =HI655X_BUS_ADDR (0xFFF ), +}; + +static void hi655x_local_irq_clear (struct regmap *map) +{ +int i; + +regmap_write (map,HI655X_ANA_IRQM_BASE ,HI655X_IRQ_CLR ); +for (i =0 ; i <HI655X_IRQ_ARRAY ; i++) { +regmap_write (map,HI655X_IRQ_STAT_BASE + i *HI655X_STRIDE , +HI655X_IRQ_CLR ); + } +} + +static int hi655x_pmic_probe (struct platform_device *pdev) +{ +int ret; +struct hi655x_pmic *pmic; +struct device *dev = &pdev->dev; +struct device_node *np = dev->of_node; +void __iomem *base; + + pmic =devm_kzalloc (dev,sizeof (*pmic),GFP_KERNEL ); +if (!pmic) +return -ENOMEM ; + pmic->dev = dev; + + pmic->res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!pmic->res) +return -ENOENT ; + + base =devm_ioremap_resource (dev, pmic->res); +if (!base) +return -ENOMEM ; + + pmic->regmap =devm_regmap_init_mmio_clk (dev,NULL , base, + &hi655x_regmap_config); + +regmap_read (pmic->regmap,HI655X_BUS_ADDR (HI655X_VER_REG ), &pmic->ver); +if ((pmic->ver <PMU_VER_START ) || (pmic->ver >PMU_VER_END )) { +dev_warn (dev,"PMU version %d unsupported\n" , pmic->ver); +return -EINVAL ; + } + +hi655x_local_irq_clear (pmic->regmap); + + pmic->gpio =of_get_named_gpio (np,"pmic-gpios" ,0 ); +if (!gpio_is_valid (pmic->gpio)) { +dev_err (dev,"Failed to get the pmic-gpios\n" ); +return -ENODEV ; + } + + ret =devm_gpio_request_one (dev, pmic->gpio,GPIOF_IN , +"hi655x_pmic_irq" ); +if (ret <0 ) { +dev_err (dev,"Failed to request gpio %d ret = %d\n" , + pmic->gpio, ret); +return ret; + } + + ret =regmap_add_irq_chip (pmic->regmap,gpio_to_irq (pmic->gpio), +IRQF_TRIGGER_LOW |IRQF_NO_SUSPEND ,0 , + &hi655x_irq_chip, &pmic->irq_data); +if (ret) { +dev_err (dev,"Failed to obtain 'hi655x_pmic_irq' %d\n" , ret); +return ret; + } + +platform_set_drvdata (pdev, pmic); + + ret =mfd_add_devices (dev,PLATFORM_DEVID_AUTO , hi655x_pmic_devs, +ARRAY_SIZE (hi655x_pmic_devs),NULL ,0 ,NULL ); +if (ret) { +dev_err (dev,"Failed to register device %d\n" , ret); +regmap_del_irq_chip (gpio_to_irq (pmic->gpio), pmic->irq_data); +return ret; + } + +return 0 ; +} + +static int hi655x_pmic_remove (struct platform_device *pdev) +{ +struct hi655x_pmic *pmic =platform_get_drvdata (pdev); + +regmap_del_irq_chip (gpio_to_irq (pmic->gpio), pmic->irq_data); +mfd_remove_devices (&pdev->dev); +return 0 ; +} + +static const struct of_device_id hi655x_pmic_match[] = { + { .compatible ="hisilicon,hi655x-pmic" , }, + {}, +}; + +static struct platform_driver hi655x_pmic_driver = { + .driver = { + .name ="hi655x-pmic" , + .of_match_table =of_match_ptr (hi655x_pmic_match), + }, + .probe = hi655x_pmic_probe, + .remove = hi655x_pmic_remove, +}; +module_platform_driver (hi655x_pmic_driver); + +MODULE_AUTHOR ("Chen Feng <[email protected]>" ); +MODULE_DESCRIPTION ("Hisilicon hi655x PMIC driver" ); +MODULE_LICENSE ("GPL v2" );include/linux/mfd/hi655x-pmic.h new file +54
-0@@ -0,0 +1,55 @@ +/* +* Device driver for regulators in hi655x IC +* +* Copyright (c) 2016 Hisilicon. +* +* Authors: +* Chen Feng <[email protected]> +* Fei Wang <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef __HI655X_PMIC_H +#define __HI655X_PMIC_H + +/* Hi655x registers are mapped to memory bus in 4 bytes stride */ +#define HI655X_STRIDE 4 +#define HI655X_BUS_ADDR (x) ((x) << 2) + +#define HI655X_BITS 8 + +#define HI655X_NR_IRQ 32 + +#define HI655X_IRQ_STAT_BASE (0x003 << 2) +#define HI655X_IRQ_MASK_BASE (0x007 << 2) +#define HI655X_ANA_IRQM_BASE (0x1b5 << 2) +#define HI655X_IRQ_ARRAY 4 +#define HI655X_IRQ_MASK 0xFF +#define HI655X_IRQ_CLR 0xFF +#define HI655X_VER_REG 0x00 + +#define PMU_VER_START 0x10 +#define PMU_VER_END 0x38 + +#define RESERVE_INT BIT(7) +#define PWRON_D20R_INT BIT(6) +#define PWRON_D20F_INT BIT(5) +#define PWRON_D4SR_INT BIT(4) +#define VSYS_6P0_D200UR_INT BIT(3) +#define VSYS_UV_D3R_INT BIT(2) +#define VSYS_2P5_R_INT BIT(1) +#define OTMP_D1R_INT BIT(0) + +struct hi655x_pmic { +struct resource *res; +struct device *dev; +struct regmap *regmap; +int gpio; +unsigned int ver; +struct regmap_irq_chip_data *irq_data; +}; +Quoted 8 lines
Quoted 8 lines
include/linux/mfd/hi655x-pmic.h line 55
Quoted 1 line
include/linux/mfd/hi655x-pmic.h new file +1
-0+#endif .
--
Lee Jones
Linaro STMicroelectronics Landing Team LeadLinaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v8 4/5 regulator: hi655x: enable regulator for hi655x PMIC
In reply to Chen FengAdd the regulator driver for hi655x PMIC.
--- drivers/regulator/Kconfig | 8 ++ drivers/regulator/Makefile | 1 + drivers/regulator/hi655x-regulator.c | 227 +++++++++++++++++++++++++++++++++++ 3 files changed, 236 insertions(+) create mode 100644 drivers/regulator/hi655x-regulator.c
drivers/regulator/Kconfig +8 -0
@@ -261,6 +261,14 @@ config REGULATOR_HI6421 21 general purpose LDOs, 3 dedicated LDOs, and 5 BUCKs. All of them come with support to either ECO (idle) or sleep mode. +config REGULATOR_HI655X + tristate "Hisilicon HI655X PMIC regulators support" + depends on ARCH_HISI || COMPILE_TEST + depends on MFD_HI655X_PMIC && OF + help + This driver provides support for the voltage regulators of the + Hisilicon Hi655x PMIC device. + config REGULATOR_ISL9305 tristate "Intersil ISL9305 regulator" depends on I2C
drivers/regulator/Makefile +1 -0
@@ -34,6 +34,7 @@ obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o obj-$(CONFIG_REGULATOR_FAN53555) += fan53555.o obj-$(CONFIG_REGULATOR_GPIO) += gpio-regulator.o obj-$(CONFIG_REGULATOR_HI6421) += hi6421-regulator.o +obj-$(CONFIG_REGULATOR_HI655X) += hi655x-regulator.o obj-$(CONFIG_REGULATOR_ISL6271A) += isl6271a-regulator.o obj-$(CONFIG_REGULATOR_ISL9305) += isl9305.o obj-$(CONFIG_REGULATOR_LM363X) += lm363x-regulator.o
drivers/regulator/hi655x-regulator.c new file +227 -0
227 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v8 5/5 arm64: dts: hisilicon: Add hi655x pmic dts node
In reply to Chen FengAdd the mfd hi655x dts node and regulator support on hi6220 platform.
--- arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts | 87 ++++++++++++++++++++++++++ 1 file changed, 87 insertions(+)
arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts +87 -0
@@ -6,6 +6,7 @@ */ /dts-v1/; +#include <dt-bindings/gpio/gpio.h> /*Reserved 1MB memory for MCU*/ /memreserve/ 0x05e00000 0x00100000;
@@ -31,6 +32,92 @@ device_type = "memory"; reg = <0x0 0x0 0x0 0x40000000>; }; + + pmic: pmic@f8000000 { + compatible = "hisilicon,hi655x-pmic"; + reg = <0x0 0xf8000000 0x0 0x1000>; + interrupt-controller; + #interrupt-cells = <2>; + pmic-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; + status = "okay"; + + regulators { + ldo2: LDO2@a21 { + regulator-name = "LDO2_2V8"; + regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <3200000>; + regulator-enable-ramp-delay = <120>; + }; + + ldo7: LDO7@a26 { + regulator-name = "LDO7_SDIO"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-enable-ramp-delay = <120>; + }; + + ldo10: LDO10@a29 { + regulator-name = "LDO10_2V85"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + regulator-enable-ramp-delay = <360>; + }; + + ldo13: LDO13@a32 { + regulator-name = "LDO13_1V8"; + regulator-min-microvolt = <1600000>; + regulator-max-microvolt = <1950000>; + regulator-enable-ramp-delay = <120>; + }; + + ldo14: LDO14@a33 { + regulator-name = "LDO14_2V8"; + regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <3200000>; + regulator-enable-ramp-delay = <120>; + }; + + ldo15: LDO15@a34 { + regulator-name = "LDO15_1V8"; + regulator-min-microvolt = <1600000>; + regulator-max-microvolt = <1950000>; + regulator-boot-on; + regulator-always-on; + regulator-enable-ramp-delay = <120>; + }; + + ldo17: LDO17@a36 { + regulator-name = "LDO17_2V5"; + regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <3200000>; + regulator-enable-ramp-delay = <120>; + }; + + ldo19: LDO19@a38 { + regulator-name = "LDO19_3V0"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + regulator-enable-ramp-delay = <360>; + }; + + ldo21: LDO21@a40 { + regulator-name = "LDO21_1V8"; + regulator-min-microvolt = <1650000>; + regulator-max-microvolt = <2000000>; + regulator-always-on; + regulator-enable-ramp-delay = <120>; + }; + + ldo22: LDO22@a41 { + regulator-name = "LDO22_1V2"; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <1200000>; + regulator-boot-on; + regulator-always-on; + regulator-enable-ramp-delay = <120>; + }; + }; + }; }; &uart2 {
Signature · 1 line
1.9.1
Quoted 27 lines · Chen Feng
The patch sets add support for Hi6220 PMIC Hi655x MFD core and its regulator driver.
Current testing and support board is Hikey which is one of 96boards. It is an arm64 open source board. For more information about this board, please access https://www.96boards.org.This is hardware layout for access PMIC Hi655x from AP SoC Hi6220. Between PMIC Hi655x and Hi6220, the physical signal channel is SSI. We can use memory-mapped I/O to communicate.
+----------------+ +-------------+ | | | | | Hi6220 | SSI bus | Hi655x | | |-------------| | | |(REGMAP_MMIO)| | +----------------+ +-------------+V2: Code refactoring of regulator.
V3: Drop mtcmos from this patch and use regmap-irq.
V4: Move the vset-table to driver code and donot open code for it.
V5: Use
regulators_nodeandof_match, donot open code fot it.V7: Change the constraints into
hikey.dtsand fix code in PMIC.
Quoted 8 lines
V8: Change format in document, and fix bit mask in regulator.
Chen Feng (5):
mfd: hi655x: Add document for mfd hi665x PMIC
regulator: hi655x: Document for hi655x regulator
mfd: hi655x: Add MFD driver for hi655x
regulator: hi655x: enable regulator for hi655x PMIC
arm64: dts: hisilicon: Add hi655x pmic dts node
So what's going on with this set? Can the MFD patches go in via my tree on their own? Or are there dependencies between them and the Regulator changes? If the latter, then we need Mark's Ack to proceed.
Quoted 17 lines
.../devicetree/bindings/mfd/hisilicon,hi655x.txt | 27 +++ .../regulator/hisilicon,hi655x-regulator.txt | 29 +++ arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts | 87 ++++++++ drivers/mfd/Kconfig | 10 + drivers/mfd/Makefile | 1 + drivers/mfd/hi655x-pmic.c | 162 +++++++++++++++ drivers/regulator/Kconfig | 8 + drivers/regulator/Makefile | 1 + drivers/regulator/hi655x-regulator.c | 227 +++++++++++++++++++++ include/linux/mfd/hi655x-pmic.h | 55 +++++ 10 files changed, 607 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt create mode 100644 Documentation/devicetree/bindings/regulator/hisilicon,hi655x-regulator.txt create mode 100644 drivers/mfd/hi655x-pmic.c create mode 100644 drivers/regulator/hi655x-regulator.c create mode 100644 include/linux/mfd/hi655x-pmic.h
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Hi lee,
Mark already took the regulator set.
Please help take the mfd part.
mfd: hi655x: Add document for mfd hi665x PMIC
and
mfd: hi655x: Add MFD driver for hi655x
thanks a lot.
Quoted 61 lines · Lee Jones
Quoted 27 lines · Chen Feng
The patch sets add support for Hi6220 PMIC Hi655x MFD core and its regulator driver.
Current testing and support board is Hikey which is one of 96boards. It is an arm64 open source board. For more information about this board, please access https://www.96boards.org.This is hardware layout for access PMIC Hi655x from AP SoC Hi6220. Between PMIC Hi655x and Hi6220, the physical signal channel is SSI. We can use memory-mapped I/O to communicate.
+----------------+ +-------------+ | | | | | Hi6220 | SSI bus | Hi655x | | |-------------| | | |(REGMAP_MMIO)| | +----------------+ +-------------+V2: Code refactoring of regulator.
V3: Drop mtcmos from this patch and use regmap-irq.
V4: Move the vset-table to driver code and donot open code for it.
V5: Use
regulators_nodeandof_match, donot open code fot it.V7: Change the constraints into
hikey.dtsand fix code in PMIC.Quoted 8 lines
V8: Change format in document, and fix bit mask in regulator.
Chen Feng (5):
mfd: hi655x: Add document for mfd hi665x PMIC
regulator: hi655x: Document for hi655x regulator
mfd: hi655x: Add MFD driver for hi655x
regulator: hi655x: enable regulator for hi655x PMIC
arm64: dts: hisilicon: Add hi655x pmic dts nodeSo what's going on with this set? Can the MFD patches go in via my tree on their own? Or are there dependencies between them and the Regulator changes? If the latter, then we need Mark's Ack to proceed.
Quoted 17 lines
.../devicetree/bindings/mfd/hisilicon,hi655x.txt | 27 +++ .../regulator/hisilicon,hi655x-regulator.txt | 29 +++ arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts | 87 ++++++++ drivers/mfd/Kconfig | 10 + drivers/mfd/Makefile | 1 + drivers/mfd/hi655x-pmic.c | 162 +++++++++++++++ drivers/regulator/Kconfig | 8 + drivers/regulator/Makefile | 1 + drivers/regulator/hi655x-regulator.c | 227 +++++++++++++++++++++ include/linux/mfd/hi655x-pmic.h | 55 +++++ 10 files changed, 607 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt create mode 100644 Documentation/devicetree/bindings/regulator/hisilicon,hi655x-regulator.txt create mode 100644 drivers/mfd/hi655x-pmic.c create mode 100644 drivers/regulator/hi655x-regulator.c create mode 100644 include/linux/mfd/hi655x-pmic.h