xref: /linux/Documentation/devicetree/bindings/input/syna,rmi4.yaml (revision 3a2c4d55e32ad65efebdb6de44eef3bfa08bb49d)
1# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/input/syna,rmi4.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Synaptics RMI4 compliant devices
8
9maintainers:
10  - Jason A. Donenfeld <Jason@zx2c4.com>
11  - Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
12  - Vincent Huang <vincent.huang@tw.synaptics.com>
13
14description: |
15  The Synaptics RMI4 (Register Mapped Interface 4) core is able to support RMI4
16  devices using different transports (I2C, SPI) and different functions (e.g.
17  Function 1, 2D sensors using Function 11 or 12).
18
19properties:
20  compatible:
21    oneOf:
22      - enum:
23          - syna,rmi4-i2c
24          - syna,rmi4-spi
25      - items:
26          - enum:
27              - syna,rmi4-s3706b  # OnePlus 6/6T
28          - const: syna,rmi4-i2c
29
30  reg:
31    maxItems: 1
32
33  '#address-cells':
34    const: 1
35
36  '#size-cells':
37    const: 0
38
39  interrupts:
40    maxItems: 1
41
42  reset-gpios:
43    maxItems: 1
44    description: Active low signal
45
46  spi-cpha: true
47  spi-cpol: true
48
49  syna,reset-delay-ms:
50    description:
51      Delay to wait after resetting the device.
52
53  syna,startup-delay-ms:
54    description:
55      Delay to wait after powering on the device.
56
57  vdd-supply: true
58  vio-supply: true
59
60  rmi4-f01@1:
61    type: object
62    additionalProperties: false
63    description:
64      Function 1
65
66    properties:
67      reg:
68        maxItems: 1
69
70      syna,nosleep-mode:
71        $ref: /schemas/types.yaml#/definitions/uint32
72        enum: [0, 1, 2]
73        description:
74          If set the device will run at full power without sleeping.  nosleep
75          has 3 modes, 0 will not change the default setting, 1 will disable
76          nosleep (allow sleeping), and 2 will enable nosleep (disabling
77          sleep).
78
79      syna,wakeup-threshold:
80        $ref: /schemas/types.yaml#/definitions/uint32
81        description:
82          Defines the amplitude of the disturbance to the background
83          capacitance that will cause the device to wake from dozing.
84
85      syna,doze-holdoff-ms:
86        description:
87          The delay to wait after the last finger lift and the first doze
88          cycle.
89
90      syna,doze-interval-ms:
91        description:
92          The time period that the device sleeps between finger activity.
93
94    required:
95      - reg
96
97  rmi4-f1a@1a:
98    type: object
99    additionalProperties: false
100    $ref: input.yaml#
101    description:
102      RMI4 Function 1A is for capacitive keys.
103
104    properties:
105      reg:
106        maxItems: 1
107
108      linux,keycodes:
109        minItems: 1
110        maxItems: 4
111
112    required:
113      - reg
114
115patternProperties:
116  "^rmi4-f1[12]@1[12]$":
117    type: object
118    unevaluatedProperties: false
119    $ref: /schemas/input/touchscreen/touchscreen.yaml#
120    description:
121      RMI4 Function 11 and Function 12 are for 2D touch position sensing.
122
123    properties:
124      reg:
125        maxItems: 1
126
127      syna,clip-x-low:
128        $ref: /schemas/types.yaml#/definitions/uint32
129        description:
130          Minimum value for X.
131
132      syna,clip-y-low:
133        $ref: /schemas/types.yaml#/definitions/uint32
134        description:
135          Minimum value for Y.
136
137      syna,clip-x-high:
138        $ref: /schemas/types.yaml#/definitions/uint32
139        description:
140          Maximum value for X.
141
142      syna,clip-y-high:
143        $ref: /schemas/types.yaml#/definitions/uint32
144        description:
145          Maximum value for Y.
146
147      syna,offset-x:
148        $ref: /schemas/types.yaml#/definitions/uint32
149        description:
150          Add an offset to X.
151
152      syna,offset-y:
153        $ref: /schemas/types.yaml#/definitions/uint32
154        description:
155          Add an offset to Y.
156
157      syna,delta-x-threshold:
158        $ref: /schemas/types.yaml#/definitions/uint32
159        description:
160          Minimum distance on the X axis required to generate an interrupt in
161          reduced reporting mode.
162
163      syna,delta-y-threshold:
164        $ref: /schemas/types.yaml#/definitions/uint32
165        description:
166          Minimum distance on the Y axis required to generate an interrupt in
167          reduced reporting mode.
168
169      syna,sensor-type:
170        $ref: /schemas/types.yaml#/definitions/uint32
171        enum: [1, 2]
172        description: |
173          Sensor type: 1 for touchscreen 2 for touchpad.
174
175      syna,disable-report-mask:
176        $ref: /schemas/types.yaml#/definitions/uint32
177        description:
178          Mask for disabling posiiton reporting. Used to disable reporing
179          absolute position data.
180
181      syna,rezero-wait-ms:
182        description:
183          Time to wait after issuing a rezero command.
184
185    required:
186      - reg
187
188  "^rmi4-f[0-9a-f]+@[0-9a-f]+$":
189    type: object
190    additionalProperties: true
191
192    description:
193      Other functions, not documented yet.
194
195    properties:
196      reg:
197        maxItems: 1
198
199    required:
200      - reg
201
202required:
203  - compatible
204  - reg
205
206unevaluatedProperties: false
207
208allOf:
209  - $ref: /schemas/spi/spi-peripheral-props.yaml#
210
211  - if:
212      properties:
213        compatible:
214          contains:
215            const: syna,rmi4-i2c
216    then:
217      properties:
218        spi-rx-delay-us: false
219        spi-tx-delay-us: false
220    else:
221      properties:
222        syna,reset-delay-ms: false
223        syna,startup-delay-ms: false
224
225examples:
226  - |
227    #include <dt-bindings/input/linux-event-codes.h>
228    #include <dt-bindings/interrupt-controller/irq.h>
229
230    i2c {
231        #address-cells = <1>;
232        #size-cells = <0>;
233
234        touchscreen@20 {
235            compatible = "syna,rmi4-i2c";
236            reg = <0x20>;
237            interrupt-parent = <&gpx1>;
238            interrupts = <6 IRQ_TYPE_EDGE_FALLING>;
239
240            syna,startup-delay-ms = <100>;
241            vdd-supply = <&tsp_vdd>;
242            vio-supply = <&ldo32_reg>;
243
244            pinctrl-0 = <&touch_irq>;
245            pinctrl-names = "default";
246            #address-cells = <1>;
247            #size-cells = <0>;
248
249            rmi4-f01@1 {
250                reg = <0x1>;
251                syna,nosleep-mode = <1>;
252            };
253
254            rmi4-f12@12 {
255                reg = <0x12>;
256                syna,sensor-type = <1>;
257            };
258
259            rmi4-f1a@1a {
260                reg = <0x1a>;
261                linux,keycodes = <KEY_BACK KEY_HOME KEY_MENU>;
262            };
263        };
264    };
265
266  - |
267    #include <dt-bindings/interrupt-controller/irq.h>
268
269    spi {
270        #address-cells = <1>;
271        #size-cells = <0>;
272
273        touchscreen@0 {
274            compatible = "syna,rmi4-spi";
275            reg = <0x0>;
276            interrupt-parent = <&gpx1>;
277            interrupts = <6 IRQ_TYPE_EDGE_FALLING>;
278
279            spi-max-frequency = <4000000>;
280            spi-rx-delay-us = <30>;
281            spi-cpha;
282            spi-cpol;
283
284            #address-cells = <1>;
285            #size-cells = <0>;
286
287            rmi4-f01@1 {
288                reg = <0x1>;
289                syna,nosleep-mode = <1>;
290            };
291
292            rmi4-f11@11 {
293                reg = <0x11>;
294                touchscreen-inverted-y;
295                syna,sensor-type = <2>;
296            };
297        };
298    };
299