mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-03 03:31:41 +03:00
fix(esp_hw_support): fix MODEM_ADC_COMMON_FE destroyed by modem powerdown lightsleep
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include "driver/rtc_io.h"
|
||||
#include "esp_adc/adc_oneshot.h"
|
||||
#include "esp_clk_tree.h"
|
||||
#include "esp_sleep.h"
|
||||
#include "esp_private/adc_private.h"
|
||||
#include "esp_private/adc_share_hw_ctrl.h"
|
||||
#include "esp_private/sar_periph_ctrl.h"
|
||||
@@ -163,6 +164,16 @@ esp_err_t adc_oneshot_new_unit(const adc_oneshot_unit_init_cfg_t *init_config, a
|
||||
|
||||
ESP_LOGD(TAG, "new adc unit%"PRId32" is created", unit->unit_id);
|
||||
*ret_unit = unit;
|
||||
|
||||
#if CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP
|
||||
//TODO: IDF-8475: Depends to SLEEP_RETENTION_MODULE_CLOCK_MODEM retention module after ADC retention supported.
|
||||
#if SOC_PM_SUPPORT_MODEM_PD
|
||||
ESP_ERROR_CHECK(esp_sleep_pd_config(ESP_PD_DOMAIN_MODEM, ESP_PD_OPTION_ON));
|
||||
ESP_ERROR_CHECK(esp_sleep_pd_config(ESP_PD_DOMAIN_TOP, ESP_PD_OPTION_ON));
|
||||
#endif
|
||||
#elif ADC_LL_ADC_FE_ON_MODEM_DOMAIN
|
||||
ESP_ERROR_CHECK(esp_sleep_pd_config(ESP_PD_DOMAIN_MODEM, ESP_PD_OPTION_ON));
|
||||
#endif
|
||||
return ESP_OK;
|
||||
|
||||
err:
|
||||
@@ -288,6 +299,15 @@ esp_err_t adc_oneshot_del_unit(adc_oneshot_unit_handle_t handle)
|
||||
_lock_release(&s_ctx.mutex);
|
||||
#endif
|
||||
|
||||
#if CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP
|
||||
//TODO: IDF-8475: Depends to SLEEP_RETENTION_MODULE_CLOCK_MODEM retention module after ADC retention supported.
|
||||
#if SOC_PM_SUPPORT_MODEM_PD
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_MODEM, ESP_PD_OPTION_OFF);
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_TOP, ESP_PD_OPTION_OFF);
|
||||
#endif
|
||||
#elif ADC_LL_ADC_FE_ON_MODEM_DOMAIN
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_MODEM, ESP_PD_OPTION_OFF);
|
||||
#endif
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user