public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] mux: adg2404: add support for ADG2404 multiplexer
@ 2026-01-05 12:00 Antoniu Miclaus
  2026-01-05 12:00 ` [PATCH v2 1/2] dt-bindings: mux: adg2404: add support Antoniu Miclaus
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Antoniu Miclaus @ 2026-01-05 12:00 UTC (permalink / raw)
  To: Peter Rosin, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Antoniu Miclaus, Greg Kroah-Hartman, Arnd Bergmann, devicetree,
	linux-kernel

This series adds support for the Analog Devices ADG2404, a 4:1 analog
multiplexer with low 0.62Ω on-resistance.

The ADG2404 features:
- Low RON of 0.62Ω
- Flat RON across signal range (0.003Ω)
- Dual supply operation (±15V, ±5V)
- Single supply operation (+12V)
- Asymmetric supply support (+5V/-12V)
- 1.8V/3.3V/5V logic compatibility
- Break-before-make switching

Applications include automatic test equipment, data acquisition,
instrumentation, audio/video switching, and communication systems.

Antoniu Miclaus (2):
  dt-bindings: mux: adg2404: add support
  mux: adg2404: add driver support

 .../devicetree/bindings/mux/adi,adg2404.yaml  |  66 +++++++++
 drivers/mux/Kconfig                           |  12 ++
 drivers/mux/Makefile                          |   2 +
 drivers/mux/adg2404.c                         | 130 ++++++++++++++++++
 4 files changed, 210 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mux/adi,adg2404.yaml
 create mode 100644 drivers/mux/adg2404.c

-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/2] dt-bindings: mux: adg2404: add support
  2026-01-05 12:00 [PATCH v2 0/2] mux: adg2404: add support for ADG2404 multiplexer Antoniu Miclaus
@ 2026-01-05 12:00 ` Antoniu Miclaus
  2026-01-05 12:00 ` [PATCH v2 2/2] mux: adg2404: add driver support Antoniu Miclaus
  2026-01-06 19:05 ` [PATCH v2 0/2] mux: adg2404: add support for ADG2404 multiplexer Rob Herring
  2 siblings, 0 replies; 5+ messages in thread
From: Antoniu Miclaus @ 2026-01-05 12:00 UTC (permalink / raw)
  To: Peter Rosin, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Antoniu Miclaus, Greg Kroah-Hartman, Arnd Bergmann, devicetree,
	linux-kernel

Add dt bindings for adg2404.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
changes in v2:
 * rename addr-gpios to mux-gpios
 * rename en-gpios to enable-gpios
 * use items format for mux-gpios description
 * simplify property descriptions
---
 .../devicetree/bindings/mux/adi,adg2404.yaml  | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mux/adi,adg2404.yaml

