mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
fix(phy): add fe dependency when enable rf with regdma
This commit is contained in:
@@ -30,6 +30,17 @@ typedef struct {
|
|||||||
#define RETENTION_MODULE_BITMAP_INIT(module) { .bitmap[(SLEEP_RETENTION_MODULE_ ## module) >> 5] = BIT((SLEEP_RETENTION_MODULE_ ## module) % 32) }
|
#define RETENTION_MODULE_BITMAP_INIT(module) { .bitmap[(SLEEP_RETENTION_MODULE_ ## module) >> 5] = BIT((SLEEP_RETENTION_MODULE_ ## module) % 32) }
|
||||||
uint32_t bitmap[SLEEP_RETENTION_MODULE_BITMAP_SZ];
|
uint32_t bitmap[SLEEP_RETENTION_MODULE_BITMAP_SZ];
|
||||||
} sleep_retention_module_bitmap_t;
|
} sleep_retention_module_bitmap_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set a bit in the retention module bitmap
|
||||||
|
*
|
||||||
|
* @param bitmap_ptr Pointer to the bitmap structure
|
||||||
|
* @param module Module number (e.g., SLEEP_RETENTION_MODULE_SYS_PERIPH)
|
||||||
|
*/
|
||||||
|
#define RETENTION_MODULE_BITMAP_SET(bitmap_ptr, module) \
|
||||||
|
do { \
|
||||||
|
(bitmap_ptr)->bitmap[(module) >> 5] |= BIT((module) % 32); \
|
||||||
|
} while (0)
|
||||||
typedef regdma_entry_buf_t sleep_retention_entries_t;
|
typedef regdma_entry_buf_t sleep_retention_entries_t;
|
||||||
typedef regdma_entries_config_t sleep_retention_entries_config_t;
|
typedef regdma_entries_config_t sleep_retention_entries_config_t;
|
||||||
|
|
||||||
|
|||||||
@@ -148,12 +148,15 @@ const esp_phy_init_data_t phy_init_data= { {
|
|||||||
|
|
||||||
const char __attribute__((section(".rodata"))) phy_init_magic_post[] = PHY_INIT_MAGIC;
|
const char __attribute__((section(".rodata"))) phy_init_magic_post[] = PHY_INIT_MAGIC;
|
||||||
|
|
||||||
#if SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_MAC_BB_PD
|
#if SOC_PM_MODEM_RETENTION_BY_REGDMA && (CONFIG_MAC_BB_PD || CONFIG_ESP_PHY_HW_SWITCH_RF)
|
||||||
|
|
||||||
#include "esp_private/sleep_retention.h"
|
#include "esp_private/sleep_retention.h"
|
||||||
|
|
||||||
static const char* TAG = "phy_sleep";
|
static const char* TAG = "phy_sleep";
|
||||||
|
static _lock_t s_phy_fe_retention_lock;
|
||||||
|
uint8_t s_phy_fe_retention_ref = 0;
|
||||||
|
#endif // SOC_PM_MODEM_RETENTION_BY_REGDMA && (CONFIG_MAC_BB_PD || CONFIG_ESP_PHY_HW_SWITCH_RF)
|
||||||
|
|
||||||
|
#if SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_MAC_BB_PD
|
||||||
static esp_err_t sleep_retention_wifi_bb_init(void *arg)
|
static esp_err_t sleep_retention_wifi_bb_init(void *arg)
|
||||||
{
|
{
|
||||||
#define N_REGS_WIFI_AGC() (121)
|
#define N_REGS_WIFI_AGC() (121)
|
||||||
@@ -204,7 +207,9 @@ void esp_phy_sleep_data_deinit(void)
|
|||||||
ESP_LOGW(TAG, "WiFi BB sleep retention deinit failed");
|
ESP_LOGW(TAG, "WiFi BB sleep retention deinit failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif // SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_MAC_BB_PD
|
||||||
|
|
||||||
|
#if SOC_PM_MODEM_RETENTION_BY_REGDMA && (CONFIG_MAC_BB_PD || CONFIG_ESP_PHY_HW_SWITCH_RF)
|
||||||
static esp_err_t sleep_retention_phy_fe_init(void *arg)
|
static esp_err_t sleep_retention_phy_fe_init(void *arg)
|
||||||
{
|
{
|
||||||
#define N_REGS_FE_COEX() (58)
|
#define N_REGS_FE_COEX() (58)
|
||||||
@@ -219,25 +224,40 @@ static esp_err_t sleep_retention_phy_fe_init(void *arg)
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void esp_phy_fe_sleep_data_init(void)
|
esp_err_t esp_phy_fe_sleep_data_init(void)
|
||||||
{
|
{
|
||||||
sleep_retention_module_init_param_t init_param = {
|
_lock_acquire(&s_phy_fe_retention_lock);
|
||||||
.cbs = { .create = { .handle = sleep_retention_phy_fe_init, .arg = NULL } },
|
if (s_phy_fe_retention_ref++ == 0) {
|
||||||
.attribute = SLEEP_RETENTION_MODULE_ATTR_PASSIVE | SLEEP_RETENTION_MODULE_ATTR_ATTACH
|
sleep_retention_module_init_param_t init_param = {
|
||||||
};
|
.cbs = { .create = { .handle = sleep_retention_phy_fe_init, .arg = NULL } },
|
||||||
esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_PHY_FE, &init_param);
|
.attribute = SLEEP_RETENTION_MODULE_ATTR_PASSIVE
|
||||||
if (err != ESP_OK) {
|
};
|
||||||
ESP_LOGW(TAG, "PHY FE sleep retention init failed");
|
esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_PHY_FE, &init_param);
|
||||||
return;
|
if (err != ESP_OK) {
|
||||||
|
ESP_LOGW(TAG, "PHY FE sleep retention init failed");
|
||||||
|
s_phy_fe_retention_ref --;
|
||||||
|
_lock_release(&s_phy_fe_retention_lock);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
_lock_release(&s_phy_fe_retention_lock);
|
||||||
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void esp_phy_fe_sleep_data_deinit(void)
|
void esp_phy_fe_sleep_data_deinit(void)
|
||||||
{
|
{
|
||||||
esp_err_t err = sleep_retention_module_deinit(SLEEP_RETENTION_MODULE_PHY_FE);
|
_lock_acquire(&s_phy_fe_retention_lock);
|
||||||
if (err != ESP_OK) {
|
if (s_phy_fe_retention_ref == 0) {
|
||||||
ESP_LOGW(TAG, "PHY FE sleep retention deinit failed");
|
_lock_release(&s_phy_fe_retention_lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (--s_phy_fe_retention_ref == 0) {
|
||||||
|
esp_err_t err = sleep_retention_module_deinit(SLEEP_RETENTION_MODULE_PHY_FE);
|
||||||
|
if (err != ESP_OK) {
|
||||||
|
ESP_LOGW(TAG, "PHY FE sleep retention deinit failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_lock_release(&s_phy_fe_retention_lock);
|
||||||
}
|
}
|
||||||
#endif // SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_MAC_BB_PD
|
#endif // SOC_PM_MODEM_RETENTION_BY_REGDMA && (CONFIG_MAC_BB_PD || CONFIG_ESP_PHY_HW_SWITCH_RF)
|
||||||
|
|||||||
@@ -281,19 +281,19 @@ void phy_wait_freq_hw_hop_done(void);
|
|||||||
*/
|
*/
|
||||||
void phy_track_temp_debug(uint8_t debug_flag, uint8_t track_temp);
|
void phy_track_temp_debug(uint8_t debug_flag, uint8_t track_temp);
|
||||||
#endif
|
#endif
|
||||||
#if SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_MAC_BB_PD
|
#if SOC_PM_MODEM_RETENTION_BY_REGDMA && (CONFIG_MAC_BB_PD || CONFIG_ESP_PHY_HW_SWITCH_RF)
|
||||||
/**
|
/**
|
||||||
* @brief PHY module common memory (FE) initialize
|
* @brief PHY module common memory (FE) initialize
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void esp_phy_fe_sleep_data_init(void);
|
esp_err_t esp_phy_fe_sleep_data_init(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief PHY module common memory (FE) de-initialize
|
* @brief PHY module common memory (FE) de-initialize
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void esp_phy_fe_sleep_data_deinit(void);
|
void esp_phy_fe_sleep_data_deinit(void);
|
||||||
#endif // SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_MAC_BB_PD
|
#endif // SOC_PM_MODEM_RETENTION_BY_REGDMA && (CONFIG_MAC_BB_PD || CONFIG_ESP_PHY_HW_SWITCH_RF)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,14 +67,28 @@ void esp_btbb_enable(void)
|
|||||||
if (s_btbb_access_ref == 0) {
|
if (s_btbb_access_ref == 0) {
|
||||||
bt_bb_v2_init_cmplx(BTBB_ENABLE_VERSION_PRINT);
|
bt_bb_v2_init_cmplx(BTBB_ENABLE_VERSION_PRINT);
|
||||||
#if SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
#if SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||||
|
esp_err_t err = ESP_OK;
|
||||||
|
#if CONFIG_ESP_PHY_HW_SWITCH_RF
|
||||||
|
err = esp_phy_fe_sleep_data_init();
|
||||||
|
if (err != ESP_OK) {
|
||||||
|
_lock_release(&s_btbb_access_lock);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif // CONFIG_ESP_PHY_HW_SWITCH_RF
|
||||||
sleep_retention_module_init_param_t init_param = {
|
sleep_retention_module_init_param_t init_param = {
|
||||||
.cbs = { .create = { .handle = btbb_sleep_retention_init, .arg = NULL } },
|
.cbs = { .create = { .handle = btbb_sleep_retention_init, .arg = NULL } },
|
||||||
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_MODEM)
|
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_MODEM)
|
||||||
};
|
};
|
||||||
esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_BT_BB, &init_param);
|
#if CONFIG_ESP_PHY_HW_SWITCH_RF
|
||||||
|
init_param.depends.bitmap[SLEEP_RETENTION_MODULE_PHY_FE >> 5] |= BIT(SLEEP_RETENTION_MODULE_PHY_FE % 32);
|
||||||
|
#endif // CONFIG_ESP_PHY_HW_SWITCH_RF
|
||||||
|
err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_BT_BB, &init_param);
|
||||||
if (err == ESP_OK) {
|
if (err == ESP_OK) {
|
||||||
err = sleep_retention_module_allocate(SLEEP_RETENTION_MODULE_BT_BB);
|
err = sleep_retention_module_allocate(SLEEP_RETENTION_MODULE_BT_BB);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
|
#if CONFIG_ESP_PHY_HW_SWITCH_RF
|
||||||
|
esp_phy_fe_sleep_data_deinit();
|
||||||
|
#endif // CONFIG_ESP_PHY_HW_SWITCH_RF
|
||||||
ESP_LOGW(TAG, "failed to allocate sleep retention linked list for btbb retention");
|
ESP_LOGW(TAG, "failed to allocate sleep retention linked list for btbb retention");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -92,6 +106,9 @@ void esp_btbb_disable(void)
|
|||||||
if (s_btbb_access_ref && (--s_btbb_access_ref == 0)) {
|
if (s_btbb_access_ref && (--s_btbb_access_ref == 0)) {
|
||||||
#if SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
#if SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||||
btbb_sleep_retention_deinit();
|
btbb_sleep_retention_deinit();
|
||||||
|
#if CONFIG_ESP_PHY_HW_SWITCH_RF
|
||||||
|
esp_phy_fe_sleep_data_deinit();
|
||||||
|
#endif // CONFIG_ESP_PHY_HW_SWITCH_RF
|
||||||
#endif // SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
#endif // SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||||
}
|
}
|
||||||
_lock_release(&s_btbb_access_lock);
|
_lock_release(&s_btbb_access_lock);
|
||||||
|
|||||||
Reference in New Issue
Block a user