From 50feb8f75bdaa8cf0658181acaf1ea54ba265944 Mon Sep 17 00:00:00 2001 From: jingli Date: Fri, 23 Dec 2022 17:27:36 +0800 Subject: [PATCH 1/2] soc_caps: remove SOC_GPIO_SUPPORT_SLP_SWITCH all esp chips support this feature --- components/driver/gpio/gpio.c | 10 ++++------ components/driver/include/driver/gpio.h | 2 -- components/driver/include/esp_private/gpio.h | 2 -- .../esp_hw_support/include/esp_private/sleep_gpio.h | 4 ++-- components/esp_hw_support/include/esp_sleep.h | 2 -- components/esp_hw_support/sleep_gpio.c | 4 ---- components/esp_pm/pm_impl.c | 4 ++-- components/hal/include/hal/gpio_hal.h | 2 -- components/soc/esp32/include/soc/Kconfig.soc_caps.in | 4 ---- components/soc/esp32/include/soc/soc_caps.h | 3 --- components/soc/esp32c2/include/soc/Kconfig.soc_caps.in | 4 ---- components/soc/esp32c2/include/soc/soc_caps.h | 3 --- components/soc/esp32c3/include/soc/Kconfig.soc_caps.in | 4 ---- components/soc/esp32c3/include/soc/soc_caps.h | 3 --- components/soc/esp32h2/include/soc/Kconfig.soc_caps.in | 4 ---- components/soc/esp32h2/include/soc/soc_caps.h | 3 --- components/soc/esp32s2/include/soc/Kconfig.soc_caps.in | 4 ---- components/soc/esp32s2/include/soc/soc_caps.h | 3 --- components/soc/esp32s3/include/soc/Kconfig.soc_caps.in | 4 ---- components/soc/esp32s3/include/soc/soc_caps.h | 3 --- 20 files changed, 8 insertions(+), 64 deletions(-) diff --git a/components/driver/gpio/gpio.c b/components/driver/gpio/gpio.c index 138e9b159d..288220c9ce 100644 --- a/components/driver/gpio/gpio.c +++ b/components/driver/gpio/gpio.c @@ -579,7 +579,7 @@ esp_err_t gpio_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t intr_type) portENTER_CRITICAL(&gpio_context.gpio_spinlock); gpio_hal_set_intr_type(gpio_context.gpio_hal, gpio_num, intr_type); gpio_hal_wakeup_enable(gpio_context.gpio_hal, gpio_num); -#if SOC_GPIO_SUPPORT_SLP_SWITCH && CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND +#if CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND gpio_hal_sleep_sel_dis(gpio_context.gpio_hal, gpio_num); #endif portEXIT_CRITICAL(&gpio_context.gpio_spinlock); @@ -602,7 +602,7 @@ esp_err_t gpio_wakeup_disable(gpio_num_t gpio_num) #endif portENTER_CRITICAL(&gpio_context.gpio_spinlock); gpio_hal_wakeup_disable(gpio_context.gpio_hal, gpio_num); -#if SOC_GPIO_SUPPORT_SLP_SWITCH && CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND +#if CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND gpio_hal_sleep_sel_en(gpio_context.gpio_hal, gpio_num); #endif portEXIT_CRITICAL(&gpio_context.gpio_spinlock); @@ -740,7 +740,6 @@ void gpio_iomux_out(uint8_t gpio_num, int func, bool oen_inv) gpio_hal_iomux_out(gpio_context.gpio_hal, gpio_num, func, (uint32_t)oen_inv); } -#if SOC_GPIO_SUPPORT_SLP_SWITCH static esp_err_t gpio_sleep_pullup_en(gpio_num_t gpio_num) { GPIO_CHECK(GPIO_IS_VALID_GPIO(gpio_num), "GPIO number error", ESP_ERR_INVALID_ARG); @@ -912,7 +911,6 @@ esp_err_t gpio_sleep_pupd_config_unapply(gpio_num_t gpio_num) return ESP_OK; } #endif // CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL -#endif // SOC_GPIO_SUPPORT_SLP_SWITCH #if SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP esp_err_t gpio_deep_sleep_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t intr_type) @@ -927,7 +925,7 @@ esp_err_t gpio_deep_sleep_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t int } portENTER_CRITICAL(&gpio_context.gpio_spinlock); gpio_hal_deepsleep_wakeup_enable(gpio_context.gpio_hal, gpio_num, intr_type); -#if SOC_GPIO_SUPPORT_SLP_SWITCH && CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND +#if CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND gpio_hal_sleep_sel_dis(gpio_context.gpio_hal, gpio_num); #endif portEXIT_CRITICAL(&gpio_context.gpio_spinlock); @@ -942,7 +940,7 @@ esp_err_t gpio_deep_sleep_wakeup_disable(gpio_num_t gpio_num) } portENTER_CRITICAL(&gpio_context.gpio_spinlock); gpio_hal_deepsleep_wakeup_disable(gpio_context.gpio_hal, gpio_num); -#if SOC_GPIO_SUPPORT_SLP_SWITCH && CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND +#if CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND gpio_hal_sleep_sel_en(gpio_context.gpio_hal, gpio_num); #endif portEXIT_CRITICAL(&gpio_context.gpio_spinlock); diff --git a/components/driver/include/driver/gpio.h b/components/driver/include/driver/gpio.h index e784f65341..c3ef9157ae 100644 --- a/components/driver/include/driver/gpio.h +++ b/components/driver/include/driver/gpio.h @@ -446,7 +446,6 @@ esp_err_t gpio_force_hold_all(void); esp_err_t gpio_force_unhold_all(void); #endif -#if SOC_GPIO_SUPPORT_SLP_SWITCH /** * @brief Enable SLP_SEL to change GPIO status automantically in lightsleep. * @param gpio_num GPIO number of the pad. @@ -493,7 +492,6 @@ esp_err_t gpio_sleep_set_direction(gpio_num_t gpio_num, gpio_mode_t mode); * - ESP_ERR_INVALID_ARG : Parameter error */ esp_err_t gpio_sleep_set_pull_mode(gpio_num_t gpio_num, gpio_pull_mode_t pull); -#endif #if SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP diff --git a/components/driver/include/esp_private/gpio.h b/components/driver/include/esp_private/gpio.h index c4227dc8c4..65211a5e4e 100644 --- a/components/driver/include/esp_private/gpio.h +++ b/components/driver/include/esp_private/gpio.h @@ -12,7 +12,6 @@ #include "soc/soc_caps.h" #include "driver/gpio.h" -#if SOC_GPIO_SUPPORT_SLP_SWITCH #if CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL /** * @brief Emulate ESP32S2 behaviour to backup FUN_PU, FUN_PD information @@ -34,4 +33,3 @@ esp_err_t gpio_sleep_pupd_config_apply(gpio_num_t gpio_num); */ esp_err_t gpio_sleep_pupd_config_unapply(gpio_num_t gpio_num); #endif -#endif diff --git a/components/esp_hw_support/include/esp_private/sleep_gpio.h b/components/esp_hw_support/include/esp_private/sleep_gpio.h index abab21871a..493687ec32 100644 --- a/components/esp_hw_support/include/esp_private/sleep_gpio.h +++ b/components/esp_hw_support/include/esp_private/sleep_gpio.h @@ -18,7 +18,7 @@ extern "C" { * This file contains declarations of GPIO related functions in light sleep mode. */ -#if SOC_GPIO_SUPPORT_SLP_SWITCH && CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL +#if CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL /** * @brief Save GPIO pull-up and pull-down configuration information in the wake-up state @@ -39,7 +39,7 @@ void gpio_sleep_mode_config_apply(void); */ void gpio_sleep_mode_config_unapply(void); -#endif // SOC_GPIO_SUPPORT_SLP_SWITCH && CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL +#endif // CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL #ifdef __cplusplus } diff --git a/components/esp_hw_support/include/esp_sleep.h b/components/esp_hw_support/include/esp_sleep.h index 71926c3bc2..4cb3fed4bc 100644 --- a/components/esp_hw_support/include/esp_sleep.h +++ b/components/esp_hw_support/include/esp_sleep.h @@ -479,7 +479,6 @@ void esp_deep_sleep_disable_rom_logging(void); esp_err_t esp_sleep_cpu_pd_low_init(bool enable); #endif -#if SOC_GPIO_SUPPORT_SLP_SWITCH /** * @brief Configure to isolate all GPIO pins in sleep state */ @@ -490,7 +489,6 @@ void esp_sleep_config_gpio_isolate(void); * @param enable decide whether to switch status or not */ void esp_sleep_enable_gpio_switch(bool enable); -#endif #if CONFIG_MAC_BB_PD /** diff --git a/components/esp_hw_support/sleep_gpio.c b/components/esp_hw_support/sleep_gpio.c index 0386ceb5fd..5915ffa79c 100644 --- a/components/esp_hw_support/sleep_gpio.c +++ b/components/esp_hw_support/sleep_gpio.c @@ -25,8 +25,6 @@ static const char *TAG = "sleep"; -#if SOC_GPIO_SUPPORT_SLP_SWITCH - #if CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL void gpio_sleep_mode_config_apply(void) { @@ -95,8 +93,6 @@ void esp_sleep_enable_gpio_switch(bool enable) } } -#endif // SOC_GPIO_SUPPORT_SLP_SWITCH - // IDF does not officially support esp32h2 in v5.0 #if !CONFIG_IDF_TARGET_ESP32H2 IRAM_ATTR void esp_sleep_isolate_digital_gpio(void) diff --git a/components/esp_pm/pm_impl.c b/components/esp_pm/pm_impl.c index 36ece69223..12e6c6f48b 100644 --- a/components/esp_pm/pm_impl.c +++ b/components/esp_pm/pm_impl.c @@ -300,7 +300,7 @@ esp_err_t esp_pm_configure(const void* vconfig) s_config_changed = true; portEXIT_CRITICAL(&s_switch_lock); -#if CONFIG_PM_SLP_DISABLE_GPIO && SOC_GPIO_SUPPORT_SLP_SWITCH +#if CONFIG_PM_SLP_DISABLE_GPIO esp_sleep_enable_gpio_switch(config->light_sleep_enable); #endif @@ -744,7 +744,7 @@ void esp_pm_impl_init(void) esp_pm_trace_init(); #endif -#if CONFIG_PM_SLP_DISABLE_GPIO && SOC_GPIO_SUPPORT_SLP_SWITCH +#if CONFIG_PM_SLP_DISABLE_GPIO esp_sleep_config_gpio_isolate(); #endif ESP_ERROR_CHECK(esp_pm_lock_create(ESP_PM_CPU_FREQ_MAX, 0, "rtos0", diff --git a/components/hal/include/hal/gpio_hal.h b/components/hal/include/hal/gpio_hal.h index 2c9c08bfa9..00498edefd 100644 --- a/components/hal/include/hal/gpio_hal.h +++ b/components/hal/include/hal/gpio_hal.h @@ -350,7 +350,6 @@ void gpio_hal_intr_disable(gpio_hal_context_t *hal, uint32_t gpio_num); #define gpio_hal_force_unhold_all() gpio_ll_force_unhold_all() #endif -#if SOC_GPIO_SUPPORT_SLP_SWITCH /** * @brief Enable pull-up on GPIO when system sleep. * @@ -448,7 +447,6 @@ void gpio_hal_sleep_pupd_config_apply(gpio_hal_context_t *hal, uint32_t gpio_num */ void gpio_hal_sleep_pupd_config_unapply(gpio_hal_context_t *hal, uint32_t gpio_num); #endif // CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL -#endif //SOC_GPIO_SUPPORT_SLP_SWITCH #if SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP diff --git a/components/soc/esp32/include/soc/Kconfig.soc_caps.in b/components/soc/esp32/include/soc/Kconfig.soc_caps.in index fbbc877e42..2d3d9fbaeb 100644 --- a/components/soc/esp32/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32/include/soc/Kconfig.soc_caps.in @@ -259,10 +259,6 @@ config SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK hex default 0xEF0FEA -config SOC_GPIO_SUPPORT_SLP_SWITCH - bool - default y - config SOC_I2C_NUM int default 2 diff --git a/components/soc/esp32/include/soc/soc_caps.h b/components/soc/esp32/include/soc/soc_caps.h index 22aacb1444..b493bef0e7 100644 --- a/components/soc/esp32/include/soc/soc_caps.h +++ b/components/soc/esp32/include/soc/soc_caps.h @@ -167,9 +167,6 @@ // digital I/O pad powered by VDD3P3_CPU or VDD_SPI(GPIO_NUM: 1, 3, 5, 6, 7, 8, 9, 10, 11, 16, 17, 18, 19, 21, 22, 23) #define SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK 0xEF0FEAULL -// Support to configure slept status -#define SOC_GPIO_SUPPORT_SLP_SWITCH (1) - /*-------------------------- I2C CAPS ----------------------------------------*/ // ESP32 has 2 I2C #define SOC_I2C_NUM (2) diff --git a/components/soc/esp32c2/include/soc/Kconfig.soc_caps.in b/components/soc/esp32c2/include/soc/Kconfig.soc_caps.in index 4ed771e1df..94591921d1 100644 --- a/components/soc/esp32c2/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32c2/include/soc/Kconfig.soc_caps.in @@ -215,10 +215,6 @@ config SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK hex default 0x00000000001FFFC0 -config SOC_GPIO_SUPPORT_SLP_SWITCH - bool - default y - config SOC_DEDIC_GPIO_OUT_CHANNELS_NUM int default 8 diff --git a/components/soc/esp32c2/include/soc/soc_caps.h b/components/soc/esp32c2/include/soc/soc_caps.h index f28f545ad8..be80d9a3dc 100644 --- a/components/soc/esp32c2/include/soc/soc_caps.h +++ b/components/soc/esp32c2/include/soc/soc_caps.h @@ -114,9 +114,6 @@ // digital I/O pad powered by VDD3P3_CPU or VDD_SPI(GPIO_NUM_6~GPIO_NUM_20) #define SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK 0x00000000001FFFC0ULL -// Support to configure sleep status -#define SOC_GPIO_SUPPORT_SLP_SWITCH (1) - /*-------------------------- Dedicated GPIO CAPS -----------------------------*/ #define SOC_DEDIC_GPIO_OUT_CHANNELS_NUM (8) /*!< 8 outward channels on each CPU core */ #define SOC_DEDIC_GPIO_IN_CHANNELS_NUM (8) /*!< 8 inward channels on each CPU core */ diff --git a/components/soc/esp32c3/include/soc/Kconfig.soc_caps.in b/components/soc/esp32c3/include/soc/Kconfig.soc_caps.in index 4a0da79c2a..d4379a07b3 100644 --- a/components/soc/esp32c3/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32c3/include/soc/Kconfig.soc_caps.in @@ -311,10 +311,6 @@ config SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK hex default 0x00000000003FFFC0 -config SOC_GPIO_SUPPORT_SLP_SWITCH - bool - default y - config SOC_DEDIC_GPIO_OUT_CHANNELS_NUM int default 8 diff --git a/components/soc/esp32c3/include/soc/soc_caps.h b/components/soc/esp32c3/include/soc/soc_caps.h index 4c8bbaf5a9..077bd63c94 100644 --- a/components/soc/esp32c3/include/soc/soc_caps.h +++ b/components/soc/esp32c3/include/soc/soc_caps.h @@ -157,9 +157,6 @@ // digital I/O pad powered by VDD3P3_CPU or VDD_SPI(GPIO_NUM_6~GPIO_NUM_21) #define SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK 0x00000000003FFFC0ULL -// Support to configure sleep status -#define SOC_GPIO_SUPPORT_SLP_SWITCH (1) - /*-------------------------- Dedicated GPIO CAPS -----------------------------*/ #define SOC_DEDIC_GPIO_OUT_CHANNELS_NUM (8) /*!< 8 outward channels on each CPU core */ #define SOC_DEDIC_GPIO_IN_CHANNELS_NUM (8) /*!< 8 inward channels on each CPU core */ diff --git a/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in b/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in index 7622e5a604..107c1fcdf7 100644 --- a/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in @@ -287,10 +287,6 @@ config SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK hex default 0x000001FFFFFFFFC0 -config SOC_GPIO_SUPPORT_SLP_SWITCH - bool - default y - config SOC_DEDIC_GPIO_OUT_CHANNELS_NUM int default 8 diff --git a/components/soc/esp32h2/include/soc/soc_caps.h b/components/soc/esp32h2/include/soc/soc_caps.h index bb88bf0243..b72135a111 100644 --- a/components/soc/esp32h2/include/soc/soc_caps.h +++ b/components/soc/esp32h2/include/soc/soc_caps.h @@ -163,9 +163,6 @@ #define SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK 0x0000000003FFE07FULL #endif -// Support to configure sleep status -#define SOC_GPIO_SUPPORT_SLP_SWITCH (1) - /*-------------------------- Dedicated GPIO CAPS -----------------------------*/ #define SOC_DEDIC_GPIO_OUT_CHANNELS_NUM (8) /*!< 8 outward channels on each CPU core */ #define SOC_DEDIC_GPIO_IN_CHANNELS_NUM (8) /*!< 8 inward channels on each CPU core */ diff --git a/components/soc/esp32s2/include/soc/Kconfig.soc_caps.in b/components/soc/esp32s2/include/soc/Kconfig.soc_caps.in index f8f54815df..967627aeda 100644 --- a/components/soc/esp32s2/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32s2/include/soc/Kconfig.soc_caps.in @@ -295,10 +295,6 @@ config SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK hex default 0x00007FFFFC000000 -config SOC_GPIO_SUPPORT_SLP_SWITCH - bool - default y - config SOC_DEDIC_GPIO_OUT_CHANNELS_NUM int default 8 diff --git a/components/soc/esp32s2/include/soc/soc_caps.h b/components/soc/esp32s2/include/soc/soc_caps.h index b1f17f2430..b6e2def714 100644 --- a/components/soc/esp32s2/include/soc/soc_caps.h +++ b/components/soc/esp32s2/include/soc/soc_caps.h @@ -151,9 +151,6 @@ // digital I/O pad powered by VDD3P3_CPU or VDD_SPI(GPIO_NUM_26~GPIO_NUM_46) #define SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK 0x00007FFFFC000000ULL -// Support to configure slept status -#define SOC_GPIO_SUPPORT_SLP_SWITCH (1) - /*-------------------------- Dedicated GPIO CAPS ---------------------------------------*/ #define SOC_DEDIC_GPIO_OUT_CHANNELS_NUM (8) /*!< 8 outward channels on each CPU core */ #define SOC_DEDIC_GPIO_IN_CHANNELS_NUM (8) /*!< 8 inward channels on each CPU core */ diff --git a/components/soc/esp32s3/include/soc/Kconfig.soc_caps.in b/components/soc/esp32s3/include/soc/Kconfig.soc_caps.in index 01669a7cee..14660a730f 100644 --- a/components/soc/esp32s3/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32s3/include/soc/Kconfig.soc_caps.in @@ -379,10 +379,6 @@ config SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK hex default 0x0001FFFFFC000000 -config SOC_GPIO_SUPPORT_SLP_SWITCH - bool - default y - config SOC_DEDIC_GPIO_OUT_CHANNELS_NUM int default 8 diff --git a/components/soc/esp32s3/include/soc/soc_caps.h b/components/soc/esp32s3/include/soc/soc_caps.h index a1d9ca6658..4775a716d2 100644 --- a/components/soc/esp32s3/include/soc/soc_caps.h +++ b/components/soc/esp32s3/include/soc/soc_caps.h @@ -157,9 +157,6 @@ // digital I/O pad powered by VDD3P3_CPU or VDD_SPI(GPIO_NUM_26~GPIO_NUM_48) #define SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK 0x0001FFFFFC000000ULL -// Support to configure slept status -#define SOC_GPIO_SUPPORT_SLP_SWITCH (1) - /*-------------------------- Dedicated GPIO CAPS -----------------------------*/ #define SOC_DEDIC_GPIO_OUT_CHANNELS_NUM (8) /*!< 8 outward channels on each CPU core */ From 7f15980de91090411962996f42da04b644829572 Mon Sep 17 00:00:00 2001 From: jingli Date: Fri, 23 Dec 2022 17:55:18 +0800 Subject: [PATCH 2/2] sleep: fix gpio wakeup not working properly in some cases Before this fix, when we call esp_pm_configure after gpio_wakeup_enable, the configuration of GPIO in sleep state in gpio_wakeup_enable will be overwritten by esp_pm_configure. --- components/driver/gpio/gpio.c | 8 ++++---- components/esp_hw_support/sleep_modes.c | 2 +- components/esp_pm/pm_impl.c | 7 ------- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/components/driver/gpio/gpio.c b/components/driver/gpio/gpio.c index 288220c9ce..1eb0ba3088 100644 --- a/components/driver/gpio/gpio.c +++ b/components/driver/gpio/gpio.c @@ -579,7 +579,7 @@ esp_err_t gpio_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t intr_type) portENTER_CRITICAL(&gpio_context.gpio_spinlock); gpio_hal_set_intr_type(gpio_context.gpio_hal, gpio_num, intr_type); gpio_hal_wakeup_enable(gpio_context.gpio_hal, gpio_num); -#if CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND +#if CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND || CONFIG_PM_SLP_DISABLE_GPIO gpio_hal_sleep_sel_dis(gpio_context.gpio_hal, gpio_num); #endif portEXIT_CRITICAL(&gpio_context.gpio_spinlock); @@ -602,7 +602,7 @@ esp_err_t gpio_wakeup_disable(gpio_num_t gpio_num) #endif portENTER_CRITICAL(&gpio_context.gpio_spinlock); gpio_hal_wakeup_disable(gpio_context.gpio_hal, gpio_num); -#if CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND +#if CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND || CONFIG_PM_SLP_DISABLE_GPIO gpio_hal_sleep_sel_en(gpio_context.gpio_hal, gpio_num); #endif portEXIT_CRITICAL(&gpio_context.gpio_spinlock); @@ -925,7 +925,7 @@ esp_err_t gpio_deep_sleep_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t int } portENTER_CRITICAL(&gpio_context.gpio_spinlock); gpio_hal_deepsleep_wakeup_enable(gpio_context.gpio_hal, gpio_num, intr_type); -#if CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND +#if CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND || CONFIG_PM_SLP_DISABLE_GPIO gpio_hal_sleep_sel_dis(gpio_context.gpio_hal, gpio_num); #endif portEXIT_CRITICAL(&gpio_context.gpio_spinlock); @@ -940,7 +940,7 @@ esp_err_t gpio_deep_sleep_wakeup_disable(gpio_num_t gpio_num) } portENTER_CRITICAL(&gpio_context.gpio_spinlock); gpio_hal_deepsleep_wakeup_disable(gpio_context.gpio_hal, gpio_num); -#if CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND +#if CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND || CONFIG_PM_SLP_DISABLE_GPIO gpio_hal_sleep_sel_en(gpio_context.gpio_hal, gpio_num); #endif portEXIT_CRITICAL(&gpio_context.gpio_spinlock); diff --git a/components/esp_hw_support/sleep_modes.c b/components/esp_hw_support/sleep_modes.c index 138aa8ec98..644fdd2e83 100644 --- a/components/esp_hw_support/sleep_modes.c +++ b/components/esp_hw_support/sleep_modes.c @@ -1448,7 +1448,7 @@ void rtc_sleep_enable_ultra_low(bool enable) s_ultra_low_enabled = enable; } -#if CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND && !CONFIG_PM_SLP_DISABLE_GPIO +#if CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND || CONFIG_PM_SLP_DISABLE_GPIO ESP_SYSTEM_INIT_FN(esp_sleep_startup_init, BIT(0), 105) { // Configure to isolate (disable the Input/Output/Pullup/Pulldown diff --git a/components/esp_pm/pm_impl.c b/components/esp_pm/pm_impl.c index 12e6c6f48b..c5a124dc9f 100644 --- a/components/esp_pm/pm_impl.c +++ b/components/esp_pm/pm_impl.c @@ -300,10 +300,6 @@ esp_err_t esp_pm_configure(const void* vconfig) s_config_changed = true; portEXIT_CRITICAL(&s_switch_lock); -#if CONFIG_PM_SLP_DISABLE_GPIO - esp_sleep_enable_gpio_switch(config->light_sleep_enable); -#endif - #if CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP && SOC_PM_SUPPORT_CPU_PD esp_err_t ret = esp_sleep_cpu_pd_low_init(config->light_sleep_enable); if (config->light_sleep_enable && ret != ESP_OK) { @@ -744,9 +740,6 @@ void esp_pm_impl_init(void) esp_pm_trace_init(); #endif -#if CONFIG_PM_SLP_DISABLE_GPIO - esp_sleep_config_gpio_isolate(); -#endif ESP_ERROR_CHECK(esp_pm_lock_create(ESP_PM_CPU_FREQ_MAX, 0, "rtos0", &s_rtos_lock_handle[0])); ESP_ERROR_CHECK(esp_pm_lock_acquire(s_rtos_lock_handle[0]));