public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: dts: qcom: sdm845-oneplus-common: add Hall sensor
@ 2023-03-06 17:41 Gergo Koteles
  2023-03-06 17:46 ` Konrad Dybcio
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Gergo Koteles @ 2023-03-06 17:41 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski
  Cc: linux-arm-msm, devicetree, linux-kernel, Gergo Koteles

Enable the Hall effect sensor (flip cover) for OnePlus 6/6T.
The GPIO is mapped to SW_LID events as in msm8916, msm8994,
msm8998 devices.

Signed-off-by: Gergo Koteles <soyer@irl.hu>
---
 .../boot/dts/qcom/sdm845-oneplus-common.dtsi  | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
index 64638ea94db7..b01542d79ae2 100644
--- a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
@@ -29,6 +29,23 @@ chosen {
 		stdout-path = "serial0:115200n8";
 	};
 
+	gpio-hall-sensor {
+		compatible = "gpio-keys";
+		label = "Hall effect sensor";
+
+		pinctrl-0 = <&hall_sensor_default>;
+		pinctrl-names = "default";
+
+		event-hall-sensor {
+			gpios = <&tlmm 124 GPIO_ACTIVE_LOW>;
+			label = "Hall Effect Sensor";
+			linux,input-type = <EV_SW>;
+			linux,code = <SW_LID>;
+			linux,can-disable;
+			wakeup-source;
+		};
+	};
+
 	gpio-keys {
 		compatible = "gpio-keys";
 		label = "Volume keys";
@@ -753,6 +770,14 @@ &usb_1_hsphy {
 &tlmm {
 	gpio-reserved-ranges = <0 4>, <81 4>;
 
+	hall_sensor_default: hall-sensor-default-state {
+		pins = "gpio124";
+		function = "gpio";
+		drive-strength = <2>;
+		bias-disable;
+		input-enable;
+	};
+
 	tri_state_key_default: tri-state-key-default-state {
 		pins = "gpio40", "gpio42", "gpio26";
 		function = "gpio";
-- 
2.39.2


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

* Re: [PATCH] arm64: dts: qcom: sdm845-oneplus-common: add Hall sensor
  2023-03-06 17:41 [PATCH] arm64: dts: qcom: sdm845-oneplus-common: add Hall sensor Gergo Koteles
@ 2023-03-06 17:46 ` Konrad Dybcio
  2023-03-06 22:03 ` Caleb Connolly
  2023-03-22 14:45 ` Bjorn Andersson
  2 siblings, 0 replies; 4+ messages in thread
From: Konrad Dybcio @ 2023-03-06 17:46 UTC (permalink / raw)
  To: Gergo Koteles, Andy Gross, Bjorn Andersson, Rob Herring,
	Krzysztof Kozlowski
  Cc: linux-arm-msm, devicetree, linux-kernel



