[PATCH 05/13] dt-bindings: input: Document adp5589 and similar devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add device tree bindings for the adp5589 keypad (and similar devices). The
ADP5585 family has small differences like the lack of the unlock
function and less pins (cols x rows) for the keymap.

As there's no MAINTAINERS entry for these devices, add one. Also to note
that these devices were removed from trivial-devices.yaml.

Signed-off-by: Nuno Sa <nuno.sa@xxxxxxxxxx>
---
 .../devicetree/bindings/input/adi,adp5589.yaml     | 310 +++++++++++++++++++++
 .../devicetree/bindings/trivial-devices.yaml       |   6 -
 MAINTAINERS                                        |   9 +
 3 files changed, 319 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/input/adi,adp5589.yaml b/Documentation/devicetree/bindings/input/adi,adp5589.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..bdbc79758a0390952c8363ec28f48057dab929a9
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/adi,adp5589.yaml
@@ -0,0 +1,310 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/adi,adp5589.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices ADP5589 and similar Keypad Controllers
+
+maintainers:
+  - Nuno Sa <nuno.sa@xxxxxxxxxx>
+  - Michael Hennerich <michael.hennerich@xxxxxxxxxx>
+
+description: |
+  Analog Devices Mobile I/O Expander and QWERTY Keypad Controllers
+   - https://www.analog.com/media/en/technical-documentation/data-sheets/ADP5589.pdf
+   - https://www.analog.com/media/en/technical-documentation/data-sheets/ADP5585.pdf
+
+properties:
+  compatible:
+    enum:
+      - adi,adp5589
+      - adi,adp5585
+      - adi,adp5585-2
+
+  reg:
+    maxItems: 1
+
+  vcc-supply: true
+
+  interrupts:
+    maxItems: 1
+
+  gpio-controller:
+    description:
+      This property applies if there are pins not used in the keypad.
+
+  '#gpio-cells':
+    const: 2
+
+  interrupt-controller:
+    description:
+      This property applies if there are pins not used in the keypad.
+
+  '#interrupt-cells':
+    const: 2
+
+  adi,cols-mask:
+    description:
+      Defines the number of pins (columns) being used ad part of the keymap. As
+      the device is fully configurable and we can have holes in the columns
+      being used, this is given as mask.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 0x1
+    maximum: 0x3f
+
+  adi,rows-mask:
+    description:
+      Defines the number of pins (rows) being used ad part of the keymap. As
+      the device is fully configurable and we can have holes in the rows being
+      used, this is given as mask.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 0x1
+    maximum: 0xff
+
+  adi,key-poll-ms:
+    description: Configure time between consecutive scan cycles.
+    enum: [10, 20, 30, 40]
+    default: 10
+
+  adi,unlock-keys:
+    description:
+      Specifies a maximum of 2 keys that can be used to unlock the keypad.
+      If this property is set, the keyboard will be locked and only unlocked
+      after these keys are pressed. The value 127 serves as a wildcard which
+      means any key can be used for unlocking.
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    minItems: 1
+    maxItems: 2
+    items:
+      anyOf:
+        - minimum: 1
+          maximum: 88
+        - minimum: 97
+          maximum: 115
+        - const: 127
+
+  adi,unlock-trigger-sec:
+    description:
+      Defines the time in which the second unlock event must occur after the
+      first unlock event has occurred.
+    maximum: 7
+    default: 0
+
+  adi,reset1-keys:
+    description:
+      Defines the trigger events (key presses) that can generate reset
+      conditions one the reset1 block.
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    minItems: 1
+    maxItems: 3
+    items:
+      anyOf:
+        - minimum: 1
+          maximum: 88
+        - minimum: 97
+          maximum: 115
+
+  adi,reset2-keys:
+    description:
+      Defines the trigger events (key presses) that can generate reset
+      conditions one the reset2 block.
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    minItems: 1
+    maxItems: 2
+    items:
+      anyOf:
+        - minimum: 1
+          maximum: 88
+        - minimum: 97
+          maximum: 115
+
+  adi,reset1-active-high:
+    description: Sets the reset1 signal as active high.
+    type: boolean
+
+  adi,reset2-active-high:
+    description: Sets the reset2 signal as active high.
+    type: boolean
+
+  adi,rst-passtrough-enable:
+    description: Allows the RST pin to override (OR with) the reset1 signal.
+    type: boolean
+
+  adi,reset-trigger-ms:
+    description:
+      Defines the length of time that the reset events must be active before a
+      reset signal is generated. All events must be active at the same time for
+      the same duration.
+    enum: [0, 1000, 1500, 2000, 2500, 3000, 3500, 4000]
+    default: 0
+
+  adi,reset-pulse-width-us:
+    description: Defines the pulse width of the reset signals.
+    enum: [500, 1000, 2000, 10000]
+    default: 500
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
+patternProperties:
+  "^gpio@":
+    type: object
+    additionalProperties: false
+
+    properties:
+      reg:
+        description: The GPIO number being configured.
+        maximum: 18
+
+      adi,pull-up-ohms:
+        description: The pullup resistor to be used.
+        enum: [100000, 300000]
+        default: 300000
+
+    required:
+      - reg
+
+dependencies:
+  adi,rows-mask:
+    - linux,keymap
+    - adi,cols-mask
+  adi,cols-mask:
+    - linux,keymap
+    - adi,rows-mask
+  linux,keymap:
+    - adi,rows-mask
+    - adi,cols-mask
+    - interrupts
+  interrupt-controller:
+    - interrupts
+  adi,unlock-trigger-sec:
+    - adi,unlock-keys
+  adi,reset1-active-high:
+    - adi,reset1-keys
+  adi,rst-passtrough-enable:
+    - adi,reset1-keys
+  adi,reset2-active-high:
+    - adi,reset2-keys
+
+required:
+  - compatible
+  - reg
+  - vcc-supply
+
+allOf:
+  - $ref: matrix-keymap.yaml#
+  - $ref: input.yaml#
+  - if:
+      properties:
+        compatible:
+          enum:
+            - adi,adp5585-2
+    then:
+      properties:
+        adi,unlock-keys: false
+        adi,unlock-trigger-sec: false
+        adi,rows-mask:
+          maximum: 0x2f
+        adi,cols-mask:
+          maximum: 0x1f
+        adi,reset1-keys:
+          items:
+            anyOf:
+              - minimum: 1
+                maximum: 30
+              - minimum: 37
+                maximum: 47
+        adi,reset2-keys:
+          items:
+            anyOf:
+              - minimum: 1
+                maximum: 30
+              - minimum: 37
+                maximum: 47
+      patternProperties:
+        "^gpio@":
+          properties:
+            reg:
+              maximum: 10
+  - if:
+      properties:
+        compatible:
+          enum:
+            - adi,adp5585
+    then:
+      properties:
+        adi,unlock-keys: false
+        adi,unlock-trigger-sec: false
+        adi,rows-mask:
+          maximum: 0x1f
+        adi,cols-mask:
+          maximum: 0x1f
+        adi,reset1-keys:
+          items:
+            anyOf:
+              - minimum: 1
+                maximum: 25
+              - enum: [37, 38, 39, 40, 41, 43, 44, 45, 46, 47]
+        adi,reset2-keys:
+          items:
+            anyOf:
+              - minimum: 1
+                maximum: 25
+              - enum: [37, 38, 39, 40, 41, 43, 44, 45, 46, 47]
+      patternProperties:
+        "^gpio@":
+          properties:
+            reg:
+              enum: [0, 1, 2, 3, 4, 6, 7, 8, 9, 10]
+
+unevaluatedProperties: false
+
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/input/input.h>
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        keys@34 {
+            compatible = "adi,adp5589";
+            reg = <0x34>;
+
+            vcc-supply = <&vcc>;
+            interrupts = <21 IRQ_TYPE_EDGE_FALLING>;
+            interrupt-parent = <&gpio>;
+
+            adi,rows-mask = <0x13>;
+            adi,cols-mask = <0xf>;
+
+            linux,keymap = <
+                MATRIX_KEY(0x00, 0x00, KEY_1)
+                MATRIX_KEY(0x00, 0x01, KEY_2)
+                MATRIX_KEY(0x00, 0x02, KEY_3)
+                MATRIX_KEY(0x00, 0x03, KEY_4)
+                MATRIX_KEY(0x01, 0x00, KEY_5)
+                MATRIX_KEY(0x01, 0x01, KEY_6)
+                MATRIX_KEY(0x01, 0x02, KEY_7)
+                MATRIX_KEY(0x01, 0x03, KEY_8)
+                MATRIX_KEY(0x04, 0x00, KEY_9)
+                MATRIX_KEY(0x04, 0x01, KEY_A)
+                MATRIX_KEY(0x04, 0x02, KEY_B)
+                MATRIX_KEY(0x04, 0x03, KEY_C)
+            >;
+
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            gpio@10 {
+                reg = <10>;
+                adi,pull-up-ohms = <100000>;
+            };
+        };
+    };
+...
diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml
index 7913ca9b6b54020c58e387b3618922386ce03763..35238b1d89e65bfed09e1a1a5b421a07555f6351 100644
--- a/Documentation/devicetree/bindings/trivial-devices.yaml
+++ b/Documentation/devicetree/bindings/trivial-devices.yaml
@@ -38,12 +38,6 @@ properties:
           - ad,adm9240
             # AD5110 - Nonvolatile Digital Potentiometer
           - adi,ad5110
