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