On 6.03.2023 18:41, Gergo Koteles wrote:
> Enable the Hall effect sensor (flip cover) for OnePlus 6/6T.
> The GPIO is mapped to SW_LID events as in msm8916, msm8994,
> msm8998 devices.
> 
> Signed-off-by: Gergo Koteles <soyer@irl.hu>
> ---
One fun thing I discovered is that if suspend is broken for whatever
reason and you get a magnet close to a device with it mapped to SW_LID,
you'll essentially get a hang or a reboot lol

Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad
>  .../boot/dts/qcom/sdm845-oneplus-common.dtsi  | 25 +++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
> index 64638ea94db7..b01542d79ae2 100644
> --- a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
> @@ -29,6 +29,23 @@ chosen {
>  		stdout-path = "serial0:115200n8";
>  	};
>  
> +	gpio-hall-sensor {
> +		compatible = "gpio-keys";
> +		label = "Hall effect sensor";
> +
> +		pinctrl-0 = <&hall_sensor_default>;
> +		pinctrl-names = "default";
> +
> +		event-hall-sensor {
> +			gpios = <&tlmm 124 GPIO_ACTIVE_LOW>;
> +			label = "Hall Effect Sensor";
> +			linux,input-type = <EV_SW>;
> +			linux,code = <SW_LID>;
> +			linux,can-disable;
> +			wakeup-source;
> +		};
> +	};
> +
>  	gpio-keys {
>  		compatible = "gpio-keys";
>  		label = "Volume keys";
> @@ -753,6 +770,14 @@ &usb_1_hsphy {
>  &tlmm {
>  	gpio-reserved-ranges = <0 4>, <81 4>;
>  
> +	hall_sensor_default: hall-sensor-default-state {
> +		pins = "gpio124";
> +		function = "gpio";
> +		drive-strength = <2>;
> +		bias-disable;
> +		input-enable;
> +	};
> +
>  	tri_state_key_default: tri-state-key-default-state {
>  		pins = "gpio40", "gpio42", "gpio26";
>  		function = "gpio";

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

* Re: [PATCH] arm64: dts: qcom: sdm845-oneplus-common: add Hall sensor
  2023-03-06 17:41 [PATCH] arm64: dts: qcom: sdm845-oneplus-common: add Hall sensor Gergo Koteles
  2023-03-06 17:46 ` Konrad Dybcio
@ 2023-03-06 22:03 ` Caleb Connolly
  2023-03-22 14:45 ` Bjorn Andersson
  2 siblings, 0 replies; 4+ messages in thread
From: Caleb Connolly @ 2023-03-06 22:03 UTC (permalink / raw)
  To: Gergo Koteles, Andy Gross, Bjorn Andersson, Konrad Dybcio,
	Rob Herring, Krzysztof Kozlowski
  Cc: linux-arm-msm, devicetree, linux-kernel



On 06/03/2023 17:41, Gergo Koteles wrote:
> Enable the Hall effect sensor (flip cover) for OnePlus 6/6T.
> The GPIO is mapped to SW_LID events as in msm8916, msm8994,
> msm8998 devices.
>
> Signed-off-by: Gergo Koteles <soyer@irl.hu>

Reviewed-by: Caleb Connolly <caleb@connolly.tech>
> ---
>  .../boot/dts/qcom/sdm845-oneplus-common.dtsi  | 25 +++++++++++++++++++
>  1 file changed, 25 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
> index 64638ea94db7..b01542d79ae2 100644
> --- a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
> @@ -29,6 +29,23 @@ chosen {
>  		stdout-path = "serial0:115200n8";
>  	};
>
> +	gpio-hall-sensor {
> +		compatible = "gpio-keys";
> +		label = "Hall effect sensor";
> +
> +		pinctrl-0 = <&hall_sensor_default>;
> +		pinctrl-names = "default";
> +
> +		event-hall-sensor {
> +			gpios = <&tlmm 124 GPIO_ACTIVE_LOW>;
> +			label = "Hall Effect Sensor";
> +			linux,input-type = <EV_SW>;
> +			linux,code = <SW_LID>;
> +			linux,can-disable;
> +			wakeup-source;
> +		};
> +	};
> +
>  	gpio-keys {
>  		compatible = "gpio-keys";
>  		label = "Volume keys";
> @@ -753,6 +770,14 @@ &usb_1_hsphy {
>  &tlmm {
>  	gpio-reserved-ranges = <0 4>, <81 4>;
>
> +	hall_sensor_default: hall-sensor-default-state {
> +		pins = "gpio124";
> +		function = "gpio";
> +		drive-strength = <2>;
> +		bias-disable;
> +		input-enable;
> +	};
> +
>  	tri_state_key_default: tri-state-key-default-state {
>  		pins = "gpio40", "gpio42", "gpio26";
>  		function = "gpio";
> --
> 2.39.2
>

--
Kind Regards,
Caleb


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

* Re: [PATCH] arm64: dts: qcom: sdm845-oneplus-common: add Hall sensor
  2023-03-06 17:41 [PATCH] arm64: dts: qcom: sdm845-oneplus-common: add Hall sensor Gergo Koteles
  2023-03-06 17:46 ` Konrad Dybcio
  2023-03-06 22:03 ` Caleb Connolly
@ 2023-03-22 14:45 ` Bjorn Andersson
  2 siblings, 0 replies; 4+ messages in thread
From: Bjorn Andersson @ 2023-03-22 14:45 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Andy Gross, Konrad Dybcio, Rob Herring,
	Gergo Koteles
  Cc: linux-kernel, devicetree, linux-arm-msm

On Mon, 6 Mar 2023 18:41:47 +0100, Gergo Koteles wrote:
> Enable the Hall effect sensor (flip cover) for OnePlus 6/6T.
> The GPIO is mapped to SW_LID events as in msm8916, msm8994,
> msm8998 devices.
> 
> 

Applied, thanks!

[1/1] arm64: dts: qcom: sdm845-oneplus-common: add Hall sensor
      commit: 80dc42d9facc9232072855340c2285682c0c3b19

Best regards,
-- 
Bjorn Andersson <andersson@kernel.org>

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

end of thread, other threads:[~2023-03-22 14:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-06 17:41 [PATCH] arm64: dts: qcom: sdm845-oneplus-common: add Hall sensor Gergo Koteles
2023-03-06 17:46 ` Konrad Dybcio
2023-03-06 22:03 ` Caleb Connolly
2023-03-22 14:45 ` Bjorn Andersson

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