feat(pm): change power down prepare position

This commit is contained in:
cjin
2023-09-26 16:44:27 +08:00
parent 15e1c8d3ca
commit ff69928064
2 changed files with 7 additions and 8 deletions

View File

@@ -624,14 +624,6 @@ static esp_err_t IRAM_ATTR esp_sleep_start(uint32_t pd_flags, esp_sleep_mode_t m
// Will switch to XTAL turn down MSPI speed
mspi_timing_change_speed_mode_cache_safe(true);
/*
Since the modem requires a PLL clock to access modem REG,
it is necessary to back up the mac/bb REG before disabling the PLL clock.
*/
#if SOC_PM_RETENTION_HAS_CLOCK_BUG
mac_bb_power_down_prepare();
#endif // SOC_PM_RETENTION_HAS_CLOCK_BUG
// Save current frequency and switch to XTAL
rtc_cpu_freq_config_t cpu_freq_config;
rtc_clk_cpu_freq_get_config(&cpu_freq_config);

View File

@@ -967,6 +967,13 @@ void esp_pm_impl_idle_hook(void)
&& !periph_should_skip_light_sleep()
#endif
) {
/*
Since the modem requires a PLL clock to access modem REG,
it is necessary to back up the mac/bb REG before disabling the PLL clock.
*/
#if SOC_PM_RETENTION_HAS_CLOCK_BUG
mac_bb_power_down_prepare();
#endif // SOC_PM_RETENTION_HAS_CLOCK_BUG
esp_pm_lock_release(s_rtos_lock_handle[core_id]);
s_core_idle[core_id] = true;
}