summaryrefslogtreecommitdiffstats
path: root/Documentation/devicetree/bindings/mfd/st,stmpe.yaml
blob: b77cc3f3075d7904a5fa4a5fee77af79dafaf504 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/mfd/st,stmpe.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: STMicroelectonics Port Expander (STMPE)

description: STMicroelectronics Port Expander (STMPE) is a series of slow
  bus controllers for various expanded peripherals such as GPIO, keypad,
  touchscreen, ADC, PWM or rotator. It can contain one or several different
  peripherals connected to SPI or I2C.

maintainers:
  - Linus Walleij <linus.walleij@linaro.org>

allOf:
  - $ref: /schemas/spi/spi-peripheral-props.yaml#

properties:
  compatible:
    enum:
      - st,stmpe601
      - st,stmpe801
      - st,stmpe811
      - st,stmpe1600
      - st,stmpe1601
      - st,stmpe2401
      - st,stmpe2403

  reg:
    maxItems: 1

  interrupts:
    maxItems: 1

  vcc-supply: true

  vio-supply: true

  reset-gpios:
    maxItems: 1

  wakeup-source: true

  st,autosleep-timeout:
    $ref: /schemas/types.yaml#/definitions/uint32
    enum: [ 4, 16, 32, 64, 128, 256, 512, 1024 ]
    description: Time idle before going to automatic sleep to save power

  st,sample-time:
    $ref: /schemas/types.yaml#/definitions/uint32
    enum: [ 0, 1, 2, 3, 4, 5, 6 ]
    description: |
      Sample time per iteration
      0 = 36 clock ticks
      1 = 44 clock ticks
      2 = 56 clock ticks
      3 = 64 clock ticks
      4 = 80 clock ticks - recommended
      5 = 96 clock ticks
      6 = 124 clock ticks

  st,mod-12b:
    $ref: /schemas/types.yaml#/definitions/uint32
    enum: [ 0, 1 ]
    description: ADC bit mode 0 = 10bit ADC, 1 = 12bit ADC

  st,ref-sel:
    $ref: /schemas/types.yaml#/definitions/uint32
    enum: [ 0, 1 ]
    description: ADC reference source 0 = internal, 1 = external

  st,adc-freq:
    $ref: /schemas/types.yaml#/definitions/uint32
    enum: [ 0, 1, 2, 3 ]
    description: |
      ADC clock speed
      0 = 1.625 MHz
      1 = 3.25 MHz
      2, 3 = 6.5 MHz

  adc:
    type: object
    $ref: /schemas/iio/adc/st,stmpe-adc.yaml#

  gpio:
    type: object
    $ref: /schemas/gpio/st,stmpe-gpio.yaml#

  keyboard-controller:
    type: object
    $ref: /schemas/input/matrix-keymap.yaml#

    unevaluatedProperties: false

    properties:
      compatible:
        const: st,stmpe-keypad

      debounce-interval:
        description: Debouncing interval in milliseconds
        $ref: /schemas/types.yaml#/definitions/uint32

      st,no-autorepeat:
        description: If present, the keys will not autorepeat when pressed
        $ref: /schemas/types.yaml#/definitions/flag

      st,scan-count:
        description: Scanning cycles elapsed before key data is updated
        $ref: /schemas/types.yaml#/definitions/uint32

    required:
      - compatible
      - linux,keymap

  pwm:
    type: object
    $ref: /schemas/pwm/pwm.yaml#

    unevaluatedProperties: false

    properties:
      compatible:
        const: st,stmpe-pwm

      "#pwm-cells":
        const: 2

  touchscreen:
    type: object
    $ref: /schemas/input/touchscreen/touchscreen.yaml#

    unevaluatedProperties: false

    properties:
      compatible:
        const: st,stmpe-ts

      st,ave-ctrl:
        $ref: /schemas/types.yaml#/definitions/uint32
        enum: [ 0, 1, 2, 3 ]
        description: |
          Sample average control
          0 = 1 sample
          1 = 2 samples
          2 = 4 samples
          3 = 8 samples

      st,touch-det-delay:
        $ref: /schemas/types.yaml#/definitions/uint32
        enum: [ 0, 1, 2, 3, 4, 5, 6, 7 ]
        description: |
          Touch detection delay
          0 = 10 us
          1 = 50 us
          2 = 100 us
          3 = 500 us - recommended
          4 = 1 ms
          5 = 5 ms
          6 = 10 ms
          7 = 50 ms

      st,settling:
        $ref: /schemas/types.yaml#/definitions/uint32
        enum: [ 0, 1, 2, 3, 4, 5, 6, 7 ]
        description: |
          Panel driver settling time
          0 = 10 us
          1 = 100 us
          2 = 500 us - recommended
          3 = 1 ms
          4 = 5 ms
          5 = 10 ms
          6 = 50 ms
          7 = 100 ms

      st,fraction-z:
        $ref: /schemas/types.yaml#/definitions/uint32
        enum: [ 0, 1, 2, 3, 4, 5, 6, 7 ]
        description: Length of the fractional part in z, recommended is 7
          (fraction-z ([0..7]) = Count of the fractional part)

      st,i-drive:
        $ref: /schemas/types.yaml#/definitions/uint32
        enum: [ 0, 1 ]
        description: |
          current limit value of the touchscreen drivers
          0 = 20 mA (typical 35 mA max)
          1 = 50 mA (typical 80 mA max)

    required:
      - compatible

additionalProperties: false

required:
  - compatible
  - reg
  - interrupts

examples:
  - |
    #include <dt-bindings/gpio/gpio.h>
    #include <dt-bindings/interrupt-controller/irq.h>
    #include <dt-bindings/input/input.h>
    i2c {
      #address-cells = <1>;
      #size-cells = <0>;

      port-expander@43 {
        compatible = "st,stmpe2401";
        reg = <0x43>;
        reset-gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
        interrupts = <26 IRQ_TYPE_EDGE_FALLING>;
        interrupt-parent = <&gpio>;
        vcc-supply = <&db8500_vsmps2_reg>;
        vio-supply = <&db8500_vsmps2_reg>;
        wakeup-source;
        st,autosleep-timeout = <1024>;

        gpio {
          compatible = "st,stmpe-gpio";
          gpio-controller;
          #gpio-cells = <2>;
          interrupt-controller;
          #interrupt-cells = <2>;
          st,norequest-mask = <0xf0f002>;
        };

        keyboard-controller {
          compatible = "st,stmpe-keypad";
          debounce-interval = <64>;
          st,scan-count = <8>;
          st,no-autorepeat;
          keypad,num-rows = <8>;
          keypad,num-columns = <8>;
          linux,keymap = <
              MATRIX_KEY(0x00, 0x00, KEY_1)
              MATRIX_KEY(0x00, 0x01, KEY_2)
              MATRIX_KEY(0x00, 0x02, KEY_3)
              MATRIX_KEY(0x00, 0x03, KEY_4)
              MATRIX_KEY(0x00, 0x04, KEY_5)
              MATRIX_KEY(0x00, 0x05, KEY_6)
              MATRIX_KEY(0x00, 0x06, KEY_7)
              MATRIX_KEY(0x00, 0x07, KEY_8)
              MATRIX_KEY(0x00, 0x08, KEY_9)
              MATRIX_KEY(0x00, 0x09, KEY_0)
          >;
        };

        pwm {
          compatible = "st,stmpe-pwm";
          #pwm-cells = <2>;
        };
      };

      port-expander@41 {
        compatible = "st,stmpe811";
        reg = <0x41>;
        interrupts = <10 IRQ_TYPE_LEVEL_LOW>;
        interrupt-parent = <&gpio>;
        st,adc-freq = <1>;
        st,mod-12b = <1>;
        st,ref-sel = <0>;
        st,sample-time = <4>;

        adc {
          compatible = "st,stmpe-adc";
          st,norequest-mask = <0x0f>;
          #io-channel-cells = <1>;
        };

        gpio {
          compatible = "st,stmpe-gpio";
          gpio-controller;
          #gpio-cells = <2>;
          interrupt-controller;
          #interrupt-cells = <2>;
        };

        pwm {
          compatible = "st,stmpe-pwm";
          #pwm-cells = <2>;
        };

        touchscreen {
          compatible = "st,stmpe-ts";
          st,ave-ctrl = <3>;
          st,touch-det-delay = <5>;
          st,settling = <3>;
          st,fraction-z = <7>;
          st,i-drive = <1>;
        };
      };
    };
...