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: ad4030: Fix _scale value for common-mode channels

Previously, the driver always used the amount of precision bits of
differential input channels to provide the scale to mV. Though,
differential and common-mode voltage channels have different amount of
precision bits and the correct number of precision bits must be considered
to get to a proper mV scale factor for each one. Use channel specific
number of precision bits to provide the correct scale value for each
channel.

Fixes: de67f28abe58 ("iio: adc: ad4030: check scan_type for error")
Fixes: 949abd1ca5a4 ("iio: adc: ad4030: add averaging support")
Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Marcelo Schmitt and committed by
Jonathan Cameron
ffc74ad5 3a866087

+1 -1
+1 -1
drivers/iio/adc/ad4030.c
··· 385 385 struct ad4030_state *st = iio_priv(indio_dev); 386 386 const struct iio_scan_type *scan_type; 387 387 388 - scan_type = iio_get_current_scan_type(indio_dev, st->chip->channels); 388 + scan_type = iio_get_current_scan_type(indio_dev, chan); 389 389 if (IS_ERR(scan_type)) 390 390 return PTR_ERR(scan_type); 391 391