Skip to content

Commit

Permalink
iio: dac: ad5446: Fix read_raw not returning set value
Browse files Browse the repository at this point in the history
commit 89a01cd upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
mhennerich authored and gregkh committed May 9, 2022
1 parent cd266c3 commit 28e1f97
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/iio/dac/ad5446.c
Expand Up @@ -178,7 +178,7 @@ static int ad5446_read_raw(struct iio_dev *indio_dev,

switch (m) {
case IIO_CHAN_INFO_RAW:
*val = st->cached_val;
*val = st->cached_val >> chan->scan_type.shift;
return IIO_VAL_INT;
case IIO_CHAN_INFO_SCALE:
*val = st->vref_mv;
Expand Down

0 comments on commit 28e1f97

Please sign in to comment.