mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-10 15:19:51 +00:00
698dc0cf94
The current description of ADC keys is not precise enough. "when this key is pressed" leaves it open if a key is considered pressed below or above the threshold. This has led to confusion: drivers/input/keyboard/adc-keys.c ignores the meaning of thresholds and sets the key that is closest to press-threshold-microvolt. This patch nails down the definitions and provides an interpretation of the supplied example. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Acked-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20201222110815.24121-1-xypron.glpk@gmx.de Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
68 lines
2.0 KiB
Plaintext
68 lines
2.0 KiB
Plaintext
ADC attached resistor ladder buttons
|
|
------------------------------------
|
|
|
|
Required properties:
|
|
- compatible: "adc-keys"
|
|
- io-channels: Phandle to an ADC channel
|
|
- io-channel-names = "buttons";
|
|
- keyup-threshold-microvolt: Voltage above or equal to which all the keys are
|
|
considered up.
|
|
|
|
Optional properties:
|
|
- poll-interval: Poll interval time in milliseconds
|
|
- autorepeat: Boolean, Enable auto repeat feature of Linux input
|
|
subsystem.
|
|
|
|
Each button (key) is represented as a sub-node of "adc-keys":
|
|
|
|
Required subnode-properties:
|
|
- label: Descriptive name of the key.
|
|
- linux,code: Keycode to emit.
|
|
- press-threshold-microvolt: voltage above or equal to which this key is
|
|
considered pressed.
|
|
|
|
No two values of press-threshold-microvolt may be the same.
|
|
All values of press-threshold-microvolt must be less than
|
|
keyup-threshold-microvolt.
|
|
|
|
Example:
|
|
|
|
#include <dt-bindings/input/input.h>
|
|
|
|
adc-keys {
|
|
compatible = "adc-keys";
|
|
io-channels = <&lradc 0>;
|
|
io-channel-names = "buttons";
|
|
keyup-threshold-microvolt = <2000000>;
|
|
|
|
button-up {
|
|
label = "Volume Up";
|
|
linux,code = <KEY_VOLUMEUP>;
|
|
press-threshold-microvolt = <1500000>;
|
|
};
|
|
|
|
button-down {
|
|
label = "Volume Down";
|
|
linux,code = <KEY_VOLUMEDOWN>;
|
|
press-threshold-microvolt = <1000000>;
|
|
};
|
|
|
|
button-enter {
|
|
label = "Enter";
|
|
linux,code = <KEY_ENTER>;
|
|
press-threshold-microvolt = <500000>;
|
|
};
|
|
};
|
|
|
|
+--------------------------------+------------------------+
|
|
| 2.000.000 <= value | no key pressed |
|
|
+--------------------------------+------------------------+
|
|
| 1.500.000 <= value < 2.000.000 | KEY_VOLUMEUP pressed |
|
|
+--------------------------------+------------------------+
|
|
| 1.000.000 <= value < 1.500.000 | KEY_VOLUMEDOWN pressed |
|
|
+--------------------------------+------------------------+
|
|
| 500.000 <= value < 1.000.000 | KEY_ENTER pressed |
|
|
+--------------------------------+------------------------+
|
|
| value < 500.000 | no key pressed |
|
|
+--------------------------------+------------------------+
|