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