Skip to content

Commit 7497f97

Browse files
marcusfolkessongregkh
authored andcommitted
iio: adc: mcp3911: make use of the sign bit
[ Upstream commit 8f89e33 ] The device supports negative values as well. Fixes: 3a89b28 ("iio: adc: add support for mcp3911") Signed-off-by: Marcus Folkesson <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 9e1f742 commit 7497f97

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/iio/adc/mcp3911.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ static int mcp3911_read_raw(struct iio_dev *indio_dev,
111111
if (ret)
112112
goto out;
113113

114+
*val = sign_extend32(*val, 23);
115+
114116
ret = IIO_VAL_INT;
115117
break;
116118

0 commit comments

Comments
 (0)