Re: [PATCH v2 0/4] gpio: deprecate and track the removal of GPIO workarounds for regulators

From: Bartosz Golaszewski
Date: Mon Apr 07 2025 - 09:17:05 EST


On Wed, Apr 2, 2025 at 4:08 PM Mark Brown <broonie@xxxxxxxxxx> wrote:
>
> > I believe pwrseq could actually be used to hide the enable counting
> > for GPIOs behind a faux GPIO chip and the consumer would never see a
> > pwrseq handle - they would instead use GPIO consumer interfaces and
> > we'd have to agree on what logic would we put behind gpiod_set_value()
> > (should it effectively work as gpiod_enable() meaning: value is 1 as
> > long as at least one user sets it to 1?) and
> > gpiod_direction_input()/output() (same thing: highest priority is
> > gpiod_direction_output(HIGH) and as long as at least one user sets it
> > as such, we keep it).
>
> Like I say that doesn't do the right thing since other users need to be
> able to see when something changes on the GPIO. If that just happens on
> normal gpiolib then that complicates usage for the default case since
> they now have to worry about things not actually happening when
> requested which doesn't seem ideal.

If I understand correctly, regulator_ena_gpio_ctrl()[1] changes the
GPIO value (even if it's shared) and then notifies regulator consumers
about a DISABLE event. Now if we'd be implicitly sharing the GPIO with
an enable-counter, we could possibly emit an event that's a
false-positive?

In any case: I'll allow myself to apply this series, as the
description does not define a specific approach to take and instead
just allows us to track the rework.

Bartosz

[1] https://elixir.bootlin.com/linux/v6.13/source/drivers/regulator/core.c#L2607