diff mbox series

[v2] arm64: dts: renesas: r8a779a0: falcon-cpu: Add SW46 switch support

Message ID 20211025130457.935122-1-kieran.bingham+renesas@ideasonboard.com (mailing list archive)
State Under Review
Delegated to: Geert Uytterhoeven
Headers show
Series [v2] arm64: dts: renesas: r8a779a0: falcon-cpu: Add SW46 switch support | expand

Commit Message

Kieran Bingham Oct. 25, 2021, 1:04 p.m. UTC
From: Kieran Bingham <kieran.bingham@ideasonboard.com>

Add support for SW46-1 and SW46-2 as switches using the gpio-keys
framework.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
v2:
 - Don't adjust the pin-config bias

SW_LID and SW_DOCK are selected as low-impact switch events for the
default configuration. Would SW_RFKILL_ALL, and SW_MUTE_DEVICE be
preferred as more 'functional' defaults? (I have otherwise avoided these
to hopefully prevent unwanted / undocumented effects occuring on
development hardware running a full interface which may parse these)

I'd expect them to be overridden by any platform using them anyway.

Testing this with evtest on the board shows this:

	kbingham@falcon-v3u:~$ sudo evtest /dev/input/by-path/platform-keys-event
	Input driver version is 1.0.1
	Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
	Input device name: "keys"
	Supported events:
	  Event type 0 (EV_SYN)
	  Event type 1 (EV_KEY)
	    Event code 2 (KEY_1)
	    Event code 3 (KEY_2)
	    Event code 4 (KEY_3)
	  Event type 5 (EV_SW)
	    Event code 0 (SW_LID) state 0
	    Event code 5 (SW_DOCK) state 0
	Properties:
	Testing ... (interrupt to exit)
	Event: time 1635166698.832665, type 5 (EV_SW), code 5 (SW_DOCK), value 1
	Event: time 1635166698.832665, -------------- SYN_REPORT ------------
	Event: time 1635166701.661119, type 5 (EV_SW), code 0 (SW_LID), value 1
	Event: time 1635166701.661119, -------------- SYN_REPORT ------------
	Event: time 1635166711.453056, type 5 (EV_SW), code 5 (SW_DOCK), value 0
	Event: time 1635166711.453056, -------------- SYN_REPORT ------------
	Event: time 1635166712.791572, type 5 (EV_SW), code 0 (SW_LID), value 0
	Event: time 1635166712.791572, -------------- SYN_REPORT ------------

 .../boot/dts/renesas/r8a779a0-falcon-cpu.dtsi  | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/renesas/r8a779a0-falcon-cpu.dtsi b/arch/arm64/boot/dts/renesas/r8a779a0-falcon-cpu.dtsi
index 1fe0cf0dcc99..0ca21a057530 100644
--- a/arch/arm64/boot/dts/renesas/r8a779a0-falcon-cpu.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a779a0-falcon-cpu.dtsi
@@ -83,6 +83,24 @@  keys {
 		pinctrl-0 = <&keys_pins>;
 		pinctrl-names = "default";
 
+		sw-1 {
+			gpios = <&gpio1 28 GPIO_ACTIVE_LOW>;
+			linux,code = <SW_LID>;
+			linux,input-type = <EV_SW>;
+			label = "SW46-1";
+			wakeup-source;
+			debounce-interval = <20>;
+		};
+
+		sw-2 {
+			gpios = <&gpio1 29 GPIO_ACTIVE_LOW>;
+			linux,code = <SW_DOCK>;
+			linux,input-type = <EV_SW>;
+			label = "SW46-2";
+			wakeup-source;
+			debounce-interval = <20>;
+		};
+
 		key-1 {
 			gpios = <&gpio6 18 GPIO_ACTIVE_LOW>;
 			linux,code = <KEY_1>;