[PATCH 2/5] dt-bindings: Add bindings for the Analog Devices ADP5585

From: Laurent Pinchart
Date: Mon May 20 2024 - 16:00:30 EST


The ADP5585 is a 10/11 input/output port expander with a built in keypad
matrix decoder, programmable logic, reset generator, and PWM generator.
These bindings model the device as an MFD, and support the GPIO expander
and PWM functions.

These bindings support the GPIO and PWM functions.

Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
---
I've limited the bindings to GPIO and PWM as I lack hardware to design,
implement and test the rest of the features the chip supports.
---
.../bindings/gpio/adi,adp5585-gpio.yaml | 36 ++++++
.../devicetree/bindings/mfd/adi,adp5585.yaml | 117 ++++++++++++++++++
.../bindings/pwm/adi,adp5585-pwm.yaml | 35 ++++++
MAINTAINERS | 7 ++
4 files changed, 195 insertions(+)
create mode 100644 Documentation/devicetree/bindings/gpio/adi,adp5585-gpio.yaml
create mode 100644 Documentation/devicetree/bindings/mfd/adi,adp5585.yaml
create mode 100644 Documentation/devicetree/bindings/pwm/adi,adp5585-pwm.yaml

diff --git a/Documentation/devicetree/bindings/gpio/adi,adp5585-gpio.yaml b/Documentation/devicetree/bindings/gpio/adi,adp5585-gpio.yaml
new file mode 100644
index 000000000000..210e4d53e764
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/adi,adp5585-gpio.yaml
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gpio/adi,adp5585-gpio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices ADP5585 GPIO Expander
+
+maintainers:
+ - Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
+
+description: |
+ The Analog Devices ADP5585 has up to 11 GPIOs represented by a "gpio" child
+ node of the parent MFD device. See
+ Documentation/devicetree/bindings/mfd/adi,adp5585.yaml for further details as
+ well as an example.
+
+properties:
+ compatible:
+ const: adi,adp5585-gpio
+
+ gpio-controller: true
+
+ '#gpio-cells':
+ const: 2
+
+ gpio-reserved-ranges: true
+
+required:
+ - compatible
+ - gpio-controller
+ - "#gpio-cells"
+
+additionalProperties: false
+
+...
diff --git a/Documentation/devicetree/bindings/mfd/adi,adp5585.yaml b/Documentation/devicetree/bindings/mfd/adi,adp5585.yaml
new file mode 100644
index 000000000000..217c038b2842
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/adi,adp5585.yaml
@@ -0,0 +1,117 @@
+# 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@xxxxxxxxxxxxxxxx>
+
+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:
+ 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
+
+ reg:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+ vdd-supply: true
+
+ gpio:
+ $ref: /schemas/gpio/adi,adp5585-gpio.yaml
+
+ pwm:
+ $ref: /schemas/pwm/adi,adp5585-pwm.yaml
+
+required:
+ - compatible
+ - reg
+ - gpio
+ - pwm
+
+allOf:
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: adi,adp5585-01
+ then:
+ properties:
+ gpio:
+ properties:
+ gpio-reserved-ranges: false
+ else:
+ properties:
+ gpio:
+ properties:
+ gpio-reserved-ranges:
+ items:
+ - const: 5
+ - const: 1
+
+additionalProperties: false
+
+examples:
+ - |
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ mfd@34 {
+ compatible = "adi,adp5585-00", "adi,adp5585";
+ reg = <0x34>;
+
+ gpio {
+ compatible = "adi,adp5585-gpio";
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-reserved-ranges = <5 1>;
+ };
+
+ pwm {
+ compatible = "adi,adp5585-pwm";
+ #pwm-cells = <3>;
+ };
+ };
+ };
+
+ - |
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ mfd@34 {
+ compatible = "adi,adp5585-01", "adi,adp5585";
+ reg = <0x34>;
+
+ vdd-supply = <&reg_3v3>;
+
+ gpio {
+ compatible = "adi,adp5585-gpio";
+ gpio-controller;
+ #gpio-cells = <2>;
+ };
+
+ pwm {
+ compatible = "adi,adp5585-pwm";
+ #pwm-cells = <3>;
+ };
+ };
+ };
+
+...
diff --git a/Documentation/devicetree/bindings/pwm/adi,adp5585-pwm.yaml b/Documentation/devicetree/bindings/pwm/adi,adp5585-pwm.yaml
new file mode 100644
index 000000000000..351a9d5da566
--- /dev/null
+++ b/Documentation/devicetree/bindings/pwm/adi,adp5585-pwm.yaml
@@ -0,0 +1,35 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pwm/adi,adp5585-pwm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices ADP5585 PWM Generator
+
+maintainers:
+ - Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
+
+description: |
+ The Analog Devices ADP5585 generates a PWM output with configurable frequency
+ and duty cycle represented by a "pwm" child node of the parent MFD device.
+ See Documentation/devicetree/bindings/mfd/adi,adp5585.yaml for further
+ details as well as an example.
+
+allOf:
+ - $ref: /schemas/pwm/pwm.yaml#
+
+properties:
+ compatible:
+ enum:
+ - adi,adp5585-pwm
+
+ "#pwm-cells":
+ const: 3
+
+required:
+ - compatible
+ - "#pwm-cells"
+
+additionalProperties: false
+
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 28e20975c26f..afecdb82e783 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -497,6 +497,13 @@ F: drivers/leds/leds-adp5520.c
F: drivers/mfd/adp5520.c
F: drivers/video/backlight/adp5520_bl.c

+ADP5585 GPIO EXPANDER, PWM AND KEYPAD CONTROLLER DRIVER
+M: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
+L: linux-gpio@xxxxxxxxxxxxxxx
+L: linux-pwm@xxxxxxxxxxxxxxx
+S: Maintained
+F: Documentation/devicetree/bindings/*/adi,adp5585*.yaml
+
ADP5588 QWERTY KEYPAD AND IO EXPANDER DRIVER (ADP5588/ADP5587)
M: Michael Hennerich <michael.hennerich@xxxxxxxxxx>
S: Supported
--
Regards,

Laurent Pinchart