linux-arm-msm.vger.kernel.org archive mirror
 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 1/3] input: add event codes for user programmable switch events
Date: Mon, 16 May 2022 14:22:57 +0000	[thread overview]
Message-ID: <20220516142158.1612109-1-caleb@connolly.tech> (raw)

Add SW_PROG{1,2,3,4} for device switches which are handled by userspace.

This can be used for devices with "generic" switches which are intended
to be user-programmable, for example OnePlus phones contain a tri-state
key which can be used for switching between mute/vibrate/ring, or
programmed by the user to perform any arbitrary actions.

These are analogous to the keys KEY_PROG{1,2,3,4} found on some
keyboards.

Signed-off-by: Caleb Connolly <caleb@connolly.tech>
---
See the next patch in this series for an example usecase.
---
 include/linux/mod_devicetable.h        | 2 +-
 include/uapi/linux/input-event-codes.h | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 5da5d990ff58..45364fbeaaf7 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -326,7 +326,7 @@ struct pcmcia_device_id {
 #define INPUT_DEVICE_ID_LED_MAX		0x0f
 #define INPUT_DEVICE_ID_SND_MAX		0x07
 #define INPUT_DEVICE_ID_FF_MAX		0x7f
-#define INPUT_DEVICE_ID_SW_MAX		0x10
+#define INPUT_DEVICE_ID_SW_MAX		0x14
 #define INPUT_DEVICE_ID_PROP_MAX	0x1f

 #define INPUT_DEVICE_ID_MATCH_BUS	1
diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h
index dff8e7f17074..339153886a13 100644
--- a/include/uapi/linux/input-event-codes.h
+++ b/include/uapi/linux/input-event-codes.h
@@ -917,7 +917,11 @@
 #define SW_MUTE_DEVICE		0x0e  /* set = device disabled */
 #define SW_PEN_INSERTED		0x0f  /* set = pen inserted */
 #define SW_MACHINE_COVER	0x10  /* set = cover closed */
-#define SW_MAX			0x10
+#define SW_PROG1		0x11  /* set = program 1 (user defined) */
+#define SW_PROG2		0x12  /* set = program 2 (user defined) */
+#define SW_PROG3		0x13  /* set = program 3 (user defined) */
+#define SW_PROG4		0x14  /* set = program 4 (user defined) */
+#define SW_MAX			0x14
 #define SW_CNT			(SW_MAX+1)

 /*
--
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 Caleb Connolly [this message]
2022-05-16 14:23 ` [PATCH 2/3] arm64: dts: qcom: sdm845-oneplus: add tri-state-key Caleb Connolly
2022-05-16 14:23 ` [PATCH 3/3] arm64: dts: qcom: msm8998-oneplus: " 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-1-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).