Devicetree
 help / color / mirror / Atom feed
* [PATCH] arm64: dts: qcom: sc8280xp-lenovo-thinkpad-x13s: Add LID switch
@ 2022-07-30 19:36 Bjorn Andersson
  2022-07-30 20:51 ` Steev Klimaszewski
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Bjorn Andersson @ 2022-07-30 19:36 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio
  Cc: Rob Herring, Krzysztof Kozlowski, linux-arm-msm, devicetree,
	linux-kernel

Add gpio-keys for exposing the LID switch state.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
 .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts    | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
index 84dc92dda0b8..f3246cc13d15 100644
--- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
+++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
@@ -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";
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] arm64: dts: qcom: sc8280xp-lenovo-thinkpad-x13s: Add LID switch
  2022-07-30 19:36 [PATCH] arm64: dts: qcom: sc8280xp-lenovo-thinkpad-x13s: Add LID switch Bjorn Andersson
@ 2022-07-30 20:51 ` Steev Klimaszewski
  2022-07-30 20:53 ` Konrad Dybcio
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Steev Klimaszewski @ 2022-07-30 20:51 UTC (permalink / raw)
  To: Bjorn Andersson, Andy Gross, Konrad Dybcio
  Cc: Rob Herring, Krzysztof Kozlowski, linux-arm-msm, devicetree,
	linux-kernel


On 7/30/22 2:36 PM, Bjorn Andersson wrote:
> Add gpio-keys for exposing the LID switch state.
>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
>   .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts    | 25 +++++++++++++++++++
>   1 file changed, 25 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> index 84dc92dda0b8..f3246cc13d15 100644
> --- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> +++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> @@ -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";

Tested on the Lenovo Thinkpad X13s

Tested-by: Steev Klimaszewski <steev@kali.org>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] arm64: dts: qcom: sc8280xp-lenovo-thinkpad-x13s: Add LID switch
  2022-07-30 19:36 [PATCH] arm64: dts: qcom: sc8280xp-lenovo-thinkpad-x13s: Add LID switch Bjorn Andersson
  2022-07-30 20:51 ` Steev Klimaszewski
@ 2022-07-30 20:53 ` Konrad Dybcio
  2022-08-05  8:40 ` Johan Hovold
  2022-11-12  3:51 ` Bjorn Andersson
  3 siblings, 0 replies; 5+ messages in thread
From: Konrad Dybcio @ 2022-07-30 20:53 UTC (permalink / raw)
  To: Bjorn Andersson, Andy Gross
  Cc: Rob Herring, Krzysztof Kozlowski, linux-arm-msm, devicetree,
	linux-kernel



On 30.07.2022 21:36, Bjorn Andersson wrote:
> Add gpio-keys for exposing the LID switch state.
> 
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@somainline.org>

Konrad

>  .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts    | 25 +++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> index 84dc92dda0b8..f3246cc13d15 100644
> --- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> +++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> @@ -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";

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] arm64: dts: qcom: sc8280xp-lenovo-thinkpad-x13s: Add LID switch
  2022-07-30 19:36 [PATCH] arm64: dts: qcom: sc8280xp-lenovo-thinkpad-x13s: Add LID switch Bjorn Andersson
  2022-07-30 20:51 ` Steev Klimaszewski
  2022-07-30 20:53 ` Konrad Dybcio
@ 2022-08-05  8:40 ` Johan Hovold
  2022-11-12  3:51 ` Bjorn Andersson
  3 siblings, 0 replies; 5+ messages in thread
From: Johan Hovold @ 2022-08-05  8:40 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	linux-arm-msm, devicetree, linux-kernel

On Sat, Jul 30, 2022 at 12:36:17PM -0700, Bjorn Andersson wrote:
> Add gpio-keys for exposing the LID switch state.
> 
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
>  .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts    | 25 +++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> index 84dc92dda0b8..f3246cc13d15 100644
> --- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> +++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> @@ -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 {

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.

> +		pins = "gpio107";
> +		function = "gpio";
> +

Newline not needed (nor used in the other nodes).

> +		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:

Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
Tested-by: Johan Hovold <johan+linaro@kernel.org>

Johan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] arm64: dts: qcom: sc8280xp-lenovo-thinkpad-x13s: Add LID switch
  2022-07-30 19:36 [PATCH] arm64: dts: qcom: sc8280xp-lenovo-thinkpad-x13s: Add LID switch Bjorn Andersson
                   ` (2 preceding siblings ...)
  2022-08-05  8:40 ` Johan Hovold
@ 2022-11-12  3:51 ` Bjorn Andersson
  3 siblings, 0 replies; 5+ messages in thread
From: Bjorn Andersson @ 2022-11-12  3:51 UTC (permalink / raw)
  To: Bjorn Andersson, konrad.dybcio, agross
  Cc: linux-arm-msm, linux-kernel, devicetree, krzysztof.kozlowski+dt,
	robh+dt

On Sat, 30 Jul 2022 12:36:17 -0700, Bjorn Andersson wrote:
> 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,
-- 
Bjorn Andersson <andersson@kernel.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-11-12  3:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-30 19:36 [PATCH] arm64: dts: qcom: sc8280xp-lenovo-thinkpad-x13s: Add LID switch Bjorn Andersson
2022-07-30 20:51 ` Steev Klimaszewski
2022-07-30 20:53 ` Konrad Dybcio
2022-08-05  8:40 ` Johan Hovold
2022-11-12  3:51 ` Bjorn Andersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox