1# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/pinctrl/qcom,pmic-gpio.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Qualcomm PMIC GPIO block
8
9maintainers:
10  - Bjorn Andersson <bjorn.andersson@linaro.org>
11
12description:
13  This binding describes the GPIO block(s) found in the 8xxx series of
14  PMIC's from Qualcomm.
15
16properties:
17  compatible:
18    items:
19      - enum:
20          - qcom,pm2250-gpio
21          - qcom,pm660-gpio
22          - qcom,pm660l-gpio
23          - qcom,pm6125-gpio
24          - qcom,pm6150-gpio
25          - qcom,pm6150l-gpio
26          - qcom,pm6350-gpio
27          - qcom,pm7325-gpio
28          - qcom,pm8005-gpio
29          - qcom,pm8008-gpio
30          - qcom,pm8018-gpio
31          - qcom,pm8019-gpio
32          - qcom,pm8038-gpio
33          - qcom,pm8058-gpio
34          - qcom,pm8150-gpio
35          - qcom,pm8150b-gpio
36          - qcom,pm8150l-gpio
37          - qcom,pm8226-gpio
38          - qcom,pm8350-gpio
39          - qcom,pm8350b-gpio
40          - qcom,pm8350c-gpio
41          - qcom,pm8450-gpio
42          - qcom,pm8916-gpio
43          - qcom,pm8917-gpio
44          - qcom,pm8921-gpio
45          - qcom,pm8941-gpio
46          - qcom,pm8950-gpio
47          - qcom,pm8994-gpio
48          - qcom,pm8998-gpio
49          - qcom,pma8084-gpio
50          - qcom,pmi8950-gpio
51          - qcom,pmi8994-gpio
52          - qcom,pmi8998-gpio
53          - qcom,pmk8350-gpio
54          - qcom,pmm8155au-gpio
55          - qcom,pmr735a-gpio
56          - qcom,pmr735b-gpio
57          - qcom,pms405-gpio
58          - qcom,pmx55-gpio
59          - qcom,pmx65-gpio
60
61      - enum:
62          - qcom,spmi-gpio
63          - qcom,ssbi-gpio
64
65  reg:
66    maxItems: 1
67
68  interrupt-controller: true
69
70  '#interrupt-cells':
71    const: 2
72
73  gpio-controller: true
74
75  gpio-ranges:
76    maxItems: 1
77
78  gpio-line-names:
79    minItems: 2
80    maxItems: 44
81
82  gpio-reserved-ranges:
83    minItems: 1
84    # maxItems as half of total number of GPIOs, as there has to be at
85    # least one usable GPIO between each reserved range.
86    maxItems: 22
87
88  '#gpio-cells':
89    const: 2
90    description:
91      The first cell will be used to define gpio number and the
92      second denotes the flags for this gpio
93
94additionalProperties: false
95
96required:
97  - compatible
98  - reg
99  - gpio-controller
100  - '#gpio-cells'
101  - gpio-ranges
102  - interrupt-controller
103
104allOf:
105  - if:
106      properties:
107        compatible:
108          contains:
109            enum:
110              - qcom,pm8008-gpio
111              - qcom,pmi8950-gpio
112    then:
113      properties:
114        gpio-line-names:
115          minItems: 2
116          maxItems: 2
117        gpio-reserved-ranges:
118          maxItems: 1
119
120  - if:
121      properties:
122        compatible:
123          contains:
124            enum:
125              - qcom,pm8005-gpio
126              - qcom,pm8450-gpio
127              - qcom,pm8916-gpio
128              - qcom,pmk8350-gpio
129              - qcom,pmr735a-gpio
130              - qcom,pmr735b-gpio
131    then:
132      properties:
133        gpio-line-names:
134          minItems: 4
135          maxItems: 4
136        gpio-reserved-ranges:
137          minItems: 1
138          maxItems: 2
139
140  - if:
141      properties:
142        compatible:
143          contains:
144            enum:
145              - qcom,pm8018-gpio
146              - qcom,pm8019-gpio
147    then:
148      properties:
149        gpio-line-names:
150          minItems: 6
151          maxItems: 6
152        gpio-reserved-ranges:
153          minItems: 1
154          maxItems: 3
155
156  - if:
157      properties:
158        compatible:
159          contains:
160            enum:
161              - qcom,pm8350b-gpio
162              - qcom,pm8950-gpio
163    then:
164      properties:
165        gpio-line-names:
166          minItems: 8
167          maxItems: 8
168        gpio-reserved-ranges:
169          minItems: 1
170          maxItems: 4
171
172  - if:
173      properties:
174        compatible:
175          contains:
176            enum:
177              - qcom,pm6350-gpio
178              - qcom,pm8350c-gpio
179    then:
180      properties:
181        gpio-line-names:
182          minItems: 9
183          maxItems: 9
184        gpio-reserved-ranges:
185          minItems: 1
186          maxItems: 5
187
188  - if:
189      properties:
190        compatible:
191          contains:
192            enum:
193              - qcom,pm2250-gpio
194              - qcom,pm6150-gpio
195              - qcom,pm7325-gpio
196              - qcom,pm8150-gpio
197              - qcom,pm8350-gpio
198              - qcom,pmc8180-gpio
199              - qcom,pmi8994-gpio
200              - qcom,pmm8155au-gpio
201    then:
202      properties:
203        gpio-line-names:
204          minItems: 10
205          maxItems: 10
206        gpio-reserved-ranges:
207          minItems: 1
208          maxItems: 5
209
210  - if:
211      properties:
212        compatible:
213          contains:
214            enum:
215              - qcom,pmx55-gpio
216    then:
217      properties:
218        gpio-line-names:
219          minItems: 11
220          maxItems: 11
221        gpio-reserved-ranges:
222          minItems: 1
223          maxItems: 6
224
225  - if:
226      properties:
227        compatible:
228          contains:
229            enum:
230              - qcom,pm660l-gpio
231              - qcom,pm6150l-gpio
232              - qcom,pm8038-gpio
233              - qcom,pm8150b-gpio
234              - qcom,pm8150l-gpio
235              - qcom,pmc8180c-gpio
236              - qcom,pms405-gpio
237    then:
238      properties:
239        gpio-line-names:
240          minItems: 12
241          maxItems: 12
242        gpio-reserved-ranges:
243          minItems: 1
244          maxItems: 6
245
246  - if:
247      properties:
248        compatible:
249          contains:
250            enum:
251              - qcom,pm660-gpio
252    then:
253      properties:
254        gpio-line-names:
255          minItems: 13
256          maxItems: 13
257        gpio-reserved-ranges:
258          minItems: 1
259          maxItems: 7
260
261  - if:
262      properties:
263        compatible:
264          contains:
265            enum:
266              - qcom,pmi8998-gpio
267    then:
268      properties:
269        gpio-line-names:
270          minItems: 14
271          maxItems: 14
272        gpio-reserved-ranges:
273          minItems: 1
274          maxItems: 7
275
276  - if:
277      properties:
278        compatible:
279          contains:
280            enum:
281              - qcom,pmx65-gpio
282    then:
283      properties:
284        gpio-line-names:
285          minItems: 16
286          maxItems: 16
287        gpio-reserved-ranges:
288          minItems: 1
289          maxItems: 8
290
291  - if:
292      properties:
293        compatible:
294          contains:
295            enum:
296              - qcom,pm8994-gpio
297              - qcom,pma8084-gpio
298    then:
299      properties:
300        gpio-line-names:
301          minItems: 22
302          maxItems: 22
303        gpio-reserved-ranges:
304          minItems: 1
305          maxItems: 11
306
307  - if:
308      properties:
309        compatible:
310          contains:
311            enum:
312              - qcom,pm8998-gpio
313    then:
314      properties:
315        gpio-line-names:
316          minItems: 26
317          maxItems: 26
318        gpio-reserved-ranges:
319          minItems: 1
320          maxItems: 13
321
322  - if:
323      properties:
324        compatible:
325          contains:
326            enum:
327              - qcom,pm8941-gpio
328    then:
329      properties:
330        gpio-line-names:
331          minItems: 36
332          maxItems: 36
333        gpio-reserved-ranges:
334          minItems: 1
335          maxItems: 18
336
337  - if:
338      properties:
339        compatible:
340          contains:
341            enum:
342              - qcom,pm8917-gpio
343    then:
344      properties:
345        gpio-line-names:
346          minItems: 38
347          maxItems: 38
348        gpio-reserved-ranges:
349          minItems: 1
350          maxItems: 19
351
352  - if:
353      properties:
354        compatible:
355          contains:
356            enum:
357              - qcom,pm8058-gpio
358              - qcom,pm8921-gpio
359    then:
360      properties:
361        gpio-line-names:
362          minItems: 44
363          maxItems: 44
364        gpio-reserved-ranges:
365          minItems: 1
366          maxItems: 22
367
368patternProperties:
369  '-state$':
370    oneOf:
371      - $ref: "#/$defs/qcom-pmic-gpio-state"
372      - patternProperties:
373          "(pinconf|-pins)$":
374            $ref: "#/$defs/qcom-pmic-gpio-state"
375        additionalProperties: false
376
377$defs:
378  qcom-pmic-gpio-state:
379    type: object
380    allOf:
381      - $ref: "pinmux-node.yaml"
382      - $ref: "pincfg-node.yaml"
383    properties:
384      pins:
385        description:
386          List of gpio pins affected by the properties specified in
387          this subnode.  Valid pins are
388                 - gpio1-gpio9 for pm6125
389                 - gpio1-gpio10 for pm6150
390                 - gpio1-gpio12 for pm6150l
391                 - gpio1-gpio9 for pm6350
392                 - gpio1-gpio10 for pm7325
393                 - gpio1-gpio4 for pm8005
394                 - gpio1-gpio2 for pm8008
395                 - gpio1-gpio6 for pm8018
396                 - gpio1-gpio12 for pm8038
397                 - gpio1-gpio40 for pm8058
398                 - gpio1-gpio10 for pm8150 (holes on gpio2, gpio5,
399                                            gpio7 and gpio8)
400                 - gpio1-gpio12 for pm8150b (holes on gpio3, gpio4
401                                             and gpio7)
402                 - gpio1-gpio12 for pm8150l (hole on gpio7)
403                 - gpio1-gpio4 for pm8916
404                 - gpio1-gpio10 for pm8350
405                 - gpio1-gpio8 for pm8350b
406                 - gpio1-gpio9 for pm8350c
407                 - gpio1-gpio38 for pm8917
408                 - gpio1-gpio44 for pm8921
409                 - gpio1-gpio36 for pm8941
410                 - gpio1-gpio8 for pm8950 (hole on gpio3)
411                 - gpio1-gpio22 for pm8994
412                 - gpio1-gpio26 for pm8998
413                 - gpio1-gpio22 for pma8084
414                 - gpio1-gpio2 for pmi8950
415                 - gpio1-gpio10 for pmi8994
416                 - gpio1-gpio4 for pmk8350
417                 - gpio1-gpio10 for pmm8155au
418                 - gpio1-gpio4 for pmr735a
419                 - gpio1-gpio4 for pmr735b
420                 - gpio1-gpio12 for pms405 (holes on gpio1, gpio9
421                                            and gpio10)
422                 - gpio1-gpio11 for pmx55 (holes on gpio3, gpio7, gpio10
423                                            and gpio11)
424                 - gpio1-gpio16 for pmx65
425
426        items:
427          pattern: "^gpio([0-9]+)$"
428
429      function:
430        items:
431          - enum:
432              - normal
433              - paired
434              - func1
435              - func2
436              - dtest1
437              - dtest2
438              - dtest3
439              - dtest4
440              - func3  # supported by LV/MV GPIO subtypes
441              - func4  # supported by LV/MV GPIO subtypes
442
443      bias-disable: true
444      bias-pull-down: true
445      bias-pull-up: true
446
447      qcom,pull-up-strength:
448        $ref: /schemas/types.yaml#/definitions/uint32
449        description:
450          Specifies the strength to use for pull up, if selected.
451          Valid values are defined in
452          <dt-bindings/pinctrl/qcom,pmic-gpio.h>
453          If this property is omitted 30uA strength will be used
454          if pull up is selected
455        enum: [0, 1, 2, 3]
456
457      bias-high-impedance: true
458      input-enable: true
459      input-disable: true
460      output-high: true
461      output-low: true
462      output-enable: true
463      output-disable: true
464      power-source: true
465
466      qcom,drive-strength:
467        $ref: /schemas/types.yaml#/definitions/uint32
468        description:
469          Selects the drive strength for the specified pins
470          Valid drive strength values are defined in
471          <dt-bindings/pinctrl/qcom,pmic-gpio.h>
472        enum: [0, 1, 2, 3]
473
474      drive-push-pull: true
475      drive-open-drain: true
476      drive-open-source: true
477
478      qcom,analog-pass:
479        $ref: /schemas/types.yaml#/definitions/flag
480        description:
481          The specified pins are configured in
482          analog-pass-through mode.
483
484      qcom,atest:
485        $ref: /schemas/types.yaml#/definitions/uint32
486        description:
487          Selects ATEST rail to route to GPIO when it's
488          configured in analog-pass-through mode.
489        enum: [1, 2, 3, 4]
490
491      qcom,dtest-buffer:
492        $ref: /schemas/types.yaml#/definitions/uint32
493        description:
494          Selects DTEST rail to route to GPIO when it's
495          configured as digital input.
496        enum: [1, 2, 3, 4]
497
498    required:
499      - pins
500      - function
501
502    additionalProperties: false
503
504examples:
505  - |
506    #include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
507
508    pm8921_gpio: gpio@150 {
509      compatible = "qcom,pm8921-gpio", "qcom,ssbi-gpio";
510      reg = <0x150 0x160>;
511      interrupt-controller;
512      #interrupt-cells = <2>;
513      gpio-controller;
514      gpio-ranges = <&pm8921_gpio 0 0 44>;
515      #gpio-cells = <2>;
516
517      pm8921_gpio_keys: gpio-keys-state {
518        volume-keys-pins {
519          pins = "gpio20", "gpio21";
520          function = "normal";
521
522          input-enable;
523          bias-pull-up;
524          drive-push-pull;
525          qcom,drive-strength = <PMIC_GPIO_STRENGTH_NO>;
526          power-source = <PM8921_GPIO_S4>;
527        };
528      };
529    };
530...
531