diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2012-04-25 11:45:00 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-04-25 21:57:20 +0400 |
commit | 5e06bdfb46e8b96bdde1f306d3fadff2d6a2ae77 (patch) | |
tree | 82280d0715b5bbec043ad68c2b2a83db48676681 | |
parent | cae329e04ac1f187338d0febd4e1ddf81db582cf (diff) | |
download | linux-5e06bdfb46e8b96bdde1f306d3fadff2d6a2ae77.tar.xz |
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: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/iio/dac/ad5446.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/staging/iio/dac/ad5446.c b/drivers/staging/iio/dac/ad5446.c index 731cd05456ab..9dc67c806016 100644 --- a/drivers/staging/iio/dac/ad5446.c +++ b/drivers/staging/iio/dac/ad5446.c @@ -229,6 +229,9 @@ static int ad5446_read_raw(struct iio_dev *indio_dev, unsigned long scale_uv; switch (m) { + case IIO_CHAN_INFO_RAW: + *val = st->cached_val; + return IIO_VAL_INT; case IIO_CHAN_INFO_SCALE: scale_uv = (st->vref_mv * 1000) >> chan->scan_type.realbits; *val = scale_uv / 1000; |