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

From: Mika Westerberg
Date: Fri Nov 14 2014 - 04:53:52 EST


+Rafael

On Fri, Nov 14, 2014 at 10:39:07AM +0100, Linus Walleij wrote:
> On Tue, Nov 4, 2014 at 7:57 PM, Mika Westerberg
> <mika.westerberg@xxxxxxxxxxxxxxx> 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?

It should prevent the driver from probing until all the devices listed
in _DEP have drivers probed.

However, it turned out that this is not that straightforward after all
:-( For one, it looks like _DEP is used also for non-operation region
dependencies. This is not in the ACPI spec but we have seen this in real
machines out there.

Other thing I heard, is that handling all these dependencies in driver
core might be nightmare to maintain.

> 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?

Yes we can if the driver core prevents probing the driver.

> 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.

I agree.

> (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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/