include: gpio: Add GPIO_INT_WAKEUP flag

Add a flag to configure the GPIO pin interrupt as a
wakeup source for the system.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
This commit is contained in:
Mahesh Mahadevan
2023-12-13 16:54:55 -06:00
parent 6fc1047b96
commit 45a3d31e81
2 changed files with 7 additions and 1 deletions

View File

@@ -783,6 +783,8 @@ enum gpio_int_trig {
GPIO_INT_TRIG_HIGH = GPIO_INT_HIGH_1,
/* Trigger detection on pin rising or falling edge. */
GPIO_INT_TRIG_BOTH = GPIO_INT_LOW_0 | GPIO_INT_HIGH_1,
/* Trigger a system wakup. */
GPIO_INT_TRIG_WAKE = GPIO_INT_WAKEUP,
};
__subsystem struct gpio_driver_api {
@@ -909,7 +911,7 @@ static inline int z_impl_gpio_pin_interrupt_configure(const struct device *port,
flags ^= (GPIO_INT_LOW_0 | GPIO_INT_HIGH_1);
}
trig = (enum gpio_int_trig)(flags & (GPIO_INT_LOW_0 | GPIO_INT_HIGH_1));
trig = (enum gpio_int_trig)(flags & (GPIO_INT_LOW_0 | GPIO_INT_HIGH_1 | GPIO_INT_WAKEUP));
#ifdef CONFIG_GPIO_ENABLE_DISABLE_INTERRUPT
mode = (enum gpio_int_mode)(flags & (GPIO_INT_EDGE | GPIO_INT_DISABLE | GPIO_INT_ENABLE |
GPIO_INT_ENABLE_DISABLE_ONLY));

View File

@@ -81,6 +81,10 @@
/* Note: Bits 15 downto 8 are reserved for SoC specific flags. */
/** Configures GPIO interrupt to wakeup the system from low power mode.
*/
#define GPIO_INT_WAKEUP (1u << 28)
/**
* @}
*/