mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
change(pm): move the modem_clock-related code outside SOC_PM_SUPPORT_PMU_MODEM_STATE
This commit is contained in:
parent
29076a43f6
commit
f5487c72ab
@ -70,7 +70,7 @@ void modem_clock_module_disable(periph_module_t module);
|
||||
*/
|
||||
void modem_clock_module_mac_reset(periph_module_t module);
|
||||
|
||||
#if SOC_PMU_SUPPORTED
|
||||
#if SOC_BLE_USE_WIFI_PWR_CLK_WORKAROUND
|
||||
/**
|
||||
* @brief Enable modem clock domain clock gate to gate it's output
|
||||
*
|
||||
|
@ -29,7 +29,9 @@ extern "C" {
|
||||
*/
|
||||
typedef enum {
|
||||
PMU_HP_ICG_MODEM_CODE_SLEEP = 0,
|
||||
#if SOC_PM_SUPPORT_PMU_MODEM_STATE
|
||||
PMU_HP_ICG_MODEM_CODE_MODEM = 1,
|
||||
#endif
|
||||
PMU_HP_ICG_MODEM_CODE_ACTIVE = 2,
|
||||
} pmu_hp_icg_modem_mode_t;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -157,7 +157,7 @@ modem_clock_context_t * __attribute__((weak)) IRAM_ATTR MODEM_CLOCK_instance(voi
|
||||
return &modem_clock_context;
|
||||
}
|
||||
|
||||
#if SOC_PM_SUPPORT_PMU_MODEM_STATE
|
||||
#if SOC_BLE_USE_WIFI_PWR_CLK_WORKAROUND
|
||||
esp_err_t modem_clock_domain_clk_gate_enable(modem_clock_domain_t domain, pmu_hp_icg_modem_mode_t mode)
|
||||
{
|
||||
if (domain >= MODEM_CLOCK_DOMAIN_MAX || domain < MODEM_CLOCK_DOMAIN_MODEM_APB) {
|
||||
@ -189,7 +189,7 @@ esp_err_t modem_clock_domain_clk_gate_disable(modem_clock_domain_t domain, pmu_h
|
||||
portEXIT_CRITICAL_SAFE(&MODEM_CLOCK_instance()->lock);
|
||||
return ESP_OK;
|
||||
}
|
||||
#endif // #if SOC_PM_SUPPORT_PMU_MODEM_STATE
|
||||
#endif // #if SOC_BLE_USE_WIFI_PWR_CLK_WORKAROUND
|
||||
|
||||
static void IRAM_ATTR modem_clock_device_enable(modem_clock_context_t *ctx, uint32_t dev_map)
|
||||
{
|
||||
@ -290,12 +290,13 @@ static IRAM_ATTR uint32_t modem_clock_get_module_deps(periph_module_t module)
|
||||
return deps;
|
||||
}
|
||||
|
||||
#if SOC_PM_SUPPORT_PMU_MODEM_STATE
|
||||
/* the ICG code's bit 0, 1 and 2 indicates the ICG state
|
||||
* of pmu SLEEP, MODEM and ACTIVE mode respectively */
|
||||
#define ICG_NOGATING_SLEEP (BIT(PMU_HP_ICG_MODEM_CODE_SLEEP))
|
||||
#define ICG_NOGATING_MODEM (BIT(PMU_HP_ICG_MODEM_CODE_MODEM))
|
||||
#define ICG_NOGATING_ACTIVE (BIT(PMU_HP_ICG_MODEM_CODE_ACTIVE))
|
||||
#define ICG_NOGATING_SLEEP (BIT(PMU_HP_ICG_MODEM_CODE_SLEEP))
|
||||
#if SOC_PM_SUPPORT_PMU_MODEM_STATE
|
||||
#define ICG_NOGATING_MODEM (BIT(PMU_HP_ICG_MODEM_CODE_MODEM))
|
||||
#endif
|
||||
|
||||
static const DRAM_ATTR uint32_t initial_gating_mode[MODEM_CLOCK_DOMAIN_MAX] = {
|
||||
[MODEM_CLOCK_DOMAIN_MODEM_APB] = ICG_NOGATING_ACTIVE | ICG_NOGATING_MODEM,
|
||||
@ -315,8 +316,10 @@ static IRAM_ATTR void modem_clock_module_icg_map_init_all(void)
|
||||
{
|
||||
portENTER_CRITICAL_SAFE(&MODEM_CLOCK_instance()->lock);
|
||||
for (int domain = 0; domain < MODEM_CLOCK_DOMAIN_MAX; domain++) {
|
||||
#if !CONFIG_IDF_TARGET_ESP32H2 //TODO: ESP32H2 need icg
|
||||
uint32_t code = modem_clock_hal_get_clock_domain_icg_bitmap(MODEM_CLOCK_instance()->hal, domain);
|
||||
modem_clock_hal_set_clock_domain_icg_bitmap(MODEM_CLOCK_instance()->hal, domain, initial_gating_mode[domain] | code);
|
||||
#endif
|
||||
}
|
||||
portEXIT_CRITICAL_SAFE(&MODEM_CLOCK_instance()->lock);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ typedef struct {
|
||||
modem_lpcon_dev_t *lpcon_dev;
|
||||
} modem_clock_hal_context_t;
|
||||
|
||||
#if MAC_SUPPORT_PMU_MODEM_STATE
|
||||
#if !CONFIG_IDF_TARGET_ESP32H2 //TODO: PM-
|
||||
void modem_clock_hal_set_clock_domain_icg_bitmap(modem_clock_hal_context_t *hal, modem_clock_domain_t domain, uint32_t bitmap);
|
||||
uint32_t modem_clock_hal_get_clock_domain_icg_bitmap(modem_clock_hal_context_t *hal, modem_clock_domain_t domain);
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user