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