Thread (25 messages) 25 messages, 7 authors, 2019-11-18

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

From: Rob Herring <robh+dt@kernel.org>
Date: 2019-10-30 13:13:08
Also in: linux-gpio, lkml

On Wed, Oct 30, 2019 at 7:03 AM Peter Ujfalusi [off-list ref] wrote:
Hi,

The shared GPIO line for external components tends to be a common issue and
there is no 'clean' way of handling it.

I'm aware of the GPIOD_FLAGS_BIT_NONEXCLUSIVE flag, which must be provided when
a driver tries to request a GPIO which is already in use.
However the driver must know that the component is going to be used in such a
way, which can be said to any external components with GPIO line, so in theory
all drivers must set this flag when requesting the GPIO...

But with the GPIOD_FLAGS_BIT_NONEXCLUSIVE all clients have full control of the
GPIO line. For example any device using the same GPIO as reset/enable line can
reset/enable other devices, which is not something the other device might like
or can handle.
For example a device needs to be configured after it is enabled, but some other
driver would reset it while handling the same GPIO -> the device is not
operational anymmore as it lost it's configuration.

With the gpio-shared gpiochip we can overcome this by giving the gpio-shared
the role of making sure that the GPIO line only changes state when it will not
disturb any of the clients sharing the same GPIO line.
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.

Rob
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help