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