From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: linux-acpi@vger.kernel.org
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
Linus Walleij <linus.walleij@linaro.org>,
Chris Ball <cjb@laptop.org>,
Johannes Berg <johannes@sipsolutions.net>,
Rhyland Klein <rklein@nvidia.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Mathias Nyman <mathias.nyman@linux.intel.com>,
Alexandre Courbot <acourbot@nvidia.com>,
Rob Landley <rob@landley.net>,
Stephen Warren <swarren@wwwdotorg.org>,
Thierry Reding <thierry.reding@gmail.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v4 4/4] Documentation / ACPI: update to GPIO descriptor API
Date: Wed, 8 Jan 2014 12:40:57 +0200 [thread overview]
Message-ID: <1389177657-29266-5-git-send-email-mika.westerberg@linux.intel.com> (raw)
In-Reply-To: <1389177657-29266-1-git-send-email-mika.westerberg@linux.intel.com>
Update the documentation also to reflect the fact that there are no ACPI
specific GPIO interfaces anymore but drivers should instead use the
descriptor based GPIO APIs.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
Documentation/acpi/enumeration.txt | 36 +++++++-----------------------------
1 file changed, 7 insertions(+), 29 deletions(-)
diff --git a/Documentation/acpi/enumeration.txt b/Documentation/acpi/enumeration.txt
index b994bcb32b92..2a1519b87177 100644
--- a/Documentation/acpi/enumeration.txt
+++ b/Documentation/acpi/enumeration.txt
@@ -293,36 +293,13 @@ the device to the driver. For example:
These GPIO numbers are controller relative and path "\\_SB.PCI0.GPI0"
specifies the path to the controller. In order to use these GPIOs in Linux
-we need to translate them to the Linux GPIO numbers.
+we need to translate them to the corresponding Linux GPIO descriptors.
-In a simple case of just getting the Linux GPIO number from device
-resources one can use acpi_get_gpio_by_index() helper function. It takes
-pointer to the device and index of the GpioIo/GpioInt descriptor in the
-device resources list. For example:
+There is a standard GPIO API for that and is documented in
+Documentation/gpio.txt.
- int gpio_irq, gpio_power;
- int ret;
-
- gpio_irq = acpi_get_gpio_by_index(dev, 1, NULL);
- if (gpio_irq < 0)
- /* handle error */
-
- gpio_power = acpi_get_gpio_by_index(dev, 0, NULL);
- if (gpio_power < 0)
- /* handle error */
-
- /* Now we can use the GPIO numbers */
-
-Other GpioIo parameters must be converted first by the driver to be
-suitable to the gpiolib before passing them.
-
-In case of GpioInt resource an additional call to gpio_to_irq() must be
-done before calling request_irq().
-
-Note that the above API is ACPI specific and not recommended for drivers
-that need to support non-ACPI systems. The recommended way is to use
-the descriptor based GPIO interfaces. The above example looks like this
-when converted to the GPIO desc:
+In the above example we can get the corresponding two GPIO descriptors with
+a code like this:
#include <linux/gpio/consumer.h>
...
@@ -339,4 +316,5 @@ when converted to the GPIO desc:
/* Now we can use the GPIO descriptors */
-See also Documentation/gpio.txt.
+There are also devm_* versions of these functions which release the
+descriptors once the device is released.
--
1.8.5.2
next prev parent reply other threads:[~2014-01-08 10:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-08 10:40 [PATCH v4 0/4] gpio / ACPI: convert users to gpiod_* and drop acpi_gpio.h Mika Westerberg
2014-01-08 10:40 ` [PATCH v4 1/4] gpio / ACPI: register to ACPI events automatically Mika Westerberg
2014-01-08 11:55 ` Linus Walleij
2014-01-08 10:40 ` [PATCH v4 2/4] mmc: sdhci-acpi: convert to use GPIO descriptor API Mika Westerberg
2014-01-08 11:54 ` Linus Walleij
2014-01-08 12:34 ` Mika Westerberg
2014-01-13 18:32 ` Chris Ball
2014-01-08 10:40 ` [PATCH v4 3/4] gpio / ACPI: get rid of acpi_gpio.h Mika Westerberg
2014-01-08 11:56 ` Linus Walleij
2014-01-08 10:40 ` Mika Westerberg [this message]
2014-01-08 11:57 ` [PATCH v4 4/4] Documentation / ACPI: update to GPIO descriptor API Linus Walleij
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=1389177657-29266-5-git-send-email-mika.westerberg@linux.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=acourbot@nvidia.com \
--cc=adrian.hunter@intel.com \
--cc=cjb@laptop.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=johannes@sipsolutions.net \
--cc=linus.walleij@linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathias.nyman@linux.intel.com \
--cc=rjw@rjwysocki.net \
--cc=rklein@nvidia.com \
--cc=rob@landley.net \
--cc=swarren@wwwdotorg.org \
--cc=thierry.reding@gmail.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;
as well as URLs for NNTP newsgroup(s).