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