Add devicetree bindings for adg1712 SPST quad switch.
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
Changes in v2:
- Replace individual GPIO properties (switch1-gpios, switch2-gpios, etc.)
with a single GPIO array property (switch-gpios)
- Update required properties list accordingly
- Simplify device tree example to use array notation
---
.../devicetree/bindings/gpio/adi,adg1712.yaml | 65 +++++++++++++++++++
1 file changed, 65 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..d6000a788d6e
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/adi,adg1712.yaml
@@ -0,0 +1,65 @@
+# 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
+
+ switch-gpios:
+ description: |
+ Array of GPIOs connected to the IN1-IN4 control pins.
+ Index 0 corresponds to IN1 (controls SW1),
+ Index 1 corresponds to IN2 (controls SW2),
+ Index 2 corresponds to IN3 (controls SW3),
+ Index 3 corresponds to IN4 (controls SW4).
+ minItems: 4
+ maxItems: 4
+
+ 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
+ - switch-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>;
+
+ switch-gpios = <&gpio 10 GPIO_ACTIVE_HIGH>,
+ <&gpio 11 GPIO_ACTIVE_HIGH>,
+ <&gpio 12 GPIO_ACTIVE_HIGH>,
+ <&gpio 13 GPIO_ACTIVE_HIGH>;
+ };
+...
--
2.43.0
On Sat, 2025-11-08 at 17:40 +0000, Antoniu Miclaus wrote:
> Add devicetree bindings for adg1712 SPST quad switch.
>
> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
> ---
> Changes in v2:
> - Replace individual GPIO properties (switch1-gpios, switch2-gpios, etc.)
> with a single GPIO array property (switch-gpios)
> - Update required properties list accordingly
> - Simplify device tree example to use array notation
> ---
Antoniu,
See the discussion in [1] and reply there. Linus gave a suggestion on how
this could be implemented. See if it fits the usecases this chip is being
used and if not we need to discuss alternatives or if we can allow
gpiochip .set()/.get()
[1]: https://lore.kernel.org/linux-gpio/20251031160710.13343-1-antoniu.miclaus@analog.com/T/#m3f4397526ee7cb2a737a30673934578b3b290c1c
- Nuno Sá
> .../devicetree/bindings/gpio/adi,adg1712.yaml | 65 +++++++++++++++++++
> 1 file changed, 65 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..d6000a788d6e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/gpio/adi,adg1712.yaml
> @@ -0,0 +1,65 @@
> +# 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
> +
> + switch-gpios:
> + description: |
> + Array of GPIOs connected to the IN1-IN4 control pins.
> + Index 0 corresponds to IN1 (controls SW1),
> + Index 1 corresponds to IN2 (controls SW2),
> + Index 2 corresponds to IN3 (controls SW3),
> + Index 3 corresponds to IN4 (controls SW4).
> + minItems: 4
> + maxItems: 4
> +
> + 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
> + - switch-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>;
> +
> + switch-gpios = <&gpio 10 GPIO_ACTIVE_HIGH>,
> + <&gpio 11 GPIO_ACTIVE_HIGH>,
> + <&gpio 12 GPIO_ACTIVE_HIGH>,
> + <&gpio 13 GPIO_ACTIVE_HIGH>;
> + };
> +...
On Sat, Nov 8, 2025 at 6:43 PM Antoniu Miclaus
<antoniu.miclaus@analog.com> wrote:
> Add devicetree bindings for adg1712 SPST quad switch.
>
> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
My comment on v1 stands.
This is a switch controlled by a GPIO:
-----/ -----
|
gpio
The resulting binding is not about GPIO, it is about a switch.
There are similar things that have unique bindings already,
for example:
Documentation/devicetree/bindings/power/reset/gpio-poweroff.yaml
I think this needs a new binding folder in
dt-bindings/switch/* and cannot be hidden away
as "some kind of GPIO".
Maybe it will be modeled as some GPIO in Linux, I don't
know yet, but other operating systems use these bindings
too, and they will be confused by this "GPIO" which is
actually a switch.
I don't like the idea of GPIO being used as a dumping
ground for hardware that isn't properly modeled.
Yours,
Linus Walleij
On Sat, Nov 08, 2025 at 05:40:28PM +0000, Antoniu Miclaus wrote:
> Add devicetree bindings for adg1712 SPST quad switch.
>
> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
> ---
> Changes in v2:
> - Replace individual GPIO properties (switch1-gpios, switch2-gpios, etc.)
> with a single GPIO array property (switch-gpios)
As implemented, does this not prevent only populating some of the
inputs?
e.g. 1-3 and 0 is empty.
> - Update required properties list accordingly
> - Simplify device tree example to use array notation
> ---
> .../devicetree/bindings/gpio/adi,adg1712.yaml | 65 +++++++++++++++++++
> 1 file changed, 65 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..d6000a788d6e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/gpio/adi,adg1712.yaml
> @@ -0,0 +1,65 @@
> +# 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
> +
> + switch-gpios:
> + description: |
> + Array of GPIOs connected to the IN1-IN4 control pins.
> + Index 0 corresponds to IN1 (controls SW1),
> + Index 1 corresponds to IN2 (controls SW2),
> + Index 2 corresponds to IN3 (controls SW3),
> + Index 3 corresponds to IN4 (controls SW4).
> + minItems: 4
> + maxItems: 4
> +
> + 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
> + - switch-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>;
> +
> + switch-gpios = <&gpio 10 GPIO_ACTIVE_HIGH>,
> + <&gpio 11 GPIO_ACTIVE_HIGH>,
> + <&gpio 12 GPIO_ACTIVE_HIGH>,
> + <&gpio 13 GPIO_ACTIVE_HIGH>;
> + };
> +...
> --
> 2.43.0
>
© 2016 - 2025 Red Hat, Inc.