Add Support for Hi6220 PMIC Hi6553 MFD Core
Subsystems (4)
v3 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
The patch sets are based on 4.4-rc5.
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 | 17 ++ .../regulator/hisilicon,hi655x-regulator.txt | 43 ++++ arch/arm64/boot/dts/hisilicon/hi6220.dtsi | 178 +++++++++++++++ drivers/mfd/Kconfig | 9 + drivers/mfd/Makefile | 1 + drivers/mfd/hi655x-pmic.c | 170 ++++++++++++++ drivers/regulator/Kconfig | 8 + drivers/regulator/Makefile | 1 + drivers/regulator/hi655x-regulator.c | 246 +++++++++++++++++++++ include/linux/mfd/hi655x-pmic.h | 56 +++++ include/linux/regulator/hi655x-regulator.h | 41 ++++ 11 files changed, 770 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 create mode 100644 include/linux/regulator/hi655x-regulator.h
Signature · 1 line
1.9.1
PATCH v3 1/5 doc: bindings: Add document for mfd hi665x PMIC
Add document for mfd driver hi655x pmic driver
--- .../devicetree/bindings/mfd/hisilicon,hi655x.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +17 -0
@@ -0,0 +1,17 @@ +Hisilicon hi655x Power Management Integrated Circuit (PMIC) + +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 = <&gpio_pmu_irq_n>; + status = "okay"; + }
Signature · 1 line
1.9.1
PATCH v3 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 | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/hisilicon,hi655x-regulator.txt
Documentation/devicetree/bindings/regulator/hisilicon,hi655x-regulator.txt new file +43 -0
@@ -0,0 +1,43 @@ +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. + +Required properties: +- compatible: Must be "hisilicon,hi655x-regulator-pmic"; +- regulator-ctrl-regs: Registers offset of control register, + In turn with enable disable and status register offset. +- regulator-ctrl-mask: The control mask bit of the register. +- regulator-vset-regs: Voltage set register offset. +- regulator-vset-mask: voltage set control mask. +- regulator-n-vol: The num of support voltages. +- regulator-vset-table: The table of support voltages. + +Example: + pmic: pmic@f8000000 { + compatible = "hisilicon,hi655x-pmic"; + ... + ldo7: regulator@a26 { + compatible = "hisilicon,hi655x-regulator-pmic"; + regulator-name = "ldo7"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-valid-modes-mask = <0x0a>; + regulator-enable-ramp-delay = <120>; + regulator-ctrl-regs = <0x029 0x02a 0x02b>; + regulator-ctrl-mask = <0x6>; + regulator-vset-regs = <0x078>; + regulator-vset-mask = <0x7>; + regulator-n-vol = <8>; + regulator-vset-table = <1800000>,<1850000>, + <2850000>,<2900000>, + <3000000>,<3100000>, + <3200000>,<3300000>; + }; + ... + }
Signature · 1 line
1.9.1
PATCH v3 3/5 mfd: hi655x: Add hi665x pmic driver
In reply to Chen FengAdd mfd driver to support hisilicon hi665x PMIC.
--- drivers/mfd/Kconfig | 9 +++ drivers/mfd/Makefile | 1 + drivers/mfd/hi655x-pmic.c | 170 ++++++++++++++++++++++++++++++++++++++++ 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 +9 -0
@@ -284,6 +284,15 @@ 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 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 +170 -0
170 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
kbuild test robot
build bot[PATCH] mfd: hi655x: fix platform_no_drv_owner.cocci warnings
drivers/mfd/hi655x-pmic.c:161:3-8: No need to set .owner here. The core will do it.
drivers/mfd/hi655x-pmic.c:161:3-8: No need to set .owner here. The core will do it.
Remove .owner field if calls are used which set it automatically
Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci
---
hi655x-pmic.c | 1 - 1 file changed, 1 deletion(-)
drivers/mfd/hi655x-pmic.c +0 -1
@@ -158,7 +158,6 @@ static int hi655x_pmic_probe(struct platstatic struct platform_driver hi655x_pmic_driver = { .driver = { .name ="hi655x-pmic" , - .owner =THIS_MODULE , .of_match_table = of_hi655x_pmic_match_tbl, }, .probe = hi655x_pmic_probe,
kbuild test robot
build botRe: [PATCH v3 3/5] mfd: hi655x: Add hi665x pmic driver
In reply to Chen Fengcoccinelle warnings: (new ones prefixed by >>)
Hi Chen,
[auto build test WARNING on ljones-mfd/for-mfd-next] [also build test WARNING on v4.4-rc5 next-20151214]
url: https://github.com/0day-ci/linux/commits/Chen-Feng/Add-Support-for-Hi6220-PMIC-Hi6553-MFD-Core/20151215-210113 base: https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
coccinelle warnings: (new ones prefixed by >>)
>> drivers/mfd/hi655x-pmic.c:161:3-8: No need to set .owner here. The core will do it.
Please review and possibly fold the followup patch.
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
PATCH v3 4/5 regulator: add regulator driver of hi655x PMIC
In reply to Chen FengAdd driver support for HiSilicon Hi655x voltage regulators.
--- drivers/regulator/Kconfig | 8 + drivers/regulator/Makefile | 1 + drivers/regulator/hi655x-regulator.c | 246 +++++++++++++++++++++++++++++ include/linux/regulator/hi655x-regulator.h | 41 +++++ 4 files changed, 296 insertions(+) create mode 100644 drivers/regulator/hi655x-regulator.c create mode 100644 include/linux/regulator/hi655x-regulator.h
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 + 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 +246 -0
246 lines not on this page · raw message
include/linux/regulator/hi655x-regulator.h new file +41 -0
41 lines not on this page · raw message
Signature · 1 line
1.9.1
Mark Brown
maintainerRe: [PATCH v3 4/5] regulator: add regulator driver of hi655x PMIC
drivers/regulator/Kconfig config REGULATOR_HI6421 · line 271
Quoted 8 lines · Chen Feng
drivers/regulator/Kconfig +8
-0+config REGULATOR_HI655X + tristate "Hisilicon HI655X PMIC regulators support" + depends on ARCH_HISI + depends on MFD_HI655X_PMIC && OF + help + This driver provides support for the voltage regulators of the + Hisilicon Hi655x PMIC device. +
On the previous version of this patch I said:
| For both of these we should have an || COMPILE_TEST and there's no need | for either to be bool I can see, they should be tristate.
I see you have made this a tristate which is good but you've not enabled COMPILE_TEST or indicated why - there may be a very good reason for doing this but nobody has said what it is. Please don't ignore review comments, people are generally making them for a reason and are likely to have the same concerns if issues remain unaddressed. Having to repeat the same comments can get repetitive and make people question the value of time spent reviewing. If you disagree with the review comments that's fine but you need to reply and discuss your concerns so that the reviewer can understand your decisions.
drivers/regulator/hi655x-regulator.c line 39
Quoted 6 lines
drivers/regulator/hi655x-regulator.c new file +6
-0+static int hi655x_is_enabled (struct regulator_dev *rdev) +{ +unsigned int value =0 ; + +struct hi655x_regulator *regulator =rdev_get_drvdata (rdev); +struct hi655x_regulator_ctrl_regs *ctrl_regs = ®ulator->ctrl_regs;
The style here is not what we normally do - normally the struct lookups would be first, then any other variables and there wouldn't be any blank lines in the variable declarations. The same applies to quite a few functions.
drivers/regulator/hi655x-regulator.c line 71
Quoted 3 lines
drivers/regulator/hi655x-regulator.c new file +3
-0+static int hi655x_set_voltage (struct regulator_dev *rdev, +int min_uV,int max_uV,unsigned *selector) +{
As I commented on the previous version of this driver:
| Use the standard helpers, including one of the map_voltage()s and | set_voltage_sel_regmap(), don't open code them.
You need to at least split the map and set_voltage_sel operations.
I've stopped reviewing here.
Re: [PATCH v3 4/5] regulator: add regulator driver of hi655x PMIC
Mark,
Thanks very much for your review.
Quoted 16 lines · Mark Brown
drivers/regulator/Kconfig config REGULATOR_HI6421 · line 271
Quoted 8 lines · Chen Feng
drivers/regulator/Kconfig +8
-0+config REGULATOR_HI655X + tristate "Hisilicon HI655X PMIC regulators support" + depends on ARCH_HISI + depends on MFD_HI655X_PMIC && OF + help + This driver provides support for the voltage regulators of the + Hisilicon Hi655x PMIC device. +On the previous version of this patch I said:
| For both of these we should have an || COMPILE_TEST and there's no need | for either to be bool I can see, they should be tristate.
Quoted 10 lines
I see you have made this a tristate which is good but you've not enabled
COMPILE_TESTor indicated why - there may be a very good reason for doing this but nobody has said what it is. Please don't ignore review comments, people are generally making them for a reason and are likely to have the same concerns if issues remain unaddressed. Having to repeat the same comments can get repetitive and make people question the value of time spent reviewing. If you disagree with the review comments that's fine but you need to reply and discuss your concerns so that the reviewer can understand your decisions.
Sorry for this,I am busy with other issue these days.
Really appreciate your comments.
I will add the COMPILE_TEST next version.
Quoted 12 lines
drivers/regulator/hi655x-regulator.c line 39
Quoted 6 lines
drivers/regulator/hi655x-regulator.c new file +6
-0+static int hi655x_is_enabled (struct regulator_dev *rdev) +{ +unsigned int value =0 ; + +struct hi655x_regulator *regulator =rdev_get_drvdata (rdev); +struct hi655x_regulator_ctrl_regs *ctrl_regs = ®ulator->ctrl_regs;The style here is not what we normally do - normally the struct lookups would be first, then any other variables and there wouldn't be any blank lines in the variable declarations. The same applies to quite a few functions.
ok, I will fix the style problem.
Quoted 9 lines
drivers/regulator/hi655x-regulator.c line 71
Quoted 3 lines
drivers/regulator/hi655x-regulator.c new file +3
-0+static int hi655x_set_voltage (struct regulator_dev *rdev, +int min_uV,int max_uV,unsigned *selector) +{As I commented on the previous version of this driver:
| Use the standard helpers, including one of the map_voltage()s and |
set_voltage_sel_regmap(), don't open code them.
I change the regulator_enable method to regulator_enable_regmap this version.
But,since the hi655x PMIC use status register to ensure the regulator is okay or not.
Three different register offset in these PMIC series.
enable register.
disable register.
status register.
I can't use regulator_is_enabled_regmap regulator_disable_regmap in helpers.c
int regulator_disable_regmap(struct regulator_dev *rdev)
{
...
return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
rdev->desc->enable_mask, val);
...
}Only enable_reg in the desc struct.
I will change the set voltage to regulator_set_voltage_sel_regmap next version.
Thanks again.
Quoted 4 lines
You need to at least split the map and
set_voltage_seloperations.I've stopped reviewing here.
PATCH v3 5/5 hisilicon/dts: Add hi655x pmic dts node
In reply to Chen FengAdd dts node for hi665x MFD and regulator driver
--- arch/arm64/boot/dts/hisilicon/hi6220.dtsi | 178 ++++++++++++++++++++++++++++++ 1 file changed, 178 insertions(+)
arch/arm64/boot/dts/hisilicon/hi6220.dtsi +178 -0
@@ -208,5 +208,183 @@ clock-names = "uartclk", "apb_pclk"; status = "disabled"; }; + pmic: pmic@F8000000 { + compatible = "hisilicon,hi655x-pmic"; + reg = <0x0 0xf8000000 0x0 0x1000>; + #interrupt-cells = <2>; + interrupt-controller; + pmic-gpios = <&gpio_pmu_irq_n>; + status = "okay"; + ldo2: regulator@a21 { + compatible = "hisilicon,hi655x-regulator-pmic"; + regulator-name = "ldo2"; + regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <3200000>; + regulator-valid-modes-mask = <0x02>; + regulator-enable-ramp-delay = <120>; + regulator-ctrl-regs = <0x029 0x02a 0x02b>; + regulator-ctrl-mask = <0x1>; + regulator-vset-regs = <0x072>; + regulator-vset-mask = <0x7>; + regulator-n-vol = <8>; + regulator-vset-table = <2500000>,<2600000>, + <2700000>,<2800000>, + <2900000>,<3000000>, + <3100000>,<3200000>; + }; + ldo7: regulator@a26 { + compatible = "hisilicon,hi655x-regulator-pmic"; + regulator-name = "ldo7"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-valid-modes-mask = <0x0a>; + regulator-enable-ramp-delay = <120>; + regulator-ctrl-regs = <0x029 0x02a 0x02b>; + regulator-ctrl-mask = <0x6>; + regulator-vset-regs = <0x078>; + regulator-vset-mask = <0x7>; + regulator-n-vol = <8>; + regulator-vset-table = <1800000>,<1850000>, + <2850000>,<2900000>, + <3000000>,<3100000>, + <3200000>,<3300000>; + }; + ldo10: regulator@a29 { + compatible = "hisilicon,hi655x-regulator-pmic"; + regulator-name = "ldo10"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + regulator-valid-modes-mask = <0x0a>; + regulator-enable-ramp-delay = <360>; + regulator-ctrl-regs = <0x02c 0x02d 0x02e>; + regulator-ctrl-mask = <0x1>; + regulator-vset-regs = <0x07b>; + regulator-vset-mask = <0x7>; + regulator-n-vol = <8>; + regulator-vset-table = <1800000>,<1850000>, + <1900000>,<2750000>, + <2800000>,<2850000>, + <2900000>,<3000000>; + }; + ldo13: regulator@a32 { + compatible = "hisilicon,hi655x-regulator-pmic"; + regulator-name = "ldo13"; + regulator-min-microvolt = <1600000>; + regulator-max-microvolt = <1950000>; + regulator-enable-ramp-delay = <120>; + regulator-ctrl-regs = <0x02c 0x02d 0x02e>; + regulator-ctrl-mask = <0x4>; + regulator-vset-regs = <0x07e>; + regulator-vset-mask = <0x7>; + regulator-n-vol = <8>; + regulator-vset-table = <1600000>,<1650000>, + <1700000>,<1750000>, + <1800000>,<1850000>, + <1900000>,<1950000>; + }; + ldo14: regulator@a33 { + compatible = "hisilicon,hi655x-regulator-pmic"; + regulator-name = "ldo14"; + regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <3200000>; + regulator-enable-ramp-delay = <120>; + regulator-ctrl-regs = <0x02c 0x02d 0x02e>; + regulator-ctrl-mask = <0x5>; + regulator-vset-regs = <0x07f>; + regulator-vset-mask = <0x7>; + regulator-n-vol = <8>; + regulator-vset-table = <2500000>,<2600000>, + <2700000>,<2800000>, + <2900000>,<3000000>, + <3100000>,<3200000>; + }; + ldo15: regulator@a34 { + compatible = "hisilicon,hi655x-regulator-pmic"; + regulator-name = "ldo15"; + regulator-min-microvolt = <1600000>; + regulator-max-microvolt = <1950000>; + regulator-boot-on; + regulator-always-on; + regulator-enable-ramp-delay = <120>; + regulator-ctrl-regs = <0x02c 0x02d 0x02e>; + regulator-ctrl-mask = <0x6>; + regulator-vset-regs = <0x080>; + regulator-vset-mask = <0x7>; + regulator-n-vol = <8>; + regulator-vset-table = <1600000>,<1650000>, + <1700000>,<1750000>, + <1800000>,<1850000>, + <1900000>,<1950000>; + }; + ldo17: regulator@a36 { + compatible = "hisilicon,hi655x-regulator-pmic"; + regulator-name = "ldo17"; + regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <3200000>; + regulator-enable-ramp-delay = <120>; + regulator-ctrl-regs = <0x02f 0x030 0x031>; + regulator-ctrl-mask = <0x0>; + regulator-vset-regs = <0x082>; + regulator-vset-mask = <0x7>; + regulator-n-vol = <8>; + regulator-vset-table = <2500000>,<2600000>, + <2700000>,<2800000>, + <2900000>,<3000000>, + <3100000>,<3200000>; + }; + ldo19: regulator@a38 { + compatible = "hisilicon,hi655x-regulator-pmic"; + regulator-name = "ldo19"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + regulator-enable-ramp-delay = <360>; + regulator-ctrl-regs = <0x02f 0x030 0x031>; + regulator-ctrl-mask = <0x2>; + regulator-vset-regs = <0x084>; + regulator-vset-mask = <0x7>; + regulator-n-vol = <8>; + regulator-vset-table = <1800000>,<1850000>, + <1900000>,<2750000>, + <2800000>,<2850000>, + <2900000>,<3000000>; + }; + ldo21: regulator@a40 { + compatible = "hisilicon,hi655x-regulator-pmic"; + regulator-name = "ldo21"; + regulator-min-microvolt = <1650000>; + regulator-max-microvolt = <2000000>; + regulator-always-on; + regulator-valid-modes-mask = <0x02>; + regulator-enable-ramp-delay = <120>; + regulator-ctrl-regs = <0x02f 0x030 0x031>; + regulator-ctrl-mask = <0x4>; + regulator-vset-regs = <0x086>; + regulator-vset-mask = <0x7>; + regulator-n-vol = <8>; + regulator-vset-table = <1650000>,<1700000>, + <1750000>,<1800000>, + <1850000>,<1900000>, + <1950000>,<2000000>; + }; + ldo22: regulator@a41 { + compatible = "hisilicon,hi655x-regulator-pmic"; + regulator-name = "ldo22"; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <1200000>; + regulator-boot-on; + regulator-always-on; + regulator-valid-modes-mask = <0x02>; + regulator-enable-ramp-delay = <120>; + regulator-ctrl-regs = <0x02f 0x030 0x031>; + regulator-ctrl-mask = <0x5>; + regulator-vset-regs = <0x087>; + regulator-vset-mask = <0x7>; + regulator-n-vol = <8>; + regulator-vset-table = <900000>,<1000000>, + <1050000>,<1100000>, + <1150000>,<1175000>, + <1185000>,<1200000>; + }; + }; }; };
Signature · 1 line
1.9.1
Re: [PATCH v3 5/5] hisilicon/dts: Add hi655x pmic dts node
Mark,
+- regulator-vset-regs: Voltage set register offset. +- regulator-vset-mask: voltage set control mask. +- regulator-n-vol: The num of support voltages. +- regulator-vset-table: The table of support voltages.
Quoted 4 lines
Why is this in the binding? This is a binding for a specific device, there is no point in putting all these data tables in the DT - it just bloats the DT and makes it harder for us to enhance our support for this device in the future.
You mentioned in previous version,I I have some questions for it.
This regulator-vset-regs etc are vendor specific describe. The hi655x PMIC is a series of chips. They all have this value, but the offset may be different. And we can generate the dts file from excel which is defined by SOC.
I think the dts is designed to distinguish different platform. If we hard code this in files, it may be also different to use as common in next chip version.
I will appreciate it if you can give me some suggestions.
Quoted 198 lines · Chen Feng
Add dts node for hi665x MFD and regulator driver
Signed-off-by Chen Feng <[email protected]>Signed-off-by Fei Wang <[email protected]>Tested-by Xinwei Kong <[email protected]>--- arch/arm64/boot/dts/hisilicon/hi6220.dtsi | 178 ++++++++++++++++++++++++++++++ 1 file changed, 178 insertions(+)arch/arm64/boot/dts/hisilicon/hi6220.dtsi +178
-0@@ -208,5 +208,183 @@ clock-names = "uartclk", "apb_pclk"; status = "disabled"; }; + pmic: pmic@F8000000 { + compatible = "hisilicon,hi655x-pmic"; + reg = <0x0 0xf8000000 0x0 0x1000>; + #interrupt-cells = <2>; + interrupt-controller; + pmic-gpios = <&gpio_pmu_irq_n>; + status = "okay"; + ldo2: regulator@a21 { + compatible = "hisilicon,hi655x-regulator-pmic"; + regulator-name = "ldo2"; + regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <3200000>; + regulator-valid-modes-mask = <0x02>; + regulator-enable-ramp-delay = <120>; + regulator-ctrl-regs = <0x029 0x02a 0x02b>; + regulator-ctrl-mask = <0x1>; + regulator-vset-regs = <0x072>; + regulator-vset-mask = <0x7>; + regulator-n-vol = <8>; + regulator-vset-table = <2500000>,<2600000>, + <2700000>,<2800000>, + <2900000>,<3000000>, + <3100000>,<3200000>; + }; + ldo7: regulator@a26 { + compatible = "hisilicon,hi655x-regulator-pmic"; + regulator-name = "ldo7"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-valid-modes-mask = <0x0a>; + regulator-enable-ramp-delay = <120>; + regulator-ctrl-regs = <0x029 0x02a 0x02b>; + regulator-ctrl-mask = <0x6>; + regulator-vset-regs = <0x078>; + regulator-vset-mask = <0x7>; + regulator-n-vol = <8>; + regulator-vset-table = <1800000>,<1850000>, + <2850000>,<2900000>, + <3000000>,<3100000>, + <3200000>,<3300000>; + }; + ldo10: regulator@a29 { + compatible = "hisilicon,hi655x-regulator-pmic"; + regulator-name = "ldo10"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + regulator-valid-modes-mask = <0x0a>; + regulator-enable-ramp-delay = <360>; + regulator-ctrl-regs = <0x02c 0x02d 0x02e>; + regulator-ctrl-mask = <0x1>; + regulator-vset-regs = <0x07b>; + regulator-vset-mask = <0x7>; + regulator-n-vol = <8>; + regulator-vset-table = <1800000>,<1850000>, + <1900000>,<2750000>, + <2800000>,<2850000>, + <2900000>,<3000000>; + }; + ldo13: regulator@a32 { + compatible = "hisilicon,hi655x-regulator-pmic"; + regulator-name = "ldo13"; + regulator-min-microvolt = <1600000>; + regulator-max-microvolt = <1950000>; + regulator-enable-ramp-delay = <120>; + regulator-ctrl-regs = <0x02c 0x02d 0x02e>; + regulator-ctrl-mask = <0x4>; + regulator-vset-regs = <0x07e>; + regulator-vset-mask = <0x7>; + regulator-n-vol = <8>; + regulator-vset-table = <1600000>,<1650000>, + <1700000>,<1750000>, + <1800000>,<1850000>, + <1900000>,<1950000>; + }; + ldo14: regulator@a33 { + compatible = "hisilicon,hi655x-regulator-pmic"; + regulator-name = "ldo14"; + regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <3200000>; + regulator-enable-ramp-delay = <120>; + regulator-ctrl-regs = <0x02c 0x02d 0x02e>; + regulator-ctrl-mask = <0x5>; + regulator-vset-regs = <0x07f>; + regulator-vset-mask = <0x7>; + regulator-n-vol = <8>; + regulator-vset-table = <2500000>,<2600000>, + <2700000>,<2800000>, + <2900000>,<3000000>, + <3100000>,<3200000>; + }; + ldo15: regulator@a34 { + compatible = "hisilicon,hi655x-regulator-pmic"; + regulator-name = "ldo15"; + regulator-min-microvolt = <1600000>; + regulator-max-microvolt = <1950000>; + regulator-boot-on; + regulator-always-on; + regulator-enable-ramp-delay = <120>; + regulator-ctrl-regs = <0x02c 0x02d 0x02e>; + regulator-ctrl-mask = <0x6>; + regulator-vset-regs = <0x080>; + regulator-vset-mask = <0x7>; + regulator-n-vol = <8>; + regulator-vset-table = <1600000>,<1650000>, + <1700000>,<1750000>, + <1800000>,<1850000>, + <1900000>,<1950000>; + }; + ldo17: regulator@a36 { + compatible = "hisilicon,hi655x-regulator-pmic"; + regulator-name = "ldo17"; + regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <3200000>; + regulator-enable-ramp-delay = <120>; + regulator-ctrl-regs = <0x02f 0x030 0x031>; + regulator-ctrl-mask = <0x0>; + regulator-vset-regs = <0x082>; + regulator-vset-mask = <0x7>; + regulator-n-vol = <8>; + regulator-vset-table = <2500000>,<2600000>, + <2700000>,<2800000>, + <2900000>,<3000000>, + <3100000>,<3200000>; + }; + ldo19: regulator@a38 { + compatible = "hisilicon,hi655x-regulator-pmic"; + regulator-name = "ldo19"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + regulator-enable-ramp-delay = <360>; + regulator-ctrl-regs = <0x02f 0x030 0x031>; + regulator-ctrl-mask = <0x2>; + regulator-vset-regs = <0x084>; + regulator-vset-mask = <0x7>; + regulator-n-vol = <8>; + regulator-vset-table = <1800000>,<1850000>, + <1900000>,<2750000>, + <2800000>,<2850000>, + <2900000>,<3000000>; + }; + ldo21: regulator@a40 { + compatible = "hisilicon,hi655x-regulator-pmic"; + regulator-name = "ldo21"; + regulator-min-microvolt = <1650000>; + regulator-max-microvolt = <2000000>; + regulator-always-on; + regulator-valid-modes-mask = <0x02>; + regulator-enable-ramp-delay = <120>; + regulator-ctrl-regs = <0x02f 0x030 0x031>; + regulator-ctrl-mask = <0x4>; + regulator-vset-regs = <0x086>; + regulator-vset-mask = <0x7>; + regulator-n-vol = <8>; + regulator-vset-table = <1650000>,<1700000>, + <1750000>,<1800000>, + <1850000>,<1900000>, + <1950000>,<2000000>; + }; + ldo22: regulator@a41 { + compatible = "hisilicon,hi655x-regulator-pmic"; + regulator-name = "ldo22"; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <1200000>; + regulator-boot-on; + regulator-always-on; + regulator-valid-modes-mask = <0x02>; + regulator-enable-ramp-delay = <120>; + regulator-ctrl-regs = <0x02f 0x030 0x031>; + regulator-ctrl-mask = <0x5>; + regulator-vset-regs = <0x087>; + regulator-vset-mask = <0x7>; + regulator-n-vol = <8>; + regulator-vset-table = <900000>,<1000000>, + <1050000>,<1100000>, + <1150000>,<1175000>, + <1185000>,<1200000>; + }; + }; }; };
Mark Brown
maintainerRe: [PATCH v3 5/5] hisilicon/dts: Add hi655x pmic dts node
Quoted 5 lines · chenfeng
+- regulator-vset-regs: Voltage set register offset. +- regulator-vset-mask: voltage set control mask. +- regulator-n-vol: The num of support voltages. +- regulator-vset-table: The table of support voltages.
Quoted 8 lines
Quoted 4 lines
Why is this in the binding? This is a binding for a specific device, there is no point in putting all these data tables in the DT - it just bloats the DT and makes it harder for us to enhance our support for this device in the future.
You mentioned in previous version,I I have some questions for it.
This regulator-vset-regs etc are vendor specific describe. The hi655x PMIC
There's nothing vendor specific about the way this is written...
Quoted 5 lines
is a series of chips. They all have this value, but the offset may be different. And we can generate the dts file from excel which is defined by SOC.
I think the dts is designed to distinguish different platform. If we hard code this in files, it may be also different to use as common in next chip version.
If your tooling can generate DT files it can generate C code just as well and it seems unlikely you're going to be able to build new boards without being able to do firmware updates here. Especially for the sorts of systems that use DT the set of scenarios where you're able to update the DT but not the kernel seems like it will be extremely limited. I don't really buy the argument that there's any practical difference in the ability to update the kernel and DT and to the extent there is one it seems better to keep the ABI we have to support smaller by having the DT be minimal.
This also allows us to map things more efficiently than we can with just a table of voltages. For example a good selection of the regulators in your example DT appear to be linear ranges and so should be mapped as such so we can do direct calcuations rather than having to iterate through a table to map voltages into selectors. That gets especially serious for higher resolution regulators like most DCDCs (and modern LDOs for that matter).
Re: [PATCH v3 5/5] hisilicon/dts: Add hi655x pmic dts node
Mark,
Quoted 34 lines · Mark Brown
Quoted 5 lines · chenfeng
+- regulator-vset-regs: Voltage set register offset. +- regulator-vset-mask: voltage set control mask. +- regulator-n-vol: The num of support voltages. +- regulator-vset-table: The table of support voltages.Quoted 8 lines
Quoted 4 lines
Why is this in the binding? This is a binding for a specific device, there is no point in putting all these data tables in the DT - it just bloats the DT and makes it harder for us to enhance our support for this device in the future.
You mentioned in previous version,I I have some questions for it.
This regulator-vset-regs etc are vendor specific describe. The hi655x PMIC
There's nothing vendor specific about the way this is written...
Quoted 5 lines
is a series of chips. They all have this value, but the offset may be different. And we can generate the dts file from excel which is defined by SOC.
I think the dts is designed to distinguish different platform. If we hard code this in files, it may be also different to use as common in next chip version.
If your tooling can generate DT files it can generate C code just as well and it seems unlikely you're going to be able to build new boards without being able to do firmware updates here. Especially for the sorts of systems that use DT the set of scenarios where you're able to update the DT but not the kernel seems like it will be extremely limited. I don't really buy the argument that there's any practical difference in the ability to update the kernel and DT and to the extent there is one it seems better to keep the ABI we have to support smaller by having the DT be minimal.
Quoted 8 lines
This also allows us to map things more efficiently than we can with just a table of voltages. For example a good selection of the regulators in your example DT appear to be linear ranges and so should be mapped as such so we can do direct calcuations rather than having to iterate through a table to map voltages into selectors. That gets especially serious for higher resolution regulators like most DCDCs (and modern LDOs for that matter).
Thanks,
I see, I will change the table of voltages into driver. like this,
static const unsigned int voltages[] = {
1500000, 1800000, 2400000, 2500000,
2600000, 2700000, 2850000, 3000000,
};And there will be two open-code function for is-enable and disable in the regulator driver. Since we need use the status and disable register on PM chip. Only enable reg in the regulator desc.
Do you agree with this?
Re: [PATCH v3 5/5] hisilicon/dts: Add hi655x pmic dts node
Quoted 53 lines · chenfeng
Mark,
Quoted 34 lines · Mark Brown
Quoted 5 lines · chenfeng
+- regulator-vset-regs: Voltage set register offset. +- regulator-vset-mask: voltage set control mask. +- regulator-n-vol: The num of support voltages. +- regulator-vset-table: The table of support voltages.Quoted 8 lines
Quoted 4 lines
Why is this in the binding? This is a binding for a specific device, there is no point in putting all these data tables in the DT - it just bloats the DT and makes it harder for us to enhance our support for this device in the future.
You mentioned in previous version,I I have some questions for it.
This regulator-vset-regs etc are vendor specific describe. The hi655x PMIC
There's nothing vendor specific about the way this is written...
Quoted 5 lines
is a series of chips. They all have this value, but the offset may be different. And we can generate the dts file from excel which is defined by SOC.
I think the dts is designed to distinguish different platform. If we hard code this in files, it may be also different to use as common in next chip version.
If your tooling can generate DT files it can generate C code just as well and it seems unlikely you're going to be able to build new boards without being able to do firmware updates here. Especially for the sorts of systems that use DT the set of scenarios where you're able to update the DT but not the kernel seems like it will be extremely limited. I don't really buy the argument that there's any practical difference in the ability to update the kernel and DT and to the extent there is one it seems better to keep the ABI we have to support smaller by having the DT be minimal.
Quoted 8 lines
This also allows us to map things more efficiently than we can with just a table of voltages. For example a good selection of the regulators in your example DT appear to be linear ranges and so should be mapped as such so we can do direct calcuations rather than having to iterate through a table to map voltages into selectors. That gets especially serious for higher resolution regulators like most DCDCs (and modern LDOs for that matter).
Thanks,
I see, I will change the table of voltages into driver. like this,static const unsigned int voltages[] = { 1500000, 1800000, 2400000, 2500000, 2600000, 2700000, 2850000, 3000000, };
Quoted 5 lines
And there will be two open-code function for is-enable and disable in the regulator driver. Since we need use the status and disable register on PM chip. Only enable reg in the regulator desc.
Do you agree with this?
While doing this in driver code, I found that it seems all the vendor chip have the voltage table. So I am wondering can we add this into the regulator framework.
We can add in the function of_get_regulation_constraints to get the vset table.
I am not sure this is right or not.
Quoted 2 lines
Mark Brown
maintainerRe: [PATCH v3 5/5] hisilicon/dts: Add hi655x pmic dts node
On Mon, Dec 21, 2015 at 02:20:16PM +0800, chenfeng wrote:
Please fix your mail client to word wrap within paragraphs at something substantially less than 80 columns. Doing this makes your messages much easier to read and reply to.
Quoted 8 lines
While doing this in driver code, I found that it seems all the vendor chip have the voltage table. So I am wondering can we add this into the regulator framework.
We can add in the function
of_get_regulation_constraintsto get the vset table.I am not sure this is right or not.
I'm just not convinced it's a good pattern to move this data out to DT, like I said in my other mail it's making the ABI bigger and I'm not sure I see much upside over putting the data in a table in DT rather than in C code. It's more parsing code and more things we really shouldn't change in future.
Re: [PATCH v3 5/5] hisilicon/dts: Add hi655x pmic dts node
Quoted 6 lines · Mark Brown
On Mon, Dec 21, 2015 at 02:20:16PM +0800, chenfeng wrote:
Please fix your mail client to word wrap within paragraphs at something substantially less than 80 columns. Doing this makes your messages much easier to read and reply to.
ok, thanks for your advice.
Quoted 7 lines
Quoted 6 lines
While doing this in driver code, I found that it seems all the vendor chip have the voltage table. So I am wondering can we add this into the regulator framework.
We can add in the function
of_get_regulation_constraintsto get the vset table.
Quoted 8 lines
Quoted 1 line
I am not sure this is right or not.
I'm just not convinced it's a good pattern to move this data out to DT, like I said in my other mail it's making the ABI bigger and I'm not sure I see much upside over putting the data in a table in DT rather than in C code. It's more parsing code and more things we really shouldn't change in future.
ok. I will send the new version soon.
Mark Brown
maintainerRe: [PATCH v3 5/5] hisilicon/dts: Add hi655x pmic dts node
In reply to chenfengOn Mon, Dec 21, 2015 at 11:01:37AM +0800, chenfeng wrote:
Please fix your mail client to word wrap within paragraphs at something substantially less than 80 columns. Doing this makes your messages much easier to read and reply to.
Quoted 11 lines
I see, I will change the table of voltages into driver. like this,
static const unsigned int voltages[] = { 1500000, 1800000, 2400000, 2500000, 2600000, 2700000, 2850000, 3000000, };And there will be two open-code function for is-enable and disable in the regulator driver. Since we need use the status and disable register on PM chip. Only enable reg in the regulator desc.
Do you agree with this?
Yes.