diff --git a/components/esp_driver_ledc/src/ledc.c b/components/esp_driver_ledc/src/ledc.c index 30934e3e81e..d3c132d1f81 100644 --- a/components/esp_driver_ledc/src/ledc.c +++ b/components/esp_driver_ledc/src/ledc.c @@ -17,6 +17,7 @@ #include "soc/soc_caps.h" #include "hal/ledc_hal.h" #include "driver/ledc.h" +#include "driver/rtc_io.h" #include "esp_private/esp_sleep_internal.h" #include "esp_sleep.h" #include "esp_private/periph_ctrl.h" @@ -998,11 +999,11 @@ esp_err_t ledc_channel_config(const ledc_channel_config_t *ledc_conf) // 2. keep IO output during sleep gpio_sleep_sel_dis(gpio_num); -#if CONFIG_IDF_TARGET_ESP32P4 - // To workaround DIG-399, all LP IOs are held when LP_PERIPH is powered off to ensure EXT wakeup functionality +#if CONFIG_ESP32P4_SELECTS_REV_LESS_V3 || CONFIG_IDF_TARGET_ESP32S31 + // To workaround P4 (DIG-399) & S31 (DIG-814), all LP IOs are held when LP_PERIPH is powered off to ensure EXT wakeup functionality // But holding LP IOs will cause LEDC signal cannot output on the pad during sleep // Therefore, we will force LP periph xpd in such case - if (GPIO_IS_HP_PERIPH_PD_WAKEUP_VALID_IO(gpio_num)) { + if (rtc_gpio_is_valid_gpio(gpio_num)) { esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON); } #endif diff --git a/components/esp_hw_support/port/esp32s31/pmu_sleep.c b/components/esp_hw_support/port/esp32s31/pmu_sleep.c index 24b8a69dcdd..d5064551757 100644 --- a/components/esp_hw_support/port/esp32s31/pmu_sleep.c +++ b/components/esp_hw_support/port/esp32s31/pmu_sleep.c @@ -281,7 +281,9 @@ static void pmu_sleep_digital_init(pmu_context_t *ctx, const pmu_sleep_digital_c { pmu_ll_hp_set_dig_pad_slp_sel (ctx->hal->dev, HP(SLEEP), dig->syscntl.dig_pad_slp_sel); pmu_ll_hp_set_hold_all_hp_pad (ctx->hal->dev, HP(SLEEP), dig->syscntl.hp_pad_hold_all); + pmu_ll_hp_set_hold_all_hp_pad (ctx->hal->dev, HP(MODEM), dig->syscntl.hp_pad_hold_all); pmu_ll_hp_set_hold_all_lp_pad (ctx->hal->dev, HP(SLEEP), dig->syscntl.lp_pad_hold_all); + pmu_ll_hp_set_hold_all_lp_pad (ctx->hal->dev, HP(MODEM), dig->syscntl.lp_pad_hold_all); pmu_ll_hp_set_pause_watchdog (ctx->hal->dev, HP(SLEEP), dig->syscntl.dig_pause_wdt); pmu_ll_hp_set_c_channel_enable (ctx->hal->dev, HP(SLEEP), dig->syscntl.c_channel); if (!dslp) { diff --git a/components/esp_hw_support/port/esp32s31/private_include/pmu_param.h b/components/esp_hw_support/port/esp32s31/private_include/pmu_param.h index 831ccc0ac4c..cd9d0c69a45 100644 --- a/components/esp_hw_support/port/esp32s31/private_include/pmu_param.h +++ b/components/esp_hw_support/port/esp32s31/private_include/pmu_param.h @@ -350,7 +350,7 @@ typedef struct { #define PMU_SLEEP_DIGITAL_DSLP_CONFIG_DEFAULT(sleep_flags) { \ .syscntl = { \ .dig_pad_slp_sel = 0, \ - .lp_pad_hold_all = 1, \ + .lp_pad_hold_all = (sleep_flags & PMU_SLEEP_PD_LP_PERIPH) ? 1 : 0, \ .hp_pad_hold_all = 1, \ .dig_pause_wdt = ((sleep_flags) & RTC_SLEEP_USE_RTC_WDT) ? 0 : 1, \ .c_channel = (sleep_flags & PMU_SLEEP_PD_TOP) ? 0 : 1 \ @@ -358,10 +358,10 @@ typedef struct { .icg_func = { .clock = { 0, 0 } }, \ } -#define PMU_SLEEP_DIGITAL_LSLP_CONFIG_DEFAULT(sleep_flags, clk_flags) { \ +#define PMU_SLEEP_DIGITAL_LSLP_CONFIG_DEFAULT(sleep_flags, clk_flags) { \ .syscntl = { \ .dig_pad_slp_sel = ((sleep_flags) & PMU_SLEEP_PD_TOP) ? 0 : 1, \ - .lp_pad_hold_all = ((sleep_flags) & PMU_SLEEP_PD_TOP) ? 1 : 0, \ + .lp_pad_hold_all = ((sleep_flags) & PMU_SLEEP_PD_LP_PERIPH) ? 1 : 0,\ .hp_pad_hold_all = ((sleep_flags) & PMU_SLEEP_PD_TOP) ? 1 : 0, \ .dig_pause_wdt = ((sleep_flags) & RTC_SLEEP_USE_RTC_WDT) ? 0 : 1, \ .c_channel = (sleep_flags & PMU_SLEEP_PD_TOP) ? 0 : 1 \