public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	Grant Likely <grant.likely@secretlab.ca>,
	Linus Walleij <linus.walleij@linaro.org>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Mathias Nyman <mathias.nyman@linux.intel.com>,
	linux-acpi@vger.kernel.org
Subject: Re: [PATCH] gpiolib-acpi: introduce acpi_get_gpio_by_index() helper
Date: Thu, 4 Apr 2013 12:38:20 +0300	[thread overview]
Message-ID: <20130404093820.GI21804@intel.com> (raw)
In-Reply-To: <CAN+gG=F4LMHMsOqVh+BikSLKBJ8V7ni-p4hKi7yRb4jjD7gv0w@mail.gmail.com>

On Thu, Apr 04, 2013 at 11:19:53AM +0200, Benjamin Tissoires wrote:
> Hi Mika,
> 
> On Wed, Apr 3, 2013 at 12:56 PM, Mika Westerberg
> <mika.westerberg@linux.intel.com> wrote:
> > Instead of open-coding ACPI GPIO resource lookup in each driver, we provide
> > a helper function analogous to Device Tree version that allows drivers to
> > specify which GPIO resource they are interested (using an index to the GPIO
> > resources). The function then finds out the correct resource, translates
> > the ACPI GPIO number to the corresponding Linux GPIO number and returns
> > that.
> >
> > Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> > ---
> >  Documentation/acpi/enumeration.txt |   32 ++++++++++++++-
> >  drivers/gpio/gpiolib-acpi.c        |   77 ++++++++++++++++++++++++++++++++++++
> >  include/linux/acpi_gpio.h          |   17 ++++++++
> >  3 files changed, 125 insertions(+), 1 deletion(-)
> >
> > diff --git a/Documentation/acpi/enumeration.txt b/Documentation/acpi/enumeration.txt
> > index 94a6561..b0d5410 100644
> > --- a/Documentation/acpi/enumeration.txt
> > +++ b/Documentation/acpi/enumeration.txt
> > @@ -199,6 +199,8 @@ the device to the driver. For example:
> >         {
> >                 Name (SBUF, ResourceTemplate()
> >                 {
> > +                       ...
> > +                       // Used to power on/off the device
> >                         GpioIo (Exclusive, PullDefault, 0x0000, 0x0000,
> >                                 IoRestrictionOutputOnly, "\\_SB.PCI0.GPI0",
> >                                 0x00, ResourceConsumer,,)
> > @@ -206,10 +208,20 @@ the device to the driver. For example:
> >                                 // Pin List
> >                                 0x0055
> >                         }
> > +
> > +                       // Interrupt for the device
> > +                       GpioInt (Edge, ActiveHigh, ExclusiveAndWake, PullNone,
> > +                                0x0000, "\\_SB.PCI0.GPI0", 0x00, ResourceConsumer,,)
> 
> Sorry for coming late in the GPIO ACPI discussion, but when I see this
> documentation, I wonder:
> wouldn't it be feasible to find the correct GPIO by its type? Here, we
> have a GpioIo and a GpioInt, and I bet this would be sometime more
> useful to request the first GpioInt without knowing the correct order
> of declarations.

Why not. But then again you can always check the type returned in the
acpi_gpio_info structure and pick the first GpioInt (if you have multiple
GPIO resources).

> It may be feasible by walking the tree, but a helper would be of great
> help (thinking at i2c-hid here, which can not rely on indexes in the
> DSDT).

Well, index is the only thing we can rely on unfortunately. There's nothing
like names or anything like that.

What I've seen from ACPI enumerated i2c-hid devices there is only one GPIO
resource (GpioInt) declared.

  reply	other threads:[~2013-04-04  9:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-03 10:56 [PATCH] gpiolib-acpi: introduce acpi_get_gpio_by_index() helper Mika Westerberg
2013-04-03 11:04 ` Rafael J. Wysocki
2013-04-11  7:29   ` Mika Westerberg
2013-04-11 22:35     ` Linus Walleij
2013-04-12  6:57       ` Mika Westerberg
2013-04-04  9:19 ` Benjamin Tissoires
2013-04-04  9:38   ` Mika Westerberg [this message]
2013-04-04  9:42     ` Benjamin Tissoires
2013-04-04  9:57       ` Mika Westerberg
2013-04-04 10:01         ` Benjamin Tissoires
2013-04-04 10:13           ` Mika Westerberg
2013-04-11 22:33 ` Linus Walleij
2013-04-11 22:43   ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130404093820.GI21804@intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=benjamin.tissoires@gmail.com \
    --cc=grant.likely@secretlab.ca \
    --cc=linus.walleij@linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathias.nyman@linux.intel.com \
    --cc=rafael.j.wysocki@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox