[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141022081044.GB1484@lahna.fi.intel.com>
Date: Wed, 22 Oct 2014 11:10:44 +0300
From: Mika Westerberg <mika.westerberg@...ux.intel.com>
To: Arnd Bergmann <arnd@...db.de>
Cc: Alexandre Courbot <gnurou@...il.com>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Grant Likely <grant.likely@...aro.org>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
Aaron Lu <aaron.lu@...el.com>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
Linus Walleij <linus.walleij@...aro.org>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Bryan Wu <cooloney@...il.com>,
Darren Hart <dvhart@...ux.intel.com>,
Mark Rutland <mark.rutland@....com>
Subject: Re: 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists