Re: [PATCH] gpio/regulator: Allow nonexclusive GPIO access

From: Mark Brown
Date: Thu Oct 11 2018 - 10:43:37 EST


On Thu, Oct 11, 2018 at 04:35:31PM +0200, Linus Walleij wrote:

> + /*
> + * Some fixed regulators share the enable line between two
> + * regulators which makes it necessary to get a handle on the
> + * same descriptor for two different consumers. This will get
> + * the GPIO descriptor, but only the first call will initialize
> + * it so any flags such as inversion or open drain will only
> + * be set up by the first caller and assumed identical on the
> + * next caller.
> + *
> + * FIXME: find a better way to deal with this.
> + */
> + gflags |= GPIOD_FLAGS_BIT_NONEXCLUSIVE;
> +

It's not just fixed regulators that do this, often regulators with
register control can do this as well. Since power up is often a
performance critical path but regulators tend to be controlled via slow
buses like I2C it's common to have register control combined with a GPIO
enable line so you don't need to use the bus to do the enables. That
should just be a case of adding this flag to all the drivers that have
already been converted to gpiod (including the core code that's in
regulator_ena_gpio_request() which I thought was coping with this
already) unless I'm missing something?

Attachment: signature.asc
Description: PGP signature