@@ -195,16 +195,9 @@ const pmu_sleep_config_t* pmu_sleep_config_default(
195195 analog_default .lp_sys [LP (SLEEP )].analog .pd_cur = PMU_PD_CUR_SLEEP_ON ;
196196 analog_default .lp_sys [LP (SLEEP )].analog .bias_sleep = PMU_BIASSLP_SLEEP_ON ;
197197 analog_default .lp_sys [LP (SLEEP )].analog .dbg_atten = PMU_DBG_ATTEN_ACTIVE_DEFAULT ;
198- #if !CONFIG_ESP_SLEEP_KEEP_DCDC_ALWAYS_ON
199- analog_default .lp_sys [LP (SLEEP )].analog .dbias = LP_CALI_ACTIVE_DBIAS_DEFAULT ;
200- #endif
201198 }
202-
203- #if CONFIG_ESP_SLEEP_KEEP_DCDC_ALWAYS_ON
204199 power_default .hp_sys .dig_power .dcdc_switch_pd_en = 0 ;
205200 analog_default .hp_sys .analog .dcm_vset = CONFIG_ESP_SLEEP_DCM_VSET_VAL_IN_SLEEP ;
206- analog_default .hp_sys .analog .dcm_mode = 1 ;
207- #endif
208201 if (sleep_flags & PMU_SLEEP_PD_VDDSDIO ) {
209202 analog_default .hp_sys .analog .xpd_0p1a = 0 ;
210203 } else {
@@ -276,6 +269,10 @@ static void pmu_sleep_digital_init(pmu_context_t *ctx, const pmu_sleep_digital_c
276269static void pmu_sleep_analog_init (pmu_context_t * ctx , const pmu_sleep_analog_config_t * analog , bool dslp )
277270{
278271 assert (ctx -> hal );
272+ /* For deepsleep, DCDC_EN will be controlled by software to avoid DCDC working in a non-feedback state,
273+ which may cause input glitch voltage when waking up and switching to LDO. After chip wake up from deepsleep,
274+ set DCDC_EN in rtc_clk_init. */
275+ pmu_ll_hp_set_dcm_mode (ctx -> hal -> dev , HP (ACTIVE ), dslp ? 0 : 1 );
279276 pmu_ll_hp_set_dcm_mode (ctx -> hal -> dev , HP (SLEEP ), analog -> hp_sys .analog .dcm_mode );
280277 pmu_ll_hp_set_dcm_vset (ctx -> hal -> dev , HP (SLEEP ), analog -> hp_sys .analog .dcm_vset );
281278 pmu_ll_hp_set_current_power_off (ctx -> hal -> dev , HP (SLEEP ), analog -> hp_sys .analog .pd_cur );
@@ -291,24 +288,6 @@ static void pmu_sleep_analog_init(pmu_context_t *ctx, const pmu_sleep_analog_con
291288 pmu_ll_hp_set_regulator_dbias (ctx -> hal -> dev , HP (SLEEP ), analog -> hp_sys .analog .dbias );
292289 pmu_ll_hp_set_regulator_driver_bar (ctx -> hal -> dev , HP (SLEEP ), analog -> hp_sys .analog .drv_b );
293290
294- #if CONFIG_ESP_SLEEP_KEEP_DCDC_ALWAYS_ON
295- if (dslp )
296- #endif
297- {
298- /**
299- DCDC_EN will be controlled by software to avoid DCDC working in a non-feedback state, which may
300- cause input glitch voltage when waking up and switching to LDO.
301- 1. Lightsleep:
302- CONFIG_ESP_SLEEP_KEEP_DCDC_ALWAYS_ON = y: DCDC will not shutdown during sleep.
303- CONFIG_ESP_SLEEP_KEEP_DCDC_ALWAYS_ON = n:
304- PD_TOP: DCDC_EN DCDC_EN enabled by regdma after wake up.
305- PU_TOP: DCDC_EN DCDC_EN enabled by pmu_sleep_finish after wakeup.
306- 2. Deepsleep
307- After chip wake up from deepsleep, set DCDC_EN in rtc_clk_init.
308- **/
309- pmu_ll_hp_set_dcm_mode (ctx -> hal -> dev , HP (ACTIVE ), 0 );
310- }
311-
312291 pmu_ll_lp_set_regulator_sleep_dbias (ctx -> hal -> dev , LP (ACTIVE ), analog -> lp_sys [LP (ACTIVE )].analog .slp_dbias );
313292 pmu_ll_lp_set_regulator_dbias (ctx -> hal -> dev , LP (ACTIVE ), analog -> lp_sys [LP (ACTIVE )].analog .dbias );
314293 pmu_ll_lp_set_regulator_driver_bar (ctx -> hal -> dev , LP (ACTIVE ), analog -> lp_sys [LP (ACTIVE )].analog .drv_b );
@@ -461,20 +440,13 @@ TCM_IRAM_ATTR uint32_t pmu_sleep_start(uint32_t wakeup_opt, uint32_t reject_opt,
461440
462441TCM_IRAM_ATTR bool pmu_sleep_finish (bool dslp )
463442{
464- #if CONFIG_ESP_SLEEP_KEEP_DCDC_ALWAYS_ON
465- if (!dslp ) {
466- // Keep DCDC always on during light sleep, no need to adjust LDO.
467- } else
468- #endif
469- {
443+ if (dslp ) {
470444 pmu_ll_hp_set_dcm_vset (& PMU , PMU_MODE_HP_ACTIVE , HP_CALI_ACTIVE_DCM_VSET_DEFAULT );
471445 pmu_sleep_enable_dcdc ();
472- if (pmu_ll_hp_is_sleep_reject (& PMU ) || ! s_pmu_sleep_regdma_backup_enabled ) {
446+ if (pmu_ll_hp_is_sleep_reject (& PMU )) {
473447 // If sleep is rejected or regdma restore is skipped, the hardware wake-up process that
474448 // turns on DCDC is skipped, and wait DCDC volt rise up by software here.
475449 esp_rom_delay_us (DCDC_STARTUP_TIME_US );
476- } else if (s_pmu_sleep_regdma_backup_enabled ) {
477- esp_rom_delay_us (DCDC_STARTUP_TIME_US - PMU_REGDMA_S2A_WORK_TIME_US );
478450 }
479451 pmu_sleep_shutdown_ldo ();
480452 }
0 commit comments