Add Support for Hi6220 PMIC Hi6553 MFD Core
Subsystems (4)
v5 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 of_match to get dt-data
Chen Feng (5):
doc: bindings: Add document for mfd hi665x PMIC
doc: bindings: Document for hi655x regulator driver
mfd: hi655x: Add hi665x pmic driver
regulator: add regulator driver of hi655x pmic hisilicon/dts: Add hi655x pmic dts node
.../devicetree/bindings/mfd/hisilicon,hi655x.txt | 28 +++ .../regulator/hisilicon,hi655x-regulator.txt | 30 +++ arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts | 5 + arch/arm64/boot/dts/hisilicon/hi6220.dtsi | 102 ++++++++ drivers/mfd/Kconfig | 10 + drivers/mfd/Makefile | 1 + drivers/mfd/hi655x-pmic.c | 169 ++++++++++++++ drivers/regulator/Kconfig | 8 + drivers/regulator/Makefile | 1 + drivers/regulator/hi655x-regulator.c | 256 +++++++++++++++++++++ include/linux/mfd/hi655x-pmic.h | 56 +++++ 11 files changed, 666 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 v5 1/5 doc: bindings: Add document for mfd hi665x PMIC
Add document for mfd driver hi655x pmic driver
--- .../devicetree/bindings/mfd/hisilicon,hi655x.txt | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +28 -0
@@ -0,0 +1,28 @@ +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-cells = <2>; + interrupt-controller; + pmic-gpios = <&gpio1 2 0>; + status = "disabled"; + }
Signature · 1 line
1.9.1
Re: [PATCH v5 1/5] doc: bindings: Add document for mfd hi665x PMIC
Quoted 22 lines · Chen Feng
Add document for mfd driver hi655x pmic driver
Signed-off-by Chen Feng <[email protected]>Signed-off-by Fei Wang <[email protected]>Signed-off-by Xinwei Kong <[email protected]>--- .../devicetree/bindings/mfd/hisilicon,hi655x.txt | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txtDocumentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +6
-0@@ -0,0 +1,28 @@ +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. +
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 16
Quoted 10 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +10
-0++----------------+ +-------------+ +| | | | +| Hi6220 | SSI bus | Hi655x | +| |-------------| | +| |(REGMAP_MMIO)| | ++----------------+ +-------------+ + +Required properties: +- compatible: Should be "hisilicon,hi655x-pmic" +- reg: Base address of PMIC on hi6220 soc
SoC
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 18
Quoted 2 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +2
-0+- interrupt-controller: Hi655x has internal IRQs (has own IRQ domain). +- pmic-gpios: The gpio used by pmic irq.
PMIC IRQ
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 26
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-cells = <2>; + interrupt-controller; + pmic-gpios = <&gpio1 2 0>;
What's the last cell for here? If they are flags, there is probably a #define you can use in dt-include.
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 27
Quoted 1 line
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +1
-0+ status = "disabled";
What's the point in disabling example code?
Quoted 1 line
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +1
-0+ }
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 v5 1/5] doc: bindings: Add document for mfd hi665x PMIC
Quoted 42 lines · Lee Jones
Quoted 22 lines · Chen Feng
Add document for mfd driver hi655x pmic driver
Signed-off-by Chen Feng <[email protected]>Signed-off-by Fei Wang <[email protected]>Signed-off-by Xinwei Kong <[email protected]>--- .../devicetree/bindings/mfd/hisilicon,hi655x.txt | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txtDocumentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +6
-0@@ -0,0 +1,28 @@ +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. +Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 16
Quoted 10 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +10
-0++----------------+ +-------------+ +| | | | +| Hi6220 | SSI bus | Hi655x | +| |-------------| | +| |(REGMAP_MMIO)| | ++----------------+ +-------------+ + +Required properties: +- compatible: Should be "hisilicon,hi655x-pmic" +- reg: Base address of PMIC on hi6220 socSoC
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 18
Quoted 2 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +2
-0+- interrupt-controller: Hi655x has internal IRQs (has own IRQ domain). +- pmic-gpios: The gpio used by pmic irq.PMIC IRQ
Quoted 11 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 26
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-cells = <2>; + interrupt-controller; + pmic-gpios = <&gpio1 2 0>;What's the last cell for here? If they are flags, there is probably a #define you can use in dt-include.
ok, I will use the irq flag in dt-include.
Quoted 4 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 27
Quoted 2 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +1
-0+ status = "disabled";What's the point in disabling example code?
It's just copy from the dts, I will drop this.
Quoted 3 lines
Quoted 2 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +1
-0+ }
PATCH v5 2/5 doc: bindings: Document for hi655x regulator driver
In reply to Chen FengAdd Document for hi655x pmic regulator driver
--- .../regulator/hisilicon,hi655x-regulator.txt | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/hisilicon,hi655x-regulator.txt
Documentation/devicetree/bindings/regulator/hisilicon,hi655x-regulator.txt new file +30 -0
@@ -0,0 +1,30 @@ +Hisilicon Hi655x Voltage regulators + +Note: +The hi655x regulator control is managed by hi655x Power IC. +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 ldo7 ldo10 ldo13 ldo14 ldo15 ldo17 ldo19 ldo21 ldo22 + +Example: + pmic: pmic@f8000000 { + compatible = "hisilicon,hi655x-pmic"; + ... + regulators { + ldo2: ldo2@a21 { + compatible = "hisilicon,hi655x-regulator"; + regulator-name = "ldo2"; + regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <3200000>; + regulator-valid-modes-mask = <0x02>; + regulator-enable-ramp-delay = <120>; + }; + ... + } + }
Signature · 1 line
1.9.1
Mark Brown
maintainerRe: [PATCH v5 2/5] doc: bindings: Document for hi655x regulator driver
Quoted 1 line · Chen Feng
Add Document for hi655x pmic regulator driver
As I said in reply to v4:
| Please also use subject lines reflecting the normal style for the | subsystem.
Re: [PATCH v5 2/5] doc: bindings: Document for hi655x regulator driver
Mark,
Quoted 8 lines · Mark Brown
Quoted 1 line · Chen Feng
Add Document for hi655x pmic regulator driver
As I said in reply to v4:
| Please also use subject lines reflecting the normal style for the | subsystem.
Sorry, I don't understand your Prior advice.
I will change it like this.
regulator: hisilicon: Add Document for hi655x PMIC regulator
PATCH v5 3/5 mfd: hi655x: Add hi665x pmic driver
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 | 169 ++++++++++++++++++++++++++++++++++++++++ include/linux/mfd/hi655x-pmic.h | 56 +++++++++++++ 4 files changed, 236 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 && ARM64) + 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
@@ -186,6 +186,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 +169 -0
169 lines not on this page · raw message
include/linux/mfd/hi655x-pmic.h new file +56 -0
56 lines not on this page · raw message
Signature · 1 line
1.9.1
Re: [PATCH v5 3/5] mfd: hi655x: Add hi665x pmic driver
Quoted 1 line · Chen Feng
Add pmic mfd driver to support hisilicon hi665x.
PMIC MFD
Quoted 17 lines
Signed-off-by Chen Feng <[email protected]>Signed-off-by Fei Wang <[email protected]>Signed-off-by Xinwei Kong <[email protected]>--- drivers/mfd/Kconfig | 10 +++ drivers/mfd/Makefile | 1 + drivers/mfd/hi655x-pmic.c | 169 ++++++++++++++++++++++++++++++++++++++++ include/linux/mfd/hi655x-pmic.h | 56 +++++++++++++ 4 files changed, 236 insertions(+) create mode 100644 drivers/mfd/hi655x-pmic.c create mode 100644 include/linux/mfd/hi655x-pmic.hdrivers/mfd/Kconfig +0
-0
drivers/mfd/Kconfig config MFD_HI6421_PMIC · line 289
Quoted 6 lines
drivers/mfd/Kconfig +3
-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 && ARM64)
Why not just COMPILE_TEST?
drivers/mfd/Kconfig config MFD_HI6421_PMIC · line 290
Quoted 1 line
drivers/mfd/Kconfig +1
-0+ depends on OF
So this will not COMPILE_TEST if OF is not enabled.
Quoted 27 lines
drivers/mfd/Kconfig +6
-0+ 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@@ -186,6 +186,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 +0
-0
drivers/mfd/hi655x-pmic.c line 2
Quoted 2 lines
drivers/mfd/hi655x-pmic.c new file +2
-0@@ -0,0 +1,169 @@ +/* +* Device driver for regulators in hi655x IC
We know it's a device driver. And I hope it's not a regulator driver.
drivers/mfd/hi655x-pmic.c line 7
Quoted 4 lines
drivers/mfd/hi655x-pmic.c new file +4
-0+* Copyright (c) 2016 Hisilicon. +* +* Chen Feng <[email protected]> +* Fei Wang <[email protected]>
Author(s):
Quoted 5 lines
drivers/mfd/hi655x-pmic.c new file +5
-0+* 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. +*/ +
drivers/mfd/hi655x-pmic.c line 23
Quoted 10 lines
drivers/mfd/hi655x-pmic.c new file +10
-0+#include <linux/io.h> +#include <linux/interrupt.h> +#include <linux/init.h> +#include <linux/gpio.h> +#include <linux/of_gpio.h> +#include <linux/platform_device.h> +#include <linux/of_platform.h> +#include <linux/mfd/core.h> +#include <linux/mfd/hi655x-pmic.h> +#include <linux/regmap.h>
Alphabetical please.
drivers/mfd/hi655x-pmic.c line 27
Quoted 3 lines
drivers/mfd/hi655x-pmic.c new file +3
-0+static const struct mfd_cell hi655x_pmic_devs[] = { + { .name ="hi655x-regulator" , }, +};
What other devices are there?
Quoted 19 lines
drivers/mfd/hi655x-pmic.c new file +19
-0+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 , +};
drivers/mfd/hi655x-pmic.c line 57
Quoted 10 lines
drivers/mfd/hi655x-pmic.c new file +10
-0+ +static unsigned int hi655x_pmic_get_version (struct hi655x_pmic *pmic) +{ +u32 val; + +regmap_read (pmic->regmap, +HI655X_BUS_ADDR (HI655X_VER_REG ), &val); + +return val; +}
This is a small function that you only use once.
Probably better just to call regmap_read() directly from below.
Quoted 17 lines
drivers/mfd/hi655x-pmic.c new file +17
-0+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 ); + } +}
drivers/mfd/hi655x-pmic.c line 85
Quoted 10 lines
drivers/mfd/hi655x-pmic.c new file +10
-0+ +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 );
You need a NULL check here.
drivers/mfd/hi655x-pmic.c line 90
Quoted 5 lines
drivers/mfd/hi655x-pmic.c new file +5
-0+ pmic->dev = dev; + + pmic->res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!pmic->res) { +dev_err (dev,"platform_get_resource err\n" );
This is not a good error message.
Besides, we don't normally try to catch this error, as it's checked for you in devm_ioremap_resource().
drivers/mfd/hi655x-pmic.c line 87
Quoted 2 lines
drivers/mfd/hi655x-pmic.c new file +2
-0+return -ENOENT ; + }
'\n' here.
drivers/mfd/hi655x-pmic.c line 95
Quoted 3 lines
drivers/mfd/hi655x-pmic.c new file +3
-0+ base =devm_ioremap_resource (dev, pmic->res); +if (!base) { +dev_err (dev,"cannot map register memory\n" );
devm_ioremap_resource() already prints a message on error. No need for this.
drivers/mfd/hi655x-pmic.c line 99
Quoted 4 lines
drivers/mfd/hi655x-pmic.c new file +4
-0+return -ENOMEM ; + } + pmic->regmap =devm_regmap_init_mmio_clk (dev,NULL , base, + &hi655x_regmap_config);
You need to check for an error here.
drivers/mfd/hi655x-pmic.c line 103
Quoted 3 lines
drivers/mfd/hi655x-pmic.c new file +3
-0+ pmic->ver =hi655x_pmic_get_version (pmic); +if ((pmic->ver <PMU_VER_START ) || (pmic->ver >PMU_VER_END )) { +dev_warn (dev,"it is wrong pmu version\n" );
You can't issue a _warn, then return an error. Please use _err.
... and change to "PMU version %d unsupported".
Quoted 5 lines
drivers/mfd/hi655x-pmic.c new file +5
-0+return -EINVAL ; + } + +hi655x_local_irq_clear (pmic->regmap); +
drivers/mfd/hi655x-pmic.c line 118
Quoted 10 lines
drivers/mfd/hi655x-pmic.c new file +10
-0+ pmic->gpio =of_get_named_gpio (np,"pmic-gpios" ,0 ); +if (!gpio_is_valid (pmic->gpio)) { +dev_err (dev,"cannot 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",
More readable if you use the IRQ name, as you know it.
"Failed to obtain 'hi655x_pmic_irq'"
drivers/mfd/hi655x-pmic.c line 131
Quoted 13 lines
drivers/mfd/hi655x-pmic.c new file +13
-0+ 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,"add pmic irq chip error! ret %d\n" , ret); +return ret; + } + +/* bind pmic to device */
"Bind PMIC to device"
It would be better if you dropped the comment completely to be honest.
drivers/mfd/hi655x-pmic.c line 134
Quoted 3 lines
drivers/mfd/hi655x-pmic.c new file +3
-0+platform_set_drvdata (pdev, pmic); + + ret = mfd_add_devices(dev, 0, hi655x_pmic_devs,
Please use the #defines for the second parameter.
drivers/mfd/hi655x-pmic.c line 137
Quoted 3 lines
drivers/mfd/hi655x-pmic.c new file +3
-0+ ARRAY_SIZE(hi655x_pmic_devs), NULL, 0, NULL); +if (ret) { +dev_err (dev,"add mfd devices failed: %d\n" , ret);
"Failed to register device".
Quoted 13 lines
drivers/mfd/hi655x-pmic.c new file +13
-0+regmap_del_irq_chip (pmic->irq, pmic->irq_data); +return ret; + } + +return 0 ; +} + +static int hi655x_pmic_remove (struct platform_device *pdev) +{ +mfd_remove_devices (&pdev->dev); + +return 0 ; +}
drivers/mfd/hi655x-pmic.c line 160
Quoted 10 lines
drivers/mfd/hi655x-pmic.c new file +10
-0+ +static const struct of_device_id of_hi655x_pmic_match_tbl[] = { + { .compatible ="hisilicon,hi655x-pmic" , }, + {}, +}; + +static struct platform_driver hi655x_pmic_driver = { + .driver = { + .name ="hi655x-pmic" , + .of_match_table = of_hi655x_pmic_match_tbl,
of_match_ptr()
drivers/mfd/hi655x-pmic.c line 168
Quoted 8 lines
drivers/mfd/hi655x-pmic.c new file +8
-0+ }, + .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" );
PMIC
Quoted 7 lines
drivers/mfd/hi655x-pmic.c new file +1
-0+MODULE_LICENSE ("GPL v2" );include/linux/mfd/hi655x-pmic.h new file +0
-0
include/linux/mfd/hi655x-pmic.h line 7
Quoted 7 lines
include/linux/mfd/hi655x-pmic.h new file +7
-0@@ -0,0 +1,56 @@ +/* +* Device driver for regulators in hi655x IC +* +* Copyright (c) 2016 Hisilicon. +* +* Chen Feng <[email protected]> +* Fei Wang <[email protected]>
Author(s):
Quoted 25 lines
include/linux/mfd/hi655x-pmic.h new file +25
-0+* 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)
include/linux/mfd/hi655x-pmic.h line 43
Quoted 10 lines
include/linux/mfd/hi655x-pmic.h new file +10
-0+#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))
No need for the extra ()'s
include/linux/mfd/hi655x-pmic.h line 49
Quoted 5 lines
include/linux/mfd/hi655x-pmic.h new file +5
-0+struct hi655x_pmic { +struct resource *res; +struct device *dev; +struct regmap *regmap; +struct clk *clk;
Is this used?
include/linux/mfd/hi655x-pmic.h line 54
Quoted 5 lines
include/linux/mfd/hi655x-pmic.h new file +5
-0+int irq; +int gpio; +unsigned int ver; +struct regmap_irq_chip_data *irq_data; +};
Check to see if they are all used.
Quoted 1 line
include/linux/mfd/hi655x-pmic.h new file +1
-0+#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: [PATCH v5 3/5] mfd: hi655x: Add hi665x pmic driver
Quoted 6 lines · Lee Jones
Quoted 1 line · Chen Feng
Add pmic mfd driver to support hisilicon hi665x.
PMIC MFD
ok.
Quoted 20 lines
Quoted 20 lines
Signed-off-by Chen Feng <[email protected]>Signed-off-by Fei Wang <[email protected]>Signed-off-by Xinwei Kong <[email protected]>--- drivers/mfd/Kconfig | 10 +++ drivers/mfd/Makefile | 1 + drivers/mfd/hi655x-pmic.c | 169 ++++++++++++++++++++++++++++++++++++++++ include/linux/mfd/hi655x-pmic.h | 56 +++++++++++++ 4 files changed, 236 insertions(+) create mode 100644 drivers/mfd/hi655x-pmic.c create mode 100644 include/linux/mfd/hi655x-pmic.hdrivers/mfd/Kconfig +0
-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.
Quoted 5 lines
drivers/mfd/Kconfig config MFD_HI6421_PMIC · line 289
Quoted 3 lines
drivers/mfd/Kconfig +3
-0+config MFD_HI655X_PMIC + tristate "HiSilicon Hi655X series PMU/Codec IC" + depends on ARCH_HISI || (COMPILE_TEST && ARM64)Why not just
COMPILE_TEST?
ok, the V6 already just COMPILE_TEST.
Quoted 28 lines
drivers/mfd/Kconfig config MFD_HI6421_PMIC · line 290
Quoted 2 lines
drivers/mfd/Kconfig +1
-0+ depends on OFSo this will not
COMPILE_TESTif OF is not enabled.Quoted 23 lines
drivers/mfd/Kconfig +6
-0+ 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@@ -186,6 +186,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 +0
-0
Quoted 9 lines
drivers/mfd/hi655x-pmic.c line 2
Quoted 6 lines
index 0000000..aab18f7
drivers/mfd/hi655x-pmic.c new file +2
-0@@ -0,0 +1,169 @@ +/* +* Device driver for regulators in hi655x IC We know it's a device driver. And I hope it's not a regulator driver.
ok, I will change the name.
Quoted 7 lines
drivers/mfd/hi655x-pmic.c line 7
Quoted 4 lines
drivers/mfd/hi655x-pmic.c new file +4
-0+* Copyright (c) 2016 Hisilicon. +* +* Chen Feng <[email protected]> +* Fei Wang <[email protected]> Author(s):
ok.
Quoted 9 lines
Quoted 9 lines
drivers/mfd/hi655x-pmic.c new file +9
-0+* 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/io.h> +#include <linux/interrupt.h> +#include <linux/init.h> +#include <linux/gpio.h>
Quoted 9 lines
drivers/mfd/hi655x-pmic.c line 23
Quoted 6 lines
drivers/mfd/hi655x-pmic.c new file +6
-0+#include <linux/of_gpio.h> +#include <linux/platform_device.h> +#include <linux/of_platform.h> +#include <linux/mfd/core.h> +#include <linux/mfd/hi655x-pmic.h> +#include <linux/regmap.h> Alphabetical please.
ok.
Quoted 6 lines
drivers/mfd/hi655x-pmic.c line 27
Quoted 3 lines
drivers/mfd/hi655x-pmic.c new file +3
-0+static const struct mfd_cell hi655x_pmic_devs[] = { + { .name ="hi655x-regulator" , }, +};What other devices are there?
These patches only add regulator,the RTC and Power-key will be added later.
So I just list the regulator this time.
Quoted 32 lines
Quoted 19 lines
drivers/mfd/hi655x-pmic.c new file +19
-0+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 , +};drivers/mfd/hi655x-pmic.c line 57
Quoted 10 lines
drivers/mfd/hi655x-pmic.c new file +10
-0+ +static unsigned int hi655x_pmic_get_version (struct hi655x_pmic *pmic) +{ +u32 val; + +regmap_read (pmic->regmap, +HI655X_BUS_ADDR (HI655X_VER_REG ), &val); + +return val; +}This is a small function that you only use once.
Quoted 2 lines
Probably better just to call
regmap_read()directly from below.
ok.
Quoted 21 lines
Quoted 21 lines
drivers/mfd/hi655x-pmic.c new file +21
-0+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;
Quoted 9 lines
drivers/mfd/hi655x-pmic.c line 85
Quoted 6 lines
drivers/mfd/hi655x-pmic.c new file +6
-0+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 );You need a NULL check here.
ok.
Quoted 23 lines
drivers/mfd/hi655x-pmic.c line 90
Quoted 5 lines
drivers/mfd/hi655x-pmic.c new file +5
-0+ pmic->dev = dev; + + pmic->res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!pmic->res) { +dev_err (dev,"platform_get_resource err\n" );This is not a good error message.
Besides, we don't normally try to catch this error, as it's checked for you in
devm_ioremap_resource().drivers/mfd/hi655x-pmic.c line 87
Quoted 2 lines
drivers/mfd/hi655x-pmic.c new file +2
-0+return -ENOENT ; + }'\n' here.
drivers/mfd/hi655x-pmic.c line 95
Quoted 3 lines
drivers/mfd/hi655x-pmic.c new file +3
-0+ base =devm_ioremap_resource (dev, pmic->res); +if (!base) { +dev_err (dev,"cannot map register memory\n" );
devm_ioremap_resource()already prints a message on error. No need for this.
Quoted 6 lines
drivers/mfd/hi655x-pmic.c line 99
Quoted 4 lines
drivers/mfd/hi655x-pmic.c new file +4
-0+return -ENOMEM ; + } + pmic->regmap =devm_regmap_init_mmio_clk (dev,NULL , base, + &hi655x_regmap_config);You need to check for an error here.
ok
Quoted 159 lines
drivers/mfd/hi655x-pmic.c line 103
Quoted 4 lines
drivers/mfd/hi655x-pmic.c new file +3
-0+ pmic->ver =hi655x_pmic_get_version (pmic); +if ((pmic->ver <PMU_VER_START ) || (pmic->ver >PMU_VER_END )) { +dev_warn (dev,"it is wrong pmu version\n" );You can't issue a
_warn, then return an error. Please use_err.... and change to "PMU version %d unsupported".
Quoted 5 lines
drivers/mfd/hi655x-pmic.c new file +5
-0+return -EINVAL ; + } + +hi655x_local_irq_clear (pmic->regmap); +drivers/mfd/hi655x-pmic.c line 118
Quoted 10 lines
drivers/mfd/hi655x-pmic.c new file +10
-0+ pmic->gpio =of_get_named_gpio (np,"pmic-gpios" ,0 ); +if (!gpio_is_valid (pmic->gpio)) { +dev_err (dev,"cannot 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",More readable if you use the IRQ name, as you know it.
"Failed to obtain '
hi655x_pmic_irq'"drivers/mfd/hi655x-pmic.c line 131
Quoted 13 lines
drivers/mfd/hi655x-pmic.c new file +13
-0+ 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,"add pmic irq chip error! ret %d\n" , ret); +return ret; + } + +/* bind pmic to device */ "Bind PMIC to device"
It would be better if you dropped the comment completely to be honest.
drivers/mfd/hi655x-pmic.c line 134
Quoted 3 lines
drivers/mfd/hi655x-pmic.c new file +3
-0+platform_set_drvdata (pdev, pmic); + + ret = mfd_add_devices(dev, 0, hi655x_pmic_devs,Please use the #defines for the second parameter.
drivers/mfd/hi655x-pmic.c line 137
Quoted 3 lines
drivers/mfd/hi655x-pmic.c new file +3
-0+ ARRAY_SIZE(hi655x_pmic_devs), NULL, 0, NULL); +if (ret) { +dev_err (dev,"add mfd devices failed: %d\n" , ret);"Failed to register device".
Quoted 13 lines
drivers/mfd/hi655x-pmic.c new file +13
-0+regmap_del_irq_chip (pmic->irq, pmic->irq_data); +return ret; + } + +return 0 ; +} + +static int hi655x_pmic_remove (struct platform_device *pdev) +{ +mfd_remove_devices (&pdev->dev); + +return 0 ; +}drivers/mfd/hi655x-pmic.c line 160
Quoted 10 lines
drivers/mfd/hi655x-pmic.c new file +10
-0+ +static const struct of_device_id of_hi655x_pmic_match_tbl[] = { + { .compatible ="hisilicon,hi655x-pmic" , }, + {}, +}; + +static struct platform_driver hi655x_pmic_driver = { + .driver = { + .name ="hi655x-pmic" , + .of_match_table = of_hi655x_pmic_match_tbl,
of_match_ptr()drivers/mfd/hi655x-pmic.c line 168
Quoted 8 lines
drivers/mfd/hi655x-pmic.c new file +8
-0+ }, + .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" );PMIC
Quoted 7 lines
drivers/mfd/hi655x-pmic.c new file +1
-0+MODULE_LICENSE ("GPL v2" );include/linux/mfd/hi655x-pmic.h new file +0
-0include/linux/mfd/hi655x-pmic.h line 7
Quoted 7 lines
include/linux/mfd/hi655x-pmic.h new file +7
-0@@ -0,0 +1,56 @@ +/* +* Device driver for regulators in hi655x IC +* +* Copyright (c) 2016 Hisilicon. +* +* Chen Feng <[email protected]> +* Fei Wang <[email protected]> Author(s):
Quoted 25 lines
include/linux/mfd/hi655x-pmic.h new file +25
-0+* 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)include/linux/mfd/hi655x-pmic.h line 43
Quoted 10 lines
include/linux/mfd/hi655x-pmic.h new file +10
-0+#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))No need for the extra ()'s
include/linux/mfd/hi655x-pmic.h line 49
Quoted 5 lines
include/linux/mfd/hi655x-pmic.h new file +5
-0+struct hi655x_pmic { +struct resource *res; +struct device *dev; +struct regmap *regmap; +struct clk *clk;Is this used?
Quoted 10 lines
include/linux/mfd/hi655x-pmic.h line 54
Quoted 5 lines
include/linux/mfd/hi655x-pmic.h new file +5
-0+int irq; +int gpio; +unsigned int ver; +struct regmap_irq_chip_data *irq_data; +};Check to see if they are all used.
Quoted 1 line
include/linux/mfd/hi655x-pmic.h new file +1
-0+#endif
The other comments are all accepted, thanks for your review.
Re: [PATCH v5 3/5] mfd: hi655x: Add hi665x pmic driver
In reply to Lee JonesHi Lee,
Thanks for your review!
There is one things need your confirm.
Please help to see it below.
Quoted 3 lines · Lee Jones
Quoted 1 line · Chen Feng
Add pmic mfd driver to support hisilicon hi665x.
[..]
Quoted 7 lines
drivers/mfd/hi655x-pmic.c line 27
Quoted 4 lines
drivers/mfd/hi655x-pmic.c new file +3
-0+static const struct mfd_cell hi655x_pmic_devs[] = { + { .name ="hi655x-regulator" , }, +};What other devices are there?
Current the MFD PMIC driver only has regulator enable.
The RTC & Power-key are not in these patch sets.
They will be added later.
Will this be accepted?
Quoted 2 lines
Quoted 2 lines
drivers/mfd/hi655x-pmic.c new file +2
-0+static const struct regmap_irq hi655x_irqs[] = { + { .reg_offset =0 , .mask =OTMP_D1R_INT },
Re: [PATCH v5 3/5] mfd: hi655x: Add hi665x pmic driver
Quoted 20 lines · chenfeng
Hi Lee,
Thanks for your review!
There is one things need your confirm.
Please help to see it below.Quoted 3 lines · Lee Jones
Quoted 1 line · Chen Feng
Add pmic mfd driver to support hisilicon hi665x.
[..]
Quoted 7 lines
drivers/mfd/hi655x-pmic.c line 27
Quoted 4 lines
drivers/mfd/hi655x-pmic.c new file +3
-0+static const struct mfd_cell hi655x_pmic_devs[] = { + { .name ="hi655x-regulator" , }, +};What other devices are there?
Quoted 7 lines
Current the MFD PMIC driver only has regulator enable.
The RTC & Power-key are not in these patch sets.
They will be added later.
Will this be accepted?
Yes.
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
drivers/mfd/hi655x-pmic.c new file +2
-0+static const struct regmap_irq hi655x_irqs[] = { + { .reg_offset =0 , .mask =OTMP_D1R_INT },
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v5 4/5 regulator: add regulator driver of hi655x pmic
In reply to Chen FengAdd regulator support for hi655x pmic
--- drivers/regulator/Kconfig | 8 ++ drivers/regulator/Makefile | 1 + drivers/regulator/hi655x-regulator.c | 256 +++++++++++++++++++++++++++++++++++ 3 files changed, 265 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 && ARM64) + 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_LP3971) += lp3971.o
drivers/regulator/hi655x-regulator.c new file +256 -0
256 lines not on this page · raw message
Signature · 1 line
1.9.1
Mark Brown
maintainerRe: [PATCH v5 4/5] regulator: add regulator driver of hi655x pmic
drivers/regulator/Kconfig config REGULATOR_HI6421 · line 266
Quoted 3 lines · Chen Feng
drivers/regulator/Kconfig +3
-0+config REGULATOR_HI655X + tristate "Hisilicon HI655X PMIC regulators support" + depends on ARCH_HISI || (COMPILE_TEST && ARM64)
Why does this depend on ARM64? If it's needed it probably indicates a problem...
drivers/regulator/hi655x-regulator.c line 207
Quoted 7 lines
drivers/regulator/hi655x-regulator.c new file +7
-0+ np =of_get_child_by_name (dev->parent->of_node,"regulators" ); +if (!np) +return -ENODEV ; + + ret =of_regulator_match (dev, np, + hi655x_regulator_match, +ARRAY_SIZE (hi655x_regulator_match));
Like I said on the previous version:
| Don't open code this, use the standard support with of_match and | regulators_node.
The code is now using of_match but still open coding regulators_node.
Re: [PATCH v5 4/5] regulator: add regulator driver of hi655x pmic
Quoted 9 lines · Mark Brown
drivers/regulator/Kconfig config REGULATOR_HI6421 · line 266
Quoted 3 lines · Chen Feng
drivers/regulator/Kconfig +3
-0+config REGULATOR_HI655X + tristate "Hisilicon HI655X PMIC regulators support" + depends on ARCH_HISI || (COMPILE_TEST && ARM64)Why does this depend on ARM64? If it's needed it probably indicates a problem...
There will be compile warning with arch parisc.
Add the current support platform is ARM64.
Quoted 10 lines
drivers/regulator/hi655x-regulator.c line 207
Quoted 7 lines
drivers/regulator/hi655x-regulator.c new file +7
-0+ np =of_get_child_by_name (dev->parent->of_node,"regulators" ); +if (!np) +return -ENODEV ; + + ret =of_regulator_match (dev, np, + hi655x_regulator_match, +ARRAY_SIZE (hi655x_regulator_match));Like I said on the previous version:
Quoted 5 lines
| Don't open code this, use the standard support with
of_matchand |regulators_node.The code is now using
of_matchbut still open codingregulators_node.
I am not sure about open coding regulators_node.
I take max8907-regulator.c for reference. The code there is:
224 static int max8907_regulator_parse_dt(struct platform_device *pdev) 225 {
226 struct device_node *np, *regulators;
227 int ret;
228
229 np = pdev->dev.parent->of_node;
230 if (!np)
231 return 0;
232
233 regulators = of_get_child_by_name(np, "regulators"); ...
238
239 ret = of_regulator_match(&pdev->dev, regulators, max8907_matches,
240 ARRAY_SIZE(max8907_matches));
249 }
Can you give me some references? Really thanks for your help.
ChenFeng
Mark Brown
maintainerRe: [PATCH v5 4/5] regulator: add regulator driver of hi655x pmic
Quoted 10 lines · chenfeng
Quoted 8 lines · Mark Brown
drivers/regulator/Kconfig config REGULATOR_HI6421 · line 266
Quoted 3 lines · Chen Feng
drivers/regulator/Kconfig +3
-0+config REGULATOR_HI655X + tristate "Hisilicon HI655X PMIC regulators support" + depends on ARCH_HISI || (COMPILE_TEST && ARM64)Why does this depend on ARM64? If it's needed it probably indicates a problem...
Quoted 3 lines
There will be compile warning with arch parisc.
Add the current support platform is ARM64.
The whole point of COMPILE_TEST is to allow people who are working generally rather than with the particular hardware to build things to improve build test coverage when doing general kernel work. A warning on a very obscure architecture is really not a blocker here.
Quoted 4 lines
I am not sure about open coding
regulators_node.I take
max8907-regulator.cfor reference. The code there is:
224 static intmax8907_regulator_parse_dt(struct platform_device *pdev)
The existance of older drivers that have not yet been converted to use newer core subsystem features is not a good reason to avoid using those core subsystem features. You'll commonly find this situation in the kernel.
Quoted 1 line
Can you give me some references? Really thanks for your help.
$ grep -l regulators_node drivers/regulator/*.c drivers/regulator/88pm800.c drivers/regulator/axp20x-regulator.c drivers/regulator/da9062-regulator.c drivers/regulator/isl9305.c drivers/regulator/max14577.c drivers/regulator/max77686.c drivers/regulator/max77693.c drivers/regulator/max77802.c drivers/regulator/mt6311-regulator.c drivers/regulator/of_regulator.c drivers/regulator/pv88060-regulator.c drivers/regulator/pv88090-regulator.c drivers/regulator/rn5t618-regulator.c drivers/regulator/rt5033-regulator.c drivers/regulator/sky81452-regulator.c drivers/regulator/tps65023-regulator.c drivers/regulator/tps65086-regulator.c drivers/regulator/tps65217-regulator.c
Re: [PATCH v5 4/5] regulator: add regulator driver of hi655x pmic
Quoted 11 lines · Mark Brown
Quoted 9 lines · chenfeng
Quoted 8 lines · Mark Brown
drivers/regulator/Kconfig config REGULATOR_HI6421 · line 266
Quoted 3 lines · Chen Feng
drivers/regulator/Kconfig +3
-0+config REGULATOR_HI655X + tristate "Hisilicon HI655X PMIC regulators support" + depends on ARCH_HISI || (COMPILE_TEST && ARM64)Why does this depend on ARM64? If it's needed it probably indicates a problem...
Quoted 9 lines
Quoted 3 lines
There will be compile warning with arch parisc.
Add the current support platform is ARM64.
The whole point of
COMPILE_TESTis to allow people who are working generally rather than with the particular hardware to build things to improve build test coverage when doing general kernel work. A warning on a very obscure architecture is really not a blocker here.
ok, I will remove the ARM64 depends.
Quoted 23 lines
Quoted 4 lines
I am not sure about open coding
regulators_node.I take
max8907-regulator.cfor reference. The code there is:
224 static intmax8907_regulator_parse_dt(struct platform_device *pdev)The existance of older drivers that have not yet been converted to use newer core subsystem features is not a good reason to avoid using those core subsystem features. You'll commonly find this situation in the kernel.
Quoted 1 line
Can you give me some references? Really thanks for your help.
$ grep -l regulators_node drivers/regulator/*.c drivers/regulator/88pm800.c drivers/regulator/axp20x-regulator.c drivers/regulator/da9062-regulator.c drivers/regulator/isl9305.c drivers/regulator/max14577.c drivers/regulator/max77686.c drivers/regulator/max77693.c drivers/regulator/max77802.c drivers/regulator/mt6311-regulator.c drivers/regulator/of_regulator.c
Quoted 9 lines
drivers/regulator/pv88060-regulator.c drivers/regulator/pv88090-regulator.c drivers/regulator/rn5t618-regulator.c drivers/regulator/rt5033-regulator.c drivers/regulator/sky81452-regulator.c drivers/regulator/tps65023-regulator.c drivers/regulator/tps65086-regulator.c drivers/regulator/tps65217-regulator.c
Understand, I will remove the match-table and add the regulators_node to match the regulator-compatible in dts.
PATCH v5 5/5 hisilicon/dts: Add hi655x pmic dts node
In reply to Chen FengAdd the mfd hi655x dts node and regulator support
--- arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts | 5 ++ arch/arm64/boot/dts/hisilicon/hi6220.dtsi | 102 +++++++++++++++++++++++++ 2 files changed, 107 insertions(+)
arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts +5 -0
@@ -31,4 +31,9 @@ device_type = "memory"; reg = <0x0 0x0 0x0 0x40000000>; }; + +}; + +&pmic { + status = "okay"; };
arch/arm64/boot/dts/hisilicon/hi6220.dtsi +102 -0
107 lines not on this page · raw message
Signature · 1 line
1.9.1