change(esp_wifi): support wifi module retention runtime attach and detach

This commit is contained in:
Li Shuai
2026-05-21 11:46:16 +08:00
committed by BOT
parent 3bef3296c9
commit 0d9587952d
4 changed files with 29 additions and 5 deletions
+12 -1
View File
@@ -316,6 +316,7 @@ void esp_phy_sleep_data_init(void)
{
sleep_retention_module_init_param_t init_param = {
.cbs = { .create = { .handle = sleep_retention_wifi_bb_init, .arg = NULL } },
.attribute = SLEEP_RETENTION_MODULE_ATTR_ATTACH,
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_MODEM)
};
esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_WIFI_BB, &init_param);
@@ -326,12 +327,22 @@ void esp_phy_sleep_data_init(void)
err = sleep_retention_module_allocate(SLEEP_RETENTION_MODULE_WIFI_BB);
if (err != ESP_OK) {
ESP_LOGW(TAG, "failed to allocate sleep retention linked list for wifi bb retention");
return;
}
err = sleep_retention_module_attach(SLEEP_RETENTION_MODULE_WIFI_BB);
if (err != ESP_OK) {
ESP_LOGW(TAG, "failed to attach sleep retention linked list for wifi bb retention");
}
}
void esp_phy_sleep_data_deinit(void)
{
esp_err_t err = sleep_retention_module_free(SLEEP_RETENTION_MODULE_WIFI_BB);
esp_err_t err = sleep_retention_module_detach(SLEEP_RETENTION_MODULE_WIFI_BB);
if (err != ESP_OK) {
ESP_LOGW(TAG, "failed to detach sleep retention linked list for wifi bb retention");
return;
}
err = sleep_retention_module_free(SLEEP_RETENTION_MODULE_WIFI_BB);
if (err != ESP_OK) {
ESP_LOGW(TAG, "failed to free sleep retention linked list for wifi bb retention");
return;