aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Folkesson <[email protected]>2022-07-22 15:07:18 +0200
committerJonathan Cameron <[email protected]>2022-08-15 22:30:40 +0100
commit8f89e33bf040bbef66386c426198622180233178 (patch)
treeca908f0389835a9663b47822a29772c93be46de5
parent568035b01cfb107af8d2e4bd2fb9aea22cf5b868 (diff)
iio: adc: mcp3911: make use of the sign bit
The device supports negative values as well. Fixes: 3a89b289df5d ("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]>
-rw-r--r--drivers/iio/adc/mcp3911.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/iio/adc/mcp3911.c b/drivers/iio/adc/mcp3911.c
index 1cb4590fe412..f581cefb6719 100644
--- a/drivers/iio/adc/mcp3911.c
+++ b/drivers/iio/adc/mcp3911.c
@@ -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;