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  interrupts:
30    maxItems: 1
31
32  '#interrupt-cells':
33    const: 2
34
35  interrupt-controller: true
36
37  '#gpio-cells':
38    const: 2
39
40  gpio-controller: true
41
42  semtech,probe-reset:
43    description: Will trigger a reset of the GPIO expander on probe
44    type: boolean
45
46patternProperties:
47  '-cfg$':
48    type: object
49    properties:
50      pins: true
51
52      bias-disable: true
53      bias-pull-up: true
54      bias-pull-down: true
55      bias-pull-pin-default: true
56      drive-push-pull: true
57      output-low: true
58      output-high: true
59      drive-open-drain: true
60
61    required:
62      - pins
63
64    allOf:
65      - $ref: "pincfg-node.yaml#"
66      - $ref: "pinmux-node.yaml#"
67      - if:
68          properties:
69            pins:
70              contains:
71                const: oscio
72        then:
73          properties:
74            bias-disable: false
75            bias-pull-up: false
76            bias-pull-down: false
77            bias-pull-pin-default: false
78            drive-open-drain: false
79
80    additionalProperties: false
81
82required:
83  - compatible
84  - reg
85  - '#gpio-cells'
86  - gpio-controller
87
88allOf:
89  - $ref: "pinctrl.yaml#"
90  - if:
91      not:
92        properties:
93          compatible:
94            contains:
95              enum:
96                - semtech,sx1507q
97                - semtech,sx1508q
98                - semtech,sx1509q
99    then:
100      properties:
101        semtech,probe-reset: false
102  - if:
103      properties:
104        compatible:
105          contains:
106            enum:
107              - semtech,sx1501q
108              - semtech,sx1504q
109    then:
110      patternProperties:
111        '-cfg$':
112          properties:
113            pins:
114              items:
115                pattern: '^gpio[0-3]$'
116  - if:
117      properties:
118        compatible:
119          contains:
120            enum:
121              - semtech,sx1502q
122              - semtech,sx1505q
123    then:
124      patternProperties:
125        '-cfg$':
126          properties:
127            pins:
128              items:
129                pattern: '^gpio[0-7]$'
130  - if:
131      properties:
132        compatible:
133          contains:
134            enum:
135              - semtech,sx1503q
136              - semtech,sx1506q
137    then:
138      patternProperties:
139        '-cfg$':
140          properties:
141            pins:
142              items:
143                pattern: '^(gpio[0-9]|gpio1[0-5])$'
144  - if:
145      properties:
146        compatible:
147          contains:
148            const: semtech,sx1507q
149    then:
150      patternProperties:
151        '-cfg$':
152          properties:
153            pins:
154              items:
155                pattern: '^(oscio|gpio[0-3])$'
156  - if:
157      properties:
158        compatible:
159          contains:
160            const: semtech,sx1508q
161    then:
162      patternProperties:
163        '-cfg$':
164          properties:
165            pins:
166              items:
167                pattern: '^(oscio|gpio[0-7])$'
168  - if:
169      properties:
170        compatible:
171          contains:
172            const: semtech,sx1509q
173    then:
174      patternProperties:
175        '-cfg$':
176          properties:
177            pins:
178              items:
179                pattern: '^(oscio|gpio[0-9]|gpio1[0-5])$'
180
181additionalProperties: false
182
183examples:
184  - |
185    #include <dt-bindings/interrupt-controller/irq.h>
186    i2c@1000 {
187        reg = <0x1000 0x80>;
188        #address-cells = <1>;
189        #size-cells = <0>;
190
191        pinctrl@20 {
192            compatible = "semtech,sx1501q";
193            reg = <0x20>;
194
195            #gpio-cells = <2>;
196            #interrupt-cells = <2>;
197
198            interrupts = <16 IRQ_TYPE_EDGE_FALLING>;
199
200            gpio-controller;
201            interrupt-controller;
202
203            gpio1-cfg {
204                  pins = "gpio1";
205                  bias-pull-up;
206            };
207        };
208    };
209