diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2013-09-28 10:31:00 +0100 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-10-01 16:19:13 +0100 |
commit | 4f9be985865f9c83ed724b62be9bb65921226221 (patch) | |
tree | ffbe828ae71e9491758d1075681fa3a4ead002cd /drivers/staging/iio/cdc | |
parent | b740f48a3d0d118b160db7c9559fb75de8af8657 (diff) | |
download | linux-4f9be985865f9c83ed724b62be9bb65921226221.tar.gz linux-4f9be985865f9c83ed724b62be9bb65921226221.tar.bz2 linux-4f9be985865f9c83ed724b62be9bb65921226221.zip |
staging:iio:ad7746: 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/staging/iio/cdc')
-rw-r--r-- | drivers/staging/iio/cdc/ad7746.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c index 75a533bce021..862d68d99630 100644 --- a/drivers/staging/iio/cdc/ad7746.c +++ b/drivers/staging/iio/cdc/ad7746.c @@ -656,20 +656,21 @@ static int ad7746_read_raw(struct iio_dev *indio_dev, switch (chan->type) { case IIO_CAPACITANCE: /* 8.192pf / 2^24 */ - *val2 = 488; *val = 0; + *val2 = 488; + ret = IIO_VAL_INT_PLUS_NANO; break; case IIO_VOLTAGE: /* 1170mV / 2^23 */ - *val2 = 139475; - *val = 0; + *val = 1170; + *val2 = 23; + ret = IIO_VAL_FRACTIONAL_LOG2; break; default: - ret = -EINVAL; - goto out; + ret = -EINVAL; + break; } - ret = IIO_VAL_INT_PLUS_NANO; break; default: ret = -EINVAL; |