From: Dumitru Ceclan Date: Wed, 31 Jul 2024 12:37:25 +0000 (+0300) Subject: iio: adc: ad7124: set initial ADC mode to idle X-Git-Tag: v6.12-rc1~39^2~37^2~44 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6f055df6f65944b155c35fa7f790ca749471f0b6;p=thirdparty%2Fkernel%2Flinux.git iio: adc: ad7124: set initial ADC mode to idle During setup the st->adc_control is 0, which corresponds to a continuous conversion mode. The reset value for channel 1 is to enable it. The combined effect of these two is that the ADC will start conversions for channel 1 without them being read. This is not neccessarily a problem, but it is an unexpected behavior. Set the ADC state to idle during setup to avoid this. Signed-off-by: Dumitru Ceclan Reviewed-by: Nuno Sa Link: https://patch.msgid.link/20240731-ad7124-fix-v1-4-46a76aa4b9be@analog.com Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/adc/ad7124.c b/drivers/iio/adc/ad7124.c index 05fdd5e7123dd..37aa3bdcdf4f6 100644 --- a/drivers/iio/adc/ad7124.c +++ b/drivers/iio/adc/ad7124.c @@ -896,6 +896,9 @@ static int ad7124_setup(struct ad7124_state *st) st->adc_control &= ~AD7124_ADC_CTRL_PWR_MSK; st->adc_control |= AD7124_ADC_CTRL_PWR(power_mode); + st->adc_control &= ~AD7124_ADC_CTRL_MODE_MSK; + st->adc_control |= AD7124_ADC_CTRL_MODE(AD_SD_MODE_IDLE); + mutex_init(&st->cfgs_lock); INIT_KFIFO(st->live_cfgs_fifo); for (i = 0; i < st->num_channels; i++) {