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