diff --git a/components/esp_hw_support/Kconfig b/components/esp_hw_support/Kconfig index 58f90e64da..2d09fa5f12 100644 --- a/components/esp_hw_support/Kconfig +++ b/components/esp_hw_support/Kconfig @@ -42,5 +42,13 @@ menu "Hardware Settings" increase during light sleep. If the CS pin of SPIRAM has an external pull-up, you do not need to select this option, otherwise, you should enable this option. + + config ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND + bool "Flash leakage current workaround in light sleep" + help + When the CS pin of Flash is not pulled up, the sleep current will + increase during light sleep. If the CS pin of Flash has an external + pull-up, you do not need to select this option, otherwise, you + should enable this option. endmenu endmenu diff --git a/components/esp_hw_support/sleep_gpio.c b/components/esp_hw_support/sleep_gpio.c index f7b8a1726c..b9f874c3c6 100644 --- a/components/esp_hw_support/sleep_gpio.c +++ b/components/esp_hw_support/sleep_gpio.c @@ -19,6 +19,7 @@ #include "driver/gpio.h" #include "esp_private/gpio.h" #include "esp_private/sleep_gpio.h" +#include "bootloader_common.h" #ifdef CONFIG_IDF_TARGET_ESP32 #include "esp32/spiram.h" @@ -64,6 +65,9 @@ void esp_sleep_config_gpio_isolate(void) #if CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND && CONFIG_SPIRAM gpio_sleep_set_pull_mode(esp_spiram_get_cs_io(), GPIO_PULLUP_ONLY); #endif +#if CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND + gpio_sleep_set_pull_mode(bootloader_flash_get_cs_io(), GPIO_PULLUP_ONLY); +#endif } void esp_sleep_enable_gpio_switch(bool enable)