Maxim MAX7360 Keypad, Rotary encoder, PWM and GPIO controller

Schema identifier ($id): "http://devicetree.org/schemas/mfd/maxim,max7360.yaml#"

Schema dialect ($schema): "http://devicetree.org/meta-schemas/core.yaml#"

Maintainers (maintainers): "Kamel Bouhara <kamel.bouhara@bootlin.com>", "Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>"

Maxim MAX7360 device, with following functions:
  - keypad controller
  - rotary controller
  - GPIO and GPO controller
  - PWM controller

https://www.analog.com/en/products/max7360.html

All of these rules must match (allOf) #

Rule 1 #

Shared schema rule ($ref): /schemas/input/matrix-keymap.yaml#

Rule 2 #

Shared schema rule ($ref): /schemas/input/input.yaml#

Properties and child nodes (properties) #

compatible — required here #

Allowed values (enum): "maxim,max7360"

reg — required here #

Maximum number of items (maxItems): 1

interrupts — required here #

Maximum number of items (maxItems): 2

interrupt-names — required here #

Array item rules (items) #

Item 1

Exact value (const): "inti"

Item 2

Exact value (const): "intk"

keypad-debounce-delay-ms — not listed as required here #

Keypad debounce delay in ms

Minimum value (minimum): 9

Maximum value (maximum): 40

Default value (default): 9

rotary-debounce-delay-ms — not listed as required here #

Rotary encoder debounce delay in ms

Minimum value (minimum): 0

Maximum value (maximum): 15

Default value (default): 0

linux,axis — required here #

Shared schema rule ($ref): /schemas/input/rotary-encoder.yaml#/properties/linux,axis

rotary-encoder,relative-axis — not listed as required here #

Shared schema rule ($ref): /schemas/types.yaml#/definitions/flag

Register a relative axis rather than an absolute one.

rotary-encoder,steps — not listed as required here #

Shared schema rule ($ref): /schemas/types.yaml#/definitions/uint32

Default value (default): 24

Number of steps in a full turnaround of the encoder. Only relevant for absolute axis. Defaults to 24 which is a typical value for such devices.

rotary-encoder,rollover — not listed as required here #

Shared schema rule ($ref): /schemas/types.yaml#/definitions/flag

Automatic rollover when the rotary value becomes greater than the specified steps or smaller than 0. For absolute axis only.

#pwm-cells — required here #

Exact value (const): 3

gpio — required here #

Shared schema rule ($ref): /schemas/gpio/maxim,max7360-gpio.yaml#

PORT0 to PORT7 general purpose input/output pins configuration.

gpo — required here #

Shared schema rule ($ref): /schemas/gpio/maxim,max7360-gpio.yaml#

COL2 to COL7 general purpose output pins configuration. Allows to use unused keypad columns as outputs. The MAX7360 has 8 column lines and 6 of them can be used as GPOs. GPIOs numbers used for this gpio-controller node do correspond to the column numbers: values 0 and 1 are never valid, values from 2 to 7 might be valid depending on the value of the keypad,num-column property.

Properties matching a name pattern (patternProperties) #

-pins$ — name matches this regular expression #

Value type (type): "object"

Pinctrl node's client devices use subnodes for desired pin configuration. Client device subnodes use below standard properties.

Shared schema rule ($ref): /schemas/pinctrl/pincfg-node.yaml

Properties and child nodes (properties) #

pins — not listed as required here

List of gpio pins affected by the properties specified in this subnode.

Array item rules (items)

String pattern (pattern): "^(PORT[0-7]|ROTARY)$"

Minimum number of items (minItems): 1

Maximum number of items (maxItems): 8

function — not listed as required here

Specify the alternative function to be configured for the specified pins.

Allowed values (enum): "gpio", "pwm", "rotary"

Properties not matched by properties or patternProperties in this schema (additionalProperties) #

false

Not allowed by this rule.

Required in this object (required): "compatible", "reg", "interrupts", "interrupt-names", "linux,keymap", "linux,axis", "#pwm-cells", "gpio", "gpo"

Properties not evaluated by applicable rules (unevaluatedProperties) #

false

Not allowed by this rule.

Examples (examples) #

#include <dt-bindings/input/input.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>

i2c {
  #address-cells = <1>;
  #size-cells = <0>;

  io-expander@38 {
    compatible = "maxim,max7360";
    reg = <0x38>;

    interrupt-parent = <&gpio1>;
    interrupts = <23 IRQ_TYPE_LEVEL_LOW>,
                 <24 IRQ_TYPE_LEVEL_LOW>;
    interrupt-names = "inti", "intk";

    keypad,num-rows = <8>;
    keypad,num-columns = <4>;
    linux,keymap = <
      MATRIX_KEY(0x00, 0x00, KEY_F5)
      MATRIX_KEY(0x01, 0x00, KEY_F4)
      MATRIX_KEY(0x02, 0x01, KEY_F6)
      >;
    keypad-debounce-delay-ms = <10>;
    autorepeat;

    rotary-debounce-delay-ms = <2>;
    linux,axis = <0>; /* REL_X */
    rotary-encoder,relative-axis;

    #pwm-cells = <3>;

    max7360_gpio: gpio {
      compatible = "maxim,max7360-gpio";

      gpio-controller;
      #gpio-cells = <2>;
      maxim,constant-current-disable = <0x06>;

      interrupt-controller;
      #interrupt-cells = <0x2>;
    };

    max7360_gpo: gpo {
      compatible = "maxim,max7360-gpo";

      gpio-controller;
      #gpio-cells = <2>;
    };

    backlight_pins: backlight-pins {
      pins = "PORT2";
      function = "pwm";
    };
  };
};

Source notes #

Annotations retained from the schema source

Line 1: SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)

Edit this page