aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/adc/max1363.c
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2013-09-28 05:31:00 -0400
committerJonathan Cameron <jic23@kernel.org>2013-10-01 11:19:12 -0400
commitb2171677cbf8c781679b588fdffabfe0eaecbcdc (patch)
tree51c1c1ea2861e40d9d50e2b6dccbf034ab65e6b9 /drivers/iio/adc/max1363.c
parentc45e561ee81477903b8254331cb2e28e04082de5 (diff)
iio:max1363: 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> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/adc/max1363.c')
-rw-r--r--drivers/iio/adc/max1363.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/iio/adc/max1363.c b/drivers/iio/adc/max1363.c
index b4bc166d57b0..2b34d2f02cf3 100644
--- a/drivers/iio/adc/max1363.c
+++ b/drivers/iio/adc/max1363.c
@@ -397,7 +397,6 @@ static int max1363_read_raw(struct iio_dev *indio_dev,
397{ 397{
398 struct max1363_state *st = iio_priv(indio_dev); 398 struct max1363_state *st = iio_priv(indio_dev);
399 int ret; 399 int ret;
400 unsigned long scale_uv;
401 400
402 switch (m) { 401 switch (m) {
403 case IIO_CHAN_INFO_RAW: 402 case IIO_CHAN_INFO_RAW:
@@ -406,10 +405,9 @@ static int max1363_read_raw(struct iio_dev *indio_dev,
406 return ret; 405 return ret;
407 return IIO_VAL_INT; 406 return IIO_VAL_INT;
408 case IIO_CHAN_INFO_SCALE: 407 case IIO_CHAN_INFO_SCALE:
409 scale_uv = st->vref_uv >> st->chip_info->bits; 408 *val = st->vref_uv / 1000;
410 *val = scale_uv / 1000; 409 *val2 = st->chip_info->bits;
411 *val2 = (scale_uv % 1000) * 1000; 410 return IIO_VAL_FRACTIONAL_LOG2;
412 return IIO_VAL_INT_PLUS_MICRO;
413 default: 411 default:
414 return -EINVAL; 412 return -EINVAL;
415 } 413 }