staging:iio:dac:ad5791: Fix scale unit
authorLars-Peter Clausen <lars@metafoo.de>
Wed, 19 Oct 2011 15:47:52 +0000 (17:47 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 19 Oct 2011 20:57:01 +0000 (13:57 -0700)
Scale is currently reported in volts instead of millivolts. This patch fixes it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/iio/dac/ad5791.c

index 9ba45f1a23798e8e4d85d890acc3fc2d35fdd65e..6fbca8d961538fcb6ea5ce81886a2a0acf7670d6 100644 (file)
@@ -239,7 +239,7 @@ static int ad5791_read_raw(struct iio_dev *indio_dev,
                return IIO_VAL_INT;
        case (1 << IIO_CHAN_INFO_SCALE_SHARED):
                *val = 0;
-               *val2 = (st->vref_mv * 1000) >> chan->scan_type.realbits;
+               *val2 = (((u64)st->vref_mv) * 1000000ULL) >> chan->scan_type.realbits;
                return IIO_VAL_INT_PLUS_MICRO;
        case (1 << IIO_CHAN_INFO_OFFSET_SHARED):
                val64 = (((u64)st->vref_neg_mv) << chan->scan_type.realbits);