Documentation / devicetree / bindings / mfd / adi,adp5585.yaml


Based on kernel version 6.17. Page generated on 2025-10-03 10:04 EST.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/mfd/adi,adp5585.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Analog Devices ADP5585 Keypad Decoder and I/O Expansion

maintainers:
  - Laurent Pinchart <laurent.pinchart@ideasonboard.com>

description:
  The ADP5585 is a 10/11 input/output port expander with a built in keypad
  matrix decoder, programmable logic, reset generator, and PWM generator.

properties:
  compatible:
    oneOf:
      - items:
          - enum:
              - adi,adp5585-00  # Default
              - adi,adp5585-01  # 11 GPIOs
              - adi,adp5585-02  # No pull-up resistors by default on special pins
              - adi,adp5585-03  # Alternate I2C address
              - adi,adp5585-04  # Pull-down resistors on all pins by default
          - const: adi,adp5585
      - items:
          - enum:
              - adi,adp5589-00  # Default
              - adi,adp5589-01  # R4 defaulted to RESET1 output
              - adi,adp5589-02  # Pull-down resistors by default on special pins
          - const: adi,adp5589

  reg:
    maxItems: 1

  interrupts:
    maxItems: 1

  vdd-supply: true

  reset-gpios:
    maxItems: 1

  gpio-controller: true
 
  '#gpio-cells':
    const: 2

  gpio-reserved-ranges: true
 
  "#pwm-cells":
    const: 3

  interrupt-controller: true
 
  '#interrupt-cells':
    const: 2

  poll-interval:
    enum: [10, 20, 30, 40]
    default: 10

  adi,keypad-pins:
    description: Specifies the pins used for the keypad matrix.
    $ref: /schemas/types.yaml#/definitions/uint32-array

  adi,unlock-events:
    description:
      Specifies a maximum of 2 events that can be used to unlock the keypad.
      If this property is set, the keyboard will be locked and only unlocked
      after these keys/gpis 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-events:
    description:
      Defines the trigger events (key/gpi presses) that can generate reset
      conditions one the reset1 block.
    $ref: /schemas/types.yaml#/definitions/uint32-array
    minItems: 1
    maxItems: 3

  adi,reset2-events:
    description:
      Defines the trigger events (key/gpi presses) that can generate reset
      conditions one the reset2 block.
    $ref: /schemas/types.yaml#/definitions/uint32-array
    minItems: 1
    maxItems: 2

  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-passthrough-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

patternProperties:
  "-hog(-[0-9]+)?$":
    type: object

    required:
      - gpio-hog

dependencies:
  linux,keymap:
    - adi,keypad-pins
    - interrupts
  interrupt-controller:
    - interrupts
  adi,unlock-trigger-sec:
    - adi,unlock-events
  adi,reset1-active-high:
    - adi,reset1-events
  adi,rst-passtrough-enable:
    - adi,reset1-events
  adi,reset2-active-high:
    - adi,reset2-events

required:
  - compatible
  - reg

allOf:
  - $ref: /schemas/input/matrix-keymap.yaml#
  - $ref: /schemas/input/input.yaml#
  - if:
      properties:
        compatible:
          contains:
            const: adi,adp5585-01
    then:
      properties:
        adi,unlock-events: false
        adi,unlock-trigger-sec: false
        gpio-reserved-ranges: false
        reset-gpios: false
        adi,keypad-pins:
          minItems: 2
          maxItems: 11
          items:
            minimum: 0
            maximum: 10
        adi,reset1-events:
          items:
            anyOf:
              - minimum: 1
                maximum: 30
              - minimum: 37
                maximum: 47
        adi,reset2-events:
          items:
            anyOf:
              - minimum: 1
                maximum: 30
              - minimum: 37
                maximum: 47
  - if:
      properties:
        compatible:
          contains:
            enum:
              - adi,adp5585-00
              - adi,adp5585-02
              - adi,adp5585-03
              - adi,adp5585-04
    then:
      properties:
        adi,unlock-events: false
        adi,unlock-trigger-sec: false
        adi,keypad-pins:
          minItems: 2
          maxItems: 10
          items:
            enum: [0, 1, 2, 3, 4, 6, 7, 8, 9, 10]
        adi,reset1-events:
          items:
            anyOf:
              - minimum: 1
                maximum: 25
              - enum: [37, 38, 39, 40, 41, 43, 44, 45, 46, 47]
        adi,reset2-events:
          items:
            anyOf:
              - minimum: 1
                maximum: 25
              - enum: [37, 38, 39, 40, 41, 43, 44, 45, 46, 47]
        gpio-reserved-ranges:
          maxItems: 1
          items:
            items:
              - const: 5
              - const: 1

  - if:
      properties:
        compatible:
          contains:
            enum:
              - adi,adp5589-00
              - adi,adp5589-01
              - adi,adp5589-02
    then:
      properties:
        gpio-reserved-ranges: false
        adi,keypad-pins:
          minItems: 2
          maxItems: 19
          items:
            minimum: 0
            maximum: 18
        adi,reset1-events:
          items:
            anyOf:
              - minimum: 1
                maximum: 88
              - minimum: 97
                maximum: 115
        adi,reset2-events:
          items:
            anyOf:
              - minimum: 1
                maximum: 88
              - minimum: 97
                maximum: 115

unevaluatedProperties: false

examples:
  - |
    #include <dt-bindings/input/input.h>
    #include <dt-bindings/interrupt-controller/irq.h>
    i2c {
        #address-cells = <1>;
        #size-cells = <0>;
 
        io-expander@34 {
            compatible = "adi,adp5585-00", "adi,adp5585";
            reg = <0x34>;
 
            vdd-supply = <&reg_3v3>;
 
            gpio-controller;
            #gpio-cells = <2>;
            gpio-reserved-ranges = <5 1>;
 
            #pwm-cells = <3>;
 
            interrupts = <16 IRQ_TYPE_EDGE_FALLING>;
            interrupt-parent = <&gpio>;
 
            adi,reset1-events = <1 43>;
            adi,reset2-events = <2 3>;
            adi,reset-trigger-ms = <2000>;
 
            /*
             * col0, col1, col2
             * row0, row1, row2
             */
            adi,keypad-pins = <0 1 2 6 7 8>;
 
            linux,keymap = <
                MATRIX_KEY(0x00, 0x00, KEY_1)
                MATRIX_KEY(0x00, 0x01, KEY_2)
                MATRIX_KEY(0x00, 0x02, KEY_3)
 
                MATRIX_KEY(0x01, 0x00, KEY_A)
                MATRIX_KEY(0x01, 0x01, KEY_B)
                MATRIX_KEY(0x01, 0x02, KEY_C)
 
                MATRIX_KEY(0x02, 0x00, BTN_1)
                MATRIX_KEY(0x02, 0x01, BTN_2)
                MATRIX_KEY(0x02, 0x02, BTN_3)
            >;
        };
    };

...