diff --git a/Documentation/devicetree/bindings/mux/adi,adg2404.yaml b/Documentation/devicetree/bindings/mux/adi,adg2404.yaml
new file mode 100644
index 000000000000..d5a7c205d579
--- /dev/null
+++ b/Documentation/devicetree/bindings/mux/adi,adg2404.yaml
@@ -0,0 +1,66 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mux/adi,adg2404.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices ADG2404 4:1 multiplexer
+
+maintainers:
+  - Antoniu Miclaus <antoniu.miclaus@analog.com>
+
+description: |
+  Bindings for Analog Devices ADG2404 4:1 single-ended analog multiplexer
+
+  The multiplexer state corresponds to the selected input channel:
+  * 0: Channel S1 selected
+  * 1: Channel S2 selected
+  * 2: Channel S3 selected
+  * 3: Channel S4 selected
+
+allOf:
+  - $ref: mux-controller.yaml#
+
+properties:
+  compatible:
+    const: adi,adg2404
+
+  mux-gpios:
+    description:
+      GPIO pins connected to the address inputs.
+    items:
+      - description: A0 address pin
+      - description: A1 address pin
+
+  enable-gpios:
+    description:
+      GPIO connected to the EN (enable) pin. Active high.
+    maxItems: 1
+
+  '#mux-control-cells':
+    const: 0
+
+required:
+  - compatible
+  - mux-gpios
+  - enable-gpios
+  - '#mux-control-cells'
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    mux-controller {
+        compatible = "adi,adg2404";
+        #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>; /* Select channel S1 when idle */
+    };
+
+...
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] mux: adg2404: add driver support
  2026-01-05 12:00 [PATCH v2 0/2] mux: adg2404: add support for ADG2404 multiplexer Antoniu Miclaus
  2026-01-05 12:00 ` [PATCH v2 1/2] dt-bindings: mux: adg2404: add support Antoniu Miclaus
@ 2026-01-05 12:00 ` Antoniu Miclaus
  2026-01-06 19:05 ` [PATCH v2 0/2] mux: adg2404: add support for ADG2404 multiplexer Rob Herring
  2 siblings, 0 replies; 5+ messages in thread
From: Antoniu Miclaus @ 2026-01-05 12:00 UTC (permalink / raw)
  To: Peter Rosin, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Antoniu Miclaus, Greg Kroah-Hartman, Arnd Bergmann, devicetree,
	linux-kernel

Add support for ADG2404, a 4:1 analog multiplexer.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
changes in v2:
 * rename addr_gpios to mux_gpios
 * rename en_gpio to enable_gpio
 * update GPIO names: "addr" to "mux", "en" to "enable"
 * remove dev_info message
---
 drivers/mux/Kconfig   |  12 ++++
 drivers/mux/Makefile  |   2 +
 drivers/mux/adg2404.c | 130 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 144 insertions(+)
 create mode 100644 drivers/mux/adg2404.c

diff --git a/drivers/mux/Kconfig b/drivers/mux/Kconfig
index c68132e38138..5aba66e6e210 100644
--- a/drivers/mux/Kconfig
+++ b/drivers/mux/Kconfig
@@ -9,6 +9,18 @@ config MULTIPLEXER
 menu "Multiplexer drivers"
 	depends on MULTIPLEXER
 
+config MUX_ADG2404
+	tristate "Analog Devices ADG2404 Multiplexer"
+	depends on GPIOLIB || COMPILE_TEST
+	help
+	  ADG2404 4:1 single-ended analog multiplexer controlled by GPIO.
+
+	  The multiplexer state is controlled by 3 GPIO pins: A0, A1
+	  (address selection) and EN (enable).
+
+	  To compile the driver as a module, choose M here: the module will
+	  be called mux-adg2404.
+
 config MUX_ADG792A
 	tristate "Analog Devices ADG792A/ADG792G Multiplexers"
 	depends on I2C
diff --git a/drivers/mux/Makefile b/drivers/mux/Makefile
index 6e9fa47daf56..d3df403f8978 100644
--- a/drivers/mux/Makefile
+++ b/drivers/mux/Makefile
@@ -4,12 +4,14 @@
 #
 
 mux-core-objs			:= core.o
+mux-adg2404-objs		:= adg2404.o
 mux-adg792a-objs		:= adg792a.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_ADG2404)	+= mux-adg2404.o
 obj-$(CONFIG_MUX_ADG792A)	+= mux-adg792a.o
 obj-$(CONFIG_MUX_ADGS1408)	+= mux-adgs1408.o
 obj-$(CONFIG_MUX_GPIO)		+= mux-gpio.o
diff --git a/drivers/mux/adg2404.c b/drivers/mux/adg2404.c
new file mode 100644
index 000000000000..11c3b81ff481
--- /dev/null
+++ b/drivers/mux/adg2404.c
@@ -0,0 +1,130 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Analog Devices ADG2404 4:1 multiplexer driver
+ *
+ * Copyright 2025 Analog Devices Inc.
+ *
+ * Author: Antoniu Miclaus <antoniu.miclaus@analog.com>
+ */
+
+#include <linux/bitmap.h>
+#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 ADG2404_CHANNELS	4
+
+struct adg2404_mux {
+	struct gpio_descs *mux_gpios;
+	struct gpio_desc *enable_gpio;
+};
+
+static int adg2404_set(struct mux_control *mux, int state)
+{
+	struct adg2404_mux *adg2404 = mux_chip_priv(mux->chip);
+	DECLARE_BITMAP(values, BITS_PER_TYPE(state));
+	u32 value = state;
+
+	if (state == MUX_IDLE_DISCONNECT) {
+		gpiod_set_value_cansleep(adg2404->enable_gpio, 0);
+		return 0;
+	}
+
+	/*
+	 * 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(adg2404->enable_gpio, 0);
+
+	bitmap_from_arr32(values, &value, BITS_PER_TYPE(value));
+	gpiod_set_array_value_cansleep(adg2404->mux_gpios->ndescs,
+				       adg2404->mux_gpios->desc,
+				       adg2404->mux_gpios->info,
+				       values);
+
+	/* Enable the mux with the new address */
+	gpiod_set_value_cansleep(adg2404->enable_gpio, 1);
+
+	return 0;
+}
+
+static const struct mux_control_ops adg2404_ops = {
+	.set = adg2404_set,
+};
+
+static int adg2404_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct mux_chip *mux_chip;
+	struct adg2404_mux *adg2404;
+	s32 idle_state;
+	int ret;
+
+	mux_chip = devm_mux_chip_alloc(dev, 1, sizeof(*adg2404));
+	if (IS_ERR(mux_chip))
+		return PTR_ERR(mux_chip);
+
+	adg2404 = mux_chip_priv(mux_chip);
+	mux_chip->ops = &adg2404_ops;
+
+	adg2404->mux_gpios = devm_gpiod_get_array(dev, "mux", GPIOD_OUT_LOW);
+	if (IS_ERR(adg2404->mux_gpios))
+		return dev_err_probe(dev, PTR_ERR(adg2404->mux_gpios),
+				     "failed to get mux gpios\n");
+
+	if (adg2404->mux_gpios->ndescs != 2)
+		return dev_err_probe(dev, -EINVAL,
+				     "mux-gpios must have exactly 2 GPIOs\n");
+
+	adg2404->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
+	if (IS_ERR(adg2404->enable_gpio))
+		return dev_err_probe(dev, PTR_ERR(adg2404->enable_gpio),
+				     "failed to get enable gpio\n");
+
+	mux_chip->mux->states = ADG2404_CHANNELS;
+
+	ret = device_property_read_u32(dev, "idle-state", (u32 *)&idle_state);
+	if (ret < 0)
+		idle_state = MUX_IDLE_AS_IS;
+
+	switch (idle_state) {
+	case MUX_IDLE_DISCONNECT:
+	case MUX_IDLE_AS_IS:
+	case 0 ... ADG2404_CHANNELS - 1:
+		mux_chip->mux->idle_state = idle_state;
+		break;
+	default:
+		dev_err(dev, "invalid idle-state %d\n", idle_state);
+		return -EINVAL;
+	}
+
+	ret = devm_mux_chip_register(dev, mux_chip);
+	if (ret < 0)
+		return ret;
+
+	return 0;
+}
+
+static const struct of_device_id adg2404_dt_ids[] = {
+	{ .compatible = "adi,adg2404", },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, adg2404_dt_ids);
+
+static struct platform_driver adg2404_driver = {
+	.driver = {
+		.name = "adg2404",
+		.of_match_table	= adg2404_dt_ids,
+	},
+	.probe = adg2404_probe,
+};
+module_platform_driver(adg2404_driver);
+
+MODULE_DESCRIPTION("Analog Devices ADG2404 multiplexer driver");
+MODULE_AUTHOR("Antoniu Miclaus <antoniu.miclaus@analog.com>");
+MODULE_LICENSE("GPL");
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/2] mux: adg2404: add support for ADG2404 multiplexer
  2026-01-05 12:00 [PATCH v2 0/2] mux: adg2404: add support for ADG2404 multiplexer Antoniu Miclaus
  2026-01-05 12:00 ` [PATCH v2 1/2] dt-bindings: mux: adg2404: add support Antoniu Miclaus
  2026-01-05 12:00 ` [PATCH v2 2/2] mux: adg2404: add driver support Antoniu Miclaus
@ 2026-01-06 19:05 ` Rob Herring
  2026-01-07  8:33   ` Peter Rosin
  2 siblings, 1 reply; 5+ messages in thread
From: Rob Herring @ 2026-01-06 19:05 UTC (permalink / raw)
  To: Antoniu Miclaus
  Cc: Peter Rosin, Krzysztof Kozlowski, Conor Dooley,
	Greg Kroah-Hartman, Arnd Bergmann, devicetree, linux-kernel

On Mon, Jan 05, 2026 at 02:00:29PM +0200, Antoniu Miclaus wrote:
> This series adds support for the Analog Devices ADG2404, a 4:1 analog
> multiplexer with low 0.62Ω on-resistance.
> 
> The ADG2404 features:
> - Low RON of 0.62Ω
> - Flat RON across signal range (0.003Ω)
> - Dual supply operation (±15V, ±5V)
> - Single supply operation (+12V)
> - Asymmetric supply support (+5V/-12V)
> - 1.8V/3.3V/5V logic compatibility
> - Break-before-make switching
> 
> Applications include automatic test equipment, data acquisition,
> instrumentation, audio/video switching, and communication systems.

Isn't this just a gpio-mux with the addition of an enable GPIO line? 
Wouldn't adding enable-gpios and support for it in the gpio-mux driver 
work?

Rob

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/2] mux: adg2404: add support for ADG2404 multiplexer
  2026-01-06 19:05 ` [PATCH v2 0/2] mux: adg2404: add support for ADG2404 multiplexer Rob Herring
