rotary-encoder.txt 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. Rotary encoder DT bindings
  2. Required properties:
  3. - gpios: a spec for at least two GPIOs to be used, most significant first
  4. Optional properties:
  5. - linux,axis: the input subsystem axis to map to this rotary encoder.
  6. Defaults to 0 (ABS_X / REL_X)
  7. - rotary-encoder,steps: Number of steps in a full turnaround of the
  8. encoder. Only relevant for absolute axis. Defaults to 24 which is a
  9. typical value for such devices.
  10. - rotary-encoder,relative-axis: register a relative axis rather than an
  11. absolute one. Relative axis will only generate +1/-1 events on the input
  12. device, hence no steps need to be passed.
  13. - rotary-encoder,rollover: Automatic rollove when the rotary value becomes
  14. greater than the specified steps or smaller than 0. For absolute axis only.
  15. - rotary-encoder,steps-per-period: Number of steps (stable states) per period.
  16. The values have the following meaning:
  17. 1: Full-period mode (default)
  18. 2: Half-period mode
  19. 4: Quarter-period mode
  20. - wakeup-source: Boolean, rotary encoder can wake up the system.
  21. - rotary-encoder,encoding: String, the method used to encode steps.
  22. Supported are "gray" (the default and more common) and "binary".
  23. Deprecated properties:
  24. - rotary-encoder,half-period: Makes the driver work on half-period mode.
  25. This property is deprecated. Instead, a 'steps-per-period ' value should
  26. be used, such as "rotary-encoder,steps-per-period = <2>".
  27. See Documentation/input/rotary-encoder.txt for more information.
  28. Example:
  29. rotary@0 {
  30. compatible = "rotary-encoder";
  31. gpios = <&gpio 19 1>, <&gpio 20 0>; /* GPIO19 is inverted */
  32. linux,axis = <0>; /* REL_X */
  33. rotary-encoder,encoding = "gray";
  34. rotary-encoder,relative-axis;
  35. };
  36. rotary@1 {
  37. compatible = "rotary-encoder";
  38. gpios = <&gpio 21 0>, <&gpio 22 0>;
  39. linux,axis = <1>; /* ABS_Y */
  40. rotary-encoder,steps = <24>;
  41. rotary-encoder,encoding = "binary";
  42. rotary-encoder,rollover;
  43. };