Skip to contentSkip to conversation

Add Support for Hi6220 PMIC Hi6553 MFD Core and Regulator

PATCH In review Fei Wang 4 participants 18 messages Sep 30, 2015 – Oct 12, 2015

Subsystems (4)
lore
Share & tools
lore

Fei Wang

author
#0 lore raw

cover Add Support for Hi6220 PMIC Hi6553 MFD Core and Regulator

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 Linaro 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)|             |
+----------------+             +-------------+

This patchset are based on 4.3-rc1.

Fei Wang (8):
dt-bindings: pmic: Document Hi655x pmic driver
mfd: Hi655x: Add support for PMIC Hi655x MFD
arm64: dts: add Hi655x pmic node
regulator: Hi655x: Add support for Hi655x regulator
arm64: dts: Add Hi655x regulator config node
dt-bindings: mtcmos: Document Hi6220 mtcmos driver
mtcmos: Hi6220: Add Hi6220 mtcmos regulator driver
arm64: dts: Add Hi6220 mtcmos regulator node

 .../devicetree/bindings/mfd/hisilicon,hi655x.txt   |   80 +++
 .../bindings/regulator/hisilicon,hi6220-mtcmos.txt |   32 ++
 arch/arm64/boot/dts/hisilicon/hi6220.dtsi          |  275 +++++++++++
 drivers/mfd/Kconfig                                |    9 +
 drivers/mfd/Makefile                               |    1 +
 drivers/mfd/hi655x-pmic.c                          |  358 ++++++++++++++
 drivers/regulator/Kconfig                          |   16 +
 drivers/regulator/Makefile                         |    2 +
 drivers/regulator/hi6220-mtcmos.c                  |  281 +++++++++++
 drivers/regulator/hi655x-regulator.c               |  517 ++++++++++++++++++++
 include/linux/mfd/hi655x-pmic.h                    |   56 +++
 include/linux/regulator/hi655x-regulator.h         |   69 +++
 12 files changed, 1696 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt
 create mode 100644 Documentation/devicetree/bindings/regulator/hisilicon,hi6220-mtcmos.txt
 create mode 100644 drivers/mfd/hi655x-pmic.c
 create mode 100644 drivers/regulator/hi6220-mtcmos.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.7.9.5
author
#1 lore raw

PATCH 1/8 dt-bindings: pmic: Document Hi655x pmic driver

Document the new compatible for Hisilicon Hi655x pmic driver.

---
 .../devicetree/bindings/mfd/hisilicon,hi655x.txt   |   80 ++++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +80 -0
new file mode 100644
index 0000000..17bd8ca
@@ -0,0 +1,80 @@
+Hisilicon hi655x Power Management Integrated Circuit (PMIC)
+
+hi655x consists of a large and varied group of sub-devices:
+
+Device			 Supply Names	 Description
+------			 ------------	 -----------
+hi655x-powerkey		:		: Powerkey
+hi655x-regulator-pmic	:		: Regulators
+hi655x-usbvbus		:		: USB plug detection
+hi655x-pmu-rtc		:		: RTC
+hi655x-coul		:		: Coulomb
+
+Required properties:
+- compatible : Should be "hisilicon,hi655x-pmic-driver"
+- reg: Base address of PMIC on hi6220 soc
+- #interrupt-cells: Should be 2, is the local IRQ number for hi655x.
+- interrupt-controller: hi655x has internal IRQs (has own IRQ domain).
+- pmu_irq_gpio: should be &gpio_pmu_irq_n, is the IRQ gpio of hi655x.
+
+Example:
+	pmic: pmic at F8000000 {
+                compatible = "hisilicon,hi655x-pmic-driver";
+                reg = <0x0 0xF8000000 0x0 0x1000>;
+                #interrupt-cells = <2>;
+                interrupt-controller;
+                pmu_irq_gpio = <&gpio_pmu_irq_n>;
+                status = "ok";
+
+                ponkey:ponkey at b1{
+                        compatible = "hisilicon,hi655x-powerkey";
+                        interrupt-parent = <&pmic>;
+                        interrupts = <6 0>, <5 0>, <4 0>;
+                        interrupt-names = "down", "up", "hold 1s";
+                };
+
+                coul: coul at 1 {
+                        compatible = "hisilicon,hi655x-coul";
+                        interrupt-parent = <&pmic>;
+                        interrupts = <24 0>, <25 0>, <26 0>, <27 0>;
+                        interrupt-names = "cl_int_i", "cl_out_i", "cl_in_i", "vbat_int_i";
+                        battery_product_index = <0>;
+                        status = "ok";
+                };
+
+                rtc: rtc at 1 {
+                        compatible = "hisilicon,hi655x-pmu-rtc";
+                        interrupt-parent = <&pmic>;
+                        interrupts = <20 0>;
+                        interrupt-names = "hi655x_pmu_rtc";
+                        board_id = <1>;
+                };
+
+                usbvbus:usbvbus at b2{
+                        compatible = "hisilicon,hi655x-usbvbus";
+                        interrupt-parent = <&pmic>;
+                        interrupts = <9 0>, <8 0>;
+                        interrupt-names = "connect", "disconnect";
+                };
+
+		ldo2: regulator at a21 {
+                        compatible = "hisilicon,hi655x-regulator-pmic";
+                        regulator-name = "ldo2";
+                        regulator-min-microvolt = <2500000>;
+                        regulator-max-microvolt = <3200000>;
+                        hisilicon,valid-modes-mask = <0x02>;
+                        hisilicon,valid-ops-mask = <0x01d>;
+                        hisilicon,initial-mode = <0x02>;
+                        hisilicon,regulator-type = <0x01>;
+
+                        hisilicon,off-on-delay = <120>;
+                        hisilicon,ctrl-regs = <0x029 0x02a 0x02b>;
+                        hisilicon,ctrl-data = <0x1 0x1>;
+                        hisilicon,vset-regs = <0x072>;
+                        hisilicon,vset-data = <0 0x3>;
+                        hisilicon,regulator-n-vol = <8>;
+                        hisilicon,vset-table = <2500000>,<2600000>,<2700000>,<2800000>,<2900000>,<3000000>,<3100000>,<3200000>;
+                        hisilicon,num_consumer_supplies = <1>;
+                        hisilicon,consumer-supplies = "sensor_analog";
+                };
+	};
Signature · 1 line
1.7.9.5
maintainer
#2 lore raw

Re: [PATCH 1/8] dt-bindings: pmic: Document Hi655x pmic driver

Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 11

Quoted 11 lines · Fei Wang
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +11 -0
+Hisilicon hi655x Power Management Integrated Circuit (PMIC)
+
+hi655x consists of a large and varied group of sub-devices:
+
+Device			 Supply Names	 Description
+------			 ------------	 -----------
+hi655x-powerkey		:		: Powerkey
+hi655x-regulator-pmic	:		: Regulators
+hi655x-usbvbus		:		: USB plug detection
+hi655x-pmu-rtc		:		: RTC
+hi655x-coul		:		: Coulomb

...counter?

There's no documentation of the bindings for any of the above devices or how things are structured, you need to provide binding documentation which is understandable standalone. None of the properties are documented, nor is the set of regulators supported or how this is structured.

Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 41

Quoted 6 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +6 -0
+                coul: coul at 1 {
+                        compatible = "hisilicon,hi655x-coul";
+                        interrupt-parent = <&pmic>;
+                        interrupts = <24 0>, <25 0>, <26 0>, <27 0>;
+                        interrupt-names = "cl_int_i", "cl_out_i", "cl_in_i", "vbat_int_i";
+                        battery_product_index = <0>;

For example, the "battery_product_index" property here is undocumented.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150930/57546c23/attachment.sig>

author
#3 lore raw

Re: [PATCH 1/8] dt-bindings: pmic: Document Hi655x pmic driver

Quoted 16 lines · Mark Brown

Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 11

Quoted 11 lines · Fei Wang
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +11 -0
+Hisilicon hi655x Power Management Integrated Circuit (PMIC)
+
+hi655x consists of a large and varied group of sub-devices:
+
+Device			 Supply Names	 Description
+------			 ------------	 -----------
+hi655x-powerkey		:		: Powerkey
+hi655x-regulator-pmic	:		: Regulators
+hi655x-usbvbus		:		: USB plug detection
+hi655x-pmu-rtc		:		: RTC
+hi655x-coul		:		: Coulomb

...counter?

Quoted 5 lines

There's no documentation of the bindings for any of the above devices or how things are structured, you need to provide binding documentation which is understandable standalone. None of the properties are documented, nor is the set of regulators supported or how this is structured.

OK,i will add them.

Quoted 9 lines

Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 41

Quoted 7 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +6 -0
+                coul: coul at 1 {
+                        compatible = "hisilicon,hi655x-coul";
+                        interrupt-parent = <&pmic>;
+                        interrupts = <24 0>, <25 0>, <26 0>, <27 0>;
+                        interrupt-names = "cl_int_i", "cl_out_i", "cl_in_i", "vbat_int_i";
+                        battery_product_index = <0>;

For example, the "battery_product_index" property here is undocumented.

now on hikey, we only enable hi655x-regulator-pmic function, and regulator is child node of pmic.do i need to document regulator dt-binding in this file or create a new regulator dt-binding file?

Quoted 1 line
maintainer
#4 lore raw

Re: [PATCH 1/8] dt-bindings: pmic: Document Hi655x pmic driver

Quoted 2 lines · wangfei
Quoted 1 line · Mark Brown

On Wed, Sep 30, 2015 at 07:05:04PM +0800, Fei Wang 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 7 lines
Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +6 -0
+                coul: coul at 1 {
+                        compatible = "hisilicon,hi655x-coul";
+                        interrupt-parent = <&pmic>;
+                        interrupts = <24 0>, <25 0>, <26 0>, <27 0>;
+                        interrupt-names = "cl_int_i", "cl_out_i", "cl_in_i", "vbat_int_i";
+                        battery_product_index = <0>;
Quoted 5 lines
Quoted 1 line

For example, the "battery_product_index" property here is undocumented.

now on hikey, we only enable hi655x-regulator-pmic function, and regulator is child node of pmic.do i need to document regulator dt-binding in this file or create a new regulator dt-binding file?

Either is possible, though it is common to split the DT documentation
into per subsystem files for ease of reference and to avoid cross tree
merge issues.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151012/123109fb/attachment.sig>

#5 lore raw

Re: [PATCH 1/8] dt-bindings: pmic: Document Hi655x pmic driver

In reply to Fei Wang
Quoted 1 line · Fei Wang

Document the new compatible for Hisilicon Hi655x pmic driver.

s/pmic/PMIC/

Quoted 13 lines
---
 .../devicetree/bindings/mfd/hisilicon,hi655x.txt   |   80 ++++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +1 -0
new file mode 100644
index 0000000..17bd8ca
@@ -0,0 +1,80 @@
+Hisilicon hi655x Power Management Integrated Circuit (PMIC)

Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 11

Quoted 10 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +10 -0
+
+hi655x consists of a large and varied group of sub-devices:
+
+Device			 Supply Names	 Description
+------			 ------------	 -----------
+hi655x-powerkey		:		: Powerkey
+hi655x-regulator-pmic	:		: Regulators
+hi655x-usbvbus		:		: USB plug detection
+hi655x-pmu-rtc		:		: RTC
+hi655x-coul		:		: Coulomb

As Mark said, these all need documentation.

Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 18

Quoted 6 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +6 -0
+Required properties:
+- compatible : Should be "hisilicon,hi655x-pmic-driver"
+- reg: Base address of PMIC on hi6220 soc
+- #interrupt-cells: Should be 2, is the local IRQ number for hi655x.
+- interrupt-controller: hi655x has internal IRQs (has own IRQ domain).
+- pmu_irq_gpio: should be &gpio_pmu_irq_n, is the IRQ gpio of hi655x.

Better if you tab these out, like:

- compatible : Should be "hisilicon,hi655x-pmic-driver"
- reg : Base address of PMIC on hi6220 soc

Etc ...

Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 21

Quoted 2 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +2 -0
+Example:
+	pmic: pmic at F8000000 {

s/F/f/

Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 23

Quoted 2 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +2 -0
+                compatible = "hisilicon,hi655x-pmic-driver";
+                reg = <0x0 0xF8000000 0x0 0x1000>;

Small a => f please.

Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 26

Quoted 3 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +3 -0
+                #interrupt-cells = <2>;
+                interrupt-controller;
+                pmu_irq_gpio = <&gpio_pmu_irq_n>;

This should be <name>-gpios.

No underscores please.

Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 25

Quoted 1 line
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +1 -0
+                status = "ok";

Use "okay" instead.

Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 29

Quoted 1 line
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +1 -0
+                ponkey:ponkey at b1{

White space issues here.

Where is the 'reg' property?

Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 32

Quoted 3 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +3 -0
+                        compatible = "hisilicon,hi655x-powerkey";
+                        interrupt-parent = <&pmic>;
+                        interrupts = <6 0>, <5 0>, <4 0>;

Use #defines (same goes for all below).

Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 33

Quoted 1 line
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +1 -0
+                        interrupt-names = "down", "up", "hold 1s";

White space in a name seems wrong to me.

Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 36

Quoted 3 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +3 -0
+                };
+
+                coul: coul at 1 {

What is @1?

Is this label used?

Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 41

Quoted 5 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +5 -0
+                        compatible = "hisilicon,hi655x-coul";
+                        interrupt-parent = <&pmic>;
+                        interrupts = <24 0>, <25 0>, <26 0>, <27 0>;
+                        interrupt-names = "cl_int_i", "cl_out_i", "cl_in_i", "vbat_int_i";
+                        battery_product_index = <0>;

Documentation? It doesn't look like a generic propriety either, so should be have a vendor prefix.

Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 39

Quoted 1 line
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +1 -0
+                        status = "ok";

"okay"

Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 45

Quoted 3 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +3 -0
+                };
+
+                rtc: rtc at 1 {

Is this label used?

Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 50

Quoted 5 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +5 -0
+                        compatible = "hisilicon,hi655x-pmu-rtc";
+                        interrupt-parent = <&pmic>;
+                        interrupts = <20 0>;
+                        interrupt-names = "hi655x_pmu_rtc";
+                        board_id = <1>;

What's this? No IDs in DT please.

Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 53

Quoted 3 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +3 -0
+                };
+
+                usbvbus:usbvbus at b2{

Whitespace.

'reg'?

Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 60

Quoted 7 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +7 -0
+                        compatible = "hisilicon,hi655x-usbvbus";
+                        interrupt-parent = <&pmic>;
+                        interrupts = <9 0>, <8 0>;
+                        interrupt-names = "connect", "disconnect";
+                };
+
+		ldo2: regulator at a21 {

Tabbing seems wrong here.

Quoted 6 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +6 -0
+                        compatible = "hisilicon,hi655x-regulator-pmic";
+                        regulator-name = "ldo2";
+                        regulator-min-microvolt = <2500000>;
+                        regulator-max-microvolt = <3200000>;
+                        hisilicon,valid-modes-mask = <0x02>;
+                        hisilicon,valid-ops-mask = <0x01d>;

Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 76

Quoted 10 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +10 -0
+                        hisilicon,initial-mode = <0x02>;
+                        hisilicon,regulator-type = <0x01>;
+
+                        hisilicon,off-on-delay = <120>;
+                        hisilicon,ctrl-regs = <0x029 0x02a 0x02b>;
+                        hisilicon,ctrl-data = <0x1 0x1>;
+                        hisilicon,vset-regs = <0x072>;
+                        hisilicon,vset-data = <0 0x3>;
+                        hisilicon,regulator-n-vol = <8>;
+                        hisilicon,vset-table = <2500000>,<2600000>,<2700000>,<2800000>,<2900000>,<3000000>,<3100000>,<3200000>;

Whitespace.

Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt line 78

Quoted 2 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +2 -0
+                        hisilicon,num_consumer_supplies = <1>;
+                        hisilicon,consumer-supplies = "sensor_analog";

All of these vendor properties need documenting and signing of by Mark (the Regulator Maintainer).

Quoted 2 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +2 -0
+                };
+	};
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#6 lore raw

Re: [PATCH 1/8] dt-bindings: pmic: Document Hi655x pmic driver

In reply to Fei Wang

I just noticed that you Cc'ed all of the Core ARM people too. Please do not do that. I'm sure they have enough of their own mail to trawl though.

Only mail relevant parties i.e. those who show up when you use:

./scripts/get_maintainer.pl.

Quoted 94 lines

Document the new compatible for Hisilicon Hi655x pmic driver.

---
 .../devicetree/bindings/mfd/hisilicon,hi655x.txt   |   80 ++++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +80 -0
new file mode 100644
index 0000000..17bd8ca
@@ -0,0 +1,80 @@
+Hisilicon hi655x Power Management Integrated Circuit (PMIC)
+
+hi655x consists of a large and varied group of sub-devices:
+
+Device			 Supply Names	 Description
+------			 ------------	 -----------
+hi655x-powerkey		:		: Powerkey
+hi655x-regulator-pmic	:		: Regulators
+hi655x-usbvbus		:		: USB plug detection
+hi655x-pmu-rtc		:		: RTC
+hi655x-coul		:		: Coulomb
+
+Required properties:
+- compatible : Should be "hisilicon,hi655x-pmic-driver"
+- reg: Base address of PMIC on hi6220 soc
+- #interrupt-cells: Should be 2, is the local IRQ number for hi655x.
+- interrupt-controller: hi655x has internal IRQs (has own IRQ domain).
+- pmu_irq_gpio: should be &gpio_pmu_irq_n, is the IRQ gpio of hi655x.
+
+Example:
+	pmic: pmic at F8000000 {
+                compatible = "hisilicon,hi655x-pmic-driver";
+                reg = <0x0 0xF8000000 0x0 0x1000>;
+                #interrupt-cells = <2>;
+                interrupt-controller;
+                pmu_irq_gpio = <&gpio_pmu_irq_n>;
+                status = "ok";
+
+                ponkey:ponkey at b1{
+                        compatible = "hisilicon,hi655x-powerkey";
+                        interrupt-parent = <&pmic>;
+                        interrupts = <6 0>, <5 0>, <4 0>;
+                        interrupt-names = "down", "up", "hold 1s";
+                };
+
+                coul: coul at 1 {
+                        compatible = "hisilicon,hi655x-coul";
+                        interrupt-parent = <&pmic>;
+                        interrupts = <24 0>, <25 0>, <26 0>, <27 0>;
+                        interrupt-names = "cl_int_i", "cl_out_i", "cl_in_i", "vbat_int_i";
+                        battery_product_index = <0>;
+                        status = "ok";
+                };
+
+                rtc: rtc at 1 {
+                        compatible = "hisilicon,hi655x-pmu-rtc";
+                        interrupt-parent = <&pmic>;
+                        interrupts = <20 0>;
+                        interrupt-names = "hi655x_pmu_rtc";
+                        board_id = <1>;
+                };
+
+                usbvbus:usbvbus at b2{
+                        compatible = "hisilicon,hi655x-usbvbus";
+                        interrupt-parent = <&pmic>;
+                        interrupts = <9 0>, <8 0>;
+                        interrupt-names = "connect", "disconnect";
+                };
+
+		ldo2: regulator at a21 {
+                        compatible = "hisilicon,hi655x-regulator-pmic";
+                        regulator-name = "ldo2";
+                        regulator-min-microvolt = <2500000>;
+                        regulator-max-microvolt = <3200000>;
+                        hisilicon,valid-modes-mask = <0x02>;
+                        hisilicon,valid-ops-mask = <0x01d>;
+                        hisilicon,initial-mode = <0x02>;
+                        hisilicon,regulator-type = <0x01>;
+
+                        hisilicon,off-on-delay = <120>;
+                        hisilicon,ctrl-regs = <0x029 0x02a 0x02b>;
+                        hisilicon,ctrl-data = <0x1 0x1>;
+                        hisilicon,vset-regs = <0x072>;
+                        hisilicon,vset-data = <0 0x3>;
+                        hisilicon,regulator-n-vol = <8>;
+                        hisilicon,vset-table = <2500000>,<2600000>,<2700000>,<2800000>,<2900000>,<3000000>,<3100000>,<3200000>;
+                        hisilicon,num_consumer_supplies = <1>;
+                        hisilicon,consumer-supplies = "sensor_analog";
+                };
+	};
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author
#7 lore raw

Re: [PATCH 1/8] dt-bindings: pmic: Document Hi655x pmic driver

Quoted 8 lines · Lee Jones

I just noticed that you Cc'ed all of the Core ARM people too. Please do not do that. I'm sure they have enough of their own mail to trawl though.

Only mail relevant parties i.e. those who show up when you use:

./scripts/get_maintainer.pl.

OK?i see?thank you?

Quoted 95 lines
Quoted 94 lines

Document the new compatible for Hisilicon Hi655x pmic driver.

---
 .../devicetree/bindings/mfd/hisilicon,hi655x.txt   |   80 ++++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt new file +80 -0
new file mode 100644
index 0000000..17bd8ca
@@ -0,0 +1,80 @@
+Hisilicon hi655x Power Management Integrated Circuit (PMIC)
+
+hi655x consists of a large and varied group of sub-devices:
+
+Device			 Supply Names	 Description
+------			 ------------	 -----------
+hi655x-powerkey		:		: Powerkey
+hi655x-regulator-pmic	:		: Regulators
+hi655x-usbvbus		:		: USB plug detection
+hi655x-pmu-rtc		:		: RTC
+hi655x-coul		:		: Coulomb
+
+Required properties:
+- compatible : Should be "hisilicon,hi655x-pmic-driver"
+- reg: Base address of PMIC on hi6220 soc
+- #interrupt-cells: Should be 2, is the local IRQ number for hi655x.
+- interrupt-controller: hi655x has internal IRQs (has own IRQ domain).
+- pmu_irq_gpio: should be &gpio_pmu_irq_n, is the IRQ gpio of hi655x.
+
+Example:
+	pmic: pmic at F8000000 {
+                compatible = "hisilicon,hi655x-pmic-driver";
+                reg = <0x0 0xF8000000 0x0 0x1000>;
+                #interrupt-cells = <2>;
+                interrupt-controller;
+                pmu_irq_gpio = <&gpio_pmu_irq_n>;
+                status = "ok";
+
+                ponkey:ponkey at b1{
+                        compatible = "hisilicon,hi655x-powerkey";
+                        interrupt-parent = <&pmic>;
+                        interrupts = <6 0>, <5 0>, <4 0>;
+                        interrupt-names = "down", "up", "hold 1s";
+                };
+
+                coul: coul at 1 {
+                        compatible = "hisilicon,hi655x-coul";
+                        interrupt-parent = <&pmic>;
+                        interrupts = <24 0>, <25 0>, <26 0>, <27 0>;
+                        interrupt-names = "cl_int_i", "cl_out_i", "cl_in_i", "vbat_int_i";
+                        battery_product_index = <0>;
+                        status = "ok";
+                };
+
+                rtc: rtc at 1 {
+                        compatible = "hisilicon,hi655x-pmu-rtc";
+                        interrupt-parent = <&pmic>;
+                        interrupts = <20 0>;
+                        interrupt-names = "hi655x_pmu_rtc";
+                        board_id = <1>;
+                };
+
+                usbvbus:usbvbus at b2{
+                        compatible = "hisilicon,hi655x-usbvbus";
+                        interrupt-parent = <&pmic>;
+                        interrupts = <9 0>, <8 0>;
+                        interrupt-names = "connect", "disconnect";
+                };
+
+		ldo2: regulator at a21 {
+                        compatible = "hisilicon,hi655x-regulator-pmic";
+                        regulator-name = "ldo2";
+                        regulator-min-microvolt = <2500000>;
+                        regulator-max-microvolt = <3200000>;
+                        hisilicon,valid-modes-mask = <0x02>;
+                        hisilicon,valid-ops-mask = <0x01d>;
+                        hisilicon,initial-mode = <0x02>;
+                        hisilicon,regulator-type = <0x01>;
+
+                        hisilicon,off-on-delay = <120>;
+                        hisilicon,ctrl-regs = <0x029 0x02a 0x02b>;
+                        hisilicon,ctrl-data = <0x1 0x1>;
+                        hisilicon,vset-regs = <0x072>;
+                        hisilicon,vset-data = <0 0x3>;
+                        hisilicon,regulator-n-vol = <8>;
+                        hisilicon,vset-table = <2500000>,<2600000>,<2700000>,<2800000>,<2900000>,<3000000>,<3100000>,<3200000>;
+                        hisilicon,num_consumer_supplies = <1>;
+                        hisilicon,consumer-supplies = "sensor_analog";
+                };
+	};
author
#8 lore raw

PATCH 2/8 mfd: Hi655x: Add support for PMIC Hi655x MFD

In reply to Fei Wang

Add core files for Hi655x MFD driver.

---
 drivers/mfd/Kconfig             |    9 +
 drivers/mfd/Makefile            |    1 +
 drivers/mfd/hi655x-pmic.c       |  358 +++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/hi655x-pmic.h |   56 ++++++
 4 files changed, 424 insertions(+)
 create mode 100644 drivers/mfd/hi655x-pmic.c
 create mode 100644 include/linux/mfd/hi655x-pmic.h
drivers/mfd/Kconfig +9 -0
index 99d6367..d320def 100644
@@ -273,6 +273,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 ARCH_HISI
+	depends on OF
+	select MFD_CORE
+	select REGMAP_MMIO
+	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
index a59e3fc..11ec427 100644
@@ -185,6 +185,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 +358 -0

358 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.7.9.5
author
#9 lore raw

PATCH 3/8 arm64: dts: add Hi655x pmic node

In reply to Fei Wang

This patch add Hi655x device node for pmic in dts.

---
 arch/arm64/boot/dts/hisilicon/hi6220.dtsi |    9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm64/boot/dts/hisilicon/hi6220.dtsi +9 -0
index 3f03380..4e4830b 100644
@@ -168,4 +168,13 @@
 			clock-names = "uartclk", "apb_pclk";
 		};
 	};
+
+	pmic: pmic at F8000000 {
+                compatible = "hisilicon,hi655x-pmic-driver";
+                reg = <0x0 0xf8000000 0x0 0x1000>;
+                #interrupt-cells = <2>;
+                interrupt-controller;
+                pmu_irq_gpio = <&gpio_pmu_irq_n>;
+                status = "ok";
+	};
 };
Signature · 1 line
1.7.9.5
author
#10 lore raw

PATCH 4/8 regulator: Hi655x: Add support for Hi655x regulator

In reply to Fei Wang

Add Hi655x regulator driver.

---
 drivers/regulator/Kconfig                  |    8 +
 drivers/regulator/Makefile                 |    1 +
 drivers/regulator/hi655x-regulator.c       |  517 ++++++++++++++++++++++++++++
 include/linux/regulator/hi655x-regulator.h |   69 ++++
 4 files changed, 595 insertions(+)
 create mode 100644 drivers/regulator/hi655x-regulator.c
 create mode 100644 include/linux/regulator/hi655x-regulator.h
drivers/regulator/Kconfig +8 -0
index 64bccff..d13210b 100644
@@ -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
index 0f81749..8e4db96 100644
@@ -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 +517 -0

517 lines not on this page · raw message

include/linux/regulator/hi655x-regulator.h new file +69 -0

69 lines not on this page · raw message

Signature · 1 line
1.7.9.5
maintainer
#11 lore raw

Re: [PATCH 4/8] regulator: Hi655x: Add support for Hi655x regulator

drivers/regulator/Kconfig config REGULATOR_HI6421 · line 267

Quoted 4 lines · Fei Wang
drivers/regulator/Kconfig +4 -0
+config REGULATOR_HI655X
+        tristate "Hisilicon HI655X PMIC regulators support"
+        depends on ARCH_HISI
+	depends on MFD_HI655X_PMIC && OF

