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