All of lore.kernel.org
 help / color / mirror / Atom feed
From: Caleb Connolly <caleb@connolly.tech>
To: Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
	phone-devel@vger.kernel.org
Cc: Caleb Connolly <caleb@connolly.tech>
Subject: [PATCH 2/3] arm64: dts: qcom: sdm845-oneplus: add tri-state-key
Date: Mon, 16 May 2022 14:23:02 +0000	[thread overview]
Message-ID: <20220516142158.1612109-2-caleb@connolly.tech> (raw)
In-Reply-To: <20220516142158.1612109-1-caleb@connolly.tech>

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(-)

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;
--
2.36.1



  reply	other threads:[~2022-05-16 14:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-16 14:22 [PATCH 1/3] input: add event codes for user programmable switch events Caleb Connolly
2022-05-16 14:23 ` Caleb Connolly [this message]
2022-05-16 14:23 ` [PATCH 3/3] arm64: dts: qcom: msm8998-oneplus: add tri-state-key Caleb Connolly
2022-06-30 23:11 ` [PATCH 1/3] input: add event codes for user programmable switch events Bjorn Andersson
2022-08-07 16:01   ` Caleb Connolly
2022-08-10 22:33 ` Dmitry Torokhov
2022-08-15 13:17   ` Caleb Connolly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220516142158.1612109-2-caleb@connolly.tech \
    --to=caleb@connolly.tech \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=phone-devel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.