diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2013-09-28 13:31:00 +0400 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-10-01 19:19:13 +0400 |
commit | bfbab2bcf9718ef5e778df8a746e5f4fb8ccd4f1 (patch) | |
tree | 27cddbca0aa823999c3089da9997d367e90248e6 /drivers/staging/iio/adc | |
parent | 4f9be985865f9c83ed724b62be9bb65921226221 (diff) | |
download | linux-bfbab2bcf9718ef5e778df8a746e5f4fb8ccd4f1.tar.xz |
staging:iio:spear_adc: Report scale as fractional value
Move the complexity of calculating the fixed point scale to the core.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Stefan Roese <sr@denx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/staging/iio/adc')
-rw-r--r-- | drivers/staging/iio/adc/spear_adc.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/staging/iio/adc/spear_adc.c b/drivers/staging/iio/adc/spear_adc.c index 20f2d555e7cd..657e01bd733c 100644 --- a/drivers/staging/iio/adc/spear_adc.c +++ b/drivers/staging/iio/adc/spear_adc.c @@ -168,10 +168,9 @@ static int spear_read_raw(struct iio_dev *indio_dev, return IIO_VAL_INT; case IIO_CHAN_INFO_SCALE: - scale_mv = (info->vref_external * 1000) >> DATA_BITS; - *val = scale_mv / 1000; - *val2 = (scale_mv % 1000) * 1000; - return IIO_VAL_INT_PLUS_MICRO; + *val = info->vref_external; + *val2 = DATA_BITS; + return IIO_VAL_FRACTIONAL_LOG2; } return -EINVAL; |