Skip to content

Commit 2fce894

Browse files
committed
change(esp_phy): fix some wifi power save issues and optimize phy sleep for esp32c5 eco1 and beta5
1 parent e8d96c7 commit 2fce894

File tree

7 files changed

+54
-18
lines changed

7 files changed

+54
-18
lines changed

components/esp_hw_support/linker.lf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,5 @@ archive: libsoc.a
4848
entries:
4949
if PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP && ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND:
5050
gpio_periph: GPIO_HOLD_MASK (noflash)
51+
if PM_SLP_IRAM_OPT = y && SOC_TEMP_SENSOR_SUPPORTED = y:
52+
temperature_sensor_periph:temperature_sensor_attributes (noflash)

components/esp_hw_support/port/esp32c5/private_include/pmu_param.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ typedef struct pmu_sleep_machine_constant {
438438
} lp;
439439
struct {
440440
uint16_t min_slp_time_us; /* Minimum sleep protection time (unit: microsecond) */
441-
uint16_t clock_domain_sync_time_us; /* The Slow OSC clock domain synchronizes time with the Fast OSC domain, at least 4 slow clock cycles (unit: microsecond) */
441+
uint16_t clock_domain_sync_time_us; /* Synchronizing the rtc clock timer to modem system requires at least 1 us (unit: microsecond) */
442442
uint16_t system_dfs_up_work_time_us; /* System DFS up scaling work time (unit: microsecond) */
443443
uint16_t analog_wait_time_us; /* HP LDO power up wait time (unit: microsecond) */
444444
uint8_t isolate_wait_time_us; /* Waiting for all isolate signals to be ready (unit: microsecond) */
@@ -471,19 +471,19 @@ typedef struct pmu_sleep_machine_constant {
471471
}, \
472472
.hp = { \
473473
.min_slp_time_us = 450, \
474-
.clock_domain_sync_time_us = 150, \
474+
.clock_domain_sync_time_us = 2, \
475475
.system_dfs_up_work_time_us = 124, \
476476
.analog_wait_time_us = 154, \
477477
.isolate_wait_time_us = 1, \
478478
.reset_wait_time_us = 1, \
479479
.power_supply_wait_time_us = 2, \
480480
.power_up_wait_time_us = 2, \
481-
.regdma_s2m_work_time_us = 172, \
482-
.regdma_s2a_work_time_us = 480, \
483-
.regdma_m2a_work_time_us = 278, \
484-
.regdma_a2s_work_time_us = 382, \
485-
.regdma_rf_on_work_time_us = 70, \
486-
.regdma_rf_off_work_time_us = 23, \
481+
.regdma_s2m_work_time_us = 275, \
482+
.regdma_s2a_work_time_us = 587, \
483+
.regdma_m2a_work_time_us = 320, \
484+
.regdma_a2s_work_time_us = 494, \
485+
.regdma_rf_on_work_time_us = 60, \
486+
.regdma_rf_off_work_time_us = 25, \
487487
.xtal_wait_stable_time_us = 250, \
488488
.pll_wait_stable_time_us = 300 \
489489
} \

components/esp_phy/linker.lf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ entries:
2929
phy_init:esp_phy_enable (noflash)
3030
phy_init:esp_phy_disable (noflash)
3131
phy_init:esp_wifi_bt_power_domain_off (noflash)
32+
if PM_SLP_IRAM_OPT = y:
33+
phy_override:phy_get_tsens_value (noflash)

components/esp_phy/src/phy_init.c

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -487,16 +487,38 @@ static bool s_mac_bb_pu = true;
487487
#elif SOC_PM_MODEM_RETENTION_BY_REGDMA
488488
static esp_err_t sleep_retention_wifi_bb_init(void *arg)
489489
{
490+
#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32C61
491+
#define N_REGS_WIFI_AGC() (121)
492+
#define N_REGS_WIFI_TX() (14)
493+
#define N_REGS_WIFI_NRX() (136)
494+
#define N_REGS_WIFI_BB() (53)
495+
#define N_REGS_WIFI_BRX() (39)
496+
#define N_REGS_WIFI_FE_COEX() (58)
497+
#define N_REGS_WIFI_FE_DATA() (41)
498+
#define N_REGS_WIFI_FE_CTRL() (87)
499+
#elif CONFIG_IDF_TARGET_ESP32C5
500+
#define N_REGS_WIFI_AGC() (126)
501+
#define N_REGS_WIFI_TX() (20)
502+
#define N_REGS_WIFI_NRX() (141)
503+
#define N_REGS_WIFI_BB() (63)
504+
#define N_REGS_WIFI_BRX() (39)
505+
#define N_REGS_WIFI_FE_COEX() (19)
506+
#define N_REGS_WIFI_FE_DATA() (31)
507+
#define N_REGS_WIFI_FE_CTRL() (55)
508+
#endif
490509
const static sleep_retention_entries_config_t bb_regs_retention[] = {
491-
[0] = { .config = REGDMA_LINK_CONTINUOUS_INIT(0x0b00, 0x600a7000, 0x600a7000, 121, 0, 0), .owner = BIT(0) | BIT(1) }, /* AGC */
492-
[1] = { .config = REGDMA_LINK_CONTINUOUS_INIT(0x0b01, 0x600a7400, 0x600a7400, 14, 0, 0), .owner = BIT(0) | BIT(1) }, /* TX */
493-
[2] = { .config = REGDMA_LINK_CONTINUOUS_INIT(0x0b02, 0x600a7800, 0x600a7800, 136, 0, 0), .owner = BIT(0) | BIT(1) }, /* NRX */
494-
[3] = { .config = REGDMA_LINK_CONTINUOUS_INIT(0x0b03, 0x600a7c00, 0x600a7c00, 53, 0, 0), .owner = BIT(0) | BIT(1) }, /* BB */
495-
[4] = { .config = REGDMA_LINK_CONTINUOUS_INIT(0x0b05, 0x600a0000, 0x600a0000, 58, 0, 0), .owner = BIT(0) | BIT(1) }, /* FE COEX */
510+
[0] = { .config = REGDMA_LINK_CONTINUOUS_INIT(0x0b00, 0x600a7000, 0x600a7000, N_REGS_WIFI_AGC(), 0, 0), .owner = BIT(0) | BIT(1) }, /* AGC */
511+
[1] = { .config = REGDMA_LINK_CONTINUOUS_INIT(0x0b01, 0x600a7400, 0x600a7400, N_REGS_WIFI_TX(), 0, 0), .owner = BIT(0) | BIT(1) }, /* TX */
512+
[2] = { .config = REGDMA_LINK_CONTINUOUS_INIT(0x0b02, 0x600a7800, 0x600a7800, N_REGS_WIFI_NRX(), 0, 0), .owner = BIT(0) | BIT(1) }, /* NRX */
513+
[3] = { .config = REGDMA_LINK_CONTINUOUS_INIT(0x0b03, 0x600a7c00, 0x600a7c00, N_REGS_WIFI_BB(), 0, 0), .owner = BIT(0) | BIT(1) }, /* BB */
514+
[4] = { .config = REGDMA_LINK_CONTINUOUS_INIT(0x0b05, 0x600a0000, 0x600a0000, N_REGS_WIFI_FE_COEX(), 0, 0), .owner = BIT(0) | BIT(1) }, /* FE COEX */
496515
#ifndef SOC_PM_RETENTION_HAS_CLOCK_BUG
497-
[5] = { .config = REGDMA_LINK_CONTINUOUS_INIT(0x0b06, 0x600a8000, 0x000a8000, 39, 0, 0), .owner = BIT(0) | BIT(1) }, /* BRX */
498-
[6] = { .config = REGDMA_LINK_CONTINUOUS_INIT(0x0b07, 0x600a0400, 0x600a0400, 41, 0, 0), .owner = BIT(0) | BIT(1) }, /* FE DATA */
499-
[7] = { .config = REGDMA_LINK_CONTINUOUS_INIT(0x0b08, 0x600a0800, 0x600a0800, 87, 0, 0), .owner = BIT(0) | BIT(1) } /* FE CTRL */
516+
[5] = { .config = REGDMA_LINK_CONTINUOUS_INIT(0x0b06, 0x600a8000, 0x600a8000, N_REGS_WIFI_BRX(), 0, 0), .owner = BIT(0) | BIT(1) }, /* BRX */
517+
[6] = { .config = REGDMA_LINK_CONTINUOUS_INIT(0x0b07, 0x600a0400, 0x600a0400, N_REGS_WIFI_FE_DATA(), 0, 0), .owner = BIT(0) | BIT(1) }, /* FE DATA */
518+
[7] = { .config = REGDMA_LINK_CONTINUOUS_INIT(0x0b08, 0x600a0800, 0x600a0800, N_REGS_WIFI_FE_CTRL(), 0, 0), .owner = BIT(0) | BIT(1) }, /* FE CTRL */
519+
#endif
520+
#if CONFIG_IDF_TARGET_ESP32C5
521+
[8] = { .config = REGDMA_LINK_CONTINUOUS_INIT(0x0b09, 0x600a0c00, 0x600a0c00, 20, 0, 0), .owner = BIT(0) | BIT(1) } /* FE WIFI DATA */
500522
#endif
501523
};
502524
esp_err_t err = sleep_retention_entries_create(bb_regs_retention, ARRAY_SIZE(bb_regs_retention), 3, SLEEP_RETENTION_MODULE_WIFI_BB);

components/esp_pm/linker.lf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ entries:
3939
sleep_modem:modem_domain_pd_allowed (noflash)
4040
sleep_modem:periph_inform_out_light_sleep_overhead (noflash)
4141
sar_periph_ctrl:sar_periph_ctrl_power_disable (noflash)
42+
if SOC_TEMP_SENSOR_SUPPORTED = y:
43+
sar_periph_ctrl_common:temperature_sensor_power_acquire (noflash)
44+
sar_periph_ctrl_common:temperature_sensor_power_release (noflash)
45+
sar_periph_ctrl_common:temperature_sensor_get_raw_value (noflash)
46+
sar_periph_ctrl_common:temp_sensor_get_raw_value (noflash)
47+
regi2c_ctrl:regi2c_saradc_enable (noflash)
48+
regi2c_ctrl:regi2c_saradc_disable (noflash)
49+
if SOC_ADC_SUPPORTED = y:
50+
adc_share_hw_ctrl:adc_apb_periph_claim (noflash)
51+
adc_share_hw_ctrl:adc_apb_periph_free (noflash)
4252

4353
[mapping:esp_system_pm]
4454
archive: libesp_system.a

0 commit comments

Comments
 (0)