diff --git a/components/esp_hw_support/include/esp_sleep.h b/components/esp_hw_support/include/esp_sleep.h index 3088942e95..0a6fa025a4 100644 --- a/components/esp_hw_support/include/esp_sleep.h +++ b/components/esp_hw_support/include/esp_sleep.h @@ -61,6 +61,9 @@ typedef enum { #endif #if SOC_PM_SUPPORT_VDDSDIO_PD ESP_PD_DOMAIN_VDDSDIO, //!< VDD_SDIO +#endif +#if SOC_PM_SUPPORT_TOP_PD + ESP_PD_DOMAIN_TOP, //!< SoC TOP #endif ESP_PD_DOMAIN_MAX //!< Number of domains } esp_sleep_pd_domain_t; diff --git a/components/esp_hw_support/sleep_modes.c b/components/esp_hw_support/sleep_modes.c index ad5de434f5..98868f2b13 100644 --- a/components/esp_hw_support/sleep_modes.c +++ b/components/esp_hw_support/sleep_modes.c @@ -76,6 +76,8 @@ #include "esp32c6/rom/rtc.h" #include "hal/lp_timer_hal.h" #include "esp_private/esp_pmu.h" +#include "esp_private/sleep_peripheral.h" +#include "esp_private/sleep_clock.h" #elif CONFIG_IDF_TARGET_ESP32H2 #include "esp32h2/rom/rtc.h" #include "esp32h2/rom/cache.h" @@ -1455,6 +1457,12 @@ static uint32_t get_power_down_flags(void) } #endif +#if SOC_PM_SUPPORT_TOP_PD + if (!cpu_domain_pd_allowed() || !clock_domain_pd_allowed() || !peripheral_domain_pd_allowed()) { + s_config.domain[ESP_PD_DOMAIN_TOP].pd_option = ESP_PD_OPTION_ON; + } +#endif + #ifdef CONFIG_IDF_TARGET_ESP32 s_config.domain[ESP_PD_DOMAIN_XTAL].pd_option = ESP_PD_OPTION_OFF; #endif @@ -1512,6 +1520,11 @@ static uint32_t get_power_down_flags(void) if (s_config.domain[ESP_PD_DOMAIN_XTAL].pd_option != ESP_PD_OPTION_ON) { pd_flags |= RTC_SLEEP_PD_XTAL; } +#if SOC_PM_SUPPORT_TOP_PD + if (s_config.domain[ESP_PD_DOMAIN_TOP].pd_option != ESP_PD_OPTION_ON) { + pd_flags |= PMU_SLEEP_PD_TOP; + } +#endif #if SOC_PM_SUPPORT_VDDSDIO_PD if (s_config.domain[ESP_PD_DOMAIN_VDDSDIO].pd_option != ESP_PD_OPTION_ON) { pd_flags |= RTC_SLEEP_PD_VDDSDIO;