Re: [PATCH] pinctrl: baytrail: show output gpio state correctly on Intel Baytrail

Linus Walleij
2014-11-14T09:39:12Z

On Tue, Nov 4, 2014 at 7:57 PM, Mika Westerberg
<mika.westerberg@linux.intel.com> wrote:
> On Tue, Nov 04, 2014 at 10:05:26AM -0800, David Cohen wrote:

>> It looks we have an implicit dependency to GPIO driver in Bay Trail, and
>> having this window until load the module is not acceptable to fulfill
>> this implicit dependency.
>
> It is not implicit at all.
>
> The user of the GPIO in ACPI DSDT table says something like:
>
> Name (_DEP, Package () { \_SB.GPO2 })
>
> or similar. That is *explicit* dependency. Here \_SB.GPO2 is one of the
> GPIO banks.

That's very nice for ACPI. But what do you expect the Linux kernel to
do with that?

Basically that is just like getting an -EPROBE_DEFER from the
gpiochip when the gpiod_get() call is issued, and you have to wait
because the gpiochip is not probed yet. We can solve that at runtime
right?

I had a discussion with Greg the other day that we have no way of
expressing inside the kernel that a resource such as a GPIO, a pin,
a clk or a regulator is used by some module. It's just a synchronous
gpiod_get() or whatever call, then there is a warning if you remove
a gpiochip with gpios still in use.

What is needed to make use of such a dependency mechanism is
a way to graph the dependencies between kernel drivers and
the resources (gpios, clocks, regulators...) they provide to other
drivers, so this information can be used when probing, removing,
powering up/down the cluster.

That problem needs to be solved in the device core, until then there
is not way to actually use that ACPI _DEP property for what I can
tell.

(On a side note: whoever came up with the idea that ACPI props
be 4 characters wide and start with an underscore and this
backslash obfuscation needs to... think differently.)

Yours,
Linus Walleij