[lkml]   [2014]   [Oct]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: GPIO bindings guidelines (Was: Re: [PATCH v5 10/12] gpio: Support for unified device properties interface)
On Tue, Oct 21, 2014 at 09:54:45AM +0200, Arnd Bergmann wrote:
> On Tuesday 21 October 2014 14:14:02 Alexandre Courbot wrote:
> > >
> > > We have enforced naming things for the dmaengine binding, which has
> > > just led to everyone calling things "rx" and "tx". My fear is that
> > > if we start to enforce giving a name, we'd end up with lots of
> > > drivers that use a "gpio-gpios" property or something silly.
> >
> > Checking the bindings is also part of the review process. Things
> > like "gpio-gpios" should simply not be accepted to begin with.
> >
> > This sounds like a good chance to finally land some guidelines
> > regarding GPIO bindings. Let's summarize the situation:
> > - GPIO bindings can be defined using both DT and ACPI (both interfaces
> > nicely abstracted by the interface introduced by this series)
> > - Both firmware interfaces support indexed GPIOs
> > - Both firmware interfaces support named GPIO properties, with an
> > optional index (can we absolutely take this for granted on ACPI now?)
> The developers working on it have said that they definitely want to
> be compatible with the existing bindings, so the answer to your question
> is yes.

One thing to consider still is that we have plenty of existing ACPI code
out there where _DSD is not used but instead we rely on the index. An
example would be rfkill-gpio.c driver:

gpio = devm_gpiod_get_index(&pdev->dev, "reset", 0);
if (!IS_ERR(gpio)) {

gpio = devm_gpiod_get_index(&pdev->dev, "shutdown", 1);
if (!IS_ERR(gpio)) {

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.

 \ /
  Last update: 2014-10-22 10:41    [W:0.066 / U:0.580 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site