drivers: serial: stm32 uart driver set EXTI line for wakeup from lowPower
The USART or LPUART, especially on stm32wl, must set the EXTI
lines corresponding to the wakeUp source.
This LL_EXTI_LINE_xx is given by the Device Tree property.
This makes the system exiting lowpower stop mode on EXTI irq.
The LL_EXTI_LINE_x is exactly the bit(X) set.
Signed-off-by: Francois Ramu <francois.ramu@st.com>
diff --git a/drivers/serial/uart_stm32.c b/drivers/serial/uart_stm32.c
index 344f7d7..87c5b04 100644
--- a/drivers/serial/uart_stm32.c
+++ b/drivers/serial/uart_stm32.c
@@ -1694,6 +1694,10 @@
* CONFIG_PM_DEVICE=y : Controlled by pm_device_wakeup_enable()
*/
LL_USART_EnableInStopMode(config->usart);
+ if (config->wakeup_line != STM32_EXTI_LINE_NONE) {
+ /* Prepare the WAKEUP with the expected EXTI line */
+ LL_EXTI_EnableIT_0_31(BIT(config->wakeup_line));
+ }
}
#endif /* CONFIG_PM */
@@ -1843,8 +1847,11 @@
#endif
#ifdef CONFIG_PM
-#define STM32_UART_PM_WAKEUP(index) \
- .wakeup_source = DT_INST_PROP(index, wakeup_source),
+#define STM32_UART_PM_WAKEUP(index) \
+ .wakeup_source = DT_INST_PROP(index, wakeup_source), \
+ .wakeup_line = COND_CODE_1(DT_INST_NODE_HAS_PROP(index, wakeup_line), \
+ (DT_INST_PROP(index, wakeup_line)), \
+ (STM32_EXTI_LINE_NONE)),
#else
#define STM32_UART_PM_WAKEUP(index) /* Not used */
#endif