summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid Hendricks <dhendrix@chromium.org>2012-04-11 14:04:08 -0700
committerDavid Hendricks <dhendrix@chromium.org>2012-04-13 14:46:33 -0700
commit28292ae66332ecca9e6ea8b98cd3eadf57f36e8a (patch)
treea986dbb4bb0c356f164b8e0d26dcd607c755d75e /include
parent9fa4246a8d736d33b7ed0eee7084b952177ca6db (diff)
downloadchrome-ec-28292ae66332ecca9e6ea8b98cd3eadf57f36e8a.tar.gz
add more explicit GPIO types
This patch adds explicit handling of open-drain outputs and adds Hi-Z for high-impedence state (floating) outputs. Signed-off-by: David Hendricks <dhendrix@chromium.org> BUG=none TEST=compile tested Change-Id: I1a0c2e8366f6a82cd9cd7e83e57122944f2bdc2d
Diffstat (limited to 'include')
-rw-r--r--include/gpio.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/gpio.h b/include/gpio.h
index 4a351346eb..6eab4f1583 100644
--- a/include/gpio.h
+++ b/include/gpio.h
@@ -13,21 +13,26 @@
/* Flag definitions for gpio_info. */
+#define GPIO_INPUT 0x0000 /* Input */
#define GPIO_OUTPUT 0x0001 /* Output */
#define GPIO_PULL 0x0002 /* Input with on-chip pullup/pulldown */
#define GPIO_HIGH 0x0004 /* If GPIO_OUTPUT, default high; if GPIO_PULL,
* pull up (otherwise default low / pull
* down) */
+#define GPIO_OPEN_DRAIN 0x0008 /* Output type is open-drain */
#define GPIO_INT_RISING 0x0010 /* Interrupt on rising edge */
#define GPIO_INT_FALLING 0x0020 /* Interrupt on falling edge */
#define GPIO_INT_BOTH 0x0040 /* Interrupt on both edges */
#define GPIO_INT_LOW 0x0080 /* Interrupt on low level */
#define GPIO_INT_HIGH 0x0100 /* Interrupt on high level */
+
+
/* Common flag combinations */
#define GPIO_OUT_LOW GPIO_OUTPUT
#define GPIO_OUT_HIGH (GPIO_OUTPUT | GPIO_HIGH)
#define GPIO_PULL_DOWN GPIO_PULL
#define GPIO_PULL_UP (GPIO_PULL | GPIO_HIGH)
+#define GPIO_HI_Z (GPIO_OUTPUT | GPIO_OPEN_DRAIN | GPIO_HIGH)
#define GPIO_INT_EDGE (GPIO_INT_RISING | GPIO_INT_FALLING | GPIO_INT_BOTH)
#define GPIO_INT_LEVEL (GPIO_INT_LOW | GPIO_INT_HIGH)
#define GPIO_INT_ANY (GPIO_INT_EDGE | GPIO_INT_LEVEL)