* [PATCH 0/3] Add tri-state-key for oneplus
@ 2023-01-18 23:46 Gergo Koteles
2023-01-18 23:46 ` [PATCH 1/3] Input: gpio-keys - add support for linux,input-value dts property Gergo Koteles
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Gergo Koteles @ 2023-01-18 23:46 UTC (permalink / raw)
To: Dmitry Torokhov, Jonathan Corbet, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Rob Herring, Krzysztof Kozlowski, Jiri Kosina,
Benjamin Tissoires
Cc: linux-input, linux-kernel, linux-arm-msm, devicetree,
Caleb Connolly, Gergo Koteles
Gergo Koteles (3):
Input: gpio-keys - add support for linux,input-value dts property
Input: add ABS_SND_PROFILE
arm64: dts: qcom: sdm845-oneplus: add tri-state-key
Documentation/input/event-codes.rst | 6 +++
.../boot/dts/qcom/sdm845-oneplus-common.dtsi | 43 ++++++++++++++++++-
drivers/hid/hid-debug.c | 1 +
drivers/input/keyboard/gpio_keys.c | 3 ++
include/uapi/linux/input-event-codes.h | 1 +
5 files changed, 52 insertions(+), 2 deletions(-)
--
2.39.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] Input: gpio-keys - add support for linux,input-value dts property
2023-01-18 23:46 [PATCH 0/3] Add tri-state-key for oneplus Gergo Koteles
@ 2023-01-18 23:46 ` Gergo Koteles
2023-01-18 23:46 ` [PATCH 2/3] Input: add ABS_SND_PROFILE Gergo Koteles
2023-01-18 23:46 ` [PATCH 3/3] arm64: dts: qcom: sdm845-oneplus: add tri-state-key Gergo Koteles
2 siblings, 0 replies; 5+ messages in thread
From: Gergo Koteles @ 2023-01-18 23:46 UTC (permalink / raw)
To: Dmitry Torokhov, Jonathan Corbet, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Rob Herring, Krzysztof Kozlowski, Jiri Kosina,
Benjamin Tissoires
Cc: linux-input, linux-kernel, linux-arm-msm, devicetree,
Caleb Connolly, Gergo Koteles
Allows setting the value of EV_ABS events from dts.
This property is included in the gpio-keys.yaml scheme, but was only
implemented for gpio-keys-polled.
Signed-off-by: Gergo Koteles <soyer@irl.hu>
---
drivers/input/keyboard/gpio_keys.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 5496482a38c1..c42f86ad0766 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -770,6 +770,9 @@ gpio_keys_get_devtree_pdata(struct device *dev)
&button->type))
button->type = EV_KEY;
+ fwnode_property_read_u32(child, "linux,input-value",
+ (u32 *)&button->value);
+
button->wakeup =
fwnode_property_read_bool(child, "wakeup-source") ||
/* legacy name */
--
2.39.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] Input: add ABS_SND_PROFILE
2023-01-18 23:46 [PATCH 0/3] Add tri-state-key for oneplus Gergo Koteles
2023-01-18 23:46 ` [PATCH 1/3] Input: gpio-keys - add support for linux,input-value dts property Gergo Koteles
@ 2023-01-18 23:46 ` Gergo Koteles
2023-01-18 23:46 ` [PATCH 3/3] arm64: dts: qcom: sdm845-oneplus: add tri-state-key Gergo Koteles
2 siblings, 0 replies; 5+ messages in thread
From: Gergo Koteles @ 2023-01-18 23:46 UTC (permalink / raw)
To: Dmitry Torokhov, Jonathan Corbet, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Rob Herring, Krzysztof Kozlowski, Jiri Kosina,
Benjamin Tissoires
Cc: linux-input, linux-kernel, linux-arm-msm, devicetree,
Caleb Connolly, Gergo Koteles
ABS_SND_PROFILE used to describe the state of a multi-value sound profile
switch. This will be used for the tri-state key on OnePlus phones or other
phones.
Signed-off-by: Gergo Koteles <soyer@irl.hu>
---
Documentation/input/event-codes.rst | 6 ++++++
drivers/hid/hid-debug.c | 1 +
include/uapi/linux/input-event-codes.h | 1 +
3 files changed, 8 insertions(+)
diff --git a/Documentation/input/event-codes.rst b/Documentation/input/event-codes.rst
index b4557462edd7..d43336e64d6a 100644
--- a/Documentation/input/event-codes.rst
+++ b/Documentation/input/event-codes.rst
@@ -241,6 +241,12 @@ A few EV_ABS codes have special meanings:
emitted only when the selected profile changes, indicating the newly
selected profile value.
+* ABS_SND_PROFILE:
+
+ - Used to describe the state of a multi-value sound profile switch.
+ An event is emitted only when the selected profile changes,
+ indicating the newly selected profile value.
+
* ABS_MT_<name>:
- Used to describe multitouch input events. Please see
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
index e213bdde543a..76fb2ecbbc51 100644
--- a/drivers/hid/hid-debug.c
+++ b/drivers/hid/hid-debug.c
@@ -1018,6 +1018,7 @@ static const char *absolutes[ABS_CNT] = {
[ABS_DISTANCE] = "Distance", [ABS_TILT_X] = "XTilt",
[ABS_TILT_Y] = "YTilt", [ABS_TOOL_WIDTH] = "ToolWidth",
[ABS_VOLUME] = "Volume", [ABS_PROFILE] = "Profile",
+ [ABS_SND_PROFILE] = "SoundProfile",
[ABS_MISC] = "Misc",
[ABS_MT_TOUCH_MAJOR] = "MTMajor",
[ABS_MT_TOUCH_MINOR] = "MTMinor",
diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h
index 022a520e31fc..e765a8f9a3ae 100644
--- a/include/uapi/linux/input-event-codes.h
+++ b/include/uapi/linux/input-event-codes.h
@@ -866,6 +866,7 @@
#define ABS_VOLUME 0x20
#define ABS_PROFILE 0x21
+#define ABS_SND_PROFILE 0x22
#define ABS_MISC 0x28
--
2.39.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] arm64: dts: qcom: sdm845-oneplus: add tri-state-key
2023-01-18 23:46 [PATCH 0/3] Add tri-state-key for oneplus Gergo Koteles
2023-01-18 23:46 ` [PATCH 1/3] Input: gpio-keys - add support for linux,input-value dts property Gergo Koteles
2023-01-18 23:46 ` [PATCH 2/3] Input: add ABS_SND_PROFILE Gergo Koteles
@ 2023-01-18 23:46 ` Gergo Koteles
2023-01-19 11:29 ` Krzysztof Kozlowski
2 siblings, 1 reply; 5+ messages in thread
From: Gergo Koteles @ 2023-01-18 23:46 UTC (permalink / raw)
To: Dmitry Torokhov, Jonathan Corbet, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Rob Herring, Krzysztof Kozlowski, Jiri Kosina,
Benjamin Tissoires
Cc: linux-input, linux-kernel, linux-arm-msm, devicetree,
Caleb Connolly, Gergo Koteles
The tri-state-key is a sound profile switch found on the OnePlus 6,
Android maps the states to "mute", "vibrate" and "ring", expose them as
ABS_SND_PROFILE events.
The previous GPIO numbers were wrong, the patch updates them to the correct
ones.
Co-developed-by: Caleb Connolly <caleb@connolly.tech>
Signed-off-by: Caleb Connolly <caleb@connolly.tech>
Signed-off-by: Gergo Koteles <soyer@irl.hu>
---
.../boot/dts/qcom/sdm845-oneplus-common.dtsi | 43 ++++++++++++++++++-
1 file changed, 41 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
index 42cf4dd5ea28..33215ad17513 100644
--- a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
@@ -49,6 +49,44 @@ key-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_ABS>;
+ linux,code = <ABS_SND_PROFILE>;
+ linux,input-value = <0>;
+ gpios = <&tlmm 126 GPIO_ACTIVE_LOW>;
+ debounce-interval = <50>;
+ linux,can-disable;
+ };
+
+ state-middle {
+ label = "Tri-state key middle";
+ linux,input-type = <EV_ABS>;
+ linux,code = <ABS_SND_PROFILE>;
+ linux,input-value = <1>;
+ gpios = <&tlmm 52 GPIO_ACTIVE_LOW>;
+ debounce-interval = <50>;
+ linux,can-disable;
+ };
+
+ state-bottom {
+ label = "Tri-state key bottom";
+ linux,input-type = <EV_ABS>;
+ linux,code = <ABS_SND_PROFILE>;
+ linux,input-value = <2>;
+ 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"
@@ -588,9 +626,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.39.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 3/3] arm64: dts: qcom: sdm845-oneplus: add tri-state-key
2023-01-18 23:46 ` [PATCH 3/3] arm64: dts: qcom: sdm845-oneplus: add tri-state-key Gergo Koteles
@ 2023-01-19 11:29 ` Krzysztof Kozlowski
0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2023-01-19 11:29 UTC (permalink / raw)
To: Gergo Koteles, Dmitry Torokhov, Jonathan Corbet, Andy Gross,
Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
Jiri Kosina, Benjamin Tissoires
Cc: linux-input, linux-kernel, linux-arm-msm, devicetree, Caleb Connolly
On 19/01/2023 00:46, Gergo Koteles wrote:
> The tri-state-key is a sound profile switch found on the OnePlus 6,
> Android maps the states to "mute", "vibrate" and "ring", expose them as
> ABS_SND_PROFILE events.
> The previous GPIO numbers were wrong, the patch updates them to the correct
> ones.
>
> Co-developed-by: Caleb Connolly <caleb@connolly.tech>
> Signed-off-by: Caleb Connolly <caleb@connolly.tech>
> Signed-off-by: Gergo Koteles <soyer@irl.hu>
> ---
> .../boot/dts/qcom/sdm845-oneplus-common.dtsi | 43 ++++++++++++++++++-
> 1 file changed, 41 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
> index 42cf4dd5ea28..33215ad17513 100644
> --- a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
> @@ -49,6 +49,44 @@ key-vol-up {
> };
> };
>
> + tri-state-key {
> + compatible = "gpio-keys";
> + label = "Tri-state key";
> +
> + pinctrl-names = "default";
> + pinctrl-0 = <&tri_state_key_default>;
> +
> + state-top {
Does not look like you tested the DTS against bindings. Please run `make
dtbs_check` (see Documentation/devicetree/bindings/writing-schema.rst
for instructions).
> + label = "Tri-state key top";
> + linux,input-type = <EV_ABS>;
> + linux,code = <ABS_SND_PROFILE>;
> + linux,input-value = <0>;
> + gpios = <&tlmm 126 GPIO_ACTIVE_LOW>;
> + debounce-interval = <50>;
> + linux,can-disable;
> + };
> +
> + state-middle {
> + label = "Tri-state key middle";
> + linux,input-type = <EV_ABS>;
> + linux,code = <ABS_SND_PROFILE>;
> + linux,input-value = <1>;
> + gpios = <&tlmm 52 GPIO_ACTIVE_LOW>;
> + debounce-interval = <50>;
> + linux,can-disable;
> + };
> +
> + state-bottom {
> + label = "Tri-state key bottom";
> + linux,input-type = <EV_ABS>;
> + linux,code = <ABS_SND_PROFILE>;
> + linux,input-value = <2>;
> + 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"
> @@ -588,9 +626,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 {
You need to rebase.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-01-19 11:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-18 23:46 [PATCH 0/3] Add tri-state-key for oneplus Gergo Koteles
2023-01-18 23:46 ` [PATCH 1/3] Input: gpio-keys - add support for linux,input-value dts property Gergo Koteles
2023-01-18 23:46 ` [PATCH 2/3] Input: add ABS_SND_PROFILE Gergo Koteles
2023-01-18 23:46 ` [PATCH 3/3] arm64: dts: qcom: sdm845-oneplus: add tri-state-key Gergo Koteles
2023-01-19 11:29 ` Krzysztof Kozlowski
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).