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