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