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