rotary-encoder.yaml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
  2. %YAML 1.2
  3. ---
  4. $id: http://devicetree.org/schemas/input/rotary-encoder.yaml#
  5. $schema: http://devicetree.org/meta-schemas/core.yaml#
  6. title: Rotary encoder
  7. maintainers:
  8. - Frank Li <Frank.Li@nxp.com>
  9. description:
  10. See Documentation/input/devices/rotary-encoder.rst for more information.
  11. properties:
  12. compatible:
  13. const: rotary-encoder
  14. gpios:
  15. minItems: 2
  16. linux,axis:
  17. default: 0
  18. description:
  19. the input subsystem axis to map to this rotary encoder.
  20. Defaults to 0 (ABS_X / REL_X)
  21. rotary-encoder,steps:
  22. $ref: /schemas/types.yaml#/definitions/uint32
  23. default: 24
  24. description:
  25. Number of steps in a full turnaround of the
  26. encoder. Only relevant for absolute axis. Defaults to 24 which is a
  27. typical value for such devices.
  28. rotary-encoder,relative-axis:
  29. $ref: /schemas/types.yaml#/definitions/flag
  30. description:
  31. register a relative axis rather than an
  32. absolute one. Relative axis will only generate +1/-1 events on the input
  33. device, hence no steps need to be passed.
  34. rotary-encoder,rollover:
  35. $ref: /schemas/types.yaml#/definitions/int32
  36. description:
  37. Automatic rollover when the rotary value becomes
  38. greater than the specified steps or smaller than 0. For absolute axis only.
  39. rotary-encoder,steps-per-period:
  40. $ref: /schemas/types.yaml#/definitions/uint32
  41. default: 1
  42. enum: [1, 2, 4]
  43. description: |
  44. Number of steps (stable states) per period.
  45. The values have the following meaning:
  46. 1: Full-period mode (default)
  47. 2: Half-period mode
  48. 4: Quarter-period mode
  49. wakeup-source: true
  50. rotary-encoder,encoding:
  51. $ref: /schemas/types.yaml#/definitions/string
  52. description: the method used to encode steps.
  53. enum: [gray, binary]
  54. rotary-encoder,half-period:
  55. $ref: /schemas/types.yaml#/definitions/flag
  56. deprecated: true
  57. description:
  58. Makes the driver work on half-period mode.
  59. This property is deprecated. Instead, a 'steps-per-period ' value should
  60. be used, such as "rotary-encoder,steps-per-period = <2>".
  61. required:
  62. - compatible
  63. - gpios
  64. additionalProperties: false
  65. examples:
  66. - |
  67. rotary {
  68. compatible = "rotary-encoder";
  69. gpios = <&gpio 19 1>, <&gpio 20 0>; /* GPIO19 is inverted */
  70. linux,axis = <0>; /* REL_X */
  71. rotary-encoder,encoding = "gray";
  72. rotary-encoder,relative-axis;
  73. };