soc: arm: stm32wb low power substates
The low power states 0∕1∕2 are added to the stm32wb. The substate-id is mapping the same Zephyr power state. They correspond to the stm32wb low power stop0/1/2 modes. Signed-off-by: Francois Ramu <francois.ramu@st.com>
This commit is contained in:
parent
43aa93723b
commit
117796aea9
1 changed files with 8 additions and 6 deletions
|
@ -27,7 +27,7 @@ void pm_power_state_set(struct pm_state_info info)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (info.substate_id) {
|
switch (info.substate_id) {
|
||||||
case 0: /* this corresponds to the STOP0 mode: */
|
case 1: /* this corresponds to the STOP0 mode: */
|
||||||
/* ensure HSI is the wake-up system clock */
|
/* ensure HSI is the wake-up system clock */
|
||||||
LL_RCC_SetClkAfterWakeFromStop(LL_RCC_STOP_WAKEUPCLOCK_HSI);
|
LL_RCC_SetClkAfterWakeFromStop(LL_RCC_STOP_WAKEUPCLOCK_HSI);
|
||||||
/* enter STOP0 mode */
|
/* enter STOP0 mode */
|
||||||
|
@ -36,15 +36,16 @@ void pm_power_state_set(struct pm_state_info info)
|
||||||
/* enter SLEEP mode : WFE or WFI */
|
/* enter SLEEP mode : WFE or WFI */
|
||||||
k_cpu_idle();
|
k_cpu_idle();
|
||||||
break;
|
break;
|
||||||
case 1: /* this corresponds to the STOP1 mode: */
|
case 2: /* this corresponds to the STOP1 mode: */
|
||||||
/* ensure HSI is the wake-up system clock */
|
/* ensure HSI is the wake-up system clock */
|
||||||
LL_RCC_SetClkAfterWakeFromStop(LL_RCC_STOP_WAKEUPCLOCK_HSI);
|
LL_RCC_SetClkAfterWakeFromStop(LL_RCC_STOP_WAKEUPCLOCK_HSI);
|
||||||
/* enter STOP1 mode */
|
/* enter STOP1 mode */
|
||||||
LL_PWR_SetPowerMode(LL_PWR_MODE_STOP1);
|
LL_PWR_SetPowerMode(LL_PWR_MODE_STOP1);
|
||||||
LL_LPM_EnableDeepSleep();
|
LL_LPM_EnableDeepSleep();
|
||||||
|
/* enter SLEEP mode : WFE or WFI */
|
||||||
k_cpu_idle();
|
k_cpu_idle();
|
||||||
break;
|
break;
|
||||||
case 2: /* this corresponds to the STOP2 mode: */
|
case 3: /* this corresponds to the STOP2 mode: */
|
||||||
/* ensure HSI is the wake-up system clock */
|
/* ensure HSI is the wake-up system clock */
|
||||||
LL_RCC_SetClkAfterWakeFromStop(LL_RCC_STOP_WAKEUPCLOCK_HSI);
|
LL_RCC_SetClkAfterWakeFromStop(LL_RCC_STOP_WAKEUPCLOCK_HSI);
|
||||||
#ifdef PWR_CR1_RRSTP
|
#ifdef PWR_CR1_RRSTP
|
||||||
|
@ -53,6 +54,7 @@ void pm_power_state_set(struct pm_state_info info)
|
||||||
/* enter STOP2 mode */
|
/* enter STOP2 mode */
|
||||||
LL_PWR_SetPowerMode(LL_PWR_MODE_STOP2);
|
LL_PWR_SetPowerMode(LL_PWR_MODE_STOP2);
|
||||||
LL_LPM_EnableDeepSleep();
|
LL_LPM_EnableDeepSleep();
|
||||||
|
/* enter SLEEP mode : WFE or WFI */
|
||||||
k_cpu_idle();
|
k_cpu_idle();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -68,11 +70,11 @@ void pm_power_state_exit_post_ops(struct pm_state_info info)
|
||||||
LOG_DBG("Unsupported power state %u", info.state);
|
LOG_DBG("Unsupported power state %u", info.state);
|
||||||
} else {
|
} else {
|
||||||
switch (info.substate_id) {
|
switch (info.substate_id) {
|
||||||
case 0: /* STOP0 */
|
case 1: /* STOP0 */
|
||||||
__fallthrough;
|
__fallthrough;
|
||||||
case 1: /* STOP1 */
|
case 2: /* STOP1 */
|
||||||
__fallthrough;
|
__fallthrough;
|
||||||
case 2: /* STOP2 */
|
case 3: /* STOP2 */
|
||||||
LL_LPM_DisableSleepOnExit();
|
LL_LPM_DisableSleepOnExit();
|
||||||
LL_LPM_EnableSleep();
|
LL_LPM_EnableSleep();
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue