aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/gpio.h
diff options
context:
space:
mode:
authorAlexandre Courbot <acourbot@nvidia.com>2013-10-17 10:21:36 -0700
committerLinus Walleij <linus.walleij@linaro.org>2013-10-19 23:24:45 +0200
commit79a9becda8940deb2274b5aa4577c86d52ee7ecb (patch)
tree2e10b344abcf76446ff97855d280fe9b7fb34ef0 /include/linux/gpio.h
parentMerge tag 'v3.12-rc6' into devel (diff)
downloadlinux-dev-79a9becda8940deb2274b5aa4577c86d52ee7ecb.tar.xz
linux-dev-79a9becda8940deb2274b5aa4577c86d52ee7ecb.zip
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.h11
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 @@
#define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW)
#define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH)
+/* Gpio pin is active-low */
+#define GPIOF_ACTIVE_LOW (1 << 2)
+
/* Gpio pin is open drain */
-#define GPIOF_OPEN_DRAIN (1 << 2)
+#define GPIOF_OPEN_DRAIN (1 << 3)
/* Gpio pin is open source */
-#define GPIOF_OPEN_SOURCE (1 << 3)
+#define GPIOF_OPEN_SOURCE (1 << 4)
-#define GPIOF_EXPORT (1 << 4)
-#define GPIOF_EXPORT_CHANGEABLE (1 << 5)
+#define GPIOF_EXPORT (1 << 5)
+#define GPIOF_EXPORT_CHANGEABLE (1 << 6)
#define GPIOF_EXPORT_DIR_FIXED (GPIOF_EXPORT)
#define GPIOF_EXPORT_DIR_CHANGEABLE (GPIOF_EXPORT | GPIOF_EXPORT_CHANGEABLE)