Skip to content

Commit ccb6fbb

Browse files
westeriLinus Walleij
authored andcommitted
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>
1 parent 5ccff85 commit ccb6fbb

1 file changed

Lines changed: 7 additions & 29 deletions

File tree

‎Documentation/acpi/enumeration.txt‎

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -293,36 +293,13 @@ the device to the driver. For example:
293293

294294
These GPIO numbers are controller relative and path "\\_SB.PCI0.GPI0"
295295
specifies the path to the controller. In order to use these GPIOs in Linux
296-
we need to translate them to the Linux GPIO numbers.
296+
we need to translate them to the corresponding Linux GPIO descriptors.
297297

298-
In a simple case of just getting the Linux GPIO number from device
299-
resources one can use acpi_get_gpio_by_index() helper function. It takes
300-
pointer to the device and index of the GpioIo/GpioInt descriptor in the
301-
device resources list. For example:
298+
There is a standard GPIO API for that and is documented in
299+
Documentation/gpio.txt.
302300

303-
int gpio_irq, gpio_power;
304-
int ret;
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-
316-
Other GpioIo parameters must be converted first by the driver to be
317-
suitable to the gpiolib before passing them.
318-
319-
In case of GpioInt resource an additional call to gpio_to_irq() must be
320-
done before calling request_irq().
321-
322-
Note that the above API is ACPI specific and not recommended for drivers
323-
that need to support non-ACPI systems. The recommended way is to use
324-
the descriptor based GPIO interfaces. The above example looks like this
325-
when converted to the GPIO desc:
301+
In the above example we can get the corresponding two GPIO descriptors with
302+
a code like this:
326303

327304
#include <linux/gpio/consumer.h>
328305
...
@@ -339,4 +316,5 @@ when converted to the GPIO desc:
339316

340317
/* Now we can use the GPIO descriptors */
341318

342-
See also Documentation/gpio.txt.
319+
There are also devm_* versions of these functions which release the
320+
descriptors once the device is released.

0 commit comments

Comments
 (0)