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