summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chip/host/gpio.c6
-rw-r--r--chip/lm4/gpio.c4
-rw-r--r--chip/stm32/gpio-stm32f.c4
-rw-r--r--chip/stm32/gpio-stm32l.c4
-rw-r--r--include/gpio.h7
5 files changed, 12 insertions, 13 deletions
diff --git a/chip/host/gpio.c b/chip/host/gpio.c
index 2fcb32b2a8..eda2c456bf 100644
--- a/chip/host/gpio.c
+++ b/chip/host/gpio.c
@@ -27,11 +27,9 @@ test_mockable int gpio_get_level(enum gpio_signal signal)
static int gpio_interrupt_check(uint32_t flags, int old, int new)
{
- if ((flags & (GPIO_INT_F_RISING|GPIO_INT_F_BOTH)) &&
- old == 0 && new == 1)
+ if ((flags & GPIO_INT_F_RISING) && old == 0 && new == 1)
return 1;
- if ((flags & (GPIO_INT_F_FALLING|GPIO_INT_F_BOTH)) &&
- old == 1 && new == 0)
+ if ((flags & GPIO_INT_F_FALLING) && old == 1 && new == 0)
return 1;
if ((flags & GPIO_INT_F_LOW) && new == 0)
return 1;
diff --git a/chip/lm4/gpio.c b/chip/lm4/gpio.c
index 7bed71bbc6..58d7665f20 100644
--- a/chip/lm4/gpio.c
+++ b/chip/lm4/gpio.c
@@ -128,7 +128,9 @@ void gpio_set_flags_by_mask(uint32_t port, uint32_t mask, uint32_t flags)
else
LM4_GPIO_IEV(port) &= ~mask;
- if (flags & GPIO_INT_F_BOTH)
+ /* Handle interrupting on both edges */
+ if ((flags & GPIO_INT_F_RISING) &&
+ (flags & GPIO_INT_F_FALLING))
LM4_GPIO_IBE(port) |= mask;
else
LM4_GPIO_IBE(port) &= ~mask;
diff --git a/chip/stm32/gpio-stm32f.c b/chip/stm32/gpio-stm32f.c
index eba75d48e0..8ab72cc635 100644
--- a/chip/stm32/gpio-stm32f.c
+++ b/chip/stm32/gpio-stm32f.c
@@ -108,9 +108,9 @@ void gpio_set_flags_by_mask(uint32_t port, uint32_t pmask, uint32_t flags)
/* Set up interrupts if necessary */
ASSERT(!(flags & (GPIO_INT_F_LOW | GPIO_INT_F_HIGH)));
- if (flags & (GPIO_INT_F_RISING | GPIO_INT_F_BOTH))
+ if (flags & GPIO_INT_F_RISING)
STM32_EXTI_RTSR |= pmask;
- if (flags & (GPIO_INT_F_FALLING | GPIO_INT_F_BOTH))
+ if (flags & GPIO_INT_F_FALLING)
STM32_EXTI_FTSR |= pmask;
/* Interrupt is enabled by gpio_enable_interrupt() */
}
diff --git a/chip/stm32/gpio-stm32l.c b/chip/stm32/gpio-stm32l.c
index 727c4c1d99..c141a2fd58 100644
--- a/chip/stm32/gpio-stm32l.c
+++ b/chip/stm32/gpio-stm32l.c
@@ -74,9 +74,9 @@ void gpio_set_flags_by_mask(uint32_t port, uint32_t mask, uint32_t flags)
/* Set up interrupts if necessary */
ASSERT(!(flags & (GPIO_INT_F_LOW | GPIO_INT_F_HIGH)));
- if (flags & (GPIO_INT_F_RISING | GPIO_INT_F_BOTH))
+ if (flags & GPIO_INT_F_RISING)
STM32_EXTI_RTSR |= mask;
- if (flags & (GPIO_INT_F_FALLING | GPIO_INT_F_BOTH))
+ if (flags & GPIO_INT_F_FALLING)
STM32_EXTI_FTSR |= mask;
/* Interrupt is enabled by gpio_enable_interrupt() */
}
diff --git a/include/gpio.h b/include/gpio.h
index 6b1f80fe99..ae216269fb 100644
--- a/include/gpio.h
+++ b/include/gpio.h
@@ -24,7 +24,6 @@
#define GPIO_HIGH (1 << 7) /* If GPIO_OUTPUT, set level high */
#define GPIO_INT_F_RISING (1 << 8) /* Interrupt on rising edge */
#define GPIO_INT_F_FALLING (1 << 9) /* Interrupt on falling edge */
-#define GPIO_INT_F_BOTH (1 << 10) /* Interrupt on both edges */
#define GPIO_INT_F_LOW (1 << 11) /* Interrupt on low level */
#define GPIO_INT_F_HIGH (1 << 12) /* Interrupt on high level */
#define GPIO_DEFAULT (1 << 13) /* Don't set up on boot */
@@ -37,12 +36,12 @@
#define GPIO_ODR_LOW (GPIO_OUTPUT | GPIO_OPEN_DRAIN | GPIO_LOW)
#define GPIO_INT_RISING (GPIO_INPUT | GPIO_INT_F_RISING)
#define GPIO_INT_FALLING (GPIO_INPUT | GPIO_INT_F_FALLING)
-#define GPIO_INT_BOTH (GPIO_INPUT | GPIO_INT_F_BOTH)
+/* TODO(crosbug.com/p/24204): "EDGE" would have been clearer than "BOTH". */
+#define GPIO_INT_BOTH (GPIO_INT_RISING | GPIO_INT_FALLING)
#define GPIO_INT_LOW (GPIO_INPUT | GPIO_INT_F_LOW)
#define GPIO_INT_HIGH (GPIO_INPUT | GPIO_INT_F_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)
+#define GPIO_INT_ANY (GPIO_INT_BOTH | GPIO_INT_LEVEL)
#define GPIO_INT_BOTH_DSLEEP (GPIO_INT_BOTH | GPIO_INT_DSLEEP)
/* GPIO signal definition structure, for use by board.c */