You've got some tab/space confusion above. Also, can't we have an || COMPILE_TEST here?

drivers/regulator/hi655x-regulator.c line 43

Quoted 8 lines
drivers/regulator/hi655x-regulator.c new file +8 -0
+#define REG_VALUE_SETBITS(reg_value, pos, bits, bits_value) \
+		(reg_value = (reg_value & \
+		~((((unsigned int)1 << bits) - 1) << pos)) | \
+		((unsigned int)(bits_value & \
+		(((unsigned int)1 << bits) - 1)) << pos))
+
+#define REG_VALUE_GETBITS(reg_value, pos, bits) \
+			((reg_value >> pos) & (((unsigned int)1 << bits) - 1))

These are just really hard to read, sorry, and they appear to duplicate existing regmap functionality. If there is a strong reason to add them consider doing so in the core and if you can then please@least make them regular inline functions rather than using macros. It's much safer and more readable.

Quoted 4 lines
drivers/regulator/hi655x-regulator.c new file +4 -0
+static int hi655x_regulator_pmic_is_enabled(struct regulator_dev *rdev)
+{
+	int ret = 0;
+	unsigned int value = 0;

drivers/regulator/hi655x-regulator.c line 58

Quoted 10 lines
drivers/regulator/hi655x-regulator.c new file +10 -0
+
+	struct hi655x_regulator *sreg = rdev_get_drvdata(rdev);
+	struct hi655x_regulator_ctrl_regs  *ctrl_regs = &(sreg->ctrl_regs);
+	struct hi655x_regulator_ctrl_data  *ctrl_data = &(sreg->ctrl_data);
+
+	/*
+	* regulator is all set,but the pmu is only subset.
+	* maybe this "buck"/"ldo"/"lvs" is not contrl by a core.
+	* and in regulator have a "status" member ("okey" or "disable").
+	*/

I'm having a hard time parsing the above comment. Please also use the normal kernel comment style (this is a problem throughout the driver).

drivers/regulator/hi655x-regulator.c line 61

Quoted 3 lines
drivers/regulator/hi655x-regulator.c new file +3 -0
+	regmap_read(rdev->regmap, ctrl_regs->status_reg, &value);
+	ret = (int)REG_VALUE_GETBITS(value, ctrl_data->shift,
+					ctrl_data->mask);

This appears to just duplicate regulator core functionality for reading enable state from a bitfield? Also note that the cast here isn't a great advert for the macros above.

drivers/regulator/hi655x-regulator.c line 77

Quoted 12 lines
drivers/regulator/hi655x-regulator.c new file +12 -0
+static int hi655x_regulator_pmic_enable(struct regulator_dev *rdev)
+{
+	int ret = 0;
+	unsigned char value_u8 = 0;
+	unsigned int value_u32 = 0;
+	struct hi655x_regulator *sreg = rdev_get_drvdata(rdev);
+	struct hi655x_regulator_ctrl_regs  *ctrl_regs = &(sreg->ctrl_regs);
+	struct hi655x_regulator_ctrl_data  *ctrl_data = &(sreg->ctrl_data);
+
+	REG_VALUE_SETBITS(value_u32, ctrl_data->shift, ctrl_data->mask, 0x1);
+	value_u8  = (unsigned char)value_u32;
+	regmap_write(rdev->regmap, ctrl_regs->enable_reg, value_u8);

I'm not *entirely* sure what this is supposed to be doing but it looks like it's duplicating core functionality in a fashion that's really quite hard to read. Why not just use the core functions for setting bits?

drivers/regulator/hi655x-regulator.c line 78

Quoted 1 line
drivers/regulator/hi655x-regulator.c new file +1 -0
+	udelay(sreg->off_on_delay);

Use the regualtor core delay functionality please.

drivers/regulator/hi655x-regulator.c line 114

Quoted 2 lines
drivers/regulator/hi655x-regulator.c new file +2 -0
+static int hi655x_regulator_pmic_list_voltage_linear(struct regulator_dev *rdev,
+				  unsigned int selector)

This is *definitely* duplicating core functionality, I think you want to use regulator_list_voltage_linear_range() or possibly just plain _linear() and use separate operations for the LVS regulator.

We at least need to restructure the code so that the core helper functions are used and we don't have regulator type decisions everywhere
- the whole goal of having per regulator ops is to avoid having to open code decisions about which regulator we're dealing with into each op function.

drivers/regulator/hi655x-regulator.c line 195

Quoted 5 lines
drivers/regulator/hi655x-regulator.c new file +5 -0
+static unsigned int hi655x_regulator_pmic_get_mode(
+			struct regulator_dev *rdev)
+{
+	return REGULATOR_MODE_NORMAL;
+}

Don't implement empty functions, remove all these.

drivers/regulator/hi655x-regulator.c line 265

Quoted 7 lines
drivers/regulator/hi655x-regulator.c new file +7 -0
+	num_consumer_supplies = of_get_property(np,
+				"hisilicon,num_consumer_supplies", NULL);
+
+	if ((NULL == num_consumer_supplies) || (0 == *num_consumer_supplies)) {
+		dev_warn(dev, "%s no consumer_supplies\n", __func__);
+		return init_data;
+	}

Obviously the binding is completely undocumented but this is setting off alarm bells - why is the driver even considering consumers? Please make sure you are using the core regulator bindings rather than open coding something which translates into platform data (which is what this looks like).

I'm not going to review any more of the DT code without binding documentation.

drivers/regulator/hi655x-regulator.c line 447

Quoted 4 lines
drivers/regulator/hi655x-regulator.c new file +4 -0
+	/*
+	*initdata mem will release auto;
+	*this is kernel 3.10 import.
+	*/

Remove anything related to your vendor kernel support, this is not
relevant to upstream.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150930/0666e632/attachment.sig>

author
#12 lore raw

Re: [PATCH 4/8] regulator: Hi655x: Add support for Hi655x regulator

Quoted 10 lines · Mark Brown

drivers/regulator/Kconfig config REGULATOR_HI6421 · line 267

Quoted 4 lines · Fei Wang
drivers/regulator/Kconfig +4 -0
+config REGULATOR_HI655X
+        tristate "Hisilicon HI655X PMIC regulators support"
+        depends on ARCH_HISI
+	depends on MFD_HI655X_PMIC && OF

You've got some tab/space confusion above. Also, can't we have an || COMPILE_TEST here?

OK, i will add it.

Quoted 6 lines
Quoted 6 lines
drivers/regulator/hi655x-regulator.c new file +6 -0
+#define REG_VALUE_SETBITS(reg_value, pos, bits, bits_value) \
+		(reg_value = (reg_value & \
+		~((((unsigned int)1 << bits) - 1) << pos)) | \
+		((unsigned int)(bits_value & \
+		(((unsigned int)1 << bits) - 1)) << pos))
+
Quoted 9 lines

drivers/regulator/hi655x-regulator.c line 43

Quoted 2 lines
drivers/regulator/hi655x-regulator.c new file +2 -0
+#define REG_VALUE_GETBITS(reg_value, pos, bits) \
+			((reg_value >> pos) & (((unsigned int)1 << bits) - 1))

These are just really hard to read, sorry, and they appear to duplicate existing regmap functionality. If there is a strong reason to add them consider doing so in the core and if you can then please at least make them regular inline functions rather than using macros. It's much safer and more readable.

i agree with you ?i will refactor all the unreadable code?

Quoted 9 lines
Quoted 9 lines
drivers/regulator/hi655x-regulator.c new file +9 -0
+static int hi655x_regulator_pmic_is_enabled(struct regulator_dev *rdev)
+{
+	int ret = 0;
+	unsigned int value = 0;
+
+	struct hi655x_regulator *sreg = rdev_get_drvdata(rdev);
+	struct hi655x_regulator_ctrl_regs  *ctrl_regs = &(sreg->ctrl_regs);
+	struct hi655x_regulator_ctrl_data  *ctrl_data = &(sreg->ctrl_data);
+
Quoted 9 lines

drivers/regulator/hi655x-regulator.c line 58

Quoted 5 lines
drivers/regulator/hi655x-regulator.c new file +5 -0
+	/*
+	* regulator is all set,but the pmu is only subset.
+	* maybe this "buck"/"ldo"/"lvs" is not contrl by a core.
+	* and in regulator have a "status" member ("okey" or "disable").
+	*/

I'm having a hard time parsing the above comment. Please also use the normal kernel comment style (this is a problem throughout the driver).

OK. i will modify all of these?

Quoted 26 lines

drivers/regulator/hi655x-regulator.c line 61

Quoted 3 lines
drivers/regulator/hi655x-regulator.c new file +3 -0
+	regmap_read(rdev->regmap, ctrl_regs->status_reg, &value);
+	ret = (int)REG_VALUE_GETBITS(value, ctrl_data->shift,
+					ctrl_data->mask);

This appears to just duplicate regulator core functionality for reading enable state from a bitfield? Also note that the cast here isn't a great advert for the macros above.

drivers/regulator/hi655x-regulator.c line 77

Quoted 12 lines
drivers/regulator/hi655x-regulator.c new file +12 -0
+static int hi655x_regulator_pmic_enable(struct regulator_dev *rdev)
+{
+	int ret = 0;
+	unsigned char value_u8 = 0;
+	unsigned int value_u32 = 0;
+	struct hi655x_regulator *sreg = rdev_get_drvdata(rdev);
+	struct hi655x_regulator_ctrl_regs  *ctrl_regs = &(sreg->ctrl_regs);
+	struct hi655x_regulator_ctrl_data  *ctrl_data = &(sreg->ctrl_data);
+
+	REG_VALUE_SETBITS(value_u32, ctrl_data->shift, ctrl_data->mask, 0x1);
+	value_u8  = (unsigned char)value_u32;
+	regmap_write(rdev->regmap, ctrl_regs->enable_reg, value_u8);

I'm not *entirely* sure what this is supposed to be doing but it looks like it's duplicating core functionality in a fashion that's really quite hard to read. Why not just use the core functions for setting bits?

Quoted 3 lines

drivers/regulator/hi655x-regulator.c line 78

Quoted 1 line
drivers/regulator/hi655x-regulator.c new file +1 -0
+	udelay(sreg->off_on_delay);

Use the regualtor core delay functionality please.

OK?i will modify it?

Quoted 8 lines

drivers/regulator/hi655x-regulator.c line 114

Quoted 3 lines
drivers/regulator/hi655x-regulator.c new file +2 -0
+static int hi655x_regulator_pmic_list_voltage_linear(struct regulator_dev *rdev,
+				  unsigned int selector)

This is *definitely* duplicating core functionality, I think you want to use regulator_list_voltage_linear_range() or possibly just plain _linear() and use separate operations for the LVS regulator.

Quoted 6 lines

We at least need to restructure the code so that the core helper functions are used and we don't have regulator type decisions everywhere
- the whole goal of having per regulator ops is to avoid having to open code decisions about which regulator we're dealing with into each op function.

OK?i will modify it?

Quoted 22 lines

drivers/regulator/hi655x-regulator.c line 195

Quoted 5 lines
drivers/regulator/hi655x-regulator.c new file +5 -0
+static unsigned int hi655x_regulator_pmic_get_mode(
+			struct regulator_dev *rdev)
+{
+	return REGULATOR_MODE_NORMAL;
+}

Don't implement empty functions, remove all these.

drivers/regulator/hi655x-regulator.c line 265

Quoted 7 lines
drivers/regulator/hi655x-regulator.c new file +7 -0
+	num_consumer_supplies = of_get_property(np,
+				"hisilicon,num_consumer_supplies", NULL);
+
+	if ((NULL == num_consumer_supplies) || (0 == *num_consumer_supplies)) {
+		dev_warn(dev, "%s no consumer_supplies\n", __func__);
+		return init_data;
+	}

Obviously the binding is completely undocumented but this is setting off alarm bells - why is the driver even considering consumers? Please make sure you are using the core regulator bindings rather than open coding something which translates into platform data (which is what this looks like).

Quoted 2 lines

I'm not going to review any more of the DT code without binding documentation.

I will document the dt-binding first?

Quoted 9 lines

drivers/regulator/hi655x-regulator.c line 447

Quoted 5 lines
drivers/regulator/hi655x-regulator.c new file +4 -0
+	/*
+	*initdata mem will release auto;
+	*this is kernel 3.10 import.
+	*/

Remove anything related to your vendor kernel support, this is not relevant to upstream.

Thanks?Mark?i agree with you and will modify all of you mentioned soon?

#13 lore raw

Re: [PATCH 4/8] regulator: Hi655x: Add support for Hi655x regulator

In reply to Fei Wang

Hello Fei Wang,

Quoted 4 lines · Fei Wang

Add Hi655x regulator driver.

---

[snip]

drivers/regulator/Kconfig config REGULATOR_HI6421 · line 265

Quoted 3 lines
drivers/regulator/Kconfig +2 -0
+config REGULATOR_HI655X
+        tristate "Hisilicon HI655X PMIC regulators support"

The Kconfig symbol is tree state which means it can be built as a module...

drivers/regulator/hi655x-regulator.c line 245

Quoted 8 lines
drivers/regulator/hi655x-regulator.c new file +8 -0
+
+static const struct of_device_id of_hi655x_regulator_match_tbl[] = {
+       {
+               .compatible = "hisilicon,hi655x-regulator-pmic",
+               .data = &hi655x_regulator_pmic,
+       },
+       { /* end */ }
+};

...but the OF module alias information is not built into the module so module autoloading won't work.

Please add a MODULE_DEVICE_TABLE(of, of_hi655x_regulator_match_tbl) here.

Best regards,
Javier

author
#14 lore raw

PATCH 5/8 arm64: dts: Add Hi655x regulator config node

In reply to Fei Wang

This patch add hi655x regulator dts file for Hi6220 SoC.

---
 arch/arm64/boot/dts/hisilicon/hi6220.dtsi |  245 +++++++++++++++++++++++++++++
 1 file changed, 245 insertions(+)
arch/arm64/boot/dts/hisilicon/hi6220.dtsi +245 -0
index 4e4830b..40f895b 100644
@@ -176,5 +176,250 @@
                 interrupt-controller;
                 pmu_irq_gpio = <&gpio_pmu_irq_n>;
                 status = "ok";
+
+		ldo2: regulator at a21 {
+                        compatible = "hisilicon,hi655x-regulator-pmic";
+                        regulator-name = "ldo2";
+                        regulator-min-microvolt = <2500000>;
+                        regulator-max-microvolt = <3200000>;
+                        hisilicon,valid-modes-mask = <0x02>;
+                        hisilicon,valid-ops-mask = <0x01d>;
+                        hisilicon,initial-mode = <0x02>;
+                        hisilicon,regulator-type = <0x01>;
+
+                        hisilicon,off-on-delay = <120>;
+                        hisilicon,ctrl-regs = <0x029 0x02a 0x02b>;
+                        hisilicon,ctrl-data = <0x1 0x1>;
+                        hisilicon,vset-regs = <0x072>;
+                        hisilicon,vset-data = <0 0x3>;
+                        hisilicon,regulator-n-vol = <8>;
+                        hisilicon,vset-table  = <2500000>,<2600000>,
+						<2700000>,<2800000>,
+						<2900000>,<3000000>,
+						<3100000>,<3200000>;
+                        hisilicon,num_consumer_supplies = <1>;
+                        hisilicon,consumer-supplies = "sensor_analog";
+                };
+
+		ldo7: regulator at a26 {
+                        compatible = "hisilicon,hi655x-regulator-pmic";
+                        regulator-name = "ldo7";
+                        regulator-min-microvolt = <1800000>;
+                        regulator-max-microvolt = <3300000>;
+                        hisilicon,valid-modes-mask = <0x0a>;
+                        hisilicon,valid-ops-mask = <0x01d>;
+                        hisilicon,initial-mode = <0x02>;
+                        hisilicon,regulator-type = <0x01>;
+
+                        hisilicon,off-on-delay = <120>;
+                        hisilicon,ctrl-regs = <0x029 0x02a 0x02b>;
+                        hisilicon,ctrl-data = <0x6 0x1>;
+                        hisilicon,vset-regs = <0x078>;
+                        hisilicon,vset-data = <0 0x3>;
+                        hisilicon,regulator-n-vol = <8>;
+                        hisilicon,vset-table  = <1800000>,<1850000>,
+						<2850000>,<2900000>,
+						<3000000>,<3100000>,
+						<3200000>,<3300000>;
+                        hisilicon,num_consumer_supplies = <1>;
+                        hisilicon,consumer-supplies = "sd_card_io";
+		};
+
+		ldo10: regulator at a29 {
+                        compatible = "hisilicon,hi655x-regulator-pmic";
+                        regulator-name = "ldo10";
+                        regulator-min-microvolt = <1800000>;
+                        regulator-max-microvolt = <3000000>;
+                        hisilicon,valid-modes-mask = <0x0a>;
+                        hisilicon,valid-ops-mask = <0x01d>;
+                        hisilicon,initial-mode = <0x02>;
+                        hisilicon,regulator-type = <0x01>;
+
+                        hisilicon,off-on-delay = <360>;
+                        hisilicon,ctrl-regs = <0x02c 0x02d 0x02e>;
+                        hisilicon,ctrl-data = <0x1 0x1>;
+                        hisilicon,vset-regs = <0x07b>;
+                        hisilicon,vset-data = <0 0x3>;
+                        hisilicon,regulator-n-vol = <8>;
+                        hisilicon,vset-table  = <1800000>,<1850000>,
+						<1900000>,<2750000>,
+						<2800000>,<2850000>,
+						<2900000>,<3000000>;
+                        hisilicon,num_consumer_supplies = <1>;
+                        hisilicon,consumer-supplies = "sd_card";
+                };
+
+		ldo13: regulator at a32 {
+                        compatible = "hisilicon,hi655x-regulator-pmic";
+                        regulator-name = "ldo13";
+                        regulator-min-microvolt = <1600000>;
+                        regulator-max-microvolt = <1950000>;
+                        hisilicon,valid-modes-mask = <0x0a>;
+                        hisilicon,valid-ops-mask = <0x01d>;
+                        hisilicon,initial-mode = <0x02>;
+                        hisilicon,regulator-type = <0x01>;
+
+                        hisilicon,off-on-delay = <120>;
+                        hisilicon,ctrl-regs = <0x02c 0x02d 0x02e>;
+                        hisilicon,ctrl-data = <0x4 0x1>;
+                        hisilicon,vset-regs = <0x07e>;
+                        hisilicon,vset-data = <0 0x3>;
+                        hisilicon,regulator-n-vol = <8>;
+                        hisilicon,vset-table  = <1600000>,<1650000>,
+						<1700000>,<1750000>,
+						<1800000>,<1850000>,
+						<1900000>,<1950000>;
+                        hisilicon,num_consumer_supplies = <3>;
+                        hisilicon,consumer-supplies = "scamera_core",
+							"mcamera_io",
+							"scamera_io";
+                };
+
+		ldo14: regulator at a33 {
+                        compatible = "hisilicon,hi655x-regulator-pmic";
+                        regulator-name = "ldo14";
+                        regulator-min-microvolt = <2500000>;
+                        regulator-max-microvolt = <3200000>;
+                        hisilicon,valid-modes-mask = <0x02>;
+                        hisilicon,valid-ops-mask = <0x01d>;
+                        hisilicon,initial-mode = <0x02>;
+                        hisilicon,regulator-type = <0x01>;
+
+                        hisilicon,off-on-delay = <120>;
+                        hisilicon,ctrl-regs = <0x02c 0x02d 0x02e>;
+                        hisilicon,ctrl-data = <0x5 0x1>;
+                        hisilicon,vset-regs = <0x07f>;
+                        hisilicon,vset-data = <0 0x3>;
+                        hisilicon,regulator-n-vol = <8>;
+                        hisilicon,vset-table  = <2500000>,<2600000>,
+						<2700000>,<2800000>,
+						<2900000>,<3000000>,
+						<3100000>,<3200000>;
+                        hisilicon,num_consumer_supplies = <3>;
+                        hisilicon,consumer-supplies  = "scamera_avdd",
+							"mcamera_avdd",
+							"mcamera_vcm";
+                };
+
+		ldo15: regulator at a34 {
+                        compatible = "hisilicon,hi655x-regulator-pmic";
+                        regulator-name = "ldo15";
+                        regulator-min-microvolt = <1600000>;
+                        regulator-max-microvolt = <1950000>;
+                        regulator-boot-on;
+                        regulator-always-on;
+                        hisilicon,valid-modes-mask = <0x0a>;
+                        hisilicon,valid-ops-mask = <0x01d>;
+                        hisilicon,initial-mode = <0x02>;
+                        hisilicon,regulator-type = <0x01>;
+
+                        hisilicon,off-on-delay = <120>;
+                        hisilicon,ctrl-regs = <0x02c 0x02d 0x02e>;
+                        hisilicon,ctrl-data = <0x6 0x1>;
+                        hisilicon,vset-regs = <0x080>;
+                        hisilicon,vset-data = <0 0x3>;
+                        hisilicon,regulator-n-vol = <8>;
+                        hisilicon,vset-table  = <1600000>,<1650000>,
+						<1700000>,<1750000>,
+						<1800000>,<1850000>,
+						<1900000>,<1950000>;
+                        hisilicon,num_consumer_supplies = <1>;
+                        hisilicon,consumer-supplies = "codec_analog";
+                };
+
+		ldo17: regulator at a36 {
+                        compatible = "hisilicon,hi655x-regulator-pmic";
+                        regulator-name = "ldo17";
+                        regulator-min-microvolt = <2500000>;
+                        regulator-max-microvolt = <3200000>;
+                        hisilicon,valid-modes-mask = <0x02>;
+                        hisilicon,valid-ops-mask = <0x01d>;
+                        hisilicon,initial-mode = <0x02>;
+                        hisilicon,regulator-type = <0x01>;
+
+                        hisilicon,off-on-delay = <120>;
+                        hisilicon,ctrl-regs = <0x02f 0x030 0x031>;
+                        hisilicon,ctrl-data = <0x0 0x1>;
+                        hisilicon,vset-regs = <0x082>;
+                        hisilicon,vset-data = <0 0x3>;
+                        hisilicon,regulator-n-vol = <8>;
+                        hisilicon,vset-table  = <2500000>,<2600000>,
+						<2700000>,<2800000>,
+						<2900000>,<3000000>,
+						<3100000>,<3200000>;
+                        hisilicon,num_consumer_supplies = <1>;
+                        hisilicon,consumer-supplies = "vibrator";
+                };
+
+		ldo19: regulator at a38 {
+                        compatible = "hisilicon,hi655x-regulator-pmic";
+                        regulator-name = "ldo19";
+                        regulator-min-microvolt = <1800000>;
+                        regulator-max-microvolt = <3000000>;
+                        hisilicon,valid-modes-mask = <0x0a>;
+                        hisilicon,valid-ops-mask = <0x01d>;
+                        hisilicon,initial-mode = <0x02>;
+                        hisilicon,regulator-type = <0x01>;
+
+                        hisilicon,off-on-delay = <360>;
+                        hisilicon,ctrl-regs = <0x02f 0x030 0x031>;
+                        hisilicon,ctrl-data = <0x2 0x1>;
+                        hisilicon,vset-regs = <0x084>;
+                        hisilicon,vset-data = <0 0x3>;
+                        hisilicon,regulator-n-vol = <8>;
+                        hisilicon,vset-table  = <1800000>,<1850000>,
+						<1900000>,<2750000>,
+						<2800000>,<2850000>,
+						<2900000>,<3000000>;
+                        hisilicon,num_consumer_supplies = <1>;
+                        hisilicon,consumer-supplies = "emmc_vddm";
+                };
+
+		ldo21: regulator at a40 {
+                        compatible = "hisilicon,hi655x-regulator-pmic";
+                        regulator-name = "ldo21";                                                                                                       regulator-min-microvolt = <1650000>;
+                        regulator-max-microvolt = <2000000>;
+                        regulator-always-on;
+                        hisilicon,valid-modes-mask = <0x02>;                                                                                            hisilicon,valid-ops-mask = <0x01d>;
+                        hisilicon,initial-mode = <0x02>;
+                        hisilicon,regulator-type = <0x01>;
+
+                        hisilicon,off-on-delay = <120>;
+                        hisilicon,ctrl-regs = <0x02f 0x030 0x031>;
+                        hisilicon,ctrl-data = <0x4 0x1>;
+                        hisilicon,vset-regs = <0x086>;
+                        hisilicon,vset-data = <0 0x3>;
+                        hisilicon,regulator-n-vol = <8>;
+                        hisilicon,vset-table  = <1650000>,<1700000>,
+						<1750000>,<1800000>,
+						<1850000>,<1900000>,
+						<1950000>,<2000000>;
+                };
+
+		ldo22: regulator at a41 {
+                        compatible = "hisilicon,hi655x-regulator-pmic";
+                        regulator-name = "ldo22";
+                        regulator-min-microvolt = <900000>;
+                        regulator-max-microvolt = <1200000>;
+                        regulator-boot-on;
+                        regulator-always-on;
+                        hisilicon,valid-modes-mask = <0x02>;
+                        hisilicon,valid-ops-mask = <0x01d>;
+                        hisilicon,initial-mode = <0x02>;
+                        hisilicon,regulator-type = <0x01>;
+
+                        hisilicon,off-on-delay = <120>;
+                        hisilicon,ctrl-regs = <0x02f 0x030 0x031>;
+                        hisilicon,ctrl-data = <0x5 0x1>;
+                        hisilicon,vset-regs = <0x087>;
+                        hisilicon,vset-data = <0 0x3>;
+                        hisilicon,regulator-n-vol = <8>;
+                        hisilicon,vset-table  = <900000>,<1000000>,
+						<1050000>,<1100000>,
+						<1150000>,<1175000>,
+						<1185000>,<1200000>;
+                        hisilicon,num_consumer_supplies = <1>;
+                        hisilicon,consumer-supplies = "mcamera_core";
+                };
 	};
 };
Signature · 1 line
1.7.9.5
author
#15 lore raw

PATCH 6/8 dt-bindings: mtcmos: Document Hi6220 mtcmos driver

In reply to Fei Wang

Document the new compatible for Hisilicon Hi6220 mtcmos driver.

---
 .../bindings/regulator/hisilicon,hi6220-mtcmos.txt |   32 ++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/hisilicon,hi6220-mtcmos.txt
Documentation/devicetree/bindings/regulator/hisilicon,hi6220-mtcmos.txt new file +32 -0
new file mode 100644
index 0000000..748ac62
@@ -0,0 +1,32 @@
+Hi6220 mtcmos Voltage regulators
+
+Required parent device properties:
+- compatible: Must be "hisilicon,hi6220-mtcmos-driver"
+- hisilicon,mtcmos-steady-us: The time to wait for power steady
+- hisilicon,mtcmos-sc-on-base: address of hi6220 soc control register
+
+Required child device properties:
+- regulator-name: The name of mtcmos
+- hisilicon,ctrl-regs: offset of ctrl-regs
+- hisilicon,ctrl-data: the bit to ctrl the regulator
+
+Example:
+        mtcmos {
+                compatible = "hisilicon,hi6220-mtcmos-driver";
+                hisilicon,mtcmos-steady-us = <10>;
+                hisilicon,mtcmos-sc-on-base  = <0xf7800000>;
+                hisilicon,mtcmos-acpu-on-base = <0xf65a0000>;
+
+                mtcmos1: regulator at a1{
+                        regulator-name = "G3D_PD_VDD";
+                        regulator-compatible = "mtcmos1";
+                        hisilicon,ctrl-regs = <0x830 0x834 0x83c>;
+                        hisilicon,ctrl-data = <1 0x1>;
+                };
+                mtcmos2: regulator at a2{
+                        regulator-name = "SOC_MED";
+                         regulator-compatible = "mtcmos2";
+                        hisilicon,ctrl-regs = <0x830 0x834 0x83c>;
+                        hisilicon,ctrl-data = <2 0x1>;
+                };
+        };
Signature · 1 line
1.7.9.5
author
#16 lore raw

PATCH 7/8 mtcmos: Hi6220: Add Hi6220 mtcmos regulator driver

In reply to Fei Wang

Add Hi6220 mtcmos regulator driver.

---
 drivers/regulator/Kconfig         |    8 ++
 drivers/regulator/Makefile        |    1 +
 drivers/regulator/hi6220-mtcmos.c |  281 +++++++++++++++++++++++++++++++++++++
 3 files changed, 290 insertions(+)
 create mode 100644 drivers/regulator/hi6220-mtcmos.c
drivers/regulator/Kconfig +8 -0
index d13210b..b5af2c6 100644
@@ -269,6 +269,14 @@ config REGULATOR_HI655X
           This driver provides support for the voltage regulators of the
           Hisilicon Hi655x PMIC device.
 
+config REGULATOR_HI6220
+        tristate "Hisilicon Hi6220 MTCMOS regulator support"
+        depends on ARCH_HISI
+        default ARCH_HISI
+        help
+          This driver provides support for the mtcmos regulators on the
+          Hisilicon Hi6220 chip.
+
 config REGULATOR_ISL9305
 	tristate "Intersil ISL9305 regulator"
 	depends on I2C
drivers/regulator/Makefile +1 -0
index 8e4db96..0590e8f 100644
@@ -35,6 +35,7 @@ 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_HI6220) += hi6220-mtcmos.o
 obj-$(CONFIG_REGULATOR_ISL6271A) += isl6271a-regulator.o
 obj-$(CONFIG_REGULATOR_ISL9305) += isl9305.o
 obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o
drivers/regulator/hi6220-mtcmos.c new file +281 -0

281 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author
#17 lore raw

PATCH 8/8 arm64: dts: Add Hi6220 mtcmos regulator node

In reply to Fei Wang

This patch add mtcmos regulator dts file for Hi6220 SoC.

---
 arch/arm64/boot/dts/hisilicon/hi6220.dtsi |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
arch/arm64/boot/dts/hisilicon/hi6220.dtsi +21 -0
index 40f895b..9b1a6ed 100644
@@ -167,6 +167,27 @@
 			clocks = <&ao_ctrl 36>, <&ao_ctrl 36>;
 			clock-names = "uartclk", "apb_pclk";
 		};
+
+		mtcmos {
+			compatible = "hisilicon,hi6220-mtcmos-driver";
+			hisilicon,mtcmos-steady-us = <10>;
+			hisilicon,mtcmos-sc-on-base  = <0xf7800000>;
+			hisilicon,mtcmos-acpu-on-base = <0xf65a0000>;
+
+			mtcmos1: regulator at a1{
+				regulator-name = "G3D_PD_VDD";
+				regulator-compatible = "mtcmos1";
+				hisilicon,ctrl-regs = <0x830 0x834 0x83c>;
+				hisilicon,ctrl-data = <1 0x1>;
+			};
+
+			mtcmos2: regulator at a2{
+				regulator-name = "SOC_MED";
+				regulator-compatible = "mtcmos2";
+				hisilicon,ctrl-regs = <0x830 0x834 0x83c>;
+				hisilicon,ctrl-data = <2 0x1>;
+			};
+		};
 	};
 
 	pmic: pmic at F8000000 {
Signature · 1 line
1.7.9.5