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