diff mbox series

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

Message ID 20220516142158.1612109-2-caleb@connolly.tech (mailing list archive)
State New, archived
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 6.
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>
---
 .../boot/dts/qcom/sdm845-oneplus-common.dtsi  | 44 +++++++++++++++++--
 1 file changed, 40 insertions(+), 4 deletions(-)

--
2.36.1
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
index 07b729f9fec5..f134c51e17ec 100644
--- a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
@@ -7,7 +7,7 @@ 

 /dts-v1/;

-#include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/regulator/qcom,rpmh-regulator.h>

 #include "sdm845.dtsi"
@@ -26,7 +26,7 @@  chosen {
 		stdout-path = "serial0:115200n8";
 	};

-	gpio-keys {
+	volume-keys {
 		compatible = "gpio-keys";
 		label = "Volume keys";
 		autorepeat;
@@ -49,6 +49,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 126 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 52 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 24 GPIO_ACTIVE_LOW>;
+			debounce-interval = <50>;
+			linux,can-disable;
+		};
+	};
+
 	reserved-memory {
 		/* The rmtfs_mem needs to be guarded due to "XPU limitations"
 		 * it is otherwise possible for an allocation adjacent to the
@@ -607,9 +642,10 @@  &usb_1_hsphy {
 &tlmm {
 	gpio-reserved-ranges = <0 4>, <81 4>;

-	tri_state_key_default: tri_state_key_default {
+	/* The GPIOs have a hardware pullup */
+	tri_state_key_default: tri-state-pins {
 		mux {
-			pins = "gpio40", "gpio42", "gpio26";
+			pins = "gpio126", "gpio52", "gpio24";
 			function = "gpio";
 			drive-strength = <2>;
 			bias-disable;