-            # Analog Devices ADP5585 Keypad Decoder and I/O Expansion
-          - adi,adp5585
-            # Analog Devices ADP5585 Keypad Decoder and I/O Expansion with support for Row5
-          - adi,adp5585-02
-            # Analog Devices ADP5589 Keypad Decoder and I/O Expansion
-          - adi,adp5589
             # Analog Devices LT7182S Dual Channel 6A, 20V PolyPhase Step-Down Silent Switcher
           - adi,lt7182s
             # AMS iAQ-Core VOC Sensor
diff --git a/MAINTAINERS b/MAINTAINERS
index a533d882b0022fd7580b829b68d846d319a4a8a7..120a1867b8f716ae11bffedab94a938c25888457 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -545,6 +545,15 @@ W:	https://ez.analog.com/linux-software-drivers
 F:	Documentation/devicetree/bindings/input/adi,adp5588.yaml
 F:	drivers/input/keyboard/adp5588-keys.c
 
+ADP5589 QWERTY KEYPAD AND IO EXPANDER DRIVER (ADP5589/ADP5585)
+M:	Michael Hennerich <michael.hennerich@xxxxxxxxxx>
+M:	Nuno Sa <nuno.sa@xxxxxxxxxx>
+S:	Supported
+W:	https://ez.analog.com/linux-software-drivers
+F:	Documentation/devicetree/bindings/input/adi,adp5589.yaml
+F:	drivers/input/keyboard/adp5589-keys.c
+F:	include/linux/input/adp5589.h
+
 ADP8860 BACKLIGHT DRIVER (ADP8860/ADP8861/ADP8863)
 M:	Michael Hennerich <michael.hennerich@xxxxxxxxxx>
 S:	Supported

-- 
2.46.1





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux