linux-sunxi.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] AXP221/AXP223/AXP809 GPIO support
@ 2022-09-16  4:27 Samuel Holland
  2022-09-16  4:27 ` [PATCH v3 1/2] ARM: dts: axp803/axp81x: Drop GPIO LDO pinctrl nodes Samuel Holland
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Samuel Holland @ 2022-09-16  4:27 UTC (permalink / raw)
  To: Chen-Yu Tsai, Jernej Skrabec
  Cc: Samuel Holland, Krzysztof Kozlowski, Rob Herring, devicetree,
	linux-arm-kernel, linux-kernel, linux-sunxi

This series hooks up the GPIO controller found in some older X-Powers
PMICs. The main motivation is converting the U-Boot driver over to use
devicetree, but Linux might as well gain support for the hardware too.

Changes in v3:
 - Added patch to remove existing "ldo" pinctrl nodes
 - Drop already-merged binding and driver patches
 - Remove "ldo" pinctrl children from new nodes

Samuel Holland (2):
  ARM: dts: axp803/axp81x: Drop GPIO LDO pinctrl nodes
  ARM: dts: axp22x/axp809: Add GPIO controller nodes

 arch/arm/boot/dts/axp22x.dtsi             |  6 ++++++
 arch/arm/boot/dts/axp809.dtsi             |  7 +++++++
 arch/arm/boot/dts/axp81x.dtsi             | 14 --------------
 arch/arm64/boot/dts/allwinner/axp803.dtsi | 10 ----------
 4 files changed, 13 insertions(+), 24 deletions(-)

-- 
2.35.1


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

* [PATCH v3 1/2] ARM: dts: axp803/axp81x: Drop GPIO LDO pinctrl nodes
  2022-09-16  4:27 [PATCH v3 0/2] AXP221/AXP223/AXP809 GPIO support Samuel Holland
@ 2022-09-16  4:27 ` Samuel Holland
  2022-10-12 22:01   ` Jernej Škrabec
  2022-09-16  4:27 ` [PATCH v3 2/2] ARM: dts: axp22x/axp809: Add GPIO controller nodes Samuel Holland
  2022-10-26 20:16 ` [PATCH v3 0/2] AXP221/AXP223/AXP809 GPIO support Jernej Škrabec
  2 siblings, 1 reply; 6+ messages in thread
From: Samuel Holland @ 2022-09-16  4:27 UTC (permalink / raw)
  To: Chen-Yu Tsai, Jernej Skrabec
  Cc: Samuel Holland, Krzysztof Kozlowski, Rob Herring, devicetree,
	linux-arm-kernel, linux-kernel, linux-sunxi

The "ldo-io0" and "ldo-io1" regulators are enabled/disabled by toggling
the pinmux between two functions. This happens in the regulator driver.
Setting the pinmux to "ldo" in the DT is inappropriate because it would
enable the regulator before the driver has a chance to set the correct
initial voltage.

Signed-off-by: Samuel Holland <samuel@sholland.org>
---

Changes in v3:
 - Added patch to remove existing "ldo" pinctrl nodes

 arch/arm/boot/dts/axp81x.dtsi             | 14 --------------
 arch/arm64/boot/dts/allwinner/axp803.dtsi | 10 ----------
 2 files changed, 24 deletions(-)

diff --git a/arch/arm/boot/dts/axp81x.dtsi b/arch/arm/boot/dts/axp81x.dtsi
index b93387b0c1c3..ebaf1c3ce8db 100644
--- a/arch/arm/boot/dts/axp81x.dtsi
+++ b/arch/arm/boot/dts/axp81x.dtsi
@@ -62,16 +62,6 @@ axp_gpio: gpio {
 		compatible = "x-powers,axp813-gpio";
 		gpio-controller;
 		#gpio-cells = <2>;
-
-		gpio0_ldo: gpio0-ldo-pin {
-			pins = "GPIO0";
-			function = "ldo";
-		};
-
-		gpio1_ldo: gpio1-ldo-pin {
-			pins = "GPIO1";
-			function = "ldo";
-		};
 	};
 
 	battery_power_supply: battery-power {
@@ -144,15 +134,11 @@ reg_fldo3: fldo3 {
 		};
 
 		reg_ldo_io0: ldo-io0 {
-			pinctrl-names = "default";
-			pinctrl-0 = <&gpio0_ldo>;
 			/* Disable by default to avoid conflicts with GPIO */
 			status = "disabled";
 		};
 
 		reg_ldo_io1: ldo-io1 {
-			pinctrl-names = "default";
-			pinctrl-0 = <&gpio1_ldo>;
 			/* Disable by default to avoid conflicts with GPIO */
 			status = "disabled";
 		};
diff --git a/arch/arm64/boot/dts/allwinner/axp803.dtsi b/arch/arm64/boot/dts/allwinner/axp803.dtsi
index 578ef368e2b4..a6b4b87f185d 100644
--- a/arch/arm64/boot/dts/allwinner/axp803.dtsi
+++ b/arch/arm64/boot/dts/allwinner/axp803.dtsi
@@ -25,16 +25,6 @@ axp_gpio: gpio {
 		compatible = "x-powers,axp803-gpio", "x-powers,axp813-gpio";
 		gpio-controller;
 		#gpio-cells = <2>;
-
-		gpio0_ldo: gpio0-ldo-pin {
-			pins = "GPIO0";
-			function = "ldo";
-		};
-
-		gpio1_ldo: gpio1-ldo-pin {
-			pins = "GPIO1";
-			function = "ldo";
-		};
 	};
 
 	battery_power_supply: battery-power {
-- 
2.35.1


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

* [PATCH v3 2/2] ARM: dts: axp22x/axp809: Add GPIO controller nodes
  2022-09-16  4:27 [PATCH v3 0/2] AXP221/AXP223/AXP809 GPIO support Samuel Holland
  2022-09-16  4:27 ` [PATCH v3 1/2] ARM: dts: axp803/axp81x: Drop GPIO LDO pinctrl nodes Samuel Holland
