Skip to contentSkip to conversation

ARM: dts: rcar2: Configure pull up for GPIO keys

PATCH In review Geert Uytterhoeven 3 participants 8 messages Apr 30, 2021 – May 25, 2021 Device tree bindings

lore
Share & tools
lore
#0 lore raw

cover ARM: dts: rcar2: Configure pull up for GPIO keys

Hi all,

This patches series follows up on the work started with "[PATCH] ARM:
dts: koelsch: Configure pull-up for SOFT_SW GPIO keys"[1], and explicitly configures pull-ups for pins used for GPIO keys without external pull-up resistors on R-Car Gen2 boards, preceded by a small cleanup. Currently GPIO keys rely on the initial states of these pins, which fortunately match the expectations, but it is better to be explicit.

To actually make a difference, this depends on "[PATCH 00/12] pinctrl:
renesas: Add more bias pinconf support"[2]. Note that it is safe to apply this series before [2] has landed, as pinctrl_bind_pins() does not consider -ENOTSUPP a fatal error.

It would be great if people with access to the hardware could do similar tests like I did on Koelsch[3].

I hope to queue this in renesas-devel for v5.14.

Thanks for your comments!

[1] https://lore.kernel.org/r/[email protected]/
[2] https://lore.kernel.org/r/[email protected]/
[3] https://lore.kernel.org/r/[email protected]

Geert Uytterhoeven (5):
ARM: dts: koelsch: Rename sw2 to keyboard
ARM: dts: lager: Configure pull-up for SOFT_SW GPIO keys
ARM: dts: blanche: Configure pull-up for SOFT_SW and SW25 GPIO keys
ARM: dts: gose: Configure pull-up for SOFT_SW GPIO keys
ARM: dts: silk: Configure pull-up for SOFT_SW GPIO keys

 arch/arm/boot/dts/r8a7790-lager.dts   |  8 ++++++++
 arch/arm/boot/dts/r8a7791-koelsch.dts |  4 ++--
 arch/arm/boot/dts/r8a7792-blanche.dts |  8 ++++++++
 arch/arm/boot/dts/r8a7793-gose.dts    | 10 +++++++++-
 arch/arm/boot/dts/r8a7794-silk.dts    | 10 +++++++++-
 5 files changed, 36 insertions(+), 4 deletions(-)
Signature · 12 lines
2.25.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds
#1 lore raw

PATCH 1/5 ARM: dts: koelsch: Rename sw2 to keyboard

Rename "sw2_pins" and "sw2" to "keyboard_pins" resp. "keyboard", to comply with generic name recommendations.

---
 arch/arm/boot/dts/r8a7791-koelsch.dts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/r8a7791-koelsch.dts +2 -2
