1# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2# Copyright 2019-2020 Artur Rojek
3%YAML 1.2
4---
5$id: "http://devicetree.org/schemas/input/adc-joystick.yaml#"
6$schema: "http://devicetree.org/meta-schemas/core.yaml#"
7
8title: ADC attached joystick
9
10maintainers:
11  - Artur Rojek <contact@artur-rojek.eu>
12
13description: >
14  Bindings for joystick devices connected to ADC controllers supporting
15  the Industrial I/O subsystem.
16
17properties:
18  compatible:
19    const: adc-joystick
20
21  io-channels:
22    minItems: 1
23    maxItems: 1024
24    description: >
25      List of phandle and IIO specifier pairs.
26      Each pair defines one ADC channel to which a joystick axis is connected.
27      See Documentation/devicetree/bindings/iio/iio-bindings.txt for details.
28
29  '#address-cells':
30    const: 1
31
32  '#size-cells':
33    const: 0
34
35required:
36  - compatible
37  - io-channels
38  - '#address-cells'
39  - '#size-cells'
40
41additionalProperties: false
42
43patternProperties:
44  "^axis@[0-9a-f]+$":
45    type: object
46    description: >
47      Represents a joystick axis bound to the given ADC channel.
48      For each entry in the io-channels list, one axis subnode with a matching
49      reg property must be specified.
50
51    properties:
52      reg:
53        minimum: 0
54        maximum: 1023
55        description: Index of an io-channels list entry bound to this axis.
56
57      linux,code:
58        $ref: /schemas/types.yaml#/definitions/uint32
59        description: EV_ABS specific event code generated by the axis.
60
61      abs-range:
62        allOf:
63          - $ref: /schemas/types.yaml#/definitions/uint32-array
64          - items:
65              - description: minimum value
66              - description: maximum value
67        description: >
68          Minimum and maximum values produced by the axis.
69          For an ABS_X axis this will be the left-most and right-most
70          inclination of the joystick. If min > max, it is left to userspace to
71          treat the axis as inverted.
72          This property is interpreted as two signed 32 bit values.
73
74      abs-fuzz:
75        $ref: /schemas/types.yaml#/definitions/uint32
76        description: >
77          Amount of noise in the input value.
78          Omitting this property indicates the axis is precise.
79
80      abs-flat:
81        $ref: /schemas/types.yaml#/definitions/uint32
82        description: >
83          Axial "deadzone", or area around the center position, where the axis
84          is considered to be at rest.
85          Omitting this property indicates the axis always returns to exactly
86          the center position.
87
88    required:
89      - reg
90      - linux,code
91      - abs-range
92
93    additionalProperties: false
94
95examples:
96  - |
97    #include <dt-bindings/iio/adc/ingenic,adc.h>
98    #include <dt-bindings/input/input.h>
99
100    joystick: adc-joystick {
101      compatible = "adc-joystick";
102      io-channels = <&adc INGENIC_ADC_TOUCH_XP>,
103                    <&adc INGENIC_ADC_TOUCH_YP>;
104      #address-cells = <1>;
105      #size-cells = <0>;
106
107      axis@0 {
108              reg = <0>;
109              linux,code = <ABS_X>;
110              abs-range = <3300 0>;
111              abs-fuzz = <4>;
112              abs-flat = <200>;
113      };
114      axis@1 {
115              reg = <1>;
116              linux,code = <ABS_Y>;
117              abs-range = <0 3300>;
118              abs-fuzz = <4>;
119              abs-flat = <200>;
120      };
121    };
122