Skip to contentSkip to conversation

ARM: shmobile: gose: Add GPIO keys and leds to DT

PATCH New Simon Horman 3 participants 5 messages Nov 18, 2015 – Dec 18, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover ARM: shmobile: gose: Add GPIO keys and leds to DT

Hi,

this short series adds GPIO keys and leds to the device tree of the r8a7793 based Gose board.

It uses the makes use of the recently addition of GPIO devices to the device tree of the r8a7793. Thanks Magnus!

I have booted a system with these changes and verified that the relevant entries appear to be present in sysfs.

I have not tested button press events or illumination of the leds as I do not currently have physical access to a Gose board.

Based on renesas-devel-20151118-v4.4-rc1

Simon Horman (2):
ARM: shmobile: gose: Add GPIO keys to DT
ARM: shmobile: gose: Add GPIO leds to DT

 arch/arm/boot/dts/r8a7793-gose.dts | 98 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 98 insertions(+)
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/2 ARM: shmobile: gose: Add GPIO keys to DT

Instantiate the GPIO keys in the gose device tree.

Based on similar work for the koelsch board by Laurent Pinchart.

Cc Laurent Pinchart <[email protected]>

---
* Compile Tested Only

---
 arch/arm/boot/dts/r8a7793-gose.dts | 82 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 82 insertions(+)
arch/arm/boot/dts/r8a7793-gose.dts +82 -0
index d842ce77b7c8..ff391d2fb767 100644
@@ -31,6 +31,88 @@
 		device_type = "memory";
 		reg = <0 0x40000000 0 0x40000000>;
 	};
+
+	gpio-keys {
+		compatible = "gpio-keys";
+
+		key-1 {
+		        gpios = <&gpio5 0 GPIO_ACTIVE_LOW>;
+		        linux,code = <KEY_1>;
+		        label = "SW2-1";
+		        gpio-key,wakeup;
+		        debounce-interval = <20>;
+		};
+		key-2 {
+		        gpios = <&gpio5 1 GPIO_ACTIVE_LOW>;
+		        linux,code = <KEY_2>;
+		        label = "SW2-2";
+		        gpio-key,wakeup;
+		        debounce-interval = <20>;
+		};
+		key-3 {
+		        gpios = <&gpio5 2 GPIO_ACTIVE_LOW>;
+		        linux,code = <KEY_3>;
+		        label = "SW2-3";
+		        gpio-key,wakeup;
+		        debounce-interval = <20>;
+		};
+		key-4 {
+		        gpios = <&gpio5 3 GPIO_ACTIVE_LOW>;
+		        linux,code = <KEY_4>;
+		        label = "SW2-4";
+		        gpio-key,wakeup;
+		        debounce-interval = <20>;
+		};
+		key-a {
+		        gpios = <&gpio7 0 GPIO_ACTIVE_LOW>;
+		        linux,code = <KEY_A>;
+		        label = "SW30";
+		        gpio-key,wakeup;
+		        debounce-interval = <20>;
+		};
+		key-b {
+		        gpios = <&gpio7 1 GPIO_ACTIVE_LOW>;
+		        linux,code = <KEY_B>;
+		        label = "SW31";
+		        gpio-key,wakeup;
+		        debounce-interval = <20>;
+		};
+		key-c {
+		        gpios = <&gpio7 2 GPIO_ACTIVE_LOW>;
+		        linux,code = <KEY_C>;
+		        label = "SW32";
+		        gpio-key,wakeup;
+		        debounce-interval = <20>;
+		};
+		key-d {
+		        gpios = <&gpio7 3 GPIO_ACTIVE_LOW>;
+		        linux,code = <KEY_D>;
+		        label = "SW33";
+		        gpio-key,wakeup;
+		        debounce-interval = <20>;
+		};
+		key-e {
+		        gpios = <&gpio7 4 GPIO_ACTIVE_LOW>;
+		        linux,code = <KEY_E>;
+		        label = "SW34";
+		        gpio-key,wakeup;
+		        debounce-interval = <20>;
+		};
+		key-f {
+		        gpios = <&gpio7 5 GPIO_ACTIVE_LOW>;
+		        linux,code = <KEY_F>;
+		        label = "SW35";
+		        gpio-key,wakeup;
+		        debounce-interval = <20>;
+		};
+		key-g {
+		        gpios = <&gpio7 6 GPIO_ACTIVE_LOW>;
+		        linux,code = <KEY_G>;
+		        label = "SW36";
+		        gpio-key,wakeup;
+		        debounce-interval = <20>;
+		};
+	};
 };
 
 &extal_clk {
Signature · 1 line
2.1.4
#2 lore raw

PATCH 2/2 ARM: shmobile: gose: Add GPIO leds to DT

In reply to Simon Horman

Instantiate the GPIO leds in the gose device tree.

Based on similar work for the koelsch board by Magnus Damm.

---
* Compile Tested Only

---
 arch/arm/boot/dts/r8a7793-gose.dts | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/arm/boot/dts/r8a7793-gose.dts +16 -0
index ff391d2fb767..7e1794736aa9 100644
@@ -113,6 +113,22 @@
 		        debounce-interval = <20>;
 		};
 	};
