diff mbox series

[3/3] arm64: dts: qcom: msm8998-oneplus: add tri-state-key

Message ID 20220516142158.1612109-3-caleb@connolly.tech
State New
Headers show
Series [1/3] input: add event codes for user programmable switch events | expand

Commit Message

Caleb Connolly May 16, 2022, 2:23 p.m. UTC
The tri-state-key is a 3-state mute slider found on the OnePlus 5.
The default software maps the states to "mute", "vibrate" and "ring",
expose them as generic switch events so that they can be configured
by userspace.

Signed-off-by: Caleb Connolly <caleb@connolly.tech>
Signed-off-by: Jami Kettunen <jami.kettunen@somainline.org>
---
 .../boot/dts/qcom/msm8998-oneplus-common.dtsi | 43 +++++++++++++++++++
 1 file changed, 43 insertions(+)

--
2.36.1
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/qcom/msm8998-oneplus-common.dtsi b/arch/arm64/boot/dts/qcom/msm8998-oneplus-common.dtsi
index 9823d48a91b1..9ae6b3e4fc32 100644
--- a/arch/arm64/boot/dts/qcom/msm8998-oneplus-common.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8998-oneplus-common.dtsi
@@ -94,6 +94,41 @@  vol-up {
 		};
 	};

+	tri-state-key {
+		compatible = "gpio-keys";
+		label = "Tri-state key";
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&tri_state_key_default>;
+
+		state-top {
+			label = "Tri-state key top";
+			linux,input-type = <EV_SW>;
+			linux,code = <SW_PROG1>;
+			gpios = <&tlmm 40 GPIO_ACTIVE_LOW>;
+			debounce-interval = <50>;
+			linux,can-disable;
+		};
+
+		state-middle {
+			label = "Tri-state key middle";
+			linux,input-type = <EV_SW>;
+			linux,code = <SW_PROG2>;
+			gpios = <&tlmm 42 GPIO_ACTIVE_LOW>;
+			debounce-interval = <50>;
+			linux,can-disable;
+		};
+
+		state-bottom {
+			label = "Tri-state key bottom";
+			linux,input-type = <EV_SW>;
+			linux,code = <SW_PROG3>;
+			gpios = <&tlmm 26 GPIO_ACTIVE_LOW>;
+			debounce-interval = <50>;
+			linux,can-disable;
+		};
+	};
+
 	gpio-hall-sensor {
 		compatible = "gpio-keys";
 		label = "Hall effect sensor";
@@ -441,6 +476,14 @@  vreg_bob: bob {
 &tlmm {
 	gpio-reserved-ranges = <0 4>, <81 4>;

+	/* The GPIOs have a hardware pullup */
+	tri_state_key_default: tri-state-pins {
+			pins = "gpio40", "gpio42", "gpio26";
+			function = "gpio";
+			drive-strength = <2>;
+			bias-disable;
+	};
+
 	hall_sensor_default: hall-sensor-default {
 		pins = "gpio124";
 		function = "gpio";