mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
modem clock: provide a protected wifipwr clock enable/disable interface to fix the bug of selecting xtal as the low power clock source for ble
This commit is contained in:
parent
9950b6a527
commit
21781b1ab1
@ -324,7 +324,7 @@ void modem_clock_select_lp_clock_source(periph_module_t module, modem_clock_lpcl
|
||||
modem_clock_hal_deselect_all_wifi_lpclk_source(MODEM_CLOCK_instance()->hal);
|
||||
modem_clock_hal_select_wifi_lpclk_source(MODEM_CLOCK_instance()->hal, src);
|
||||
modem_lpcon_ll_set_wifi_lpclk_divisor_value(MODEM_CLOCK_instance()->hal->lpcon_dev, divider);
|
||||
modem_lpcon_ll_enable_wifipwr_clock(MODEM_CLOCK_instance()->hal->lpcon_dev, true);
|
||||
modem_clock_hal_enable_wifipwr_clock(MODEM_CLOCK_instance()->hal, true);
|
||||
break;
|
||||
#endif // SOC_WIFI_SUPPORTED
|
||||
|
||||
@ -377,7 +377,7 @@ void modem_clock_deselect_lp_clock_source(periph_module_t module)
|
||||
#if SOC_WIFI_SUPPORTED
|
||||
case PERIPH_WIFI_MODULE:
|
||||
modem_clock_hal_deselect_all_wifi_lpclk_source(MODEM_CLOCK_instance()->hal);
|
||||
modem_lpcon_ll_enable_wifipwr_clock(MODEM_CLOCK_instance()->hal->lpcon_dev, false);
|
||||
modem_clock_hal_enable_wifipwr_clock(MODEM_CLOCK_instance()->hal, false);
|
||||
break;
|
||||
#endif // SOC_WIFI_SUPPORTED
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "esp_attr.h"
|
||||
#include "hal/modem_clock_hal.h"
|
||||
#include "hal/modem_clock_types.h"
|
||||
#include "hal/efuse_hal.h"
|
||||
#include "hal/assert.h"
|
||||
|
||||
typedef enum {
|
||||
@ -239,3 +240,22 @@ void modem_clock_hal_select_wifi_lpclk_source(modem_clock_hal_context_t *hal, mo
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void modem_clock_hal_enable_wifipwr_clock(modem_clock_hal_context_t *hal, bool enable)
|
||||
{
|
||||
if (efuse_hal_chip_revision() == 0) { /* eco0 */
|
||||
modem_lpcon_ll_enable_wifipwr_clock(hal->lpcon_dev, enable);
|
||||
} else {
|
||||
static int ref = 0;
|
||||
if (enable) {
|
||||
if (ref++ == 0) {
|
||||
modem_lpcon_ll_enable_wifipwr_clock(hal->lpcon_dev, enable);
|
||||
}
|
||||
} else {
|
||||
if (--ref == 0) {
|
||||
modem_lpcon_ll_enable_wifipwr_clock(hal->lpcon_dev, enable);
|
||||
}
|
||||
}
|
||||
HAL_ASSERT(ref > 0);
|
||||
}
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ void modem_clock_hal_deselect_all_coex_lpclk_source(modem_clock_hal_context_t *h
|
||||
#if SOC_WIFI_SUPPORTED
|
||||
void modem_clock_hal_select_wifi_lpclk_source(modem_clock_hal_context_t *hal, modem_clock_lpclk_src_t src);
|
||||
void modem_clock_hal_deselect_all_wifi_lpclk_source(modem_clock_hal_context_t *hal);
|
||||
void modem_clock_hal_enable_wifipwr_clock(modem_clock_hal_context_t *hal, bool enable);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Loading…
x
Reference in New Issue
Block a user