@ 2022-09-16  4:27 ` Samuel Holland
  2022-10-12 21:53   ` Jernej Škrabec
  2022-10-26 20:16 ` [PATCH v3 0/2] AXP221/AXP223/AXP809 GPIO support Jernej Škrabec
  2 siblings, 1 reply; 6+ messages in thread
From: Samuel Holland @ 2022-09-16  4:27 UTC (permalink / raw)
  To: Chen-Yu Tsai, Jernej Skrabec
  Cc: Samuel Holland, Krzysztof Kozlowski, Rob Herring, devicetree,
	linux-arm-kernel, linux-kernel, linux-sunxi

These PMICs all contain a GPIO controller. Now that the binding for this
variant is documented, wire up the controller in the device tree.

Signed-off-by: Samuel Holland <samuel@sholland.org>
---

Changes in v3:
 - Remove "ldo" pinctrl children from new nodes

 arch/arm/boot/dts/axp22x.dtsi | 6 ++++++
 arch/arm/boot/dts/axp809.dtsi | 7 +++++++
 2 files changed, 13 insertions(+)

diff --git a/arch/arm/boot/dts/axp22x.dtsi b/arch/arm/boot/dts/axp22x.dtsi
index a020c12b2884..f79650afd0a7 100644
--- a/arch/arm/boot/dts/axp22x.dtsi
+++ b/arch/arm/boot/dts/axp22x.dtsi
@@ -67,6 +67,12 @@ battery_power_supply: battery-power {
 		status = "disabled";
 	};
 
+	axp_gpio: gpio {
+		compatible = "x-powers,axp221-gpio";
+		gpio-controller;
+		#gpio-cells = <2>;
+	};
+
 	regulators {
 		/* Default work frequency for buck regulators */
 		x-powers,dcdc-freq = <3000>;
diff --git a/arch/arm/boot/dts/axp809.dtsi b/arch/arm/boot/dts/axp809.dtsi
index ab8e5f2d9246..d134d4c00bd8 100644
--- a/arch/arm/boot/dts/axp809.dtsi
+++ b/arch/arm/boot/dts/axp809.dtsi
@@ -50,4 +50,11 @@ &axp809 {
 	compatible = "x-powers,axp809";
 	interrupt-controller;
 	#interrupt-cells = <1>;
+
+	axp_gpio: gpio {
+		compatible = "x-powers,axp809-gpio",
+			     "x-powers,axp221-gpio";
+		gpio-controller;
+		#gpio-cells = <2>;
+	};
 };
-- 
2.35.1


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

* Re: [PATCH v3 2/2] ARM: dts: axp22x/axp809: Add GPIO controller nodes
  2022-09-16  4:27 ` [PATCH v3 2/2] ARM: dts: axp22x/axp809: Add GPIO controller nodes Samuel Holland
@ 2022-10-12 21:53   ` Jernej Škrabec
  0 siblings, 0 replies; 6+ messages in thread
From: Jernej Škrabec @ 2022-10-12 21:53 UTC (permalink / raw)
  To: Chen-Yu Tsai, Samuel Holland
  Cc: Samuel Holland, Krzysztof Kozlowski, Rob Herring, devicetree,
	linux-arm-kernel, linux-kernel, linux-sunxi

Hi Samuel,

Dne petek, 16. september 2022 ob 06:27:51 CEST je Samuel Holland napisal(a):
> These PMICs all contain a GPIO controller. Now that the binding for this
> variant is documented, wire up the controller in the device tree.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>

Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>

Best regards,
Jernej

> ---
> 
> Changes in v3:
>  - Remove "ldo" pinctrl children from new nodes
> 
>  arch/arm/boot/dts/axp22x.dtsi | 6 ++++++
>  arch/arm/boot/dts/axp809.dtsi | 7 +++++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/axp22x.dtsi b/arch/arm/boot/dts/axp22x.dtsi
> index a020c12b2884..f79650afd0a7 100644
> --- a/arch/arm/boot/dts/axp22x.dtsi
> +++ b/arch/arm/boot/dts/axp22x.dtsi
> @@ -67,6 +67,12 @@ battery_power_supply: battery-power {
>  		status = "disabled";
>  	};
> 
> +	axp_gpio: gpio {
> +		compatible = "x-powers,axp221-gpio";
> +		gpio-controller;
> +		#gpio-cells = <2>;
> +	};
> +
>  	regulators {
>  		/* Default work frequency for buck regulators */
>  		x-powers,dcdc-freq = <3000>;
> diff --git a/arch/arm/boot/dts/axp809.dtsi b/arch/arm/boot/dts/axp809.dtsi
> index ab8e5f2d9246..d134d4c00bd8 100644
> --- a/arch/arm/boot/dts/axp809.dtsi
> +++ b/arch/arm/boot/dts/axp809.dtsi
> @@ -50,4 +50,11 @@ &axp809 {
>  	compatible = "x-powers,axp809";
>  	interrupt-controller;
>  	#interrupt-cells = <1>;
> +
> +	axp_gpio: gpio {
> +		compatible = "x-powers,axp809-gpio",
> +			     "x-powers,axp221-gpio";
> +		gpio-controller;
> +		#gpio-cells = <2>;
> +	};
>  };
> --
> 2.35.1



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

* Re: [PATCH v3 1/2] ARM: dts: axp803/axp81x: Drop GPIO LDO pinctrl nodes
  2022-09-16  4:27 ` [PATCH v3 1/2] ARM: dts: axp803/axp81x: Drop GPIO LDO pinctrl nodes Samuel Holland
