From b7a4bb3ef9b7aa34e0626a14e8127cd3ff5561ae Mon Sep 17 00:00:00 2001 From: Marcio Ribeiro Date: Thu, 26 Sep 2024 17:22:55 -0300 Subject: [PATCH] drivers: adc: esp32: adc2 init code calibration Add call to adc2_init_code_calibration during adc initialization on esp32s2 and esp32c3 Signed-off-by: Marcio Ribeiro --- drivers/adc/adc_esp32.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/adc/adc_esp32.c b/drivers/adc/adc_esp32.c index 434e83011bd..740719901b3 100644 --- a/drivers/adc/adc_esp32.c +++ b/drivers/adc/adc_esp32.c @@ -654,6 +654,12 @@ static int adc_esp32_init(const struct device *dev) adc_hw_calibration(conf->unit); +#if CONFIG_SOC_SERIES_ESP32S2 || CONFIG_SOC_SERIES_ESP32C3 + if (conf->unit == ADC_UNIT_2) { + adc2_init_code_calibration(); + } +#endif /* CONFIG_SOC_SERIES_ESP32S2 || CONFIG_SOC_SERIES_ESP32C3 */ + #if defined(CONFIG_ADC_ESP32_DMA) if (!device_is_ready(conf->gpio_port)) { LOG_ERR("gpio0 port not ready");