linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] AXP221/AXP223/AXP809 GPIO support
@ 2022-06-16  6:09 Samuel Holland
  2022-06-16  6:09 ` [PATCH 1/4] dt-bindings: gpio: Add AXP221/AXP223/AXP809 compatibles Samuel Holland
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Samuel Holland @ 2022-06-16  6:09 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Linus Walleij, linux-gpio
  Cc: Krzysztof Kozlowski, devicetree, Rob Herring, Samuel Holland,
	Bartosz Golaszewski, linux-kernel

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.


Samuel Holland (4):
  dt-bindings: gpio: Add AXP221/AXP223/AXP809 compatibles
  mfd: axp20x: Add AXP221/AXP223/AXP809 GPIO cells
  pinctrl: axp209: Support the AXP221/AXP223/AXP809 variant
  ARM: dts: axp22x/axp809: Add GPIO controller nodes

 .../bindings/gpio/x-powers,axp209-gpio.yaml   |  7 +++++++
 arch/arm/boot/dts/axp22x.dtsi                 | 18 ++++++++++++++++++
 arch/arm/boot/dts/axp809.dtsi                 | 19 +++++++++++++++++++
 drivers/mfd/axp20x.c                          |  9 +++++++++
 drivers/pinctrl/pinctrl-axp209.c              | 14 +++++++++++---
 5 files changed, 64 insertions(+), 3 deletions(-)

-- 
2.35.1


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

* [PATCH 1/4] dt-bindings: gpio: Add AXP221/AXP223/AXP809 compatibles
  2022-06-16  6:09 [PATCH 0/4] AXP221/AXP223/AXP809 GPIO support Samuel Holland
@ 2022-06-16  6:09 ` Samuel Holland
  2022-06-16 13:57   ` Krzysztof Kozlowski
  2022-06-16  6:09 ` [PATCH 2/4] mfd: axp20x: Add AXP221/AXP223/AXP809 GPIO cells Samuel Holland
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Samuel Holland @ 2022-06-16  6:09 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Linus Walleij, linux-gpio
  Cc: Krzysztof Kozlowski, devicetree, Rob Herring, Samuel Holland,
	Bartosz Golaszewski, linux-kernel

These PMICs each have 2 GPIOs with the same register layout as AXP813,
but without an ADC function.

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

 .../devicetree/bindings/gpio/x-powers,axp209-gpio.yaml     | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/gpio/x-powers,axp209-gpio.yaml b/Documentation/devicetree/bindings/gpio/x-powers,axp209-gpio.yaml
index 0f628b088cec..6faa3ef28960 100644
--- a/Documentation/devicetree/bindings/gpio/x-powers,axp209-gpio.yaml
+++ b/Documentation/devicetree/bindings/gpio/x-powers,axp209-gpio.yaml
@@ -19,7 +19,14 @@ properties:
     oneOf:
       - enum:
           - x-powers,axp209-gpio
+          - x-powers,axp221-gpio
           - x-powers,axp813-gpio
+      - items:
+          - const: x-powers,axp223-gpio
+          - const: x-powers,axp221-gpio
+      - items:
+          - const: x-powers,axp809-gpio
+          - const: x-powers,axp221-gpio
       - items:
           - const: x-powers,axp803-gpio
           - const: x-powers,axp813-gpio
-- 
2.35.1


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

