Re: [PATCH v2] mux: gpio-mux: add support for 4:1 2-channels mux

From: Andrea Tomassetti

Date: Wed Jul 22 2026 - 08:35:08 EST


Hi Peter,
thank you for finding the time to address this topic and for the explanation.

This patch can be dropped.

Cheers,
Andrea

On 7/8/26 16:08, Peter Rosin wrote:
> On 2026-05-06 14:33, Andrea Tomassetti wrote:
>> Some gpio multiplexers, like TMUX1209, offer differential 4:1
>> or dual 4:1 single-ended channels. No binding changes are needed
>> because the DT binding already supports #mux-control-cells
>> with values 0 and 1. So, similarly to what was 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.
>>
>> As an example, 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>;
>> };
>>
>> And use it like this:
>>
>> 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@xxxxxxxxxxx>
>> Reviewed-by: Linus Walleij <linusw@xxxxxxxxxx>
>
> Hi!
>
> Sorry for the extremely late reply.
>
> This patch is not needed and makes no sense at all. You should be
> able to describe the hardware like below instead. I.e., no need for
> an extra controller. The mux subsystem handles multiple clients to
> the same mux controller as mux controllers are always shared.
>
> tmux1209: mux-controller {
> compatible = "gpio-mux";
> #mux-control-cells = <0>;
>
> 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>;
>
> 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>;
>
> channels = "S1B", "S2B", "S3B", "S4B";
> };
>
> An extra controller would have been needed if it was different
> gpios for mux A and B. But it's not. You cannot change mux A
> without affecting mux B, so the mux controller absolutely must be
> shared between A and B.
>
> I hope that helps.
>
> Cheers,
> Peter
>
>