From d4337bdcefad4fd4660b070d51bd05d701f44bd4 Mon Sep 17 00:00:00 2001 From: hebinglin Date: Wed, 25 Mar 2026 19:42:14 +0800 Subject: [PATCH] change(esp_hw_support): update pmu analog param for esp32h4 eco1 --- .../esp_hal_pmu/esp32h4/include/hal/pmu_ll.h | 7 ----- .../esp_hw_support/port/esp32h21/pmu_sleep.c | 1 + .../esp_hw_support/port/esp32h4/pmu_sleep.c | 7 ++++- .../port/esp32h4/private_include/pmu_param.h | 29 ++++++++++--------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/components/esp_hal_pmu/esp32h4/include/hal/pmu_ll.h b/components/esp_hal_pmu/esp32h4/include/hal/pmu_ll.h index f4a96deffe..55526952c0 100644 --- a/components/esp_hal_pmu/esp32h4/include/hal/pmu_ll.h +++ b/components/esp_hal_pmu/esp32h4/include/hal/pmu_ll.h @@ -578,13 +578,6 @@ FORCE_INLINE_ATTR void pmu_ll_hp_set_memory_power_on_mask(pmu_dev_t *hw, uint32_ hw->power.mem_mask.mem2_mask = (mem_mask & BIT(2)) ? 1 : 0; } -FORCE_INLINE_ATTR void pmu_ll_hp_set_memory_power_off_mask(pmu_dev_t *hw, uint32_t mem0_pd_mask, uint32_t mem1_pd_mask, uint32_t mem2_pd_mask) -{ - hw->power.mem_mask.mem0_pd_mask = mem0_pd_mask; - hw->power.mem_mask.mem1_pd_mask = mem1_pd_mask; - hw->power.mem_mask.mem2_pd_mask = mem2_pd_mask; -} - FORCE_INLINE_ATTR void pmu_ll_hp_set_vdd_flash_tiel_enable(pmu_dev_t *hw, bool enable) { hw->power.vdd_flash.ldo_tiel_en = enable; diff --git a/components/esp_hw_support/port/esp32h21/pmu_sleep.c b/components/esp_hw_support/port/esp32h21/pmu_sleep.c index e5587c3725..76b73a0abf 100644 --- a/components/esp_hw_support/port/esp32h21/pmu_sleep.c +++ b/components/esp_hw_support/port/esp32h21/pmu_sleep.c @@ -178,6 +178,7 @@ const pmu_sleep_config_t* pmu_sleep_config_default( analog_default.lp_sys[LP(SLEEP)].analog.pd_cur = PMU_PD_CUR_SLEEP_ON; analog_default.lp_sys[LP(SLEEP)].analog.bias_sleep = PMU_BIASSLP_SLEEP_ON; analog_default.lp_sys[LP(SLEEP)].analog.dbias = get_act_lp_dbias(); + analog_default.lp_sys[LP(SLEEP)].analog.dcm_vset = 20; } else if (!(sleep_flags & PMU_SLEEP_PD_RC_FAST)) { analog_default.hp_sys.analog.drv_b = get_act_hp_drvb(); analog_default.lp_sys[LP(SLEEP)].analog.dbias = get_act_lp_dbias(); diff --git a/components/esp_hw_support/port/esp32h4/pmu_sleep.c b/components/esp_hw_support/port/esp32h4/pmu_sleep.c index 505138d7d6..6de6b180dc 100644 --- a/components/esp_hw_support/port/esp32h4/pmu_sleep.c +++ b/components/esp_hw_support/port/esp32h4/pmu_sleep.c @@ -153,7 +153,9 @@ const pmu_sleep_config_t* pmu_sleep_config_default( config->digital = digital_default; pmu_sleep_analog_config_t analog_default = PMU_SLEEP_ANALOG_LSLP_CONFIG_DEFAULT(sleep_flags); - analog_default.hp_sys.analog.drv_b = PMU_HP_DRVB_LIGHTSLEEP; + if (sleep_flags & PMU_SLEEP_PD_TOP) { + analog_default.hp_sys.analog.drv_b = PMU_HP_DRVB_LIGHTSLEEP_TOP_PD; + } analog_default.lp_sys[LP(SLEEP)].analog.dbias = get_slp_lp_dbias(); if (!(sleep_flags & PMU_SLEEP_PD_XTAL)){ analog_default.hp_sys.analog.xpd_trx = PMU_XPD_TRX_SLEEP_ON; @@ -164,6 +166,7 @@ const pmu_sleep_config_t* pmu_sleep_config_default( analog_default.lp_sys[LP(SLEEP)].analog.pd_cur = PMU_PD_CUR_SLEEP_ON; analog_default.lp_sys[LP(SLEEP)].analog.bias_sleep = PMU_BIASSLP_SLEEP_ON; analog_default.lp_sys[LP(SLEEP)].analog.dbias = get_act_lp_dbias(); + analog_default.lp_sys[LP(SLEEP)].analog.dcm_vset = 20; } else if (!(sleep_flags & PMU_SLEEP_PD_RC_FAST)) { analog_default.hp_sys.analog.drv_b = get_act_hp_drvb(); analog_default.lp_sys[LP(SLEEP)].analog.dbias = get_act_lp_dbias(); @@ -214,6 +217,7 @@ static void pmu_sleep_analog_init(pmu_context_t *ctx, const pmu_sleep_analog_con pmu_ll_hp_set_regulator_xpd (ctx->hal->dev, HP(SLEEP), analog->hp_sys.analog.xpd); pmu_ll_hp_set_regulator_driver_bar (ctx->hal->dev, HP(SLEEP), analog->hp_sys.analog.drv_b); pmu_ll_hp_set_trx_xpd (ctx->hal->dev, HP(SLEEP), analog->hp_sys.analog.xpd_trx); + pmu_ll_hp_set_discnnt_dig_rtc (ctx->hal->dev, HP(SLEEP), analog->hp_sys.analog.discnnt_dig_rtc); pmu_ll_lp_set_current_power_off (ctx->hal->dev, LP(SLEEP), analog->lp_sys[LP(SLEEP)].analog.pd_cur); pmu_ll_lp_set_bias_sleep_enable (ctx->hal->dev, LP(SLEEP), analog->lp_sys[LP(SLEEP)].analog.bias_sleep); @@ -222,6 +226,7 @@ static void pmu_sleep_analog_init(pmu_context_t *ctx, const pmu_sleep_analog_con pmu_ll_lp_set_regulator_sleep_dbias(ctx->hal->dev, LP(SLEEP), analog->lp_sys[LP(SLEEP)].analog.slp_dbias); pmu_ll_lp_set_regulator_dbias (ctx->hal->dev, LP(SLEEP), analog->lp_sys[LP(SLEEP)].analog.dbias); pmu_ll_lp_set_regulator_driver_bar (ctx->hal->dev, LP(SLEEP), analog->lp_sys[LP(SLEEP)].analog.drv_b); + pmu_ll_lp_set_discnnt_dig_rtc (ctx->hal->dev, LP(SLEEP), analog->lp_sys[LP(SLEEP)].analog.discnnt_dig_rtc); pmu_ll_hp_set_dcm_mode (ctx->hal->dev, HP(SLEEP), analog->hp_sys.analog.dcm_mode); pmu_ll_hp_set_dcm_vset (ctx->hal->dev, HP(SLEEP), analog->hp_sys.analog.dcm_vset); diff --git a/components/esp_hw_support/port/esp32h4/private_include/pmu_param.h b/components/esp_hw_support/port/esp32h4/private_include/pmu_param.h index 144af0a46a..dc0ae173c7 100644 --- a/components/esp_hw_support/port/esp32h4/private_include/pmu_param.h +++ b/components/esp_hw_support/port/esp32h4/private_include/pmu_param.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -27,18 +27,19 @@ extern "C" { // FOR BOTH LIGHTSLEEP & DEEPSLEEP #define PMU_PD_CUR_SLEEP_DEFAULT 1 #define PMU_BIASSLP_SLEEP_DEFAULT 1 -#define PMU_LP_XPD_SLEEP_DEFAULT 1 #define PMU_LP_SLP_XPD_SLEEP_DEFAULT 0 #define PMU_LP_SLP_DBIAS_SLEEP_DEFAULT 0 // FOR LIGHTSLEEP -#define PMU_HP_DRVB_LIGHTSLEEP 0 +#define PMU_HP_DRVB_LIGHTSLEEP_TOP_PU 25 +#define PMU_HP_DRVB_LIGHTSLEEP_TOP_PD 23 #define PMU_LP_DRVB_LIGHTSLEEP 0 #define PMU_HP_XPD_LIGHTSLEEP 1 +#define PMU_LP_XPD_LIGHTSLEEP_DEFAULT 1 #define PMU_DBG_ATTEN_LIGHTSLEEP_DEFAULT 0 -#define PMU_HP_DBIAS_LIGHTSLEEP_0V6_DEFAULT 1 -#define PMU_LP_DBIAS_LIGHTSLEEP_0V7_DEFAULT 12 +#define PMU_HP_DBIAS_LIGHTSLEEP_0V6_DEFAULT 0 +#define PMU_LP_DBIAS_LIGHTSLEEP_0V7_DEFAULT 3 #define PMU_REGDMA_S2A_WORK_TIME_PD_TOP_US 0 // The current value of this depends on the restoration time overhead of the longest chain in regdma @@ -48,9 +49,9 @@ extern "C" { #define PMU_DBG_HP_DEEPSLEEP 0 #define PMU_HP_XPD_DEEPSLEEP 0 #define PMU_LP_DRVB_DEEPSLEEP 0 - +#define PMU_LP_XPD_DEEPSLEEP_DEFAULT 0 #define PMU_DBG_ATTEN_DEEPSLEEP_DEFAULT 12 -#define PMU_LP_DBIAS_SLEEP_0V7_DEFAULT 23 +#define PMU_LP_DBIAS_SLEEP_0V7_DEFAULT 3 uint32_t get_act_hp_drvb(void); uint32_t get_act_lp_dbias(void); @@ -330,8 +331,7 @@ typedef struct { }, \ .lp_sys[PMU_MODE_LP_SLEEP] = { \ .dig_power = { \ - /* TODO: PM-638 */\ - .vdd_io_mode = 0, \ + .vdd_io_mode = 3, \ .bod_source_sel = 0, \ .vddbat_mode = 0, \ .peri_pd_en = ((sleep_flags) & PMU_SLEEP_PD_LP_PERIPH) ? 1 : 0,\ @@ -391,8 +391,9 @@ typedef struct { .dcm_mode = 3, \ .discnnt_dig_rtc = 0, \ .xpd_trx = 0, \ + .xpd_bias = 0, \ .power_det_bypass = 0, \ - .drv_b = PMU_HP_DRVB_LIGHTSLEEP, \ + .drv_b = PMU_HP_DRVB_LIGHTSLEEP_TOP_PU, \ .pd_cur = PMU_PD_CUR_SLEEP_DEFAULT, \ .bias_sleep = PMU_BIASSLP_SLEEP_DEFAULT, \ .xpd = PMU_HP_XPD_LIGHTSLEEP, \ @@ -405,7 +406,7 @@ typedef struct { .dcdc_clear_rdy = 0, \ .dig_reg_dpcur_bias = 1, \ .dig_reg_dsfmos = 4, \ - .dcm_vset = 20, \ + .dcm_vset = 0, \ .dcm_mode = 3, \ .discnnt_dig_rtc = 0, \ .drv_b = PMU_LP_DRVB_DEEPSLEEP, \ @@ -413,7 +414,7 @@ typedef struct { .bias_sleep = PMU_BIASSLP_SLEEP_DEFAULT, \ .slp_xpd = PMU_LP_SLP_XPD_SLEEP_DEFAULT, \ .slp_dbias = PMU_LP_SLP_DBIAS_SLEEP_DEFAULT, \ - .xpd = PMU_LP_XPD_SLEEP_DEFAULT, \ + .xpd = PMU_LP_XPD_LIGHTSLEEP_DEFAULT, \ .dbias = PMU_LP_DBIAS_LIGHTSLEEP_0V7_DEFAULT \ } \ } \ @@ -426,7 +427,7 @@ typedef struct { .dcdc_clear_rdy = 0, \ .dig_reg_dpcur_bias = 1, \ .dig_reg_dsfmos = 4, \ - .dcm_vset = 23, \ + .dcm_vset = 20, \ .dcm_mode = 3, \ .discnnt_dig_rtc = 0, \ .xpd_trx = 0, \ @@ -450,7 +451,7 @@ typedef struct { .bias_sleep = PMU_BIASSLP_SLEEP_DEFAULT, \ .slp_xpd = PMU_LP_SLP_XPD_SLEEP_DEFAULT, \ .slp_dbias = PMU_LP_SLP_DBIAS_SLEEP_DEFAULT, \ - .xpd = PMU_LP_XPD_SLEEP_DEFAULT, \ + .xpd = PMU_LP_XPD_DEEPSLEEP_DEFAULT, \ .dbias = PMU_LP_DBIAS_SLEEP_0V7_DEFAULT \ } \ } \