arm64: dts: qcom: sc8280xp-lenovo-thinkpad-x13s: Add LID switch
PATCH 1/1 arm64: dts: qcom: sc8280xp-lenovo-thinkpad-x13s: Add LID switch
Add gpio-keys for exposing the LID switch state.
--- .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+)
arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts +25 -0
@@ -7,6 +7,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 "sc8280xp.dtsi"
@@ -26,6 +28,21 @@ backlight { pinctrl-0 = <&edp_bl_en>, <&edp_bl_pwm>; }; + gpio-keys { + compatible = "gpio-keys"; + + pinctrl-names = "default"; + pinctrl-0 = <&hall_int_state>; + + switch-lid { + gpios = <&tlmm 107 GPIO_ACTIVE_LOW>; + linux,input-type = <EV_SW>; + linux,code = <SW_LID>; + wakeup-source; + wakeup-event-action = <EV_ACT_DEASSERTED>; + }; + }; + vreg_edp_bl: regulator-edp-bl { compatible = "regulator-fixed";
@@ -347,6 +364,14 @@ reset { }; }; + hall_int_state: hall-int-state { + pins = "gpio107"; + function = "gpio"; + + input-enable; + bias-disable; + }; + qup0_i2c4_default: qup0-i2c4-default-state { pins = "gpio171", "gpio172"; function = "qup4";
Signature · 1 line
2.35.1
Quoted 47 lines · Bjorn Andersson
Add gpio-keys for exposing the LID switch state.
Signed-off-by Bjorn Andersson <[email protected]>--- .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+)arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts +18
-0@@ -7,6 +7,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 "sc8280xp.dtsi"@@ -26,6 +28,21 @@ backlight { pinctrl-0 = <&edp_bl_en>, <&edp_bl_pwm>; }; + gpio-keys { + compatible = "gpio-keys"; + + pinctrl-names = "default"; + pinctrl-0 = <&hall_int_state>; + + switch-lid { + gpios = <&tlmm 107 GPIO_ACTIVE_LOW>; + linux,input-type = <EV_SW>; + linux,code = <SW_LID>; + wakeup-source; + wakeup-event-action = <EV_ACT_DEASSERTED>; + }; + }; + vreg_edp_bl: regulator-edp-bl { compatible = "regulator-fixed";@@ -347,6 +364,14 @@ reset { }; }; + hall_int_state: hall-int-state {
arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts reset { · line 377
Quoted 10 lines
arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts +7
-0+ pins = "gpio107"; + function = "gpio"; + + input-enable; + bias-disable; + }; + qup0_i2c4_default: qup0-i2c4-default-state { pins = "gpio171", "gpio172"; function = "qup4";
Tested on the Lenovo Thinkpad X13s
Quoted 4 lines · Bjorn Andersson
Add gpio-keys for exposing the LID switch state.
Signed-off-by Bjorn Andersson <[email protected]>---
Konrad
Quoted 53 lines
.../qcom/sc8280xp-lenovo-thinkpad-x13s.dts | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+)arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts +25
-0@@ -7,6 +7,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 "sc8280xp.dtsi"@@ -26,6 +28,21 @@ backlight { pinctrl-0 = <&edp_bl_en>, <&edp_bl_pwm>; }; + gpio-keys { + compatible = "gpio-keys"; + + pinctrl-names = "default"; + pinctrl-0 = <&hall_int_state>; + + switch-lid { + gpios = <&tlmm 107 GPIO_ACTIVE_LOW>; + linux,input-type = <EV_SW>; + linux,code = <SW_LID>; + wakeup-source; + wakeup-event-action = <EV_ACT_DEASSERTED>; + }; + }; + vreg_edp_bl: regulator-edp-bl { compatible = "regulator-fixed";@@ -347,6 +364,14 @@ reset { }; }; + hall_int_state: hall-int-state { + pins = "gpio107"; + function = "gpio"; + + input-enable; + bias-disable; + }; + qup0_i2c4_default: qup0-i2c4-default-state { pins = "gpio171", "gpio172"; function = "qup4";
Quoted 43 lines · Bjorn Andersson
Add gpio-keys for exposing the LID switch state.
Signed-off-by Bjorn Andersson <[email protected]>--- .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+)arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts +17
-0@@ -7,6 +7,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 "sc8280xp.dtsi"@@ -26,6 +28,21 @@ backlight { pinctrl-0 = <&edp_bl_en>, <&edp_bl_pwm>; }; + gpio-keys { + compatible = "gpio-keys"; + + pinctrl-names = "default"; + pinctrl-0 = <&hall_int_state>; + + switch-lid { + gpios = <&tlmm 107 GPIO_ACTIVE_LOW>; + linux,input-type = <EV_SW>; + linux,code = <SW_LID>; + wakeup-source; + wakeup-event-action = <EV_ACT_DEASSERTED>; + }; + }; + vreg_edp_bl: regulator-edp-bl { compatible = "regulator-fixed";
arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts reset { · line 367
Quoted 4 lines
arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts +1
-0@@ -347,6 +364,14 @@ reset { }; }; + hall_int_state: hall-int-state {
This node should go before the keyboard node to maintain the sort order.
Also, none of the other labels have a "state" suffix and the other active-low pin node names have a "-n" suffix.
So I believe this should be
hall_int_n: hall-int-n-state
for consistency.
arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts reset { · line 370
Quoted 3 lines
arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts +3
-0+ pins = "gpio107"; + function = "gpio"; +
Newline not needed (nor used in the other nodes).
arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts reset { · line 377
Quoted 7 lines
arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts +4
-0+ input-enable; + bias-disable; + }; + qup0_i2c4_default: qup0-i2c4-default-state { pins = "gpio171", "gpio172"; function = "qup4";
Looks good otherwise and appears to work as intended:
Johan
Quoted 3 lines · Bjorn Andersson
Add gpio-keys for exposing the LID switch state.
Applied, thanks!
[1/1] arm64: dts: qcom: sc8280xp-lenovo-thinkpad-x13s: Add LID switch
commit: a607fe5ea21324a91f03301194bfcda1df2108a6
Best regards,
Signature · 1 line
Bjorn Andersson <[email protected]>