arm64: dts: qcom: sdm845-oneplus-common: add Hall sensor
authorGergo Koteles <soyer@irl.hu>
Mon, 6 Mar 2023 17:41:47 +0000 (18:41 +0100)
committerBjorn Andersson <andersson@kernel.org>
Wed, 22 Mar 2023 03:34:14 +0000 (20:34 -0700)
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>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20230306174147.185239-1-soyer@irl.hu
arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi

index 64638ea..b01542d 100644 (file)
                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";
 &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";