5050#endif
5151#include "hal/efuse_hal.h"
5252
53- #if SOC_PM_MODEM_RETENTION_BY_REGDMA
54- #include "esp_private/sleep_retention.h"
55- #endif
56-
5753#if CONFIG_IDF_TARGET_ESP32
5854extern wifi_mac_time_update_cb_t s_wifi_mac_time_update_cb ;
5955#endif
@@ -484,48 +480,6 @@ static uint32_t* s_mac_bb_pd_mem = NULL;
484480static uint8_t s_macbb_backup_mem_ref = 0 ;
485481/* Reference of powering down MAC and BB */
486482static bool s_mac_bb_pu = true;
487- #elif SOC_PM_MODEM_RETENTION_BY_REGDMA
488- static esp_err_t sleep_retention_wifi_bb_init (void * arg )
489- {
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
509- const static sleep_retention_entries_config_t bb_regs_retention [] = {
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 */
515- #ifndef SOC_PM_RETENTION_HAS_CLOCK_BUG
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 */
522- #endif
523- };
524- esp_err_t err = sleep_retention_entries_create (bb_regs_retention , ARRAY_SIZE (bb_regs_retention ), 3 , SLEEP_RETENTION_MODULE_WIFI_BB );
525- ESP_RETURN_ON_ERROR (err , TAG , "failed to allocate memory for modem (%s) retention" , "WiFi BB" );
526- ESP_LOGD (TAG , "WiFi BB sleep retention initialization" );
527- return ESP_OK ;
528- }
529483#endif // SOC_PM_MODEM_RETENTION_BY_BACKUPDMA
530484
531485void esp_mac_bb_pd_mem_init (void )
@@ -538,19 +492,7 @@ void esp_mac_bb_pd_mem_init(void)
538492 }
539493 _lock_release (& s_phy_access_lock );
540494#elif SOC_PM_MODEM_RETENTION_BY_REGDMA
541- sleep_retention_module_init_param_t init_param = {
542- .cbs = { .create = { .handle = sleep_retention_wifi_bb_init , .arg = NULL } },
543- .depends = RETENTION_MODULE_BITMAP_INIT (CLOCK_MODEM )
544- };
545- esp_err_t err = sleep_retention_module_init (SLEEP_RETENTION_MODULE_WIFI_BB , & init_param );
546- if (err != ESP_OK ) {
547- ESP_LOGW (TAG , "WiFi BB sleep retention init failed" );
548- return ;
549- }
550- err = sleep_retention_module_allocate (SLEEP_RETENTION_MODULE_WIFI_BB );
551- if (err != ESP_OK ) {
552- ESP_LOGW (TAG , "failed to allocate sleep retention linked list for wifi bb retention" );
553- }
495+ esp_phy_sleep_data_init ();
554496#endif
555497}
556498
@@ -565,15 +507,7 @@ void esp_mac_bb_pd_mem_deinit(void)
565507 }
566508 _lock_release (& s_phy_access_lock );
567509#elif SOC_PM_MODEM_RETENTION_BY_REGDMA
568- esp_err_t err = sleep_retention_module_free (SLEEP_RETENTION_MODULE_WIFI_BB );
569- if (err != ESP_OK ) {
570- ESP_LOGW (TAG , "failed to free sleep retention linked list for wifi bb retention" );
571- return ;
572- }
573- err = sleep_retention_module_deinit (SLEEP_RETENTION_MODULE_WIFI_BB );
574- if (err != ESP_OK ) {
575- ESP_LOGW (TAG , "WiFi BB sleep retention deinit failed" );
576- }
510+ esp_phy_sleep_data_deinit ();
577511#endif
578512}
579513
0 commit comments