Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <dumitru.ceclan@analog.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://patch.msgid.link/20240731-ad7124-fix-v1-4-46a76aa4b9be@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Dumitru Ceclan and committed by
Jonathan Cameron
6f055df6 b7eef979

+3
+3
drivers/iio/adc/ad7124.c
··· 896 896 st->adc_control &= ~AD7124_ADC_CTRL_PWR_MSK; 897 897 st->adc_control |= AD7124_ADC_CTRL_PWR(power_mode); 898 898 899 + st->adc_control &= ~AD7124_ADC_CTRL_MODE_MSK; 900 + st->adc_control |= AD7124_ADC_CTRL_MODE(AD_SD_MODE_IDLE); 901 + 899 902 mutex_init(&st->cfgs_lock); 900 903 INIT_KFIFO(st->live_cfgs_fifo); 901 904 for (i = 0; i < st->num_channels; i++) {