aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/acpi/enumeration.txt
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2014-01-08 05:40:57 -0500
committerLinus Walleij <linus.walleij@linaro.org>2014-01-08 09:07:28 -0500
commitccb6fbb990202e647523a003018f6edaed17b53d (patch)
treeada492fcfc1f8595fd47e6129209390185ae862c /Documentation/acpi/enumeration.txt
parent5ccff85276addfdaad0046390bc5624f7e44e614 (diff)
Documentation / ACPI: update to GPIO descriptor API
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> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'Documentation/acpi/enumeration.txt')
-rw-r--r--Documentation/acpi/enumeration.txt36
1 files 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:
293 293
294These GPIO numbers are controller relative and path "\\_SB.PCI0.GPI0" 294These GPIO numbers are controller relative and path "\\_SB.PCI0.GPI0"
295specifies the path to the controller. In order to use these GPIOs in Linux 295specifies the path to the controller. In order to use these GPIOs in Linux
296we need to translate them to the Linux GPIO numbers. 296we need to translate them to the corresponding Linux GPIO descriptors.
297 297
298In a simple case of just getting the Linux GPIO number from device 298There is a standard GPIO API for that and is documented in
299resources one can use acpi_get_gpio_by_index() helper function. It takes 299Documentation/gpio.txt.
300pointer to the device and index of the GpioIo/GpioInt descriptor in the
301device resources list. For example:
302 300
303 int gpio_irq, gpio_power; 301In the above example we can get the corresponding two GPIO descriptors with
304 int ret; 302a code like this:
305
306 gpio_irq = acpi_get_gpio_by_index(dev, 1, NULL);
307 if (gpio_irq < 0)
308 /* handle error */
309
310 gpio_power = acpi_get_gpio_by_index(dev, 0, NULL);
311 if (gpio_power < 0)
312 /* handle error */
313
314 /* Now we can use the GPIO numbers */
315
316Other GpioIo parameters must be converted first by the driver to be
317suitable to the gpiolib before passing them.
318
319In case of GpioInt resource an additional call to gpio_to_irq() must be
320done before calling request_irq().
321
322Note that the above API is ACPI specific and not recommended for drivers
323that need to support non-ACPI systems. The recommended way is to use
324the descriptor based GPIO interfaces. The above example looks like this
325when converted to the GPIO desc:
326 303
327 #include <linux/gpio/consumer.h> 304 #include <linux/gpio/consumer.h>
328 ... 305 ...
@@ -339,4 +316,5 @@ when converted to the GPIO desc:
339 316
340 /* Now we can use the GPIO descriptors */ 317 /* Now we can use the GPIO descriptors */
341 318
342See also Documentation/gpio.txt. 319There are also devm_* versions of these functions which release the
320descriptors once the device is released.