Skip to content

Commit 8555b6c

Browse files
committed
fix(adc): only call esp_pm APIs when CONFIG_PM_ENABLE is enabled
1 parent 6674470 commit 8555b6c

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

components/esp_adc/adc_continuous.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,11 @@ esp_err_t adc_continuous_start(adc_continuous_handle_t handle)
264264
adc_ll_reset_register();
265265
}
266266

267+
#if CONFIG_PM_ENABLE
267268
if (handle->pm_lock) {
268269
ESP_RETURN_ON_ERROR(esp_pm_lock_acquire(handle->pm_lock), ADC_TAG, "acquire pm_lock failed");
269270
}
271+
#endif
270272

271273
handle->fsm = ADC_FSM_STARTED;
272274
sar_periph_ctrl_adc_continuous_power_acquire();
@@ -369,10 +371,12 @@ esp_err_t adc_continuous_stop(adc_continuous_handle_t handle)
369371
}
370372
sar_periph_ctrl_adc_continuous_power_release();
371373

374+
#if CONFIG_PM_ENABLE
372375
//release power manager lock
373376
if (handle->pm_lock) {
374377
ESP_RETURN_ON_ERROR(esp_pm_lock_release(handle->pm_lock), ADC_TAG, "release pm_lock failed");
375378
}
379+
#endif
376380

377381
ANALOG_CLOCK_DISABLE();
378382

@@ -422,9 +426,11 @@ esp_err_t adc_continuous_deinit(adc_continuous_handle_t handle)
422426
free(handle->ringbuf_struct);
423427
}
424428

429+
#if CONFIG_PM_ENABLE
425430
if (handle->pm_lock) {
426431
esp_pm_lock_delete(handle->pm_lock);
427432
}
433+
#endif
428434

429435
free(handle->rx_dma_buf);
430436
free(handle->hal.rx_desc);

components/esp_adc/adc_continuous_internal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ struct adc_continuous_ctx_t {
8989
adc_hal_digi_ctrlr_cfg_t hal_digi_ctrlr_cfg; //Hal digital controller configuration
9090
adc_continuous_evt_cbs_t cbs; //Callbacks
9191
void *user_data; //User context
92+
#if CONFIG_PM_ENABLE
9293
esp_pm_lock_handle_t pm_lock; //For power management
94+
#endif
9395
struct {
9496
uint32_t flush_pool: 1; //Flush the internal pool when the pool is full. With this flag, the `on_pool_ovf` event will not happen.
9597
} flags;

0 commit comments

Comments
 (0)