[PATCH v2 17/24] staging:iio:cdc:ad7150: Shift the _raw readings by 4 bits.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>

Every other register related to raw value on the datasheet is
described as correpsonding to the 12MSB of the actual
data registers + the bottom 4 bits are 0.  So lets treat this
as what it actually is, which is a 12 bit value.
Note that we will have to be a little careful to compensate for
the offset and scale values.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
Reviewed-by: Alexandru Ardelean <alexandru.ardelean@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20210207154623.433442-18-jic23@xxxxxxxxxx
---
 drivers/staging/iio/cdc/ad7150.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c
index 67af39f80650..1a041396ff9e 100644
--- a/drivers/staging/iio/cdc/ad7150.c
+++ b/drivers/staging/iio/cdc/ad7150.c
@@ -111,7 +111,7 @@ static int ad7150_read_raw(struct iio_dev *indio_dev,
 						  ad7150_addresses[channel][0]);
 		if (ret < 0)
 			return ret;
-		*val = ret;
+		*val = ret >> 4;
 
 		return IIO_VAL_INT;
 	case IIO_CHAN_INFO_AVERAGE_RAW:
-- 
2.30.2




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux