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. >> But let's say that a board design will pick two components (C1 and C2) >> and use the same GPIO line to enable them. We already have the drivers >> for them and they are used in boards already. > > This is basically an attempt to make a generic implementation of > that cooperation for simple cases. Without some generic implementation we would need to patch up drivers (sometimes unrelated) for components which uses the same GPIO line on some random board. We have such a thing for tlv310aic3x (for Nokia n900). I would need one for pcm3168a and there were an attempt for max98927 also. We also have boards where one GPIO is used for backlight and panel, etc. If we would have generic way then it can be tuned for more exotic setups, but again, I believe that board designers are not doing things just to be evil. What they connect most of the times are 'sane' - Péter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki