xref: /linux/Documentation/devicetree/bindings/mfd/st,stmpe.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/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 <linusw@kernel.org>
16
17allOf:
18  - $ref: /schemas/spi/spi-peripheral-props.yaml#
19
20properties:
21  compatible:
22    enum:
23      - st,stmpe610
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    required:
131      - compatible
132      - "#pwm-cells"
133
134  touchscreen:
135    type: object
136    $ref: /schemas/input/touchscreen/touchscreen.yaml#
137
138    unevaluatedProperties: false
139
140    properties:
141      compatible:
142        const: st,stmpe-ts
143
144      st,ave-ctrl:
145        $ref: /schemas/types.yaml#/definitions/uint32
146        enum: [ 0, 1, 2, 3 ]
147        description: |
148          Sample average control
149          0 = 1 sample
150          1 = 2 samples
151          2 = 4 samples
152          3 = 8 samples
153
154      st,touch-det-delay:
155        $ref: /schemas/types.yaml#/definitions/uint32
156        enum: [ 0, 1, 2, 3, 4, 5, 6, 7 ]
157        description: |
158          Touch detection delay
159          0 = 10 us
160          1 = 50 us
161          2 = 100 us
162          3 = 500 us - recommended
163          4 = 1 ms
164          5 = 5 ms
165          6 = 10 ms
166          7 = 50 ms
167
168      st,settling:
169        $ref: /schemas/types.yaml#/definitions/uint32
170        enum: [ 0, 1, 2, 3, 4, 5, 6, 7 ]
171        description: |
172          Panel driver settling time
173          0 = 10 us
174          1 = 100 us
175          2 = 500 us - recommended
176          3 = 1 ms
177          4 = 5 ms
178          5 = 10 ms
179          6 = 50 ms
180          7 = 100 ms
181
182      st,fraction-z:
183        $ref: /schemas/types.yaml#/definitions/uint32
184        enum: [ 0, 1, 2, 3, 4, 5, 6, 7 ]
185        description: Length of the fractional part in z, recommended is 7
186          (fraction-z ([0..7]) = Count of the fractional part)
187
188      st,i-drive:
189        $ref: /schemas/types.yaml#/definitions/uint32
190        enum: [ 0, 1 ]
191        description: |
192          current limit value of the touchscreen drivers
193          0 = 20 mA (typical 35 mA max)
194          1 = 50 mA (typical 80 mA max)
195
196    required:
197      - compatible
198
199additionalProperties: false
200
201required:
202  - compatible
203  - reg
204  - interrupts
205
206examples:
207  - |
208    #include <dt-bindings/gpio/gpio.h>
209    #include <dt-bindings/interrupt-controller/irq.h>
210    #include <dt-bindings/input/input.h>
211    i2c {
212      #address-cells = <1>;
213      #size-cells = <0>;
214
215      port-expander@43 {
216        compatible = "st,stmpe2401";
217        reg = <0x43>;
218        reset-gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
219        interrupts = <26 IRQ_TYPE_EDGE_FALLING>;
220        interrupt-parent = <&gpio>;
221        vcc-supply = <&db8500_vsmps2_reg>;
222        vio-supply = <&db8500_vsmps2_reg>;
223        wakeup-source;
224        st,autosleep-timeout = <1024>;
225
226        gpio {
227          compatible = "st,stmpe-gpio";
228          gpio-controller;
229          #gpio-cells = <2>;
230          interrupt-controller;
231          #interrupt-cells = <2>;
232          st,norequest-mask = <0xf0f002>;
233        };
234
235        keyboard-controller {
236          compatible = "st,stmpe-keypad";
237          debounce-interval = <64>;
238          st,scan-count = <8>;
239          st,no-autorepeat;
240          keypad,num-rows = <8>;
241          keypad,num-columns = <8>;
242          linux,keymap = <
243              MATRIX_KEY(0x00, 0x00, KEY_1)
244              MATRIX_KEY(0x00, 0x01, KEY_2)
245              MATRIX_KEY(0x00, 0x02, KEY_3)
246              MATRIX_KEY(0x00, 0x03, KEY_4)
247              MATRIX_KEY(0x00, 0x04, KEY_5)
248              MATRIX_KEY(0x00, 0x05, KEY_6)
249              MATRIX_KEY(0x00, 0x06, KEY_7)
250              MATRIX_KEY(0x00, 0x07, KEY_8)
251              MATRIX_KEY(0x00, 0x08, KEY_9)
252              MATRIX_KEY(0x00, 0x09, KEY_0)
253          >;
254        };
255
256        pwm {
257          compatible = "st,stmpe-pwm";
258          #pwm-cells = <2>;
259        };
260      };
261
262      port-expander@41 {
263        compatible = "st,stmpe811";
264        reg = <0x41>;
265        interrupts = <10 IRQ_TYPE_LEVEL_LOW>;
266        interrupt-parent = <&gpio>;
267        st,adc-freq = <1>;
268        st,mod-12b = <1>;
269        st,ref-sel = <0>;
270        st,sample-time = <4>;
271
272        adc {
273          compatible = "st,stmpe-adc";
274          st,norequest-mask = <0x0f>;
275          #io-channel-cells = <1>;
276        };
277
278        gpio {
279          compatible = "st,stmpe-gpio";
280          gpio-controller;
281          #gpio-cells = <2>;
282          interrupt-controller;
283          #interrupt-cells = <2>;
284        };
285
286        pwm {
287          compatible = "st,stmpe-pwm";
288          #pwm-cells = <2>;
289        };
290
291        touchscreen {
292          compatible = "st,stmpe-ts";
293          st,ave-ctrl = <3>;
294          st,touch-det-delay = <5>;
295          st,settling = <3>;
296          st,fraction-z = <7>;
297          st,i-drive = <1>;
298        };
299      };
300    };
301...
302