Skip to content

Commit fb3a081

Browse files
ukleinekjic23
authored andcommitted
iio: adc: ad_sigma_delta: Disable channel after calibration
The function ad_sd_calibrate() enables the channel to calibrate at function entry but doesn't disable it on exit. This is problematic because if two (or more) channels are calibrated in a row, the second calibration isn't executed as intended as the first (still enabled) channel is recalibrated and after the first irq (i.e. when the calibration of the first channel completed) the calibration is aborted. This currently affects ad7173 only, as the other drivers using ad_sd_calibrate() never have more than one channel enabled at a time. To fix this, disable the calibrated channel after calibration. Fixes: 031bdc8 ("iio: adc: ad7173: add calibration support") Signed-off-by: Uwe Kleine-König <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 9525c66 commit fb3a081

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/iio/adc/ad_sigma_delta.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ int ad_sd_calibrate(struct ad_sigma_delta *sigma_delta,
339339
out:
340340
sigma_delta->keep_cs_asserted = false;
341341
ad_sigma_delta_set_mode(sigma_delta, AD_SD_MODE_IDLE);
342+
ad_sigma_delta_disable_one(sigma_delta, channel);
342343
sigma_delta->bus_locked = false;
343344
spi_bus_unlock(sigma_delta->spi->controller);
344345

0 commit comments

Comments
 (0)