diff options
| author | Uwe Kleine-König <u.kleine-koenig@baylibre.com> | 2025-03-03 12:46:59 +0100 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-04-10 14:44:31 +0200 |
| commit | 9300ff01d6b19a7a2795bf4fb4bf8d9d89be48a1 (patch) | |
| tree | ea77dd21c4e6fc881b6afea02e18227b48c8a123 | |
| parent | 1488abd2b201e41c69bf5d6144398237ae4f03e0 (diff) | |
| download | linux-9300ff01d6b19a7a2795bf4fb4bf8d9d89be48a1.tar.gz linux-9300ff01d6b19a7a2795bf4fb4bf8d9d89be48a1.tar.bz2 linux-9300ff01d6b19a7a2795bf4fb4bf8d9d89be48a1.zip | |
iio: adc: ad_sigma_delta: Disable channel after calibration
[ Upstream commit fb3a0811a7bc12d51cba4b75d6b123ab62e2fe4d ]
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: 031bdc8aee01 ("iio: adc: ad7173: add calibration support")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://patch.msgid.link/20250303114659.1672695-11-u.kleine-koenig@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
| -rw-r--r-- | drivers/iio/adc/ad_sigma_delta.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/iio/adc/ad_sigma_delta.c b/drivers/iio/adc/ad_sigma_delta.c index d5d81581ab34..77b4e8bc4748 100644 --- a/drivers/iio/adc/ad_sigma_delta.c +++ b/drivers/iio/adc/ad_sigma_delta.c @@ -339,6 +339,7 @@ int ad_sd_calibrate(struct ad_sigma_delta *sigma_delta, out: sigma_delta->keep_cs_asserted = false; ad_sigma_delta_set_mode(sigma_delta, AD_SD_MODE_IDLE); + ad_sigma_delta_disable_one(sigma_delta, channel); sigma_delta->bus_locked = false; spi_bus_unlock(sigma_delta->spi->controller); |