index 61e881bbbf6ee5aa..2a8b6fd9095cceba 100644
@@ -81,7 +81,7 @@ lbsc {
 	keyboard {
 		compatible = "gpio-keys";
 
-		pinctrl-0 = <&sw2_pins>;
+		pinctrl-0 = <&keyboard_pins>;
 		pinctrl-names = "default";
 
 		key-1 {
@@ -622,7 +622,7 @@ sound_clk_pins: sound_clk {
 		function = "audio_clk";
 	};
 
-	sw2_pins: sw2 {
+	keyboard_pins: keyboard {
 		pins = "GP_5_0", "GP_5_1", "GP_5_2", "GP_5_3";
 		bias-pull-up;
 	};
Signature · 1 line
2.25.1
Reviewed-by on v1 1/5
#2 lore raw

Re: [PATCH 1/5] ARM: dts: koelsch: Rename sw2 to keyboard

Hi Geert,

Thanks for your work.

Quoted 4 lines · Geert Uytterhoeven

Rename "sw2_pins" and "sw2" to "keyboard_pins" resp. "keyboard", to comply with generic name recommendations.

Quoted 29 lines
---
 arch/arm/boot/dts/r8a7791-koelsch.dts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/r8a7791-koelsch.dts +2 -2
index 61e881bbbf6ee5aa..2a8b6fd9095cceba 100644
@@ -81,7 +81,7 @@ lbsc {
 	keyboard {
 		compatible = "gpio-keys";
 
-		pinctrl-0 = <&sw2_pins>;
+		pinctrl-0 = <&keyboard_pins>;
 		pinctrl-names = "default";
 
 		key-1 {
@@ -622,7 +622,7 @@ sound_clk_pins: sound_clk {
 		function = "audio_clk";
 	};
 
-	sw2_pins: sw2 {
+	keyboard_pins: keyboard {
 		pins = "GP_5_0", "GP_5_1", "GP_5_2", "GP_5_3";
 		bias-pull-up;
 	};
Signature · 1 line
2.25.1
Signature · 2 lines
Regards,
Niklas Söderlund
#3 lore raw

PATCH 2/5 ARM: dts: lager: Configure pull-up for SOFT_SW GPIO keys

In reply to Geert Uytterhoeven

The GPIO pins connected to the 4 Software Switches (SW2) do not have external pull-up resistors, but rely on internal pull-ups being enabled. Fortunately this is satisfied by the initial state of these pins.

Make this explicit by enabling bias-pull-up, to remove the dependency on initial state and/or boot loader configuration.

---
 arch/arm/boot/dts/r8a7790-lager.dts | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/boot/dts/r8a7790-lager.dts +8 -0
index 2dad0742d2ba159b..fa6d986b5d4632cf 100644
@@ -81,6 +81,9 @@ lbsc {
 	keyboard {
 		compatible = "gpio-keys";
 
+		pinctrl-0 = <&keyboard_pins>;
+		pinctrl-names = "default";
+
 		one {
 			linux,code = <KEY_1>;
 			label = "SW2-1";
@@ -659,6 +662,11 @@ sound_clk_pins: sound_clk {
 		groups = "audio_clk_a";
 		function = "audio_clk";
 	};
+
+	keyboard_pins: keyboard {
+		pins = "GP_1_14", "GP_1_24", "GP_1_26", "GP_1_28";
+		bias-pull-up;
+	};
 };
 
 &ether {
Signature · 1 line
2.25.1
Reviewed-by Tested-by on v1 2/5
#4 lore raw

Re: [PATCH 2/5] ARM: dts: lager: Configure pull-up for SOFT_SW GPIO keys

Quoted 8 lines · Geert Uytterhoeven

The GPIO pins connected to the 4 Software Switches (SW2) do not have external pull-up resistors, but rely on internal pull-ups being enabled. Fortunately this is satisfied by the initial state of these pins.

Make this explicit by enabling bias-pull-up, to remove the dependency on initial state and/or boot loader configuration.

Works fine on my Lager board:

#5 lore raw

PATCH 3/5 ARM: dts: blanche: Configure pull-up for SOFT_SW and SW25 GPIO keys

In reply to Geert Uytterhoeven

The GPIO pins connected to the 4 Software Switches (SW2) and the second Tact Switch (SW25) do not have external pull-up resistors, but rely on internal pull-ups being enabled. Fortunately this is satisfied by the initial state of these pins.

Make this explicit by enabling bias-pull-up, to remove the dependency on initial state and/or boot loader configuration.

Note that the GPIO pin connected to the first Tact Switch (SW24) does have an external pull-up resistor.

---
 arch/arm/boot/dts/r8a7792-blanche.dts | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/boot/dts/r8a7792-blanche.dts +8 -0
index c100ae903a46bb1c..62aa9f61321bea74 100644
@@ -112,6 +112,9 @@ x2_clk: x2 {
 	keyboard {
 		compatible = "gpio-keys";
 
+		pinctrl-0 = <&keyboard_pins>;
+		pinctrl-names = "default";
+
 		key-1 {
 			linux,code = <KEY_1>;
 			label = "SW2-1";
@@ -235,6 +238,11 @@ du1_pins: du1 {
 		function = "du1";
 	};
 
+	keyboard_pins: keyboard {
+		pins = "GP_3_10", "GP_3_11", "GP_3_12", "GP_3_15", "GP_11_02";
+		bias-pull-up;
+	};
+
 	pmic_irq_pins: pmicirq {
 		groups = "intc_irq2";
 		function = "intc";
Signature · 1 line
2.25.1
#6 lore raw

PATCH 4/5 ARM: dts: gose: Configure pull-up for SOFT_SW GPIO keys

In reply to Geert Uytterhoeven

The GPIO pins connected to the 4 Software Switches ("SOFT_SW", SW2) do not have external pull-up resistors, but rely on internal pull-ups being enabled. Fortunately this is satisfied by the initial state of these pins.

Make this explicit by enabling bias-pull-up, to remove the dependency on initial state and/or boot loader configuration.

While at it, rename the surrounding device node from "gpio-keys" to "keyboard", to comply with generic node name recommendations.

---
 arch/arm/boot/dts/r8a7793-gose.dts | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
arch/arm/boot/dts/r8a7793-gose.dts +9 -1
index 87fa57a99399b73d..479e0fdf0c37311e 100644
@@ -64,9 +64,12 @@ memory@40000000 {
 		reg = <0 0x40000000 0 0x40000000>;
 	};
 
-	gpio-keys {
+	keyboard {
 		compatible = "gpio-keys";
 
+		pinctrl-0 = <&keyboard_pins>;
+		pinctrl-names = "default";
+
 		key-1 {
 			gpios = <&gpio5 0 GPIO_ACTIVE_LOW>;
 			linux,code = <KEY_1>;
@@ -567,6 +570,11 @@ sound_clk_pins: sound_clk {
 		function = "audio_clk";
 	};
 
+	keyboard_pins: keyboard {
+		pins = "GP_5_0", "GP_5_1", "GP_5_2", "GP_5_3";
+		bias-pull-up;
+	};
+
 	vin0_pins: vin0 {
 		groups = "vin0_data24", "vin0_sync", "vin0_clkenb", "vin0_clk";
 		function = "vin0";
Signature · 1 line
2.25.1
#7 lore raw

PATCH 5/5 ARM: dts: silk: Configure pull-up for SOFT_SW GPIO keys

In reply to Geert Uytterhoeven

The GPIO pins connected to the 4 Software Switches ("SOFT_SW", SW12) do not have external pull-up resistors, but rely on internal pull-ups being enabled. Fortunately this is satisfied by the initial state of these pins.

Make this explicit by enabling bias-pull-up, to remove the dependency on initial state and/or boot loader configuration.

While at it, rename the surrounding device node from "gpio-keys" to "keyboard", to comply with generic node name recommendations.

---
 arch/arm/boot/dts/r8a7794-silk.dts | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
arch/arm/boot/dts/r8a7794-silk.dts +9 -1
index eb89a27a6ed0c9aa..cafa3046daa4baf4 100644
@@ -45,9 +45,12 @@ memory@40000000 {
 		reg = <0 0x40000000 0 0x40000000>;
 	};
 
-	gpio-keys {
+	keyboard {
 		compatible = "gpio-keys";
 
+		pinctrl-0 = <&keyboard_pins>;
+		pinctrl-names = "default";
+
 		key-3 {
 			gpios = <&gpio5 10 GPIO_ACTIVE_LOW>;
 			linux,code = <KEY_3>;
@@ -358,6 +361,11 @@ du1_pins: du1 {
 		function = "du1";
 	};
 
+	keyboard_pins: keyboard {
+		pins = "GP_3_9", "GP_3_10", "GP_3_11", "GP_3_12";
+		bias-pull-up;
+	};
+
 	ssi_pins: sound {
 		groups = "ssi0129_ctrl", "ssi0_data", "ssi1_data";
 		function = "ssi";
Signature · 1 line
2.25.1