Add Support for Hi6220 PMIC Hi6553 MFD Core
Subsystems (4)
v6 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.
V6: Use regulators_node and of_match, donot open code fot it.
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 | 28 +++ arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts | 5 + arch/arm64/boot/dts/hisilicon/hi6220.dtsi | 87 ++++++++ drivers/mfd/Kconfig | 10 + drivers/mfd/Makefile | 1 + drivers/mfd/hi655x-pmic.c | 170 +++++++++++++++ drivers/regulator/Kconfig | 8 + drivers/regulator/Makefile | 1 + drivers/regulator/hi655x-regulator.c | 227 +++++++++++++++++++++ include/linux/mfd/hi655x-pmic.h | 56 +++++ 11 files changed, 621 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 v6 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
PATCH v6 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 | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/hisilicon,hi655x-regulator.txt
Documentation/devicetree/bindings/regulator/hisilicon,hi655x-regulator.txt new file +28 -0
@@ -0,0 +1,28 @@ +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 { + regulator-compatible = "LDO2"; + regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <3200000>; + regulator-enable-ramp-delay = <120>; + }; + ... + } + }
Signature · 1 line
1.9.1
PATCH v6 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 | 170 ++++++++++++++++++++++++++++++++++++++++ include/linux/mfd/hi655x-pmic.h | 56 +++++++++++++ 4 files changed, 237 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
@@ -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
PATCH v6 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 | 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_LP3971) += lp3971.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 v6 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 | 87 ++++++++++++++++++++++++++ 2 files changed, 92 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 +87 -0
92 lines not on this page · raw message
Signature · 1 line
1.9.1
Mark Brown
maintainerRe: [PATCH v6 5/5] hisilicon/dts: Add hi655x pmic dts node
arch/arm64/boot/dts/hisilicon/hi6220.dtsi line 224
Quoted 7 lines · Chen Feng
index 82d2488..6de9881 100644
arch/arm64/boot/dts/hisilicon/hi6220.dtsi +3
-0+ regulators { + ldo2: ldo2@a21 { + regulator-compatible = "LDO2";
Why are you using the legacy regulator-compatible property? No new bindings should use this.
arch/arm64/boot/dts/hisilicon/hi6220.dtsi
Quoted 2 lines
arch/arm64/boot/dts/hisilicon/hi6220.dtsi +2
-0+ regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <3200000>;
This is broken as it misunderstands the purpose of specifying constraints. The constraints are there to say what the safe and supported configuration is on a given board, it is not possible to provide this information safely in a general include that is used by all systems using the PMIC. Specifying the maximum voltage range for the regulators is almost guaranteed to result in at least some configurations being enabled which will not work, in the worst case this may include configurations which could physically damage the system.
In general it is very unusual to include the regulators in a .dtsi since essentially all the configuration for them should be board specific.
Re: [PATCH v6 5/5] hisilicon/dts: Add hi655x pmic dts node
Mark,
Quoted 10 lines · Mark Brown
arch/arm64/boot/dts/hisilicon/hi6220.dtsi line 224
Quoted 7 lines · Chen Feng
index 82d2488..6de9881 100644
arch/arm64/boot/dts/hisilicon/hi6220.dtsi +3
-0+ regulators { + ldo2: ldo2@a21 { + regulator-compatible = "LDO2";
I will change it like this:
regulators {
ldo2: LDO2@a21 {
regulator-name = "ldo2";
regulator-min-microvolt = <2500000>;
regulator-max-microvolt = <3200000>;
regulator-valid-modes-mask = <0x02>;
regulator-enable-ramp-delay = <120>;
};Quoted 15 lines
Why are you using the legacy regulator-compatible property? No new bindings should use this.
arch/arm64/boot/dts/hisilicon/hi6220.dtsi
Quoted 2 lines
arch/arm64/boot/dts/hisilicon/hi6220.dtsi +2
-0+ regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <3200000>;This is broken as it misunderstands the purpose of specifying constraints. The constraints are there to say what the safe and supported configuration is on a given board, it is not possible to provide this information safely in a general include that is used by all systems using the PMIC. Specifying the maximum voltage range for the regulators is almost guaranteed to result in at least some configurations being enabled which will not work, in the worst case this may include configurations which could physically damage the system.
Quoted 3 lines
In general it is very unusual to include the regulators in a .dtsi since essentially all the configuration for them should be board specific.
Do you mean that I should move this into dts and enable it by default?
Mark Brown
maintainerRe: [PATCH v6 5/5] hisilicon/dts: Add hi655x pmic dts node
Quoted 4 lines · chenfeng
Quoted 1 line · Mark Brown
On Tue, Jan 19, 2016 at 02:32:04PM +0800, Chen Feng wrote:
I will change it like this:
Quoted 8 lines
regulators {
ldo2: LDO2@a21 {
regulator-name = "ldo2";
regulator-min-microvolt = <2500000>;
regulator-max-microvolt = <3200000>;
regulator-valid-modes-mask = <0x02>;
regulator-enable-ramp-delay = <120>;
};No, do not include the voltage constraints, see the second half of my reply.
Quoted 12 lines
Quoted 11 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <3200000>;This is broken as it misunderstands the purpose of specifying constraints. The constraints are there to say what the safe and supported configuration is on a given board, it is not possible to provide this information safely in a general include that is used by all systems using the PMIC. Specifying the maximum voltage range for the regulators is almost guaranteed to result in at least some configurations being enabled which will not work, in the worst case this may include configurations which could physically damage the system.
Quoted 4 lines
Quoted 2 lines
In general it is very unusual to include the regulators in a .dtsi since essentially all the configuration for them should be board specific.
Do you mean that I should move this into dts and enable it by default?
It would be more normal to put everything to do with the regulators into the board DTS. It is unlikely that a straight move would be the right thing, you would need to understand what all the voltage ranges on the board are and set them appropriately and should normally also be naming the regulators as per the schematic so users can tie the DT and the schematic together.
Mark Brown
maintainerQuoted 6 lines · Chen Feng
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
I've asked you several times to use subject lines reflecting the style for the subsystem for the DT bindings (and have just noticed that the same thing applies to the DTS update).
Quoted 9 lines · Mark Brown
Quoted 6 lines · Chen Feng
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
Quoted 4 lines
I've asked you several times to use subject lines reflecting the style for the subsystem for the DT bindings (and have just noticed that the same thing applies to the DTS update).
Mark,
Really sorry for this.
Since I have not caught what you mean before this time.
I changed the style problem from doc:bindings to doc: bindings. A blank space added. But this was not accurately what you mean.
I will change it like this:
bindings: mfd: hi655x: Add document for mfd hi665x PMIC
bindings: regulator: hi655x: Document for hi655x regulator driver
regulator: hi655x: add regulator driver of hi655x pmic
arm64: dts: hisilicon: Add hi655x pmic dts node
Will this be okay?
Have you also reviewed the regulator driver code? I changed it to of_match and regulators_node without opening code.
Thanks again for your advice.
Feng
Mark Brown
maintainerQuoted 2 lines · chenfeng
I will change it like this:
bindings: regulator: hi655x: Document for hi655x regulator driver
As we discussed previously I'd expected something more like:
regulator: hi655x: Document for hi655x regulator driver
Quoted 1 line
arm64: dts: hisilicon: Add hi655x pmic dts node
That's what I'd expect.
Quoted 2 lines
Have you also reviewed the regulator driver code? I changed it to
of_matchandregulators_nodewithout opening code.
Not yet.
Quoted 9 lines · Mark Brown
Quoted 2 lines · chenfeng
I will change it like this:
bindings: regulator: hi655x: Document for hi655x regulator driverAs we discussed previously I'd expected something more like:
regulator: hi655x: Document for hi655x regulator driver
ok
Quoted 9 lines
Quoted 1 line
arm64: dts: hisilicon: Add hi655x pmic dts node
That's what I'd expect.
Quoted 2 lines
Have you also reviewed the regulator driver code? I changed it to
of_matchandregulators_nodewithout opening code.Not yet.