180c99bcdSDaniel MackRotary encoder DT bindings 280c99bcdSDaniel Mack 380c99bcdSDaniel MackRequired properties: 47dde4e74SUwe Kleine-König- gpios: a spec for at least two GPIOs to be used, most significant first 580c99bcdSDaniel Mack 680c99bcdSDaniel MackOptional properties: 780c99bcdSDaniel Mack- linux,axis: the input subsystem axis to map to this rotary encoder. 880c99bcdSDaniel Mack Defaults to 0 (ABS_X / REL_X) 980c99bcdSDaniel Mack- rotary-encoder,steps: Number of steps in a full turnaround of the 1080c99bcdSDaniel Mack encoder. Only relevant for absolute axis. Defaults to 24 which is a 1180c99bcdSDaniel Mack typical value for such devices. 1280c99bcdSDaniel Mack- rotary-encoder,relative-axis: register a relative axis rather than an 1380c99bcdSDaniel Mack absolute one. Relative axis will only generate +1/-1 events on the input 1480c99bcdSDaniel Mack device, hence no steps need to be passed. 15cd81abdfSRahul Bedarkar- rotary-encoder,rollover: Automatic rollover when the rotary value becomes 1680c99bcdSDaniel Mack greater than the specified steps or smaller than 0. For absolute axis only. 173a341a4cSEzequiel Garcia- rotary-encoder,steps-per-period: Number of steps (stable states) per period. 183a341a4cSEzequiel Garcia The values have the following meaning: 193a341a4cSEzequiel Garcia 1: Full-period mode (default) 203a341a4cSEzequiel Garcia 2: Half-period mode 213a341a4cSEzequiel Garcia 4: Quarter-period mode 2247ec6e5aSSylvain Rochet- wakeup-source: Boolean, rotary encoder can wake up the system. 23d205a218SUwe Kleine-König- rotary-encoder,encoding: String, the method used to encode steps. 24d205a218SUwe Kleine-König Supported are "gray" (the default and more common) and "binary". 2580c99bcdSDaniel Mack 263a341a4cSEzequiel GarciaDeprecated properties: 273a341a4cSEzequiel Garcia- rotary-encoder,half-period: Makes the driver work on half-period mode. 283a341a4cSEzequiel Garcia This property is deprecated. Instead, a 'steps-per-period ' value should 293a341a4cSEzequiel Garcia be used, such as "rotary-encoder,steps-per-period = <2>". 303a341a4cSEzequiel Garcia 31*5fb94e9cSMauro Carvalho ChehabSee Documentation/input/devices/rotary-encoder.rst for more information. 3280c99bcdSDaniel Mack 3380c99bcdSDaniel MackExample: 3480c99bcdSDaniel Mack 3580c99bcdSDaniel Mack rotary@0 { 3680c99bcdSDaniel Mack compatible = "rotary-encoder"; 3780c99bcdSDaniel Mack gpios = <&gpio 19 1>, <&gpio 20 0>; /* GPIO19 is inverted */ 3880c99bcdSDaniel Mack linux,axis = <0>; /* REL_X */ 39d205a218SUwe Kleine-König rotary-encoder,encoding = "gray"; 4080c99bcdSDaniel Mack rotary-encoder,relative-axis; 4180c99bcdSDaniel Mack }; 4280c99bcdSDaniel Mack 4380c99bcdSDaniel Mack rotary@1 { 4480c99bcdSDaniel Mack compatible = "rotary-encoder"; 4580c99bcdSDaniel Mack gpios = <&gpio 21 0>, <&gpio 22 0>; 4680c99bcdSDaniel Mack linux,axis = <1>; /* ABS_Y */ 4780c99bcdSDaniel Mack rotary-encoder,steps = <24>; 48d205a218SUwe Kleine-König rotary-encoder,encoding = "binary"; 4980c99bcdSDaniel Mack rotary-encoder,rollover; 5080c99bcdSDaniel Mack }; 51