xref: /linux/Documentation/devicetree/bindings/mfd/adi,adp5585.yaml (revision 00a37271c8a68070dc64f81a5d64644beb4cef2f)
1# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/mfd/adi,adp5585.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Analog Devices ADP5585 Keypad Decoder and I/O Expansion
8
9maintainers:
10  - Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11
12description:
13  The ADP5585 is a 10/11 input/output port expander with a built in keypad
14  matrix decoder, programmable logic, reset generator, and PWM generator.
15
16properties:
17  compatible:
18    oneOf:
19      - items:
20          - enum:
21              - adi,adp5585-00  # Default
22              - adi,adp5585-01  # 11 GPIOs
23              - adi,adp5585-02  # No pull-up resistors by default on special pins
24              - adi,adp5585-03  # Alternate I2C address
25              - adi,adp5585-04  # Pull-down resistors on all pins by default
26          - const: adi,adp5585
27      - items:
28          - enum:
29              - adi,adp5589-00  # Default
30              - adi,adp5589-01  # R4 defaulted to RESET1 output
31              - adi,adp5589-02  # Pull-down resistors by default on special pins
32          - const: adi,adp5589
33
34  reg:
35    maxItems: 1
36
37  interrupts:
38    maxItems: 1
39
40  vdd-supply: true
41
42  reset-gpios:
43    maxItems: 1
44
45  gpio-controller: true
46
47  '#gpio-cells':
48    const: 2
49
50  gpio-reserved-ranges: true
51
52  "#pwm-cells":
53    const: 3
54
55  interrupt-controller: true
56
57  '#interrupt-cells':
58    const: 2
59
60  poll-interval:
61    enum: [10, 20, 30, 40]
62    default: 10
63
64  adi,keypad-pins:
65    description: Specifies the pins used for the keypad matrix.
66    $ref: /schemas/types.yaml#/definitions/uint32-array
67
68  adi,unlock-events:
69    description:
70      Specifies a maximum of 2 events that can be used to unlock the keypad.
71      If this property is set, the keyboard will be locked and only unlocked
72      after these keys/gpis are pressed. The value 127 serves as a wildcard which
73      means any key can be used for unlocking.
74    $ref: /schemas/types.yaml#/definitions/uint32-array
75    minItems: 1
76    maxItems: 2
77    items:
78      anyOf:
79        - minimum: 1
80          maximum: 88
81        - minimum: 97
82          maximum: 115
83        - const: 127
84
85  adi,unlock-trigger-sec:
86    description:
87      Defines the time in which the second unlock event must occur after the
88      first unlock event has occurred.
89    maximum: 7
90    default: 0
91
92  adi,reset1-events:
93    description:
94      Defines the trigger events (key/gpi presses) that can generate reset
95      conditions one the reset1 block.
96    $ref: /schemas/types.yaml#/definitions/uint32-array
97    minItems: 1
98    maxItems: 3
99
100  adi,reset2-events:
101    description:
102      Defines the trigger events (key/gpi presses) that can generate reset
103      conditions one the reset2 block.
104    $ref: /schemas/types.yaml#/definitions/uint32-array
105    minItems: 1
106    maxItems: 2
107
108  adi,reset1-active-high:
109    description: Sets the reset1 signal as active high.
110    type: boolean
111
112  adi,reset2-active-high:
113    description: Sets the reset2 signal as active high.
114    type: boolean
115
116  adi,rst-passthrough-enable:
117    description: Allows the RST pin to override (OR with) the reset1 signal.
118    type: boolean
119
120  adi,reset-trigger-ms:
121    description:
122      Defines the length of time that the reset events must be active before a
123      reset signal is generated. All events must be active at the same time for
124      the same duration.
125    enum: [0, 1000, 1500, 2000, 2500, 3000, 3500, 4000]
126    default: 0
127
128  adi,reset-pulse-width-us:
129    description: Defines the pulse width of the reset signals.
130    enum: [500, 1000, 2000, 10000]
131    default: 500
132
133patternProperties:
134  "-hog(-[0-9]+)?$":
135    type: object
136
137    required:
138      - gpio-hog
139
140dependencies:
141  linux,keymap:
142    - adi,keypad-pins
143    - interrupts
144  interrupt-controller:
145    - interrupts
146  adi,unlock-trigger-sec:
147    - adi,unlock-events
148  adi,reset1-active-high:
149    - adi,reset1-events
150  adi,rst-passtrough-enable:
151    - adi,reset1-events
152  adi,reset2-active-high:
153    - adi,reset2-events
154
155required:
156  - compatible
157  - reg
158
159allOf:
160  - $ref: /schemas/input/matrix-keymap.yaml#
161  - $ref: /schemas/input/input.yaml#
162  - if:
163      properties:
164        compatible:
165          contains:
166            const: adi,adp5585-01
167    then:
168      properties:
169        adi,unlock-events: false
170        adi,unlock-trigger-sec: false
171        gpio-reserved-ranges: false
172        reset-gpios: false
173        adi,keypad-pins:
174          minItems: 2
175          maxItems: 11
176          items:
177            minimum: 0
178            maximum: 10
179        adi,reset1-events:
180          items:
181            anyOf:
182              - minimum: 1
183                maximum: 30
184              - minimum: 37
185                maximum: 47
186        adi,reset2-events:
187          items:
188            anyOf:
189              - minimum: 1
190                maximum: 30
191              - minimum: 37
192                maximum: 47
193  - if:
194      properties:
195        compatible:
196          contains:
197            enum:
198              - adi,adp5585-00
199              - adi,adp5585-02
200              - adi,adp5585-03
201              - adi,adp5585-04
202    then:
203      properties:
204        adi,unlock-events: false
205        adi,unlock-trigger-sec: false
206        adi,keypad-pins:
207          minItems: 2
208          maxItems: 10
209          items:
210            enum: [0, 1, 2, 3, 4, 6, 7, 8, 9, 10]
211        adi,reset1-events:
212          items:
213            anyOf:
214              - minimum: 1
215                maximum: 25
216              - enum: [37, 38, 39, 40, 41, 43, 44, 45, 46, 47]
217        adi,reset2-events:
218          items:
219            anyOf:
220              - minimum: 1
221                maximum: 25
222              - enum: [37, 38, 39, 40, 41, 43, 44, 45, 46, 47]
223        gpio-reserved-ranges:
224          maxItems: 1
225          items:
226            items:
227              - const: 5
228              - const: 1
229
230  - if:
231      properties:
232        compatible:
233          contains:
234            enum:
235              - adi,adp5589-00
236              - adi,adp5589-01
237              - adi,adp5589-02
238    then:
239      properties:
240        gpio-reserved-ranges: false
241        adi,keypad-pins:
242          minItems: 2
243          maxItems: 19
244          items:
245            minimum: 0
246            maximum: 18
247        adi,reset1-events:
248          items:
249            anyOf:
250              - minimum: 1
251                maximum: 88
252              - minimum: 97
253                maximum: 115
254        adi,reset2-events:
255          items:
256            anyOf:
257              - minimum: 1
258                maximum: 88
259              - minimum: 97
260                maximum: 115
261
262unevaluatedProperties: false
263
264examples:
265  - |
266    #include <dt-bindings/input/input.h>
267    #include <dt-bindings/interrupt-controller/irq.h>
268    i2c {
269        #address-cells = <1>;
270        #size-cells = <0>;
271
272        io-expander@34 {
273            compatible = "adi,adp5585-00", "adi,adp5585";
274            reg = <0x34>;
275
276            vdd-supply = <&reg_3v3>;
277
278            gpio-controller;
279            #gpio-cells = <2>;
280            gpio-reserved-ranges = <5 1>;
281
282            #pwm-cells = <3>;
283
284            interrupts = <16 IRQ_TYPE_EDGE_FALLING>;
285            interrupt-parent = <&gpio>;
286
287            adi,reset1-events = <1 43>;
288            adi,reset2-events = <2 3>;
289            adi,reset-trigger-ms = <2000>;
290
291            /*
292             * col0, col1, col2
293             * row0, row1, row2
294             */
295            adi,keypad-pins = <0 1 2 6 7 8>;
296
297            linux,keymap = <
298                MATRIX_KEY(0x00, 0x00, KEY_1)
299                MATRIX_KEY(0x00, 0x01, KEY_2)
300                MATRIX_KEY(0x00, 0x02, KEY_3)
301
302                MATRIX_KEY(0x01, 0x00, KEY_A)
303                MATRIX_KEY(0x01, 0x01, KEY_B)
304                MATRIX_KEY(0x01, 0x02, KEY_C)
305
306                MATRIX_KEY(0x02, 0x00, BTN_1)
307                MATRIX_KEY(0x02, 0x01, BTN_2)
308                MATRIX_KEY(0x02, 0x02, BTN_3)
309            >;
310        };
311    };
312
313...
314