xref: /linux/Documentation/devicetree/bindings/pinctrl/semtech,sx1501q.yaml (revision 9ad8d22f2f3fad7a366c9772362795ef6d6a2d51)
1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2# Copyright 2022 Linaro Ltd.
3%YAML 1.2
4---
5$id: http://devicetree.org/schemas/pinctrl/semtech,sx1501q.yaml#
6$schema: http://devicetree.org/meta-schemas/core.yaml#
7
8title: Semtech SX150x GPIO expander
9
10maintainers:
11  - Neil Armstrong <neil.armstrong@linaro.org>
12
13properties:
14  compatible:
15    enum:
16      - semtech,sx1501q
17      - semtech,sx1502q
18      - semtech,sx1503q
19      - semtech,sx1504q
20      - semtech,sx1505q
21      - semtech,sx1506q
22      - semtech,sx1507q
23      - semtech,sx1508q
24      - semtech,sx1509q
25
26  reg:
27    maxItems: 1
28
29  gpio-line-names:
30    minItems: 5
31    maxItems: 17
32
33  interrupts:
34    maxItems: 1
35
36  '#interrupt-cells':
37    const: 2
38
39  interrupt-controller: true
40
41  '#gpio-cells':
42    const: 2
43
44  gpio-controller: true
45
46  semtech,probe-reset:
47    description: Will trigger a reset of the GPIO expander on probe
48    type: boolean
49
50patternProperties:
51  '-cfg$':
52    type: object
53    properties:
54      pins: true
55
56      bias-disable: true
57      bias-pull-up: true
58      bias-pull-down: true
59      bias-pull-pin-default: true
60      drive-push-pull: true
61      output-low: true
62      output-high: true
63      drive-open-drain: true
64
65    required:
66      - pins
67
68    allOf:
69      - $ref: pincfg-node.yaml#
70      - $ref: pinmux-node.yaml#
71      - if:
72          properties:
73            pins:
74              contains:
75                const: oscio
76        then:
77          properties:
78            bias-disable: false
79            bias-pull-up: false
80            bias-pull-down: false
81            bias-pull-pin-default: false
82            drive-open-drain: false
83
84    additionalProperties: false
85
86required:
87  - compatible
88  - reg
89  - '#gpio-cells'
90  - gpio-controller
91
92allOf:
93  - $ref: pinctrl.yaml#
94  - if:
95      properties:
96        compatible:
97          contains:
98            enum:
99              - semtech,sx1501q
100              - semtech,sx1504q
101              - semtech,sx1507q
102    then:
103      properties:
104        gpio-line-names:
105          minItems: 5
106          maxItems: 5
107  - if:
108      properties:
109        compatible:
110          contains:
111            enum:
112              - semtech,sx1502q
113              - semtech,sx1505q
114              - semtech,sx1508q
115    then:
116      properties:
117        gpio-line-names:
118          minItems: 9
119          maxItems: 9
120  - if:
121      properties:
122        compatible:
123          contains:
124            enum:
125              - semtech,sx1503q
126              - semtech,sx1506q
127              - semtech,sx1509q
128    then:
129      properties:
130        gpio-line-names:
131          minItems: 17
132          maxItems: 17
133  - if:
134      not:
135        properties:
136          compatible:
137            contains:
138              enum:
139                - semtech,sx1507q
140                - semtech,sx1508q
141                - semtech,sx1509q
142    then:
143      properties:
144        semtech,probe-reset: false
145  - if:
146      properties:
147        compatible:
148          contains:
149            enum:
150              - semtech,sx1501q
151              - semtech,sx1504q
152    then:
153      patternProperties:
154        '-cfg$':
155          properties:
156            pins:
157              items:
158                pattern: '^gpio[0-3]$'
159  - if:
160      properties:
161        compatible:
162          contains:
163            enum:
164              - semtech,sx1502q
165              - semtech,sx1505q
166    then:
167      patternProperties:
168        '-cfg$':
169          properties:
170            pins:
171              items:
172                pattern: '^gpio[0-7]$'
173  - if:
174      properties:
175        compatible:
176          contains:
177            enum:
178              - semtech,sx1503q
179              - semtech,sx1506q
180    then:
181      patternProperties:
182        '-cfg$':
183          properties:
184            pins:
185              items:
186                pattern: '^(gpio[0-9]|gpio1[0-5])$'
187  - if:
188      properties:
189        compatible:
190          contains:
191            const: semtech,sx1507q
192    then:
193      patternProperties:
194        '-cfg$':
195          properties:
196            pins:
197              items:
198                pattern: '^(oscio|gpio[0-3])$'
199  - if:
200      properties:
201        compatible:
202          contains:
203            const: semtech,sx1508q
204    then:
205      patternProperties:
206        '-cfg$':
207          properties:
208            pins:
209              items:
210                pattern: '^(oscio|gpio[0-7])$'
211  - if:
212      properties:
213        compatible:
214          contains:
215            const: semtech,sx1509q
216    then:
217      patternProperties:
218        '-cfg$':
219          properties:
220            pins:
221              items:
222                pattern: '^(oscio|gpio[0-9]|gpio1[0-5])$'
223
224additionalProperties: false
225
226examples:
227  - |
228    #include <dt-bindings/interrupt-controller/irq.h>
229    i2c@1000 {
230        reg = <0x1000 0x80>;
231        #address-cells = <1>;
232        #size-cells = <0>;
233
234        pinctrl@20 {
235            compatible = "semtech,sx1501q";
236            reg = <0x20>;
237
238            #gpio-cells = <2>;
239            #interrupt-cells = <2>;
240
241            interrupts = <16 IRQ_TYPE_EDGE_FALLING>;
242
243            gpio-controller;
244            interrupt-controller;
245
246            gpio1-cfg {
247                  pins = "gpio1";
248                  bias-pull-up;
249            };
250        };
251    };
252