[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b9f25589-347f-1c54-f45e-b4617452191f@axentia.se>
Date: Wed, 7 Jan 2026 09:24:34 +0100
From: Peter Rosin <peda@...ntia.se>
To: Antoniu Miclaus <antoniu.miclaus@...log.com>,
Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Arnd Bergmann <arnd@...db.de>, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] mux: adg1736: add driver support
Hi!
2026-01-05 at 12:57, Antoniu Miclaus wrote:
> Add support for ADG1736, a dual SPDT (single-pole, double-throw)
> switch. The device features two independent 2:1 analog multiplexers,
> each controlled by a GPIO pin. Each switch connects its drain
> terminal (D) to one of two source terminals (SA or SB) based on
> the control input state.
>
> The driver implements two independent mux controllers with a shared
> enable GPIO that can disable all switches when set low. Each mux
> controller supports idle-state configuration for disconnecting
> when not in use.
>
> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@...log.com>
> ---
> changes in v2:
> * rename ctrl_gpios to mux_gpios
> * rename en_gpio to enable_gpio
> * update GPIO names: "ctrl" to "mux", "en" to "enable"
> * remove dev_info message
> ---
> drivers/mux/Kconfig | 12 ++++
> drivers/mux/Makefile | 2 +
> drivers/mux/adg1736.c | 140 ++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 154 insertions(+)
> create mode 100644 drivers/mux/adg1736.c
>
> diff --git a/drivers/mux/Kconfig b/drivers/mux/Kconfig
> index c68132e38138..bdf16e0983cc 100644
> --- a/drivers/mux/Kconfig
> +++ b/drivers/mux/Kconfig
> @@ -21,6 +21,18 @@ config MUX_ADG792A
> To compile the driver as a module, choose M here: the module will
> be called mux-adg792a.
>
> +config MUX_ADG1736
> + tristate "Analog Devices ADG1736 Dual SPDT Switch Multiplexer"
> + depends on GPIOLIB || COMPILE_TEST
> + help
> + ADG1736 Dual SPDT (single-pole, double-throw) Switch.
> +
> + The driver supports two independent 2:1 multiplexers, each
> + controlled by a GPIO pin.
> +
> + To compile the driver as a module, choose M here: the module will
> + be called mux-adg1736.
> +
> config MUX_ADGS1408
> tristate "Analog Devices ADGS1408/ADGS1409 Multiplexers"
> depends on SPI
> diff --git a/drivers/mux/Makefile b/drivers/mux/Makefile
> index 6e9fa47daf56..f1497c319bcf 100644
> --- a/drivers/mux/Makefile
> +++ b/drivers/mux/Makefile
> @@ -5,12 +5,14 @@
>
> mux-core-objs := core.o
> mux-adg792a-objs := adg792a.o
> +mux-adg1736-objs := adg1736.o
> mux-adgs1408-objs := adgs1408.o
> mux-gpio-objs := gpio.o
> mux-mmio-objs := mmio.o
>
> obj-$(CONFIG_MULTIPLEXER) += mux-core.o
> obj-$(CONFIG_MUX_ADG792A) += mux-adg792a.o
> +obj-$(CONFIG_MUX_ADG1736) += mux-adg1736.o
> obj-$(CONFIG_MUX_ADGS1408) += mux-adgs1408.o
> obj-$(CONFIG_MUX_GPIO) += mux-gpio.o
> obj-$(CONFIG_MUX_MMIO) += mux-mmio.o
> diff --git a/drivers/mux/adg1736.c b/drivers/mux/adg1736.c
> new file mode 100644
> index 000000000000..90408d455a48
> --- /dev/null
> +++ b/drivers/mux/adg1736.c
> @@ -0,0 +1,140 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Analog Devices ADG1736 Dual SPDT Switch Multiplexer driver
> + *
> + * Copyright 2025 Analog Devices Inc.
> + *
> + * Author: Antoniu Miclaus <antoniu.miclaus@...log.com>
> + */
> +
> +#include <linux/err.h>
> +#include <linux/gpio/consumer.h>
> +#include <linux/mod_devicetable.h>
> +#include <linux/module.h>
> +#include <linux/mux/driver.h>
> +#include <linux/platform_device.h>
> +#include <linux/property.h>
> +
> +#define ADG1736_MUX_CONTROLLERS 2
> +#define ADG1736_MUX_STATES 2
> +
> +struct adg1736_mux {
> + struct gpio_desc *mux_gpios[ADG1736_MUX_CONTROLLERS];
> + struct gpio_desc *enable_gpio;
> +};
> +
> +static int adg1736_set(struct mux_control *mux, int state)
> +{
> + struct adg1736_mux *adg1736 = mux_chip_priv(mux->chip);
> + unsigned int controller = mux_control_get_index(mux);
> +
> + if (controller >= ADG1736_MUX_CONTROLLERS)
> + return -EINVAL;
> +
> + if (state == MUX_IDLE_DISCONNECT) {
> + /* When idle disconnect is requested, disable the EN pin */
> + if (controller == 0)
> + gpiod_set_value_cansleep(adg1736->enable_gpio, 0);
Why is this ok? The way I read it, if the "A" mux has been configured to
idle on disconnect, then at all times the "A" mux is not set, the "B" mux
will also be disconnected.
That's hardly "independent"...
I see no trivial way to fit the use of the "EN" pin into the framework.
Since the "EN" pin is difficult to use, this device is perhaps better
modelled with two independednt instances of the gpio mux?
Cheers,
Peter
> + return 0;
> + }
Powered by blists - more mailing lists