Re: GPIO bindings guidelines (Was: Re: [PATCH v5 10/12] gpio: Support for unified device properties interface)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 22, 2014 at 10:33:32AM +0200, Arnd Bergmann wrote:
> On Wednesday 22 October 2014 11:10:44 Mika Westerberg wrote:
> > 
> > It expects that GPIOs returned from _CRS are in specific order. Since we
> > can't change these existing ACPI tables, we must support them somehow.
> > 
> > This patch series handles it so that:
> > 
> >   1) If we can't find given property (e.g "reset-gpios" or
> >      "shutdown-gpios") the index above will refer directly to the GPIO
> >      resource returned from _CRS.
> > 
> >   2) If the property is found we ignore index and take it from the
> >      property instead.
> > 
> > This has the drawback that we cannot support this:
> > 
> >         Package () { "reset-gpios", Package () { ^GPIO, 0, 0, 0, ^GPIO, 1, 0, 0}}
> >                                                                  ^^^^^^^^^^^^^^
> > So the second entry in the above is not accessible using
> > gpiod_get_index() and the reason is that we want to support the existing
> > and new ACPI tables where _DSD is not being used.
> 
> So this is not using the DT binding but does thing slightly differently then.
> In this case (supporting two incompatible bindings for DT and ACPI), I think
> the only sensible driver implementation would be to know what we are asking
> for and use different devm_gpiod_get_index statements based on the firmware
> interface.

Yes something like that is probably needed.

Alternatively (I didn't try if this works) we could do it so that
when we see:

	gpio = devm_gpiod_get_index(&pdev->dev, "shutdown", 1);

we check first for the property ("shutdown-gpios"), and check if it has
more than one entry in the value, like:

	Package () { "reset-gpios", Package () { ^GPIO, 0, 0, 0, ^GPIO, 1, 0, 0}}

and in that case return the second entry. If we find this instead:

	Package () { "reset-gpios", Package () { ^GPIO, 0, 0, 0 }}

we just ignore the index.

Last if there is no _DSD the index refers directly to the GPIO resource
in _CRS.

This would support both _DSD and non-_DSD at the same time but it makes
the implementation more complex.
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux