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
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 <[email protected]>
Signed-off-by: Caleb Connolly <[email protected]>
Signed-off-by: Gergo Koteles <[email protected]>
---
.../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
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 <[email protected]>
---
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
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 <[email protected]>
> Signed-off-by: Caleb Connolly <[email protected]>
> Signed-off-by: Gergo Koteles <[email protected]>
> ---
> .../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