xref: /linux/Documentation/devicetree/bindings/pinctrl/qcom,pmic-gpio.yaml (revision d53b8e36925256097a08d7cb749198d85cbf9b2b)
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    required:
429      - gpio-hog
430
431$defs:
432  qcom-pmic-gpio-state:
433    type: object
434    allOf:
435      - $ref: pinmux-node.yaml
436      - $ref: pincfg-node.yaml
437    properties:
438      pins:
439        description:
440          List of gpio pins affected by the properties specified in
441          this subnode.  Valid pins are
442                 - gpio1-gpio9 for pm6125
443                 - gpio1-gpio10 for pm6150
444                 - gpio1-gpio12 for pm6150l
445                 - gpio1-gpio9 for pm6350
446                 - gpio1-gpio9 for pm6450
447                 - gpio1-gpio12 for pm7250b
448                 - gpio1-gpio10 for pm7325
449                 - gpio1-gpio8 for pm7550ba
450                 - gpio1-gpio4 for pm8005
451                 - gpio1-gpio6 for pm8018
452                 - gpio1-gpio12 for pm8038
453                 - gpio1-gpio40 for pm8058
454                 - gpio1-gpio10 for pm8150 (holes on gpio2, gpio5,
455                                            gpio7 and gpio8)
456                 - gpio1-gpio12 for pm8150b (holes on gpio3, gpio4
457                                             and gpio7)
458                 - gpio1-gpio12 for pm8150l (hole on gpio7)
459                 - gpio1-gpio4 for pm8916
460                 - gpio1-gpio10 for pm8350
461                 - gpio1-gpio8 for pm8350b
462                 - gpio1-gpio9 for pm8350c
463                 - gpio1-gpio4 for pm8450
464                 - gpio1-gpio12 for pm8550
465                 - gpio1-gpio12 for pm8550b
466                 - gpio1-gpio8 for pm8550ve
467                 - gpio1-gpio6 for pm8550vs
468                 - gpio1-gpio38 for pm8917
469                 - gpio1-gpio44 for pm8921
470                 - gpio1-gpio36 for pm8941
471                 - gpio1-gpio8 for pm8950 (hole on gpio3)
472                 - gpio1-gpio8 for pm8953 (hole on gpio3 and gpio6)
473                 - gpio1-gpio22 for pm8994
474                 - gpio1-gpio26 for pm8998
475                 - gpio1-gpio22 for pma8084
476                 - gpio1-gpio4 for pmd8028
477                 - gpio1-gpio8 for pmi632
478                 - gpio1-gpio2 for pmi8950
479                 - gpio1-gpio10 for pmi8994
480                 - gpio1-gpio18 for pmih0108
481                 - gpio1-gpio4 for pmk8350
482                 - gpio1-gpio6 for pmk8550
483                 - gpio1-gpio10 for pmm8155au
484                 - gpio1-gpio12 for pmm8654au
485                 - gpio1-gpio12 for pmp8074 (holes on gpio1 and gpio12)
486                 - gpio1-gpio4 for pmr735a
487                 - gpio1-gpio4 for pmr735b
488                 - gpio1-gpio2 for pmr735d
489                 - gpio1-gpio12 for pms405 (holes on gpio1, gpio9
490                                            and gpio10)
491                 - gpio1-gpio11 for pmx55 (holes on gpio3, gpio7, gpio10
492                                            and gpio11)
493                 - gpio1-gpio16 for pmx65
494                 - gpio1-gpio16 for pmx75
495                 - gpio1-gpio12 for pmxr2230
496
497        items:
498          pattern: "^gpio([0-9]+)$"
499
500      function:
501        items:
502          - enum:
503              - normal
504              - paired
505              - func1
506              - func2
507              - dtest1
508              - dtest2
509              - dtest3
510              - dtest4
511              - func3  # supported by LV/MV GPIO subtypes
512              - func4  # supported by LV/MV GPIO subtypes
513
514      bias-disable: true
515      bias-pull-down: true
516      bias-pull-up: true
517
518      qcom,pull-up-strength:
519        $ref: /schemas/types.yaml#/definitions/uint32
520        description:
521          Specifies the strength to use for pull up, if selected.
522          Valid values are defined in
523          <dt-bindings/pinctrl/qcom,pmic-gpio.h>
524          If this property is omitted 30uA strength will be used
525          if pull up is selected
526        enum: [0, 1, 2, 3]
527
528      bias-high-impedance: true
529      input-enable: true
530      input-disable: true
531      output-high: true
532      output-low: true
533      output-enable: true
534      output-disable: true
535      power-source: true
536
537      qcom,drive-strength:
538        $ref: /schemas/types.yaml#/definitions/uint32
539        description:
540          Selects the drive strength for the specified pins
541          Valid drive strength values are defined in
542          <dt-bindings/pinctrl/qcom,pmic-gpio.h>
543        enum: [0, 1, 2, 3]
544
545      drive-push-pull: true
546      drive-open-drain: true
547      drive-open-source: true
548
549      qcom,analog-pass:
550        $ref: /schemas/types.yaml#/definitions/flag
551        description:
552          The specified pins are configured in
553          analog-pass-through mode.
554
555      qcom,atest:
556        $ref: /schemas/types.yaml#/definitions/uint32
557        description:
558          Selects ATEST rail to route to GPIO when it's
559          configured in analog-pass-through mode.
560        enum: [1, 2, 3, 4]
561
562      qcom,dtest-buffer:
563        $ref: /schemas/types.yaml#/definitions/uint32
564        description:
565          Selects DTEST rail to route to GPIO when it's
566          configured as digital input.
567        enum: [1, 2, 3, 4]
568
569    required:
570      - pins
571      - function
572
573    additionalProperties: false
574
575examples:
576  - |
577    #include <dt-bindings/gpio/gpio.h>
578    #include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
579
580    pm8921_gpio: gpio@150 {
581      compatible = "qcom,pm8921-gpio", "qcom,ssbi-gpio";
582      reg = <0x150 0x160>;
583      interrupt-controller;
584      #interrupt-cells = <2>;
585      gpio-controller;
586      gpio-ranges = <&pm8921_gpio 0 0 44>;
587      #gpio-cells = <2>;
588
589      pm8921_gpio_keys: gpio-keys-state {
590        volume-keys-pins {
591          pins = "gpio20", "gpio21";
592          function = "normal";
593
594          input-enable;
595          bias-pull-up;
596          drive-push-pull;
597          qcom,drive-strength = <PMIC_GPIO_STRENGTH_NO>;
598          power-source = <PM8921_GPIO_S4>;
599        };
600      };
601
602      otg-hog {
603        gpio-hog;
604        gpios = <35 GPIO_ACTIVE_HIGH>;
605        output-high;
606        line-name = "otg-gpio";
607      };
608    };
609...
610