+
+	leds {
+		compatible = "gpio-leds";
+		led6 {
+			gpios = <&gpio2 19 GPIO_ACTIVE_HIGH>;
+			label = "LED6";
+		};
+		led7 {
+			gpios = <&gpio2 20 GPIO_ACTIVE_HIGH>;
+			label = "LED7";
+		};
+		led8 {
+			gpios = <&gpio2 21 GPIO_ACTIVE_HIGH>;
+			label = "LED8";
+		};
+	};
 };
 
 &extal_clk {
Signature · 1 line
2.1.4
#3 lore raw

cover ARM: shmobile: gose: Add GPIO keys and leds to DT

In reply to Simon Horman

Hi Simon,

Quoted 14 lines · Simon Horman

Hi,

this short series adds GPIO keys and leds to the device tree of the r8a7793 based Gose board.

It uses the makes use of the recently addition of GPIO devices to the device tree of the r8a7793. Thanks Magnus!

I have booted a system with these changes and verified that the relevant entries appear to be present in sysfs.

I have not tested button press events or illumination of the leds as I do not currently have physical access to a Gose board.

Quoted 8 lines

Based on renesas-devel-20151118-v4.4-rc1

Simon Horman (2):
ARM: shmobile: gose: Add GPIO keys to DT
ARM: shmobile: gose: Add GPIO leds to DT

 arch/arm/boot/dts/r8a7793-gose.dts | 98 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 98 insertions(+)

Thanks a lot for these patches! Very useful as basic a test environment for the r8a7793 GPIO device nodes.

So I've now managed to test the GPIO keys and LED devices on a physical Gose board. The LED6 -> LED 8 entries will be lit as expected by controlling brightness in /sys/class/leds/. The GPIO keys associated with buttons SW30 to SW36 and the dip switch SW2 all generate interrupts in /proc/interrupts on key press or dip switch change. All good!

Please queue up these changes. Feel free to add:

Cheers,

/ magnus

#4 lore raw

cover ARM: shmobile: gose: Add GPIO keys and leds to DT

Quoted 37 lines · Magnus Damm

Hi Simon,

Quoted 14 lines · Simon Horman

Hi,

this short series adds GPIO keys and leds to the device tree of the r8a7793 based Gose board.

It uses the makes use of the recently addition of GPIO devices to the device tree of the r8a7793. Thanks Magnus!

I have booted a system with these changes and verified that the relevant entries appear to be present in sysfs.

I have not tested button press events or illumination of the leds as I do not currently have physical access to a Gose board.

Quoted 8 lines

Based on renesas-devel-20151118-v4.4-rc1

Simon Horman (2):
ARM: shmobile: gose: Add GPIO keys to DT
ARM: shmobile: gose: Add GPIO leds to DT

 arch/arm/boot/dts/r8a7793-gose.dts | 98 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 98 insertions(+)

Thanks a lot for these patches! Very useful as basic a test environment for the r8a7793 GPIO device nodes.

So I've now managed to test the GPIO keys and LED devices on a physical Gose board. The LED6 -> LED 8 entries will be lit as expected by controlling brightness in /sys/class/leds/. The GPIO keys associated with buttons SW30 to SW36 and the dip switch SW2 all generate interrupts in /proc/interrupts on key press or dip switch change. All good!

Quoted 3 lines

Please queue up these changes. Feel free to add:

Thanks, I have queued these up for v4.6.