adc-keys.txt 2.0 KB

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