Skip to content

Commit 8f89e33

Browse files
marcusfolkessonjic23
authored andcommitted
iio: adc: mcp3911: make use of the sign bit
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]>
1 parent 568035b commit 8f89e33

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
@@ -113,6 +113,8 @@ static int mcp3911_read_raw(struct iio_dev *indio_dev,
113113
if (ret)
114114
goto out;
115115

116+
*val = sign_extend32(*val, 23);
117+
116118
ret = IIO_VAL_INT;
117119
break;
118120

0 commit comments

Comments
 (0)