summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chip/g/gpio.c8
-rw-r--r--include/gpio.h2
2 files changed, 6 insertions, 4 deletions
diff --git a/chip/g/gpio.c b/chip/g/gpio.c
index a4f17eaf76..5683048344 100644
--- a/chip/g/gpio.c
+++ b/chip/g/gpio.c
@@ -84,24 +84,24 @@ void gpio_set_flags_by_mask(uint32_t port, uint32_t mask, uint32_t flags)
if (flags & GPIO_INT_F_LOW) {
GR_GPIO_CLRINTTYPE(port) = mask;
GR_GPIO_CLRINTPOL(port) = mask;
- GR_GPIO_SETINTEN(port) = mask;
}
if (flags & GPIO_INT_F_HIGH) {
GR_GPIO_CLRINTTYPE(port) = mask;
GR_GPIO_SETINTPOL(port) = mask;
- GR_GPIO_SETINTEN(port) = mask;
}
if (flags & GPIO_INT_F_FALLING) {
GR_GPIO_SETINTTYPE(port) = mask;
GR_GPIO_CLRINTPOL(port) = mask;
- GR_GPIO_SETINTEN(port) = mask;
}
if (flags & GPIO_INT_F_RISING) {
GR_GPIO_SETINTTYPE(port) = mask;
GR_GPIO_SETINTPOL(port) = mask;
- GR_GPIO_SETINTEN(port) = mask;
}
+ if (flags & (GPIO_INT_ANY ^ GPIO_INPUT))
+ if (!(flags & GPIO_INT_DISABLE))
+ GR_GPIO_SETINTEN(port) = mask;
+
/* No way to trigger on both rising and falling edges, darn it. */
}
diff --git a/include/gpio.h b/include/gpio.h
index 35f53801de..d1dad9056a 100644
--- a/include/gpio.h
+++ b/include/gpio.h
@@ -33,6 +33,8 @@
#define GPIO_ALTERNATE (1 << 17) /* GPIO used for alternate function. */
#define GPIO_LOCKED (1 << 18) /* Lock GPIO output and configuration */
#define GPIO_HIB_WAKE_HIGH (1 << 19) /* Hibernate wake on high level */
+#define GPIO_INT_DISABLE (1 << 20) /* Don't enable interrupt in */
+ /* gpio_pre_init */
/* Common flag combinations */
#define GPIO_OUT_LOW (GPIO_OUTPUT | GPIO_LOW)