Skip to content

Commit 89a01cd

Browse files
mhennerichjic23
authored andcommitted
iio: dac: ad5446: Fix read_raw not returning set value
read_raw should return the un-scaled value. Fixes: 5e06bdf ("staging:iio:dac:ad5446: Return cached value for 'raw' attribute") Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20220406105620.1171340-1-michael.hennerich@analog.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 3a26787 commit 89a01cd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/iio/dac/ad5446.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static int ad5446_read_raw(struct iio_dev *indio_dev,
178178

179179
switch (m) {
180180
case IIO_CHAN_INFO_RAW:
181-
*val = st->cached_val;
181+
*val = st->cached_val >> chan->scan_type.shift;
182182
return IIO_VAL_INT;
183183
case IIO_CHAN_INFO_SCALE:
184184
*val = st->vref_mv;

0 commit comments

Comments
 (0)