xref: /linux/Documentation/devicetree/bindings/input/microchip,cap11xx.yaml (revision 3a2c4d55e32ad65efebdb6de44eef3bfa08bb49d)
1# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/input/microchip,cap11xx.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Microchip CAP11xx based capacitive touch sensors
8
9description: |
10  The Microchip CAP1xxx Family of RightTouchTM multiple-channel capacitive
11  touch controllers and LED drivers. The device communication via I2C only.
12
13  For more product information please see the links below:
14    CAP1106: https://ww1.microchip.com/downloads/en/DeviceDoc/00001624B.pdf
15    CAP1114: https://ww1.microchip.com/downloads/en/DeviceDoc/00002444A.pdf
16    CAP1126: https://ww1.microchip.com/downloads/en/DeviceDoc/00001623B.pdf
17    CAP1188: https://ww1.microchip.com/downloads/en/DeviceDoc/00001620C.pdf
18    CAP1203: https://ww1.microchip.com/downloads/en/DeviceDoc/00001572B.pdf
19    CAP1206: https://ww1.microchip.com/downloads/en/DeviceDoc/00001567B.pdf
20    CAP1293: https://ww1.microchip.com/downloads/en/DeviceDoc/00001566B.pdf
21    CAP1298: https://ww1.microchip.com/downloads/en/DeviceDoc/00001571B.pdf
22
23maintainers:
24  - Rob Herring <robh@kernel.org>
25
26properties:
27  compatible:
28    enum:
29      - microchip,cap1106
30      - microchip,cap1114
31      - microchip,cap1126
32      - microchip,cap1188
33      - microchip,cap1203
34      - microchip,cap1206
35      - microchip,cap1293
36      - microchip,cap1298
37
38  reg:
39    maxItems: 1
40
41  '#address-cells':
42    const: 1
43
44  '#size-cells':
45    const: 0
46
47  interrupts:
48    maxItems: 1
49    description: |
50      Property describing the interrupt line the
51      device's ALERT#/CM_IRQ# pin is connected to.
52      The device only has one interrupt source.
53
54  reset-gpios:
55    description: |
56      GPIO connected to the active-high RESET pin of the chip;
57      driving it high asserts reset and deep sleep, while driving
58      it low releases reset for normal operation.
59    maxItems: 1
60
61  autorepeat:
62    description: |
63      Enables the Linux input system's autorepeat feature on the input device.
64
65  linux,keycodes:
66    minItems: 3
67    maxItems: 14
68    description: |
69      Specifies an array of numeric keycode values to
70      be used for the channels. If this property is
71      omitted, KEY_A, KEY_B, etc are used as defaults.
72      The number of entries must correspond to the number of channels.
73
74  microchip,sensor-gain:
75    $ref: /schemas/types.yaml#/definitions/uint32
76    default: 1
77    enum: [1, 2, 4, 8]
78    description: |
79      Defines the gain of the sensor circuitry. This
80      effectively controls the sensitivity, as a
81      smaller delta capacitance is required to
82      generate the same delta count values.
83
84  microchip,irq-active-high:
85    type: boolean
86    description: |
87      By default the interrupt pin is active low
88      open drain. This property allows using the active
89      high push-pull output.
90
91  microchip,sensitivity-delta-sense:
92    $ref: /schemas/types.yaml#/definitions/uint32
93    default: 32
94    enum: [1, 2, 4, 8, 16, 32, 64, 128]
95    description:
96      Controls the sensitivity multiplier of a touch detection.
97      Higher value means more sensitive settings.
98      At the more sensitive settings, touches are detected for a smaller delta
99      capacitance corresponding to a "lighter" touch.
100
101  microchip,signal-guard:
102    $ref: /schemas/types.yaml#/definitions/uint32-array
103    minItems: 3
104    maxItems: 8
105    items:
106      enum: [0, 1]
107    description: |
108      0 - off
109      1 - on
110      The signal guard isolates the signal from virtual grounds.
111      If enabled then the behavior of the channel is changed to signal guard.
112      The number of entries must correspond to the number of channels.
113
114  microchip,input-threshold:
115    $ref: /schemas/types.yaml#/definitions/uint32-array
116    minItems: 3
117    maxItems: 8
118    items:
119      minimum: 0
120      maximum: 127
121    description:
122      Specifies the delta threshold that is used to determine if a touch has
123      been detected. A higher value means a larger difference in capacitance
124      is required for a touch to be registered, making the touch sensor less
125      sensitive.
126      The number of entries must correspond to the number of channels.
127      CAP1114 is an exception where channels 8~14 reuse the eighth entry's
128      threshold, so counts differ.
129
130  microchip,calib-sensitivity:
131    $ref: /schemas/types.yaml#/definitions/uint32-array
132    minItems: 3
133    maxItems: 8
134    items:
135      enum: [1, 2, 4]
136    description: |
137      Specifies an array of numeric values that controls the gain
138      used by the calibration routine to enable sensor inputs
139      to be more sensitive for proximity detection.
140      Gain is based on touch pad capacitance range
141      1 - 5-50pF
142      2 - 0-25pF
143      4 - 0-12.5pF
144      The number of entries must correspond to the number of channels.
145
146patternProperties:
147  "^led@[0-9a]$":
148    type: object
149    description: CAP11xx LEDs
150    $ref: /schemas/leds/common.yaml#
151
152    properties:
153      reg:
154        description: LED channel number
155        minimum: 0
156        maximum: 10
157
158      label: true
159
160      linux,default-trigger: true
161
162      default-state: true
163
164    required:
165      - reg
166
167    additionalProperties: false
168
169allOf:
170  - $ref: input.yaml
171  - if:
172      properties:
173        compatible:
174          contains:
175            enum:
176              - microchip,cap1106
177              - microchip,cap1203
178              - microchip,cap1206
179              - microchip,cap1293
180              - microchip,cap1298
181    then:
182      properties:
183        reset-gpios: false
184
185  - if:
186      properties:
187        compatible:
188          contains:
189            enum:
190              - microchip,cap1114
191    then:
192      properties:
193        linux,keycodes:
194          minItems: 14
195    else:
196      properties:
197        linux,keycodes:
198          maxItems: 8
199
200  - if:
201      properties:
202        compatible:
203          contains:
204            enum:
205              - microchip,cap1106
206              - microchip,cap1203
207              - microchip,cap1206
208              - microchip,cap1293
209              - microchip,cap1298
210    then:
211      patternProperties:
212        "^led@": false
213
214  - if:
215      properties:
216        compatible:
217          contains:
218            enum:
219              - microchip,cap1126
220    then:
221      patternProperties:
222        "^led@":
223          properties:
224            reg:
225              maximum: 1
226
227  - if:
228      properties:
229        compatible:
230          contains:
231            enum:
232              - microchip,cap1188
233    then:
234      patternProperties:
235        "^led@":
236          properties:
237            reg:
238              maximum: 7
239
240  - if:
241      properties:
242        compatible:
243          contains:
244            enum:
245              - microchip,cap1106
246              - microchip,cap1114
247              - microchip,cap1126
248              - microchip,cap1188
249              - microchip,cap1203
250              - microchip,cap1206
251    then:
252      properties:
253        microchip,signal-guard: false
254        microchip,calib-sensitivity: false
255
256required:
257  - compatible
258  - interrupts
259
260additionalProperties: false
261
262examples:
263  - |
264    #include <dt-bindings/gpio/gpio.h>
265
266    i2c {
267      #address-cells = <1>;
268      #size-cells = <0>;
269
270      touch@28 {
271        compatible = "microchip,cap1188";
272        interrupt-parent = <&gpio1>;
273        interrupts = <0 0>;
274        reg = <0x28>;
275        autorepeat;
276        microchip,sensor-gain = <2>;
277        microchip,sensitivity-delta-sense = <16>;
278        microchip,input-threshold = <21>, <18>, <46>, <46>, <46>, <21>;
279
280        linux,keycodes = <103>, /* KEY_UP */
281                         <106>, /* KEY_RIGHT */
282                         <108>, /* KEY_DOWN */
283                         <105>, /* KEY_LEFT */
284                         <109>, /* KEY_PAGEDOWN */
285                         <104>; /* KEY_PAGEUP */
286
287        reset-gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
288
289        #address-cells = <1>;
290        #size-cells = <0>;
291
292        led@0 {
293                label = "cap11xx:green:usr0";
294                reg = <0>;
295        };
296
297        led@1 {
298                label = "cap11xx:green:usr1";
299                reg = <1>;
300        };
301
302        led@2 {
303                label = "cap11xx:green:alive";
304                reg = <2>;
305                linux,default-trigger = "heartbeat";
306        };
307      };
308    };
309