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