From: Jonas Jelonek <jelonek.jonas@gmail.com>
To: Thomas Richard <thomas.richard@bootlin.com>,
Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>, Peter Rosin <peda@axentia.se>,
Geert Uytterhoeven <geert+renesas@glider.be>
Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] gpio: add gpio-line-mux driver
Date: Tue, 4 Nov 2025 15:57:15 +0100 [thread overview]
Message-ID: <59b5eac8-3380-4fb4-a13d-9e4b32b403c4@gmail.com> (raw)
In-Reply-To: <50646b88-5746-4665-8085-09e394aa291f@bootlin.com>
Hi Thomas,
On 28.10.25 10:45, Thomas Richard wrote:
> On 10/27/25 12:17 AM, Jonas Jelonek wrote:
>> +
>> + struct mutex lock;
>> +
>> + struct gpio_desc *shared_gpio;
>> + /* dynamically sized, must be last */
>> + unsigned int gpio_mux_states[];
>> +};
>> +
>> +DEFINE_GUARD(gpio_lmux, struct gpio_lmux *, mutex_lock(&_T->lock), mutex_unlock(&_T->lock))
>> +
>> +static int gpio_lmux_gpio_get(struct gpio_chip *gc, unsigned int offset)
>> +{
>> + struct gpio_lmux *glm = (struct gpio_lmux *)gpiochip_get_data(gc);
>> + int ret;
>> +
>> + if (offset > gc->ngpio)
>> + return -EINVAL;
>> +
>> + guard(gpio_lmux)(glm);
>> +
>> + ret = mux_control_select(glm->mux, glm->gpio_mux_states[offset]);
>> + if (ret < 0)
>> + return ret;
>> +
>> + ret = gpiod_get_raw_value_cansleep(glm->shared_gpio);
> Why ignoring ACTIVE_LOW status ?
I think this would be rather error-prone and doesn't make sense to me. The
consumer of this driver should decide about whether it uses ACTIVE_HIGH or
ACTIVE_LOW for each one of the virtual GPIOs separately. This should then be
applied as if this was a real GPIO. Following the ACTIVE_* that is given in
the 'shared-gpio' property then would interfere again.
> [...]
>
Thanks for all the suggested simplifications, I'll incorporate them.
> The advantage of the forwarder is that it handles if the shared GPIO is
> sleeping or not.
> But I think the forwarder shall have ngpio, not 1. You will have to add
> ngpio times the same GPIO desc. Also unsupported operations shall be unset.
> So I don't really know if it shall be used in this case.
I agree. As Peter mentioned, I need to use "can_sleep" anyway because of the mux.
So there's not really an argument left to use the forwarder.
> Best Regards,
>
> Thomas
Best regards,
Jonas
prev parent reply other threads:[~2025-11-04 14:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-26 23:17 [PATCH v2 0/2] add gpio-line-mux Jonas Jelonek
2025-10-26 23:17 ` [PATCH v2 1/2] dt-bindings: gpio: add gpio-line-mux controller Jonas Jelonek
2025-10-27 11:39 ` Rob Herring (Arm)
2025-10-27 11:47 ` Jonas Jelonek
2025-10-27 13:32 ` Rob Herring
2025-10-26 23:17 ` [PATCH v2 2/2] gpio: add gpio-line-mux driver Jonas Jelonek
2025-10-27 7:51 ` Peter Rosin
2025-10-27 8:26 ` Jonas Jelonek
2025-10-28 9:45 ` Thomas Richard
2025-10-28 10:09 ` Peter Rosin
2025-10-28 10:22 ` Thomas Richard
2025-11-04 14:57 ` Jonas Jelonek [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=59b5eac8-3380-4fb4-a13d-9e4b32b403c4@gmail.com \
--to=jelonek.jonas@gmail.com \
--cc=brgl@bgdev.pl \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=geert+renesas@glider.be \
--cc=krzk+dt@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peda@axentia.se \
--cc=robh@kernel.org \
--cc=thomas.richard@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).