xref: /linux/Documentation/devicetree/bindings/mfd/st,stmpe.yaml (revision 8dd765a5d769c521d73931850d1c8708fbc490cb)
1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/mfd/st,stmpe.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: STMicroelectonics Port Expander (STMPE)
8
9description: STMicroelectronics Port Expander (STMPE) is a series of slow
10  bus controllers for various expanded peripherals such as GPIO, keypad,
11  touchscreen, ADC, PWM or rotator. It can contain one or several different
12  peripherals connected to SPI or I2C.
13
14maintainers:
15  - Linus Walleij <linus.walleij@linaro.org>
16
17allOf:
18  - $ref: /schemas/spi/spi-peripheral-props.yaml#
19
20properties:
21  compatible:
22    enum:
23      - st,stmpe601
24      - st,stmpe801
25      - st,stmpe811
26      - st,stmpe1600
27      - st,stmpe1601
28      - st,stmpe2401
29      - st,stmpe2403
30
31  reg:
32    maxItems: 1
33
34  interrupts:
35    maxItems: 1
36
37  vcc-supply: true
38
39  vio-supply: true
40
41  reset-gpios:
42    maxItems: 1
43
44  wakeup-source: true
45
46  st,autosleep-timeout:
47    $ref: /schemas/types.yaml#/definitions/uint32
48    enum: [ 4, 16, 32, 64, 128, 256, 512, 1024 ]
49    description: Time idle before going to automatic sleep to save power
50
51  st,sample-time:
52    $ref: /schemas/types.yaml#/definitions/uint32
53    enum: [ 0, 1, 2, 3, 4, 5, 6 ]
54    description: |
55      Sample time per iteration
56      0 = 36 clock ticks
57      1 = 44 clock ticks
58      2 = 56 clock ticks
59      3 = 64 clock ticks
60      4 = 80 clock ticks - recommended
61      5 = 96 clock ticks
62      6 = 124 clock ticks
63
64  st,mod-12b:
65    $ref: /schemas/types.yaml#/definitions/uint32
66    enum: [ 0, 1 ]
67    description: ADC bit mode 0 = 10bit ADC, 1 = 12bit ADC
68
69  st,ref-sel:
70    $ref: /schemas/types.yaml#/definitions/uint32
71    enum: [ 0, 1 ]
72    description: ADC reference source 0 = internal, 1 = external
73
74  st,adc-freq:
75    $ref: /schemas/types.yaml#/definitions/uint32
76    enum: [ 0, 1, 2, 3 ]
77    description: |
78      ADC clock speed
79      0 = 1.625 MHz
80      1 = 3.25 MHz
81      2, 3 = 6.5 MHz
82
83  adc:
84    type: object
85    $ref: /schemas/iio/adc/st,stmpe-adc.yaml#
86
87  gpio:
88    type: object
89    $ref: /schemas/gpio/st,stmpe-gpio.yaml#
90
91  keyboard-controller:
92    type: object
93    $ref: /schemas/input/matrix-keymap.yaml#
94
95    unevaluatedProperties: false
96
97    properties:
98      compatible:
99        const: st,stmpe-keypad
100
101      debounce-interval:
102        description: Debouncing interval in milliseconds
103        $ref: /schemas/types.yaml#/definitions/uint32
104
105      st,no-autorepeat:
106        description: If present, the keys will not autorepeat when pressed
107        $ref: /schemas/types.yaml#/definitions/flag
108
109      st,scan-count:
110        description: Scanning cycles elapsed before key data is updated
111        $ref: /schemas/types.yaml#/definitions/uint32
112
113    required:
114      - compatible
115      - linux,keymap
116
117  pwm:
118    type: object
119    $ref: /schemas/pwm/pwm.yaml#
120
121    unevaluatedProperties: false
122
123    properties:
124      compatible:
125        const: st,stmpe-pwm
126
127      "#pwm-cells":
128        const: 2
129
130  touchscreen:
131    type: object
132    $ref: /schemas/input/touchscreen/touchscreen.yaml#
133
134    unevaluatedProperties: false
135
136    properties:
137      compatible:
138        const: st,stmpe-ts
139
140      st,ave-ctrl:
141        $ref: /schemas/types.yaml#/definitions/uint32
142        enum: [ 0, 1, 2, 3 ]
143        description: |
144          Sample average control
145          0 = 1 sample
146          1 = 2 samples
147          2 = 4 samples
148          3 = 8 samples
149
150      st,touch-det-delay:
151        $ref: /schemas/types.yaml#/definitions/uint32
152        enum: [ 0, 1, 2, 3, 4, 5, 6, 7 ]
153        description: |
154          Touch detection delay
155          0 = 10 us
156          1 = 50 us
157          2 = 100 us
158          3 = 500 us - recommended
159          4 = 1 ms
160          5 = 5 ms
161          6 = 10 ms
162          7 = 50 ms
163
164      st,settling:
165        $ref: /schemas/types.yaml#/definitions/uint32
166        enum: [ 0, 1, 2, 3, 4, 5, 6, 7 ]
167        description: |
168          Panel driver settling time
169          0 = 10 us
170          1 = 100 us
171          2 = 500 us - recommended
172          3 = 1 ms
173          4 = 5 ms
174          5 = 10 ms
175          6 = 50 ms
176          7 = 100 ms
177
178      st,fraction-z:
179        $ref: /schemas/types.yaml#/definitions/uint32
180        enum: [ 0, 1, 2, 3, 4, 5, 6, 7 ]
181        description: Length of the fractional part in z, recommended is 7
182          (fraction-z ([0..7]) = Count of the fractional part)
183
184      st,i-drive:
185        $ref: /schemas/types.yaml#/definitions/uint32
186        enum: [ 0, 1 ]
187        description: |
188          current limit value of the touchscreen drivers
189          0 = 20 mA (typical 35 mA max)
190          1 = 50 mA (typical 80 mA max)
191
192    required:
193      - compatible
194
195additionalProperties: false
196
197required:
198  - compatible
199  - reg
200  - interrupts
201
202examples:
203  - |
204    #include <dt-bindings/gpio/gpio.h>
205    #include <dt-bindings/interrupt-controller/irq.h>
206    #include <dt-bindings/input/input.h>
207    i2c {
208      #address-cells = <1>;
209      #size-cells = <0>;
210
211      port-expander@43 {
212        compatible = "st,stmpe2401";
213        reg = <0x43>;
214        reset-gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
215        interrupts = <26 IRQ_TYPE_EDGE_FALLING>;
216        interrupt-parent = <&gpio>;
217        vcc-supply = <&db8500_vsmps2_reg>;
218        vio-supply = <&db8500_vsmps2_reg>;
219        wakeup-source;
220        st,autosleep-timeout = <1024>;
221
222        gpio {
223          compatible = "st,stmpe-gpio";
224          gpio-controller;
225          #gpio-cells = <2>;
226          interrupt-controller;
227          #interrupt-cells = <2>;
228          st,norequest-mask = <0xf0f002>;
229        };
230
231        keyboard-controller {
232          compatible = "st,stmpe-keypad";
233          debounce-interval = <64>;
234          st,scan-count = <8>;
235          st,no-autorepeat;
236          keypad,num-rows = <8>;
237          keypad,num-columns = <8>;
238          linux,keymap = <
239              MATRIX_KEY(0x00, 0x00, KEY_1)
240              MATRIX_KEY(0x00, 0x01, KEY_2)
241              MATRIX_KEY(0x00, 0x02, KEY_3)
242              MATRIX_KEY(0x00, 0x03, KEY_4)
243              MATRIX_KEY(0x00, 0x04, KEY_5)
244              MATRIX_KEY(0x00, 0x05, KEY_6)
245              MATRIX_KEY(0x00, 0x06, KEY_7)
246              MATRIX_KEY(0x00, 0x07, KEY_8)
247              MATRIX_KEY(0x00, 0x08, KEY_9)
248              MATRIX_KEY(0x00, 0x09, KEY_0)
249          >;
250        };
251
252        pwm {
253          compatible = "st,stmpe-pwm";
254          #pwm-cells = <2>;
255        };
256      };
257
258      port-expander@41 {
259        compatible = "st,stmpe811";
260        reg = <0x41>;
261        interrupts = <10 IRQ_TYPE_LEVEL_LOW>;
262        interrupt-parent = <&gpio>;
263        st,adc-freq = <1>;
264        st,mod-12b = <1>;
265        st,ref-sel = <0>;
266        st,sample-time = <4>;
267
268        adc {
269          compatible = "st,stmpe-adc";
270          st,norequest-mask = <0x0f>;
271          #io-channel-cells = <1>;
272        };
273
274        gpio {
275          compatible = "st,stmpe-gpio";
276          gpio-controller;
277          #gpio-cells = <2>;
278          interrupt-controller;
279          #interrupt-cells = <2>;
280        };
281
282        pwm {
283          compatible = "st,stmpe-pwm";
284          #pwm-cells = <2>;
285        };
286
287        touchscreen {
288          compatible = "st,stmpe-ts";
289          st,ave-ctrl = <3>;
290          st,touch-det-delay = <5>;
291          st,settling = <3>;
292          st,fraction-z = <7>;
293          st,i-drive = <1>;
294        };
295      };
296    };
297...
298