[PATCH 1/2] dt-bindings: gpio: adg1712: add adg1712 support

Antoniu Miclaus posted 2 patches 3 months, 1 week ago
There is a newer version of this series
[PATCH 1/2] dt-bindings: gpio: adg1712: add adg1712 support
Posted by Antoniu Miclaus 3 months, 1 week ago
Add devicetree bindings for adg1712 SPST quad switch.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
 .../devicetree/bindings/gpio/adi,adg1712.yaml | 75 +++++++++++++++++++
 1 file changed, 75 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/adi,adg1712.yaml

diff --git a/Documentation/devicetree/bindings/gpio/adi,adg1712.yaml b/Documentation/devicetree/bindings/gpio/adi,adg1712.yaml
new file mode 100644
index 000000000000..2c26d2a7def8
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/adi,adg1712.yaml
@@ -0,0 +1,75 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gpio/adi,adg1712.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices ADG1712 quad SPST switch GPIO controller
+
+maintainers:
+  - Antoniu Miclaus <antoniu.miclaus@analog.com>
+
+description: |
+  Bindings for Analog Devices ADG1712 quad single-pole, single-throw (SPST)
+  switch controlled by GPIOs. The device features four independent switches,
+  each controlled by a dedicated GPIO input pin.
+
+  Each GPIO line exposed by this controller corresponds to one of the four
+  switches (SW1-SW4) on the ADG1712. Setting a GPIO line high enables the
+  corresponding switch, while setting it low disables the switch.
+
+properties:
+  compatible:
+    const: adi,adg1712
+
+  switch1-gpios:
+    description: GPIO connected to the IN1 control pin (controls SW1)
+    maxItems: 1
+
+  switch2-gpios:
+    description: GPIO connected to the IN2 control pin (controls SW2)
+    maxItems: 1
+
+  switch3-gpios:
+    description: GPIO connected to the IN3 control pin (controls SW3)
+    maxItems: 1
+
+  switch4-gpios:
+    description: GPIO connected to the IN4 control pin (controls SW4)
+    maxItems: 1
+
+  gpio-controller: true
+
+  "#gpio-cells":
+    const: 2
+    description: |
+      The first cell is the GPIO number (0-3 corresponding to SW1-SW4).
+      The second cell specifies GPIO flags.
+
+required:
+  - compatible
+  - switch1-gpios
+  - switch2-gpios
+  - switch3-gpios
+  - switch4-gpios
+  - gpio-controller
+  - "#gpio-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    adg1712: gpio-expander {
+        compatible = "adi,adg1712";
+        gpio-controller;
+        #gpio-cells = <2>;
+
+        switch1-gpios = <&gpio 10 GPIO_ACTIVE_HIGH>;
+        switch2-gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
+        switch3-gpios = <&gpio 12 GPIO_ACTIVE_HIGH>;
+        switch4-gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
+    };
+
+...
\ No newline at end of file
-- 
2.43.0
Re: [PATCH 1/2] dt-bindings: gpio: adg1712: add adg1712 support
Posted by Linus Walleij 3 months ago
Hi Antoniu,

thanks for your patch!

Add
Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/adg1712.pdf

Before signed-off-by, thanks.

On Fri, Oct 31, 2025 at 5:08 PM Antoniu Miclaus
<antoniu.miclaus@analog.com> wrote:

> +title: Analog Devices ADG1712 quad SPST switch GPIO controller
> +
> +maintainers:
> +  - Antoniu Miclaus <antoniu.miclaus@analog.com>
> +
> +description: |
> +  Bindings for Analog Devices ADG1712 quad single-pole, single-throw (SPST)
> +  switch controlled by GPIOs. The device features four independent switches,
> +  each controlled by a dedicated GPIO input pin.
> +
> +  Each GPIO line exposed by this controller corresponds to one of the four
> +  switches (SW1-SW4) on the ADG1712. Setting a GPIO line high enables the
> +  corresponding switch, while setting it low disables the switch.

There are two unclarities here:

- I know what an SPST switch is, but how is that electrically controlled?
  Is it actually a good old electro-magnetic relay? There are clearly
  details missing here. When I look in the datasheet, a symbol for a
  relay is present in the schematics. At least explain that they work
  "as a relay replacement" (literal wording from the datasheet) so
  we know what this is.

- GPIO is general purpose input/output. This is a narrow fit with that
  concept. This device is more of a general purpose mechanical
  current switch. We need some motivation here, explaining why
  GPIO is a good, operating system-neutral description of what this
  device does.

Perhaps we need to create a new binding category
dt-bindings/switch for this, even if in Linux specifically we chose
to model this as a GPIO, it could just be something we do in
Linux, Zephyr for example might want to have a dedicated driver
for switches.

Also I would like Peter Rosin's eye on this, as we have
dt-bindings/mux which is selecting one analog line out of many
and it's close enough.

> +  switch1-gpios:
> +    description: GPIO connected to the IN1 control pin (controls SW1)
> +    maxItems: 1
> +
> +  switch2-gpios:
> +    description: GPIO connected to the IN2 control pin (controls SW2)
> +    maxItems: 1
> +
> +  switch3-gpios:
> +    description: GPIO connected to the IN3 control pin (controls SW3)
> +    maxItems: 1
> +
> +  switch4-gpios:
> +    description: GPIO connected to the IN4 control pin (controls SW4)
> +    maxItems: 1

Why not just use an array of GPIOs? The property has the suffix "gpios"
(pluralis) after all.

I'd just use switch-gpios = <1, 2, 3, 4>...

> +  gpio-controller: true

So this switching capacity expose four new GPIOs, are these really
GPIOs, that's the question. I think we might need a new binding
category. Either this is switch, GPIO or some type of amplifier.

Yours,
Linus Walleij
Re: [PATCH 1/2] dt-bindings: gpio: adg1712: add adg1712 support
Posted by Rob Herring (Arm) 3 months, 1 week ago
On Fri, 31 Oct 2025 16:07:04 +0000, Antoniu Miclaus wrote:
> Add devicetree bindings for adg1712 SPST quad switch.
> 
> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
> ---
>  .../devicetree/bindings/gpio/adi,adg1712.yaml | 75 +++++++++++++++++++
>  1 file changed, 75 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/gpio/adi,adg1712.yaml
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:
./Documentation/devicetree/bindings/gpio/adi,adg1712.yaml:75:4: [error] no new line character at the end of file (new-line-at-end-of-file)

dtschema/dtc warnings/errors:

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20251031160710.13343-2-antoniu.miclaus@analog.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.