* [PATCH 2/4] mfd: axp20x: Add AXP221/AXP223/AXP809 GPIO cells
  2022-06-16  6:09 [PATCH 0/4] AXP221/AXP223/AXP809 GPIO support Samuel Holland
  2022-06-16  6:09 ` [PATCH 1/4] dt-bindings: gpio: Add AXP221/AXP223/AXP809 compatibles Samuel Holland
@ 2022-06-16  6:09 ` Samuel Holland
  2022-06-27 16:24   ` Lee Jones
  2022-06-16  6:09 ` [PATCH 3/4] pinctrl: axp209: Support the AXP221/AXP223/AXP809 variant Samuel Holland
  2022-06-16  6:09 ` [PATCH 4/4] ARM: dts: axp22x/axp809: Add GPIO controller nodes Samuel Holland
  3 siblings, 1 reply; 9+ messages in thread
From: Samuel Holland @ 2022-06-16  6:09 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Linus Walleij, linux-gpio
  Cc: Krzysztof Kozlowski, devicetree, Rob Herring, Samuel Holland,
	Bartosz Golaszewski, linux-kernel

These PMICs all contain a compatible GPIO controller.

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

 drivers/mfd/axp20x.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 8161a5dc68e8..88a212a8168c 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -619,6 +619,9 @@ static const struct mfd_cell axp20x_cells[] = {
 
 static const struct mfd_cell axp221_cells[] = {
 	{
+		.name		= "axp20x-gpio",
+		.of_compatible	= "x-powers,axp221-gpio",
+	}, {
 		.name		= "axp221-pek",
 		.num_resources	= ARRAY_SIZE(axp22x_pek_resources),
 		.resources	= axp22x_pek_resources,
@@ -645,6 +648,9 @@ static const struct mfd_cell axp221_cells[] = {
 
 static const struct mfd_cell axp223_cells[] = {
 	{
+		.name		= "axp20x-gpio",
+		.of_compatible	= "x-powers,axp221-gpio",
+	}, {
 		.name		= "axp221-pek",
 		.num_resources	= ARRAY_SIZE(axp22x_pek_resources),
 		.resources	= axp22x_pek_resources,
@@ -785,6 +791,9 @@ static const struct mfd_cell axp806_cells[] = {
 
 static const struct mfd_cell axp809_cells[] = {
 	{
+		.name		= "axp20x-gpio",
+		.of_compatible	= "x-powers,axp221-gpio",
+	}, {
 		.name		= "axp221-pek",
 		.num_resources	= ARRAY_SIZE(axp809_pek_resources),
 		.resources	= axp809_pek_resources,
-- 
2.35.1


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

* [PATCH 3/4] pinctrl: axp209: Support the AXP221/AXP223/AXP809 variant
  2022-06-16  6:09 [PATCH 0/4] AXP221/AXP223/AXP809 GPIO support Samuel Holland
  2022-06-16  6:09 ` [PATCH 1/4] dt-bindings: gpio: Add AXP221/AXP223/AXP809 compatibles Samuel Holland
  2022-06-16  6:09 ` [PATCH 2/4] mfd: axp20x: Add AXP221/AXP223/AXP809 GPIO cells Samuel Holland
@ 2022-06-16  6:09 ` Samuel Holland
  2022-06-25 23:29   ` Linus Walleij
  2022-06-26 12:54   ` Chen-Yu Tsai
  2022-06-16  6:09 ` [PATCH 4/4] ARM: dts: axp22x/axp809: Add GPIO controller nodes Samuel Holland
  3 siblings, 2 replies; 9+ messages in thread
From: Samuel Holland @ 2022-06-16  6:09 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Linus Walleij, linux-gpio
  Cc: Krzysztof Kozlowski, devicetree, Rob Herring, Samuel Holland,
	Bartosz Golaszewski, linux-kernel

These PMICs each have 2 GPIOs with the same register layout as AXP813,
but without an ADC function. They all fall back to the AXP221 compatible
string, so only that one needs to be listed in the driver.

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

 drivers/pinctrl/pinctrl-axp209.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c
index 207cbae3a7bf..7ab20ac15391 100644
--- a/drivers/pinctrl/pinctrl-axp209.c
+++ b/drivers/pinctrl/pinctrl-axp209.c
@@ -73,7 +73,7 @@ static const struct pinctrl_pin_desc axp209_pins[] = {
 	PINCTRL_PIN(2, "GPIO2"),
 };
 
-static const struct pinctrl_pin_desc axp813_pins[] = {
+static const struct pinctrl_pin_desc axp22x_pins[] = {
 	PINCTRL_PIN(0, "GPIO0"),
 	PINCTRL_PIN(1, "GPIO1"),
 };
@@ -87,9 +87,16 @@ static const struct axp20x_pctrl_desc axp20x_data = {
 	.adc_mux = AXP20X_MUX_ADC,
 };
 
+static const struct axp20x_pctrl_desc axp22x_data = {
+	.pins	= axp22x_pins,
+	.npins	= ARRAY_SIZE(axp22x_pins),
+	.ldo_mask = BIT(0) | BIT(1),
+	.gpio_status_offset = 0,
+};
+
 static const struct axp20x_pctrl_desc axp813_data = {
-	.pins	= axp813_pins,
-	.npins	= ARRAY_SIZE(axp813_pins),
+	.pins	= axp22x_pins,
+	.npins	= ARRAY_SIZE(axp22x_pins),
 	.ldo_mask = BIT(0) | BIT(1),
 	.adc_mask = BIT(0),
 	.gpio_status_offset = 0,
@@ -388,6 +395,7 @@ static int axp20x_build_funcs_groups(struct platform_device *pdev)
 
 static const struct of_device_id axp20x_pctl_match[] = {
 	{ .compatible = "x-powers,axp209-gpio", .data = &axp20x_data, },
+	{ .compatible = "x-powers,axp221-gpio", .data = &axp22x_data, },
 	{ .compatible = "x-powers,axp813-gpio", .data = &axp813_data, },
 	{ }
 };
-- 
2.35.1


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

* [PATCH 4/4] ARM: dts: axp22x/axp809: Add GPIO controller nodes
  2022-06-16  6:09 [PATCH 0/4] AXP221/AXP223/AXP809 GPIO support Samuel Holland
                   ` (2 preceding siblings ...)
  2022-06-16  6:09 ` [PATCH 3/4] pinctrl: axp209: Support the AXP221/AXP223/AXP809 variant Samuel Holland
@ 2022-06-16  6:09 ` Samuel Holland
  3 siblings, 0 replies; 9+ messages in thread
