Commit 5e06bdfb authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Greg Kroah-Hartman

staging:iio:dac:ad5446: Return cached value for 'raw' attribute

We can not read back the value from the device, but we cache the value anyway so
we might as well return the cached value instead of an error.
Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Acked-by: default avatarJonathan Cameron <jic23@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cae329e0
...@@ -229,6 +229,9 @@ static int ad5446_read_raw(struct iio_dev *indio_dev, ...@@ -229,6 +229,9 @@ static int ad5446_read_raw(struct iio_dev *indio_dev,
unsigned long scale_uv; unsigned long scale_uv;
switch (m) { switch (m) {
case IIO_CHAN_INFO_RAW:
*val = st->cached_val;
return IIO_VAL_INT;
case IIO_CHAN_INFO_SCALE: case IIO_CHAN_INFO_SCALE:
scale_uv = (st->vref_mv * 1000) >> chan->scan_type.realbits; scale_uv = (st->vref_mv * 1000) >> chan->scan_type.realbits;
*val = scale_uv / 1000; *val = scale_uv / 1000;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment