stm32: power: SoC restores the clock

Clock must be restored as soon as the SoC leaves standby.
Keep the logic inside the SoC instead of delegate it to the pm
subsystem.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2024-04-30 16:06:00 -07:00 committed by Carles Cufí
commit e1685bb421
3 changed files with 12 additions and 4 deletions

View file

@ -50,8 +50,9 @@ void config_plli2s(void);
#endif
void config_enable_default_clocks(void);
/* function exported to the soc power.c */
/* functions exported to the soc power.c */
int stm32_clock_control_init(const struct device *dev);
void stm32_clock_control_standby_exit(void);
#ifdef __cplusplus
}

View file

@ -550,14 +550,21 @@ static int sys_clock_driver_init(void)
return 0;
}
void sys_clock_idle_exit(void)
void stm32_clock_control_standby_exit(void)
{
#ifdef CONFIG_STM32_LPTIM_STDBY_TIMER
if (clock_control_get_status(clk_ctrl,
(clock_control_subsys_t) &lptim_clk[0])
!= CLOCK_CONTROL_STATUS_ON) {
sys_clock_driver_init();
} else if (timeout_stdby) {
}
#endif /* CONFIG_STM32_LPTIM_STDBY_TIMER */
}
void sys_clock_idle_exit(void)
{
#ifdef CONFIG_STM32_LPTIM_STDBY_TIMER
if (timeout_stdby) {
cycle_t missed_lptim_cnt;
uint32_t stdby_timer_diff, stdby_timer_post, dticks;
uint64_t stdby_timer_us;

View file

@ -118,7 +118,7 @@ static void set_mode_suspend_to_ram(void)
/* Execution is restored at this point after wake up */
/* Restore system clock as soon as we exit standby mode */
sys_clock_idle_exit();
stm32_clock_control_standby_exit();
}
#endif