adc-keys.yaml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. # SPDX-License-Identifier: GPL-2.0
  2. %YAML 1.2
  3. ---
  4. $id: http://devicetree.org/schemas/input/adc-keys.yaml#
  5. $schema: http://devicetree.org/meta-schemas/core.yaml#
  6. title: ADC attached resistor ladder buttons
  7. maintainers:
  8. - Alexandre Belloni <alexandre.belloni@bootlin.com>
  9. allOf:
  10. - $ref: input.yaml#
  11. properties:
  12. compatible:
  13. const: adc-keys
  14. io-channels:
  15. maxItems: 1
  16. io-channel-names:
  17. const: buttons
  18. keyup-threshold-microvolt:
  19. description:
  20. Voltage above or equal to which all the keys are considered up.
  21. poll-interval: true
  22. autorepeat: true
  23. patternProperties:
  24. '^button-':
  25. type: object
  26. $ref: input.yaml#
  27. additionalProperties: false
  28. description:
  29. Each button (key) is represented as a sub-node.
  30. properties:
  31. label: true
  32. linux,code: true
  33. press-threshold-microvolt:
  34. description:
  35. Voltage above or equal to which this key is considered pressed. No
  36. two values of press-threshold-microvolt may be the same. All values
  37. of press-threshold-microvolt must be less than
  38. keyup-threshold-microvolt.
  39. required:
  40. - linux,code
  41. - press-threshold-microvolt
  42. required:
  43. - compatible
  44. - io-channels
  45. - io-channel-names
  46. - keyup-threshold-microvolt
  47. additionalProperties: false
  48. examples:
  49. - |
  50. #include <dt-bindings/input/input.h>
  51. // +--------------------------------+------------------------+
  52. // | 2.000.000 <= value | no key pressed |
  53. // +--------------------------------+------------------------+
  54. // | 1.500.000 <= value < 2.000.000 | KEY_VOLUMEUP pressed |
  55. // +--------------------------------+------------------------+
  56. // | 1.000.000 <= value < 1.500.000 | KEY_VOLUMEDOWN pressed |
  57. // +--------------------------------+------------------------+
  58. // | 500.000 <= value < 1.000.000 | KEY_ENTER pressed |
  59. // +--------------------------------+------------------------+
  60. // | value < 500.000 | no key pressed |
  61. // +--------------------------------+------------------------+
  62. adc-keys {
  63. compatible = "adc-keys";
  64. io-channels = <&lradc 0>;
  65. io-channel-names = "buttons";
  66. keyup-threshold-microvolt = <2000000>;
  67. button-up {
  68. label = "Volume Up";
  69. linux,code = <KEY_VOLUMEUP>;
  70. press-threshold-microvolt = <1500000>;
  71. };
  72. button-down {
  73. label = "Volume Down";
  74. linux,code = <KEY_VOLUMEDOWN>;
  75. press-threshold-microvolt = <1000000>;
  76. };
  77. button-enter {
  78. label = "Enter";
  79. linux,code = <KEY_ENTER>;
  80. press-threshold-microvolt = <500000>;
  81. };
  82. };
  83. ...