mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
sleep: fix sleep current issue caused by sar adc
This commit is contained in:
parent
2a3ee80fba
commit
d84cdace52
@ -62,6 +62,16 @@ void sar_periph_ctrl_pwdet_power_acquire(void);
|
||||
*/
|
||||
void sar_periph_ctrl_pwdet_power_release(void);
|
||||
|
||||
/**
|
||||
* @brief Enable SAR power when system wakes up
|
||||
*/
|
||||
void sar_periph_ctrl_power_enable(void);
|
||||
|
||||
/**
|
||||
* @brief Disable SAR power when system goes to sleep
|
||||
*/
|
||||
void sar_periph_ctrl_power_disable(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -32,6 +32,13 @@ void sar_periph_ctrl_init(void)
|
||||
//Add other periph power control initialisation here
|
||||
}
|
||||
|
||||
void sar_periph_ctrl_power_enable(void)
|
||||
{
|
||||
portENTER_CRITICAL_SAFE(&rtc_spinlock);
|
||||
sar_ctrl_ll_set_power_mode(SAR_CTRL_LL_POWER_ON);
|
||||
portEXIT_CRITICAL_SAFE(&rtc_spinlock);
|
||||
}
|
||||
|
||||
void sar_periph_ctrl_power_disable(void)
|
||||
{
|
||||
portENTER_CRITICAL_SAFE(&rtc_spinlock);
|
||||
|
@ -34,6 +34,13 @@ void sar_periph_ctrl_init(void)
|
||||
//Add other periph power control initialisation here
|
||||
}
|
||||
|
||||
void sar_periph_ctrl_power_enable(void)
|
||||
{
|
||||
portENTER_CRITICAL_SAFE(&rtc_spinlock);
|
||||
sar_ctrl_ll_set_power_mode(SAR_CTRL_LL_POWER_FSM);
|
||||
portEXIT_CRITICAL_SAFE(&rtc_spinlock);
|
||||
}
|
||||
|
||||
void sar_periph_ctrl_power_disable(void)
|
||||
{
|
||||
portENTER_CRITICAL_SAFE(&rtc_spinlock);
|
||||
|
@ -34,6 +34,13 @@ void sar_periph_ctrl_init(void)
|
||||
//Add other periph power control initialisation here
|
||||
}
|
||||
|
||||
void sar_periph_ctrl_power_enable(void)
|
||||
{
|
||||
portENTER_CRITICAL_SAFE(&rtc_spinlock);
|
||||
sar_ctrl_ll_set_power_mode(SAR_CTRL_LL_POWER_FSM);
|
||||
portEXIT_CRITICAL_SAFE(&rtc_spinlock);
|
||||
}
|
||||
|
||||
void sar_periph_ctrl_power_disable(void)
|
||||
{
|
||||
portENTER_CRITICAL_SAFE(&rtc_spinlock);
|
||||
|
@ -29,6 +29,11 @@ void sar_periph_ctrl_init(void)
|
||||
//TODO: IDF-6123
|
||||
}
|
||||
|
||||
void sar_periph_ctrl_power_enable(void)
|
||||
{
|
||||
//TODO: IDF-6123
|
||||
}
|
||||
|
||||
void sar_periph_ctrl_power_disable(void)
|
||||
{
|
||||
//TODO: IDF-6123
|
||||
|
@ -34,6 +34,13 @@ void sar_periph_ctrl_init(void)
|
||||
//Add other periph power control initialisation here
|
||||
}
|
||||
|
||||
void sar_periph_ctrl_power_enable(void)
|
||||
{
|
||||
portENTER_CRITICAL_SAFE(&rtc_spinlock);
|
||||
sar_ctrl_ll_set_power_mode(SAR_CTRL_LL_POWER_FSM);
|
||||
portEXIT_CRITICAL_SAFE(&rtc_spinlock);
|
||||
}
|
||||
|
||||
void sar_periph_ctrl_power_disable(void)
|
||||
{
|
||||
portENTER_CRITICAL_SAFE(&rtc_spinlock);
|
||||
|
@ -34,6 +34,13 @@ void sar_periph_ctrl_init(void)
|
||||
//Add other periph power control initialisation here
|
||||
}
|
||||
|
||||
void sar_periph_ctrl_power_enable(void)
|
||||
{
|
||||
portENTER_CRITICAL_SAFE(&rtc_spinlock);
|
||||
sar_ctrl_ll_set_power_mode(SAR_CTRL_LL_POWER_FSM);
|
||||
portEXIT_CRITICAL_SAFE(&rtc_spinlock);
|
||||
}
|
||||
|
||||
void sar_periph_ctrl_power_disable(void)
|
||||
{
|
||||
portENTER_CRITICAL_SAFE(&rtc_spinlock);
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include "esp_private/esp_clk.h"
|
||||
#include "esp_private/startup_internal.h"
|
||||
#include "esp_private/esp_task_wdt.h"
|
||||
#include "esp_private/sar_periph_ctrl.h"
|
||||
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
#include "esp32/rom/cache.h"
|
||||
@ -361,6 +362,7 @@ inline static void IRAM_ATTR misc_modules_sleep_prepare(void)
|
||||
#if REGI2C_ANA_CALI_PD_WORKAROUND
|
||||
regi2c_analog_cali_reg_read();
|
||||
#endif
|
||||
sar_periph_ctrl_power_disable();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -368,6 +370,7 @@ inline static void IRAM_ATTR misc_modules_sleep_prepare(void)
|
||||
*/
|
||||
inline static void IRAM_ATTR misc_modules_wake_prepare(void)
|
||||
{
|
||||
sar_periph_ctrl_power_enable();
|
||||
#if SOC_PM_SUPPORT_CPU_PD || SOC_PM_SUPPORT_TAGMEM_PD
|
||||
sleep_disable_memory_retention();
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user