^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) ADC attached resistor ladder buttons
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) ------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) Required properties:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) - compatible: "adc-keys"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) - io-channels: Phandle to an ADC channel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) - io-channel-names = "buttons";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) - keyup-threshold-microvolt: Voltage at which all the keys are considered up.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) Optional properties:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) - poll-interval: Poll interval time in milliseconds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) - autorepeat: Boolean, Enable auto repeat feature of Linux input
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) subsystem.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) Each button (key) is represented as a sub-node of "adc-keys":
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) Required subnode-properties:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) - label: Descriptive name of the key.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) - linux,code: Keycode to emit.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) - press-threshold-microvolt: Voltage ADC input when this key is pressed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) Example:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <dt-bindings/input/input.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) adc-keys {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) compatible = "adc-keys";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) io-channels = <&lradc 0>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) io-channel-names = "buttons";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) keyup-threshold-microvolt = <2000000>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) button-up {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) label = "Volume Up";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) linux,code = <KEY_VOLUMEUP>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) press-threshold-microvolt = <1500000>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) button-down {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) label = "Volume Down";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) linux,code = <KEY_VOLUMEDOWN>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) press-threshold-microvolt = <1000000>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) button-enter {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) label = "Enter";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) linux,code = <KEY_ENTER>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) press-threshold-microvolt = <500000>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) };