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