Skip to content

Commit

Permalink
staging:iio:dac:ad5446: Return cached value for 'raw' attribute
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
larsclausen authored and gregkh committed Apr 25, 2012
1 parent cae329e commit 5e06bdf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/staging/iio/dac/ad5446.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5e06bdf

Please sign in to comment.