From: Samuel Holland @ 2022-06-16  6:09 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Linus Walleij, linux-gpio
  Cc: Krzysztof Kozlowski, devicetree, Rob Herring, Samuel Holland,
	Bartosz Golaszewski, linux-kernel

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

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

 arch/arm/boot/dts/axp22x.dtsi | 18 ++++++++++++++++++
 arch/arm/boot/dts/axp809.dtsi | 19 +++++++++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/arch/arm/boot/dts/axp22x.dtsi b/arch/arm/boot/dts/axp22x.dtsi
index a020c12b2884..5c233c84be92 100644
--- a/arch/arm/boot/dts/axp22x.dtsi
+++ b/arch/arm/boot/dts/axp22x.dtsi
@@ -67,6 +67,24 @@ battery_power_supply: battery-power {
 		status = "disabled";
 	};
 
+	axp_gpio: gpio {
+		compatible = "x-powers,axp221-gpio";
+		gpio-controller;
+		#gpio-cells = <2>;
+
+		/omit-if-no-ref/
+		gpio0_ldo: gpio0-ldo-pin {
+			pins = "GPIO0";
+			function = "ldo";
+		};
+
+		/omit-if-no-ref/
+		gpio1_ldo: gpio1-ldo-pin {
+			pins = "GPIO1";
+			function = "ldo";
+		};
+	};
+
 	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..da92b105f3b0 100644
--- a/arch/arm/boot/dts/axp809.dtsi
+++ b/arch/arm/boot/dts/axp809.dtsi
@@ -50,4 +50,23 @@ &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>;
+
+		/omit-if-no-ref/
+		gpio0_ldo: gpio0-ldo-pin {
+			pins = "GPIO0";
+			function = "ldo";
+		};
+
+		/omit-if-no-ref/
+		gpio1_ldo: gpio1-ldo-pin {
+			pins = "GPIO1";
+			function = "ldo";
+		};
+	};
 };
-- 
2.35.1


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

* Re: [PATCH 1/4] dt-bindings: gpio: Add AXP221/AXP223/AXP809 compatibles
  2022-06-16  6:09 ` [PATCH 1/4] dt-bindings: gpio: Add AXP221/AXP223/AXP809 compatibles Samuel Holland
@ 2022-06-16 13:57   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2022-06-16 13:57 UTC (permalink / raw)
  To: Samuel Holland, Chen-Yu Tsai, Lee Jones, Linus Walleij, linux-gpio
  Cc: Krzysztof Kozlowski, devicetree, Rob Herring,
	Bartosz Golaszewski, linux-kernel

On 15/06/2022 23:09, Samuel Holland wrote:
> These PMICs each have 2 GPIOs with the same register layout as AXP813,
> but without an ADC function.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
> 
>  .../devicetree/bindings/gpio/x-powers,axp209-gpio.yaml     | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/gpio/x-powers,axp209-gpio.yaml b/Documentation/devicetree/bindings/gpio/x-powers,axp209-gpio.yaml
> index 0f628b088cec..6faa3ef28960 100644
> --- a/Documentation/devicetree/bindings/gpio/x-powers,axp209-gpio.yaml
> +++ b/Documentation/devicetree/bindings/gpio/x-powers,axp209-gpio.yaml
> @@ -19,7 +19,14 @@ properties:
>      oneOf:
>        - enum:
>            - x-powers,axp209-gpio
> +          - x-powers,axp221-gpio
>            - x-powers,axp813-gpio
> +      - items:
> +          - const: x-powers,axp223-gpio
> +          - const: x-powers,axp221-gpio
> +      - items:
> +          - const: x-powers,axp809-gpio

This is just an enum with 223 and 809. No need for two separate entries
here.

> +          - const: x-powers,axp221-gpio
>        - items:
>            - const: x-powers,axp803-gpio
>            - const: x-powers,axp813-gpio


Best regards,
Krzysztof

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

* Re: [PATCH 3/4] pinctrl: axp209: Support the AXP221/AXP223/AXP809 variant
  2022-06-16  6:09 ` [PATCH 3/4] pinctrl: axp209: Support the AXP221/AXP223/AXP809 variant Samuel Holland
