Skip to content

Commit

Permalink
Merge branch 'bugfix/fix_adc_pm_lock_release_issue' into 'master'
Browse files Browse the repository at this point in the history
esp_adc: fix continuous mode pm lock release fail issue and add tests

Closes IDFGH-9493

See merge request espressif/esp-idf!22535
  • Loading branch information
Icarus113 committed Mar 1, 2023
2 parents 2b401b2 + 53f1c35 commit bbac0c8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
12 changes: 0 additions & 12 deletions components/esp_adc/adc_continuous.c
Expand Up @@ -53,11 +53,6 @@ extern portMUX_TYPE rtc_spinlock; //TODO: Will be placed in the appropriate posi

#define INTERNAL_BUF_NUM 5

#ifdef CONFIG_PM_ENABLE
//Only for deprecated API
extern esp_pm_lock_handle_t adc_digi_arbiter_lock;
#endif //CONFIG_PM_ENABLE

/*---------------------------------------------------------------
ADC Continuous Read Mode (via DMA)
---------------------------------------------------------------*/
Expand Down Expand Up @@ -396,11 +391,6 @@ esp_err_t adc_continuous_stop(adc_continuous_handle_t handle)
adc_hal_digi_stop(&handle->hal);

adc_hal_digi_deinit(&handle->hal);
#if CONFIG_PM_ENABLE
if (handle->pm_lock) {
esp_pm_lock_release(handle->pm_lock);
}
#endif //CONFIG_PM_ENABLE

if (handle->use_adc2) {
adc_lock_release(ADC_UNIT_2);
Expand Down Expand Up @@ -461,11 +451,9 @@ esp_err_t adc_continuous_deinit(adc_continuous_handle_t handle)
free(handle->ringbuf_struct);
}

#if CONFIG_PM_ENABLE
if (handle->pm_lock) {
esp_pm_lock_delete(handle->pm_lock);
}
#endif //CONFIG_PM_ENABLE

free(handle->rx_dma_buf);
free(handle->hal.rx_desc);
Expand Down
2 changes: 2 additions & 0 deletions components/esp_adc/test_apps/adc/pytest_adc.py
Expand Up @@ -15,13 +15,15 @@
@pytest.mark.parametrize('config', [
'iram_safe',
'release',
'pm_enable'
], indirect=True)
def test_adc(dut: Dut) -> None:
dut.expect_exact('Press ENTER to see the list of tests')
dut.write('*')
dut.expect_unity_test_output(timeout=120)


# No PM test, as C2 doesn't support ADC continuous mode
@pytest.mark.esp32c2
@pytest.mark.adc
@pytest.mark.xtal_26mhz
Expand Down
14 changes: 14 additions & 0 deletions components/esp_adc/test_apps/adc/sdkconfig.ci.pm_enable
@@ -0,0 +1,14 @@
CONFIG_COMPILER_DUMP_RTL_FILES=y
CONFIG_ADC_ONESHOT_CTRL_FUNC_IN_IRAM=y
CONFIG_GPTIMER_ISR_IRAM_SAFE=y
CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM=y
CONFIG_ADC_CONTINUOUS_ISR_IRAM_SAFE=y
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
# silent the error check, as the error string are stored in rodata, causing RTL check failure
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y
CONFIG_HAL_ASSERTION_SILENT=y

CONFIG_PM_ENABLE=y
CONFIG_FREERTOS_USE_TICKLESS_IDLE=y
CONFIG_PM_DFS_INIT_AUTO=y

0 comments on commit bbac0c8

Please sign in to comment.