diff --git a/soc/st/stm32/stm32l4x/poweroff.c b/soc/st/stm32/stm32l4x/poweroff.c index b5260dc33cdfb65..0b5a9effdd8f225 100644 --- a/soc/st/stm32/stm32l4x/poweroff.c +++ b/soc/st/stm32/stm32l4x/poweroff.c @@ -1,11 +1,14 @@ /* * Copyright (c) 2023 Nordic Semiconductor ASA + * Copyright (c) 2024 STMicroelectronics + * * SPDX-License-Identifier: Apache-2.0 */ #include #include #include +#include #include #include @@ -13,6 +16,12 @@ void z_sys_poweroff(void) { +#ifdef CONFIG_STM32_WKUP_PINS + stm32_pwr_wkup_pin_cfg_pupd(); + + LL_PWR_ClearFlag_WU(); +#endif /* CONFIG_STM32_WKUP_PINS */ + LL_PWR_SetPowerMode(LL_PWR_MODE_SHUTDOWN); LL_LPM_EnableDeepSleep(); LL_DBGMCU_DisableDBGStandbyMode(); diff --git a/soc/st/stm32/stm32u5x/poweroff.c b/soc/st/stm32/stm32u5x/poweroff.c index 191230be5235d97..1b2e26c0395c8c2 100644 --- a/soc/st/stm32/stm32u5x/poweroff.c +++ b/soc/st/stm32/stm32u5x/poweroff.c @@ -1,17 +1,26 @@ /* * Copyright (c) 2023 Nordic Semiconductor ASA + * Copyright (c) 2024 STMicroelectronics + * * SPDX-License-Identifier: Apache-2.0 */ #include #include #include +#include #include #include void z_sys_poweroff(void) { +#ifdef CONFIG_STM32_WKUP_PINS + stm32_pwr_wkup_pin_cfg_pupd(); + + LL_PWR_ClearFlag_WU(); +#endif /* CONFIG_STM32_WKUP_PINS */ + LL_PWR_SetPowerMode(LL_PWR_SHUTDOWN_MODE); LL_LPM_EnableDeepSleep(); diff --git a/soc/st/stm32/stm32wbx/poweroff.c b/soc/st/stm32/stm32wbx/poweroff.c index d95aa24fc0c0557..e4319762e826215 100644 --- a/soc/st/stm32/stm32wbx/poweroff.c +++ b/soc/st/stm32/stm32wbx/poweroff.c @@ -1,18 +1,25 @@ /* * Copyright (c) 2023 Nordic Semiconductor ASA + * Copyright (c) 2024 STMicroelectronics + * * SPDX-License-Identifier: Apache-2.0 */ #include #include #include +#include #include #include void z_sys_poweroff(void) { +#ifdef CONFIG_STM32_WKUP_PINS + stm32_pwr_wkup_pin_cfg_pupd(); + LL_PWR_ClearFlag_WU(); +#endif /* CONFIG_STM32_WKUP_PINS */ LL_PWR_SetPowerMode(LL_PWR_MODE_SHUTDOWN); LL_LPM_EnableDeepSleep(); diff --git a/soc/st/stm32/stm32wlx/poweroff.c b/soc/st/stm32/stm32wlx/poweroff.c index 05d516393ea963d..e4319762e826215 100644 --- a/soc/st/stm32/stm32wlx/poweroff.c +++ b/soc/st/stm32/stm32wlx/poweroff.c @@ -1,17 +1,26 @@ /* * Copyright (c) 2023 Nordic Semiconductor ASA + * Copyright (c) 2024 STMicroelectronics + * * SPDX-License-Identifier: Apache-2.0 */ #include #include #include +#include #include #include void z_sys_poweroff(void) { +#ifdef CONFIG_STM32_WKUP_PINS + stm32_pwr_wkup_pin_cfg_pupd(); + + LL_PWR_ClearFlag_WU(); +#endif /* CONFIG_STM32_WKUP_PINS */ + LL_PWR_SetPowerMode(LL_PWR_MODE_SHUTDOWN); LL_LPM_EnableDeepSleep();