1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/input/adi,adp5588.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Analog Devices ADP5588 Keypad Controller
8
9maintainers:
10  - Nuno Sá <nuno.sa@analog.com>
11
12description: |
13  Analog Devices Mobile I/O Expander and QWERTY Keypad Controller
14  https://www.analog.com/media/en/technical-documentation/data-sheets/ADP5588.pdf
15
16allOf:
17  - $ref: matrix-keymap.yaml#
18  - $ref: input.yaml#
19
20properties:
21  compatible:
22    enum:
23      - adi,adp5587
24      - adi,adp5588
25
26  reg:
27    maxItems: 1
28
29  vcc-supply:
30    description: Supply Voltage Input
31
32  reset-gpios:
33    description:
34      If specified, it will be asserted during driver probe. As the line is
35      active low, it should be marked GPIO_ACTIVE_LOW.
36    maxItems: 1
37
38  interrupts:
39    maxItems: 1
40
41  gpio-controller:
42    description:
43      This property applies if either keypad,num-rows lower than 8 or
44      keypad,num-columns lower than 10.
45
46  '#gpio-cells':
47    const: 2
48
49  interrupt-controller:
50    description:
51      This property applies if either keypad,num-rows lower than 8 or
52      keypad,num-columns lower than 10. This property is optional if
53      keypad,num-rows or keypad,num-columns are not specified as the
54      device is then configured to be used purely for gpio during which
55      interrupts may or may not be utilized.
56
57  '#interrupt-cells':
58    const: 2
59
60  adi,unlock-keys:
61    description:
62      Specifies a maximum of 2 keys that can be used to unlock the keypad.
63      If this property is set, the keyboard will be locked and only unlocked
64      after these keys are pressed. If only one key is set, a double click is
65      needed to unlock the keypad. The value of this property cannot be bigger
66      or equal than keypad,num-rows * keypad,num-columns.
67    $ref: /schemas/types.yaml#/definitions/uint32-array
68    minItems: 1
69    maxItems: 2
70
71dependencies:
72  keypad,num-rows:
73    - linux,keymap
74    - keypad,num-columns
75  keypad,num-columns:
76    - linux,keymap
77    - keypad,num-rows
78  linux,keymap:
79    - keypad,num-rows
80    - keypad,num-columns
81    - interrupts
82  interrupt-controller:
83    - interrupts
84
85required:
86  - compatible
87  - reg
88
89unevaluatedProperties: false
90
91examples:
92  - |
93    #include <dt-bindings/interrupt-controller/irq.h>
94    #include <dt-bindings/input/input.h>
95    #include <dt-bindings/gpio/gpio.h>
96    i2c {
97        #address-cells = <1>;
98        #size-cells = <0>;
99
100        keys@34 {
101            compatible = "adi,adp5588";
102            reg = <0x34>;
103
104            vcc-supply = <&vcc>;
105            interrupts = <21 IRQ_TYPE_EDGE_FALLING>;
106            interrupt-parent = <&gpio>;
107            reset-gpios = <&gpio 20 GPIO_ACTIVE_LOW>;
108
109            keypad,num-rows = <1>;
110            keypad,num-columns = <9>;
111            linux,keymap = <
112                MATRIX_KEY(0x00, 0x00, KEY_1)
113                MATRIX_KEY(0x00, 0x01, KEY_2)
114                MATRIX_KEY(0x00, 0x02, KEY_3)
115                MATRIX_KEY(0x00, 0x03, KEY_4)
116                MATRIX_KEY(0x00, 0x04, KEY_5)
117                MATRIX_KEY(0x00, 0x05, KEY_6)
118                MATRIX_KEY(0x00, 0x06, KEY_7)
119                MATRIX_KEY(0x00, 0x07, KEY_8)
120                MATRIX_KEY(0x00, 0x08, KEY_9)
121            >;
122        };
123    };
124
125  - |
126    #include <dt-bindings/gpio/gpio.h>
127    i2c {
128        #address-cells = <1>;
129        #size-cells = <0>;
130        gpio@34 {
131            compatible = "adi,adp5588";
132            reg = <0x34>;
133
134            #gpio-cells = <2>;
135            gpio-controller;
136        };
137    };
138
139...
140