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