From fbca69683b4e2f35ef08b271aff1e0aa928c2b84 Mon Sep 17 00:00:00 2001
From: Tobias Schramm <tobias@t-sys.eu>
Date: Thu, 6 Feb 2020 14:55:38 +0100
Subject: [PATCH] arm64/dts: Split gpio-keys into separate nodes for power key
 and lid switch

Suggested by Will Springer. Allows selective disable of wakeup functionality
without killing e.g. screen blanking on lid close.
---
 .../boot/dts/rockchip/rk3399-pinebook-pro.dts      | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts
index 763ecd79d7923..92f70a048aaa2 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts
@@ -5,6 +5,7 @@
  */
 
 /dts-v1/;
+#include <dt-bindings/input/gpio-keys.h>
 #include <dt-bindings/input/linux-event-codes.h>
 #include <dt-bindings/pwm/pwm.h>
 #include <dt-bindings/usb/pd.h>
@@ -80,10 +81,12 @@ drm_logo: drm-logo@00000000 {
 		};
 	};
 
-	gpio-keys {
+	/* Use separate nodes for gpio-keys to enable selective deactivation of
+	   wakeup sources without disabling the whole key */
+	gpio-key-power {
 		compatible = "gpio-keys";
 		pinctrl-names = "default";
-		pinctrl-0 = <&pwrbtn &lidbtn>;
+		pinctrl-0 = <&pwrbtn>;
 
 		power {
 			debounce-interval = <20>;
@@ -92,6 +95,12 @@ power {
 			linux,code = <KEY_POWER>;
 			wakeup-source;
 		};
+	};
+
+	gpio-key-lid {
+		compatible = "gpio-keys";
+		pinctrl-names = "default";
+		pinctrl-0 = <&lidbtn>;
 
 		lid {
 			debounce-interval = <20>;
@@ -99,6 +108,7 @@ lid {
 			label = "Lid";
 			linux,code = <SW_LID>;
 			linux,input-type = <EV_SW>;
+			wakeup-event-action = <EV_ACT_DEASSERTED>;
 			wakeup-source;
 		};
 	};
-- 
GitLab