arm64: dts: qcom: c630: Expose LID events
authorBjorn Andersson <bjorn.andersson@linaro.org>
Wed, 25 Nov 2020 06:08:38 +0000 (00:08 -0600)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Mon, 30 Nov 2020 16:42:44 +0000 (10:42 -0600)
The LID state can be read from GPIO 124 and the "tablet mode" from GPIO
95, expose these to the system using gpio-keys and mark the falling edge
of the LID state as a wakeup-source - to wake the system from suspend.

Tested-by: Steev Klimaszewski <steev@kali.org>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Link: https://lore.kernel.org/r/20201125060838.165576-1-bjorn.andersson@linaro.org
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts

index f5b9884..3850e74 100644 (file)
@@ -8,6 +8,8 @@
 /dts-v1/;
 
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/gpio-keys.h>
+#include <dt-bindings/input/input.h>
 #include <dt-bindings/regulator/qcom,rpmh-regulator.h>
 #include <dt-bindings/sound/qcom,q6afe.h>
 #include <dt-bindings/sound/qcom,q6asm.h>
        aliases {
                hsuart0 = &uart6;
        };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+
+               pinctrl-names = "default";
+               pinctrl-0 = <&lid_pin_active>, <&mode_pin_active>;
+
+               lid {
+                       gpios = <&tlmm 124 GPIO_ACTIVE_HIGH>;
+                       linux,input-type = <EV_SW>;
+                       linux,code = <SW_LID>;
+                       wakeup-source;
+                       wakeup-event-action = <EV_ACT_DEASSERTED>;
+               };
+
+               mode {
+                       gpios = <&tlmm 95 GPIO_ACTIVE_HIGH>;
+                       linux,input-type = <EV_SW>;
+                       linux,code = <SW_TABLET_MODE>;
+               };
+       };
 };
 
 &adsp_pas {
                bias-pull-down;
                drive-strength = <2>;
        };
+
+       lid_pin_active: lid-pin {
+               pins = "gpio124";
+               function = "gpio";
+
+               input-enable;
+               bias-disable;
+       };
+
+       mode_pin_active: mode-pin {
+               pins = "gpio95";
+               function = "gpio";
+
+               input-enable;
+               bias-disable;
+       };
 };
 
 &uart6 {