[3/5] ARM: dts: qcom: msm8974-oneplus-bacon: Add volume keys and hall sensor

Message ID 20230122-msm8974-bacon-features-v1-3-4049f565c24c@z3ntu.xyz
State New
Headers
Series Add support for some features on OnePlus One |

Commit Message

Luca Weiss Jan. 22, 2023, 4:48 p.m. UTC
  Add nodes for the volume buttons and the hall sensor that are found on
the device.

Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
---
 .../arm/boot/dts/qcom-msm8974pro-oneplus-bacon.dts | 50 ++++++++++++++++++++++
 1 file changed, 50 insertions(+)
  

Comments

Konrad Dybcio Jan. 23, 2023, 4:42 p.m. UTC | #1
On 22.01.2023 17:48, Luca Weiss wrote:
> Add nodes for the volume buttons and the hall sensor that are found on
> the device.
> 
> Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
> ---
>  .../arm/boot/dts/qcom-msm8974pro-oneplus-bacon.dts | 50 ++++++++++++++++++++++
>  1 file changed, 50 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/qcom-msm8974pro-oneplus-bacon.dts b/arch/arm/boot/dts/qcom-msm8974pro-oneplus-bacon.dts
> index 63180fe1d292..10ba3c94e26d 100644
> --- a/arch/arm/boot/dts/qcom-msm8974pro-oneplus-bacon.dts
> +++ b/arch/arm/boot/dts/qcom-msm8974pro-oneplus-bacon.dts
> @@ -19,6 +19,38 @@ aliases {
>  	chosen {
>  		stdout-path = "serial0:115200n8";
>  	};
> +
> +	gpio-keys {
> +		compatible = "gpio-keys";
> +
> +		pinctrl-names = "default";
> +		pinctrl-0 = <&gpio_keys_default>, <&gpio_hall_sensor_default>;
pinctrl-N
pinctrl-names

please

> +
> +		key-volume-down {
> +			label = "Volume Down";
> +			gpios = <&pm8941_gpios 2 GPIO_ACTIVE_LOW>;
> +			linux,code = <KEY_VOLUMEDOWN>;
> +			wakeup-source;
> +			debounce-interval = <15>;
> +		};
> +
> +		key-volume-up {
> +			label = "Volume Up";
> +			gpios = <&pm8941_gpios 5 GPIO_ACTIVE_LOW>;
> +			linux,code = <KEY_VOLUMEUP>;
> +			wakeup-source;
> +			debounce-interval = <15>;
> +		};
> +
> +		event-hall-sensor {
> +			label = "Hall Effect Sensor";
> +			gpios = <&tlmm 68 GPIO_ACTIVE_LOW>;
> +			linux,input-type = <EV_SW>;
> +			linux,code = <SW_LID>;
> +			linux,can-disable;
> +			debounce-interval = <150>;
> +		};
> +	};
>  };
>  
>  &blsp1_i2c1 {
> @@ -95,6 +127,17 @@ &pm8941_coincell {
>  	status = "okay";
>  };
>  
> +&pm8941_gpios {
> +	gpio_keys_default: gpio-keys-active-state {
> +		pins = "gpio2", "gpio5";
> +		function = "normal";
> +
Unnecessary newline

Konrad
> +		input-enable;
> +		bias-disable;
> +		power-source = <PM8941_GPIO_S3>;
> +	};
> +};
> +
>  &pm8941_vib {
>  	status = "okay";
>  };
> @@ -349,6 +392,13 @@ &sdhc_1 {
>  };
>  
>  &tlmm {
> +	gpio_hall_sensor_default: gpio-hall-sensor-default-state {
> +		pins = "gpio68";
> +		function = "gpio";
> +		drive-strength = <8>;
> +		bias-pull-up;
> +	};
> +
>  	sdc1_on: sdc1-on-state {
>  		clk-pins {
>  			pins = "sdc1_clk";
>
  

Patch

diff --git a/arch/arm/boot/dts/qcom-msm8974pro-oneplus-bacon.dts b/arch/arm/boot/dts/qcom-msm8974pro-oneplus-bacon.dts
index 63180fe1d292..10ba3c94e26d 100644
--- a/arch/arm/boot/dts/qcom-msm8974pro-oneplus-bacon.dts
+++ b/arch/arm/boot/dts/qcom-msm8974pro-oneplus-bacon.dts
@@ -19,6 +19,38 @@  aliases {
 	chosen {
 		stdout-path = "serial0:115200n8";
 	};
+
+	gpio-keys {
+		compatible = "gpio-keys";
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&gpio_keys_default>, <&gpio_hall_sensor_default>;
+
+		key-volume-down {
+			label = "Volume Down";
+			gpios = <&pm8941_gpios 2 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_VOLUMEDOWN>;
+			wakeup-source;
+			debounce-interval = <15>;
+		};
+
+		key-volume-up {
+			label = "Volume Up";
+			gpios = <&pm8941_gpios 5 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_VOLUMEUP>;
+			wakeup-source;
+			debounce-interval = <15>;
+		};
+
+		event-hall-sensor {
+			label = "Hall Effect Sensor";
+			gpios = <&tlmm 68 GPIO_ACTIVE_LOW>;
+			linux,input-type = <EV_SW>;
+			linux,code = <SW_LID>;
+			linux,can-disable;
+			debounce-interval = <150>;
+		};
+	};
 };
 
 &blsp1_i2c1 {
@@ -95,6 +127,17 @@  &pm8941_coincell {
 	status = "okay";
 };
 
+&pm8941_gpios {
+	gpio_keys_default: gpio-keys-active-state {
+		pins = "gpio2", "gpio5";
+		function = "normal";
+
+		input-enable;
+		bias-disable;
+		power-source = <PM8941_GPIO_S3>;
+	};
+};
+
 &pm8941_vib {
 	status = "okay";
 };
@@ -349,6 +392,13 @@  &sdhc_1 {
 };
 
 &tlmm {
+	gpio_hall_sensor_default: gpio-hall-sensor-default-state {
+		pins = "gpio68";
+		function = "gpio";
+		drive-strength = <8>;
+		bias-pull-up;
+	};
+
 	sdc1_on: sdc1-on-state {
 		clk-pins {
 			pins = "sdc1_clk";