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