All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/11] AXP803 PMIC support for Pine64
@ 2017-04-07 18:34 ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood
  Cc: devicetree, linux-sunxi, linux-kernel, linux-arm-kernel, Icenowy Zheng

The Pine64 (including Pine64+) boards have an AXP803 PMIC, which is a PMIC
similar to AXP288, but tweaked to use with Allwinner SoCs rather than Intel
tablets (with DCIN and Vbus re-splitted like other AXP PMICs, and RSB bus
support added).

This patchset adds support for it and enabled it in Pine64 device tree.

This patchset can be splitted into two big parts:

- Part1: PATCH 1/11 to PATCH 5/11, which are enabling the MFD (and the
  power key functionality) of AXP803.

- Part2: PATCH 6/11 to PATCH 11/11, which are enabling the regulator
  function of the AXP803 PMIC. Finally Wi-Fi function is added
  as a usage of regulators function.

PATCH 1 and 2 added RSB and NMI device nodes, which are used for the
communication between A64 and AXP803.

PATCH 3 adds basical devicetree binding for AXP803.

PATCH 4 adds support for the AXP803 variant in axp20x-rsb mfd driver.

PATCH 5 enabled the AXP803 MFD in Pine64 device tree.

PATCH 6 adds devicetree binding for the regulators in AXP803.

PATCH 7 adds support for the regulators in AXP803 in the axp20x-regulator
driver.

PATCH 8 enabled the regulator MFD cell in AXP803.

PATCH 9 adds a DTSI file for AXP803, just like what have been done for other
AXPs.

PATCH 10 enabled the regulators on Pine64.

PATCH 11 enabled Wi-Fi support on Pine64, which required DLDO4 and ELDO1
regulators.

Icenowy Zheng (11):
  arm64: allwinner: a64: enable RSB on A64
  arm64: allwinner: a64: add NMI controller on A64
  dt-bindings: add device tree binding for X-Powers AXP803 PMIC
  mfd: axp20x: support AXP803 variant
  arm64: allwinner: a64: add AXP803 node to Pine64 device tree
  dt-bindings: add AXP803's regulator info
  regulator: axp20x-regulator: add support for AXP803
  mfd: axp20x: add axp20x-regulator cell for AXP803
  arm64: allwinner: a64: add DTSI file for AXP803 PMIC
  arm64: allwinner: a64: enable AXP803 regulators for Pine64
  arm64: allwinner: a64: enable Wi-Fi for Pine64

 Documentation/devicetree/bindings/mfd/axp20x.txt   |  32 ++++-
 arch/arm64/boot/dts/allwinner/axp803.dtsi          | 150 ++++++++++++++++++++
 .../arm64/boot/dts/allwinner/sun50i-a64-pine64.dts | 136 +++++++++++++++++++
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi      |  27 ++++
 drivers/mfd/axp20x-rsb.c                           |   1 +
 drivers/mfd/axp20x.c                               |  81 +++++++++++
 drivers/regulator/axp20x-regulator.c               | 151 ++++++++++++++++++---
 include/linux/mfd/axp20x.h                         |  77 ++++++++++-
 8 files changed, 631 insertions(+), 24 deletions(-)
 create mode 100644 arch/arm64/boot/dts/allwinner/axp803.dtsi

-- 
2.12.2

^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH v2 00/11] AXP803 PMIC support for Pine64
@ 2017-04-07 18:34 ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Icenowy Zheng

The Pine64 (including Pine64+) boards have an AXP803 PMIC, which is a PMIC
similar to AXP288, but tweaked to use with Allwinner SoCs rather than Intel
tablets (with DCIN and Vbus re-splitted like other AXP PMICs, and RSB bus
support added).

This patchset adds support for it and enabled it in Pine64 device tree.

This patchset can be splitted into two big parts:

- Part1: PATCH 1/11 to PATCH 5/11, which are enabling the MFD (and the
  power key functionality) of AXP803.

- Part2: PATCH 6/11 to PATCH 11/11, which are enabling the regulator
  function of the AXP803 PMIC. Finally Wi-Fi function is added
  as a usage of regulators function.

PATCH 1 and 2 added RSB and NMI device nodes, which are used for the
communication between A64 and AXP803.

PATCH 3 adds basical devicetree binding for AXP803.

PATCH 4 adds support for the AXP803 variant in axp20x-rsb mfd driver.

PATCH 5 enabled the AXP803 MFD in Pine64 device tree.

PATCH 6 adds devicetree binding for the regulators in AXP803.

PATCH 7 adds support for the regulators in AXP803 in the axp20x-regulator
driver.

PATCH 8 enabled the regulator MFD cell in AXP803.

PATCH 9 adds a DTSI file for AXP803, just like what have been done for other
AXPs.

PATCH 10 enabled the regulators on Pine64.

PATCH 11 enabled Wi-Fi support on Pine64, which required DLDO4 and ELDO1
regulators.

Icenowy Zheng (11):
  arm64: allwinner: a64: enable RSB on A64
  arm64: allwinner: a64: add NMI controller on A64
  dt-bindings: add device tree binding for X-Powers AXP803 PMIC
  mfd: axp20x: support AXP803 variant
  arm64: allwinner: a64: add AXP803 node to Pine64 device tree
  dt-bindings: add AXP803's regulator info
  regulator: axp20x-regulator: add support for AXP803
  mfd: axp20x: add axp20x-regulator cell for AXP803
  arm64: allwinner: a64: add DTSI file for AXP803 PMIC
  arm64: allwinner: a64: enable AXP803 regulators for Pine64
  arm64: allwinner: a64: enable Wi-Fi for Pine64

 Documentation/devicetree/bindings/mfd/axp20x.txt   |  32 ++++-
 arch/arm64/boot/dts/allwinner/axp803.dtsi          | 150 ++++++++++++++++++++
 .../arm64/boot/dts/allwinner/sun50i-a64-pine64.dts | 136 +++++++++++++++++++
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi      |  27 ++++
 drivers/mfd/axp20x-rsb.c                           |   1 +
 drivers/mfd/axp20x.c                               |  81 +++++++++++
 drivers/regulator/axp20x-regulator.c               | 151 ++++++++++++++++++---
 include/linux/mfd/axp20x.h                         |  77 ++++++++++-
 8 files changed, 631 insertions(+), 24 deletions(-)
 create mode 100644 arch/arm64/boot/dts/allwinner/axp803.dtsi

-- 
2.12.2

^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH v2 00/11] AXP803 PMIC support for Pine64
@ 2017-04-07 18:34 ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: linux-arm-kernel

The Pine64 (including Pine64+) boards have an AXP803 PMIC, which is a PMIC
similar to AXP288, but tweaked to use with Allwinner SoCs rather than Intel
tablets (with DCIN and Vbus re-splitted like other AXP PMICs, and RSB bus
support added).

This patchset adds support for it and enabled it in Pine64 device tree.

This patchset can be splitted into two big parts:

- Part1: PATCH 1/11 to PATCH 5/11, which are enabling the MFD (and the
  power key functionality) of AXP803.

- Part2: PATCH 6/11 to PATCH 11/11, which are enabling the regulator
  function of the AXP803 PMIC. Finally Wi-Fi function is added
  as a usage of regulators function.

PATCH 1 and 2 added RSB and NMI device nodes, which are used for the
communication between A64 and AXP803.

PATCH 3 adds basical devicetree binding for AXP803.

PATCH 4 adds support for the AXP803 variant in axp20x-rsb mfd driver.

PATCH 5 enabled the AXP803 MFD in Pine64 device tree.

PATCH 6 adds devicetree binding for the regulators in AXP803.

PATCH 7 adds support for the regulators in AXP803 in the axp20x-regulator
driver.

PATCH 8 enabled the regulator MFD cell in AXP803.

PATCH 9 adds a DTSI file for AXP803, just like what have been done for other
AXPs.

PATCH 10 enabled the regulators on Pine64.

PATCH 11 enabled Wi-Fi support on Pine64, which required DLDO4 and ELDO1
regulators.

Icenowy Zheng (11):
  arm64: allwinner: a64: enable RSB on A64
  arm64: allwinner: a64: add NMI controller on A64
  dt-bindings: add device tree binding for X-Powers AXP803 PMIC
  mfd: axp20x: support AXP803 variant
  arm64: allwinner: a64: add AXP803 node to Pine64 device tree
  dt-bindings: add AXP803's regulator info
  regulator: axp20x-regulator: add support for AXP803
  mfd: axp20x: add axp20x-regulator cell for AXP803
  arm64: allwinner: a64: add DTSI file for AXP803 PMIC
  arm64: allwinner: a64: enable AXP803 regulators for Pine64
  arm64: allwinner: a64: enable Wi-Fi for Pine64

 Documentation/devicetree/bindings/mfd/axp20x.txt   |  32 ++++-
 arch/arm64/boot/dts/allwinner/axp803.dtsi          | 150 ++++++++++++++++++++
 .../arm64/boot/dts/allwinner/sun50i-a64-pine64.dts | 136 +++++++++++++++++++
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi      |  27 ++++
 drivers/mfd/axp20x-rsb.c                           |   1 +
 drivers/mfd/axp20x.c                               |  81 +++++++++++
 drivers/regulator/axp20x-regulator.c               | 151 ++++++++++++++++++---
 include/linux/mfd/axp20x.h                         |  77 ++++++++++-
 8 files changed, 631 insertions(+), 24 deletions(-)
 create mode 100644 arch/arm64/boot/dts/allwinner/axp803.dtsi

-- 
2.12.2

^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH v2 01/11] arm64: allwinner: a64: enable RSB on A64
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood
  Cc: devicetree, linux-sunxi, linux-kernel, linux-arm-kernel, Icenowy Zheng

Allwinner A64 have a RSB controller like the one on A23/A33 SoCs.

Add it and its pinmux.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Acked-by: Chen-Yu Tsai <wens@csie.org>
---
Changes in v2:
- Removed bonus properties in pio node.
- Added Chen-Yu's ACK.

 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
index c7f669f5884f..05ec9fc5e81f 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
@@ -422,6 +422,25 @@
 			#gpio-cells = <3>;
 			interrupt-controller;
 			#interrupt-cells = <3>;
+
+			r_rsb_pins: rsb@0 {
+				pins = "PL0", "PL1";
+				function = "s_rsb";
+			};
+		};
+
+		r_rsb: rsb@1f03400 {
+			compatible = "allwinner,sun8i-a23-rsb";
+			reg = <0x01f03400 0x400>;
+			interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&r_ccu 6>;
+			clock-frequency = <3000000>;
+			resets = <&r_ccu 2>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&r_rsb_pins>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
 		};
 	};
 };
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 01/11] arm64: allwinner: a64: enable RSB on A64
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Icenowy Zheng

Allwinner A64 have a RSB controller like the one on A23/A33 SoCs.

Add it and its pinmux.

Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
Acked-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
---
Changes in v2:
- Removed bonus properties in pio node.
- Added Chen-Yu's ACK.

 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
index c7f669f5884f..05ec9fc5e81f 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
@@ -422,6 +422,25 @@
 			#gpio-cells = <3>;
 			interrupt-controller;
 			#interrupt-cells = <3>;
+
+			r_rsb_pins: rsb@0 {
+				pins = "PL0", "PL1";
+				function = "s_rsb";
+			};
+		};
+
+		r_rsb: rsb@1f03400 {
+			compatible = "allwinner,sun8i-a23-rsb";
+			reg = <0x01f03400 0x400>;
+			interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&r_ccu 6>;
+			clock-frequency = <3000000>;
+			resets = <&r_ccu 2>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&r_rsb_pins>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
 		};
 	};
 };
-- 
2.12.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 01/11] arm64: allwinner: a64: enable RSB on A64
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: linux-arm-kernel

Allwinner A64 have a RSB controller like the one on A23/A33 SoCs.

Add it and its pinmux.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Acked-by: Chen-Yu Tsai <wens@csie.org>
---
Changes in v2:
- Removed bonus properties in pio node.
- Added Chen-Yu's ACK.

 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
index c7f669f5884f..05ec9fc5e81f 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
@@ -422,6 +422,25 @@
 			#gpio-cells = <3>;
 			interrupt-controller;
 			#interrupt-cells = <3>;
+
+			r_rsb_pins: rsb at 0 {
+				pins = "PL0", "PL1";
+				function = "s_rsb";
+			};
+		};
+
+		r_rsb: rsb at 1f03400 {
+			compatible = "allwinner,sun8i-a23-rsb";
+			reg = <0x01f03400 0x400>;
+			interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&r_ccu 6>;
+			clock-frequency = <3000000>;
+			resets = <&r_ccu 2>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&r_rsb_pins>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
 		};
 	};
 };
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 02/11] arm64: allwinner: a64: add NMI controller on A64
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood
  Cc: devicetree, linux-sunxi, linux-kernel, linux-arm-kernel, Icenowy Zheng

Allwinner A64 SoC features a NMI controller, which is usually connected
to the AXP PMIC.

Add support for it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Acked-by: Chen-Yu Tsai <wens@csie.org>
---
Changes in v2:
- Added Chen-Yu's ACK.

 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
index 05ec9fc5e81f..53c18ca372ea 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
@@ -403,6 +403,14 @@
 				     <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
 		};
 
+		nmi_intc: interrupt-controller@01f00c0c {
+			compatible = "allwinner,sun6i-a31-sc-nmi";
+			interrupt-controller;
+			#interrupt-cells = <2>;
+			reg = <0x01f00c0c 0x38>;
+			interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
+		};
+
 		r_ccu: clock@1f01400 {
 			compatible = "allwinner,sun50i-a64-r-ccu";
 			reg = <0x01f01400 0x100>;
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 02/11] arm64: allwinner: a64: add NMI controller on A64
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Icenowy Zheng

Allwinner A64 SoC features a NMI controller, which is usually connected
to the AXP PMIC.

Add support for it.

Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
Acked-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
---
Changes in v2:
- Added Chen-Yu's ACK.

 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
index 05ec9fc5e81f..53c18ca372ea 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
@@ -403,6 +403,14 @@
 				     <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
 		};
 
+		nmi_intc: interrupt-controller@01f00c0c {
+			compatible = "allwinner,sun6i-a31-sc-nmi";
+			interrupt-controller;
+			#interrupt-cells = <2>;
+			reg = <0x01f00c0c 0x38>;
+			interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
+		};
+
 		r_ccu: clock@1f01400 {
 			compatible = "allwinner,sun50i-a64-r-ccu";
 			reg = <0x01f01400 0x100>;
-- 
2.12.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 02/11] arm64: allwinner: a64: add NMI controller on A64
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: linux-arm-kernel

Allwinner A64 SoC features a NMI controller, which is usually connected
to the AXP PMIC.

Add support for it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Acked-by: Chen-Yu Tsai <wens@csie.org>
---
Changes in v2:
- Added Chen-Yu's ACK.

 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
index 05ec9fc5e81f..53c18ca372ea 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
@@ -403,6 +403,14 @@
 				     <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
 		};
 
+		nmi_intc: interrupt-controller at 01f00c0c {
+			compatible = "allwinner,sun6i-a31-sc-nmi";
+			interrupt-controller;
+			#interrupt-cells = <2>;
+			reg = <0x01f00c0c 0x38>;
+			interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
+		};
+
 		r_ccu: clock at 1f01400 {
 			compatible = "allwinner,sun50i-a64-r-ccu";
 			reg = <0x01f01400 0x100>;
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 03/11] dt-bindings: add device tree binding for X-Powers AXP803 PMIC
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood
  Cc: devicetree, linux-sunxi, linux-kernel, linux-arm-kernel, Icenowy Zheng

AXP803 is a PMIC produced by Shenzhen X-Powers, with either I2C or RSB
bus.

Add a compatible for it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Acked-by: Chen-Yu Tsai <wens@csie.org>
---
Changes in v2:
- Place AXP803 before AXP806/809.
- Added Chen-Yu's ACK.

 Documentation/devicetree/bindings/mfd/axp20x.txt | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
index b41d2601c6ba..334fb19ce605 100644
--- a/Documentation/devicetree/bindings/mfd/axp20x.txt
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -6,12 +6,13 @@ axp202 (X-Powers)
 axp209 (X-Powers)
 axp221 (X-Powers)
 axp223 (X-Powers)
+axp803 (X-Powers)
 axp809 (X-Powers)
 
 Required properties:
 - compatible: "x-powers,axp152", "x-powers,axp202", "x-powers,axp209",
-	      "x-powers,axp221", "x-powers,axp223", "x-powers,axp806",
-	      "x-powers,axp809"
+	      "x-powers,axp221", "x-powers,axp223", "x-powers,axp803",
+	      "x-powers,axp806", "x-powers,axp809"
 - reg: The I2C slave address or RSB hardware address for the AXP chip
 - interrupt-parent: The parent interrupt controller
 - interrupts: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 03/11] dt-bindings: add device tree binding for X-Powers AXP803 PMIC
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Icenowy Zheng

AXP803 is a PMIC produced by Shenzhen X-Powers, with either I2C or RSB
bus.

Add a compatible for it.

Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
Acked-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
---
Changes in v2:
- Place AXP803 before AXP806/809.
- Added Chen-Yu's ACK.

 Documentation/devicetree/bindings/mfd/axp20x.txt | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
index b41d2601c6ba..334fb19ce605 100644
--- a/Documentation/devicetree/bindings/mfd/axp20x.txt
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -6,12 +6,13 @@ axp202 (X-Powers)
 axp209 (X-Powers)
 axp221 (X-Powers)
 axp223 (X-Powers)
+axp803 (X-Powers)
 axp809 (X-Powers)
 
 Required properties:
 - compatible: "x-powers,axp152", "x-powers,axp202", "x-powers,axp209",
-	      "x-powers,axp221", "x-powers,axp223", "x-powers,axp806",
-	      "x-powers,axp809"
+	      "x-powers,axp221", "x-powers,axp223", "x-powers,axp803",
+	      "x-powers,axp806", "x-powers,axp809"
 - reg: The I2C slave address or RSB hardware address for the AXP chip
 - interrupt-parent: The parent interrupt controller
 - interrupts: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
-- 
2.12.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 03/11] dt-bindings: add device tree binding for X-Powers AXP803 PMIC
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: linux-arm-kernel

AXP803 is a PMIC produced by Shenzhen X-Powers, with either I2C or RSB
bus.

Add a compatible for it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Acked-by: Chen-Yu Tsai <wens@csie.org>
---
Changes in v2:
- Place AXP803 before AXP806/809.
- Added Chen-Yu's ACK.

 Documentation/devicetree/bindings/mfd/axp20x.txt | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
index b41d2601c6ba..334fb19ce605 100644
--- a/Documentation/devicetree/bindings/mfd/axp20x.txt
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -6,12 +6,13 @@ axp202 (X-Powers)
 axp209 (X-Powers)
 axp221 (X-Powers)
 axp223 (X-Powers)
+axp803 (X-Powers)
 axp809 (X-Powers)
 
 Required properties:
 - compatible: "x-powers,axp152", "x-powers,axp202", "x-powers,axp209",
-	      "x-powers,axp221", "x-powers,axp223", "x-powers,axp806",
-	      "x-powers,axp809"
+	      "x-powers,axp221", "x-powers,axp223", "x-powers,axp803",
+	      "x-powers,axp806", "x-powers,axp809"
 - reg: The I2C slave address or RSB hardware address for the AXP chip
 - interrupt-parent: The parent interrupt controller
 - interrupts: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 04/11] mfd: axp20x: support AXP803 variant
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood
  Cc: devicetree, linux-sunxi, linux-kernel, linux-arm-kernel, Icenowy Zheng

AXP803 is a new PMIC chip produced by X-Powers, usually paired with A64
via RSB bus. The PMIC itself is like AXP288, but with RSB support and
dedicated VBUS and ACIN.

Add support for it in the axp20x mfd driver.

Currently only power key function is supported.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
Changes in v2:
- Share regmap configs with AXP288.
- Place AXP803 bits before AXP806/809.

 drivers/mfd/axp20x-rsb.c   |  1 +
 drivers/mfd/axp20x.c       | 79 ++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h | 40 ++++++++++++++++++++++-
 3 files changed, 119 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/axp20x-rsb.c b/drivers/mfd/axp20x-rsb.c
index a732cb50bcff..fd5c7267b136 100644
--- a/drivers/mfd/axp20x-rsb.c
+++ b/drivers/mfd/axp20x-rsb.c
@@ -61,6 +61,7 @@ static int axp20x_rsb_remove(struct sunxi_rsb_device *rdev)
 
 static const struct of_device_id axp20x_rsb_of_match[] = {
 	{ .compatible = "x-powers,axp223", .data = (void *)AXP223_ID },
+	{ .compatible = "x-powers,axp803", .data = (void *)AXP803_ID },
 	{ .compatible = "x-powers,axp806", .data = (void *)AXP806_ID },
 	{ .compatible = "x-powers,axp809", .data = (void *)AXP809_ID },
 	{ },
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 5ba3b04cc9b1..2268a6a9aa2c 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -41,6 +41,7 @@ static const char * const axp20x_model_names[] = {
 	"AXP221",
 	"AXP223",
 	"AXP288",
+	"AXP803",
 	"AXP806",
 	"AXP809",
 };
@@ -117,6 +118,7 @@ static const struct regmap_access_table axp22x_volatile_table = {
 	.n_yes_ranges	= ARRAY_SIZE(axp22x_volatile_ranges),
 };
 
+/* AXP288 ranges are shared with the AXP803, as they cover the same range */
 static const struct regmap_range axp288_writeable_ranges[] = {
 	regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ6_STATE),
 	regmap_reg_range(AXP20X_DCDC_MODE, AXP288_FG_TUNE5),
@@ -264,6 +266,20 @@ static struct resource axp288_fuel_gauge_resources[] = {
 	},
 };
 
+static struct resource axp803_pek_resources[] = {
+	{
+		.name   = "PEK_DBR",
+		.start  = AXP803_IRQ_PEK_RIS_EDGE,
+		.end    = AXP803_IRQ_PEK_RIS_EDGE,
+		.flags  = IORESOURCE_IRQ,
+	}, {
+		.name   = "PEK_DBF",
+		.start  = AXP803_IRQ_PEK_FAL_EDGE,
+		.end    = AXP803_IRQ_PEK_FAL_EDGE,
+		.flags  = IORESOURCE_IRQ,
+	},
+};
+
 static struct resource axp809_pek_resources[] = {
 	{
 		.name   = "PEK_DBR",
@@ -457,6 +473,43 @@ static const struct regmap_irq axp288_regmap_irqs[] = {
 	INIT_REGMAP_IRQ(AXP288, BC_USB_CHNG,            5, 1),
 };
 
+static const struct regmap_irq axp803_regmap_irqs[] = {
+	INIT_REGMAP_IRQ(AXP803, ACIN_OVER_V,		0, 7),
+	INIT_REGMAP_IRQ(AXP803, ACIN_PLUGIN,		0, 6),
+	INIT_REGMAP_IRQ(AXP803, ACIN_REMOVAL,	        0, 5),
+	INIT_REGMAP_IRQ(AXP803, VBUS_OVER_V,		0, 4),
+	INIT_REGMAP_IRQ(AXP803, VBUS_PLUGIN,		0, 3),
+	INIT_REGMAP_IRQ(AXP803, VBUS_REMOVAL,	        0, 2),
+	INIT_REGMAP_IRQ(AXP803, BATT_PLUGIN,		1, 7),
+	INIT_REGMAP_IRQ(AXP803, BATT_REMOVAL,	        1, 6),
+	INIT_REGMAP_IRQ(AXP803, BATT_ENT_ACT_MODE,	1, 5),
+	INIT_REGMAP_IRQ(AXP803, BATT_EXIT_ACT_MODE,	1, 4),
+	INIT_REGMAP_IRQ(AXP803, CHARG,		        1, 3),
+	INIT_REGMAP_IRQ(AXP803, CHARG_DONE,		1, 2),
+	INIT_REGMAP_IRQ(AXP803, BATT_CHG_TEMP_HIGH,	2, 7),
+	INIT_REGMAP_IRQ(AXP803, BATT_CHG_TEMP_HIGH_END,	2, 6),
+	INIT_REGMAP_IRQ(AXP803, BATT_CHG_TEMP_LOW,	2, 5),
+	INIT_REGMAP_IRQ(AXP803, BATT_CHG_TEMP_LOW_END,	2, 4),
+	INIT_REGMAP_IRQ(AXP803, BATT_ACT_TEMP_HIGH,	2, 3),
+	INIT_REGMAP_IRQ(AXP803, BATT_ACT_TEMP_HIGH_END,	2, 2),
+	INIT_REGMAP_IRQ(AXP803, BATT_ACT_TEMP_LOW,	2, 1),
+	INIT_REGMAP_IRQ(AXP803, BATT_ACT_TEMP_LOW_END,	2, 0),
+	INIT_REGMAP_IRQ(AXP803, DIE_TEMP_HIGH,	        3, 7),
+	INIT_REGMAP_IRQ(AXP803, GPADC,		        3, 2),
+	INIT_REGMAP_IRQ(AXP803, LOW_PWR_LVL1,	        3, 1),
+	INIT_REGMAP_IRQ(AXP803, LOW_PWR_LVL2,	        3, 0),
+	INIT_REGMAP_IRQ(AXP803, TIMER,		        4, 7),
+	INIT_REGMAP_IRQ(AXP803, PEK_RIS_EDGE,	        4, 6),
+	INIT_REGMAP_IRQ(AXP803, PEK_FAL_EDGE,	        4, 5),
+	INIT_REGMAP_IRQ(AXP803, PEK_SHORT,		4, 4),
+	INIT_REGMAP_IRQ(AXP803, PEK_LONG,		4, 3),
+	INIT_REGMAP_IRQ(AXP803, PEK_OVER_OFF,		4, 2),
+	INIT_REGMAP_IRQ(AXP803, GPIO1_INPUT,		4, 1),
+	INIT_REGMAP_IRQ(AXP803, GPIO0_INPUT,		4, 0),
+	INIT_REGMAP_IRQ(AXP803, BC_USB_CHNG,            5, 1),
+	INIT_REGMAP_IRQ(AXP803, MV_CHNG,                5, 0),
+};
+
 static const struct regmap_irq axp806_regmap_irqs[] = {
 	INIT_REGMAP_IRQ(AXP806, DIE_TEMP_HIGH_LV1,	0, 0),
 	INIT_REGMAP_IRQ(AXP806, DIE_TEMP_HIGH_LV2,	0, 1),
@@ -557,6 +610,18 @@ static const struct regmap_irq_chip axp288_regmap_irq_chip = {
 
 };
 
+static const struct regmap_irq_chip axp803_regmap_irq_chip = {
+	.name			= "axp803",
+	.status_base		= AXP20X_IRQ1_STATE,
+	.ack_base		= AXP20X_IRQ1_STATE,
+	.mask_base		= AXP20X_IRQ1_EN,
+	.mask_invert		= true,
+	.init_ack_masked	= true,
+	.irqs			= axp803_regmap_irqs,
+	.num_irqs		= ARRAY_SIZE(axp803_regmap_irqs),
+	.num_regs		= 6,
+};
+
 static const struct regmap_irq_chip axp806_regmap_irq_chip = {
 	.name			= "axp806",
 	.status_base		= AXP20X_IRQ1_STATE,
@@ -769,6 +834,14 @@ static struct mfd_cell axp288_cells[] = {
 	},
 };
 
+static struct mfd_cell axp803_cells[] = {
+	{
+		.name			= "axp20x-pek",
+		.num_resources		= ARRAY_SIZE(axp803_pek_resources),
+		.resources		= axp803_pek_resources,
+	}
+};
+
 static struct mfd_cell axp806_cells[] = {
 	{
 		.id			= 2,
@@ -855,6 +928,12 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
 		axp20x->regmap_irq_chip = &axp288_regmap_irq_chip;
 		axp20x->irq_flags = IRQF_TRIGGER_LOW;
 		break;
+	case AXP803_ID:
+		axp20x->nr_cells = ARRAY_SIZE(axp803_cells);
+		axp20x->cells = axp803_cells;
+		axp20x->regmap_cfg = &axp288_regmap_config;
+		axp20x->regmap_irq_chip = &axp803_regmap_irq_chip;
+		break;
 	case AXP806_ID:
 		axp20x->nr_cells = ARRAY_SIZE(axp806_cells);
 		axp20x->cells = axp806_cells;
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index dc8798cf2a24..cde56cfe8446 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -20,6 +20,7 @@ enum axp20x_variants {
 	AXP221_ID,
 	AXP223_ID,
 	AXP288_ID,
+	AXP803_ID,
 	AXP806_ID,
 	AXP809_ID,
 	NR_AXP20X_VARIANTS,
@@ -234,7 +235,7 @@ enum axp20x_variants {
 #define AXP22X_TS_ADC_L			0x59
 #define AXP22X_BATLOW_THRES1		0xe6
 
-/* AXP288 specific registers */
+/* AXP288/AXP803 specific registers */
 #define AXP288_POWER_REASON		0x02
 #define AXP288_BC_GLOBAL		0x2c
 #define AXP288_BC_VBUS_CNTL		0x2d
@@ -475,6 +476,43 @@ enum axp288_irqs {
 	AXP288_IRQ_BC_USB_CHNG,
 };
 
+enum axp803_irqs {
+	AXP803_IRQ_ACIN_OVER_V = 1,
+	AXP803_IRQ_ACIN_PLUGIN,
+	AXP803_IRQ_ACIN_REMOVAL,
+	AXP803_IRQ_VBUS_OVER_V,
+	AXP803_IRQ_VBUS_PLUGIN,
+	AXP803_IRQ_VBUS_REMOVAL,
+	AXP803_IRQ_BATT_PLUGIN,
+	AXP803_IRQ_BATT_REMOVAL,
+	AXP803_IRQ_BATT_ENT_ACT_MODE,
+	AXP803_IRQ_BATT_EXIT_ACT_MODE,
+	AXP803_IRQ_CHARG,
+	AXP803_IRQ_CHARG_DONE,
+	AXP803_IRQ_BATT_CHG_TEMP_HIGH,
+	AXP803_IRQ_BATT_CHG_TEMP_HIGH_END,
+	AXP803_IRQ_BATT_CHG_TEMP_LOW,
+	AXP803_IRQ_BATT_CHG_TEMP_LOW_END,
+	AXP803_IRQ_BATT_ACT_TEMP_HIGH,
+	AXP803_IRQ_BATT_ACT_TEMP_HIGH_END,
+	AXP803_IRQ_BATT_ACT_TEMP_LOW,
+	AXP803_IRQ_BATT_ACT_TEMP_LOW_END,
+	AXP803_IRQ_DIE_TEMP_HIGH,
+	AXP803_IRQ_GPADC,
+	AXP803_IRQ_LOW_PWR_LVL1,
+	AXP803_IRQ_LOW_PWR_LVL2,
+	AXP803_IRQ_TIMER,
+	AXP803_IRQ_PEK_RIS_EDGE,
+	AXP803_IRQ_PEK_FAL_EDGE,
+	AXP803_IRQ_PEK_SHORT,
+	AXP803_IRQ_PEK_LONG,
+	AXP803_IRQ_PEK_OVER_OFF,
+	AXP803_IRQ_GPIO1_INPUT,
+	AXP803_IRQ_GPIO0_INPUT,
+	AXP803_IRQ_BC_USB_CHNG,
+	AXP803_IRQ_MV_CHNG,
+};
+
 enum axp806_irqs {
 	AXP806_IRQ_DIE_TEMP_HIGH_LV1,
 	AXP806_IRQ_DIE_TEMP_HIGH_LV2,
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 04/11] mfd: axp20x: support AXP803 variant
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Icenowy Zheng

AXP803 is a new PMIC chip produced by X-Powers, usually paired with A64
via RSB bus. The PMIC itself is like AXP288, but with RSB support and
dedicated VBUS and ACIN.

Add support for it in the axp20x mfd driver.

Currently only power key function is supported.

Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
---
Changes in v2:
- Share regmap configs with AXP288.
- Place AXP803 bits before AXP806/809.

 drivers/mfd/axp20x-rsb.c   |  1 +
 drivers/mfd/axp20x.c       | 79 ++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h | 40 ++++++++++++++++++++++-
 3 files changed, 119 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/axp20x-rsb.c b/drivers/mfd/axp20x-rsb.c
index a732cb50bcff..fd5c7267b136 100644
--- a/drivers/mfd/axp20x-rsb.c
+++ b/drivers/mfd/axp20x-rsb.c
@@ -61,6 +61,7 @@ static int axp20x_rsb_remove(struct sunxi_rsb_device *rdev)
 
 static const struct of_device_id axp20x_rsb_of_match[] = {
 	{ .compatible = "x-powers,axp223", .data = (void *)AXP223_ID },
+	{ .compatible = "x-powers,axp803", .data = (void *)AXP803_ID },
 	{ .compatible = "x-powers,axp806", .data = (void *)AXP806_ID },
 	{ .compatible = "x-powers,axp809", .data = (void *)AXP809_ID },
 	{ },
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 5ba3b04cc9b1..2268a6a9aa2c 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -41,6 +41,7 @@ static const char * const axp20x_model_names[] = {
 	"AXP221",
 	"AXP223",
 	"AXP288",
+	"AXP803",
 	"AXP806",
 	"AXP809",
 };
@@ -117,6 +118,7 @@ static const struct regmap_access_table axp22x_volatile_table = {
 	.n_yes_ranges	= ARRAY_SIZE(axp22x_volatile_ranges),
 };
 
+/* AXP288 ranges are shared with the AXP803, as they cover the same range */
 static const struct regmap_range axp288_writeable_ranges[] = {
 	regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ6_STATE),
 	regmap_reg_range(AXP20X_DCDC_MODE, AXP288_FG_TUNE5),
@@ -264,6 +266,20 @@ static struct resource axp288_fuel_gauge_resources[] = {
 	},
 };
 
+static struct resource axp803_pek_resources[] = {
+	{
+		.name   = "PEK_DBR",
+		.start  = AXP803_IRQ_PEK_RIS_EDGE,
+		.end    = AXP803_IRQ_PEK_RIS_EDGE,
+		.flags  = IORESOURCE_IRQ,
+	}, {
+		.name   = "PEK_DBF",
+		.start  = AXP803_IRQ_PEK_FAL_EDGE,
+		.end    = AXP803_IRQ_PEK_FAL_EDGE,
+		.flags  = IORESOURCE_IRQ,
+	},
+};
+
 static struct resource axp809_pek_resources[] = {
 	{
 		.name   = "PEK_DBR",
@@ -457,6 +473,43 @@ static const struct regmap_irq axp288_regmap_irqs[] = {
 	INIT_REGMAP_IRQ(AXP288, BC_USB_CHNG,            5, 1),
 };
 
+static const struct regmap_irq axp803_regmap_irqs[] = {
+	INIT_REGMAP_IRQ(AXP803, ACIN_OVER_V,		0, 7),
+	INIT_REGMAP_IRQ(AXP803, ACIN_PLUGIN,		0, 6),
+	INIT_REGMAP_IRQ(AXP803, ACIN_REMOVAL,	        0, 5),
+	INIT_REGMAP_IRQ(AXP803, VBUS_OVER_V,		0, 4),
+	INIT_REGMAP_IRQ(AXP803, VBUS_PLUGIN,		0, 3),
+	INIT_REGMAP_IRQ(AXP803, VBUS_REMOVAL,	        0, 2),
+	INIT_REGMAP_IRQ(AXP803, BATT_PLUGIN,		1, 7),
+	INIT_REGMAP_IRQ(AXP803, BATT_REMOVAL,	        1, 6),
+	INIT_REGMAP_IRQ(AXP803, BATT_ENT_ACT_MODE,	1, 5),
+	INIT_REGMAP_IRQ(AXP803, BATT_EXIT_ACT_MODE,	1, 4),
+	INIT_REGMAP_IRQ(AXP803, CHARG,		        1, 3),
+	INIT_REGMAP_IRQ(AXP803, CHARG_DONE,		1, 2),
+	INIT_REGMAP_IRQ(AXP803, BATT_CHG_TEMP_HIGH,	2, 7),
+	INIT_REGMAP_IRQ(AXP803, BATT_CHG_TEMP_HIGH_END,	2, 6),
+	INIT_REGMAP_IRQ(AXP803, BATT_CHG_TEMP_LOW,	2, 5),
+	INIT_REGMAP_IRQ(AXP803, BATT_CHG_TEMP_LOW_END,	2, 4),
+	INIT_REGMAP_IRQ(AXP803, BATT_ACT_TEMP_HIGH,	2, 3),
+	INIT_REGMAP_IRQ(AXP803, BATT_ACT_TEMP_HIGH_END,	2, 2),
+	INIT_REGMAP_IRQ(AXP803, BATT_ACT_TEMP_LOW,	2, 1),
+	INIT_REGMAP_IRQ(AXP803, BATT_ACT_TEMP_LOW_END,	2, 0),
+	INIT_REGMAP_IRQ(AXP803, DIE_TEMP_HIGH,	        3, 7),
+	INIT_REGMAP_IRQ(AXP803, GPADC,		        3, 2),
+	INIT_REGMAP_IRQ(AXP803, LOW_PWR_LVL1,	        3, 1),
+	INIT_REGMAP_IRQ(AXP803, LOW_PWR_LVL2,	        3, 0),
+	INIT_REGMAP_IRQ(AXP803, TIMER,		        4, 7),
+	INIT_REGMAP_IRQ(AXP803, PEK_RIS_EDGE,	        4, 6),
+	INIT_REGMAP_IRQ(AXP803, PEK_FAL_EDGE,	        4, 5),
+	INIT_REGMAP_IRQ(AXP803, PEK_SHORT,		4, 4),
+	INIT_REGMAP_IRQ(AXP803, PEK_LONG,		4, 3),
+	INIT_REGMAP_IRQ(AXP803, PEK_OVER_OFF,		4, 2),
+	INIT_REGMAP_IRQ(AXP803, GPIO1_INPUT,		4, 1),
+	INIT_REGMAP_IRQ(AXP803, GPIO0_INPUT,		4, 0),
+	INIT_REGMAP_IRQ(AXP803, BC_USB_CHNG,            5, 1),
+	INIT_REGMAP_IRQ(AXP803, MV_CHNG,                5, 0),
+};
+
 static const struct regmap_irq axp806_regmap_irqs[] = {
 	INIT_REGMAP_IRQ(AXP806, DIE_TEMP_HIGH_LV1,	0, 0),
 	INIT_REGMAP_IRQ(AXP806, DIE_TEMP_HIGH_LV2,	0, 1),
@@ -557,6 +610,18 @@ static const struct regmap_irq_chip axp288_regmap_irq_chip = {
 
 };
 
+static const struct regmap_irq_chip axp803_regmap_irq_chip = {
+	.name			= "axp803",
+	.status_base		= AXP20X_IRQ1_STATE,
+	.ack_base		= AXP20X_IRQ1_STATE,
+	.mask_base		= AXP20X_IRQ1_EN,
+	.mask_invert		= true,
+	.init_ack_masked	= true,
+	.irqs			= axp803_regmap_irqs,
+	.num_irqs		= ARRAY_SIZE(axp803_regmap_irqs),
+	.num_regs		= 6,
+};
+
 static const struct regmap_irq_chip axp806_regmap_irq_chip = {
 	.name			= "axp806",
 	.status_base		= AXP20X_IRQ1_STATE,
@@ -769,6 +834,14 @@ static struct mfd_cell axp288_cells[] = {
 	},
 };
 
+static struct mfd_cell axp803_cells[] = {
+	{
+		.name			= "axp20x-pek",
+		.num_resources		= ARRAY_SIZE(axp803_pek_resources),
+		.resources		= axp803_pek_resources,
+	}
+};
+
 static struct mfd_cell axp806_cells[] = {
 	{
 		.id			= 2,
@@ -855,6 +928,12 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
 		axp20x->regmap_irq_chip = &axp288_regmap_irq_chip;
 		axp20x->irq_flags = IRQF_TRIGGER_LOW;
 		break;
+	case AXP803_ID:
+		axp20x->nr_cells = ARRAY_SIZE(axp803_cells);
+		axp20x->cells = axp803_cells;
+		axp20x->regmap_cfg = &axp288_regmap_config;
+		axp20x->regmap_irq_chip = &axp803_regmap_irq_chip;
+		break;
 	case AXP806_ID:
 		axp20x->nr_cells = ARRAY_SIZE(axp806_cells);
 		axp20x->cells = axp806_cells;
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index dc8798cf2a24..cde56cfe8446 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -20,6 +20,7 @@ enum axp20x_variants {
 	AXP221_ID,
 	AXP223_ID,
 	AXP288_ID,
+	AXP803_ID,
 	AXP806_ID,
 	AXP809_ID,
 	NR_AXP20X_VARIANTS,
@@ -234,7 +235,7 @@ enum axp20x_variants {
 #define AXP22X_TS_ADC_L			0x59
 #define AXP22X_BATLOW_THRES1		0xe6
 
-/* AXP288 specific registers */
+/* AXP288/AXP803 specific registers */
 #define AXP288_POWER_REASON		0x02
 #define AXP288_BC_GLOBAL		0x2c
 #define AXP288_BC_VBUS_CNTL		0x2d
@@ -475,6 +476,43 @@ enum axp288_irqs {
 	AXP288_IRQ_BC_USB_CHNG,
 };
 
+enum axp803_irqs {
+	AXP803_IRQ_ACIN_OVER_V = 1,
+	AXP803_IRQ_ACIN_PLUGIN,
+	AXP803_IRQ_ACIN_REMOVAL,
+	AXP803_IRQ_VBUS_OVER_V,
+	AXP803_IRQ_VBUS_PLUGIN,
+	AXP803_IRQ_VBUS_REMOVAL,
+	AXP803_IRQ_BATT_PLUGIN,
+	AXP803_IRQ_BATT_REMOVAL,
+	AXP803_IRQ_BATT_ENT_ACT_MODE,
+	AXP803_IRQ_BATT_EXIT_ACT_MODE,
+	AXP803_IRQ_CHARG,
+	AXP803_IRQ_CHARG_DONE,
+	AXP803_IRQ_BATT_CHG_TEMP_HIGH,
+	AXP803_IRQ_BATT_CHG_TEMP_HIGH_END,
+	AXP803_IRQ_BATT_CHG_TEMP_LOW,
+	AXP803_IRQ_BATT_CHG_TEMP_LOW_END,
+	AXP803_IRQ_BATT_ACT_TEMP_HIGH,
+	AXP803_IRQ_BATT_ACT_TEMP_HIGH_END,
+	AXP803_IRQ_BATT_ACT_TEMP_LOW,
+	AXP803_IRQ_BATT_ACT_TEMP_LOW_END,
+	AXP803_IRQ_DIE_TEMP_HIGH,
+	AXP803_IRQ_GPADC,
+	AXP803_IRQ_LOW_PWR_LVL1,
+	AXP803_IRQ_LOW_PWR_LVL2,
+	AXP803_IRQ_TIMER,
+	AXP803_IRQ_PEK_RIS_EDGE,
+	AXP803_IRQ_PEK_FAL_EDGE,
+	AXP803_IRQ_PEK_SHORT,
+	AXP803_IRQ_PEK_LONG,
+	AXP803_IRQ_PEK_OVER_OFF,
+	AXP803_IRQ_GPIO1_INPUT,
+	AXP803_IRQ_GPIO0_INPUT,
+	AXP803_IRQ_BC_USB_CHNG,
+	AXP803_IRQ_MV_CHNG,
+};
+
 enum axp806_irqs {
 	AXP806_IRQ_DIE_TEMP_HIGH_LV1,
 	AXP806_IRQ_DIE_TEMP_HIGH_LV2,
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 04/11] mfd: axp20x: support AXP803 variant
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: linux-arm-kernel

AXP803 is a new PMIC chip produced by X-Powers, usually paired with A64
via RSB bus. The PMIC itself is like AXP288, but with RSB support and
dedicated VBUS and ACIN.

Add support for it in the axp20x mfd driver.

Currently only power key function is supported.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
Changes in v2:
- Share regmap configs with AXP288.
- Place AXP803 bits before AXP806/809.

 drivers/mfd/axp20x-rsb.c   |  1 +
 drivers/mfd/axp20x.c       | 79 ++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h | 40 ++++++++++++++++++++++-
 3 files changed, 119 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/axp20x-rsb.c b/drivers/mfd/axp20x-rsb.c
index a732cb50bcff..fd5c7267b136 100644
--- a/drivers/mfd/axp20x-rsb.c
+++ b/drivers/mfd/axp20x-rsb.c
@@ -61,6 +61,7 @@ static int axp20x_rsb_remove(struct sunxi_rsb_device *rdev)
 
 static const struct of_device_id axp20x_rsb_of_match[] = {
 	{ .compatible = "x-powers,axp223", .data = (void *)AXP223_ID },
+	{ .compatible = "x-powers,axp803", .data = (void *)AXP803_ID },
 	{ .compatible = "x-powers,axp806", .data = (void *)AXP806_ID },
 	{ .compatible = "x-powers,axp809", .data = (void *)AXP809_ID },
 	{ },
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 5ba3b04cc9b1..2268a6a9aa2c 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -41,6 +41,7 @@ static const char * const axp20x_model_names[] = {
 	"AXP221",
 	"AXP223",
 	"AXP288",
+	"AXP803",
 	"AXP806",
 	"AXP809",
 };
@@ -117,6 +118,7 @@ static const struct regmap_access_table axp22x_volatile_table = {
 	.n_yes_ranges	= ARRAY_SIZE(axp22x_volatile_ranges),
 };
 
+/* AXP288 ranges are shared with the AXP803, as they cover the same range */
 static const struct regmap_range axp288_writeable_ranges[] = {
 	regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ6_STATE),
 	regmap_reg_range(AXP20X_DCDC_MODE, AXP288_FG_TUNE5),
@@ -264,6 +266,20 @@ static struct resource axp288_fuel_gauge_resources[] = {
 	},
 };
 
+static struct resource axp803_pek_resources[] = {
+	{
+		.name   = "PEK_DBR",
+		.start  = AXP803_IRQ_PEK_RIS_EDGE,
+		.end    = AXP803_IRQ_PEK_RIS_EDGE,
+		.flags  = IORESOURCE_IRQ,
+	}, {
+		.name   = "PEK_DBF",
+		.start  = AXP803_IRQ_PEK_FAL_EDGE,
+		.end    = AXP803_IRQ_PEK_FAL_EDGE,
+		.flags  = IORESOURCE_IRQ,
+	},
+};
+
 static struct resource axp809_pek_resources[] = {
 	{
 		.name   = "PEK_DBR",
@@ -457,6 +473,43 @@ static const struct regmap_irq axp288_regmap_irqs[] = {
 	INIT_REGMAP_IRQ(AXP288, BC_USB_CHNG,            5, 1),
 };
 
+static const struct regmap_irq axp803_regmap_irqs[] = {
+	INIT_REGMAP_IRQ(AXP803, ACIN_OVER_V,		0, 7),
+	INIT_REGMAP_IRQ(AXP803, ACIN_PLUGIN,		0, 6),
+	INIT_REGMAP_IRQ(AXP803, ACIN_REMOVAL,	        0, 5),
+	INIT_REGMAP_IRQ(AXP803, VBUS_OVER_V,		0, 4),
+	INIT_REGMAP_IRQ(AXP803, VBUS_PLUGIN,		0, 3),
+	INIT_REGMAP_IRQ(AXP803, VBUS_REMOVAL,	        0, 2),
+	INIT_REGMAP_IRQ(AXP803, BATT_PLUGIN,		1, 7),
+	INIT_REGMAP_IRQ(AXP803, BATT_REMOVAL,	        1, 6),
+	INIT_REGMAP_IRQ(AXP803, BATT_ENT_ACT_MODE,	1, 5),
+	INIT_REGMAP_IRQ(AXP803, BATT_EXIT_ACT_MODE,	1, 4),
+	INIT_REGMAP_IRQ(AXP803, CHARG,		        1, 3),
+	INIT_REGMAP_IRQ(AXP803, CHARG_DONE,		1, 2),
+	INIT_REGMAP_IRQ(AXP803, BATT_CHG_TEMP_HIGH,	2, 7),
+	INIT_REGMAP_IRQ(AXP803, BATT_CHG_TEMP_HIGH_END,	2, 6),
+	INIT_REGMAP_IRQ(AXP803, BATT_CHG_TEMP_LOW,	2, 5),
+	INIT_REGMAP_IRQ(AXP803, BATT_CHG_TEMP_LOW_END,	2, 4),
+	INIT_REGMAP_IRQ(AXP803, BATT_ACT_TEMP_HIGH,	2, 3),
+	INIT_REGMAP_IRQ(AXP803, BATT_ACT_TEMP_HIGH_END,	2, 2),
+	INIT_REGMAP_IRQ(AXP803, BATT_ACT_TEMP_LOW,	2, 1),
+	INIT_REGMAP_IRQ(AXP803, BATT_ACT_TEMP_LOW_END,	2, 0),
+	INIT_REGMAP_IRQ(AXP803, DIE_TEMP_HIGH,	        3, 7),
+	INIT_REGMAP_IRQ(AXP803, GPADC,		        3, 2),
+	INIT_REGMAP_IRQ(AXP803, LOW_PWR_LVL1,	        3, 1),
+	INIT_REGMAP_IRQ(AXP803, LOW_PWR_LVL2,	        3, 0),
+	INIT_REGMAP_IRQ(AXP803, TIMER,		        4, 7),
+	INIT_REGMAP_IRQ(AXP803, PEK_RIS_EDGE,	        4, 6),
+	INIT_REGMAP_IRQ(AXP803, PEK_FAL_EDGE,	        4, 5),
+	INIT_REGMAP_IRQ(AXP803, PEK_SHORT,		4, 4),
+	INIT_REGMAP_IRQ(AXP803, PEK_LONG,		4, 3),
+	INIT_REGMAP_IRQ(AXP803, PEK_OVER_OFF,		4, 2),
+	INIT_REGMAP_IRQ(AXP803, GPIO1_INPUT,		4, 1),
+	INIT_REGMAP_IRQ(AXP803, GPIO0_INPUT,		4, 0),
+	INIT_REGMAP_IRQ(AXP803, BC_USB_CHNG,            5, 1),
+	INIT_REGMAP_IRQ(AXP803, MV_CHNG,                5, 0),
+};
+
 static const struct regmap_irq axp806_regmap_irqs[] = {
 	INIT_REGMAP_IRQ(AXP806, DIE_TEMP_HIGH_LV1,	0, 0),
 	INIT_REGMAP_IRQ(AXP806, DIE_TEMP_HIGH_LV2,	0, 1),
@@ -557,6 +610,18 @@ static const struct regmap_irq_chip axp288_regmap_irq_chip = {
 
 };
 
+static const struct regmap_irq_chip axp803_regmap_irq_chip = {
+	.name			= "axp803",
+	.status_base		= AXP20X_IRQ1_STATE,
+	.ack_base		= AXP20X_IRQ1_STATE,
+	.mask_base		= AXP20X_IRQ1_EN,
+	.mask_invert		= true,
+	.init_ack_masked	= true,
+	.irqs			= axp803_regmap_irqs,
+	.num_irqs		= ARRAY_SIZE(axp803_regmap_irqs),
+	.num_regs		= 6,
+};
+
 static const struct regmap_irq_chip axp806_regmap_irq_chip = {
 	.name			= "axp806",
 	.status_base		= AXP20X_IRQ1_STATE,
@@ -769,6 +834,14 @@ static struct mfd_cell axp288_cells[] = {
 	},
 };
 
+static struct mfd_cell axp803_cells[] = {
+	{
+		.name			= "axp20x-pek",
+		.num_resources		= ARRAY_SIZE(axp803_pek_resources),
+		.resources		= axp803_pek_resources,
+	}
+};
+
 static struct mfd_cell axp806_cells[] = {
 	{
 		.id			= 2,
@@ -855,6 +928,12 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
 		axp20x->regmap_irq_chip = &axp288_regmap_irq_chip;
 		axp20x->irq_flags = IRQF_TRIGGER_LOW;
 		break;
+	case AXP803_ID:
+		axp20x->nr_cells = ARRAY_SIZE(axp803_cells);
+		axp20x->cells = axp803_cells;
+		axp20x->regmap_cfg = &axp288_regmap_config;
+		axp20x->regmap_irq_chip = &axp803_regmap_irq_chip;
+		break;
 	case AXP806_ID:
 		axp20x->nr_cells = ARRAY_SIZE(axp806_cells);
 		axp20x->cells = axp806_cells;
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index dc8798cf2a24..cde56cfe8446 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -20,6 +20,7 @@ enum axp20x_variants {
 	AXP221_ID,
 	AXP223_ID,
 	AXP288_ID,
+	AXP803_ID,
 	AXP806_ID,
 	AXP809_ID,
 	NR_AXP20X_VARIANTS,
@@ -234,7 +235,7 @@ enum axp20x_variants {
 #define AXP22X_TS_ADC_L			0x59
 #define AXP22X_BATLOW_THRES1		0xe6
 
-/* AXP288 specific registers */
+/* AXP288/AXP803 specific registers */
 #define AXP288_POWER_REASON		0x02
 #define AXP288_BC_GLOBAL		0x2c
 #define AXP288_BC_VBUS_CNTL		0x2d
@@ -475,6 +476,43 @@ enum axp288_irqs {
 	AXP288_IRQ_BC_USB_CHNG,
 };
 
+enum axp803_irqs {
+	AXP803_IRQ_ACIN_OVER_V = 1,
+	AXP803_IRQ_ACIN_PLUGIN,
+	AXP803_IRQ_ACIN_REMOVAL,
+	AXP803_IRQ_VBUS_OVER_V,
+	AXP803_IRQ_VBUS_PLUGIN,
+	AXP803_IRQ_VBUS_REMOVAL,
+	AXP803_IRQ_BATT_PLUGIN,
+	AXP803_IRQ_BATT_REMOVAL,
+	AXP803_IRQ_BATT_ENT_ACT_MODE,
+	AXP803_IRQ_BATT_EXIT_ACT_MODE,
+	AXP803_IRQ_CHARG,
+	AXP803_IRQ_CHARG_DONE,
+	AXP803_IRQ_BATT_CHG_TEMP_HIGH,
+	AXP803_IRQ_BATT_CHG_TEMP_HIGH_END,
+	AXP803_IRQ_BATT_CHG_TEMP_LOW,
+	AXP803_IRQ_BATT_CHG_TEMP_LOW_END,
+	AXP803_IRQ_BATT_ACT_TEMP_HIGH,
+	AXP803_IRQ_BATT_ACT_TEMP_HIGH_END,
+	AXP803_IRQ_BATT_ACT_TEMP_LOW,
+	AXP803_IRQ_BATT_ACT_TEMP_LOW_END,
+	AXP803_IRQ_DIE_TEMP_HIGH,
+	AXP803_IRQ_GPADC,
+	AXP803_IRQ_LOW_PWR_LVL1,
+	AXP803_IRQ_LOW_PWR_LVL2,
+	AXP803_IRQ_TIMER,
+	AXP803_IRQ_PEK_RIS_EDGE,
+	AXP803_IRQ_PEK_FAL_EDGE,
+	AXP803_IRQ_PEK_SHORT,
+	AXP803_IRQ_PEK_LONG,
+	AXP803_IRQ_PEK_OVER_OFF,
+	AXP803_IRQ_GPIO1_INPUT,
+	AXP803_IRQ_GPIO0_INPUT,
+	AXP803_IRQ_BC_USB_CHNG,
+	AXP803_IRQ_MV_CHNG,
+};
+
 enum axp806_irqs {
 	AXP806_IRQ_DIE_TEMP_HIGH_LV1,
 	AXP806_IRQ_DIE_TEMP_HIGH_LV2,
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 05/11] arm64: allwinner: a64: add AXP803 node to Pine64 device tree
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood
  Cc: devicetree, linux-sunxi, linux-kernel, linux-arm-kernel, Icenowy Zheng

The Pine64 (including Pine64+) boards have an AXP803 as its main PMIC.

Add its device node.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
index c680ed385da3..2132d8e6cb3d 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
@@ -95,6 +95,17 @@
 	status = "okay";
 };
 
+&r_rsb {
+	status = "okay";
+
+	axp803: pmic@3a3 {
+		compatible = "x-powers,axp803";
+		reg = <0x3a3>;
+		interrupt-parent = <&nmi_intc>;
+		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+	};
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins_a>;
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 05/11] arm64: allwinner: a64: add AXP803 node to Pine64 device tree
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Icenowy Zheng

The Pine64 (including Pine64+) boards have an AXP803 as its main PMIC.

Add its device node.

Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
---
 arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
index c680ed385da3..2132d8e6cb3d 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
@@ -95,6 +95,17 @@
 	status = "okay";
 };
 
+&r_rsb {
+	status = "okay";
+
+	axp803: pmic@3a3 {
+		compatible = "x-powers,axp803";
+		reg = <0x3a3>;
+		interrupt-parent = <&nmi_intc>;
+		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+	};
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins_a>;
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 05/11] arm64: allwinner: a64: add AXP803 node to Pine64 device tree
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: linux-arm-kernel

The Pine64 (including Pine64+) boards have an AXP803 as its main PMIC.

Add its device node.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
index c680ed385da3..2132d8e6cb3d 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
@@ -95,6 +95,17 @@
 	status = "okay";
 };
 
+&r_rsb {
+	status = "okay";
+
+	axp803: pmic at 3a3 {
+		compatible = "x-powers,axp803";
+		reg = <0x3a3>;
+		interrupt-parent = <&nmi_intc>;
+		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+	};
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins_a>;
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 06/11] dt-bindings: add AXP803's regulator info
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood
  Cc: devicetree, linux-sunxi, linux-kernel, linux-arm-kernel, Icenowy Zheng

AXP803 have the most regulators in currently supported AXP PMICs.

Add info for the regulators in the dt-bindings document.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
Changes in v2:
- Place AXP803 regulators before AXP806/809 ones.

 Documentation/devicetree/bindings/mfd/axp20x.txt | 27 ++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
index 334fb19ce605..50e381cdbf44 100644
--- a/Documentation/devicetree/bindings/mfd/axp20x.txt
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -90,6 +90,33 @@ LDO_IO1		: LDO		: ips-supply		: GPIO 1
 RTC_LDO		: LDO		: ips-supply		: always on
 DRIVEVBUS	: Enable output	: drivevbus-supply	: external regulator
 
+AXP803 regulators, type, and corresponding input supply names:
+
+Regulator	  Type		  Supply Name		  Notes
+---------	  ----		  -----------		  -----
+DCDC1		: DC-DC buck	: vin1-supply
+DCDC2		: DC-DC buck	: vin2-supply		: poly-phase capable
+DCDC3		: DC-DC	buck	: vin3-supply		: poly-phase capable
+DCDC4		: DC-DC	buck	: vin4-supply
+DCDC5		: DC-DC	buck	: vin5-supply		: poly-phase capable
+DCDC6		: DC-DC	buck	: vin6-supply		: poly-phase capable
+DC1SW		: On/Off Switch	:			: DCDC1 secondary output
+ALDO1		: LDO		: aldoin-supply		: shared supply
+ALDO2		: LDO		: aldoin-supply		: shared supply
+ALDO3		: LDO		: aldoin-supply		: shared supply
+DLDO1		: LDO		: dldoin-supply		: shared supply
+DLDO2		: LDO		: dldoin-supply		: shared supply
+DLDO3		: LDO		: dldoin-supply		: shared supply
+DLDO4		: LDO		: dldoin-supply		: shared supply
+ELDO1		: LDO		: eldoin-supply		: shared supply
+ELDO2		: LDO		: eldoin-supply		: shared supply
+ELDO3		: LDO		: eldoin-supply		: shared supply
+FLDO1		: LDO		: fldoin-supply		: shared supply
+FLDO2		: LDO		: fldoin-supply		: shared supply
+LDO_IO0		: LDO		: ips-supply		: GPIO 0
+LDO_IO1		: LDO		: ips-supply		: GPIO 1
+RTC_LDO		: LDO		: ips-supply		: always on
+
 AXP806 regulators, type, and corresponding input supply names:
 
 Regulator	  Type		  Supply Name		  Notes
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 06/11] dt-bindings: add AXP803's regulator info
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Icenowy Zheng

AXP803 have the most regulators in currently supported AXP PMICs.

Add info for the regulators in the dt-bindings document.

Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
---
Changes in v2:
- Place AXP803 regulators before AXP806/809 ones.

 Documentation/devicetree/bindings/mfd/axp20x.txt | 27 ++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
index 334fb19ce605..50e381cdbf44 100644
--- a/Documentation/devicetree/bindings/mfd/axp20x.txt
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -90,6 +90,33 @@ LDO_IO1		: LDO		: ips-supply		: GPIO 1
 RTC_LDO		: LDO		: ips-supply		: always on
 DRIVEVBUS	: Enable output	: drivevbus-supply	: external regulator
 
+AXP803 regulators, type, and corresponding input supply names:
+
+Regulator	  Type		  Supply Name		  Notes
+---------	  ----		  -----------		  -----
+DCDC1		: DC-DC buck	: vin1-supply
+DCDC2		: DC-DC buck	: vin2-supply		: poly-phase capable
+DCDC3		: DC-DC	buck	: vin3-supply		: poly-phase capable
+DCDC4		: DC-DC	buck	: vin4-supply
+DCDC5		: DC-DC	buck	: vin5-supply		: poly-phase capable
+DCDC6		: DC-DC	buck	: vin6-supply		: poly-phase capable
+DC1SW		: On/Off Switch	:			: DCDC1 secondary output
+ALDO1		: LDO		: aldoin-supply		: shared supply
+ALDO2		: LDO		: aldoin-supply		: shared supply
+ALDO3		: LDO		: aldoin-supply		: shared supply
+DLDO1		: LDO		: dldoin-supply		: shared supply
+DLDO2		: LDO		: dldoin-supply		: shared supply
+DLDO3		: LDO		: dldoin-supply		: shared supply
+DLDO4		: LDO		: dldoin-supply		: shared supply
+ELDO1		: LDO		: eldoin-supply		: shared supply
+ELDO2		: LDO		: eldoin-supply		: shared supply
+ELDO3		: LDO		: eldoin-supply		: shared supply
+FLDO1		: LDO		: fldoin-supply		: shared supply
+FLDO2		: LDO		: fldoin-supply		: shared supply
+LDO_IO0		: LDO		: ips-supply		: GPIO 0
+LDO_IO1		: LDO		: ips-supply		: GPIO 1
+RTC_LDO		: LDO		: ips-supply		: always on
+
 AXP806 regulators, type, and corresponding input supply names:
 
 Regulator	  Type		  Supply Name		  Notes
-- 
2.12.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 06/11] dt-bindings: add AXP803's regulator info
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: linux-arm-kernel

AXP803 have the most regulators in currently supported AXP PMICs.

Add info for the regulators in the dt-bindings document.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
Changes in v2:
- Place AXP803 regulators before AXP806/809 ones.

 Documentation/devicetree/bindings/mfd/axp20x.txt | 27 ++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
index 334fb19ce605..50e381cdbf44 100644
--- a/Documentation/devicetree/bindings/mfd/axp20x.txt
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -90,6 +90,33 @@ LDO_IO1		: LDO		: ips-supply		: GPIO 1
 RTC_LDO		: LDO		: ips-supply		: always on
 DRIVEVBUS	: Enable output	: drivevbus-supply	: external regulator
 
+AXP803 regulators, type, and corresponding input supply names:
+
+Regulator	  Type		  Supply Name		  Notes
+---------	  ----		  -----------		  -----
+DCDC1		: DC-DC buck	: vin1-supply
+DCDC2		: DC-DC buck	: vin2-supply		: poly-phase capable
+DCDC3		: DC-DC	buck	: vin3-supply		: poly-phase capable
+DCDC4		: DC-DC	buck	: vin4-supply
+DCDC5		: DC-DC	buck	: vin5-supply		: poly-phase capable
+DCDC6		: DC-DC	buck	: vin6-supply		: poly-phase capable
+DC1SW		: On/Off Switch	:			: DCDC1 secondary output
+ALDO1		: LDO		: aldoin-supply		: shared supply
+ALDO2		: LDO		: aldoin-supply		: shared supply
+ALDO3		: LDO		: aldoin-supply		: shared supply
+DLDO1		: LDO		: dldoin-supply		: shared supply
+DLDO2		: LDO		: dldoin-supply		: shared supply
+DLDO3		: LDO		: dldoin-supply		: shared supply
+DLDO4		: LDO		: dldoin-supply		: shared supply
+ELDO1		: LDO		: eldoin-supply		: shared supply
+ELDO2		: LDO		: eldoin-supply		: shared supply
+ELDO3		: LDO		: eldoin-supply		: shared supply
+FLDO1		: LDO		: fldoin-supply		: shared supply
+FLDO2		: LDO		: fldoin-supply		: shared supply
+LDO_IO0		: LDO		: ips-supply		: GPIO 0
+LDO_IO1		: LDO		: ips-supply		: GPIO 1
+RTC_LDO		: LDO		: ips-supply		: always on
+
 AXP806 regulators, type, and corresponding input supply names:
 
 Regulator	  Type		  Supply Name		  Notes
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 07/11] regulator: axp20x-regulator: add support for AXP803
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood
  Cc: devicetree, linux-sunxi, linux-kernel, linux-arm-kernel, Icenowy Zheng

AXP803 PMIC also have a series of regulators (DCDCs and LDOs)
controllable via I2C/RSB bus.

Add support for them.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
Changes in v2:
- Place AXP803 codes before AXP806/809 ones.
- Fixed some errors in regulator description.
- Reuse AXP803 DLDO2 range for AXP806 CLDO2 & AXP809 DLDO1.

 drivers/regulator/axp20x-regulator.c | 153 ++++++++++++++++++++++++++++++-----
 include/linux/mfd/axp20x.h           |  37 +++++++++
 2 files changed, 168 insertions(+), 22 deletions(-)

diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index 0b9d4e3e52c7..2ed15e4a7a82 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -244,6 +244,82 @@ static const struct regulator_desc axp22x_drivevbus_regulator = {
 	.ops		= &axp20x_ops_sw,
 };
 
+static const struct regulator_linear_range axp803_dcdc234_ranges[] = {
+	REGULATOR_LINEAR_RANGE(500000, 0x0, 0x46, 10000),
+	REGULATOR_LINEAR_RANGE(1220000, 0x47, 0x4b, 20000),
+};
+
+static const struct regulator_linear_range axp803_dcdc5_ranges[] = {
+	REGULATOR_LINEAR_RANGE(800000, 0x0, 0x20, 10000),
+	REGULATOR_LINEAR_RANGE(1140000, 0x21, 0x44, 20000),
+};
+
+static const struct regulator_linear_range axp803_dcdc6_ranges[] = {
+	REGULATOR_LINEAR_RANGE(600000, 0x0, 0x32, 10000),
+	REGULATOR_LINEAR_RANGE(1120000, 0x33, 0x47, 20000),
+};
+
+/* AXP806's CLDO2 and AXP809's DLDO1 shares the same range */
+static const struct regulator_linear_range axp803_dldo2_ranges[] = {
+	REGULATOR_LINEAR_RANGE(700000, 0x0, 0x1a, 100000),
+	REGULATOR_LINEAR_RANGE(3400000, 0x1b, 0x1f, 200000),
+};
+
+static const struct regulator_desc axp803_regulators[] = {
+	AXP_DESC(AXP803, DCDC1, "dcdc1", "vin1", 1600, 3400, 100,
+		 AXP803_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(0)),
+	AXP_DESC_RANGES(AXP803, DCDC2, "dcdc2", "vin2", axp803_dcdc234_ranges,
+			76, AXP803_DCDC2_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
+			BIT(1)),
+	AXP_DESC_RANGES(AXP803, DCDC3, "dcdc3", "vin3", axp803_dcdc234_ranges,
+			76, AXP803_DCDC3_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
+			BIT(2)),
+	AXP_DESC_RANGES(AXP803, DCDC4, "dcdc4", "vin4", axp803_dcdc234_ranges,
+			76, AXP803_DCDC4_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
+			BIT(3)),
+	AXP_DESC_RANGES(AXP803, DCDC5, "dcdc5", "vin5", axp803_dcdc5_ranges,
+			68, AXP803_DCDC5_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
+			BIT(4)),
+	AXP_DESC_RANGES(AXP803, DCDC6, "dcdc6", "vin6", axp803_dcdc6_ranges,
+			72, AXP803_DCDC6_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
+			BIT(5)),
+	/* secondary switchable output of DCDC1 */
+	AXP_DESC_SW(AXP803, DC1SW, "dc1sw", NULL, AXP22X_PWR_OUT_CTRL2,
+		    BIT(7)),
+	AXP_DESC(AXP803, ALDO1, "aldo1", "aldoin", 700, 3300, 100,
+		 AXP22X_ALDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(5)),
+	AXP_DESC(AXP803, ALDO2, "aldo2", "aldoin", 700, 3300, 100,
+		 AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(6)),
+	AXP_DESC(AXP803, ALDO3, "aldo3", "aldoin", 700, 3300, 100,
+		 AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(7)),
+	AXP_DESC(AXP803, DLDO1, "dldo1", "dldoin", 700, 3300, 100,
+		 AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(3)),
+	AXP_DESC_RANGES(AXP803, DLDO2, "dldo2", "dldoin", axp803_dldo2_ranges,
+			32, AXP22X_DLDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2,
+			BIT(4)),
+	AXP_DESC(AXP803, DLDO3, "dldo3", "dldoin", 700, 3300, 100,
+		 AXP22X_DLDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(5)),
+	AXP_DESC(AXP803, DLDO4, "dldo4", "dldoin", 700, 3300, 100,
+		 AXP22X_DLDO4_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(6)),
+	AXP_DESC(AXP803, ELDO1, "eldo1", "eldoin", 700, 1900, 50,
+		 AXP22X_ELDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(0)),
+	AXP_DESC(AXP803, ELDO2, "eldo2", "eldoin", 700, 1900, 50,
+		 AXP22X_ELDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(1)),
+	AXP_DESC(AXP803, ELDO3, "eldo3", "eldoin", 700, 1900, 50,
+		 AXP22X_ELDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(2)),
+	AXP_DESC(AXP803, FLDO1, "fldo1", "fldoin", 700, 1450, 50,
+		 AXP803_FLDO1_V_OUT, 0x0f, AXP22X_PWR_OUT_CTRL3, BIT(2)),
+	AXP_DESC(AXP803, FLDO2, "fldo2", "fldoin", 700, 1450, 50,
+		 AXP803_FLDO2_V_OUT, 0x0f, AXP22X_PWR_OUT_CTRL3, BIT(3)),
+	AXP_DESC_IO(AXP803, LDO_IO0, "ldo_io0", "ips", 700, 3300, 100,
+		    AXP22X_LDO_IO0_V_OUT, 0x1f, AXP20X_GPIO0_CTRL, 0x07,
+		    AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
+	AXP_DESC_IO(AXP803, LDO_IO1, "ldo_io1", "ips", 700, 3300, 100,
+		    AXP22X_LDO_IO1_V_OUT, 0x1f, AXP20X_GPIO1_CTRL, 0x07,
+		    AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
+	AXP_DESC_FIXED(AXP803, RTC_LDO, "rtc_ldo", "ips", 3000),
+};
+
 static const struct regulator_linear_range axp806_dcdca_ranges[] = {
 	REGULATOR_LINEAR_RANGE(600000, 0x0, 0x32, 10000),
 	REGULATOR_LINEAR_RANGE(1120000, 0x33, 0x47, 20000),
@@ -254,11 +330,6 @@ static const struct regulator_linear_range axp806_dcdcd_ranges[] = {
 	REGULATOR_LINEAR_RANGE(1600000, 0x2e, 0x3f, 100000),
 };
 
-static const struct regulator_linear_range axp806_cldo2_ranges[] = {
-	REGULATOR_LINEAR_RANGE(700000, 0x0, 0x1a, 100000),
-	REGULATOR_LINEAR_RANGE(3400000, 0x1b, 0x1f, 200000),
-};
-
 static const struct regulator_desc axp806_regulators[] = {
 	AXP_DESC_RANGES(AXP806, DCDCA, "dcdca", "vina", axp806_dcdca_ranges,
 			72, AXP806_DCDCA_V_CTRL, 0x7f, AXP806_PWR_OUT_CTRL1,
@@ -289,7 +360,7 @@ static const struct regulator_desc axp806_regulators[] = {
 		 AXP806_BLDO4_V_CTRL, 0x0f, AXP806_PWR_OUT_CTRL2, BIT(3)),
 	AXP_DESC(AXP806, CLDO1, "cldo1", "cldoin", 700, 3300, 100,
 		 AXP806_CLDO1_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL2, BIT(4)),
-	AXP_DESC_RANGES(AXP806, CLDO2, "cldo2", "cldoin", axp806_cldo2_ranges,
+	AXP_DESC_RANGES(AXP806, CLDO2, "cldo2", "cldoin", axp803_dldo2_ranges,
 			32, AXP806_CLDO2_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL2,
 			BIT(5)),
 	AXP_DESC(AXP806, CLDO3, "cldo3", "cldoin", 700, 3300, 100,
@@ -326,7 +397,7 @@ static const struct regulator_desc axp809_regulators[] = {
 		 AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(7)),
 	AXP_DESC(AXP809, ALDO3, "aldo3", "aldoin", 700, 3300, 100,
 		 AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(5)),
-	AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp806_cldo2_ranges,
+	AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp803_dldo2_ranges,
 			32, AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2,
 			BIT(3)),
 	AXP_DESC(AXP809, DLDO2, "dldo2", "dldoin", 700, 3300, 100,
@@ -369,14 +440,21 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
 		def = 1500;
 		step = 75;
 		break;
-	case AXP806_ID:
+	case AXP803_ID:
 		/*
-		 * AXP806 DCDC work frequency setting has the same range and
+		 * AXP803 DCDC work frequency setting has the same range and
 		 * step as AXP22X, but at a different register.
 		 * Fall through to the check below.
 		 * (See include/linux/mfd/axp20x.h)
 		 */
-		reg = AXP806_DCDC_FREQ_CTRL;
+		reg = AXP803_DCDC_FREQ_CTRL;
+	case AXP806_ID:
+		/*
+		 * AXP806 also have DCDC work frequency setting register at a
+		 * different position.
+		 */
+		if (axp20x->variant == AXP806_ID)
+			reg = AXP806_DCDC_FREQ_CTRL;
 	case AXP221_ID:
 	case AXP223_ID:
 	case AXP809_ID:
@@ -475,6 +553,14 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 work
 		workmode <<= id - AXP22X_DCDC1;
 		break;
 
+	case AXP803_ID:
+		if (id < AXP803_DCDC1 || id > AXP803_DCDC6)
+			return -EINVAL;
+
+		mask = AXP22X_WORKMODE_DCDCX_MASK(id - AXP803_DCDC1);
+		workmode <<= id - AXP803_DCDC1;
+		break;
+
 	default:
 		/* should not happen */
 		WARN_ON(1);
@@ -492,20 +578,38 @@ static bool axp20x_is_polyphase_slave(struct axp20x_dev *axp20x, int id)
 {
 	u32 reg = 0;
 
-	/* Only AXP806 has poly-phase outputs */
-	if (axp20x->variant != AXP806_ID)
-		return false;
+	/*
+	 * Currently in our supported AXP variants, only AXP806 and AXP803
+	 * have polyphase regulators.
+	 */
+	switch (axp20x->variant) {
+	case AXP803_ID:
+		regmap_read(axp20x->regmap, AXP803_POLYPHASE_CTRL, &reg);
+
+		switch (id) {
+		case AXP803_DCDC3:
+			return !!(reg & BIT(6));
+		case AXP803_DCDC6:
+			return !!(reg & BIT(7));
+		}
+		break;
 
-	regmap_read(axp20x->regmap, AXP806_DCDC_MODE_CTRL2, &reg);
+	case AXP806_ID:
+		regmap_read(axp20x->regmap, AXP806_DCDC_MODE_CTRL2, &reg);
+
+		switch (id) {
+		case AXP806_DCDCB:
+			return (((reg & GENMASK(7, 6)) == BIT(6)) ||
+				((reg & GENMASK(7, 6)) == BIT(7)));
+		case AXP806_DCDCC:
+			return ((reg & GENMASK(7, 6)) == BIT(7));
+		case AXP806_DCDCE:
+			return !!(reg & BIT(5));
+		}
+		break;
 
-	switch (id) {
-	case AXP806_DCDCB:
-		return (((reg & GENMASK(7, 6)) == BIT(6)) ||
-			((reg & GENMASK(7, 6)) == BIT(7)));
-	case AXP806_DCDCC:
-		return ((reg & GENMASK(7, 6)) == BIT(7));
-	case AXP806_DCDCE:
-		return !!(reg & BIT(5));
+	default:
+		return false;
 	}
 
 	return false;
@@ -540,6 +644,10 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
 		drivevbus = of_property_read_bool(pdev->dev.parent->of_node,
 						  "x-powers,drive-vbus-en");
 		break;
+	case AXP803_ID:
+		regulators = axp803_regulators;
+		nregulators = AXP803_REG_ID_MAX;
+		break;
 	case AXP806_ID:
 		regulators = axp806_regulators;
 		nregulators = AXP806_REG_ID_MAX;
@@ -579,6 +687,7 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
 		 * name.
 		 */
 		if ((regulators == axp22x_regulators && i == AXP22X_DC1SW) ||
+		    (regulators == axp803_regulators && i == AXP803_DC1SW) ||
 		    (regulators == axp809_regulators && i == AXP809_DC1SW)) {
 			new_desc = devm_kzalloc(&pdev->dev, sizeof(*desc),
 						GFP_KERNEL);
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index cde56cfe8446..965b027e31b3 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -119,6 +119,17 @@ enum axp20x_variants {
 #define AXP806_BUS_ADDR_EXT		0xfe
 #define AXP806_REG_ADDR_EXT		0xff
 
+#define AXP803_POLYPHASE_CTRL		0x14
+#define AXP803_FLDO1_V_OUT		0x1c
+#define AXP803_FLDO2_V_OUT		0x1d
+#define AXP803_DCDC1_V_OUT		0x20
+#define AXP803_DCDC2_V_OUT		0x21
+#define AXP803_DCDC3_V_OUT		0x22
+#define AXP803_DCDC4_V_OUT		0x23
+#define AXP803_DCDC5_V_OUT		0x24
+#define AXP803_DCDC6_V_OUT		0x25
+#define AXP803_DCDC_FREQ_CTRL		0x3b
+
 /* Interrupt */
 #define AXP152_IRQ1_EN			0x40
 #define AXP152_IRQ2_EN			0x41
@@ -350,6 +361,32 @@ enum {
 	AXP809_REG_ID_MAX,
 };
 
+enum {
+	AXP803_DCDC1 = 0,
+	AXP803_DCDC2,
+	AXP803_DCDC3,
+	AXP803_DCDC4,
+	AXP803_DCDC5,
+	AXP803_DCDC6,
+	AXP803_DC1SW,
+	AXP803_ALDO1,
+	AXP803_ALDO2,
+	AXP803_ALDO3,
+	AXP803_DLDO1,
+	AXP803_DLDO2,
+	AXP803_DLDO3,
+	AXP803_DLDO4,
+	AXP803_ELDO1,
+	AXP803_ELDO2,
+	AXP803_ELDO3,
+	AXP803_FLDO1,
+	AXP803_FLDO2,
+	AXP803_RTC_LDO,
+	AXP803_LDO_IO0,
+	AXP803_LDO_IO1,
+	AXP803_REG_ID_MAX,
+};
+
 /* IRQs */
 enum {
 	AXP152_IRQ_LDO0IN_CONNECT = 1,
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 07/11] regulator: axp20x-regulator: add support for AXP803
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Icenowy Zheng

AXP803 PMIC also have a series of regulators (DCDCs and LDOs)
controllable via I2C/RSB bus.

Add support for them.

Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
---
Changes in v2:
- Place AXP803 codes before AXP806/809 ones.
- Fixed some errors in regulator description.
- Reuse AXP803 DLDO2 range for AXP806 CLDO2 & AXP809 DLDO1.

 drivers/regulator/axp20x-regulator.c | 153 ++++++++++++++++++++++++++++++-----
 include/linux/mfd/axp20x.h           |  37 +++++++++
 2 files changed, 168 insertions(+), 22 deletions(-)

diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index 0b9d4e3e52c7..2ed15e4a7a82 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -244,6 +244,82 @@ static const struct regulator_desc axp22x_drivevbus_regulator = {
 	.ops		= &axp20x_ops_sw,
 };
 
+static const struct regulator_linear_range axp803_dcdc234_ranges[] = {
+	REGULATOR_LINEAR_RANGE(500000, 0x0, 0x46, 10000),
+	REGULATOR_LINEAR_RANGE(1220000, 0x47, 0x4b, 20000),
+};
+
+static const struct regulator_linear_range axp803_dcdc5_ranges[] = {
+	REGULATOR_LINEAR_RANGE(800000, 0x0, 0x20, 10000),
+	REGULATOR_LINEAR_RANGE(1140000, 0x21, 0x44, 20000),
+};
+
+static const struct regulator_linear_range axp803_dcdc6_ranges[] = {
+	REGULATOR_LINEAR_RANGE(600000, 0x0, 0x32, 10000),
+	REGULATOR_LINEAR_RANGE(1120000, 0x33, 0x47, 20000),
+};
+
+/* AXP806's CLDO2 and AXP809's DLDO1 shares the same range */
+static const struct regulator_linear_range axp803_dldo2_ranges[] = {
+	REGULATOR_LINEAR_RANGE(700000, 0x0, 0x1a, 100000),
+	REGULATOR_LINEAR_RANGE(3400000, 0x1b, 0x1f, 200000),
+};
+
+static const struct regulator_desc axp803_regulators[] = {
+	AXP_DESC(AXP803, DCDC1, "dcdc1", "vin1", 1600, 3400, 100,
+		 AXP803_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(0)),
+	AXP_DESC_RANGES(AXP803, DCDC2, "dcdc2", "vin2", axp803_dcdc234_ranges,
+			76, AXP803_DCDC2_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
+			BIT(1)),
+	AXP_DESC_RANGES(AXP803, DCDC3, "dcdc3", "vin3", axp803_dcdc234_ranges,
+			76, AXP803_DCDC3_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
+			BIT(2)),
+	AXP_DESC_RANGES(AXP803, DCDC4, "dcdc4", "vin4", axp803_dcdc234_ranges,
+			76, AXP803_DCDC4_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
+			BIT(3)),
+	AXP_DESC_RANGES(AXP803, DCDC5, "dcdc5", "vin5", axp803_dcdc5_ranges,
+			68, AXP803_DCDC5_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
+			BIT(4)),
+	AXP_DESC_RANGES(AXP803, DCDC6, "dcdc6", "vin6", axp803_dcdc6_ranges,
+			72, AXP803_DCDC6_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
+			BIT(5)),
+	/* secondary switchable output of DCDC1 */
+	AXP_DESC_SW(AXP803, DC1SW, "dc1sw", NULL, AXP22X_PWR_OUT_CTRL2,
+		    BIT(7)),
+	AXP_DESC(AXP803, ALDO1, "aldo1", "aldoin", 700, 3300, 100,
+		 AXP22X_ALDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(5)),
+	AXP_DESC(AXP803, ALDO2, "aldo2", "aldoin", 700, 3300, 100,
+		 AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(6)),
+	AXP_DESC(AXP803, ALDO3, "aldo3", "aldoin", 700, 3300, 100,
+		 AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(7)),
+	AXP_DESC(AXP803, DLDO1, "dldo1", "dldoin", 700, 3300, 100,
+		 AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(3)),
+	AXP_DESC_RANGES(AXP803, DLDO2, "dldo2", "dldoin", axp803_dldo2_ranges,
+			32, AXP22X_DLDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2,
+			BIT(4)),
+	AXP_DESC(AXP803, DLDO3, "dldo3", "dldoin", 700, 3300, 100,
+		 AXP22X_DLDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(5)),
+	AXP_DESC(AXP803, DLDO4, "dldo4", "dldoin", 700, 3300, 100,
+		 AXP22X_DLDO4_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(6)),
+	AXP_DESC(AXP803, ELDO1, "eldo1", "eldoin", 700, 1900, 50,
+		 AXP22X_ELDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(0)),
+	AXP_DESC(AXP803, ELDO2, "eldo2", "eldoin", 700, 1900, 50,
+		 AXP22X_ELDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(1)),
+	AXP_DESC(AXP803, ELDO3, "eldo3", "eldoin", 700, 1900, 50,
+		 AXP22X_ELDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(2)),
+	AXP_DESC(AXP803, FLDO1, "fldo1", "fldoin", 700, 1450, 50,
+		 AXP803_FLDO1_V_OUT, 0x0f, AXP22X_PWR_OUT_CTRL3, BIT(2)),
+	AXP_DESC(AXP803, FLDO2, "fldo2", "fldoin", 700, 1450, 50,
+		 AXP803_FLDO2_V_OUT, 0x0f, AXP22X_PWR_OUT_CTRL3, BIT(3)),
+	AXP_DESC_IO(AXP803, LDO_IO0, "ldo_io0", "ips", 700, 3300, 100,
+		    AXP22X_LDO_IO0_V_OUT, 0x1f, AXP20X_GPIO0_CTRL, 0x07,
+		    AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
+	AXP_DESC_IO(AXP803, LDO_IO1, "ldo_io1", "ips", 700, 3300, 100,
+		    AXP22X_LDO_IO1_V_OUT, 0x1f, AXP20X_GPIO1_CTRL, 0x07,
+		    AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
+	AXP_DESC_FIXED(AXP803, RTC_LDO, "rtc_ldo", "ips", 3000),
+};
+
 static const struct regulator_linear_range axp806_dcdca_ranges[] = {
 	REGULATOR_LINEAR_RANGE(600000, 0x0, 0x32, 10000),
 	REGULATOR_LINEAR_RANGE(1120000, 0x33, 0x47, 20000),
@@ -254,11 +330,6 @@ static const struct regulator_linear_range axp806_dcdcd_ranges[] = {
 	REGULATOR_LINEAR_RANGE(1600000, 0x2e, 0x3f, 100000),
 };
 
-static const struct regulator_linear_range axp806_cldo2_ranges[] = {
-	REGULATOR_LINEAR_RANGE(700000, 0x0, 0x1a, 100000),
-	REGULATOR_LINEAR_RANGE(3400000, 0x1b, 0x1f, 200000),
-};
-
 static const struct regulator_desc axp806_regulators[] = {
 	AXP_DESC_RANGES(AXP806, DCDCA, "dcdca", "vina", axp806_dcdca_ranges,
 			72, AXP806_DCDCA_V_CTRL, 0x7f, AXP806_PWR_OUT_CTRL1,
@@ -289,7 +360,7 @@ static const struct regulator_desc axp806_regulators[] = {
 		 AXP806_BLDO4_V_CTRL, 0x0f, AXP806_PWR_OUT_CTRL2, BIT(3)),
 	AXP_DESC(AXP806, CLDO1, "cldo1", "cldoin", 700, 3300, 100,
 		 AXP806_CLDO1_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL2, BIT(4)),
-	AXP_DESC_RANGES(AXP806, CLDO2, "cldo2", "cldoin", axp806_cldo2_ranges,
+	AXP_DESC_RANGES(AXP806, CLDO2, "cldo2", "cldoin", axp803_dldo2_ranges,
 			32, AXP806_CLDO2_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL2,
 			BIT(5)),
 	AXP_DESC(AXP806, CLDO3, "cldo3", "cldoin", 700, 3300, 100,
@@ -326,7 +397,7 @@ static const struct regulator_desc axp809_regulators[] = {
 		 AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(7)),
 	AXP_DESC(AXP809, ALDO3, "aldo3", "aldoin", 700, 3300, 100,
 		 AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(5)),
-	AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp806_cldo2_ranges,
+	AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp803_dldo2_ranges,
 			32, AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2,
 			BIT(3)),
 	AXP_DESC(AXP809, DLDO2, "dldo2", "dldoin", 700, 3300, 100,
@@ -369,14 +440,21 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
 		def = 1500;
 		step = 75;
 		break;
-	case AXP806_ID:
+	case AXP803_ID:
 		/*
-		 * AXP806 DCDC work frequency setting has the same range and
+		 * AXP803 DCDC work frequency setting has the same range and
 		 * step as AXP22X, but at a different register.
 		 * Fall through to the check below.
 		 * (See include/linux/mfd/axp20x.h)
 		 */
-		reg = AXP806_DCDC_FREQ_CTRL;
+		reg = AXP803_DCDC_FREQ_CTRL;
+	case AXP806_ID:
+		/*
+		 * AXP806 also have DCDC work frequency setting register at a
+		 * different position.
+		 */
+		if (axp20x->variant == AXP806_ID)
+			reg = AXP806_DCDC_FREQ_CTRL;
 	case AXP221_ID:
 	case AXP223_ID:
 	case AXP809_ID:
@@ -475,6 +553,14 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 work
 		workmode <<= id - AXP22X_DCDC1;
 		break;
 
+	case AXP803_ID:
+		if (id < AXP803_DCDC1 || id > AXP803_DCDC6)
+			return -EINVAL;
+
+		mask = AXP22X_WORKMODE_DCDCX_MASK(id - AXP803_DCDC1);
+		workmode <<= id - AXP803_DCDC1;
+		break;
+
 	default:
 		/* should not happen */
 		WARN_ON(1);
@@ -492,20 +578,38 @@ static bool axp20x_is_polyphase_slave(struct axp20x_dev *axp20x, int id)
 {
 	u32 reg = 0;
 
-	/* Only AXP806 has poly-phase outputs */
-	if (axp20x->variant != AXP806_ID)
-		return false;
+	/*
+	 * Currently in our supported AXP variants, only AXP806 and AXP803
+	 * have polyphase regulators.
+	 */
+	switch (axp20x->variant) {
+	case AXP803_ID:
+		regmap_read(axp20x->regmap, AXP803_POLYPHASE_CTRL, &reg);
+
+		switch (id) {
+		case AXP803_DCDC3:
+			return !!(reg & BIT(6));
+		case AXP803_DCDC6:
+			return !!(reg & BIT(7));
+		}
+		break;
 
-	regmap_read(axp20x->regmap, AXP806_DCDC_MODE_CTRL2, &reg);
+	case AXP806_ID:
+		regmap_read(axp20x->regmap, AXP806_DCDC_MODE_CTRL2, &reg);
+
+		switch (id) {
+		case AXP806_DCDCB:
+			return (((reg & GENMASK(7, 6)) == BIT(6)) ||
+				((reg & GENMASK(7, 6)) == BIT(7)));
+		case AXP806_DCDCC:
+			return ((reg & GENMASK(7, 6)) == BIT(7));
+		case AXP806_DCDCE:
+			return !!(reg & BIT(5));
+		}
+		break;
 
-	switch (id) {
-	case AXP806_DCDCB:
-		return (((reg & GENMASK(7, 6)) == BIT(6)) ||
-			((reg & GENMASK(7, 6)) == BIT(7)));
-	case AXP806_DCDCC:
-		return ((reg & GENMASK(7, 6)) == BIT(7));
-	case AXP806_DCDCE:
-		return !!(reg & BIT(5));
+	default:
+		return false;
 	}
 
 	return false;
@@ -540,6 +644,10 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
 		drivevbus = of_property_read_bool(pdev->dev.parent->of_node,
 						  "x-powers,drive-vbus-en");
 		break;
+	case AXP803_ID:
+		regulators = axp803_regulators;
+		nregulators = AXP803_REG_ID_MAX;
+		break;
 	case AXP806_ID:
 		regulators = axp806_regulators;
 		nregulators = AXP806_REG_ID_MAX;
@@ -579,6 +687,7 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
 		 * name.
 		 */
 		if ((regulators == axp22x_regulators && i == AXP22X_DC1SW) ||
+		    (regulators == axp803_regulators && i == AXP803_DC1SW) ||
 		    (regulators == axp809_regulators && i == AXP809_DC1SW)) {
 			new_desc = devm_kzalloc(&pdev->dev, sizeof(*desc),
 						GFP_KERNEL);
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index cde56cfe8446..965b027e31b3 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -119,6 +119,17 @@ enum axp20x_variants {
 #define AXP806_BUS_ADDR_EXT		0xfe
 #define AXP806_REG_ADDR_EXT		0xff
 
+#define AXP803_POLYPHASE_CTRL		0x14
+#define AXP803_FLDO1_V_OUT		0x1c
+#define AXP803_FLDO2_V_OUT		0x1d
+#define AXP803_DCDC1_V_OUT		0x20
+#define AXP803_DCDC2_V_OUT		0x21
+#define AXP803_DCDC3_V_OUT		0x22
+#define AXP803_DCDC4_V_OUT		0x23
+#define AXP803_DCDC5_V_OUT		0x24
+#define AXP803_DCDC6_V_OUT		0x25
+#define AXP803_DCDC_FREQ_CTRL		0x3b
+
 /* Interrupt */
 #define AXP152_IRQ1_EN			0x40
 #define AXP152_IRQ2_EN			0x41
@@ -350,6 +361,32 @@ enum {
 	AXP809_REG_ID_MAX,
 };
 
+enum {
+	AXP803_DCDC1 = 0,
+	AXP803_DCDC2,
+	AXP803_DCDC3,
+	AXP803_DCDC4,
+	AXP803_DCDC5,
+	AXP803_DCDC6,
+	AXP803_DC1SW,
+	AXP803_ALDO1,
+	AXP803_ALDO2,
+	AXP803_ALDO3,
+	AXP803_DLDO1,
+	AXP803_DLDO2,
+	AXP803_DLDO3,
+	AXP803_DLDO4,
+	AXP803_ELDO1,
+	AXP803_ELDO2,
+	AXP803_ELDO3,
+	AXP803_FLDO1,
+	AXP803_FLDO2,
+	AXP803_RTC_LDO,
+	AXP803_LDO_IO0,
+	AXP803_LDO_IO1,
+	AXP803_REG_ID_MAX,
+};
+
 /* IRQs */
 enum {
 	AXP152_IRQ_LDO0IN_CONNECT = 1,
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 07/11] regulator: axp20x-regulator: add support for AXP803
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: linux-arm-kernel

AXP803 PMIC also have a series of regulators (DCDCs and LDOs)
controllable via I2C/RSB bus.

Add support for them.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
Changes in v2:
- Place AXP803 codes before AXP806/809 ones.
- Fixed some errors in regulator description.
- Reuse AXP803 DLDO2 range for AXP806 CLDO2 & AXP809 DLDO1.

 drivers/regulator/axp20x-regulator.c | 153 ++++++++++++++++++++++++++++++-----
 include/linux/mfd/axp20x.h           |  37 +++++++++
 2 files changed, 168 insertions(+), 22 deletions(-)

diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index 0b9d4e3e52c7..2ed15e4a7a82 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -244,6 +244,82 @@ static const struct regulator_desc axp22x_drivevbus_regulator = {
 	.ops		= &axp20x_ops_sw,
 };
 
+static const struct regulator_linear_range axp803_dcdc234_ranges[] = {
+	REGULATOR_LINEAR_RANGE(500000, 0x0, 0x46, 10000),
+	REGULATOR_LINEAR_RANGE(1220000, 0x47, 0x4b, 20000),
+};
+
+static const struct regulator_linear_range axp803_dcdc5_ranges[] = {
+	REGULATOR_LINEAR_RANGE(800000, 0x0, 0x20, 10000),
+	REGULATOR_LINEAR_RANGE(1140000, 0x21, 0x44, 20000),
+};
+
+static const struct regulator_linear_range axp803_dcdc6_ranges[] = {
+	REGULATOR_LINEAR_RANGE(600000, 0x0, 0x32, 10000),
+	REGULATOR_LINEAR_RANGE(1120000, 0x33, 0x47, 20000),
+};
+
+/* AXP806's CLDO2 and AXP809's DLDO1 shares the same range */
+static const struct regulator_linear_range axp803_dldo2_ranges[] = {
+	REGULATOR_LINEAR_RANGE(700000, 0x0, 0x1a, 100000),
+	REGULATOR_LINEAR_RANGE(3400000, 0x1b, 0x1f, 200000),
+};
+
+static const struct regulator_desc axp803_regulators[] = {
+	AXP_DESC(AXP803, DCDC1, "dcdc1", "vin1", 1600, 3400, 100,
+		 AXP803_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(0)),
+	AXP_DESC_RANGES(AXP803, DCDC2, "dcdc2", "vin2", axp803_dcdc234_ranges,
+			76, AXP803_DCDC2_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
+			BIT(1)),
+	AXP_DESC_RANGES(AXP803, DCDC3, "dcdc3", "vin3", axp803_dcdc234_ranges,
+			76, AXP803_DCDC3_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
+			BIT(2)),
+	AXP_DESC_RANGES(AXP803, DCDC4, "dcdc4", "vin4", axp803_dcdc234_ranges,
+			76, AXP803_DCDC4_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
+			BIT(3)),
+	AXP_DESC_RANGES(AXP803, DCDC5, "dcdc5", "vin5", axp803_dcdc5_ranges,
+			68, AXP803_DCDC5_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
+			BIT(4)),
+	AXP_DESC_RANGES(AXP803, DCDC6, "dcdc6", "vin6", axp803_dcdc6_ranges,
+			72, AXP803_DCDC6_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
+			BIT(5)),
+	/* secondary switchable output of DCDC1 */
+	AXP_DESC_SW(AXP803, DC1SW, "dc1sw", NULL, AXP22X_PWR_OUT_CTRL2,
+		    BIT(7)),
+	AXP_DESC(AXP803, ALDO1, "aldo1", "aldoin", 700, 3300, 100,
+		 AXP22X_ALDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(5)),
+	AXP_DESC(AXP803, ALDO2, "aldo2", "aldoin", 700, 3300, 100,
+		 AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(6)),
+	AXP_DESC(AXP803, ALDO3, "aldo3", "aldoin", 700, 3300, 100,
+		 AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(7)),
+	AXP_DESC(AXP803, DLDO1, "dldo1", "dldoin", 700, 3300, 100,
+		 AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(3)),
+	AXP_DESC_RANGES(AXP803, DLDO2, "dldo2", "dldoin", axp803_dldo2_ranges,
+			32, AXP22X_DLDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2,
+			BIT(4)),
+	AXP_DESC(AXP803, DLDO3, "dldo3", "dldoin", 700, 3300, 100,
+		 AXP22X_DLDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(5)),
+	AXP_DESC(AXP803, DLDO4, "dldo4", "dldoin", 700, 3300, 100,
+		 AXP22X_DLDO4_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(6)),
+	AXP_DESC(AXP803, ELDO1, "eldo1", "eldoin", 700, 1900, 50,
+		 AXP22X_ELDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(0)),
+	AXP_DESC(AXP803, ELDO2, "eldo2", "eldoin", 700, 1900, 50,
+		 AXP22X_ELDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(1)),
+	AXP_DESC(AXP803, ELDO3, "eldo3", "eldoin", 700, 1900, 50,
+		 AXP22X_ELDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(2)),
+	AXP_DESC(AXP803, FLDO1, "fldo1", "fldoin", 700, 1450, 50,
+		 AXP803_FLDO1_V_OUT, 0x0f, AXP22X_PWR_OUT_CTRL3, BIT(2)),
+	AXP_DESC(AXP803, FLDO2, "fldo2", "fldoin", 700, 1450, 50,
+		 AXP803_FLDO2_V_OUT, 0x0f, AXP22X_PWR_OUT_CTRL3, BIT(3)),
+	AXP_DESC_IO(AXP803, LDO_IO0, "ldo_io0", "ips", 700, 3300, 100,
+		    AXP22X_LDO_IO0_V_OUT, 0x1f, AXP20X_GPIO0_CTRL, 0x07,
+		    AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
+	AXP_DESC_IO(AXP803, LDO_IO1, "ldo_io1", "ips", 700, 3300, 100,
+		    AXP22X_LDO_IO1_V_OUT, 0x1f, AXP20X_GPIO1_CTRL, 0x07,
+		    AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
+	AXP_DESC_FIXED(AXP803, RTC_LDO, "rtc_ldo", "ips", 3000),
+};
+
 static const struct regulator_linear_range axp806_dcdca_ranges[] = {
 	REGULATOR_LINEAR_RANGE(600000, 0x0, 0x32, 10000),
 	REGULATOR_LINEAR_RANGE(1120000, 0x33, 0x47, 20000),
@@ -254,11 +330,6 @@ static const struct regulator_linear_range axp806_dcdcd_ranges[] = {
 	REGULATOR_LINEAR_RANGE(1600000, 0x2e, 0x3f, 100000),
 };
 
-static const struct regulator_linear_range axp806_cldo2_ranges[] = {
-	REGULATOR_LINEAR_RANGE(700000, 0x0, 0x1a, 100000),
-	REGULATOR_LINEAR_RANGE(3400000, 0x1b, 0x1f, 200000),
-};
-
 static const struct regulator_desc axp806_regulators[] = {
 	AXP_DESC_RANGES(AXP806, DCDCA, "dcdca", "vina", axp806_dcdca_ranges,
 			72, AXP806_DCDCA_V_CTRL, 0x7f, AXP806_PWR_OUT_CTRL1,
@@ -289,7 +360,7 @@ static const struct regulator_desc axp806_regulators[] = {
 		 AXP806_BLDO4_V_CTRL, 0x0f, AXP806_PWR_OUT_CTRL2, BIT(3)),
 	AXP_DESC(AXP806, CLDO1, "cldo1", "cldoin", 700, 3300, 100,
 		 AXP806_CLDO1_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL2, BIT(4)),
-	AXP_DESC_RANGES(AXP806, CLDO2, "cldo2", "cldoin", axp806_cldo2_ranges,
+	AXP_DESC_RANGES(AXP806, CLDO2, "cldo2", "cldoin", axp803_dldo2_ranges,
 			32, AXP806_CLDO2_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL2,
 			BIT(5)),
 	AXP_DESC(AXP806, CLDO3, "cldo3", "cldoin", 700, 3300, 100,
@@ -326,7 +397,7 @@ static const struct regulator_desc axp809_regulators[] = {
 		 AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(7)),
 	AXP_DESC(AXP809, ALDO3, "aldo3", "aldoin", 700, 3300, 100,
 		 AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(5)),
-	AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp806_cldo2_ranges,
+	AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp803_dldo2_ranges,
 			32, AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2,
 			BIT(3)),
 	AXP_DESC(AXP809, DLDO2, "dldo2", "dldoin", 700, 3300, 100,
@@ -369,14 +440,21 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
 		def = 1500;
 		step = 75;
 		break;
-	case AXP806_ID:
+	case AXP803_ID:
 		/*
-		 * AXP806 DCDC work frequency setting has the same range and
+		 * AXP803 DCDC work frequency setting has the same range and
 		 * step as AXP22X, but at a different register.
 		 * Fall through to the check below.
 		 * (See include/linux/mfd/axp20x.h)
 		 */
-		reg = AXP806_DCDC_FREQ_CTRL;
+		reg = AXP803_DCDC_FREQ_CTRL;
+	case AXP806_ID:
+		/*
+		 * AXP806 also have DCDC work frequency setting register at a
+		 * different position.
+		 */
+		if (axp20x->variant == AXP806_ID)
+			reg = AXP806_DCDC_FREQ_CTRL;
 	case AXP221_ID:
 	case AXP223_ID:
 	case AXP809_ID:
@@ -475,6 +553,14 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 work
 		workmode <<= id - AXP22X_DCDC1;
 		break;
 
+	case AXP803_ID:
+		if (id < AXP803_DCDC1 || id > AXP803_DCDC6)
+			return -EINVAL;
+
+		mask = AXP22X_WORKMODE_DCDCX_MASK(id - AXP803_DCDC1);
+		workmode <<= id - AXP803_DCDC1;
+		break;
+
 	default:
 		/* should not happen */
 		WARN_ON(1);
@@ -492,20 +578,38 @@ static bool axp20x_is_polyphase_slave(struct axp20x_dev *axp20x, int id)
 {
 	u32 reg = 0;
 
-	/* Only AXP806 has poly-phase outputs */
-	if (axp20x->variant != AXP806_ID)
-		return false;
+	/*
+	 * Currently in our supported AXP variants, only AXP806 and AXP803
+	 * have polyphase regulators.
+	 */
+	switch (axp20x->variant) {
+	case AXP803_ID:
+		regmap_read(axp20x->regmap, AXP803_POLYPHASE_CTRL, &reg);
+
+		switch (id) {
+		case AXP803_DCDC3:
+			return !!(reg & BIT(6));
+		case AXP803_DCDC6:
+			return !!(reg & BIT(7));
+		}
+		break;
 
-	regmap_read(axp20x->regmap, AXP806_DCDC_MODE_CTRL2, &reg);
+	case AXP806_ID:
+		regmap_read(axp20x->regmap, AXP806_DCDC_MODE_CTRL2, &reg);
+
+		switch (id) {
+		case AXP806_DCDCB:
+			return (((reg & GENMASK(7, 6)) == BIT(6)) ||
+				((reg & GENMASK(7, 6)) == BIT(7)));
+		case AXP806_DCDCC:
+			return ((reg & GENMASK(7, 6)) == BIT(7));
+		case AXP806_DCDCE:
+			return !!(reg & BIT(5));
+		}
+		break;
 
-	switch (id) {
-	case AXP806_DCDCB:
-		return (((reg & GENMASK(7, 6)) == BIT(6)) ||
-			((reg & GENMASK(7, 6)) == BIT(7)));
-	case AXP806_DCDCC:
-		return ((reg & GENMASK(7, 6)) == BIT(7));
-	case AXP806_DCDCE:
-		return !!(reg & BIT(5));
+	default:
+		return false;
 	}
 
 	return false;
@@ -540,6 +644,10 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
 		drivevbus = of_property_read_bool(pdev->dev.parent->of_node,
 						  "x-powers,drive-vbus-en");
 		break;
+	case AXP803_ID:
+		regulators = axp803_regulators;
+		nregulators = AXP803_REG_ID_MAX;
+		break;
 	case AXP806_ID:
 		regulators = axp806_regulators;
 		nregulators = AXP806_REG_ID_MAX;
@@ -579,6 +687,7 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
 		 * name.
 		 */
 		if ((regulators == axp22x_regulators && i == AXP22X_DC1SW) ||
+		    (regulators == axp803_regulators && i == AXP803_DC1SW) ||
 		    (regulators == axp809_regulators && i == AXP809_DC1SW)) {
 			new_desc = devm_kzalloc(&pdev->dev, sizeof(*desc),
 						GFP_KERNEL);
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index cde56cfe8446..965b027e31b3 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -119,6 +119,17 @@ enum axp20x_variants {
 #define AXP806_BUS_ADDR_EXT		0xfe
 #define AXP806_REG_ADDR_EXT		0xff
 
+#define AXP803_POLYPHASE_CTRL		0x14
+#define AXP803_FLDO1_V_OUT		0x1c
+#define AXP803_FLDO2_V_OUT		0x1d
+#define AXP803_DCDC1_V_OUT		0x20
+#define AXP803_DCDC2_V_OUT		0x21
+#define AXP803_DCDC3_V_OUT		0x22
+#define AXP803_DCDC4_V_OUT		0x23
+#define AXP803_DCDC5_V_OUT		0x24
+#define AXP803_DCDC6_V_OUT		0x25
+#define AXP803_DCDC_FREQ_CTRL		0x3b
+
 /* Interrupt */
 #define AXP152_IRQ1_EN			0x40
 #define AXP152_IRQ2_EN			0x41
@@ -350,6 +361,32 @@ enum {
 	AXP809_REG_ID_MAX,
 };
 
+enum {
+	AXP803_DCDC1 = 0,
+	AXP803_DCDC2,
+	AXP803_DCDC3,
+	AXP803_DCDC4,
+	AXP803_DCDC5,
+	AXP803_DCDC6,
+	AXP803_DC1SW,
+	AXP803_ALDO1,
+	AXP803_ALDO2,
+	AXP803_ALDO3,
+	AXP803_DLDO1,
+	AXP803_DLDO2,
+	AXP803_DLDO3,
+	AXP803_DLDO4,
+	AXP803_ELDO1,
+	AXP803_ELDO2,
+	AXP803_ELDO3,
+	AXP803_FLDO1,
+	AXP803_FLDO2,
+	AXP803_RTC_LDO,
+	AXP803_LDO_IO0,
+	AXP803_LDO_IO1,
+	AXP803_REG_ID_MAX,
+};
+
 /* IRQs */
 enum {
 	AXP152_IRQ_LDO0IN_CONNECT = 1,
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 08/11] mfd: axp20x: add axp20x-regulator cell for AXP803
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood
  Cc: devicetree, linux-sunxi, linux-kernel, linux-arm-kernel, Icenowy Zheng

As axp20x-regulator now supports AXP803, add a cell for it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/mfd/axp20x.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 2268a6a9aa2c..08b9bbd5bd71 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -839,6 +839,8 @@ static struct mfd_cell axp803_cells[] = {
 		.name			= "axp20x-pek",
 		.num_resources		= ARRAY_SIZE(axp803_pek_resources),
 		.resources		= axp803_pek_resources,
+	}, {
+		.name			= "axp20x-regulator",
 	}
 };
 
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 08/11] mfd: axp20x: add axp20x-regulator cell for AXP803
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Icenowy Zheng

As axp20x-regulator now supports AXP803, add a cell for it.

Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
---
 drivers/mfd/axp20x.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 2268a6a9aa2c..08b9bbd5bd71 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -839,6 +839,8 @@ static struct mfd_cell axp803_cells[] = {
 		.name			= "axp20x-pek",
 		.num_resources		= ARRAY_SIZE(axp803_pek_resources),
 		.resources		= axp803_pek_resources,
+	}, {
+		.name			= "axp20x-regulator",
 	}
 };
 
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 08/11] mfd: axp20x: add axp20x-regulator cell for AXP803
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: linux-arm-kernel

As axp20x-regulator now supports AXP803, add a cell for it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/mfd/axp20x.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 2268a6a9aa2c..08b9bbd5bd71 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -839,6 +839,8 @@ static struct mfd_cell axp803_cells[] = {
 		.name			= "axp20x-pek",
 		.num_resources		= ARRAY_SIZE(axp803_pek_resources),
 		.resources		= axp803_pek_resources,
+	}, {
+		.name			= "axp20x-regulator",
 	}
 };
 
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 09/11] arm64: allwinner: a64: add DTSI file for AXP803 PMIC
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood
  Cc: devicetree, linux-sunxi, linux-kernel, linux-arm-kernel, Icenowy Zheng

As nearly all A64 boards are using AXP803 PMIC, add a DTSI file for it,
like the old DTSI files for AXP20x/22x, for the common parts of the
PMIC.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 arch/arm64/boot/dts/allwinner/axp803.dtsi | 150 ++++++++++++++++++++++++++++++
 1 file changed, 150 insertions(+)
 create mode 100644 arch/arm64/boot/dts/allwinner/axp803.dtsi

diff --git a/arch/arm64/boot/dts/allwinner/axp803.dtsi b/arch/arm64/boot/dts/allwinner/axp803.dtsi
new file mode 100644
index 000000000000..f0e53a7fffbd
--- /dev/null
+++ b/arch/arm64/boot/dts/allwinner/axp803.dtsi
@@ -0,0 +1,150 @@
+/*
+ * Copyright 2017 Icenowy Zheng <icenowy@aosc.xyz>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * AXP803 Integrated Power Management Chip
+ * http://files.pine64.org/doc/datasheet/pine64/AXP803_Datasheet_V1.0.pdf
+ */
+
+&axp803 {
+	interrupt-controller;
+	#interrupt-cells = <1>;
+
+	regulators {
+		/* Default work frequency for buck regulators */
+		x-powers,dcdc-freq = <3000>;
+
+		reg_dcdc1: dcdc1 {
+			regulator-name = "dcdc1";
+		};
+
+		reg_dcdc2: dcdc2 {
+			regulator-name = "dcdc2";
+		};
+
+		reg_dcdc3: dcdc3 {
+			regulator-name = "dcdc3";
+		};
+
+		reg_dcdc4: dcdc4 {
+			regulator-name = "dcdc4";
+		};
+
+		reg_dcdc5: dcdc5 {
+			regulator-name = "dcdc5";
+		};
+
+		reg_dcdc6: dcdc6 {
+			regulator-name = "dcdc6";
+		};
+
+		reg_dc1sw: dc1sw {
+			regulator-name = "dc1sw";
+		};
+
+		reg_aldo1: aldo1 {
+			regulator-name = "aldo1";
+		};
+
+		reg_aldo2: aldo2 {
+			regulator-name = "aldo2";
+		};
+
+		reg_aldo3: aldo3 {
+			regulator-name = "aldo3";
+		};
+
+		reg_dldo1: dldo1 {
+			regulator-name = "dldo1";
+		};
+
+		reg_dldo2: dldo2 {
+			regulator-name = "dldo2";
+		};
+
+		reg_dldo3: dldo3 {
+			regulator-name = "dldo3";
+		};
+
+		reg_dldo4: dldo4 {
+			regulator-name = "dldo4";
+		};
+
+		reg_eldo1: eldo1 {
+			regulator-name = "eldo1";
+		};
+
+		reg_eldo2: eldo2 {
+			regulator-name = "eldo2";
+		};
+
+		reg_eldo3: eldo3 {
+			regulator-name = "eldo3";
+		};
+
+		reg_fldo1: fldo1 {
+			regulator-name = "fldo1";
+		};
+
+		reg_fldo2: fldo2 {
+			regulator-name = "fldo2";
+		};
+
+		reg_ldo_io0: ldo_io0 {
+			regulator-name = "ldo_io0";
+			status = "disabled";
+		};
+
+		reg_ldo_io1: ldo_io1 {
+			regulator-name = "ldo_io1";
+			status = "disabled";
+		};
+
+		reg_rtc_ldo: rtc_ldo {
+			/* RTC_LDO is a fixed, always-on regulator */
+			regulator-always-on;
+			regulator-min-microvolt = <3000000>;
+			regulator-max-microvolt = <3000000>;
+			regulator-name = "rtc_ldo";
+		};
+	};
+};
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 09/11] arm64: allwinner: a64: add DTSI file for AXP803 PMIC
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Icenowy Zheng

As nearly all A64 boards are using AXP803 PMIC, add a DTSI file for it,
like the old DTSI files for AXP20x/22x, for the common parts of the
PMIC.

Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
---
 arch/arm64/boot/dts/allwinner/axp803.dtsi | 150 ++++++++++++++++++++++++++++++
 1 file changed, 150 insertions(+)
 create mode 100644 arch/arm64/boot/dts/allwinner/axp803.dtsi

diff --git a/arch/arm64/boot/dts/allwinner/axp803.dtsi b/arch/arm64/boot/dts/allwinner/axp803.dtsi
new file mode 100644
index 000000000000..f0e53a7fffbd
--- /dev/null
+++ b/arch/arm64/boot/dts/allwinner/axp803.dtsi
@@ -0,0 +1,150 @@
+/*
+ * Copyright 2017 Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * AXP803 Integrated Power Management Chip
+ * http://files.pine64.org/doc/datasheet/pine64/AXP803_Datasheet_V1.0.pdf
+ */
+
+&axp803 {
+	interrupt-controller;
+	#interrupt-cells = <1>;
+
+	regulators {
+		/* Default work frequency for buck regulators */
+		x-powers,dcdc-freq = <3000>;
+
+		reg_dcdc1: dcdc1 {
+			regulator-name = "dcdc1";
+		};
+
+		reg_dcdc2: dcdc2 {
+			regulator-name = "dcdc2";
+		};
+
+		reg_dcdc3: dcdc3 {
+			regulator-name = "dcdc3";
+		};
+
+		reg_dcdc4: dcdc4 {
+			regulator-name = "dcdc4";
+		};
+
+		reg_dcdc5: dcdc5 {
+			regulator-name = "dcdc5";
+		};
+
+		reg_dcdc6: dcdc6 {
+			regulator-name = "dcdc6";
+		};
+
+		reg_dc1sw: dc1sw {
+			regulator-name = "dc1sw";
+		};
+
+		reg_aldo1: aldo1 {
+			regulator-name = "aldo1";
+		};
+
+		reg_aldo2: aldo2 {
+			regulator-name = "aldo2";
+		};
+
+		reg_aldo3: aldo3 {
+			regulator-name = "aldo3";
+		};
+
+		reg_dldo1: dldo1 {
+			regulator-name = "dldo1";
+		};
+
+		reg_dldo2: dldo2 {
+			regulator-name = "dldo2";
+		};
+
+		reg_dldo3: dldo3 {
+			regulator-name = "dldo3";
+		};
+
+		reg_dldo4: dldo4 {
+			regulator-name = "dldo4";
+		};
+
+		reg_eldo1: eldo1 {
+			regulator-name = "eldo1";
+		};
+
+		reg_eldo2: eldo2 {
+			regulator-name = "eldo2";
+		};
+
+		reg_eldo3: eldo3 {
+			regulator-name = "eldo3";
+		};
+
+		reg_fldo1: fldo1 {
+			regulator-name = "fldo1";
+		};
+
+		reg_fldo2: fldo2 {
+			regulator-name = "fldo2";
+		};
+
+		reg_ldo_io0: ldo_io0 {
+			regulator-name = "ldo_io0";
+			status = "disabled";
+		};
+
+		reg_ldo_io1: ldo_io1 {
+			regulator-name = "ldo_io1";
+			status = "disabled";
+		};
+
+		reg_rtc_ldo: rtc_ldo {
+			/* RTC_LDO is a fixed, always-on regulator */
+			regulator-always-on;
+			regulator-min-microvolt = <3000000>;
+			regulator-max-microvolt = <3000000>;
+			regulator-name = "rtc_ldo";
+		};
+	};
+};
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 09/11] arm64: allwinner: a64: add DTSI file for AXP803 PMIC
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: linux-arm-kernel

As nearly all A64 boards are using AXP803 PMIC, add a DTSI file for it,
like the old DTSI files for AXP20x/22x, for the common parts of the
PMIC.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 arch/arm64/boot/dts/allwinner/axp803.dtsi | 150 ++++++++++++++++++++++++++++++
 1 file changed, 150 insertions(+)
 create mode 100644 arch/arm64/boot/dts/allwinner/axp803.dtsi

diff --git a/arch/arm64/boot/dts/allwinner/axp803.dtsi b/arch/arm64/boot/dts/allwinner/axp803.dtsi
new file mode 100644
index 000000000000..f0e53a7fffbd
--- /dev/null
+++ b/arch/arm64/boot/dts/allwinner/axp803.dtsi
@@ -0,0 +1,150 @@
+/*
+ * Copyright 2017 Icenowy Zheng <icenowy@aosc.xyz>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * AXP803 Integrated Power Management Chip
+ * http://files.pine64.org/doc/datasheet/pine64/AXP803_Datasheet_V1.0.pdf
+ */
+
+&axp803 {
+	interrupt-controller;
+	#interrupt-cells = <1>;
+
+	regulators {
+		/* Default work frequency for buck regulators */
+		x-powers,dcdc-freq = <3000>;
+
+		reg_dcdc1: dcdc1 {
+			regulator-name = "dcdc1";
+		};
+
+		reg_dcdc2: dcdc2 {
+			regulator-name = "dcdc2";
+		};
+
+		reg_dcdc3: dcdc3 {
+			regulator-name = "dcdc3";
+		};
+
+		reg_dcdc4: dcdc4 {
+			regulator-name = "dcdc4";
+		};
+
+		reg_dcdc5: dcdc5 {
+			regulator-name = "dcdc5";
+		};
+
+		reg_dcdc6: dcdc6 {
+			regulator-name = "dcdc6";
+		};
+
+		reg_dc1sw: dc1sw {
+			regulator-name = "dc1sw";
+		};
+
+		reg_aldo1: aldo1 {
+			regulator-name = "aldo1";
+		};
+
+		reg_aldo2: aldo2 {
+			regulator-name = "aldo2";
+		};
+
+		reg_aldo3: aldo3 {
+			regulator-name = "aldo3";
+		};
+
+		reg_dldo1: dldo1 {
+			regulator-name = "dldo1";
+		};
+
+		reg_dldo2: dldo2 {
+			regulator-name = "dldo2";
+		};
+
+		reg_dldo3: dldo3 {
+			regulator-name = "dldo3";
+		};
+
+		reg_dldo4: dldo4 {
+			regulator-name = "dldo4";
+		};
+
+		reg_eldo1: eldo1 {
+			regulator-name = "eldo1";
+		};
+
+		reg_eldo2: eldo2 {
+			regulator-name = "eldo2";
+		};
+
+		reg_eldo3: eldo3 {
+			regulator-name = "eldo3";
+		};
+
+		reg_fldo1: fldo1 {
+			regulator-name = "fldo1";
+		};
+
+		reg_fldo2: fldo2 {
+			regulator-name = "fldo2";
+		};
+
+		reg_ldo_io0: ldo_io0 {
+			regulator-name = "ldo_io0";
+			status = "disabled";
+		};
+
+		reg_ldo_io1: ldo_io1 {
+			regulator-name = "ldo_io1";
+			status = "disabled";
+		};
+
+		reg_rtc_ldo: rtc_ldo {
+			/* RTC_LDO is a fixed, always-on regulator */
+			regulator-always-on;
+			regulator-min-microvolt = <3000000>;
+			regulator-max-microvolt = <3000000>;
+			regulator-name = "rtc_ldo";
+		};
+	};
+};
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 10/11] arm64: allwinner: a64: enable AXP803 regulators for Pine64
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood
  Cc: devicetree, linux-sunxi, linux-kernel, linux-arm-kernel, Icenowy Zheng

Add support of AXP803 regulators in the Pine64 device tree, in order to
enable many future functionalities, e.g. Wi-Fi.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 .../arm64/boot/dts/allwinner/sun50i-a64-pine64.dts | 109 +++++++++++++++++++++
 1 file changed, 109 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
index 2132d8e6cb3d..7da074f95065 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
@@ -106,6 +106,115 @@
 	};
 };
 
+#include "axp803.dtsi"
+
+&reg_aldo1 {
+	regulator-min-microvolt = <2800000>;
+	regulator-max-microvolt = <2800000>;
+	regulator-name = "vcc-csi";
+};
+
+&reg_aldo2 {
+	regulator-always-on;
+	regulator-min-microvolt = <1800000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "vcc-pl";
+};
+
+&reg_aldo3 {
+	regulator-always-on;
+	regulator-min-microvolt = <2700000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "vcc-pll-avcc";
+};
+
+&reg_dc1sw {
+	regulator-name = "vcc-phy";
+};
+
+&reg_dcdc1 {
+	regulator-always-on;
+	regulator-min-microvolt = <3300000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "vcc-3v3";
+};
+
+&reg_dcdc2 {
+	regulator-always-on;
+	regulator-min-microvolt = <1000000>;
+	regulator-max-microvolt = <1300000>;
+	regulator-name = "vdd-cpux";
+};
+
+/* DCDC3 is polyphased with DCDC2 */
+
+&reg_dcdc5 {
+	regulator-always-on;
+	regulator-min-microvolt = <1500000>;
+	regulator-max-microvolt = <1500000>;
+	regulator-name = "vcc-dram";
+};
+
+&reg_dcdc6 {
+	regulator-always-on;
+	regulator-min-microvolt = <1100000>;
+	regulator-max-microvolt = <1100000>;
+	regulator-name = "vdd-sys";
+};
+
+&reg_dldo1 {
+	regulator-min-microvolt = <3300000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "vcc-hdmi";
+};
+
+&reg_dldo2 {
+	regulator-min-microvolt = <3300000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "vcc-mipi";
+};
+
+&reg_dldo3 {
+	regulator-min-microvolt = <3300000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "avdd-csi";
+};
+
+&reg_dldo4 {
+	regulator-min-microvolt = <3300000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "vcc-wifi";
+};
+
+&reg_eldo1 {
+	regulator-min-microvolt = <1800000>;
+	regulator-max-microvolt = <1800000>;
+	regulator-name = "cpvdd";
+};
+
+&reg_eldo3 {
+	regulator-min-microvolt = <1800000>;
+	regulator-max-microvolt = <1800000>;
+	regulator-name = "vdd-1v8-csi";
+};
+
+&reg_fldo1 {
+	regulator-min-microvolt = <1200000>;
+	regulator-max-microvolt = <1200000>;
+	regulator-name = "vcc-1v2-hsic";
+};
+
+&reg_fldo2 {
+	regulator-always-on;
+	regulator-min-microvolt = <1100000>;
+	regulator-max-microvolt = <1100000>;
+	regulator-name = "vdd-cpus";
+};
+
+&reg_rtc_ldo {
+	regulator-name = "vcc-rtc";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins_a>;
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 10/11] arm64: allwinner: a64: enable AXP803 regulators for Pine64
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Icenowy Zheng

Add support of AXP803 regulators in the Pine64 device tree, in order to
enable many future functionalities, e.g. Wi-Fi.

Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
---
 .../arm64/boot/dts/allwinner/sun50i-a64-pine64.dts | 109 +++++++++++++++++++++
 1 file changed, 109 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
index 2132d8e6cb3d..7da074f95065 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
@@ -106,6 +106,115 @@
 	};
 };
 
+#include "axp803.dtsi"
+
+&reg_aldo1 {
+	regulator-min-microvolt = <2800000>;
+	regulator-max-microvolt = <2800000>;
+	regulator-name = "vcc-csi";
+};
+
+&reg_aldo2 {
+	regulator-always-on;
+	regulator-min-microvolt = <1800000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "vcc-pl";
+};
+
+&reg_aldo3 {
+	regulator-always-on;
+	regulator-min-microvolt = <2700000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "vcc-pll-avcc";
+};
+
+&reg_dc1sw {
+	regulator-name = "vcc-phy";
+};
+
+&reg_dcdc1 {
+	regulator-always-on;
+	regulator-min-microvolt = <3300000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "vcc-3v3";
+};
+
+&reg_dcdc2 {
+	regulator-always-on;
+	regulator-min-microvolt = <1000000>;
+	regulator-max-microvolt = <1300000>;
+	regulator-name = "vdd-cpux";
+};
+
+/* DCDC3 is polyphased with DCDC2 */
+
+&reg_dcdc5 {
+	regulator-always-on;
+	regulator-min-microvolt = <1500000>;
+	regulator-max-microvolt = <1500000>;
+	regulator-name = "vcc-dram";
+};
+
+&reg_dcdc6 {
+	regulator-always-on;
+	regulator-min-microvolt = <1100000>;
+	regulator-max-microvolt = <1100000>;
+	regulator-name = "vdd-sys";
+};
+
+&reg_dldo1 {
+	regulator-min-microvolt = <3300000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "vcc-hdmi";
+};
+
+&reg_dldo2 {
+	regulator-min-microvolt = <3300000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "vcc-mipi";
+};
+
+&reg_dldo3 {
+	regulator-min-microvolt = <3300000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "avdd-csi";
+};
+
+&reg_dldo4 {
+	regulator-min-microvolt = <3300000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "vcc-wifi";
+};
+
+&reg_eldo1 {
+	regulator-min-microvolt = <1800000>;
+	regulator-max-microvolt = <1800000>;
+	regulator-name = "cpvdd";
+};
+
+&reg_eldo3 {
+	regulator-min-microvolt = <1800000>;
+	regulator-max-microvolt = <1800000>;
+	regulator-name = "vdd-1v8-csi";
+};
+
+&reg_fldo1 {
+	regulator-min-microvolt = <1200000>;
+	regulator-max-microvolt = <1200000>;
+	regulator-name = "vcc-1v2-hsic";
+};
+
+&reg_fldo2 {
+	regulator-always-on;
+	regulator-min-microvolt = <1100000>;
+	regulator-max-microvolt = <1100000>;
+	regulator-name = "vdd-cpus";
+};
+
+&reg_rtc_ldo {
+	regulator-name = "vcc-rtc";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins_a>;
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 10/11] arm64: allwinner: a64: enable AXP803 regulators for Pine64
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: linux-arm-kernel

Add support of AXP803 regulators in the Pine64 device tree, in order to
enable many future functionalities, e.g. Wi-Fi.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 .../arm64/boot/dts/allwinner/sun50i-a64-pine64.dts | 109 +++++++++++++++++++++
 1 file changed, 109 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
index 2132d8e6cb3d..7da074f95065 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
@@ -106,6 +106,115 @@
 	};
 };
 
+#include "axp803.dtsi"
+
+&reg_aldo1 {
+	regulator-min-microvolt = <2800000>;
+	regulator-max-microvolt = <2800000>;
+	regulator-name = "vcc-csi";
+};
+
+&reg_aldo2 {
+	regulator-always-on;
+	regulator-min-microvolt = <1800000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "vcc-pl";
+};
+
+&reg_aldo3 {
+	regulator-always-on;
+	regulator-min-microvolt = <2700000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "vcc-pll-avcc";
+};
+
+&reg_dc1sw {
+	regulator-name = "vcc-phy";
+};
+
+&reg_dcdc1 {
+	regulator-always-on;
+	regulator-min-microvolt = <3300000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "vcc-3v3";
+};
+
+&reg_dcdc2 {
+	regulator-always-on;
+	regulator-min-microvolt = <1000000>;
+	regulator-max-microvolt = <1300000>;
+	regulator-name = "vdd-cpux";
+};
+
+/* DCDC3 is polyphased with DCDC2 */
+
+&reg_dcdc5 {
+	regulator-always-on;
+	regulator-min-microvolt = <1500000>;
+	regulator-max-microvolt = <1500000>;
+	regulator-name = "vcc-dram";
+};
+
+&reg_dcdc6 {
+	regulator-always-on;
+	regulator-min-microvolt = <1100000>;
+	regulator-max-microvolt = <1100000>;
+	regulator-name = "vdd-sys";
+};
+
+&reg_dldo1 {
+	regulator-min-microvolt = <3300000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "vcc-hdmi";
+};
+
+&reg_dldo2 {
+	regulator-min-microvolt = <3300000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "vcc-mipi";
+};
+
+&reg_dldo3 {
+	regulator-min-microvolt = <3300000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "avdd-csi";
+};
+
+&reg_dldo4 {
+	regulator-min-microvolt = <3300000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "vcc-wifi";
+};
+
+&reg_eldo1 {
+	regulator-min-microvolt = <1800000>;
+	regulator-max-microvolt = <1800000>;
+	regulator-name = "cpvdd";
+};
+
+&reg_eldo3 {
+	regulator-min-microvolt = <1800000>;
+	regulator-max-microvolt = <1800000>;
+	regulator-name = "vdd-1v8-csi";
+};
+
+&reg_fldo1 {
+	regulator-min-microvolt = <1200000>;
+	regulator-max-microvolt = <1200000>;
+	regulator-name = "vcc-1v2-hsic";
+};
+
+&reg_fldo2 {
+	regulator-always-on;
+	regulator-min-microvolt = <1100000>;
+	regulator-max-microvolt = <1100000>;
+	regulator-name = "vdd-cpus";
+};
+
+&reg_rtc_ldo {
+	regulator-name = "vcc-rtc";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins_a>;
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 11/11] arm64: allwinner: a64: enable Wi-Fi for Pine64
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood
  Cc: devicetree, linux-sunxi, linux-kernel, linux-arm-kernel, Icenowy Zheng

The Wi-Fi modules of Pine64 is powered via DLDO4 and ELDO1 (the latter
one provides I/O voltage).

Add device node for it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
index 7da074f95065..9d90bb32aa87 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
@@ -64,6 +64,11 @@
 		regulator-min-microvolt = <3300000>;
 		regulator-max-microvolt = <3300000>;
 	};
+
+	wifi_pwrseq: wifi_pwrseq {
+		compatible = "mmc-pwrseq-simple";
+		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
+	};
 };
 
 &ehci1 {
@@ -91,6 +96,17 @@
 	status = "okay";
 };
 
+&mmc1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc1_pins>;
+	vmmc-supply = <&reg_dldo4>;
+	vqmmc-supply = <&reg_eldo1>;
+	mmc-pwrseq = <&wifi_pwrseq>;
+	non-removable;
+	bus-width = <4>;
+	status = "okay";
+};
+
 &ohci1 {
 	status = "okay";
 };
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 11/11] arm64: allwinner: a64: enable Wi-Fi for Pine64
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Icenowy Zheng

The Wi-Fi modules of Pine64 is powered via DLDO4 and ELDO1 (the latter
one provides I/O voltage).

Add device node for it.

Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
---
 arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
index 7da074f95065..9d90bb32aa87 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
@@ -64,6 +64,11 @@
 		regulator-min-microvolt = <3300000>;
 		regulator-max-microvolt = <3300000>;
 	};
+
+	wifi_pwrseq: wifi_pwrseq {
+		compatible = "mmc-pwrseq-simple";
+		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
+	};
 };
 
 &ehci1 {
@@ -91,6 +96,17 @@
 	status = "okay";
 };
 
+&mmc1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc1_pins>;
+	vmmc-supply = <&reg_dldo4>;
+	vqmmc-supply = <&reg_eldo1>;
+	mmc-pwrseq = <&wifi_pwrseq>;
+	non-removable;
+	bus-width = <4>;
+	status = "okay";
+};
+
 &ohci1 {
 	status = "okay";
 };
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v2 11/11] arm64: allwinner: a64: enable Wi-Fi for Pine64
@ 2017-04-07 18:34   ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-07 18:34 UTC (permalink / raw)
  To: linux-arm-kernel

The Wi-Fi modules of Pine64 is powered via DLDO4 and ELDO1 (the latter
one provides I/O voltage).

Add device node for it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
index 7da074f95065..9d90bb32aa87 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
@@ -64,6 +64,11 @@
 		regulator-min-microvolt = <3300000>;
 		regulator-max-microvolt = <3300000>;
 	};
+
+	wifi_pwrseq: wifi_pwrseq {
+		compatible = "mmc-pwrseq-simple";
+		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
+	};
 };
 
 &ehci1 {
@@ -91,6 +96,17 @@
 	status = "okay";
 };
 
+&mmc1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc1_pins>;
+	vmmc-supply = <&reg_dldo4>;
+	vqmmc-supply = <&reg_eldo1>;
+	mmc-pwrseq = <&wifi_pwrseq>;
+	non-removable;
+	bus-width = <4>;
+	status = "okay";
+};
+
 &ohci1 {
 	status = "okay";
 };
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* Re: [PATCH v2 08/11] mfd: axp20x: add axp20x-regulator cell for AXP803
  2017-04-07 18:34   ` Icenowy Zheng
@ 2017-04-11 14:03     ` Lee Jones
  -1 siblings, 0 replies; 71+ messages in thread
From: Lee Jones @ 2017-04-11 14:03 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood,
	devicetree, linux-sunxi, linux-kernel, linux-arm-kernel

On Sat, 08 Apr 2017, Icenowy Zheng wrote:

> As axp20x-regulator now supports AXP803, add a cell for it.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
>  drivers/mfd/axp20x.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index 2268a6a9aa2c..08b9bbd5bd71 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -839,6 +839,8 @@ static struct mfd_cell axp803_cells[] = {
>  		.name			= "axp20x-pek",
>  		.num_resources		= ARRAY_SIZE(axp803_pek_resources),
>  		.resources		= axp803_pek_resources,
> +	}, {
> +		.name			= "axp20x-regulator",

I'd prefer it if you placed single lined entries on one line.

Like this:

	{	.name			= "axp20x-regulator" }


-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH v2 08/11] mfd: axp20x: add axp20x-regulator cell for AXP803
@ 2017-04-11 14:03     ` Lee Jones
  0 siblings, 0 replies; 71+ messages in thread
From: Lee Jones @ 2017-04-11 14:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, 08 Apr 2017, Icenowy Zheng wrote:

> As axp20x-regulator now supports AXP803, add a cell for it.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
>  drivers/mfd/axp20x.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index 2268a6a9aa2c..08b9bbd5bd71 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -839,6 +839,8 @@ static struct mfd_cell axp803_cells[] = {
>  		.name			= "axp20x-pek",
>  		.num_resources		= ARRAY_SIZE(axp803_pek_resources),
>  		.resources		= axp803_pek_resources,
> +	}, {
> +		.name			= "axp20x-regulator",

I'd prefer it if you placed single lined entries on one line.

Like this:

	{	.name			= "axp20x-regulator" }


-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v2 07/11] regulator: axp20x-regulator: add support for AXP803
@ 2017-04-11 14:03     ` Lee Jones
  0 siblings, 0 replies; 71+ messages in thread
From: Lee Jones @ 2017-04-11 14:03 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood,
	devicetree, linux-sunxi, linux-kernel, linux-arm-kernel

On Sat, 08 Apr 2017, Icenowy Zheng wrote:

> AXP803 PMIC also have a series of regulators (DCDCs and LDOs)
> controllable via I2C/RSB bus.
> 
> Add support for them.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
> Changes in v2:
> - Place AXP803 codes before AXP806/809 ones.
> - Fixed some errors in regulator description.
> - Reuse AXP803 DLDO2 range for AXP806 CLDO2 & AXP809 DLDO1.
> 
>  drivers/regulator/axp20x-regulator.c | 153 ++++++++++++++++++++++++++++++-----
>  include/linux/mfd/axp20x.h           |  37 +++++++++
>  2 files changed, 168 insertions(+), 22 deletions(-)

For my own reference:
  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
  
> diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
> index 0b9d4e3e52c7..2ed15e4a7a82 100644
> --- a/drivers/regulator/axp20x-regulator.c
> +++ b/drivers/regulator/axp20x-regulator.c
> @@ -244,6 +244,82 @@ static const struct regulator_desc axp22x_drivevbus_regulator = {
>  	.ops		= &axp20x_ops_sw,
>  };
>  
> +static const struct regulator_linear_range axp803_dcdc234_ranges[] = {
> +	REGULATOR_LINEAR_RANGE(500000, 0x0, 0x46, 10000),
> +	REGULATOR_LINEAR_RANGE(1220000, 0x47, 0x4b, 20000),
> +};
> +
> +static const struct regulator_linear_range axp803_dcdc5_ranges[] = {
> +	REGULATOR_LINEAR_RANGE(800000, 0x0, 0x20, 10000),
> +	REGULATOR_LINEAR_RANGE(1140000, 0x21, 0x44, 20000),
> +};
> +
> +static const struct regulator_linear_range axp803_dcdc6_ranges[] = {
> +	REGULATOR_LINEAR_RANGE(600000, 0x0, 0x32, 10000),
> +	REGULATOR_LINEAR_RANGE(1120000, 0x33, 0x47, 20000),
> +};
> +
> +/* AXP806's CLDO2 and AXP809's DLDO1 shares the same range */
> +static const struct regulator_linear_range axp803_dldo2_ranges[] = {
> +	REGULATOR_LINEAR_RANGE(700000, 0x0, 0x1a, 100000),
> +	REGULATOR_LINEAR_RANGE(3400000, 0x1b, 0x1f, 200000),
> +};
> +
> +static const struct regulator_desc axp803_regulators[] = {
> +	AXP_DESC(AXP803, DCDC1, "dcdc1", "vin1", 1600, 3400, 100,
> +		 AXP803_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(0)),
> +	AXP_DESC_RANGES(AXP803, DCDC2, "dcdc2", "vin2", axp803_dcdc234_ranges,
> +			76, AXP803_DCDC2_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
> +			BIT(1)),
> +	AXP_DESC_RANGES(AXP803, DCDC3, "dcdc3", "vin3", axp803_dcdc234_ranges,
> +			76, AXP803_DCDC3_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
> +			BIT(2)),
> +	AXP_DESC_RANGES(AXP803, DCDC4, "dcdc4", "vin4", axp803_dcdc234_ranges,
> +			76, AXP803_DCDC4_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
> +			BIT(3)),
> +	AXP_DESC_RANGES(AXP803, DCDC5, "dcdc5", "vin5", axp803_dcdc5_ranges,
> +			68, AXP803_DCDC5_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
> +			BIT(4)),
> +	AXP_DESC_RANGES(AXP803, DCDC6, "dcdc6", "vin6", axp803_dcdc6_ranges,
> +			72, AXP803_DCDC6_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
> +			BIT(5)),
> +	/* secondary switchable output of DCDC1 */
> +	AXP_DESC_SW(AXP803, DC1SW, "dc1sw", NULL, AXP22X_PWR_OUT_CTRL2,
> +		    BIT(7)),
> +	AXP_DESC(AXP803, ALDO1, "aldo1", "aldoin", 700, 3300, 100,
> +		 AXP22X_ALDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(5)),
> +	AXP_DESC(AXP803, ALDO2, "aldo2", "aldoin", 700, 3300, 100,
> +		 AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(6)),
> +	AXP_DESC(AXP803, ALDO3, "aldo3", "aldoin", 700, 3300, 100,
> +		 AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(7)),
> +	AXP_DESC(AXP803, DLDO1, "dldo1", "dldoin", 700, 3300, 100,
> +		 AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(3)),
> +	AXP_DESC_RANGES(AXP803, DLDO2, "dldo2", "dldoin", axp803_dldo2_ranges,
> +			32, AXP22X_DLDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2,
> +			BIT(4)),
> +	AXP_DESC(AXP803, DLDO3, "dldo3", "dldoin", 700, 3300, 100,
> +		 AXP22X_DLDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(5)),
> +	AXP_DESC(AXP803, DLDO4, "dldo4", "dldoin", 700, 3300, 100,
> +		 AXP22X_DLDO4_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(6)),
> +	AXP_DESC(AXP803, ELDO1, "eldo1", "eldoin", 700, 1900, 50,
> +		 AXP22X_ELDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(0)),
> +	AXP_DESC(AXP803, ELDO2, "eldo2", "eldoin", 700, 1900, 50,
> +		 AXP22X_ELDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(1)),
> +	AXP_DESC(AXP803, ELDO3, "eldo3", "eldoin", 700, 1900, 50,
> +		 AXP22X_ELDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(2)),
> +	AXP_DESC(AXP803, FLDO1, "fldo1", "fldoin", 700, 1450, 50,
> +		 AXP803_FLDO1_V_OUT, 0x0f, AXP22X_PWR_OUT_CTRL3, BIT(2)),
> +	AXP_DESC(AXP803, FLDO2, "fldo2", "fldoin", 700, 1450, 50,
> +		 AXP803_FLDO2_V_OUT, 0x0f, AXP22X_PWR_OUT_CTRL3, BIT(3)),
> +	AXP_DESC_IO(AXP803, LDO_IO0, "ldo_io0", "ips", 700, 3300, 100,
> +		    AXP22X_LDO_IO0_V_OUT, 0x1f, AXP20X_GPIO0_CTRL, 0x07,
> +		    AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
> +	AXP_DESC_IO(AXP803, LDO_IO1, "ldo_io1", "ips", 700, 3300, 100,
> +		    AXP22X_LDO_IO1_V_OUT, 0x1f, AXP20X_GPIO1_CTRL, 0x07,
> +		    AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
> +	AXP_DESC_FIXED(AXP803, RTC_LDO, "rtc_ldo", "ips", 3000),
> +};
> +
>  static const struct regulator_linear_range axp806_dcdca_ranges[] = {
>  	REGULATOR_LINEAR_RANGE(600000, 0x0, 0x32, 10000),
>  	REGULATOR_LINEAR_RANGE(1120000, 0x33, 0x47, 20000),
> @@ -254,11 +330,6 @@ static const struct regulator_linear_range axp806_dcdcd_ranges[] = {
>  	REGULATOR_LINEAR_RANGE(1600000, 0x2e, 0x3f, 100000),
>  };
>  
> -static const struct regulator_linear_range axp806_cldo2_ranges[] = {
> -	REGULATOR_LINEAR_RANGE(700000, 0x0, 0x1a, 100000),
> -	REGULATOR_LINEAR_RANGE(3400000, 0x1b, 0x1f, 200000),
> -};
> -
>  static const struct regulator_desc axp806_regulators[] = {
>  	AXP_DESC_RANGES(AXP806, DCDCA, "dcdca", "vina", axp806_dcdca_ranges,
>  			72, AXP806_DCDCA_V_CTRL, 0x7f, AXP806_PWR_OUT_CTRL1,
> @@ -289,7 +360,7 @@ static const struct regulator_desc axp806_regulators[] = {
>  		 AXP806_BLDO4_V_CTRL, 0x0f, AXP806_PWR_OUT_CTRL2, BIT(3)),
>  	AXP_DESC(AXP806, CLDO1, "cldo1", "cldoin", 700, 3300, 100,
>  		 AXP806_CLDO1_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL2, BIT(4)),
> -	AXP_DESC_RANGES(AXP806, CLDO2, "cldo2", "cldoin", axp806_cldo2_ranges,
> +	AXP_DESC_RANGES(AXP806, CLDO2, "cldo2", "cldoin", axp803_dldo2_ranges,
>  			32, AXP806_CLDO2_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL2,
>  			BIT(5)),
>  	AXP_DESC(AXP806, CLDO3, "cldo3", "cldoin", 700, 3300, 100,
> @@ -326,7 +397,7 @@ static const struct regulator_desc axp809_regulators[] = {
>  		 AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(7)),
>  	AXP_DESC(AXP809, ALDO3, "aldo3", "aldoin", 700, 3300, 100,
>  		 AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(5)),
> -	AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp806_cldo2_ranges,
> +	AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp803_dldo2_ranges,
>  			32, AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2,
>  			BIT(3)),
>  	AXP_DESC(AXP809, DLDO2, "dldo2", "dldoin", 700, 3300, 100,
> @@ -369,14 +440,21 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
>  		def = 1500;
>  		step = 75;
>  		break;
> -	case AXP806_ID:
> +	case AXP803_ID:
>  		/*
> -		 * AXP806 DCDC work frequency setting has the same range and
> +		 * AXP803 DCDC work frequency setting has the same range and
>  		 * step as AXP22X, but at a different register.
>  		 * Fall through to the check below.
>  		 * (See include/linux/mfd/axp20x.h)
>  		 */
> -		reg = AXP806_DCDC_FREQ_CTRL;
> +		reg = AXP803_DCDC_FREQ_CTRL;
> +	case AXP806_ID:
> +		/*
> +		 * AXP806 also have DCDC work frequency setting register at a
> +		 * different position.
> +		 */
> +		if (axp20x->variant == AXP806_ID)
> +			reg = AXP806_DCDC_FREQ_CTRL;
>  	case AXP221_ID:
>  	case AXP223_ID:
>  	case AXP809_ID:
> @@ -475,6 +553,14 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 work
>  		workmode <<= id - AXP22X_DCDC1;
>  		break;
>  
> +	case AXP803_ID:
> +		if (id < AXP803_DCDC1 || id > AXP803_DCDC6)
> +			return -EINVAL;
> +
> +		mask = AXP22X_WORKMODE_DCDCX_MASK(id - AXP803_DCDC1);
> +		workmode <<= id - AXP803_DCDC1;
> +		break;
> +
>  	default:
>  		/* should not happen */
>  		WARN_ON(1);
> @@ -492,20 +578,38 @@ static bool axp20x_is_polyphase_slave(struct axp20x_dev *axp20x, int id)
>  {
>  	u32 reg = 0;
>  
> -	/* Only AXP806 has poly-phase outputs */
> -	if (axp20x->variant != AXP806_ID)
> -		return false;
> +	/*
> +	 * Currently in our supported AXP variants, only AXP806 and AXP803
> +	 * have polyphase regulators.
> +	 */
> +	switch (axp20x->variant) {
> +	case AXP803_ID:
> +		regmap_read(axp20x->regmap, AXP803_POLYPHASE_CTRL, &reg);
> +
> +		switch (id) {
> +		case AXP803_DCDC3:
> +			return !!(reg & BIT(6));
> +		case AXP803_DCDC6:
> +			return !!(reg & BIT(7));
> +		}
> +		break;
>  
> -	regmap_read(axp20x->regmap, AXP806_DCDC_MODE_CTRL2, &reg);
> +	case AXP806_ID:
> +		regmap_read(axp20x->regmap, AXP806_DCDC_MODE_CTRL2, &reg);
> +
> +		switch (id) {
> +		case AXP806_DCDCB:
> +			return (((reg & GENMASK(7, 6)) == BIT(6)) ||
> +				((reg & GENMASK(7, 6)) == BIT(7)));
> +		case AXP806_DCDCC:
> +			return ((reg & GENMASK(7, 6)) == BIT(7));
> +		case AXP806_DCDCE:
> +			return !!(reg & BIT(5));
> +		}
> +		break;
>  
> -	switch (id) {
> -	case AXP806_DCDCB:
> -		return (((reg & GENMASK(7, 6)) == BIT(6)) ||
> -			((reg & GENMASK(7, 6)) == BIT(7)));
> -	case AXP806_DCDCC:
> -		return ((reg & GENMASK(7, 6)) == BIT(7));
> -	case AXP806_DCDCE:
> -		return !!(reg & BIT(5));
> +	default:
> +		return false;
>  	}
>  
>  	return false;
> @@ -540,6 +644,10 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
>  		drivevbus = of_property_read_bool(pdev->dev.parent->of_node,
>  						  "x-powers,drive-vbus-en");
>  		break;
> +	case AXP803_ID:
> +		regulators = axp803_regulators;
> +		nregulators = AXP803_REG_ID_MAX;
> +		break;
>  	case AXP806_ID:
>  		regulators = axp806_regulators;
>  		nregulators = AXP806_REG_ID_MAX;
> @@ -579,6 +687,7 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
>  		 * name.
>  		 */
>  		if ((regulators == axp22x_regulators && i == AXP22X_DC1SW) ||
> +		    (regulators == axp803_regulators && i == AXP803_DC1SW) ||
>  		    (regulators == axp809_regulators && i == AXP809_DC1SW)) {
>  			new_desc = devm_kzalloc(&pdev->dev, sizeof(*desc),
>  						GFP_KERNEL);
> diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
> index cde56cfe8446..965b027e31b3 100644
> --- a/include/linux/mfd/axp20x.h
> +++ b/include/linux/mfd/axp20x.h
> @@ -119,6 +119,17 @@ enum axp20x_variants {
>  #define AXP806_BUS_ADDR_EXT		0xfe
>  #define AXP806_REG_ADDR_EXT		0xff
>  
> +#define AXP803_POLYPHASE_CTRL		0x14
> +#define AXP803_FLDO1_V_OUT		0x1c
> +#define AXP803_FLDO2_V_OUT		0x1d
> +#define AXP803_DCDC1_V_OUT		0x20
> +#define AXP803_DCDC2_V_OUT		0x21
> +#define AXP803_DCDC3_V_OUT		0x22
> +#define AXP803_DCDC4_V_OUT		0x23
> +#define AXP803_DCDC5_V_OUT		0x24
> +#define AXP803_DCDC6_V_OUT		0x25
> +#define AXP803_DCDC_FREQ_CTRL		0x3b
> +
>  /* Interrupt */
>  #define AXP152_IRQ1_EN			0x40
>  #define AXP152_IRQ2_EN			0x41
> @@ -350,6 +361,32 @@ enum {
>  	AXP809_REG_ID_MAX,
>  };
>  
> +enum {
> +	AXP803_DCDC1 = 0,
> +	AXP803_DCDC2,
> +	AXP803_DCDC3,
> +	AXP803_DCDC4,
> +	AXP803_DCDC5,
> +	AXP803_DCDC6,
> +	AXP803_DC1SW,
> +	AXP803_ALDO1,
> +	AXP803_ALDO2,
> +	AXP803_ALDO3,
> +	AXP803_DLDO1,
> +	AXP803_DLDO2,
> +	AXP803_DLDO3,
> +	AXP803_DLDO4,
> +	AXP803_ELDO1,
> +	AXP803_ELDO2,
> +	AXP803_ELDO3,
> +	AXP803_FLDO1,
> +	AXP803_FLDO2,
> +	AXP803_RTC_LDO,
> +	AXP803_LDO_IO0,
> +	AXP803_LDO_IO1,
> +	AXP803_REG_ID_MAX,
> +};
> +
>  /* IRQs */
>  enum {
>  	AXP152_IRQ_LDO0IN_CONNECT = 1,

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v2 07/11] regulator: axp20x-regulator: add support for AXP803
@ 2017-04-11 14:03     ` Lee Jones
  0 siblings, 0 replies; 71+ messages in thread
From: Lee Jones @ 2017-04-11 14:03 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Sat, 08 Apr 2017, Icenowy Zheng wrote:

> AXP803 PMIC also have a series of regulators (DCDCs and LDOs)
> controllable via I2C/RSB bus.
> 
> Add support for them.
> 
> Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
> ---
> Changes in v2:
> - Place AXP803 codes before AXP806/809 ones.
> - Fixed some errors in regulator description.
> - Reuse AXP803 DLDO2 range for AXP806 CLDO2 & AXP809 DLDO1.
> 
>  drivers/regulator/axp20x-regulator.c | 153 ++++++++++++++++++++++++++++++-----
>  include/linux/mfd/axp20x.h           |  37 +++++++++
>  2 files changed, 168 insertions(+), 22 deletions(-)

For my own reference:
  Acked-for-MFD-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  
> diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
> index 0b9d4e3e52c7..2ed15e4a7a82 100644
> --- a/drivers/regulator/axp20x-regulator.c
> +++ b/drivers/regulator/axp20x-regulator.c
> @@ -244,6 +244,82 @@ static const struct regulator_desc axp22x_drivevbus_regulator = {
>  	.ops		= &axp20x_ops_sw,
>  };
>  
> +static const struct regulator_linear_range axp803_dcdc234_ranges[] = {
> +	REGULATOR_LINEAR_RANGE(500000, 0x0, 0x46, 10000),
> +	REGULATOR_LINEAR_RANGE(1220000, 0x47, 0x4b, 20000),
> +};
> +
> +static const struct regulator_linear_range axp803_dcdc5_ranges[] = {
> +	REGULATOR_LINEAR_RANGE(800000, 0x0, 0x20, 10000),
> +	REGULATOR_LINEAR_RANGE(1140000, 0x21, 0x44, 20000),
> +};
> +
> +static const struct regulator_linear_range axp803_dcdc6_ranges[] = {
> +	REGULATOR_LINEAR_RANGE(600000, 0x0, 0x32, 10000),
> +	REGULATOR_LINEAR_RANGE(1120000, 0x33, 0x47, 20000),
> +};
> +
> +/* AXP806's CLDO2 and AXP809's DLDO1 shares the same range */
> +static const struct regulator_linear_range axp803_dldo2_ranges[] = {
> +	REGULATOR_LINEAR_RANGE(700000, 0x0, 0x1a, 100000),
> +	REGULATOR_LINEAR_RANGE(3400000, 0x1b, 0x1f, 200000),
> +};
> +
> +static const struct regulator_desc axp803_regulators[] = {
> +	AXP_DESC(AXP803, DCDC1, "dcdc1", "vin1", 1600, 3400, 100,
> +		 AXP803_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(0)),
> +	AXP_DESC_RANGES(AXP803, DCDC2, "dcdc2", "vin2", axp803_dcdc234_ranges,
> +			76, AXP803_DCDC2_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
> +			BIT(1)),
> +	AXP_DESC_RANGES(AXP803, DCDC3, "dcdc3", "vin3", axp803_dcdc234_ranges,
> +			76, AXP803_DCDC3_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
> +			BIT(2)),
> +	AXP_DESC_RANGES(AXP803, DCDC4, "dcdc4", "vin4", axp803_dcdc234_ranges,
> +			76, AXP803_DCDC4_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
> +			BIT(3)),
> +	AXP_DESC_RANGES(AXP803, DCDC5, "dcdc5", "vin5", axp803_dcdc5_ranges,
> +			68, AXP803_DCDC5_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
> +			BIT(4)),
> +	AXP_DESC_RANGES(AXP803, DCDC6, "dcdc6", "vin6", axp803_dcdc6_ranges,
> +			72, AXP803_DCDC6_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
> +			BIT(5)),
> +	/* secondary switchable output of DCDC1 */
> +	AXP_DESC_SW(AXP803, DC1SW, "dc1sw", NULL, AXP22X_PWR_OUT_CTRL2,
> +		    BIT(7)),
> +	AXP_DESC(AXP803, ALDO1, "aldo1", "aldoin", 700, 3300, 100,
> +		 AXP22X_ALDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(5)),
> +	AXP_DESC(AXP803, ALDO2, "aldo2", "aldoin", 700, 3300, 100,
> +		 AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(6)),
> +	AXP_DESC(AXP803, ALDO3, "aldo3", "aldoin", 700, 3300, 100,
> +		 AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(7)),
> +	AXP_DESC(AXP803, DLDO1, "dldo1", "dldoin", 700, 3300, 100,
> +		 AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(3)),
> +	AXP_DESC_RANGES(AXP803, DLDO2, "dldo2", "dldoin", axp803_dldo2_ranges,
> +			32, AXP22X_DLDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2,
> +			BIT(4)),
> +	AXP_DESC(AXP803, DLDO3, "dldo3", "dldoin", 700, 3300, 100,
> +		 AXP22X_DLDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(5)),
> +	AXP_DESC(AXP803, DLDO4, "dldo4", "dldoin", 700, 3300, 100,
> +		 AXP22X_DLDO4_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(6)),
> +	AXP_DESC(AXP803, ELDO1, "eldo1", "eldoin", 700, 1900, 50,
> +		 AXP22X_ELDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(0)),
> +	AXP_DESC(AXP803, ELDO2, "eldo2", "eldoin", 700, 1900, 50,
> +		 AXP22X_ELDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(1)),
> +	AXP_DESC(AXP803, ELDO3, "eldo3", "eldoin", 700, 1900, 50,
> +		 AXP22X_ELDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(2)),
> +	AXP_DESC(AXP803, FLDO1, "fldo1", "fldoin", 700, 1450, 50,
> +		 AXP803_FLDO1_V_OUT, 0x0f, AXP22X_PWR_OUT_CTRL3, BIT(2)),
> +	AXP_DESC(AXP803, FLDO2, "fldo2", "fldoin", 700, 1450, 50,
> +		 AXP803_FLDO2_V_OUT, 0x0f, AXP22X_PWR_OUT_CTRL3, BIT(3)),
> +	AXP_DESC_IO(AXP803, LDO_IO0, "ldo_io0", "ips", 700, 3300, 100,
> +		    AXP22X_LDO_IO0_V_OUT, 0x1f, AXP20X_GPIO0_CTRL, 0x07,
> +		    AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
> +	AXP_DESC_IO(AXP803, LDO_IO1, "ldo_io1", "ips", 700, 3300, 100,
> +		    AXP22X_LDO_IO1_V_OUT, 0x1f, AXP20X_GPIO1_CTRL, 0x07,
> +		    AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
> +	AXP_DESC_FIXED(AXP803, RTC_LDO, "rtc_ldo", "ips", 3000),
> +};
> +
>  static const struct regulator_linear_range axp806_dcdca_ranges[] = {
>  	REGULATOR_LINEAR_RANGE(600000, 0x0, 0x32, 10000),
>  	REGULATOR_LINEAR_RANGE(1120000, 0x33, 0x47, 20000),
> @@ -254,11 +330,6 @@ static const struct regulator_linear_range axp806_dcdcd_ranges[] = {
>  	REGULATOR_LINEAR_RANGE(1600000, 0x2e, 0x3f, 100000),
>  };
>  
> -static const struct regulator_linear_range axp806_cldo2_ranges[] = {
> -	REGULATOR_LINEAR_RANGE(700000, 0x0, 0x1a, 100000),
> -	REGULATOR_LINEAR_RANGE(3400000, 0x1b, 0x1f, 200000),
> -};
> -
>  static const struct regulator_desc axp806_regulators[] = {
>  	AXP_DESC_RANGES(AXP806, DCDCA, "dcdca", "vina", axp806_dcdca_ranges,
>  			72, AXP806_DCDCA_V_CTRL, 0x7f, AXP806_PWR_OUT_CTRL1,
> @@ -289,7 +360,7 @@ static const struct regulator_desc axp806_regulators[] = {
>  		 AXP806_BLDO4_V_CTRL, 0x0f, AXP806_PWR_OUT_CTRL2, BIT(3)),
>  	AXP_DESC(AXP806, CLDO1, "cldo1", "cldoin", 700, 3300, 100,
>  		 AXP806_CLDO1_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL2, BIT(4)),
> -	AXP_DESC_RANGES(AXP806, CLDO2, "cldo2", "cldoin", axp806_cldo2_ranges,
> +	AXP_DESC_RANGES(AXP806, CLDO2, "cldo2", "cldoin", axp803_dldo2_ranges,
>  			32, AXP806_CLDO2_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL2,
>  			BIT(5)),
>  	AXP_DESC(AXP806, CLDO3, "cldo3", "cldoin", 700, 3300, 100,
> @@ -326,7 +397,7 @@ static const struct regulator_desc axp809_regulators[] = {
>  		 AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(7)),
>  	AXP_DESC(AXP809, ALDO3, "aldo3", "aldoin", 700, 3300, 100,
>  		 AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(5)),
> -	AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp806_cldo2_ranges,
> +	AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp803_dldo2_ranges,
>  			32, AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2,
>  			BIT(3)),
>  	AXP_DESC(AXP809, DLDO2, "dldo2", "dldoin", 700, 3300, 100,
> @@ -369,14 +440,21 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
>  		def = 1500;
>  		step = 75;
>  		break;
> -	case AXP806_ID:
> +	case AXP803_ID:
>  		/*
> -		 * AXP806 DCDC work frequency setting has the same range and
> +		 * AXP803 DCDC work frequency setting has the same range and
>  		 * step as AXP22X, but at a different register.
>  		 * Fall through to the check below.
>  		 * (See include/linux/mfd/axp20x.h)
>  		 */
> -		reg = AXP806_DCDC_FREQ_CTRL;
> +		reg = AXP803_DCDC_FREQ_CTRL;
> +	case AXP806_ID:
> +		/*
> +		 * AXP806 also have DCDC work frequency setting register at a
> +		 * different position.
> +		 */
> +		if (axp20x->variant == AXP806_ID)
> +			reg = AXP806_DCDC_FREQ_CTRL;
>  	case AXP221_ID:
>  	case AXP223_ID:
>  	case AXP809_ID:
> @@ -475,6 +553,14 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 work
>  		workmode <<= id - AXP22X_DCDC1;
>  		break;
>  
> +	case AXP803_ID:
> +		if (id < AXP803_DCDC1 || id > AXP803_DCDC6)
> +			return -EINVAL;
> +
> +		mask = AXP22X_WORKMODE_DCDCX_MASK(id - AXP803_DCDC1);
> +		workmode <<= id - AXP803_DCDC1;
> +		break;
> +
>  	default:
>  		/* should not happen */
>  		WARN_ON(1);
> @@ -492,20 +578,38 @@ static bool axp20x_is_polyphase_slave(struct axp20x_dev *axp20x, int id)
>  {
>  	u32 reg = 0;
>  
> -	/* Only AXP806 has poly-phase outputs */
> -	if (axp20x->variant != AXP806_ID)
> -		return false;
> +	/*
> +	 * Currently in our supported AXP variants, only AXP806 and AXP803
> +	 * have polyphase regulators.
> +	 */
> +	switch (axp20x->variant) {
> +	case AXP803_ID:
> +		regmap_read(axp20x->regmap, AXP803_POLYPHASE_CTRL, &reg);
> +
> +		switch (id) {
> +		case AXP803_DCDC3:
> +			return !!(reg & BIT(6));
> +		case AXP803_DCDC6:
> +			return !!(reg & BIT(7));
> +		}
> +		break;
>  
> -	regmap_read(axp20x->regmap, AXP806_DCDC_MODE_CTRL2, &reg);
> +	case AXP806_ID:
> +		regmap_read(axp20x->regmap, AXP806_DCDC_MODE_CTRL2, &reg);
> +
> +		switch (id) {
> +		case AXP806_DCDCB:
> +			return (((reg & GENMASK(7, 6)) == BIT(6)) ||
> +				((reg & GENMASK(7, 6)) == BIT(7)));
> +		case AXP806_DCDCC:
> +			return ((reg & GENMASK(7, 6)) == BIT(7));
> +		case AXP806_DCDCE:
> +			return !!(reg & BIT(5));
> +		}
> +		break;
>  
> -	switch (id) {
> -	case AXP806_DCDCB:
> -		return (((reg & GENMASK(7, 6)) == BIT(6)) ||
> -			((reg & GENMASK(7, 6)) == BIT(7)));
> -	case AXP806_DCDCC:
> -		return ((reg & GENMASK(7, 6)) == BIT(7));
> -	case AXP806_DCDCE:
> -		return !!(reg & BIT(5));
> +	default:
> +		return false;
>  	}
>  
>  	return false;
> @@ -540,6 +644,10 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
>  		drivevbus = of_property_read_bool(pdev->dev.parent->of_node,
>  						  "x-powers,drive-vbus-en");
>  		break;
> +	case AXP803_ID:
> +		regulators = axp803_regulators;
> +		nregulators = AXP803_REG_ID_MAX;
> +		break;
>  	case AXP806_ID:
>  		regulators = axp806_regulators;
>  		nregulators = AXP806_REG_ID_MAX;
> @@ -579,6 +687,7 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
>  		 * name.
>  		 */
>  		if ((regulators == axp22x_regulators && i == AXP22X_DC1SW) ||
> +		    (regulators == axp803_regulators && i == AXP803_DC1SW) ||
>  		    (regulators == axp809_regulators && i == AXP809_DC1SW)) {
>  			new_desc = devm_kzalloc(&pdev->dev, sizeof(*desc),
>  						GFP_KERNEL);
> diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
> index cde56cfe8446..965b027e31b3 100644
> --- a/include/linux/mfd/axp20x.h
> +++ b/include/linux/mfd/axp20x.h
> @@ -119,6 +119,17 @@ enum axp20x_variants {
>  #define AXP806_BUS_ADDR_EXT		0xfe
>  #define AXP806_REG_ADDR_EXT		0xff
>  
> +#define AXP803_POLYPHASE_CTRL		0x14
> +#define AXP803_FLDO1_V_OUT		0x1c
> +#define AXP803_FLDO2_V_OUT		0x1d
> +#define AXP803_DCDC1_V_OUT		0x20
> +#define AXP803_DCDC2_V_OUT		0x21
> +#define AXP803_DCDC3_V_OUT		0x22
> +#define AXP803_DCDC4_V_OUT		0x23
> +#define AXP803_DCDC5_V_OUT		0x24
> +#define AXP803_DCDC6_V_OUT		0x25
> +#define AXP803_DCDC_FREQ_CTRL		0x3b
> +
>  /* Interrupt */
>  #define AXP152_IRQ1_EN			0x40
>  #define AXP152_IRQ2_EN			0x41
> @@ -350,6 +361,32 @@ enum {
>  	AXP809_REG_ID_MAX,
>  };
>  
> +enum {
> +	AXP803_DCDC1 = 0,
> +	AXP803_DCDC2,
> +	AXP803_DCDC3,
> +	AXP803_DCDC4,
> +	AXP803_DCDC5,
> +	AXP803_DCDC6,
> +	AXP803_DC1SW,
> +	AXP803_ALDO1,
> +	AXP803_ALDO2,
> +	AXP803_ALDO3,
> +	AXP803_DLDO1,
> +	AXP803_DLDO2,
> +	AXP803_DLDO3,
> +	AXP803_DLDO4,
> +	AXP803_ELDO1,
> +	AXP803_ELDO2,
> +	AXP803_ELDO3,
> +	AXP803_FLDO1,
> +	AXP803_FLDO2,
> +	AXP803_RTC_LDO,
> +	AXP803_LDO_IO0,
> +	AXP803_LDO_IO1,
> +	AXP803_REG_ID_MAX,
> +};
> +
>  /* IRQs */
>  enum {
>  	AXP152_IRQ_LDO0IN_CONNECT = 1,

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH v2 07/11] regulator: axp20x-regulator: add support for AXP803
@ 2017-04-11 14:03     ` Lee Jones
  0 siblings, 0 replies; 71+ messages in thread
From: Lee Jones @ 2017-04-11 14:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, 08 Apr 2017, Icenowy Zheng wrote:

> AXP803 PMIC also have a series of regulators (DCDCs and LDOs)
> controllable via I2C/RSB bus.
> 
> Add support for them.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
> Changes in v2:
> - Place AXP803 codes before AXP806/809 ones.
> - Fixed some errors in regulator description.
> - Reuse AXP803 DLDO2 range for AXP806 CLDO2 & AXP809 DLDO1.
> 
>  drivers/regulator/axp20x-regulator.c | 153 ++++++++++++++++++++++++++++++-----
>  include/linux/mfd/axp20x.h           |  37 +++++++++
>  2 files changed, 168 insertions(+), 22 deletions(-)

For my own reference:
  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
  
> diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
> index 0b9d4e3e52c7..2ed15e4a7a82 100644
> --- a/drivers/regulator/axp20x-regulator.c
> +++ b/drivers/regulator/axp20x-regulator.c
> @@ -244,6 +244,82 @@ static const struct regulator_desc axp22x_drivevbus_regulator = {
>  	.ops		= &axp20x_ops_sw,
>  };
>  
> +static const struct regulator_linear_range axp803_dcdc234_ranges[] = {
> +	REGULATOR_LINEAR_RANGE(500000, 0x0, 0x46, 10000),
> +	REGULATOR_LINEAR_RANGE(1220000, 0x47, 0x4b, 20000),
> +};
> +
> +static const struct regulator_linear_range axp803_dcdc5_ranges[] = {
> +	REGULATOR_LINEAR_RANGE(800000, 0x0, 0x20, 10000),
> +	REGULATOR_LINEAR_RANGE(1140000, 0x21, 0x44, 20000),
> +};
> +
> +static const struct regulator_linear_range axp803_dcdc6_ranges[] = {
> +	REGULATOR_LINEAR_RANGE(600000, 0x0, 0x32, 10000),
> +	REGULATOR_LINEAR_RANGE(1120000, 0x33, 0x47, 20000),
> +};
> +
> +/* AXP806's CLDO2 and AXP809's DLDO1 shares the same range */
> +static const struct regulator_linear_range axp803_dldo2_ranges[] = {
> +	REGULATOR_LINEAR_RANGE(700000, 0x0, 0x1a, 100000),
> +	REGULATOR_LINEAR_RANGE(3400000, 0x1b, 0x1f, 200000),
> +};
> +
> +static const struct regulator_desc axp803_regulators[] = {
> +	AXP_DESC(AXP803, DCDC1, "dcdc1", "vin1", 1600, 3400, 100,
> +		 AXP803_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(0)),
> +	AXP_DESC_RANGES(AXP803, DCDC2, "dcdc2", "vin2", axp803_dcdc234_ranges,
> +			76, AXP803_DCDC2_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
> +			BIT(1)),
> +	AXP_DESC_RANGES(AXP803, DCDC3, "dcdc3", "vin3", axp803_dcdc234_ranges,
> +			76, AXP803_DCDC3_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
> +			BIT(2)),
> +	AXP_DESC_RANGES(AXP803, DCDC4, "dcdc4", "vin4", axp803_dcdc234_ranges,
> +			76, AXP803_DCDC4_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
> +			BIT(3)),
> +	AXP_DESC_RANGES(AXP803, DCDC5, "dcdc5", "vin5", axp803_dcdc5_ranges,
> +			68, AXP803_DCDC5_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
> +			BIT(4)),
> +	AXP_DESC_RANGES(AXP803, DCDC6, "dcdc6", "vin6", axp803_dcdc6_ranges,
> +			72, AXP803_DCDC6_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
> +			BIT(5)),
> +	/* secondary switchable output of DCDC1 */
> +	AXP_DESC_SW(AXP803, DC1SW, "dc1sw", NULL, AXP22X_PWR_OUT_CTRL2,
> +		    BIT(7)),
> +	AXP_DESC(AXP803, ALDO1, "aldo1", "aldoin", 700, 3300, 100,
> +		 AXP22X_ALDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(5)),
> +	AXP_DESC(AXP803, ALDO2, "aldo2", "aldoin", 700, 3300, 100,
> +		 AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(6)),
> +	AXP_DESC(AXP803, ALDO3, "aldo3", "aldoin", 700, 3300, 100,
> +		 AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(7)),
> +	AXP_DESC(AXP803, DLDO1, "dldo1", "dldoin", 700, 3300, 100,
> +		 AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(3)),
> +	AXP_DESC_RANGES(AXP803, DLDO2, "dldo2", "dldoin", axp803_dldo2_ranges,
> +			32, AXP22X_DLDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2,
> +			BIT(4)),
> +	AXP_DESC(AXP803, DLDO3, "dldo3", "dldoin", 700, 3300, 100,
> +		 AXP22X_DLDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(5)),
> +	AXP_DESC(AXP803, DLDO4, "dldo4", "dldoin", 700, 3300, 100,
> +		 AXP22X_DLDO4_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(6)),
> +	AXP_DESC(AXP803, ELDO1, "eldo1", "eldoin", 700, 1900, 50,
> +		 AXP22X_ELDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(0)),
> +	AXP_DESC(AXP803, ELDO2, "eldo2", "eldoin", 700, 1900, 50,
> +		 AXP22X_ELDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(1)),
> +	AXP_DESC(AXP803, ELDO3, "eldo3", "eldoin", 700, 1900, 50,
> +		 AXP22X_ELDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(2)),
> +	AXP_DESC(AXP803, FLDO1, "fldo1", "fldoin", 700, 1450, 50,
> +		 AXP803_FLDO1_V_OUT, 0x0f, AXP22X_PWR_OUT_CTRL3, BIT(2)),
> +	AXP_DESC(AXP803, FLDO2, "fldo2", "fldoin", 700, 1450, 50,
> +		 AXP803_FLDO2_V_OUT, 0x0f, AXP22X_PWR_OUT_CTRL3, BIT(3)),
> +	AXP_DESC_IO(AXP803, LDO_IO0, "ldo_io0", "ips", 700, 3300, 100,
> +		    AXP22X_LDO_IO0_V_OUT, 0x1f, AXP20X_GPIO0_CTRL, 0x07,
> +		    AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
> +	AXP_DESC_IO(AXP803, LDO_IO1, "ldo_io1", "ips", 700, 3300, 100,
> +		    AXP22X_LDO_IO1_V_OUT, 0x1f, AXP20X_GPIO1_CTRL, 0x07,
> +		    AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
> +	AXP_DESC_FIXED(AXP803, RTC_LDO, "rtc_ldo", "ips", 3000),
> +};
> +
>  static const struct regulator_linear_range axp806_dcdca_ranges[] = {
>  	REGULATOR_LINEAR_RANGE(600000, 0x0, 0x32, 10000),
>  	REGULATOR_LINEAR_RANGE(1120000, 0x33, 0x47, 20000),
> @@ -254,11 +330,6 @@ static const struct regulator_linear_range axp806_dcdcd_ranges[] = {
>  	REGULATOR_LINEAR_RANGE(1600000, 0x2e, 0x3f, 100000),
>  };
>  
> -static const struct regulator_linear_range axp806_cldo2_ranges[] = {
> -	REGULATOR_LINEAR_RANGE(700000, 0x0, 0x1a, 100000),
> -	REGULATOR_LINEAR_RANGE(3400000, 0x1b, 0x1f, 200000),
> -};
> -
>  static const struct regulator_desc axp806_regulators[] = {
>  	AXP_DESC_RANGES(AXP806, DCDCA, "dcdca", "vina", axp806_dcdca_ranges,
>  			72, AXP806_DCDCA_V_CTRL, 0x7f, AXP806_PWR_OUT_CTRL1,
> @@ -289,7 +360,7 @@ static const struct regulator_desc axp806_regulators[] = {
>  		 AXP806_BLDO4_V_CTRL, 0x0f, AXP806_PWR_OUT_CTRL2, BIT(3)),
>  	AXP_DESC(AXP806, CLDO1, "cldo1", "cldoin", 700, 3300, 100,
>  		 AXP806_CLDO1_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL2, BIT(4)),
> -	AXP_DESC_RANGES(AXP806, CLDO2, "cldo2", "cldoin", axp806_cldo2_ranges,
> +	AXP_DESC_RANGES(AXP806, CLDO2, "cldo2", "cldoin", axp803_dldo2_ranges,
>  			32, AXP806_CLDO2_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL2,
>  			BIT(5)),
>  	AXP_DESC(AXP806, CLDO3, "cldo3", "cldoin", 700, 3300, 100,
> @@ -326,7 +397,7 @@ static const struct regulator_desc axp809_regulators[] = {
>  		 AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(7)),
>  	AXP_DESC(AXP809, ALDO3, "aldo3", "aldoin", 700, 3300, 100,
>  		 AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(5)),
> -	AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp806_cldo2_ranges,
> +	AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp803_dldo2_ranges,
>  			32, AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2,
>  			BIT(3)),
>  	AXP_DESC(AXP809, DLDO2, "dldo2", "dldoin", 700, 3300, 100,
> @@ -369,14 +440,21 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
>  		def = 1500;
>  		step = 75;
>  		break;
> -	case AXP806_ID:
> +	case AXP803_ID:
>  		/*
> -		 * AXP806 DCDC work frequency setting has the same range and
> +		 * AXP803 DCDC work frequency setting has the same range and
>  		 * step as AXP22X, but at a different register.
>  		 * Fall through to the check below.
>  		 * (See include/linux/mfd/axp20x.h)
>  		 */
> -		reg = AXP806_DCDC_FREQ_CTRL;
> +		reg = AXP803_DCDC_FREQ_CTRL;
> +	case AXP806_ID:
> +		/*
> +		 * AXP806 also have DCDC work frequency setting register at a
> +		 * different position.
> +		 */
> +		if (axp20x->variant == AXP806_ID)
> +			reg = AXP806_DCDC_FREQ_CTRL;
>  	case AXP221_ID:
>  	case AXP223_ID:
>  	case AXP809_ID:
> @@ -475,6 +553,14 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 work
>  		workmode <<= id - AXP22X_DCDC1;
>  		break;
>  
> +	case AXP803_ID:
> +		if (id < AXP803_DCDC1 || id > AXP803_DCDC6)
> +			return -EINVAL;
> +
> +		mask = AXP22X_WORKMODE_DCDCX_MASK(id - AXP803_DCDC1);
> +		workmode <<= id - AXP803_DCDC1;
> +		break;
> +
>  	default:
>  		/* should not happen */
>  		WARN_ON(1);
> @@ -492,20 +578,38 @@ static bool axp20x_is_polyphase_slave(struct axp20x_dev *axp20x, int id)
>  {
>  	u32 reg = 0;
>  
> -	/* Only AXP806 has poly-phase outputs */
> -	if (axp20x->variant != AXP806_ID)
> -		return false;
> +	/*
> +	 * Currently in our supported AXP variants, only AXP806 and AXP803
> +	 * have polyphase regulators.
> +	 */
> +	switch (axp20x->variant) {
> +	case AXP803_ID:
> +		regmap_read(axp20x->regmap, AXP803_POLYPHASE_CTRL, &reg);
> +
> +		switch (id) {
> +		case AXP803_DCDC3:
> +			return !!(reg & BIT(6));
> +		case AXP803_DCDC6:
> +			return !!(reg & BIT(7));
> +		}
> +		break;
>  
> -	regmap_read(axp20x->regmap, AXP806_DCDC_MODE_CTRL2, &reg);
> +	case AXP806_ID:
> +		regmap_read(axp20x->regmap, AXP806_DCDC_MODE_CTRL2, &reg);
> +
> +		switch (id) {
> +		case AXP806_DCDCB:
> +			return (((reg & GENMASK(7, 6)) == BIT(6)) ||
> +				((reg & GENMASK(7, 6)) == BIT(7)));
> +		case AXP806_DCDCC:
> +			return ((reg & GENMASK(7, 6)) == BIT(7));
> +		case AXP806_DCDCE:
> +			return !!(reg & BIT(5));
> +		}
> +		break;
>  
> -	switch (id) {
> -	case AXP806_DCDCB:
> -		return (((reg & GENMASK(7, 6)) == BIT(6)) ||
> -			((reg & GENMASK(7, 6)) == BIT(7)));
> -	case AXP806_DCDCC:
> -		return ((reg & GENMASK(7, 6)) == BIT(7));
> -	case AXP806_DCDCE:
> -		return !!(reg & BIT(5));
> +	default:
> +		return false;
>  	}
>  
>  	return false;
> @@ -540,6 +644,10 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
>  		drivevbus = of_property_read_bool(pdev->dev.parent->of_node,
>  						  "x-powers,drive-vbus-en");
>  		break;
> +	case AXP803_ID:
> +		regulators = axp803_regulators;
> +		nregulators = AXP803_REG_ID_MAX;
> +		break;
>  	case AXP806_ID:
>  		regulators = axp806_regulators;
>  		nregulators = AXP806_REG_ID_MAX;
> @@ -579,6 +687,7 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
>  		 * name.
>  		 */
>  		if ((regulators == axp22x_regulators && i == AXP22X_DC1SW) ||
> +		    (regulators == axp803_regulators && i == AXP803_DC1SW) ||
>  		    (regulators == axp809_regulators && i == AXP809_DC1SW)) {
>  			new_desc = devm_kzalloc(&pdev->dev, sizeof(*desc),
>  						GFP_KERNEL);
> diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
> index cde56cfe8446..965b027e31b3 100644
> --- a/include/linux/mfd/axp20x.h
> +++ b/include/linux/mfd/axp20x.h
> @@ -119,6 +119,17 @@ enum axp20x_variants {
>  #define AXP806_BUS_ADDR_EXT		0xfe
>  #define AXP806_REG_ADDR_EXT		0xff
>  
> +#define AXP803_POLYPHASE_CTRL		0x14
> +#define AXP803_FLDO1_V_OUT		0x1c
> +#define AXP803_FLDO2_V_OUT		0x1d
> +#define AXP803_DCDC1_V_OUT		0x20
> +#define AXP803_DCDC2_V_OUT		0x21
> +#define AXP803_DCDC3_V_OUT		0x22
> +#define AXP803_DCDC4_V_OUT		0x23
> +#define AXP803_DCDC5_V_OUT		0x24
> +#define AXP803_DCDC6_V_OUT		0x25
> +#define AXP803_DCDC_FREQ_CTRL		0x3b
> +
>  /* Interrupt */
>  #define AXP152_IRQ1_EN			0x40
>  #define AXP152_IRQ2_EN			0x41
> @@ -350,6 +361,32 @@ enum {
>  	AXP809_REG_ID_MAX,
>  };
>  
> +enum {
> +	AXP803_DCDC1 = 0,
> +	AXP803_DCDC2,
> +	AXP803_DCDC3,
> +	AXP803_DCDC4,
> +	AXP803_DCDC5,
> +	AXP803_DCDC6,
> +	AXP803_DC1SW,
> +	AXP803_ALDO1,
> +	AXP803_ALDO2,
> +	AXP803_ALDO3,
> +	AXP803_DLDO1,
> +	AXP803_DLDO2,
> +	AXP803_DLDO3,
> +	AXP803_DLDO4,
> +	AXP803_ELDO1,
> +	AXP803_ELDO2,
> +	AXP803_ELDO3,
> +	AXP803_FLDO1,
> +	AXP803_FLDO2,
> +	AXP803_RTC_LDO,
> +	AXP803_LDO_IO0,
> +	AXP803_LDO_IO1,
> +	AXP803_REG_ID_MAX,
> +};
> +
>  /* IRQs */
>  enum {
>  	AXP152_IRQ_LDO0IN_CONNECT = 1,

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v2 06/11] dt-bindings: add AXP803's regulator info
@ 2017-04-11 14:03     ` Lee Jones
  0 siblings, 0 replies; 71+ messages in thread
From: Lee Jones @ 2017-04-11 14:03 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood,
	devicetree, linux-sunxi, linux-kernel, linux-arm-kernel

On Sat, 08 Apr 2017, Icenowy Zheng wrote:

> AXP803 have the most regulators in currently supported AXP PMICs.
> 
> Add info for the regulators in the dt-bindings document.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
> Changes in v2:
> - Place AXP803 regulators before AXP806/809 ones.
> 
>  Documentation/devicetree/bindings/mfd/axp20x.txt | 27 ++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)

For my own reference:
  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
  
> diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
> index 334fb19ce605..50e381cdbf44 100644
> --- a/Documentation/devicetree/bindings/mfd/axp20x.txt
> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
> @@ -90,6 +90,33 @@ LDO_IO1		: LDO		: ips-supply		: GPIO 1
>  RTC_LDO		: LDO		: ips-supply		: always on
>  DRIVEVBUS	: Enable output	: drivevbus-supply	: external regulator
>  
> +AXP803 regulators, type, and corresponding input supply names:
> +
> +Regulator	  Type		  Supply Name		  Notes
> +---------	  ----		  -----------		  -----
> +DCDC1		: DC-DC buck	: vin1-supply
> +DCDC2		: DC-DC buck	: vin2-supply		: poly-phase capable
> +DCDC3		: DC-DC	buck	: vin3-supply		: poly-phase capable
> +DCDC4		: DC-DC	buck	: vin4-supply
> +DCDC5		: DC-DC	buck	: vin5-supply		: poly-phase capable
> +DCDC6		: DC-DC	buck	: vin6-supply		: poly-phase capable
> +DC1SW		: On/Off Switch	:			: DCDC1 secondary output
> +ALDO1		: LDO		: aldoin-supply		: shared supply
> +ALDO2		: LDO		: aldoin-supply		: shared supply
> +ALDO3		: LDO		: aldoin-supply		: shared supply
> +DLDO1		: LDO		: dldoin-supply		: shared supply
> +DLDO2		: LDO		: dldoin-supply		: shared supply
> +DLDO3		: LDO		: dldoin-supply		: shared supply
> +DLDO4		: LDO		: dldoin-supply		: shared supply
> +ELDO1		: LDO		: eldoin-supply		: shared supply
> +ELDO2		: LDO		: eldoin-supply		: shared supply
> +ELDO3		: LDO		: eldoin-supply		: shared supply
> +FLDO1		: LDO		: fldoin-supply		: shared supply
> +FLDO2		: LDO		: fldoin-supply		: shared supply
> +LDO_IO0		: LDO		: ips-supply		: GPIO 0
> +LDO_IO1		: LDO		: ips-supply		: GPIO 1
> +RTC_LDO		: LDO		: ips-supply		: always on
> +
>  AXP806 regulators, type, and corresponding input supply names:
>  
>  Regulator	  Type		  Supply Name		  Notes

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v2 06/11] dt-bindings: add AXP803's regulator info
@ 2017-04-11 14:03     ` Lee Jones
  0 siblings, 0 replies; 71+ messages in thread
From: Lee Jones @ 2017-04-11 14:03 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Sat, 08 Apr 2017, Icenowy Zheng wrote:

> AXP803 have the most regulators in currently supported AXP PMICs.
> 
> Add info for the regulators in the dt-bindings document.
> 
> Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
> ---
> Changes in v2:
> - Place AXP803 regulators before AXP806/809 ones.
> 
>  Documentation/devicetree/bindings/mfd/axp20x.txt | 27 ++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)

For my own reference:
  Acked-for-MFD-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  
> diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
> index 334fb19ce605..50e381cdbf44 100644
> --- a/Documentation/devicetree/bindings/mfd/axp20x.txt
> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
> @@ -90,6 +90,33 @@ LDO_IO1		: LDO		: ips-supply		: GPIO 1
>  RTC_LDO		: LDO		: ips-supply		: always on
>  DRIVEVBUS	: Enable output	: drivevbus-supply	: external regulator
>  
> +AXP803 regulators, type, and corresponding input supply names:
> +
> +Regulator	  Type		  Supply Name		  Notes
> +---------	  ----		  -----------		  -----
> +DCDC1		: DC-DC buck	: vin1-supply
> +DCDC2		: DC-DC buck	: vin2-supply		: poly-phase capable
> +DCDC3		: DC-DC	buck	: vin3-supply		: poly-phase capable
> +DCDC4		: DC-DC	buck	: vin4-supply
> +DCDC5		: DC-DC	buck	: vin5-supply		: poly-phase capable
> +DCDC6		: DC-DC	buck	: vin6-supply		: poly-phase capable
> +DC1SW		: On/Off Switch	:			: DCDC1 secondary output
> +ALDO1		: LDO		: aldoin-supply		: shared supply
> +ALDO2		: LDO		: aldoin-supply		: shared supply
> +ALDO3		: LDO		: aldoin-supply		: shared supply
> +DLDO1		: LDO		: dldoin-supply		: shared supply
> +DLDO2		: LDO		: dldoin-supply		: shared supply
> +DLDO3		: LDO		: dldoin-supply		: shared supply
> +DLDO4		: LDO		: dldoin-supply		: shared supply
> +ELDO1		: LDO		: eldoin-supply		: shared supply
> +ELDO2		: LDO		: eldoin-supply		: shared supply
> +ELDO3		: LDO		: eldoin-supply		: shared supply
> +FLDO1		: LDO		: fldoin-supply		: shared supply
> +FLDO2		: LDO		: fldoin-supply		: shared supply
> +LDO_IO0		: LDO		: ips-supply		: GPIO 0
> +LDO_IO1		: LDO		: ips-supply		: GPIO 1
> +RTC_LDO		: LDO		: ips-supply		: always on
> +
>  AXP806 regulators, type, and corresponding input supply names:
>  
>  Regulator	  Type		  Supply Name		  Notes

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH v2 06/11] dt-bindings: add AXP803's regulator info
@ 2017-04-11 14:03     ` Lee Jones
  0 siblings, 0 replies; 71+ messages in thread
From: Lee Jones @ 2017-04-11 14:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, 08 Apr 2017, Icenowy Zheng wrote:

> AXP803 have the most regulators in currently supported AXP PMICs.
> 
> Add info for the regulators in the dt-bindings document.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
> Changes in v2:
> - Place AXP803 regulators before AXP806/809 ones.
> 
>  Documentation/devicetree/bindings/mfd/axp20x.txt | 27 ++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)

For my own reference:
  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
  
> diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
> index 334fb19ce605..50e381cdbf44 100644
> --- a/Documentation/devicetree/bindings/mfd/axp20x.txt
> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
> @@ -90,6 +90,33 @@ LDO_IO1		: LDO		: ips-supply		: GPIO 1
>  RTC_LDO		: LDO		: ips-supply		: always on
>  DRIVEVBUS	: Enable output	: drivevbus-supply	: external regulator
>  
> +AXP803 regulators, type, and corresponding input supply names:
> +
> +Regulator	  Type		  Supply Name		  Notes
> +---------	  ----		  -----------		  -----
> +DCDC1		: DC-DC buck	: vin1-supply
> +DCDC2		: DC-DC buck	: vin2-supply		: poly-phase capable
> +DCDC3		: DC-DC	buck	: vin3-supply		: poly-phase capable
> +DCDC4		: DC-DC	buck	: vin4-supply
> +DCDC5		: DC-DC	buck	: vin5-supply		: poly-phase capable
> +DCDC6		: DC-DC	buck	: vin6-supply		: poly-phase capable
> +DC1SW		: On/Off Switch	:			: DCDC1 secondary output
> +ALDO1		: LDO		: aldoin-supply		: shared supply
> +ALDO2		: LDO		: aldoin-supply		: shared supply
> +ALDO3		: LDO		: aldoin-supply		: shared supply
> +DLDO1		: LDO		: dldoin-supply		: shared supply
> +DLDO2		: LDO		: dldoin-supply		: shared supply
> +DLDO3		: LDO		: dldoin-supply		: shared supply
> +DLDO4		: LDO		: dldoin-supply		: shared supply
> +ELDO1		: LDO		: eldoin-supply		: shared supply
> +ELDO2		: LDO		: eldoin-supply		: shared supply
> +ELDO3		: LDO		: eldoin-supply		: shared supply
> +FLDO1		: LDO		: fldoin-supply		: shared supply
> +FLDO2		: LDO		: fldoin-supply		: shared supply
> +LDO_IO0		: LDO		: ips-supply		: GPIO 0
> +LDO_IO1		: LDO		: ips-supply		: GPIO 1
> +RTC_LDO		: LDO		: ips-supply		: always on
> +
>  AXP806 regulators, type, and corresponding input supply names:
>  
>  Regulator	  Type		  Supply Name		  Notes

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v2 04/11] mfd: axp20x: support AXP803 variant
@ 2017-04-11 14:04     ` Lee Jones
  0 siblings, 0 replies; 71+ messages in thread
From: Lee Jones @ 2017-04-11 14:04 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood,
	devicetree, linux-sunxi, linux-kernel, linux-arm-kernel

On Sat, 08 Apr 2017, Icenowy Zheng wrote:

> AXP803 is a new PMIC chip produced by X-Powers, usually paired with A64
> via RSB bus. The PMIC itself is like AXP288, but with RSB support and
> dedicated VBUS and ACIN.
> 
> Add support for it in the axp20x mfd driver.
> 
> Currently only power key function is supported.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
> Changes in v2:
> - Share regmap configs with AXP288.
> - Place AXP803 bits before AXP806/809.
> 
>  drivers/mfd/axp20x-rsb.c   |  1 +
>  drivers/mfd/axp20x.c       | 79 ++++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/mfd/axp20x.h | 40 ++++++++++++++++++++++-
>  3 files changed, 119 insertions(+), 1 deletion(-)

Applied, thanks.

> diff --git a/drivers/mfd/axp20x-rsb.c b/drivers/mfd/axp20x-rsb.c
> index a732cb50bcff..fd5c7267b136 100644
> --- a/drivers/mfd/axp20x-rsb.c
> +++ b/drivers/mfd/axp20x-rsb.c
> @@ -61,6 +61,7 @@ static int axp20x_rsb_remove(struct sunxi_rsb_device *rdev)
>  
>  static const struct of_device_id axp20x_rsb_of_match[] = {
>  	{ .compatible = "x-powers,axp223", .data = (void *)AXP223_ID },
> +	{ .compatible = "x-powers,axp803", .data = (void *)AXP803_ID },
>  	{ .compatible = "x-powers,axp806", .data = (void *)AXP806_ID },
>  	{ .compatible = "x-powers,axp809", .data = (void *)AXP809_ID },
>  	{ },
> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index 5ba3b04cc9b1..2268a6a9aa2c 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -41,6 +41,7 @@ static const char * const axp20x_model_names[] = {
>  	"AXP221",
>  	"AXP223",
>  	"AXP288",
> +	"AXP803",
>  	"AXP806",
>  	"AXP809",
>  };
> @@ -117,6 +118,7 @@ static const struct regmap_access_table axp22x_volatile_table = {
>  	.n_yes_ranges	= ARRAY_SIZE(axp22x_volatile_ranges),
>  };
>  
> +/* AXP288 ranges are shared with the AXP803, as they cover the same range */
>  static const struct regmap_range axp288_writeable_ranges[] = {
>  	regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ6_STATE),
>  	regmap_reg_range(AXP20X_DCDC_MODE, AXP288_FG_TUNE5),
> @@ -264,6 +266,20 @@ static struct resource axp288_fuel_gauge_resources[] = {
>  	},
>  };
>  
> +static struct resource axp803_pek_resources[] = {
> +	{
> +		.name   = "PEK_DBR",
> +		.start  = AXP803_IRQ_PEK_RIS_EDGE,
> +		.end    = AXP803_IRQ_PEK_RIS_EDGE,
> +		.flags  = IORESOURCE_IRQ,
> +	}, {
> +		.name   = "PEK_DBF",
> +		.start  = AXP803_IRQ_PEK_FAL_EDGE,
> +		.end    = AXP803_IRQ_PEK_FAL_EDGE,
> +		.flags  = IORESOURCE_IRQ,
> +	},
> +};
> +
>  static struct resource axp809_pek_resources[] = {
>  	{
>  		.name   = "PEK_DBR",
> @@ -457,6 +473,43 @@ static const struct regmap_irq axp288_regmap_irqs[] = {
>  	INIT_REGMAP_IRQ(AXP288, BC_USB_CHNG,            5, 1),
>  };
>  
> +static const struct regmap_irq axp803_regmap_irqs[] = {
> +	INIT_REGMAP_IRQ(AXP803, ACIN_OVER_V,		0, 7),
> +	INIT_REGMAP_IRQ(AXP803, ACIN_PLUGIN,		0, 6),
> +	INIT_REGMAP_IRQ(AXP803, ACIN_REMOVAL,	        0, 5),
> +	INIT_REGMAP_IRQ(AXP803, VBUS_OVER_V,		0, 4),
> +	INIT_REGMAP_IRQ(AXP803, VBUS_PLUGIN,		0, 3),
> +	INIT_REGMAP_IRQ(AXP803, VBUS_REMOVAL,	        0, 2),
> +	INIT_REGMAP_IRQ(AXP803, BATT_PLUGIN,		1, 7),
> +	INIT_REGMAP_IRQ(AXP803, BATT_REMOVAL,	        1, 6),
> +	INIT_REGMAP_IRQ(AXP803, BATT_ENT_ACT_MODE,	1, 5),
> +	INIT_REGMAP_IRQ(AXP803, BATT_EXIT_ACT_MODE,	1, 4),
> +	INIT_REGMAP_IRQ(AXP803, CHARG,		        1, 3),
> +	INIT_REGMAP_IRQ(AXP803, CHARG_DONE,		1, 2),
> +	INIT_REGMAP_IRQ(AXP803, BATT_CHG_TEMP_HIGH,	2, 7),
> +	INIT_REGMAP_IRQ(AXP803, BATT_CHG_TEMP_HIGH_END,	2, 6),
> +	INIT_REGMAP_IRQ(AXP803, BATT_CHG_TEMP_LOW,	2, 5),
> +	INIT_REGMAP_IRQ(AXP803, BATT_CHG_TEMP_LOW_END,	2, 4),
> +	INIT_REGMAP_IRQ(AXP803, BATT_ACT_TEMP_HIGH,	2, 3),
> +	INIT_REGMAP_IRQ(AXP803, BATT_ACT_TEMP_HIGH_END,	2, 2),
> +	INIT_REGMAP_IRQ(AXP803, BATT_ACT_TEMP_LOW,	2, 1),
> +	INIT_REGMAP_IRQ(AXP803, BATT_ACT_TEMP_LOW_END,	2, 0),
> +	INIT_REGMAP_IRQ(AXP803, DIE_TEMP_HIGH,	        3, 7),
> +	INIT_REGMAP_IRQ(AXP803, GPADC,		        3, 2),
> +	INIT_REGMAP_IRQ(AXP803, LOW_PWR_LVL1,	        3, 1),
> +	INIT_REGMAP_IRQ(AXP803, LOW_PWR_LVL2,	        3, 0),
> +	INIT_REGMAP_IRQ(AXP803, TIMER,		        4, 7),
> +	INIT_REGMAP_IRQ(AXP803, PEK_RIS_EDGE,	        4, 6),
> +	INIT_REGMAP_IRQ(AXP803, PEK_FAL_EDGE,	        4, 5),
> +	INIT_REGMAP_IRQ(AXP803, PEK_SHORT,		4, 4),
> +	INIT_REGMAP_IRQ(AXP803, PEK_LONG,		4, 3),
> +	INIT_REGMAP_IRQ(AXP803, PEK_OVER_OFF,		4, 2),
> +	INIT_REGMAP_IRQ(AXP803, GPIO1_INPUT,		4, 1),
> +	INIT_REGMAP_IRQ(AXP803, GPIO0_INPUT,		4, 0),
> +	INIT_REGMAP_IRQ(AXP803, BC_USB_CHNG,            5, 1),
> +	INIT_REGMAP_IRQ(AXP803, MV_CHNG,                5, 0),
> +};
> +
>  static const struct regmap_irq axp806_regmap_irqs[] = {
>  	INIT_REGMAP_IRQ(AXP806, DIE_TEMP_HIGH_LV1,	0, 0),
>  	INIT_REGMAP_IRQ(AXP806, DIE_TEMP_HIGH_LV2,	0, 1),
> @@ -557,6 +610,18 @@ static const struct regmap_irq_chip axp288_regmap_irq_chip = {
>  
>  };
>  
> +static const struct regmap_irq_chip axp803_regmap_irq_chip = {
> +	.name			= "axp803",
> +	.status_base		= AXP20X_IRQ1_STATE,
> +	.ack_base		= AXP20X_IRQ1_STATE,
> +	.mask_base		= AXP20X_IRQ1_EN,
> +	.mask_invert		= true,
> +	.init_ack_masked	= true,
> +	.irqs			= axp803_regmap_irqs,
> +	.num_irqs		= ARRAY_SIZE(axp803_regmap_irqs),
> +	.num_regs		= 6,
> +};
> +
>  static const struct regmap_irq_chip axp806_regmap_irq_chip = {
>  	.name			= "axp806",
>  	.status_base		= AXP20X_IRQ1_STATE,
> @@ -769,6 +834,14 @@ static struct mfd_cell axp288_cells[] = {
>  	},
>  };
>  
> +static struct mfd_cell axp803_cells[] = {
> +	{
> +		.name			= "axp20x-pek",
> +		.num_resources		= ARRAY_SIZE(axp803_pek_resources),
> +		.resources		= axp803_pek_resources,
> +	}
> +};
> +
>  static struct mfd_cell axp806_cells[] = {
>  	{
>  		.id			= 2,
> @@ -855,6 +928,12 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
>  		axp20x->regmap_irq_chip = &axp288_regmap_irq_chip;
>  		axp20x->irq_flags = IRQF_TRIGGER_LOW;
>  		break;
> +	case AXP803_ID:
> +		axp20x->nr_cells = ARRAY_SIZE(axp803_cells);
> +		axp20x->cells = axp803_cells;
> +		axp20x->regmap_cfg = &axp288_regmap_config;
> +		axp20x->regmap_irq_chip = &axp803_regmap_irq_chip;
> +		break;
>  	case AXP806_ID:
>  		axp20x->nr_cells = ARRAY_SIZE(axp806_cells);
>  		axp20x->cells = axp806_cells;
> diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
> index dc8798cf2a24..cde56cfe8446 100644
> --- a/include/linux/mfd/axp20x.h
> +++ b/include/linux/mfd/axp20x.h
> @@ -20,6 +20,7 @@ enum axp20x_variants {
>  	AXP221_ID,
>  	AXP223_ID,
>  	AXP288_ID,
> +	AXP803_ID,
>  	AXP806_ID,
>  	AXP809_ID,
>  	NR_AXP20X_VARIANTS,
> @@ -234,7 +235,7 @@ enum axp20x_variants {
>  #define AXP22X_TS_ADC_L			0x59
>  #define AXP22X_BATLOW_THRES1		0xe6
>  
> -/* AXP288 specific registers */
> +/* AXP288/AXP803 specific registers */
>  #define AXP288_POWER_REASON		0x02
>  #define AXP288_BC_GLOBAL		0x2c
>  #define AXP288_BC_VBUS_CNTL		0x2d
> @@ -475,6 +476,43 @@ enum axp288_irqs {
>  	AXP288_IRQ_BC_USB_CHNG,
>  };
>  
> +enum axp803_irqs {
> +	AXP803_IRQ_ACIN_OVER_V = 1,
> +	AXP803_IRQ_ACIN_PLUGIN,
> +	AXP803_IRQ_ACIN_REMOVAL,
> +	AXP803_IRQ_VBUS_OVER_V,
> +	AXP803_IRQ_VBUS_PLUGIN,
> +	AXP803_IRQ_VBUS_REMOVAL,
> +	AXP803_IRQ_BATT_PLUGIN,
> +	AXP803_IRQ_BATT_REMOVAL,
> +	AXP803_IRQ_BATT_ENT_ACT_MODE,
> +	AXP803_IRQ_BATT_EXIT_ACT_MODE,
> +	AXP803_IRQ_CHARG,
> +	AXP803_IRQ_CHARG_DONE,
> +	AXP803_IRQ_BATT_CHG_TEMP_HIGH,
> +	AXP803_IRQ_BATT_CHG_TEMP_HIGH_END,
> +	AXP803_IRQ_BATT_CHG_TEMP_LOW,
> +	AXP803_IRQ_BATT_CHG_TEMP_LOW_END,
> +	AXP803_IRQ_BATT_ACT_TEMP_HIGH,
> +	AXP803_IRQ_BATT_ACT_TEMP_HIGH_END,
> +	AXP803_IRQ_BATT_ACT_TEMP_LOW,
> +	AXP803_IRQ_BATT_ACT_TEMP_LOW_END,
> +	AXP803_IRQ_DIE_TEMP_HIGH,
> +	AXP803_IRQ_GPADC,
> +	AXP803_IRQ_LOW_PWR_LVL1,
> +	AXP803_IRQ_LOW_PWR_LVL2,
> +	AXP803_IRQ_TIMER,
> +	AXP803_IRQ_PEK_RIS_EDGE,
> +	AXP803_IRQ_PEK_FAL_EDGE,
> +	AXP803_IRQ_PEK_SHORT,
> +	AXP803_IRQ_PEK_LONG,
> +	AXP803_IRQ_PEK_OVER_OFF,
> +	AXP803_IRQ_GPIO1_INPUT,
> +	AXP803_IRQ_GPIO0_INPUT,
> +	AXP803_IRQ_BC_USB_CHNG,
> +	AXP803_IRQ_MV_CHNG,
> +};
> +
>  enum axp806_irqs {
>  	AXP806_IRQ_DIE_TEMP_HIGH_LV1,
>  	AXP806_IRQ_DIE_TEMP_HIGH_LV2,

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v2 04/11] mfd: axp20x: support AXP803 variant
@ 2017-04-11 14:04     ` Lee Jones
  0 siblings, 0 replies; 71+ messages in thread
From: Lee Jones @ 2017-04-11 14:04 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Sat, 08 Apr 2017, Icenowy Zheng wrote:

> AXP803 is a new PMIC chip produced by X-Powers, usually paired with A64
> via RSB bus. The PMIC itself is like AXP288, but with RSB support and
> dedicated VBUS and ACIN.
> 
> Add support for it in the axp20x mfd driver.
> 
> Currently only power key function is supported.
> 
> Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
> ---
> Changes in v2:
> - Share regmap configs with AXP288.
> - Place AXP803 bits before AXP806/809.
> 
>  drivers/mfd/axp20x-rsb.c   |  1 +
>  drivers/mfd/axp20x.c       | 79 ++++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/mfd/axp20x.h | 40 ++++++++++++++++++++++-
>  3 files changed, 119 insertions(+), 1 deletion(-)

Applied, thanks.

> diff --git a/drivers/mfd/axp20x-rsb.c b/drivers/mfd/axp20x-rsb.c
> index a732cb50bcff..fd5c7267b136 100644
> --- a/drivers/mfd/axp20x-rsb.c
> +++ b/drivers/mfd/axp20x-rsb.c
> @@ -61,6 +61,7 @@ static int axp20x_rsb_remove(struct sunxi_rsb_device *rdev)
>  
>  static const struct of_device_id axp20x_rsb_of_match[] = {
>  	{ .compatible = "x-powers,axp223", .data = (void *)AXP223_ID },
> +	{ .compatible = "x-powers,axp803", .data = (void *)AXP803_ID },
>  	{ .compatible = "x-powers,axp806", .data = (void *)AXP806_ID },
>  	{ .compatible = "x-powers,axp809", .data = (void *)AXP809_ID },
>  	{ },
> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index 5ba3b04cc9b1..2268a6a9aa2c 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -41,6 +41,7 @@ static const char * const axp20x_model_names[] = {
>  	"AXP221",
>  	"AXP223",
>  	"AXP288",
> +	"AXP803",
>  	"AXP806",
>  	"AXP809",
>  };
> @@ -117,6 +118,7 @@ static const struct regmap_access_table axp22x_volatile_table = {
>  	.n_yes_ranges	= ARRAY_SIZE(axp22x_volatile_ranges),
>  };
>  
> +/* AXP288 ranges are shared with the AXP803, as they cover the same range */
>  static const struct regmap_range axp288_writeable_ranges[] = {
>  	regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ6_STATE),
>  	regmap_reg_range(AXP20X_DCDC_MODE, AXP288_FG_TUNE5),
> @@ -264,6 +266,20 @@ static struct resource axp288_fuel_gauge_resources[] = {
>  	},
>  };
>  
> +static struct resource axp803_pek_resources[] = {
> +	{
> +		.name   = "PEK_DBR",
> +		.start  = AXP803_IRQ_PEK_RIS_EDGE,
> +		.end    = AXP803_IRQ_PEK_RIS_EDGE,
> +		.flags  = IORESOURCE_IRQ,
> +	}, {
> +		.name   = "PEK_DBF",
> +		.start  = AXP803_IRQ_PEK_FAL_EDGE,
> +		.end    = AXP803_IRQ_PEK_FAL_EDGE,
> +		.flags  = IORESOURCE_IRQ,
> +	},
> +};
> +
>  static struct resource axp809_pek_resources[] = {
>  	{
>  		.name   = "PEK_DBR",
> @@ -457,6 +473,43 @@ static const struct regmap_irq axp288_regmap_irqs[] = {
>  	INIT_REGMAP_IRQ(AXP288, BC_USB_CHNG,            5, 1),
>  };
>  
> +static const struct regmap_irq axp803_regmap_irqs[] = {
> +	INIT_REGMAP_IRQ(AXP803, ACIN_OVER_V,		0, 7),
> +	INIT_REGMAP_IRQ(AXP803, ACIN_PLUGIN,		0, 6),
> +	INIT_REGMAP_IRQ(AXP803, ACIN_REMOVAL,	        0, 5),
> +	INIT_REGMAP_IRQ(AXP803, VBUS_OVER_V,		0, 4),
> +	INIT_REGMAP_IRQ(AXP803, VBUS_PLUGIN,		0, 3),
> +	INIT_REGMAP_IRQ(AXP803, VBUS_REMOVAL,	        0, 2),
> +	INIT_REGMAP_IRQ(AXP803, BATT_PLUGIN,		1, 7),
> +	INIT_REGMAP_IRQ(AXP803, BATT_REMOVAL,	        1, 6),
> +	INIT_REGMAP_IRQ(AXP803, BATT_ENT_ACT_MODE,	1, 5),
> +	INIT_REGMAP_IRQ(AXP803, BATT_EXIT_ACT_MODE,	1, 4),
> +	INIT_REGMAP_IRQ(AXP803, CHARG,		        1, 3),
> +	INIT_REGMAP_IRQ(AXP803, CHARG_DONE,		1, 2),
> +	INIT_REGMAP_IRQ(AXP803, BATT_CHG_TEMP_HIGH,	2, 7),
> +	INIT_REGMAP_IRQ(AXP803, BATT_CHG_TEMP_HIGH_END,	2, 6),
> +	INIT_REGMAP_IRQ(AXP803, BATT_CHG_TEMP_LOW,	2, 5),
> +	INIT_REGMAP_IRQ(AXP803, BATT_CHG_TEMP_LOW_END,	2, 4),
> +	INIT_REGMAP_IRQ(AXP803, BATT_ACT_TEMP_HIGH,	2, 3),
> +	INIT_REGMAP_IRQ(AXP803, BATT_ACT_TEMP_HIGH_END,	2, 2),
> +	INIT_REGMAP_IRQ(AXP803, BATT_ACT_TEMP_LOW,	2, 1),
> +	INIT_REGMAP_IRQ(AXP803, BATT_ACT_TEMP_LOW_END,	2, 0),
> +	INIT_REGMAP_IRQ(AXP803, DIE_TEMP_HIGH,	        3, 7),
> +	INIT_REGMAP_IRQ(AXP803, GPADC,		        3, 2),
> +	INIT_REGMAP_IRQ(AXP803, LOW_PWR_LVL1,	        3, 1),
> +	INIT_REGMAP_IRQ(AXP803, LOW_PWR_LVL2,	        3, 0),
> +	INIT_REGMAP_IRQ(AXP803, TIMER,		        4, 7),
> +	INIT_REGMAP_IRQ(AXP803, PEK_RIS_EDGE,	        4, 6),
> +	INIT_REGMAP_IRQ(AXP803, PEK_FAL_EDGE,	        4, 5),
> +	INIT_REGMAP_IRQ(AXP803, PEK_SHORT,		4, 4),
> +	INIT_REGMAP_IRQ(AXP803, PEK_LONG,		4, 3),
> +	INIT_REGMAP_IRQ(AXP803, PEK_OVER_OFF,		4, 2),
> +	INIT_REGMAP_IRQ(AXP803, GPIO1_INPUT,		4, 1),
> +	INIT_REGMAP_IRQ(AXP803, GPIO0_INPUT,		4, 0),
> +	INIT_REGMAP_IRQ(AXP803, BC_USB_CHNG,            5, 1),
> +	INIT_REGMAP_IRQ(AXP803, MV_CHNG,                5, 0),
> +};
> +
>  static const struct regmap_irq axp806_regmap_irqs[] = {
>  	INIT_REGMAP_IRQ(AXP806, DIE_TEMP_HIGH_LV1,	0, 0),
>  	INIT_REGMAP_IRQ(AXP806, DIE_TEMP_HIGH_LV2,	0, 1),
> @@ -557,6 +610,18 @@ static const struct regmap_irq_chip axp288_regmap_irq_chip = {
>  
>  };
>  
> +static const struct regmap_irq_chip axp803_regmap_irq_chip = {
> +	.name			= "axp803",
> +	.status_base		= AXP20X_IRQ1_STATE,
> +	.ack_base		= AXP20X_IRQ1_STATE,
> +	.mask_base		= AXP20X_IRQ1_EN,
> +	.mask_invert		= true,
> +	.init_ack_masked	= true,
> +	.irqs			= axp803_regmap_irqs,
> +	.num_irqs		= ARRAY_SIZE(axp803_regmap_irqs),
> +	.num_regs		= 6,
> +};
> +
>  static const struct regmap_irq_chip axp806_regmap_irq_chip = {
>  	.name			= "axp806",
>  	.status_base		= AXP20X_IRQ1_STATE,
> @@ -769,6 +834,14 @@ static struct mfd_cell axp288_cells[] = {
>  	},
>  };
>  
> +static struct mfd_cell axp803_cells[] = {
> +	{
> +		.name			= "axp20x-pek",
> +		.num_resources		= ARRAY_SIZE(axp803_pek_resources),
> +		.resources		= axp803_pek_resources,
> +	}
> +};
> +
>  static struct mfd_cell axp806_cells[] = {
>  	{
>  		.id			= 2,
> @@ -855,6 +928,12 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
>  		axp20x->regmap_irq_chip = &axp288_regmap_irq_chip;
>  		axp20x->irq_flags = IRQF_TRIGGER_LOW;
>  		break;
> +	case AXP803_ID:
> +		axp20x->nr_cells = ARRAY_SIZE(axp803_cells);
> +		axp20x->cells = axp803_cells;
> +		axp20x->regmap_cfg = &axp288_regmap_config;
> +		axp20x->regmap_irq_chip = &axp803_regmap_irq_chip;
> +		break;
>  	case AXP806_ID:
>  		axp20x->nr_cells = ARRAY_SIZE(axp806_cells);
>  		axp20x->cells = axp806_cells;
> diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
> index dc8798cf2a24..cde56cfe8446 100644
> --- a/include/linux/mfd/axp20x.h
> +++ b/include/linux/mfd/axp20x.h
> @@ -20,6 +20,7 @@ enum axp20x_variants {
>  	AXP221_ID,
>  	AXP223_ID,
>  	AXP288_ID,
> +	AXP803_ID,
>  	AXP806_ID,
>  	AXP809_ID,
>  	NR_AXP20X_VARIANTS,
> @@ -234,7 +235,7 @@ enum axp20x_variants {
>  #define AXP22X_TS_ADC_L			0x59
>  #define AXP22X_BATLOW_THRES1		0xe6
>  
> -/* AXP288 specific registers */
> +/* AXP288/AXP803 specific registers */
>  #define AXP288_POWER_REASON		0x02
>  #define AXP288_BC_GLOBAL		0x2c
>  #define AXP288_BC_VBUS_CNTL		0x2d
> @@ -475,6 +476,43 @@ enum axp288_irqs {
>  	AXP288_IRQ_BC_USB_CHNG,
>  };
>  
> +enum axp803_irqs {
> +	AXP803_IRQ_ACIN_OVER_V = 1,
> +	AXP803_IRQ_ACIN_PLUGIN,
> +	AXP803_IRQ_ACIN_REMOVAL,
> +	AXP803_IRQ_VBUS_OVER_V,
> +	AXP803_IRQ_VBUS_PLUGIN,
> +	AXP803_IRQ_VBUS_REMOVAL,
> +	AXP803_IRQ_BATT_PLUGIN,
> +	AXP803_IRQ_BATT_REMOVAL,
> +	AXP803_IRQ_BATT_ENT_ACT_MODE,
> +	AXP803_IRQ_BATT_EXIT_ACT_MODE,
> +	AXP803_IRQ_CHARG,
> +	AXP803_IRQ_CHARG_DONE,
> +	AXP803_IRQ_BATT_CHG_TEMP_HIGH,
> +	AXP803_IRQ_BATT_CHG_TEMP_HIGH_END,
> +	AXP803_IRQ_BATT_CHG_TEMP_LOW,
> +	AXP803_IRQ_BATT_CHG_TEMP_LOW_END,
> +	AXP803_IRQ_BATT_ACT_TEMP_HIGH,
> +	AXP803_IRQ_BATT_ACT_TEMP_HIGH_END,
> +	AXP803_IRQ_BATT_ACT_TEMP_LOW,
> +	AXP803_IRQ_BATT_ACT_TEMP_LOW_END,
> +	AXP803_IRQ_DIE_TEMP_HIGH,
> +	AXP803_IRQ_GPADC,
> +	AXP803_IRQ_LOW_PWR_LVL1,
> +	AXP803_IRQ_LOW_PWR_LVL2,
> +	AXP803_IRQ_TIMER,
> +	AXP803_IRQ_PEK_RIS_EDGE,
> +	AXP803_IRQ_PEK_FAL_EDGE,
> +	AXP803_IRQ_PEK_SHORT,
> +	AXP803_IRQ_PEK_LONG,
> +	AXP803_IRQ_PEK_OVER_OFF,
> +	AXP803_IRQ_GPIO1_INPUT,
> +	AXP803_IRQ_GPIO0_INPUT,
> +	AXP803_IRQ_BC_USB_CHNG,
> +	AXP803_IRQ_MV_CHNG,
> +};
> +
>  enum axp806_irqs {
>  	AXP806_IRQ_DIE_TEMP_HIGH_LV1,
>  	AXP806_IRQ_DIE_TEMP_HIGH_LV2,

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH v2 04/11] mfd: axp20x: support AXP803 variant
@ 2017-04-11 14:04     ` Lee Jones
  0 siblings, 0 replies; 71+ messages in thread
From: Lee Jones @ 2017-04-11 14:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, 08 Apr 2017, Icenowy Zheng wrote:

> AXP803 is a new PMIC chip produced by X-Powers, usually paired with A64
> via RSB bus. The PMIC itself is like AXP288, but with RSB support and
> dedicated VBUS and ACIN.
> 
> Add support for it in the axp20x mfd driver.
> 
> Currently only power key function is supported.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
> Changes in v2:
> - Share regmap configs with AXP288.
> - Place AXP803 bits before AXP806/809.
> 
>  drivers/mfd/axp20x-rsb.c   |  1 +
>  drivers/mfd/axp20x.c       | 79 ++++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/mfd/axp20x.h | 40 ++++++++++++++++++++++-
>  3 files changed, 119 insertions(+), 1 deletion(-)

Applied, thanks.

> diff --git a/drivers/mfd/axp20x-rsb.c b/drivers/mfd/axp20x-rsb.c
> index a732cb50bcff..fd5c7267b136 100644
> --- a/drivers/mfd/axp20x-rsb.c
> +++ b/drivers/mfd/axp20x-rsb.c
> @@ -61,6 +61,7 @@ static int axp20x_rsb_remove(struct sunxi_rsb_device *rdev)
>  
>  static const struct of_device_id axp20x_rsb_of_match[] = {
>  	{ .compatible = "x-powers,axp223", .data = (void *)AXP223_ID },
> +	{ .compatible = "x-powers,axp803", .data = (void *)AXP803_ID },
>  	{ .compatible = "x-powers,axp806", .data = (void *)AXP806_ID },
>  	{ .compatible = "x-powers,axp809", .data = (void *)AXP809_ID },
>  	{ },
> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index 5ba3b04cc9b1..2268a6a9aa2c 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -41,6 +41,7 @@ static const char * const axp20x_model_names[] = {
>  	"AXP221",
>  	"AXP223",
>  	"AXP288",
> +	"AXP803",
>  	"AXP806",
>  	"AXP809",
>  };
> @@ -117,6 +118,7 @@ static const struct regmap_access_table axp22x_volatile_table = {
>  	.n_yes_ranges	= ARRAY_SIZE(axp22x_volatile_ranges),
>  };
>  
> +/* AXP288 ranges are shared with the AXP803, as they cover the same range */
>  static const struct regmap_range axp288_writeable_ranges[] = {
>  	regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ6_STATE),
>  	regmap_reg_range(AXP20X_DCDC_MODE, AXP288_FG_TUNE5),
> @@ -264,6 +266,20 @@ static struct resource axp288_fuel_gauge_resources[] = {
>  	},
>  };
>  
> +static struct resource axp803_pek_resources[] = {
> +	{
> +		.name   = "PEK_DBR",
> +		.start  = AXP803_IRQ_PEK_RIS_EDGE,
> +		.end    = AXP803_IRQ_PEK_RIS_EDGE,
> +		.flags  = IORESOURCE_IRQ,
> +	}, {
> +		.name   = "PEK_DBF",
> +		.start  = AXP803_IRQ_PEK_FAL_EDGE,
> +		.end    = AXP803_IRQ_PEK_FAL_EDGE,
> +		.flags  = IORESOURCE_IRQ,
> +	},
> +};
> +
>  static struct resource axp809_pek_resources[] = {
>  	{
>  		.name   = "PEK_DBR",
> @@ -457,6 +473,43 @@ static const struct regmap_irq axp288_regmap_irqs[] = {
>  	INIT_REGMAP_IRQ(AXP288, BC_USB_CHNG,            5, 1),
>  };
>  
> +static const struct regmap_irq axp803_regmap_irqs[] = {
> +	INIT_REGMAP_IRQ(AXP803, ACIN_OVER_V,		0, 7),
> +	INIT_REGMAP_IRQ(AXP803, ACIN_PLUGIN,		0, 6),
> +	INIT_REGMAP_IRQ(AXP803, ACIN_REMOVAL,	        0, 5),
> +	INIT_REGMAP_IRQ(AXP803, VBUS_OVER_V,		0, 4),
> +	INIT_REGMAP_IRQ(AXP803, VBUS_PLUGIN,		0, 3),
> +	INIT_REGMAP_IRQ(AXP803, VBUS_REMOVAL,	        0, 2),
> +	INIT_REGMAP_IRQ(AXP803, BATT_PLUGIN,		1, 7),
> +	INIT_REGMAP_IRQ(AXP803, BATT_REMOVAL,	        1, 6),
> +	INIT_REGMAP_IRQ(AXP803, BATT_ENT_ACT_MODE,	1, 5),
> +	INIT_REGMAP_IRQ(AXP803, BATT_EXIT_ACT_MODE,	1, 4),
> +	INIT_REGMAP_IRQ(AXP803, CHARG,		        1, 3),
> +	INIT_REGMAP_IRQ(AXP803, CHARG_DONE,		1, 2),
> +	INIT_REGMAP_IRQ(AXP803, BATT_CHG_TEMP_HIGH,	2, 7),
> +	INIT_REGMAP_IRQ(AXP803, BATT_CHG_TEMP_HIGH_END,	2, 6),
> +	INIT_REGMAP_IRQ(AXP803, BATT_CHG_TEMP_LOW,	2, 5),
> +	INIT_REGMAP_IRQ(AXP803, BATT_CHG_TEMP_LOW_END,	2, 4),
> +	INIT_REGMAP_IRQ(AXP803, BATT_ACT_TEMP_HIGH,	2, 3),
> +	INIT_REGMAP_IRQ(AXP803, BATT_ACT_TEMP_HIGH_END,	2, 2),
> +	INIT_REGMAP_IRQ(AXP803, BATT_ACT_TEMP_LOW,	2, 1),
> +	INIT_REGMAP_IRQ(AXP803, BATT_ACT_TEMP_LOW_END,	2, 0),
> +	INIT_REGMAP_IRQ(AXP803, DIE_TEMP_HIGH,	        3, 7),
> +	INIT_REGMAP_IRQ(AXP803, GPADC,		        3, 2),
> +	INIT_REGMAP_IRQ(AXP803, LOW_PWR_LVL1,	        3, 1),
> +	INIT_REGMAP_IRQ(AXP803, LOW_PWR_LVL2,	        3, 0),
> +	INIT_REGMAP_IRQ(AXP803, TIMER,		        4, 7),
> +	INIT_REGMAP_IRQ(AXP803, PEK_RIS_EDGE,	        4, 6),
> +	INIT_REGMAP_IRQ(AXP803, PEK_FAL_EDGE,	        4, 5),
> +	INIT_REGMAP_IRQ(AXP803, PEK_SHORT,		4, 4),
> +	INIT_REGMAP_IRQ(AXP803, PEK_LONG,		4, 3),
> +	INIT_REGMAP_IRQ(AXP803, PEK_OVER_OFF,		4, 2),
> +	INIT_REGMAP_IRQ(AXP803, GPIO1_INPUT,		4, 1),
> +	INIT_REGMAP_IRQ(AXP803, GPIO0_INPUT,		4, 0),
> +	INIT_REGMAP_IRQ(AXP803, BC_USB_CHNG,            5, 1),
> +	INIT_REGMAP_IRQ(AXP803, MV_CHNG,                5, 0),
> +};
> +
>  static const struct regmap_irq axp806_regmap_irqs[] = {
>  	INIT_REGMAP_IRQ(AXP806, DIE_TEMP_HIGH_LV1,	0, 0),
>  	INIT_REGMAP_IRQ(AXP806, DIE_TEMP_HIGH_LV2,	0, 1),
> @@ -557,6 +610,18 @@ static const struct regmap_irq_chip axp288_regmap_irq_chip = {
>  
>  };
>  
> +static const struct regmap_irq_chip axp803_regmap_irq_chip = {
> +	.name			= "axp803",
> +	.status_base		= AXP20X_IRQ1_STATE,
> +	.ack_base		= AXP20X_IRQ1_STATE,
> +	.mask_base		= AXP20X_IRQ1_EN,
> +	.mask_invert		= true,
> +	.init_ack_masked	= true,
> +	.irqs			= axp803_regmap_irqs,
> +	.num_irqs		= ARRAY_SIZE(axp803_regmap_irqs),
> +	.num_regs		= 6,
> +};
> +
>  static const struct regmap_irq_chip axp806_regmap_irq_chip = {
>  	.name			= "axp806",
>  	.status_base		= AXP20X_IRQ1_STATE,
> @@ -769,6 +834,14 @@ static struct mfd_cell axp288_cells[] = {
>  	},
>  };
>  
> +static struct mfd_cell axp803_cells[] = {
> +	{
> +		.name			= "axp20x-pek",
> +		.num_resources		= ARRAY_SIZE(axp803_pek_resources),
> +		.resources		= axp803_pek_resources,
> +	}
> +};
> +
>  static struct mfd_cell axp806_cells[] = {
>  	{
>  		.id			= 2,
> @@ -855,6 +928,12 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
>  		axp20x->regmap_irq_chip = &axp288_regmap_irq_chip;
>  		axp20x->irq_flags = IRQF_TRIGGER_LOW;
>  		break;
> +	case AXP803_ID:
> +		axp20x->nr_cells = ARRAY_SIZE(axp803_cells);
> +		axp20x->cells = axp803_cells;
> +		axp20x->regmap_cfg = &axp288_regmap_config;
> +		axp20x->regmap_irq_chip = &axp803_regmap_irq_chip;
> +		break;
>  	case AXP806_ID:
>  		axp20x->nr_cells = ARRAY_SIZE(axp806_cells);
>  		axp20x->cells = axp806_cells;
> diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
> index dc8798cf2a24..cde56cfe8446 100644
> --- a/include/linux/mfd/axp20x.h
> +++ b/include/linux/mfd/axp20x.h
> @@ -20,6 +20,7 @@ enum axp20x_variants {
>  	AXP221_ID,
>  	AXP223_ID,
>  	AXP288_ID,
> +	AXP803_ID,
>  	AXP806_ID,
>  	AXP809_ID,
>  	NR_AXP20X_VARIANTS,
> @@ -234,7 +235,7 @@ enum axp20x_variants {
>  #define AXP22X_TS_ADC_L			0x59
>  #define AXP22X_BATLOW_THRES1		0xe6
>  
> -/* AXP288 specific registers */
> +/* AXP288/AXP803 specific registers */
>  #define AXP288_POWER_REASON		0x02
>  #define AXP288_BC_GLOBAL		0x2c
>  #define AXP288_BC_VBUS_CNTL		0x2d
> @@ -475,6 +476,43 @@ enum axp288_irqs {
>  	AXP288_IRQ_BC_USB_CHNG,
>  };
>  
> +enum axp803_irqs {
> +	AXP803_IRQ_ACIN_OVER_V = 1,
> +	AXP803_IRQ_ACIN_PLUGIN,
> +	AXP803_IRQ_ACIN_REMOVAL,
> +	AXP803_IRQ_VBUS_OVER_V,
> +	AXP803_IRQ_VBUS_PLUGIN,
> +	AXP803_IRQ_VBUS_REMOVAL,
> +	AXP803_IRQ_BATT_PLUGIN,
> +	AXP803_IRQ_BATT_REMOVAL,
> +	AXP803_IRQ_BATT_ENT_ACT_MODE,
> +	AXP803_IRQ_BATT_EXIT_ACT_MODE,
> +	AXP803_IRQ_CHARG,
> +	AXP803_IRQ_CHARG_DONE,
> +	AXP803_IRQ_BATT_CHG_TEMP_HIGH,
> +	AXP803_IRQ_BATT_CHG_TEMP_HIGH_END,
> +	AXP803_IRQ_BATT_CHG_TEMP_LOW,
> +	AXP803_IRQ_BATT_CHG_TEMP_LOW_END,
> +	AXP803_IRQ_BATT_ACT_TEMP_HIGH,
> +	AXP803_IRQ_BATT_ACT_TEMP_HIGH_END,
> +	AXP803_IRQ_BATT_ACT_TEMP_LOW,
> +	AXP803_IRQ_BATT_ACT_TEMP_LOW_END,
> +	AXP803_IRQ_DIE_TEMP_HIGH,
> +	AXP803_IRQ_GPADC,
> +	AXP803_IRQ_LOW_PWR_LVL1,
> +	AXP803_IRQ_LOW_PWR_LVL2,
> +	AXP803_IRQ_TIMER,
> +	AXP803_IRQ_PEK_RIS_EDGE,
> +	AXP803_IRQ_PEK_FAL_EDGE,
> +	AXP803_IRQ_PEK_SHORT,
> +	AXP803_IRQ_PEK_LONG,
> +	AXP803_IRQ_PEK_OVER_OFF,
> +	AXP803_IRQ_GPIO1_INPUT,
> +	AXP803_IRQ_GPIO0_INPUT,
> +	AXP803_IRQ_BC_USB_CHNG,
> +	AXP803_IRQ_MV_CHNG,
> +};
> +
>  enum axp806_irqs {
>  	AXP806_IRQ_DIE_TEMP_HIGH_LV1,
>  	AXP806_IRQ_DIE_TEMP_HIGH_LV2,

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v2 03/11] dt-bindings: add device tree binding for X-Powers AXP803 PMIC
@ 2017-04-11 14:04     ` Lee Jones
  0 siblings, 0 replies; 71+ messages in thread
From: Lee Jones @ 2017-04-11 14:04 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood,
	devicetree, linux-sunxi, linux-kernel, linux-arm-kernel

On Sat, 08 Apr 2017, Icenowy Zheng wrote:

> AXP803 is a PMIC produced by Shenzhen X-Powers, with either I2C or RSB
> bus.
> 
> Add a compatible for it.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> Acked-by: Chen-Yu Tsai <wens@csie.org>
> ---
> Changes in v2:
> - Place AXP803 before AXP806/809.
> - Added Chen-Yu's ACK.
> 
>  Documentation/devicetree/bindings/mfd/axp20x.txt | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

For my own reference:
  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>

> diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
> index b41d2601c6ba..334fb19ce605 100644
> --- a/Documentation/devicetree/bindings/mfd/axp20x.txt
> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
> @@ -6,12 +6,13 @@ axp202 (X-Powers)
>  axp209 (X-Powers)
>  axp221 (X-Powers)
>  axp223 (X-Powers)
> +axp803 (X-Powers)
>  axp809 (X-Powers)
>  
>  Required properties:
>  - compatible: "x-powers,axp152", "x-powers,axp202", "x-powers,axp209",
> -	      "x-powers,axp221", "x-powers,axp223", "x-powers,axp806",
> -	      "x-powers,axp809"
> +	      "x-powers,axp221", "x-powers,axp223", "x-powers,axp803",
> +	      "x-powers,axp806", "x-powers,axp809"
>  - reg: The I2C slave address or RSB hardware address for the AXP chip
>  - interrupt-parent: The parent interrupt controller
>  - interrupts: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v2 03/11] dt-bindings: add device tree binding for X-Powers AXP803 PMIC
@ 2017-04-11 14:04     ` Lee Jones
  0 siblings, 0 replies; 71+ messages in thread
From: Lee Jones @ 2017-04-11 14:04 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Rob Herring, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Sat, 08 Apr 2017, Icenowy Zheng wrote:

> AXP803 is a PMIC produced by Shenzhen X-Powers, with either I2C or RSB
> bus.
> 
> Add a compatible for it.
> 
> Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
> Acked-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
> ---
> Changes in v2:
> - Place AXP803 before AXP806/809.
> - Added Chen-Yu's ACK.
> 
>  Documentation/devicetree/bindings/mfd/axp20x.txt | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

For my own reference:
  Acked-for-MFD-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

> diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
> index b41d2601c6ba..334fb19ce605 100644
> --- a/Documentation/devicetree/bindings/mfd/axp20x.txt
> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
> @@ -6,12 +6,13 @@ axp202 (X-Powers)
>  axp209 (X-Powers)
>  axp221 (X-Powers)
>  axp223 (X-Powers)
> +axp803 (X-Powers)
>  axp809 (X-Powers)
>  
>  Required properties:
>  - compatible: "x-powers,axp152", "x-powers,axp202", "x-powers,axp209",
> -	      "x-powers,axp221", "x-powers,axp223", "x-powers,axp806",
> -	      "x-powers,axp809"
> +	      "x-powers,axp221", "x-powers,axp223", "x-powers,axp803",
> +	      "x-powers,axp806", "x-powers,axp809"
>  - reg: The I2C slave address or RSB hardware address for the AXP chip
>  - interrupt-parent: The parent interrupt controller
>  - interrupts: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH v2 03/11] dt-bindings: add device tree binding for X-Powers AXP803 PMIC
@ 2017-04-11 14:04     ` Lee Jones
  0 siblings, 0 replies; 71+ messages in thread
From: Lee Jones @ 2017-04-11 14:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, 08 Apr 2017, Icenowy Zheng wrote:

> AXP803 is a PMIC produced by Shenzhen X-Powers, with either I2C or RSB
> bus.
> 
> Add a compatible for it.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> Acked-by: Chen-Yu Tsai <wens@csie.org>
> ---
> Changes in v2:
> - Place AXP803 before AXP806/809.
> - Added Chen-Yu's ACK.
> 
>  Documentation/devicetree/bindings/mfd/axp20x.txt | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

For my own reference:
  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>

> diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
> index b41d2601c6ba..334fb19ce605 100644
> --- a/Documentation/devicetree/bindings/mfd/axp20x.txt
> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
> @@ -6,12 +6,13 @@ axp202 (X-Powers)
>  axp209 (X-Powers)
>  axp221 (X-Powers)
>  axp223 (X-Powers)
> +axp803 (X-Powers)
>  axp809 (X-Powers)
>  
>  Required properties:
>  - compatible: "x-powers,axp152", "x-powers,axp202", "x-powers,axp209",
> -	      "x-powers,axp221", "x-powers,axp223", "x-powers,axp806",
> -	      "x-powers,axp809"
> +	      "x-powers,axp221", "x-powers,axp223", "x-powers,axp803",
> +	      "x-powers,axp806", "x-powers,axp809"
>  - reg: The I2C slave address or RSB hardware address for the AXP chip
>  - interrupt-parent: The parent interrupt controller
>  - interrupts: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v2 03/11] dt-bindings: add device tree binding for X-Powers AXP803 PMIC
  2017-04-11 14:04     ` Lee Jones
  (?)
@ 2017-04-11 15:00       ` Icenowy Zheng
  -1 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-11 15:00 UTC (permalink / raw)
  To: Lee Jones
  Cc: devicetree, linux-kernel, linux-sunxi, Liam Girdwood,
	Chen-Yu Tsai, Rob Herring, Maxime Ripard, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 2042 bytes --]



On Tue, 11 Apr 2017, Lee Jones wrote:

> On Sat, 08 Apr 2017, Icenowy Zheng wrote:
>
>> AXP803 is a PMIC produced by Shenzhen X-Powers, with either I2C or RSB
>> bus.
>> 
>> Add a compatible for it.
>> 
>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
>> Acked-by: Chen-Yu Tsai <wens@csie.org>
>> ---
>> Changes in v2:
>> - Place AXP803 before AXP806/809.
>> - Added Chen-Yu's ACK.
>>
>>  Documentation/devicetree/bindings/mfd/axp20x.txt | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> For my own reference:
>  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>

Excuse me... Who will apply this patch?

I think this patch should be applied by you as it's in bindings/mfd 
directory, however, if I'm wrong, please point out ;-)

>
>> diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
>> index b41d2601c6ba..334fb19ce605 100644
>> --- a/Documentation/devicetree/bindings/mfd/axp20x.txt
>> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
>> @@ -6,12 +6,13 @@ axp202 (X-Powers)
>>  axp209 (X-Powers)
>>  axp221 (X-Powers)
>>  axp223 (X-Powers)
>> +axp803 (X-Powers)
>>  axp809 (X-Powers)
>>
>>  Required properties:
>>  - compatible: "x-powers,axp152", "x-powers,axp202", "x-powers,axp209",
>> -	      "x-powers,axp221", "x-powers,axp223", "x-powers,axp806",
>> -	      "x-powers,axp809"
>> +	      "x-powers,axp221", "x-powers,axp223", "x-powers,axp803",
>> +	      "x-powers,axp806", "x-powers,axp809"
>>  - reg: The I2C slave address or RSB hardware address for the AXP chip
>>  - interrupt-parent: The parent interrupt controller
>>  - interrupts: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
>
> -- 
> Lee Jones
> Linaro STMicroelectronics Landing Team Lead
> Linaro.org │ Open source software for ARM SoCs
> Follow Linaro: Facebook | Twitter | Blog
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v2 03/11] dt-bindings: add device tree binding for X-Powers AXP803 PMIC
@ 2017-04-11 15:00       ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-11 15:00 UTC (permalink / raw)
  To: Lee Jones
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Liam Girdwood, Chen-Yu Tsai,
	Rob Herring, Maxime Ripard,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

[-- Attachment #1: Type: text/plain, Size: 2142 bytes --]



On Tue, 11 Apr 2017, Lee Jones wrote:

> On Sat, 08 Apr 2017, Icenowy Zheng wrote:
>
>> AXP803 is a PMIC produced by Shenzhen X-Powers, with either I2C or RSB
>> bus.
>> 
>> Add a compatible for it.
>> 
>> Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
>> Acked-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
>> ---
>> Changes in v2:
>> - Place AXP803 before AXP806/809.
>> - Added Chen-Yu's ACK.
>>
>>  Documentation/devicetree/bindings/mfd/axp20x.txt | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> For my own reference:
>  Acked-for-MFD-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

Excuse me... Who will apply this patch?

I think this patch should be applied by you as it's in bindings/mfd 
directory, however, if I'm wrong, please point out ;-)

>
>> diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
>> index b41d2601c6ba..334fb19ce605 100644
>> --- a/Documentation/devicetree/bindings/mfd/axp20x.txt
>> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
>> @@ -6,12 +6,13 @@ axp202 (X-Powers)
>>  axp209 (X-Powers)
>>  axp221 (X-Powers)
>>  axp223 (X-Powers)
>> +axp803 (X-Powers)
>>  axp809 (X-Powers)
>>
>>  Required properties:
>>  - compatible: "x-powers,axp152", "x-powers,axp202", "x-powers,axp209",
>> -	      "x-powers,axp221", "x-powers,axp223", "x-powers,axp806",
>> -	      "x-powers,axp809"
>> +	      "x-powers,axp221", "x-powers,axp223", "x-powers,axp803",
>> +	      "x-powers,axp806", "x-powers,axp809"
>>  - reg: The I2C slave address or RSB hardware address for the AXP chip
>>  - interrupt-parent: The parent interrupt controller
>>  - interrupts: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
>
> -- 
> Lee Jones
> Linaro STMicroelectronics Landing Team Lead
> Linaro.org │ Open source software for ARM SoCs
> Follow Linaro: Facebook | Twitter | Blog
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH v2 03/11] dt-bindings: add device tree binding for X-Powers AXP803 PMIC
@ 2017-04-11 15:00       ` Icenowy Zheng
  0 siblings, 0 replies; 71+ messages in thread
From: Icenowy Zheng @ 2017-04-11 15:00 UTC (permalink / raw)
  To: linux-arm-kernel



On Tue, 11 Apr 2017, Lee Jones wrote:

> On Sat, 08 Apr 2017, Icenowy Zheng wrote:
>
>> AXP803 is a PMIC produced by Shenzhen X-Powers, with either I2C or RSB
>> bus.
>> 
>> Add a compatible for it.
>> 
>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
>> Acked-by: Chen-Yu Tsai <wens@csie.org>
>> ---
>> Changes in v2:
>> - Place AXP803 before AXP806/809.
>> - Added Chen-Yu's ACK.
>>
>>  Documentation/devicetree/bindings/mfd/axp20x.txt | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> For my own reference:
>  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>

Excuse me... Who will apply this patch?

I think this patch should be applied by you as it's in bindings/mfd 
directory, however, if I'm wrong, please point out ;-)

>
>> diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
>> index b41d2601c6ba..334fb19ce605 100644
>> --- a/Documentation/devicetree/bindings/mfd/axp20x.txt
>> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
>> @@ -6,12 +6,13 @@ axp202 (X-Powers)
>>  axp209 (X-Powers)
>>  axp221 (X-Powers)
>>  axp223 (X-Powers)
>> +axp803 (X-Powers)
>>  axp809 (X-Powers)
>>
>>  Required properties:
>>  - compatible: "x-powers,axp152", "x-powers,axp202", "x-powers,axp209",
>> -	      "x-powers,axp221", "x-powers,axp223", "x-powers,axp806",
>> -	      "x-powers,axp809"
>> +	      "x-powers,axp221", "x-powers,axp223", "x-powers,axp803",
>> +	      "x-powers,axp806", "x-powers,axp809"
>>  - reg: The I2C slave address or RSB hardware address for the AXP chip
>>  - interrupt-parent: The parent interrupt controller
>>  - interrupts: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
>
> -- 
> Lee Jones
> Linaro STMicroelectronics Landing Team Lead
> Linaro.org ? Open source software for ARM SoCs
> Follow Linaro: Facebook | Twitter | Blog
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [linux-sunxi] Re: [PATCH v2 03/11] dt-bindings: add device tree binding for X-Powers AXP803 PMIC
  2017-04-11 15:00       ` Icenowy Zheng
  (?)
@ 2017-04-11 15:02         ` Chen-Yu Tsai
  -1 siblings, 0 replies; 71+ messages in thread
From: Chen-Yu Tsai @ 2017-04-11 15:02 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Lee Jones, devicetree, linux-kernel, linux-sunxi, Liam Girdwood,
	Chen-Yu Tsai, Rob Herring, Maxime Ripard, linux-arm-kernel

Hi,

On Tue, Apr 11, 2017 at 11:00 PM, Icenowy Zheng <icenowy@aosc.io> wrote:
>
>
> On Tue, 11 Apr 2017, Lee Jones wrote:
>
>> On Sat, 08 Apr 2017, Icenowy Zheng wrote:
>>
>>> AXP803 is a PMIC produced by Shenzhen X-Powers, with either I2C or RSB
>>> bus.
>>>
>>> Add a compatible for it.
>>>
>>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
>>> Acked-by: Chen-Yu Tsai <wens@csie.org>
>>> ---
>>> Changes in v2:
>>> - Place AXP803 before AXP806/809.
>>> - Added Chen-Yu's ACK.
>>>
>>>  Documentation/devicetree/bindings/mfd/axp20x.txt | 5 +++--
>>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>>
>> For my own reference:
>>  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
>
>
> Excuse me... Who will apply this patch?
>
> I think this patch should be applied by you as it's in bindings/mfd
> directory, however, if I'm wrong, please point out ;-)

We need the DT maintainers to ack it first. :)

ChenYu

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: Re: [PATCH v2 03/11] dt-bindings: add device tree binding for X-Powers AXP803 PMIC
@ 2017-04-11 15:02         ` Chen-Yu Tsai
  0 siblings, 0 replies; 71+ messages in thread
From: Chen-Yu Tsai @ 2017-04-11 15:02 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Lee Jones, devicetree, linux-kernel, linux-sunxi, Liam Girdwood,
	Chen-Yu Tsai, Rob Herring, Maxime Ripard, linux-arm-kernel

Hi,

On Tue, Apr 11, 2017 at 11:00 PM, Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org> wrote:
>
>
> On Tue, 11 Apr 2017, Lee Jones wrote:
>
>> On Sat, 08 Apr 2017, Icenowy Zheng wrote:
>>
>>> AXP803 is a PMIC produced by Shenzhen X-Powers, with either I2C or RSB
>>> bus.
>>>
>>> Add a compatible for it.
>>>
>>> Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
>>> Acked-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
>>> ---
>>> Changes in v2:
>>> - Place AXP803 before AXP806/809.
>>> - Added Chen-Yu's ACK.
>>>
>>>  Documentation/devicetree/bindings/mfd/axp20x.txt | 5 +++--
>>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>>
>> For my own reference:
>>  Acked-for-MFD-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>
>
> Excuse me... Who will apply this patch?
>
> I think this patch should be applied by you as it's in bindings/mfd
> directory, however, if I'm wrong, please point out ;-)

We need the DT maintainers to ack it first. :)

ChenYu

^ permalink raw reply	[flat|nested] 71+ messages in thread

* [linux-sunxi] Re: [PATCH v2 03/11] dt-bindings: add device tree binding for X-Powers AXP803 PMIC
@ 2017-04-11 15:02         ` Chen-Yu Tsai
  0 siblings, 0 replies; 71+ messages in thread
From: Chen-Yu Tsai @ 2017-04-11 15:02 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Tue, Apr 11, 2017 at 11:00 PM, Icenowy Zheng <icenowy@aosc.io> wrote:
>
>
> On Tue, 11 Apr 2017, Lee Jones wrote:
>
>> On Sat, 08 Apr 2017, Icenowy Zheng wrote:
>>
>>> AXP803 is a PMIC produced by Shenzhen X-Powers, with either I2C or RSB
>>> bus.
>>>
>>> Add a compatible for it.
>>>
>>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
>>> Acked-by: Chen-Yu Tsai <wens@csie.org>
>>> ---
>>> Changes in v2:
>>> - Place AXP803 before AXP806/809.
>>> - Added Chen-Yu's ACK.
>>>
>>>  Documentation/devicetree/bindings/mfd/axp20x.txt | 5 +++--
>>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>>
>> For my own reference:
>>  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
>
>
> Excuse me... Who will apply this patch?
>
> I think this patch should be applied by you as it's in bindings/mfd
> directory, however, if I'm wrong, please point out ;-)

We need the DT maintainers to ack it first. :)

ChenYu

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [linux-sunxi] Re: [PATCH v2 03/11] dt-bindings: add device tree binding for X-Powers AXP803 PMIC
@ 2017-04-11 16:29           ` Lee Jones
  0 siblings, 0 replies; 71+ messages in thread
From: Lee Jones @ 2017-04-11 16:29 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Icenowy Zheng, devicetree, linux-kernel, linux-sunxi,
	Liam Girdwood, Rob Herring, Maxime Ripard, linux-arm-kernel

On Tue, 11 Apr 2017, Chen-Yu Tsai wrote:

> Hi,
> 
> On Tue, Apr 11, 2017 at 11:00 PM, Icenowy Zheng <icenowy@aosc.io> wrote:
> >
> >
> > On Tue, 11 Apr 2017, Lee Jones wrote:
> >
> >> On Sat, 08 Apr 2017, Icenowy Zheng wrote:
> >>
> >>> AXP803 is a PMIC produced by Shenzhen X-Powers, with either I2C or RSB
> >>> bus.
> >>>
> >>> Add a compatible for it.
> >>>
> >>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> >>> Acked-by: Chen-Yu Tsai <wens@csie.org>
> >>> ---
> >>> Changes in v2:
> >>> - Place AXP803 before AXP806/809.
> >>> - Added Chen-Yu's ACK.
> >>>
> >>>  Documentation/devicetree/bindings/mfd/axp20x.txt | 5 +++--
> >>>  1 file changed, 3 insertions(+), 2 deletions(-)
> >>
> >>
> >> For my own reference:
> >>  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
> >
> >
> > Excuse me... Who will apply this patch?

Excuse you?  Are you trying to be polite, or rude?

I'm guessing due to the lagging '...', that it's the latter?

> > I think this patch should be applied by you as it's in bindings/mfd
> > directory, however, if I'm wrong, please point out ;-)
>
> We need the DT maintainers to ack it first. :)

We don't really need the DT Maintainers to get involved here.

What I do need is either clear direction as to how this
patch-set should be applied, or an indication of which patches are
dependant on others and which are orthogonal and can be applied
independently.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: Re: [PATCH v2 03/11] dt-bindings: add device tree binding for X-Powers AXP803 PMIC
@ 2017-04-11 16:29           ` Lee Jones
  0 siblings, 0 replies; 71+ messages in thread
From: Lee Jones @ 2017-04-11 16:29 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Icenowy Zheng, devicetree, linux-kernel, linux-sunxi,
	Liam Girdwood, Rob Herring, Maxime Ripard, linux-arm-kernel

On Tue, 11 Apr 2017, Chen-Yu Tsai wrote:

> Hi,
> 
> On Tue, Apr 11, 2017 at 11:00 PM, Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org> wrote:
> >
> >
> > On Tue, 11 Apr 2017, Lee Jones wrote:
> >
> >> On Sat, 08 Apr 2017, Icenowy Zheng wrote:
> >>
> >>> AXP803 is a PMIC produced by Shenzhen X-Powers, with either I2C or RSB
> >>> bus.
> >>>
> >>> Add a compatible for it.
> >>>
> >>> Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
> >>> Acked-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
> >>> ---
> >>> Changes in v2:
> >>> - Place AXP803 before AXP806/809.
> >>> - Added Chen-Yu's ACK.
> >>>
> >>>  Documentation/devicetree/bindings/mfd/axp20x.txt | 5 +++--
> >>>  1 file changed, 3 insertions(+), 2 deletions(-)
> >>
> >>
> >> For my own reference:
> >>  Acked-for-MFD-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> >
> >
> > Excuse me... Who will apply this patch?

Excuse you?  Are you trying to be polite, or rude?

I'm guessing due to the lagging '...', that it's the latter?

> > I think this patch should be applied by you as it's in bindings/mfd
> > directory, however, if I'm wrong, please point out ;-)
>
> We need the DT maintainers to ack it first. :)

We don't really need the DT Maintainers to get involved here.

What I do need is either clear direction as to how this
patch-set should be applied, or an indication of which patches are
dependant on others and which are orthogonal and can be applied
independently.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 71+ messages in thread

* [linux-sunxi] Re: [PATCH v2 03/11] dt-bindings: add device tree binding for X-Powers AXP803 PMIC
@ 2017-04-11 16:29           ` Lee Jones
  0 siblings, 0 replies; 71+ messages in thread
From: Lee Jones @ 2017-04-11 16:29 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 11 Apr 2017, Chen-Yu Tsai wrote:

> Hi,
> 
> On Tue, Apr 11, 2017 at 11:00 PM, Icenowy Zheng <icenowy@aosc.io> wrote:
> >
> >
> > On Tue, 11 Apr 2017, Lee Jones wrote:
> >
> >> On Sat, 08 Apr 2017, Icenowy Zheng wrote:
> >>
> >>> AXP803 is a PMIC produced by Shenzhen X-Powers, with either I2C or RSB
> >>> bus.
> >>>
> >>> Add a compatible for it.
> >>>
> >>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> >>> Acked-by: Chen-Yu Tsai <wens@csie.org>
> >>> ---
> >>> Changes in v2:
> >>> - Place AXP803 before AXP806/809.
> >>> - Added Chen-Yu's ACK.
> >>>
> >>>  Documentation/devicetree/bindings/mfd/axp20x.txt | 5 +++--
> >>>  1 file changed, 3 insertions(+), 2 deletions(-)
> >>
> >>
> >> For my own reference:
> >>  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
> >
> >
> > Excuse me... Who will apply this patch?

Excuse you?  Are you trying to be polite, or rude?

I'm guessing due to the lagging '...', that it's the latter?

> > I think this patch should be applied by you as it's in bindings/mfd
> > directory, however, if I'm wrong, please point out ;-)
>
> We need the DT maintainers to ack it first. :)

We don't really need the DT Maintainers to get involved here.

What I do need is either clear direction as to how this
patch-set should be applied, or an indication of which patches are
dependant on others and which are orthogonal and can be applied
independently.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v2 03/11] dt-bindings: add device tree binding for X-Powers AXP803 PMIC
@ 2017-04-13 19:56     ` Rob Herring
  0 siblings, 0 replies; 71+ messages in thread
From: Rob Herring @ 2017-04-13 19:56 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Lee Jones, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood,
	devicetree, linux-sunxi, linux-kernel, linux-arm-kernel

On Sat, Apr 08, 2017 at 02:34:33AM +0800, Icenowy Zheng wrote:
> AXP803 is a PMIC produced by Shenzhen X-Powers, with either I2C or RSB
> bus.
> 
> Add a compatible for it.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> Acked-by: Chen-Yu Tsai <wens@csie.org>
> ---
> Changes in v2:
> - Place AXP803 before AXP806/809.
> - Added Chen-Yu's ACK.
> 
>  Documentation/devicetree/bindings/mfd/axp20x.txt | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
> index b41d2601c6ba..334fb19ce605 100644
> --- a/Documentation/devicetree/bindings/mfd/axp20x.txt
> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
> @@ -6,12 +6,13 @@ axp202 (X-Powers)
>  axp209 (X-Powers)
>  axp221 (X-Powers)
>  axp223 (X-Powers)
> +axp803 (X-Powers)
>  axp809 (X-Powers)
>  
>  Required properties:
>  - compatible: "x-powers,axp152", "x-powers,axp202", "x-powers,axp209",
> -	      "x-powers,axp221", "x-powers,axp223", "x-powers,axp806",
> -	      "x-powers,axp809"
> +	      "x-powers,axp221", "x-powers,axp223", "x-powers,axp803",
> +	      "x-powers,axp806", "x-powers,axp809"

If you spin another version, please make this one valid combination per 
line. Otherwise,

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v2 03/11] dt-bindings: add device tree binding for X-Powers AXP803 PMIC
@ 2017-04-13 19:56     ` Rob Herring
  0 siblings, 0 replies; 71+ messages in thread
From: Rob Herring @ 2017-04-13 19:56 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Lee Jones, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Sat, Apr 08, 2017 at 02:34:33AM +0800, Icenowy Zheng wrote:
> AXP803 is a PMIC produced by Shenzhen X-Powers, with either I2C or RSB
> bus.
> 
> Add a compatible for it.
> 
> Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
> Acked-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
> ---
> Changes in v2:
> - Place AXP803 before AXP806/809.
> - Added Chen-Yu's ACK.
> 
>  Documentation/devicetree/bindings/mfd/axp20x.txt | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
> index b41d2601c6ba..334fb19ce605 100644
> --- a/Documentation/devicetree/bindings/mfd/axp20x.txt
> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
> @@ -6,12 +6,13 @@ axp202 (X-Powers)
>  axp209 (X-Powers)
>  axp221 (X-Powers)
>  axp223 (X-Powers)
> +axp803 (X-Powers)
>  axp809 (X-Powers)
>  
>  Required properties:
>  - compatible: "x-powers,axp152", "x-powers,axp202", "x-powers,axp209",
> -	      "x-powers,axp221", "x-powers,axp223", "x-powers,axp806",
> -	      "x-powers,axp809"
> +	      "x-powers,axp221", "x-powers,axp223", "x-powers,axp803",
> +	      "x-powers,axp806", "x-powers,axp809"

If you spin another version, please make this one valid combination per 
line. Otherwise,

Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH v2 03/11] dt-bindings: add device tree binding for X-Powers AXP803 PMIC
@ 2017-04-13 19:56     ` Rob Herring
  0 siblings, 0 replies; 71+ messages in thread
From: Rob Herring @ 2017-04-13 19:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Apr 08, 2017 at 02:34:33AM +0800, Icenowy Zheng wrote:
> AXP803 is a PMIC produced by Shenzhen X-Powers, with either I2C or RSB
> bus.
> 
> Add a compatible for it.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> Acked-by: Chen-Yu Tsai <wens@csie.org>
> ---
> Changes in v2:
> - Place AXP803 before AXP806/809.
> - Added Chen-Yu's ACK.
> 
>  Documentation/devicetree/bindings/mfd/axp20x.txt | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
> index b41d2601c6ba..334fb19ce605 100644
> --- a/Documentation/devicetree/bindings/mfd/axp20x.txt
> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
> @@ -6,12 +6,13 @@ axp202 (X-Powers)
>  axp209 (X-Powers)
>  axp221 (X-Powers)
>  axp223 (X-Powers)
> +axp803 (X-Powers)
>  axp809 (X-Powers)
>  
>  Required properties:
>  - compatible: "x-powers,axp152", "x-powers,axp202", "x-powers,axp209",
> -	      "x-powers,axp221", "x-powers,axp223", "x-powers,axp806",
> -	      "x-powers,axp809"
> +	      "x-powers,axp221", "x-powers,axp223", "x-powers,axp803",
> +	      "x-powers,axp806", "x-powers,axp809"

If you spin another version, please make this one valid combination per 
line. Otherwise,

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v2 06/11] dt-bindings: add AXP803's regulator info
@ 2017-04-13 19:57     ` Rob Herring
  0 siblings, 0 replies; 71+ messages in thread
From: Rob Herring @ 2017-04-13 19:57 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Lee Jones, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood,
	devicetree, linux-sunxi, linux-kernel, linux-arm-kernel

On Sat, Apr 08, 2017 at 02:34:36AM +0800, Icenowy Zheng wrote:
> AXP803 have the most regulators in currently supported AXP PMICs.
> 
> Add info for the regulators in the dt-bindings document.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
> Changes in v2:
> - Place AXP803 regulators before AXP806/809 ones.
> 
>  Documentation/devicetree/bindings/mfd/axp20x.txt | 27 ++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v2 06/11] dt-bindings: add AXP803's regulator info
@ 2017-04-13 19:57     ` Rob Herring
  0 siblings, 0 replies; 71+ messages in thread
From: Rob Herring @ 2017-04-13 19:57 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Lee Jones, Chen-Yu Tsai, Maxime Ripard, Liam Girdwood,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Sat, Apr 08, 2017 at 02:34:36AM +0800, Icenowy Zheng wrote:
> AXP803 have the most regulators in currently supported AXP PMICs.
> 
> Add info for the regulators in the dt-bindings document.
> 
> Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
> ---
> Changes in v2:
> - Place AXP803 regulators before AXP806/809 ones.
> 
>  Documentation/devicetree/bindings/mfd/axp20x.txt | 27 ++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)

Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH v2 06/11] dt-bindings: add AXP803's regulator info
@ 2017-04-13 19:57     ` Rob Herring
  0 siblings, 0 replies; 71+ messages in thread
From: Rob Herring @ 2017-04-13 19:57 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Apr 08, 2017 at 02:34:36AM +0800, Icenowy Zheng wrote:
> AXP803 have the most regulators in currently supported AXP PMICs.
> 
> Add info for the regulators in the dt-bindings document.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
> Changes in v2:
> - Place AXP803 regulators before AXP806/809 ones.
> 
>  Documentation/devicetree/bindings/mfd/axp20x.txt | 27 ++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v2 11/11] arm64: allwinner: a64: enable Wi-Fi for Pine64
@ 2017-04-14 16:56     ` Andreas Färber
  0 siblings, 0 replies; 71+ messages in thread
From: Andreas Färber @ 2017-04-14 16:56 UTC (permalink / raw)
  To: Icenowy Zheng, Lee Jones, Rob Herring, Chen-Yu Tsai,
	Maxime Ripard, Liam Girdwood
  Cc: devicetree, linux-sunxi, linux-kernel, linux-arm-kernel

Hi,

Am 07.04.2017 um 20:34 schrieb Icenowy Zheng:
> The Wi-Fi modules of Pine64 is powered via DLDO4 and ELDO1 (the latter

"modules ... are" or "module ... is"

> one provides I/O voltage).
> 
> Add device node for it.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
>  arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
> index 7da074f95065..9d90bb32aa87 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
> @@ -64,6 +64,11 @@
>  		regulator-min-microvolt = <3300000>;
>  		regulator-max-microvolt = <3300000>;
>  	};
> +
> +	wifi_pwrseq: wifi_pwrseq {
> +		compatible = "mmc-pwrseq-simple";
> +		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
> +	};
>  };
>  
>  &ehci1 {
> @@ -91,6 +96,17 @@
>  	status = "okay";
>  };
>  
> +&mmc1 {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&mmc1_pins>;
> +	vmmc-supply = <&reg_dldo4>;
> +	vqmmc-supply = <&reg_eldo1>;
> +	mmc-pwrseq = <&wifi_pwrseq>;
> +	non-removable;
> +	bus-width = <4>;
> +	status = "okay";
> +};

As you mention above, Wi-Fi is a module, so may be absent. Is it really
correct to enable this node and hardcode a certain power sequence? In
theory other modules could be attached.

To me that calls for an overlay instead.

> +
>  &ohci1 {
>  	status = "okay";
>  };

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v2 11/11] arm64: allwinner: a64: enable Wi-Fi for Pine64
@ 2017-04-14 16:56     ` Andreas Färber
  0 siblings, 0 replies; 71+ messages in thread
From: Andreas Färber @ 2017-04-14 16:56 UTC (permalink / raw)
  To: Icenowy Zheng, Lee Jones, Rob Herring, Chen-Yu Tsai,
	Maxime Ripard, Liam Girdwood
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Hi,

Am 07.04.2017 um 20:34 schrieb Icenowy Zheng:
> The Wi-Fi modules of Pine64 is powered via DLDO4 and ELDO1 (the latter

"modules ... are" or "module ... is"

> one provides I/O voltage).
> 
> Add device node for it.
> 
> Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
> ---
>  arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
> index 7da074f95065..9d90bb32aa87 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
> @@ -64,6 +64,11 @@
>  		regulator-min-microvolt = <3300000>;
>  		regulator-max-microvolt = <3300000>;
>  	};
> +
> +	wifi_pwrseq: wifi_pwrseq {
> +		compatible = "mmc-pwrseq-simple";
> +		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
> +	};
>  };
>  
>  &ehci1 {
> @@ -91,6 +96,17 @@
>  	status = "okay";
>  };
>  
> +&mmc1 {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&mmc1_pins>;
> +	vmmc-supply = <&reg_dldo4>;
> +	vqmmc-supply = <&reg_eldo1>;
> +	mmc-pwrseq = <&wifi_pwrseq>;
> +	non-removable;
> +	bus-width = <4>;
> +	status = "okay";
> +};

As you mention above, Wi-Fi is a module, so may be absent. Is it really
correct to enable this node and hardcode a certain power sequence? In
theory other modules could be attached.

To me that calls for an overlay instead.

> +
>  &ohci1 {
>  	status = "okay";
>  };

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)

-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH v2 11/11] arm64: allwinner: a64: enable Wi-Fi for Pine64
@ 2017-04-14 16:56     ` Andreas Färber
  0 siblings, 0 replies; 71+ messages in thread
From: Andreas Färber @ 2017-04-14 16:56 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Am 07.04.2017 um 20:34 schrieb Icenowy Zheng:
> The Wi-Fi modules of Pine64 is powered via DLDO4 and ELDO1 (the latter

"modules ... are" or "module ... is"

> one provides I/O voltage).
> 
> Add device node for it.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
>  arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
> index 7da074f95065..9d90bb32aa87 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
> @@ -64,6 +64,11 @@
>  		regulator-min-microvolt = <3300000>;
>  		regulator-max-microvolt = <3300000>;
>  	};
> +
> +	wifi_pwrseq: wifi_pwrseq {
> +		compatible = "mmc-pwrseq-simple";
> +		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
> +	};
>  };
>  
>  &ehci1 {
> @@ -91,6 +96,17 @@
>  	status = "okay";
>  };
>  
> +&mmc1 {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&mmc1_pins>;
> +	vmmc-supply = <&reg_dldo4>;
> +	vqmmc-supply = <&reg_eldo1>;
> +	mmc-pwrseq = <&wifi_pwrseq>;
> +	non-removable;
> +	bus-width = <4>;
> +	status = "okay";
> +};

As you mention above, Wi-Fi is a module, so may be absent. Is it really
correct to enable this node and hardcode a certain power sequence? In
theory other modules could be attached.

To me that calls for an overlay instead.

> +
>  &ohci1 {
>  	status = "okay";
>  };

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v2 11/11] arm64: allwinner: a64: enable Wi-Fi for Pine64
@ 2017-04-17  7:59       ` Maxime Ripard
  0 siblings, 0 replies; 71+ messages in thread
From: Maxime Ripard @ 2017-04-17  7:59 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Icenowy Zheng, Lee Jones, Rob Herring, Chen-Yu Tsai,
	Liam Girdwood, devicetree, linux-sunxi, linux-kernel,
	linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 1628 bytes --]

On Fri, Apr 14, 2017 at 06:56:16PM +0200, Andreas Färber wrote:
> > one provides I/O voltage).
> > 
> > Add device node for it.
> > 
> > Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> > ---
> >  arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts | 16 ++++++++++++++++
> >  1 file changed, 16 insertions(+)
> > 
> > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
> > index 7da074f95065..9d90bb32aa87 100644
> > --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
> > +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
> > @@ -64,6 +64,11 @@
> >  		regulator-min-microvolt = <3300000>;
> >  		regulator-max-microvolt = <3300000>;
> >  	};
> > +
> > +	wifi_pwrseq: wifi_pwrseq {
> > +		compatible = "mmc-pwrseq-simple";
> > +		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
> > +	};
> >  };
> >  
> >  &ehci1 {
> > @@ -91,6 +96,17 @@
> >  	status = "okay";
> >  };
> >  
> > +&mmc1 {
> > +	pinctrl-names = "default";
> > +	pinctrl-0 = <&mmc1_pins>;
> > +	vmmc-supply = <&reg_dldo4>;
> > +	vqmmc-supply = <&reg_eldo1>;
> > +	mmc-pwrseq = <&wifi_pwrseq>;
> > +	non-removable;
> > +	bus-width = <4>;
> > +	status = "okay";
> > +};
> 
> As you mention above, Wi-Fi is a module, so may be absent. Is it really
> correct to enable this node and hardcode a certain power sequence? In
> theory other modules could be attached.
> 
> To me that calls for an overlay instead.

Agreed.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v2 11/11] arm64: allwinner: a64: enable Wi-Fi for Pine64
@ 2017-04-17  7:59       ` Maxime Ripard
  0 siblings, 0 replies; 71+ messages in thread
From: Maxime Ripard @ 2017-04-17  7:59 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Icenowy Zheng, Lee Jones, Rob Herring, Chen-Yu Tsai,
	Liam Girdwood, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

[-- Attachment #1: Type: text/plain, Size: 1972 bytes --]

On Fri, Apr 14, 2017 at 06:56:16PM +0200, Andreas Färber wrote:
> > one provides I/O voltage).
> > 
> > Add device node for it.
> > 
> > Signed-off-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>
> > ---
> >  arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts | 16 ++++++++++++++++
> >  1 file changed, 16 insertions(+)
> > 
> > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
> > index 7da074f95065..9d90bb32aa87 100644
> > --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
> > +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
> > @@ -64,6 +64,11 @@
> >  		regulator-min-microvolt = <3300000>;
> >  		regulator-max-microvolt = <3300000>;
> >  	};
> > +
> > +	wifi_pwrseq: wifi_pwrseq {
> > +		compatible = "mmc-pwrseq-simple";
> > +		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
> > +	};
> >  };
> >  
> >  &ehci1 {
> > @@ -91,6 +96,17 @@
> >  	status = "okay";
> >  };
> >  
> > +&mmc1 {
> > +	pinctrl-names = "default";
> > +	pinctrl-0 = <&mmc1_pins>;
> > +	vmmc-supply = <&reg_dldo4>;
> > +	vqmmc-supply = <&reg_eldo1>;
> > +	mmc-pwrseq = <&wifi_pwrseq>;
> > +	non-removable;
> > +	bus-width = <4>;
> > +	status = "okay";
> > +};
> 
> As you mention above, Wi-Fi is a module, so may be absent. Is it really
> correct to enable this node and hardcode a certain power sequence? In
> theory other modules could be attached.
> 
> To me that calls for an overlay instead.

Agreed.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH v2 11/11] arm64: allwinner: a64: enable Wi-Fi for Pine64
@ 2017-04-17  7:59       ` Maxime Ripard
  0 siblings, 0 replies; 71+ messages in thread
From: Maxime Ripard @ 2017-04-17  7:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Apr 14, 2017 at 06:56:16PM +0200, Andreas F?rber wrote:
> > one provides I/O voltage).
> > 
> > Add device node for it.
> > 
> > Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> > ---
> >  arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts | 16 ++++++++++++++++
> >  1 file changed, 16 insertions(+)
> > 
> > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
> > index 7da074f95065..9d90bb32aa87 100644
> > --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
> > +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
> > @@ -64,6 +64,11 @@
> >  		regulator-min-microvolt = <3300000>;
> >  		regulator-max-microvolt = <3300000>;
> >  	};
> > +
> > +	wifi_pwrseq: wifi_pwrseq {
> > +		compatible = "mmc-pwrseq-simple";
> > +		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
> > +	};
> >  };
> >  
> >  &ehci1 {
> > @@ -91,6 +96,17 @@
> >  	status = "okay";
> >  };
> >  
> > +&mmc1 {
> > +	pinctrl-names = "default";
> > +	pinctrl-0 = <&mmc1_pins>;
> > +	vmmc-supply = <&reg_dldo4>;
> > +	vqmmc-supply = <&reg_eldo1>;
> > +	mmc-pwrseq = <&wifi_pwrseq>;
> > +	non-removable;
> > +	bus-width = <4>;
> > +	status = "okay";
> > +};
> 
> As you mention above, Wi-Fi is a module, so may be absent. Is it really
> correct to enable this node and hardcode a certain power sequence? In
> theory other modules could be attached.
> 
> To me that calls for an overlay instead.

Agreed.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170417/ff7de77c/attachment.sig>

^ permalink raw reply	[flat|nested] 71+ messages in thread

end of thread, other threads:[~2017-04-17  7:59 UTC | newest]

Thread overview: 71+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-07 18:34 [PATCH v2 00/11] AXP803 PMIC support for Pine64 Icenowy Zheng
2017-04-07 18:34 ` Icenowy Zheng
2017-04-07 18:34 ` Icenowy Zheng
2017-04-07 18:34 ` [PATCH v2 01/11] arm64: allwinner: a64: enable RSB on A64 Icenowy Zheng
2017-04-07 18:34   ` Icenowy Zheng
2017-04-07 18:34   ` Icenowy Zheng
2017-04-07 18:34 ` [PATCH v2 02/11] arm64: allwinner: a64: add NMI controller " Icenowy Zheng
2017-04-07 18:34   ` Icenowy Zheng
2017-04-07 18:34   ` Icenowy Zheng
2017-04-07 18:34 ` [PATCH v2 03/11] dt-bindings: add device tree binding for X-Powers AXP803 PMIC Icenowy Zheng
2017-04-07 18:34   ` Icenowy Zheng
2017-04-07 18:34   ` Icenowy Zheng
2017-04-11 14:04   ` Lee Jones
2017-04-11 14:04     ` Lee Jones
2017-04-11 14:04     ` Lee Jones
2017-04-11 15:00     ` Icenowy Zheng
2017-04-11 15:00       ` Icenowy Zheng
2017-04-11 15:00       ` Icenowy Zheng
2017-04-11 15:02       ` [linux-sunxi] " Chen-Yu Tsai
2017-04-11 15:02         ` Chen-Yu Tsai
2017-04-11 15:02         ` Chen-Yu Tsai
2017-04-11 16:29         ` [linux-sunxi] " Lee Jones
2017-04-11 16:29           ` Lee Jones
2017-04-11 16:29           ` Lee Jones
2017-04-13 19:56   ` Rob Herring
2017-04-13 19:56     ` Rob Herring
2017-04-13 19:56     ` Rob Herring
2017-04-07 18:34 ` [PATCH v2 04/11] mfd: axp20x: support AXP803 variant Icenowy Zheng
2017-04-07 18:34   ` Icenowy Zheng
2017-04-07 18:34   ` Icenowy Zheng
2017-04-11 14:04   ` Lee Jones
2017-04-11 14:04     ` Lee Jones
2017-04-11 14:04     ` Lee Jones
2017-04-07 18:34 ` [PATCH v2 05/11] arm64: allwinner: a64: add AXP803 node to Pine64 device tree Icenowy Zheng
2017-04-07 18:34   ` Icenowy Zheng
2017-04-07 18:34   ` Icenowy Zheng
2017-04-07 18:34 ` [PATCH v2 06/11] dt-bindings: add AXP803's regulator info Icenowy Zheng
2017-04-07 18:34   ` Icenowy Zheng
2017-04-07 18:34   ` Icenowy Zheng
2017-04-11 14:03   ` Lee Jones
2017-04-11 14:03     ` Lee Jones
2017-04-11 14:03     ` Lee Jones
2017-04-13 19:57   ` Rob Herring
2017-04-13 19:57     ` Rob Herring
2017-04-13 19:57     ` Rob Herring
2017-04-07 18:34 ` [PATCH v2 07/11] regulator: axp20x-regulator: add support for AXP803 Icenowy Zheng
2017-04-07 18:34   ` Icenowy Zheng
2017-04-07 18:34   ` Icenowy Zheng
2017-04-11 14:03   ` Lee Jones
2017-04-11 14:03     ` Lee Jones
2017-04-11 14:03     ` Lee Jones
2017-04-07 18:34 ` [PATCH v2 08/11] mfd: axp20x: add axp20x-regulator cell " Icenowy Zheng
2017-04-07 18:34   ` Icenowy Zheng
2017-04-07 18:34   ` Icenowy Zheng
2017-04-11 14:03   ` Lee Jones
2017-04-11 14:03     ` Lee Jones
2017-04-07 18:34 ` [PATCH v2 09/11] arm64: allwinner: a64: add DTSI file for AXP803 PMIC Icenowy Zheng
2017-04-07 18:34   ` Icenowy Zheng
2017-04-07 18:34   ` Icenowy Zheng
2017-04-07 18:34 ` [PATCH v2 10/11] arm64: allwinner: a64: enable AXP803 regulators for Pine64 Icenowy Zheng
2017-04-07 18:34   ` Icenowy Zheng
2017-04-07 18:34   ` Icenowy Zheng
2017-04-07 18:34 ` [PATCH v2 11/11] arm64: allwinner: a64: enable Wi-Fi " Icenowy Zheng
2017-04-07 18:34   ` Icenowy Zheng
2017-04-07 18:34   ` Icenowy Zheng
2017-04-14 16:56   ` Andreas Färber
2017-04-14 16:56     ` Andreas Färber
2017-04-14 16:56     ` Andreas Färber
2017-04-17  7:59     ` Maxime Ripard
2017-04-17  7:59       ` Maxime Ripard
2017-04-17  7:59       ` Maxime Ripard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.