mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
use API instead of Kconfig
This commit is contained in:
parent
824e0ddca8
commit
3a908c66e6
@ -32,30 +32,6 @@ menu "Hardware Settings"
|
||||
possible to force a power domain to stay ON during light sleep by using esp_sleep_pd_config()
|
||||
function.
|
||||
|
||||
config ESP_SLEEP_FORCE_POWER_DOWN_FLASH
|
||||
bool "Relax the conditions for power down flash"
|
||||
depends on ESP_SLEEP_POWER_DOWN_FLASH
|
||||
default n
|
||||
help
|
||||
Currently in IDF, whether the flash can be powered down depends on whether the RTC timer wakeup source
|
||||
is enabled or not. Only when RTC timer is the only wakeup source and sleep_duration is big enough, we
|
||||
can power down flash. The reason for this logic is:
|
||||
|
||||
If the flash is powered up again(such as wakeup happens) during its power-down period, the flash may
|
||||
not work properly. It means that if we are going to power down the flash, we must power down the flash
|
||||
completely. The power-down process takes time. So, if we can't make sure the sleep time is long enough,
|
||||
then we can't power down the flash.
|
||||
|
||||
Considering that the probability of flash not working properly when powered up again during power-down
|
||||
period is very small(< 1%). And maybe some kind of flash do not have this problem. So provide this configuration
|
||||
item to relax the conditions for power down flash.
|
||||
|
||||
If not enabled, The power-down conditions of flash are strict and absolute safe. If enabled, chip will
|
||||
also power down flash when RTC timer wakeup source is not enabled or sleep_duration is big enough.
|
||||
|
||||
Enabling this configuration item can bring better power consumption performance. But users need to pay
|
||||
attention to the potential risks.
|
||||
|
||||
config ESP_SLEEP_RTC_BUS_ISO_WORKAROUND
|
||||
bool
|
||||
default y if IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
|
||||
|
@ -636,13 +636,20 @@ static esp_err_t esp_light_sleep_inner(uint32_t pd_flags,
|
||||
return err;
|
||||
}
|
||||
|
||||
/**
|
||||
* vddsdio is used for power supply of spi flash
|
||||
*
|
||||
* pd flash via menuconfig | pd flash via `esp_sleep_pd_config` | result
|
||||
* ---------------------------------------------------------------------------------------------------
|
||||
* 0 | 0 | no pd flash
|
||||
* x | 1 | pd flash with relaxed conditions(force_pd)
|
||||
* 1 | 0 | pd flash with strict conditions(safe_pd)
|
||||
*/
|
||||
static inline bool can_power_down_vddsdio(const uint32_t vddsdio_pd_sleep_duration)
|
||||
{
|
||||
return ((s_config.wakeup_triggers == RTC_TIMER_TRIG_EN) && (s_config.sleep_duration > vddsdio_pd_sleep_duration))
|
||||
#if CONFIG_ESP_SLEEP_FORCE_POWER_DOWN_FLASH
|
||||
|| (!(s_config.wakeup_triggers & RTC_TIMER_TRIG_EN) || (s_config.sleep_duration > vddsdio_pd_sleep_duration))
|
||||
#endif
|
||||
;
|
||||
bool force_pd = !(s_config.wakeup_triggers & RTC_TIMER_TRIG_EN) || (s_config.sleep_duration > vddsdio_pd_sleep_duration);
|
||||
bool safe_pd = (s_config.wakeup_triggers == RTC_TIMER_TRIG_EN) && (s_config.sleep_duration > vddsdio_pd_sleep_duration);
|
||||
return (s_config.pd_options[ESP_PD_DOMAIN_VDDSDIO] == ESP_PD_OPTION_OFF) ? force_pd : safe_pd;
|
||||
}
|
||||
|
||||
esp_err_t esp_light_sleep_start(void)
|
||||
@ -1352,9 +1359,7 @@ static uint32_t get_power_down_flags(void)
|
||||
* value of this field.
|
||||
*/
|
||||
if (s_config.pd_options[ESP_PD_DOMAIN_VDDSDIO] == ESP_PD_OPTION_AUTO) {
|
||||
#ifdef CONFIG_ESP_SLEEP_POWER_DOWN_FLASH
|
||||
s_config.pd_options[ESP_PD_DOMAIN_VDDSDIO] = ESP_PD_OPTION_OFF;
|
||||
#else
|
||||
#ifndef CONFIG_ESP_SLEEP_POWER_DOWN_FLASH
|
||||
s_config.pd_options[ESP_PD_DOMAIN_VDDSDIO] = ESP_PD_OPTION_ON;
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user