* [PATCH v4 0/2] mux: gpio-mux: add enable GPIO support
@ 2026-01-16 15:26 Antoniu Miclaus
2026-01-16 15:26 ` [PATCH v4 1/2] dt-bindings: mux: gpio-mux: add enable-gpios support Antoniu Miclaus
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Antoniu Miclaus @ 2026-01-16 15:26 UTC (permalink / raw)
To: Peter Rosin, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Antoniu Miclaus, Srinivas Kandagatla, Linus Walleij,
Johan Hovold, David Lechner, devicetree, linux-kernel
This series adds optional enable GPIO support to the gpio-mux driver.
The enable GPIO allows the multiplexer to be disabled before changing
address lines and re-enabled after, preventing glitches that could
briefly activate unintended channels during transitions.
This feature is useful for devices like the Analog Devices ADG2404
(4:1 mux) that require enable control for glitch-free operation. The
binding documentation now includes ADG2404 as a supported device with
a dedicated example.
Changes in v4:
* Remove device-specific compatible (adi,adg2404) per reviewer feedback
* Use generic gpio-mux compatible for all GPIO-based muxes
* Add ADG2404 to binding description for discoverability
* Add dedicated ADG2404 example in binding
* Update commit messages to reference ADG2404 as a use case
Antoniu Miclaus (2):
dt-bindings: mux: gpio-mux: add enable-gpios support
mux: gpio-mux: add support for enable GPIO
.../devicetree/bindings/mux/gpio-mux.yaml | 25 +++++++++++++++
drivers/mux/gpio.c | 32 ++++++++++++++++++-
2 files changed, 56 insertions(+), 1 deletion(-)
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v4 1/2] dt-bindings: mux: gpio-mux: add enable-gpios support
2026-01-16 15:26 [PATCH v4 0/2] mux: gpio-mux: add enable GPIO support Antoniu Miclaus
@ 2026-01-16 15:26 ` Antoniu Miclaus
2026-01-16 16:04 ` Krzysztof Kozlowski
2026-01-16 15:26 ` [PATCH v4 2/2] mux: gpio-mux: add support for enable GPIO Antoniu Miclaus
2026-01-18 23:18 ` [PATCH v4 0/2] mux: gpio-mux: add enable GPIO support Linus Walleij
2 siblings, 1 reply; 7+ messages in thread
From: Antoniu Miclaus @ 2026-01-16 15:26 UTC (permalink / raw)
To: Peter Rosin, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Antoniu Miclaus, Srinivas Kandagatla, Bartosz Golaszewski,
David Lechner, devicetree, linux-kernel
Add support for an optional enable GPIO that allows the multiplexer
to be disabled before changing address lines and re-enabled after,
preventing glitches during channel transitions.
This is useful for devices like the Analog Devices ADG2404 (4:1 mux)
that benefit from enable control to ensure clean channel switching.
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
Changes in v4:
* Add ADG2404 to binding description for discoverability
* Add dedicated ADG2404 example showing enable-gpios usage
* Update commit message to reference ADG2404 as use case
---
.../devicetree/bindings/mux/gpio-mux.yaml | 25 +++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/Documentation/devicetree/bindings/mux/gpio-mux.yaml b/Documentation/devicetree/bindings/mux/gpio-mux.yaml
index ef7e33ec85d4..2d9f32012127 100644
--- a/Documentation/devicetree/bindings/mux/gpio-mux.yaml
+++ b/Documentation/devicetree/bindings/mux/gpio-mux.yaml
@@ -17,6 +17,9 @@ description: |+
multiplexer GPIO pins, where the first pin is the least significant
bit. An active pin is a binary 1, an inactive pin is a binary 0.
+ This binding supports GPIO-controlled multiplexers such as the Analog
+ Devices ADG2404 (4:1 mux with enable control).
+
properties:
compatible:
const: gpio-mux
@@ -25,6 +28,13 @@ properties:
description:
List of gpios used to control the multiplexer, least significant bit first.
+ enable-gpios:
+ description:
+ Optional GPIO to enable the multiplexer. When present, the mux will be
+ disabled before changing address lines and re-enabled after to prevent
+ glitches. Required for MUX_IDLE_DISCONNECT idle-state.
+ maxItems: 1
+
mux-supply:
description:
Regulator to power on the multiplexer.
@@ -100,4 +110,19 @@ examples:
};
};
};
+
+ - |
+ /* Analog Devices ADG2404 4:1 multiplexer with enable control */
+ #include <dt-bindings/gpio/gpio.h>
+
+ mux-controller {
+ compatible = "gpio-mux";
+ #mux-control-cells = <0>;
+
+ mux-gpios = <&gpio 1 GPIO_ACTIVE_HIGH>,
+ <&gpio 2 GPIO_ACTIVE_HIGH>;
+ enable-gpios = <&gpio 3 GPIO_ACTIVE_HIGH>;
+
+ idle-state = <0>;
+ };
...
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v4 2/2] mux: gpio-mux: add support for enable GPIO
2026-01-16 15:26 [PATCH v4 0/2] mux: gpio-mux: add enable GPIO support Antoniu Miclaus
2026-01-16 15:26 ` [PATCH v4 1/2] dt-bindings: mux: gpio-mux: add enable-gpios support Antoniu Miclaus
@ 2026-01-16 15:26 ` Antoniu Miclaus
2026-01-18 23:18 ` [PATCH v4 0/2] mux: gpio-mux: add enable GPIO support Linus Walleij
2 siblings, 0 replies; 7+ messages in thread
From: Antoniu Miclaus @ 2026-01-16 15:26 UTC (permalink / raw)
To: Peter Rosin, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Antoniu Miclaus, Srinivas Kandagatla, Bartosz Golaszewski,
David Lechner, devicetree, linux-kernel
Add support for an optional enable GPIO to the gpio-mux driver. This
allows the mux to be disabled before changing address lines and
re-enabled after, preventing glitches that could briefly activate
unintended channels during transitions.
The enable GPIO is optional and the driver maintains backward
compatibility with existing gpio-mux users.
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
Changes in v4:
* No changes
---
drivers/mux/gpio.c | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/drivers/mux/gpio.c b/drivers/mux/gpio.c
index 4cc3202c58f3..93487483e81f 100644
--- a/drivers/mux/gpio.c
+++ b/drivers/mux/gpio.c
@@ -19,6 +19,7 @@
struct mux_gpio {
struct gpio_descs *gpios;
+ struct gpio_desc *enable;
};
static int mux_gpio_set(struct mux_control *mux, int state)
@@ -27,10 +28,28 @@ static int mux_gpio_set(struct mux_control *mux, int state)
DECLARE_BITMAP(values, BITS_PER_TYPE(state));
u32 value = state;
+ if (state == MUX_IDLE_DISCONNECT) {
+ if (mux_gpio->enable)
+ gpiod_set_value_cansleep(mux_gpio->enable, 0);
+ return 0;
+ }
+
+ if (mux_gpio->enable) {
+ /*
+ * Disable the mux before changing address lines to prevent
+ * glitches. Changing address while enabled could briefly
+ * activate an unintended channel during the transition.
+ */
+ gpiod_set_value_cansleep(mux_gpio->enable, 0);
+ }
+
bitmap_from_arr32(values, &value, BITS_PER_TYPE(value));
gpiod_multi_set_value_cansleep(mux_gpio->gpios, values);
+ if (mux_gpio->enable)
+ gpiod_set_value_cansleep(mux_gpio->enable, 1);
+
return 0;
}
@@ -71,9 +90,20 @@ static int mux_gpio_probe(struct platform_device *pdev)
WARN_ON(pins != mux_gpio->gpios->ndescs);
mux_chip->mux->states = BIT(pins);
+ mux_gpio->enable = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_LOW);
+ if (IS_ERR(mux_gpio->enable))
+ return dev_err_probe(dev, PTR_ERR(mux_gpio->enable),
+ "failed to get enable gpio\n");
+
ret = device_property_read_u32(dev, "idle-state", (u32 *)&idle_state);
if (ret >= 0 && idle_state != MUX_IDLE_AS_IS) {
- if (idle_state < 0 || idle_state >= mux_chip->mux->states) {
+ if (idle_state == MUX_IDLE_DISCONNECT) {
+ if (!mux_gpio->enable) {
+ dev_err(dev,
+ "invalid idle-state (MUX_IDLE_DISCONNECT requires enable-gpios)\n");
+ return -EINVAL;
+ }
+ } else if (idle_state < 0 || idle_state >= mux_chip->mux->states) {
dev_err(dev, "invalid idle-state %u\n", idle_state);
return -EINVAL;
}
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4 1/2] dt-bindings: mux: gpio-mux: add enable-gpios support
2026-01-16 15:26 ` [PATCH v4 1/2] dt-bindings: mux: gpio-mux: add enable-gpios support Antoniu Miclaus
@ 2026-01-16 16:04 ` Krzysztof Kozlowski
0 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-16 16:04 UTC (permalink / raw)
To: Antoniu Miclaus, Peter Rosin, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Srinivas Kandagatla, Bartosz Golaszewski,
David Lechner, devicetree, linux-kernel
On 16/01/2026 16:26, Antoniu Miclaus wrote:
> Add support for an optional enable GPIO that allows the multiplexer
> to be disabled before changing address lines and re-enabled after,
> preventing glitches during channel transitions.
>
> This is useful for devices like the Analog Devices ADG2404 (4:1 mux)
> that benefit from enable control to ensure clean channel switching.
>
> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
> ---
> Changes in v4:
> * Add ADG2404 to binding description for discoverability
> * Add dedicated ADG2404 example showing enable-gpios usage
> * Update commit message to reference ADG2404 as use case
>
> ---
> .../devicetree/bindings/mux/gpio-mux.yaml | 25 +++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/mux/gpio-mux.yaml b/Documentation/devicetree/bindings/mux/gpio-mux.yaml
> index ef7e33ec85d4..2d9f32012127 100644
> --- a/Documentation/devicetree/bindings/mux/gpio-mux.yaml
> +++ b/Documentation/devicetree/bindings/mux/gpio-mux.yaml
> @@ -17,6 +17,9 @@ description: |+
> multiplexer GPIO pins, where the first pin is the least significant
> bit. An active pin is a binary 1, an inactive pin is a binary 0.
>
> + This binding supports GPIO-controlled multiplexers such as the Analog
> + Devices ADG2404 (4:1 mux with enable control).
> +
> properties:
> compatible:
> const: gpio-mux
> @@ -25,6 +28,13 @@ properties:
> description:
> List of gpios used to control the multiplexer, least significant bit first.
>
> + enable-gpios:
> + description:
> + Optional GPIO to enable the multiplexer. When present, the mux will be
> + disabled before changing address lines and re-enabled after to prevent
> + glitches. Required for MUX_IDLE_DISCONNECT idle-state.
> + maxItems: 1
> +
> mux-supply:
> description:
> Regulator to power on the multiplexer.
> @@ -100,4 +110,19 @@ examples:
> };
> };
> };
> +
> + - |
> + /* Analog Devices ADG2404 4:1 multiplexer with enable control */
> + #include <dt-bindings/gpio/gpio.h>
> +
> + mux-controller {
I did not ask for this. I asked for upstreamed DTS. DTS is a format and
a file - see arch/*/boot/dts/. When I say - upstream DTS - it means you
should make your or any board using this hardware accepted by respective
maintainer. We do not add new examples per every new property, so just
add enable-gpios into existing example.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4 0/2] mux: gpio-mux: add enable GPIO support
2026-01-16 15:26 [PATCH v4 0/2] mux: gpio-mux: add enable GPIO support Antoniu Miclaus
2026-01-16 15:26 ` [PATCH v4 1/2] dt-bindings: mux: gpio-mux: add enable-gpios support Antoniu Miclaus
2026-01-16 15:26 ` [PATCH v4 2/2] mux: gpio-mux: add support for enable GPIO Antoniu Miclaus
@ 2026-01-18 23:18 ` Linus Walleij
2026-01-20 14:28 ` Miclaus, Antoniu
2 siblings, 1 reply; 7+ messages in thread
From: Linus Walleij @ 2026-01-18 23:18 UTC (permalink / raw)
To: Antoniu Miclaus
Cc: Peter Rosin, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Srinivas Kandagatla, Johan Hovold, David Lechner, devicetree,
linux-kernel
Hi Antoniu,
thanks for your patch!
On Fri, Jan 16, 2026 at 4:38 PM Antoniu Miclaus
<antoniu.miclaus@analog.com> wrote:
> This series adds optional enable GPIO support to the gpio-mux driver.
> The enable GPIO allows the multiplexer to be disabled before changing
> address lines and re-enabled after, preventing glitches that could
> briefly activate unintended channels during transitions.
>
> This feature is useful for devices like the Analog Devices ADG2404
> (4:1 mux) that require enable control for glitch-free operation. The
> binding documentation now includes ADG2404 as a supported device with
> a dedicated example.
Overall the idea is sound!
I don't know if "enable" is a good name for this GPIO though,
because as I understand it the signal passes through the mux even
if it is "disabled"?
I would call it "hold" and make it active low if it holds the mux
state when this signal is low.
hold-gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
this will have the intended semantic.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH v4 0/2] mux: gpio-mux: add enable GPIO support
2026-01-18 23:18 ` [PATCH v4 0/2] mux: gpio-mux: add enable GPIO support Linus Walleij
@ 2026-01-20 14:28 ` Miclaus, Antoniu
2026-01-21 12:37 ` Linus Walleij
0 siblings, 1 reply; 7+ messages in thread
From: Miclaus, Antoniu @ 2026-01-20 14:28 UTC (permalink / raw)
To: Linus Walleij
Cc: Peter Rosin, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Srinivas Kandagatla, Johan Hovold, David Lechner, devicetree,
linux-kernel
> -----Original Message-----
> From: Linus Walleij <linusw@kernel.org>
> Sent: Monday, January 19, 2026 1:19 AM
> To: Miclaus, Antoniu <Antoniu.Miclaus@analog.com>
> Cc: Peter Rosin <peda@axentia.se>; Rob Herring <robh@kernel.org>; Krzysztof
> Kozlowski <krzk+dt@kernel.org>; Conor Dooley <conor+dt@kernel.org>;
> Srinivas Kandagatla <srini@kernel.org>; Johan Hovold
> <johan+linaro@kernel.org>; David Lechner <dlechner@baylibre.com>;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v4 0/2] mux: gpio-mux: add enable GPIO support
>
> [External]
>
> Hi Antoniu,
>
> thanks for your patch!
>
> On Fri, Jan 16, 2026 at 4:38 PM Antoniu Miclaus
> <antoniu.miclaus@analog.com> wrote:
>
> > This series adds optional enable GPIO support to the gpio-mux driver.
> > The enable GPIO allows the multiplexer to be disabled before changing
> > address lines and re-enabled after, preventing glitches that could
> > briefly activate unintended channels during transitions.
> >
> > This feature is useful for devices like the Analog Devices ADG2404
> > (4:1 mux) that require enable control for glitch-free operation. The
> > binding documentation now includes ADG2404 as a supported device with
> > a dedicated example.
>
> Overall the idea is sound!
>
> I don't know if "enable" is a good name for this GPIO though,
> because as I understand it the signal passes through the mux even
> if it is "disabled"?
>
> I would call it "hold" and make it active low if it holds the mux
> state when this signal is low.
>
> hold-gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
>
> this will have the intended semantic.
>
Thanks for the feedback!
Looking at the ADG2404 truth table, "enable" appears
to be semantically correct:
EN A1 A0 S1 S2 S3 S4
0 X X Off Off Off Off
1 0 0 On Off Off Off
1 0 1 Off On Off Off
1 1 0 Off Off On Off
1 1 1 Off Off Off On
When EN=0, all switches are OFF and no signal passes through
the mux - it's truly disabled. When EN=1, exactly one channel is
selected based on the address pins A1/A0.
The implementation uses this to:
- Keep all channels disconnected when idle (EN=0)
- Disable during address changes to prevent glitches
- Enable to activate the selected channel
Looking forward to your feedback.
Regards,
Antoniu
> Yours,
> Linus Walleij
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4 0/2] mux: gpio-mux: add enable GPIO support
2026-01-20 14:28 ` Miclaus, Antoniu
@ 2026-01-21 12:37 ` Linus Walleij
0 siblings, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2026-01-21 12:37 UTC (permalink / raw)
To: Miclaus, Antoniu
Cc: Peter Rosin, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Srinivas Kandagatla, Johan Hovold, David Lechner, devicetree,
linux-kernel
On Tue, Jan 20, 2026 at 3:28 PM Miclaus, Antoniu
<Antoniu.Miclaus@analog.com> wrote:
> > From: Linus Walleij <linusw@kernel.org>
> > Sent: Monday, January 19, 2026 1:19 AM
> > To: Miclaus, Antoniu <Antoniu.Miclaus@analog.com>
> > Cc: Peter Rosin <peda@axentia.se>; Rob Herring <robh@kernel.org>; Krzysztof
> > Kozlowski <krzk+dt@kernel.org>; Conor Dooley <conor+dt@kernel.org>;
> > Srinivas Kandagatla <srini@kernel.org>; Johan Hovold
> > <johan+linaro@kernel.org>; David Lechner <dlechner@baylibre.com>;
> > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org
> > Subject: Re: [PATCH v4 0/2] mux: gpio-mux: add enable GPIO support
> >
> > [External]
> >
> > Hi Antoniu,
> >
> > thanks for your patch!
> >
> > On Fri, Jan 16, 2026 at 4:38 PM Antoniu Miclaus
> > <antoniu.miclaus@analog.com> wrote:
> >
> > > This series adds optional enable GPIO support to the gpio-mux driver.
> > > The enable GPIO allows the multiplexer to be disabled before changing
> > > address lines and re-enabled after, preventing glitches that could
> > > briefly activate unintended channels during transitions.
> > >
> > > This feature is useful for devices like the Analog Devices ADG2404
> > > (4:1 mux) that require enable control for glitch-free operation. The
> > > binding documentation now includes ADG2404 as a supported device with
> > > a dedicated example.
> >
> > Overall the idea is sound!
> >
> > I don't know if "enable" is a good name for this GPIO though,
> > because as I understand it the signal passes through the mux even
> > if it is "disabled"?
> >
> > I would call it "hold" and make it active low if it holds the mux
> > state when this signal is low.
> >
> > hold-gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
> >
> > this will have the intended semantic.
> >
>
> Thanks for the feedback!
>
> Looking at the ADG2404 truth table, "enable" appears
> to be semantically correct:
>
> EN A1 A0 S1 S2 S3 S4
> 0 X X Off Off Off Off
> 1 0 0 On Off Off Off
> 1 0 1 Off On Off Off
> 1 1 0 Off Off On Off
> 1 1 1 Off Off Off On
>
> When EN=0, all switches are OFF and no signal passes through
> the mux - it's truly disabled. When EN=1, exactly one channel is
> selected based on the address pins A1/A0.
Okay.
Yeah enable-gpios is fine for this thing.
> The implementation uses this to:
> - Keep all channels disconnected when idle (EN=0)
> - Disable during address changes to prevent glitches
> - Enable to activate the selected channel
I'm a bit sceptic to how it actually works in practice.
You need to specify what the truth table says: all swiches
will be disabled when enable is off, that actually doesn't
guarantee there will be no glitches.
When you disconnect something in a mux it usually enters a
tristate (high-Z) on the output, does it not? It doesn't really
"hold" the signal that was going through.
This means if there is something connected to the outputs
this will definitely see a "glitch" as in the signal being
disabled for a short while when enable is held low.
So the output will occasionally be disabled.
I think what your patch achives is that none of the outputs
will ever be *enabled* by a glitch. But instead you introduce
a mechanism which will randomly *disable* *all* outputs
when the state is changed.
This can have side effects if e.g. one of the lines on the
output is something logic that is actively pulled down, it will
dip to zero.
But I guess that is not a problem with the intended applications,
since the signal going through is analog? That analog
signal will probably be sustained on the output if and only if
there is something like a capacitance there holding whatever
signal was before for a short while, right?
I think this needs a bit of description about how this works
in a practical use case. Also as comment in the code and/or
DT binding.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-01-21 12:37 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-16 15:26 [PATCH v4 0/2] mux: gpio-mux: add enable GPIO support Antoniu Miclaus
2026-01-16 15:26 ` [PATCH v4 1/2] dt-bindings: mux: gpio-mux: add enable-gpios support Antoniu Miclaus
2026-01-16 16:04 ` Krzysztof Kozlowski
2026-01-16 15:26 ` [PATCH v4 2/2] mux: gpio-mux: add support for enable GPIO Antoniu Miclaus
2026-01-18 23:18 ` [PATCH v4 0/2] mux: gpio-mux: add enable GPIO support Linus Walleij
2026-01-20 14:28 ` Miclaus, Antoniu
2026-01-21 12:37 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®