mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-25 17:58:46 +00:00
Merge branch 'fix/fix_lightsleep_pd_modem_breaks_common_fe_clock' into 'master'
fix(esp_hw_support): fix lightsleep pd modem breaks common fe clock Closes FCS-1741 See merge request espressif/esp-idf!40437
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "esp_private/gpio.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/regi2c_ctrl.h"
|
||||
@@ -170,6 +171,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:
|
||||
@@ -304,6 +315,15 @@ esp_err_t adc_oneshot_del_unit(adc_oneshot_unit_handle_t handle)
|
||||
|
||||
free(handle);
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
|
@@ -214,18 +214,14 @@ esp_err_t modem_clock_domain_clk_gate_disable(modem_clock_domain_t domain, pmu_h
|
||||
|
||||
static void IRAM_ATTR modem_clock_device_enable(modem_clock_context_t *ctx, uint32_t dev_map)
|
||||
{
|
||||
int16_t refs = 0;
|
||||
esp_os_enter_critical_safe(&ctx->lock);
|
||||
for (int i = 0; dev_map; dev_map >>= 1, i++) {
|
||||
if (dev_map & BIT(0)) {
|
||||
refs = ctx->dev[i].refs++;
|
||||
if (refs == 0) {
|
||||
ctx->dev[i].refs++;
|
||||
(*ctx->dev[i].configure)(ctx, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
esp_os_exit_critical_safe(&ctx->lock);
|
||||
assert(refs >= 0);
|
||||
}
|
||||
|
||||
static void IRAM_ATTR modem_clock_device_disable(modem_clock_context_t *ctx, uint32_t dev_map)
|
||||
|
@@ -40,7 +40,7 @@ extern "C" {
|
||||
#define ADC_LL_GET_LOW_THRES_MASK(monitor_id) ((monitor_id == 0) ? APB_SARADC_APB_SARADC_THRES0_LOW_INT_ST_M : APB_SARADC_APB_SARADC_THRES1_LOW_INT_ST_M)
|
||||
|
||||
#define ADC_LL_NEED_APB_PERIPH_CLAIM(ADC_UNIT) (1)
|
||||
|
||||
#define ADC_LL_ADC_FE_ON_MODEM_DOMAIN (1)
|
||||
/*---------------------------------------------------------------
|
||||
Oneshot
|
||||
---------------------------------------------------------------*/
|
||||
|
@@ -39,7 +39,7 @@ extern "C" {
|
||||
#define ADC_LL_GET_LOW_THRES_MASK(monitor_id) ((monitor_id == 0) ? APB_SARADC_APB_SARADC_THRES0_LOW_INT_ST_M : APB_SARADC_APB_SARADC_THRES1_LOW_INT_ST_M)
|
||||
|
||||
#define ADC_LL_NEED_APB_PERIPH_CLAIM(ADC_UNIT) (1)
|
||||
|
||||
#define ADC_LL_ADC_FE_ON_MODEM_DOMAIN (1)
|
||||
/*---------------------------------------------------------------
|
||||
Oneshot
|
||||
---------------------------------------------------------------*/
|
||||
|
@@ -40,7 +40,7 @@ extern "C" {
|
||||
#define ADC_LL_GET_LOW_THRES_MASK(monitor_id) ((monitor_id == 0) ? SARADC_THRES0_LOW_INT_ST_M : SARADC_THRES1_LOW_INT_ST_M)
|
||||
|
||||
#define ADC_LL_NEED_APB_PERIPH_CLAIM(ADC_UNIT) (1)
|
||||
|
||||
#define ADC_LL_ADC_FE_ON_MODEM_DOMAIN (1)
|
||||
/*---------------------------------------------------------------
|
||||
Oneshot
|
||||
---------------------------------------------------------------*/
|
||||
|
@@ -39,7 +39,7 @@ extern "C" {
|
||||
#define ADC_LL_GET_LOW_THRES_MASK(monitor_id) ((monitor_id == 0) ? APB_SARADC_APB_SARADC_THRES0_LOW_INT_ST_M : APB_SARADC_APB_SARADC_THRES1_LOW_INT_ST_M)
|
||||
|
||||
#define ADC_LL_NEED_APB_PERIPH_CLAIM(ADC_UNIT) (1)
|
||||
|
||||
#define ADC_LL_ADC_FE_ON_MODEM_DOMAIN (1)
|
||||
/*---------------------------------------------------------------
|
||||
Oneshot
|
||||
---------------------------------------------------------------*/
|
||||
|
Reference in New Issue
Block a user