The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH RESEND] mux: gpio-mux: add support for 4:1 2-channels mux
@ 2026-04-30 14:11 Andrea Tomassetti
  2026-05-05  8:23 ` Linus Walleij
  0 siblings, 1 reply; 32+ messages in thread
From: Andrea Tomassetti @ 2026-04-30 14:11 UTC (permalink / raw)
  To: Peter Rosin
  Cc: linusw, Andrea Tomassetti, Johan Hovold, Krzysztof Kozlowski,
	Srinivas Kandagatla, linux-kernel

Some gpio multiplexers, like TMUX1209, offer differential 4:1
or dual 4:1 single-ended channels. Similarly to what already done by
the adg792a driver, the gpio-mux driver has to take into account
the #mux-control-cells property and allocate as many controllers
as advised by it.

So, in the DTS you can now define:

	tmux1209: mux-controller {
		compatible = "gpio-mux";
		#mux-control-cells = <1>;

		mux-gpios = <&gpio_expander 01 GPIO_ACTIVE_HIGH>,
					<&gpio_expander 02 GPIO_ACTIVE_HIGH>;
	};

	adcmux30: adcmux30 {
		compatible = "io-channel-mux";
		io-channels = <&adc1 4>;
		io-channel-names = "parent";
		#io-channel-cells = <1>;
		mux-controls = <&tmux1209 0>;

		channels = "S1A", "S2A", "S3A", "S4A";
	};

	adcmux31: adcmux31 {
		compatible = "io-channel-mux";
		io-channels = <&adc1 5>;
		io-channel-names = "parent";
		#io-channel-cells = <1>;
		mux-controls = <&tmux1209 1>;

		channels = "S1B", "S2B", "S3B", "S4B";
	};

Signed-off-by: Andrea Tomassetti <andrea.tomassetti@sipearl.com>
---
 drivers/mux/gpio.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/mux/gpio.c b/drivers/mux/gpio.c
index 4cc3202c58f3..01ce3f878b9e 100644
--- a/drivers/mux/gpio.c
+++ b/drivers/mux/gpio.c
@@ -52,12 +52,23 @@ static int mux_gpio_probe(struct platform_device *pdev)
 	int pins;
 	s32 idle_state;
 	int ret;
+	u32 cells;
+	int i;

 	pins = gpiod_count(dev, "mux");
 	if (pins < 0)
 		return pins;

-	mux_chip = devm_mux_chip_alloc(dev, 1, sizeof(*mux_gpio));
+	ret = device_property_read_u32(dev, "#mux-control-cells", &cells);
+	if (ret < 0)
+		cells = 0;
+
+	if (cells >= 2) {
+		dev_err(dev, "invalid control-cells %u\n", cells);
+		return -EINVAL;
+	}
+
+	mux_chip = devm_mux_chip_alloc(dev, cells + 1, sizeof(*mux_gpio));
 	if (IS_ERR(mux_chip))
 		return PTR_ERR(mux_chip);

@@ -69,7 +80,9 @@ static int mux_gpio_probe(struct platform_device *pdev)
 		return dev_err_probe(dev, PTR_ERR(mux_gpio->gpios),
 				     "failed to get gpios\n");
 	WARN_ON(pins != mux_gpio->gpios->ndescs);
-	mux_chip->mux->states = BIT(pins);
+
+	for (i = 0; i < mux_chip->controllers; ++i)
+		mux_chip->mux[i].states = BIT(pins);

 	ret = device_property_read_u32(dev, "idle-state", (u32 *)&idle_state);
 	if (ret >= 0 && idle_state != MUX_IDLE_AS_IS) {

base-commit: 80234b5ab240f52fa45d201e899e207b9265ef91
--
2.51.2


^ permalink raw reply related	[flat|nested] 32+ messages in thread
* Re: [PATCH v2] mux: gpio-mux: add support for 4:1 2-channels mux
@ 2026-06-25  9:32 Lad, Prabhakar
  2026-06-25  9:43 ` Krzysztof Kozlowski
  2026-06-29 19:24 ` Linus Walleij
  0 siblings, 2 replies; 32+ messages in thread
From: Lad, Prabhakar @ 2026-06-25  9:32 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Krzysztof Kozlowski, andrea.tomassetti, Geert Uytterhoeven,
	Greg Kroah-Hartman, johan+linaro, Krzysztof Kozlowski, LKML,
	mircea.caprioru, Philipp Zabel, peda, srini, Tommaso Merciai,
	ulf.hansson, Fabrizio Castro, Chris Paterson

On Thu, Jun 25, 2026 at 10:15 AM Linus Walleij <linus.walleij@linaro.org> wrote:
> Mircea from Analog Devices contributed two important drivers for
> drivers/mux in committ
> 8b9ce6954c05e3e4115f54444c7eaf2aa2dd5e65.
>
> Perhaps Analog Devices are interested in picking up and
> maintaining drivers/mux?
>
> Mircea what do you say?
>
> Can you bring it up with your organization?

Hi Linus, Krzysztof, All,

While Linus mentioned Analog Devices, we at Renesas would be glad to
step up here.

I have discussed this internally, and Renesas is willing to dedicate
the necessary engineering time to take over the active maintainership
of drivers/mux. I am happy to act as the maintainer to review incoming
patches, handle testing, and keep the subsystem moving forward so it
doesn't stall out. If the community is on board with this, I can send
a patch updating the MAINTAINERS file to make it official.

Cheers,
Prabhakar

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

end of thread, other threads:[~2026-07-03 13:45 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-30 14:11 [PATCH RESEND] mux: gpio-mux: add support for 4:1 2-channels mux Andrea Tomassetti
2026-05-05  8:23 ` Linus Walleij
2026-05-05 15:20   ` Andrea Tomassetti
2026-05-06  7:58     ` Linus Walleij
2026-05-06 12:33       ` [PATCH v2] " Andrea Tomassetti
2026-06-03 11:43         ` Andrea Tomassetti
2026-06-03 14:00           ` Krzysztof Kozlowski
2026-06-08 22:54           ` Linus Walleij
2026-06-17 13:09             ` Tommaso Merciai
2026-06-18 13:04               ` Linus Walleij
2026-06-18 13:27                 ` Tommaso Merciai
2026-06-19  3:51                   ` Krzysztof Kozlowski
2026-06-23 16:44                     ` Tommaso Merciai
2026-06-24  8:59                       ` Geert Uytterhoeven
2026-06-24  9:59                         ` Krzysztof Kozlowski
2026-06-24  9:55                       ` Krzysztof Kozlowski
2026-06-24 22:03                         ` Linus Walleij
2026-06-24 22:11                           ` Linus Walleij
2026-06-25  9:19                             ` Nuno Sá
2026-06-29 19:27                               ` Linus Walleij
2026-07-03  7:32                                 ` Michael Hennerich
2026-07-03 10:02                                   ` Miclaus, Antoniu
2026-07-03 13:19                                     ` Alvin Šipraga
2026-07-03 13:45                                       ` Lad, Prabhakar
2026-06-19 17:23         ` Srinivas Kandagatla
2026-06-30 15:08           ` Andrea Tomassetti
2026-07-03  8:10             ` Srinivas Kandagatla
  -- strict thread matches above, loose matches on Subject: below --
2026-06-25  9:32 Lad, Prabhakar
2026-06-25  9:43 ` Krzysztof Kozlowski
2026-06-25  9:49   ` Greg Kroah-Hartman
2026-06-25  9:59   ` Lad, Prabhakar
2026-06-29 19:24 ` Linus Walleij

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