@ 2026-01-07  8:33   ` Peter Rosin
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Rosin @ 2026-01-07  8:33 UTC (permalink / raw)
  To: Rob Herring, Antoniu Miclaus
  Cc: Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman,
	Arnd Bergmann, devicetree, linux-kernel

Hi!

2026-01-06 at 20:05, Rob Herring wrote:
> On Mon, Jan 05, 2026 at 02:00:29PM +0200, Antoniu Miclaus wrote:
>> This series adds support for the Analog Devices ADG2404, a 4:1 analog
>> multiplexer with low 0.62Ω on-resistance.
>>
>> The ADG2404 features:
>> - Low RON of 0.62Ω
>> - Flat RON across signal range (0.003Ω)
>> - Dual supply operation (±15V, ±5V)
>> - Single supply operation (+12V)
>> - Asymmetric supply support (+5V/-12V)
>> - 1.8V/3.3V/5V logic compatibility
>> - Break-before-make switching
>>
>> Applications include automatic test equipment, data acquisition,
>> instrumentation, audio/video switching, and communication systems.
> 
> Isn't this just a gpio-mux with the addition of an enable GPIO line? 
> Wouldn't adding enable-gpios and support for it in the gpio-mux driver 
> work?

Yes, I agree. Please extend gpio-mux instead of duplicating it.

Cheers,
Peter

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-01-07  8:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-05 12:00 [PATCH v2 0/2] mux: adg2404: add support for ADG2404 multiplexer Antoniu Miclaus
2026-01-05 12:00 ` [PATCH v2 1/2] dt-bindings: mux: adg2404: add support Antoniu Miclaus
2026-01-05 12:00 ` [PATCH v2 2/2] mux: adg2404: add driver support Antoniu Miclaus
2026-01-06 19:05 ` [PATCH v2 0/2] mux: adg2404: add support for ADG2404 multiplexer Rob Herring
2026-01-07  8:33   ` Peter Rosin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox