mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-03 03:31:41 +03:00
Merge branch 'fix/fix_on_rf_regdma_trigger' into 'master'
Fix/fix on rf regdma trigger Closes BLERP-2995 See merge request espressif/esp-idf!51272
This commit is contained in:
@@ -258,7 +258,7 @@ uint32_t sleep_modem_reject_triggers(void)
|
|||||||
{
|
{
|
||||||
uint32_t reject_triggers = 0;
|
uint32_t reject_triggers = 0;
|
||||||
#if SOC_PM_SUPPORT_PMU_MODEM_STATE
|
#if SOC_PM_SUPPORT_PMU_MODEM_STATE
|
||||||
reject_triggers = (s_sleep_modem.phy_link != NULL) ? PMU_MODEM_WAKEUP_PROTECT : 0;
|
reject_triggers = sleep_modem_wifi_modem_state_is_enabled() ? PMU_MODEM_WAKEUP_PROTECT : 0;
|
||||||
#endif /* SOC_PM_SUPPORT_PMU_MODEM_STATE */
|
#endif /* SOC_PM_SUPPORT_PMU_MODEM_STATE */
|
||||||
return reject_triggers;
|
return reject_triggers;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -276,13 +276,16 @@ 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 || CONFIG_ESP_PHY_HW_SWITCH_RF)
|
||||||
|
#include "esp_private/sleep_retention.h"
|
||||||
|
uint8_t s_phy_fe_retention_ref = 0;
|
||||||
|
static _lock_t s_phy_fe_retention_lock;
|
||||||
|
static const char* TAG = "phy_sleep";
|
||||||
|
|
||||||
|
#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
|
#if SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_MAC_BB_PD
|
||||||
|
|
||||||
#include "esp_private/sleep_retention.h"
|
|
||||||
|
|
||||||
static const char* TAG = "phy_sleep";
|
|
||||||
|
|
||||||
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() (130)
|
#define N_REGS_WIFI_AGC() (130)
|
||||||
@@ -353,7 +356,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() (21)
|
#define N_REGS_FE_COEX() (21)
|
||||||
@@ -364,7 +369,6 @@ static esp_err_t sleep_retention_phy_fe_init(void *arg)
|
|||||||
#define REG_FEDATA_BASE 0x600a0400
|
#define REG_FEDATA_BASE 0x600a0400
|
||||||
#define REG_FECTRL_BASE 0x600a0800
|
#define REG_FECTRL_BASE 0x600a0800
|
||||||
#define REG_FEDATAWIFI_BASE 0x600a0c00
|
#define REG_FEDATAWIFI_BASE 0x600a0c00
|
||||||
|
|
||||||
const static sleep_retention_entries_config_t phy_fe_regs_retention[] = {
|
const static sleep_retention_entries_config_t phy_fe_regs_retention[] = {
|
||||||
[0] = { .config = REGDMA_LINK_CONTINUOUS_INIT(REGDMA_MODEM_FE_LINK(0), REG_FECOEX_BASE, REG_FECOEX_BASE, N_REGS_FE_COEX(), 0, 0), .owner = BIT(0) | BIT(1) }, /* FE COEX */
|
[0] = { .config = REGDMA_LINK_CONTINUOUS_INIT(REGDMA_MODEM_FE_LINK(0), REG_FECOEX_BASE, REG_FECOEX_BASE, N_REGS_FE_COEX(), 0, 0), .owner = BIT(0) | BIT(1) }, /* FE COEX */
|
||||||
[1] = { .config = REGDMA_LINK_CONTINUOUS_INIT(REGDMA_MODEM_FE_LINK(1), REG_FEDATA_BASE, REG_FEDATA_BASE, N_REGS_FE_DATA(), 0, 0), .owner = BIT(0) | BIT(1) }, /* FE DATA */
|
[1] = { .config = REGDMA_LINK_CONTINUOUS_INIT(REGDMA_MODEM_FE_LINK(1), REG_FEDATA_BASE, REG_FEDATA_BASE, N_REGS_FE_DATA(), 0, 0), .owner = BIT(0) | BIT(1) }, /* FE DATA */
|
||||||
@@ -377,8 +381,10 @@ 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)
|
||||||
{
|
{
|
||||||
|
_lock_acquire(&s_phy_fe_retention_lock);
|
||||||
|
if (s_phy_fe_retention_ref++ == 0) {
|
||||||
sleep_retention_module_init_param_t init_param = {
|
sleep_retention_module_init_param_t init_param = {
|
||||||
.cbs = { .create = { .handle = sleep_retention_phy_fe_init, .arg = NULL } },
|
.cbs = { .create = { .handle = sleep_retention_phy_fe_init, .arg = NULL } },
|
||||||
.attribute = SLEEP_RETENTION_MODULE_ATTR_PASSIVE | SLEEP_RETENTION_MODULE_ATTR_ATTACH
|
.attribute = SLEEP_RETENTION_MODULE_ATTR_PASSIVE | SLEEP_RETENTION_MODULE_ATTR_ATTACH
|
||||||
@@ -386,16 +392,29 @@ void esp_phy_fe_sleep_data_init(void)
|
|||||||
esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_PHY_FE, &init_param);
|
esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_PHY_FE, &init_param);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
ESP_LOGW(TAG, "PHY FE sleep retention init failed");
|
ESP_LOGW(TAG, "PHY FE sleep retention init failed");
|
||||||
return;
|
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)
|
||||||
{
|
{
|
||||||
|
_lock_acquire(&s_phy_fe_retention_lock);
|
||||||
|
if (s_phy_fe_retention_ref == 0) {
|
||||||
|
_lock_release(&s_phy_fe_retention_lock);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (--s_phy_fe_retention_ref == 0) {
|
||||||
esp_err_t err = sleep_retention_module_deinit(SLEEP_RETENTION_MODULE_PHY_FE);
|
esp_err_t err = sleep_retention_module_deinit(SLEEP_RETENTION_MODULE_PHY_FE);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
ESP_LOGW(TAG, "PHY FE sleep retention deinit failed");
|
ESP_LOGW(TAG, "PHY FE sleep retention deinit failed");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
_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)
|
||||||
|
|||||||
@@ -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)
|
||||||
@@ -223,7 +226,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)
|
||||||
@@ -238,8 +243,10 @@ 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)
|
||||||
{
|
{
|
||||||
|
_lock_acquire(&s_phy_fe_retention_lock);
|
||||||
|
if (s_phy_fe_retention_ref++ == 0) {
|
||||||
sleep_retention_module_init_param_t init_param = {
|
sleep_retention_module_init_param_t init_param = {
|
||||||
.cbs = { .create = { .handle = sleep_retention_phy_fe_init, .arg = NULL } },
|
.cbs = { .create = { .handle = sleep_retention_phy_fe_init, .arg = NULL } },
|
||||||
.attribute = SLEEP_RETENTION_MODULE_ATTR_PASSIVE | SLEEP_RETENTION_MODULE_ATTR_ATTACH
|
.attribute = SLEEP_RETENTION_MODULE_ATTR_PASSIVE | SLEEP_RETENTION_MODULE_ATTR_ATTACH
|
||||||
@@ -247,16 +254,29 @@ void esp_phy_fe_sleep_data_init(void)
|
|||||||
esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_PHY_FE, &init_param);
|
esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_PHY_FE, &init_param);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
ESP_LOGW(TAG, "PHY FE sleep retention init failed");
|
ESP_LOGW(TAG, "PHY FE sleep retention init failed");
|
||||||
return;
|
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)
|
||||||
{
|
{
|
||||||
|
_lock_acquire(&s_phy_fe_retention_lock);
|
||||||
|
if (s_phy_fe_retention_ref == 0) {
|
||||||
|
_lock_release(&s_phy_fe_retention_lock);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (--s_phy_fe_retention_ref == 0) {
|
||||||
esp_err_t err = sleep_retention_module_deinit(SLEEP_RETENTION_MODULE_PHY_FE);
|
esp_err_t err = sleep_retention_module_deinit(SLEEP_RETENTION_MODULE_PHY_FE);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
ESP_LOGW(TAG, "PHY FE sleep retention deinit failed");
|
ESP_LOGW(TAG, "PHY FE sleep retention deinit failed");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
_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)
|
||||||
|
|||||||
@@ -148,13 +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 || CONFIG_ESP_PHY_HW_SWITCH_RF)
|
||||||
#if SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_MAC_BB_PD
|
|
||||||
|
|
||||||
#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() (130)
|
#define N_REGS_WIFI_AGC() (130)
|
||||||
@@ -226,6 +228,9 @@ void esp_phy_sleep_data_deinit(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#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() (21)
|
#define N_REGS_FE_COEX() (21)
|
||||||
@@ -249,8 +254,10 @@ 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)
|
||||||
{
|
{
|
||||||
|
_lock_acquire(&s_phy_fe_retention_lock);
|
||||||
|
if (s_phy_fe_retention_ref++ == 0) {
|
||||||
sleep_retention_module_init_param_t init_param = {
|
sleep_retention_module_init_param_t init_param = {
|
||||||
.cbs = { .create = { .handle = sleep_retention_phy_fe_init, .arg = NULL } },
|
.cbs = { .create = { .handle = sleep_retention_phy_fe_init, .arg = NULL } },
|
||||||
.attribute = SLEEP_RETENTION_MODULE_ATTR_PASSIVE | SLEEP_RETENTION_MODULE_ATTR_ATTACH
|
.attribute = SLEEP_RETENTION_MODULE_ATTR_PASSIVE | SLEEP_RETENTION_MODULE_ATTR_ATTACH
|
||||||
@@ -258,16 +265,29 @@ void esp_phy_fe_sleep_data_init(void)
|
|||||||
esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_PHY_FE, &init_param);
|
esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_PHY_FE, &init_param);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
ESP_LOGW(TAG, "PHY FE sleep retention init failed");
|
ESP_LOGW(TAG, "PHY FE sleep retention init failed");
|
||||||
return;
|
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)
|
||||||
{
|
{
|
||||||
|
_lock_acquire(&s_phy_fe_retention_lock);
|
||||||
|
if (s_phy_fe_retention_ref == 0) {
|
||||||
|
_lock_release(&s_phy_fe_retention_lock);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (--s_phy_fe_retention_ref == 0) {
|
||||||
esp_err_t err = sleep_retention_module_deinit(SLEEP_RETENTION_MODULE_PHY_FE);
|
esp_err_t err = sleep_retention_module_deinit(SLEEP_RETENTION_MODULE_PHY_FE);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
ESP_LOGW(TAG, "PHY FE sleep retention deinit failed");
|
ESP_LOGW(TAG, "PHY FE sleep retention deinit failed");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
_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)
|
||||||
|
|||||||
@@ -154,6 +154,8 @@ const char __attribute__((section(".rodata"))) phy_init_magic_post[] = PHY_INIT_
|
|||||||
#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)
|
#endif // SOC_PM_MODEM_RETENTION_BY_REGDMA && (CONFIG_MAC_BB_PD || CONFIG_ESP_PHY_HW_SWITCH_RF)
|
||||||
|
|
||||||
@@ -240,7 +242,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() (22)
|
#define N_REGS_FE_COEX() (22)
|
||||||
@@ -264,8 +268,10 @@ 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)
|
||||||
{
|
{
|
||||||
|
_lock_acquire(&s_phy_fe_retention_lock);
|
||||||
|
if (s_phy_fe_retention_ref++ == 0) {
|
||||||
sleep_retention_module_init_param_t init_param = {
|
sleep_retention_module_init_param_t init_param = {
|
||||||
.cbs = { .create = { .handle = sleep_retention_phy_fe_init, .arg = NULL } },
|
.cbs = { .create = { .handle = sleep_retention_phy_fe_init, .arg = NULL } },
|
||||||
.attribute = SLEEP_RETENTION_MODULE_ATTR_PASSIVE | SLEEP_RETENTION_MODULE_ATTR_ATTACH
|
.attribute = SLEEP_RETENTION_MODULE_ATTR_PASSIVE | SLEEP_RETENTION_MODULE_ATTR_ATTACH
|
||||||
@@ -273,16 +279,29 @@ void esp_phy_fe_sleep_data_init(void)
|
|||||||
esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_PHY_FE, &init_param);
|
esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_PHY_FE, &init_param);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
ESP_LOGW(TAG, "PHY FE sleep retention init failed");
|
ESP_LOGW(TAG, "PHY FE sleep retention init failed");
|
||||||
return;
|
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)
|
||||||
{
|
{
|
||||||
|
_lock_acquire(&s_phy_fe_retention_lock);
|
||||||
|
if (s_phy_fe_retention_ref == 0) {
|
||||||
|
_lock_release(&s_phy_fe_retention_lock);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (--s_phy_fe_retention_ref == 0) {
|
||||||
esp_err_t err = sleep_retention_module_deinit(SLEEP_RETENTION_MODULE_PHY_FE);
|
esp_err_t err = sleep_retention_module_deinit(SLEEP_RETENTION_MODULE_PHY_FE);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
ESP_LOGW(TAG, "PHY FE sleep retention deinit failed");
|
ESP_LOGW(TAG, "PHY FE sleep retention deinit failed");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
_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)
|
||||||
|
|||||||
@@ -300,20 +300,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
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -71,6 +71,9 @@ static esp_err_t btbb_sleep_retention_enable(void)
|
|||||||
.attribute = SLEEP_RETENTION_MODULE_ATTR_ATTACH,
|
.attribute = SLEEP_RETENTION_MODULE_ATTR_ATTACH,
|
||||||
};
|
};
|
||||||
init_param.depends.bitmap[SLEEP_RETENTION_MODULE_CLOCK_MODEM >> 5] |= BIT(SLEEP_RETENTION_MODULE_CLOCK_MODEM % 32);
|
init_param.depends.bitmap[SLEEP_RETENTION_MODULE_CLOCK_MODEM >> 5] |= BIT(SLEEP_RETENTION_MODULE_CLOCK_MODEM % 32);
|
||||||
|
#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
|
||||||
#if SOC_PM_MODEM_LOCK_CLK_WORKAROUND && CONFIG_BT_CTRL_SLEEP_ENABLE
|
#if SOC_PM_MODEM_LOCK_CLK_WORKAROUND && CONFIG_BT_CTRL_SLEEP_ENABLE
|
||||||
init_param.depends.bitmap[SLEEP_RETENTION_MODULE_POWER >> 5] |= BIT(SLEEP_RETENTION_MODULE_POWER % 32);
|
init_param.depends.bitmap[SLEEP_RETENTION_MODULE_POWER >> 5] |= BIT(SLEEP_RETENTION_MODULE_POWER % 32);
|
||||||
#endif
|
#endif
|
||||||
@@ -98,9 +101,20 @@ 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 = btbb_sleep_retention_enable();
|
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
|
||||||
|
err = btbb_sleep_retention_enable();
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
btbb_sleep_retention_disable();
|
btbb_sleep_retention_disable();
|
||||||
|
#if CONFIG_ESP_PHY_HW_SWITCH_RF
|
||||||
|
esp_phy_fe_sleep_data_deinit();
|
||||||
|
#endif // CONFIG_ESP_PHY_HW_SWITCH_RF
|
||||||
_lock_release(&s_btbb_access_lock);
|
_lock_release(&s_btbb_access_lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -116,6 +130,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_disable();
|
btbb_sleep_retention_disable();
|
||||||
|
#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