Re: [RFC v2 0/2] gpio: Support for shared GPIO lines on boards

From: Rob Herring
Date: Wed Oct 30 2019 - 14:49:45 EST


On Wed, Oct 30, 2019 at 9:30 AM Peter Ujfalusi <peter.ujfalusi@xxxxxx> wrote:
>
>
>
> On 30/10/2019 16.17, Mark Brown wrote:
> > On Wed, Oct 30, 2019 at 03:32:09PM +0200, Peter Ujfalusi wrote:
> >> On 30/10/2019 15.12, Rob Herring wrote:
> >
> >>> Why can't we just add a shared flag like we have for interrupts?
> >>> Effectively, we have that for resets too, it's just hardcoded in the
> >>> the drivers.
> >
> >> This would be kind of the same thing what the
> >> GPIOD_FLAGS_BIT_NONEXCLUSIVE does, which was a quick workaround for
> >> fixed-regulators afaik.
> >
> > The theory with that was that any usage of this would need the
> > higher level code using the GPIO to cooperate so they didn't step
> > on each other's toes so the GPIO code should just punt to it.
>
> But from the client driver point of view a GPIO is still GPIO and if the
> components are unrelated then it is hard to patch things together from
> the top.

You can't escape a driver being aware. If a driver depends on that
GPIO to actually be set to states the driver says, then it can't be
guaranteed to work. For example, maybe the driver assumes the device
is in reset state after toggling reset and doesn't work if not in
reset state. The driver has to be aware no matter what you do in DT.

Rob