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