diff options
author | Alexandre Courbot <acourbot@nvidia.com> | 2013-10-17 13:21:36 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-10-19 17:24:45 -0400 |
commit | 79a9becda8940deb2274b5aa4577c86d52ee7ecb (patch) | |
tree | 2e10b344abcf76446ff97855d280fe9b7fb34ef0 /include/linux/gpio.h | |
parent | b41fb43911b4cb864812adec88d028cc6219f23e (diff) |
gpiolib: export descriptor-based GPIO interface
This patch exports the gpiod_* family of API functions, a safer
alternative to the legacy GPIO interface. Differences between the gpiod
and legacy gpio APIs are:
- gpio works with integers, whereas gpiod operates on opaque handlers
which cannot be forged or used before proper acquisition
- gpiod get/set functions are aware of the active low state of a GPIO
- gpio consumers should now include <linux/gpio/consumer.h> to access
the new interface, whereas chips drivers will use
<linux/gpio/driver.h>
The legacy gpio API is now built as inline functions on top of gpiod.
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'include/linux/gpio.h')
-rw-r--r-- | include/linux/gpio.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/include/linux/gpio.h b/include/linux/gpio.h index a06ec3e85ba3..c691df044458 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h | |||
@@ -16,14 +16,17 @@ | |||
16 | #define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW) | 16 | #define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW) |
17 | #define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH) | 17 | #define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH) |
18 | 18 | ||
19 | /* Gpio pin is active-low */ | ||
20 | #define GPIOF_ACTIVE_LOW (1 << 2) | ||
21 | |||
19 | /* Gpio pin is open drain */ | 22 | /* Gpio pin is open drain */ |
20 | #define GPIOF_OPEN_DRAIN (1 << 2) | 23 | #define GPIOF_OPEN_DRAIN (1 << 3) |
21 | 24 | ||
22 | /* Gpio pin is open source */ | 25 | /* Gpio pin is open source */ |
23 | #define GPIOF_OPEN_SOURCE (1 << 3) | 26 | #define GPIOF_OPEN_SOURCE (1 << 4) |
24 | 27 | ||
25 | #define GPIOF_EXPORT (1 << 4) | 28 | #define GPIOF_EXPORT (1 << 5) |
26 | #define GPIOF_EXPORT_CHANGEABLE (1 << 5) | 29 | #define GPIOF_EXPORT_CHANGEABLE (1 << 6) |
27 | #define GPIOF_EXPORT_DIR_FIXED (GPIOF_EXPORT) | 30 | #define GPIOF_EXPORT_DIR_FIXED (GPIOF_EXPORT) |
28 | #define GPIOF_EXPORT_DIR_CHANGEABLE (GPIOF_EXPORT | GPIOF_EXPORT_CHANGEABLE) | 31 | #define GPIOF_EXPORT_DIR_CHANGEABLE (GPIOF_EXPORT | GPIOF_EXPORT_CHANGEABLE) |
29 | 32 | ||