@ 2022-10-12 22:01   ` Jernej Škrabec
  0 siblings, 0 replies; 6+ messages in thread
From: Jernej Škrabec @ 2022-10-12 22:01 UTC (permalink / raw)
  To: Chen-Yu Tsai, Samuel Holland
  Cc: Samuel Holland, Krzysztof Kozlowski, Rob Herring, devicetree,
	linux-arm-kernel, linux-kernel, linux-sunxi

Hi Samuel,

Dne petek, 16. september 2022 ob 06:27:50 CEST je Samuel Holland napisal(a):
> The "ldo-io0" and "ldo-io1" regulators are enabled/disabled by toggling
> the pinmux between two functions. This happens in the regulator driver.
> Setting the pinmux to "ldo" in the DT is inappropriate because it would
> enable the regulator before the driver has a chance to set the correct
> initial voltage.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>

Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>

Best regards,
Jernej
> ---
> 
> Changes in v3:
>  - Added patch to remove existing "ldo" pinctrl nodes
> 
>  arch/arm/boot/dts/axp81x.dtsi             | 14 --------------
>  arch/arm64/boot/dts/allwinner/axp803.dtsi | 10 ----------
>  2 files changed, 24 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/axp81x.dtsi b/arch/arm/boot/dts/axp81x.dtsi
> index b93387b0c1c3..ebaf1c3ce8db 100644
> --- a/arch/arm/boot/dts/axp81x.dtsi
> +++ b/arch/arm/boot/dts/axp81x.dtsi
> @@ -62,16 +62,6 @@ axp_gpio: gpio {
>  		compatible = "x-powers,axp813-gpio";
>  		gpio-controller;
>  		#gpio-cells = <2>;
> -
> -		gpio0_ldo: gpio0-ldo-pin {
> -			pins = "GPIO0";
> -			function = "ldo";
> -		};
> -
> -		gpio1_ldo: gpio1-ldo-pin {
> -			pins = "GPIO1";
> -			function = "ldo";
> -		};
>  	};
> 
>  	battery_power_supply: battery-power {
> @@ -144,15 +134,11 @@ reg_fldo3: fldo3 {
>  		};
> 
>  		reg_ldo_io0: ldo-io0 {
> -			pinctrl-names = "default";
> -			pinctrl-0 = <&gpio0_ldo>;
>  			/* Disable by default to avoid conflicts with 
GPIO */
>  			status = "disabled";
>  		};
> 
>  		reg_ldo_io1: ldo-io1 {
> -			pinctrl-names = "default";
> -			pinctrl-0 = <&gpio1_ldo>;
>  			/* Disable by default to avoid conflicts with 
GPIO */
>  			status = "disabled";
>  		};
> diff --git a/arch/arm64/boot/dts/allwinner/axp803.dtsi
> b/arch/arm64/boot/dts/allwinner/axp803.dtsi index
> 578ef368e2b4..a6b4b87f185d 100644
> --- a/arch/arm64/boot/dts/allwinner/axp803.dtsi
> +++ b/arch/arm64/boot/dts/allwinner/axp803.dtsi
> @@ -25,16 +25,6 @@ axp_gpio: gpio {
>  		compatible = "x-powers,axp803-gpio", "x-powers,axp813-
gpio";
>  		gpio-controller;
>  		#gpio-cells = <2>;
> -
> -		gpio0_ldo: gpio0-ldo-pin {
> -			pins = "GPIO0";
> -			function = "ldo";
> -		};
> -
> -		gpio1_ldo: gpio1-ldo-pin {
> -			pins = "GPIO1";
> -			function = "ldo";
> -		};
>  	};
> 
>  	battery_power_supply: battery-power {
> --
> 2.35.1



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

* Re: [PATCH v3 0/2] AXP221/AXP223/AXP809 GPIO support
  2022-09-16  4:27 [PATCH v3 0/2] AXP221/AXP223/AXP809 GPIO support Samuel Holland
  2022-09-16  4:27 ` [PATCH v3 1/2] ARM: dts: axp803/axp81x: Drop GPIO LDO pinctrl nodes Samuel Holland
  2022-09-16  4:27 ` [PATCH v3 2/2] ARM: dts: axp22x/axp809: Add GPIO controller nodes Samuel Holland
@ 2022-10-26 20:16 ` Jernej Škrabec
  2 siblings, 0 replies; 6+ messages in thread
From: Jernej Škrabec @ 2022-10-26 20:16 UTC (permalink / raw)
  To: Chen-Yu Tsai, Samuel Holland
  Cc: Samuel Holland, Krzysztof Kozlowski, Rob Herring, devicetree,
	linux-arm-kernel, linux-kernel, linux-sunxi

Dne petek, 16. september 2022 ob 06:27:49 CEST je Samuel Holland napisal(a):
> This series hooks up the GPIO controller found in some older X-Powers
> PMICs. The main motivation is converting the U-Boot driver over to use
> devicetree, but Linux might as well gain support for the hardware too.
> 
> Changes in v3:
>  - Added patch to remove existing "ldo" pinctrl nodes
>  - Drop already-merged binding and driver patches
>  - Remove "ldo" pinctrl children from new nodes
> 
> Samuel Holland (2):
>   ARM: dts: axp803/axp81x: Drop GPIO LDO pinctrl nodes
>   ARM: dts: axp22x/axp809: Add GPIO controller nodes

Merged both, thanks!

Best regards,
Jernej

> 
>  arch/arm/boot/dts/axp22x.dtsi             |  6 ++++++
>  arch/arm/boot/dts/axp809.dtsi             |  7 +++++++
>  arch/arm/boot/dts/axp81x.dtsi             | 14 --------------
>  arch/arm64/boot/dts/allwinner/axp803.dtsi | 10 ----------
>  4 files changed, 13 insertions(+), 24 deletions(-)
> 
> --
> 2.35.1



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

end of thread, other threads:[~2022-10-26 20:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-16  4:27 [PATCH v3 0/2] AXP221/AXP223/AXP809 GPIO support Samuel Holland
2022-09-16  4:27 ` [PATCH v3 1/2] ARM: dts: axp803/axp81x: Drop GPIO LDO pinctrl nodes Samuel Holland
2022-10-12 22:01   ` Jernej Škrabec
2022-09-16  4:27 ` [PATCH v3 2/2] ARM: dts: axp22x/axp809: Add GPIO controller nodes Samuel Holland
2022-10-12 21:53   ` Jernej Škrabec
2022-10-26 20:16 ` [PATCH v3 0/2] AXP221/AXP223/AXP809 GPIO support Jernej Škrabec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).