From add6d78b0a5ec0262d775a0f7292014d567d923f Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Thu, 17 Sep 2015 15:56:47 -0700 Subject: [PATCH] gpio: add polarity and pull up/down config flags This adds to the configuration flags for GPIO: () Indicates the polarity of the pin, whether it should be normal or inversed. () Enables pull up/pull down for the pin. Change-Id: I2b0c57e5a539208aff7aeb4ea53050134ab404fd Signed-off-by: Daniel Leung --- include/gpio.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/gpio.h b/include/gpio.h index 56217357133..84736b4d26a 100644 --- a/include/gpio.h +++ b/include/gpio.h @@ -59,6 +59,19 @@ extern "C" { #define GPIO_INT_EDGE (1 << 5) #define GPIO_INT_DOUBLE_EDGE (1 << 6) +/* Polarity of the GPIO (1 bit) */ +#define GPIO_POL_POS 7 +#define GPIO_POL_NORMAL (0 << GPIO_POL_POS) +#define GPIO_POL_INV (1 << GPIO_POL_POS) +#define GPIO_POL_MASK (1 << GPIO_POL_POS) + +/* Pull-up/pull-down for GPIO (2 bits) */ +#define GPIO_PUD_POS 8 +#define GPIO_PUD_NORMAL (0 << GPIO_PUD_POS) +#define GPIO_PUD_PULL_UP (1 << GPIO_PUD_POS) +#define GPIO_PUD_PULL_DOWN (2 << GPIO_PUD_POS) +#define GPIO_PUD_MASK (3 << GPIO_PUD_POS) + /* application callback function signature*/ typedef void (*gpio_callback_t)(struct device *port, uint32_t pin);