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