@ 2022-06-25 23:29   ` Linus Walleij
  2022-06-26 12:54   ` Chen-Yu Tsai
  1 sibling, 0 replies; 9+ messages in thread
From: Linus Walleij @ 2022-06-25 23:29 UTC (permalink / raw)
  To: Samuel Holland
  Cc: Chen-Yu Tsai, Lee Jones, linux-gpio, Krzysztof Kozlowski,
	devicetree, Rob Herring, Bartosz Golaszewski, linux-kernel

On Thu, Jun 16, 2022 at 8:09 AM Samuel Holland <samuel@sholland.org> wrote:

> These PMICs each have 2 GPIOs with the same register layout as AXP813,
> but without an ADC function. They all fall back to the AXP221 compatible
> string, so only that one needs to be listed in the driver.
>
> Signed-off-by: Samuel Holland <samuel@sholland.org>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

* Re: [PATCH 3/4] pinctrl: axp209: Support the AXP221/AXP223/AXP809 variant
  2022-06-16  6:09 ` [PATCH 3/4] pinctrl: axp209: Support the AXP221/AXP223/AXP809 variant Samuel Holland
  2022-06-25 23:29   ` Linus Walleij
@ 2022-06-26 12:54   ` Chen-Yu Tsai
  1 sibling, 0 replies; 9+ messages in thread
From: Chen-Yu Tsai @ 2022-06-26 12:54 UTC (permalink / raw)
  To: Samuel Holland
  Cc: Lee Jones, Linus Walleij, open list:GPIO SUBSYSTEM,
	Krzysztof Kozlowski, devicetree, Rob Herring,
	Bartosz Golaszewski, linux-kernel

On Thu, Jun 16, 2022 at 2:09 PM Samuel Holland <samuel@sholland.org> wrote:
>
> These PMICs each have 2 GPIOs with the same register layout as AXP813,
> but without an ADC function. They all fall back to the AXP221 compatible
> string, so only that one needs to be listed in the driver.
>
> Signed-off-by: Samuel Holland <samuel@sholland.org>

Reviewed-by: Chen-Yu Tsai <wens@csie.org>

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

* Re: [PATCH 2/4] mfd: axp20x: Add AXP221/AXP223/AXP809 GPIO cells
  2022-06-16  6:09 ` [PATCH 2/4] mfd: axp20x: Add AXP221/AXP223/AXP809 GPIO cells Samuel Holland
@ 2022-06-27 16:24   ` Lee Jones
  0 siblings, 0 replies; 9+ messages in thread
From: Lee Jones @ 2022-06-27 16:24 UTC (permalink / raw)
  To: Samuel Holland
  Cc: Chen-Yu Tsai, Linus Walleij, linux-gpio, Krzysztof Kozlowski,
	devicetree, Rob Herring, Bartosz Golaszewski, linux-kernel

On Thu, 16 Jun 2022, Samuel Holland wrote:

> These PMICs all contain a compatible GPIO controller.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
> 
>  drivers/mfd/axp20x.c | 9 +++++++++
>  1 file changed, 9 insertions(+)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Principal Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

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

end of thread, other threads:[~2022-06-27 16:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-16  6:09 [PATCH 0/4] AXP221/AXP223/AXP809 GPIO support Samuel Holland
2022-06-16  6:09 ` [PATCH 1/4] dt-bindings: gpio: Add AXP221/AXP223/AXP809 compatibles Samuel Holland
2022-06-16 13:57   ` Krzysztof Kozlowski
2022-06-16  6:09 ` [PATCH 2/4] mfd: axp20x: Add AXP221/AXP223/AXP809 GPIO cells Samuel Holland
2022-06-27 16:24   ` Lee Jones
2022-06-16  6:09 ` [PATCH 3/4] pinctrl: axp209: Support the AXP221/AXP223/AXP809 variant Samuel Holland
2022-06-25 23:29   ` Linus Walleij
2022-06-26 12:54   ` Chen-Yu Tsai
2022-06-16  6:09 ` [PATCH 4/4] ARM: dts: axp22x/axp809: Add GPIO controller nodes Samuel Holland

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).