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