mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-28 13:22:57 +00:00
iio: adc: mcp3911: make use of the sign bit
The device supports negative values as well.
Fixes: 3a89b289df
("iio: adc: add support for mcp3911")
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220722130726.7627-2-marcus.folkesson@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
568035b01c
commit
8f89e33bf0
1 changed files with 2 additions and 0 deletions
|
@ -113,6 +113,8 @@ static int mcp3911_read_raw(struct iio_dev *indio_dev,
|
|||
if (ret)
|
||||
goto out;
|
||||
|
||||
*val = sign_extend32(*val, 23);
|
||||
|
||||
ret = IIO_VAL_INT;
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in a new issue