[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <7e43ad09f814d63b570ab6b2b9fe3fe17775d22d.1758164614.git.cy_huang@richtek.com>
Date: Thu, 18 Sep 2025 11:10:59 +0800
From: <cy_huang@...htek.com>
To: Jonathan Cameron <jic23@...nel.org>
CC: David Lechner <dlechner@...libre.com>, Nuno Sá
<nuno.sa@...log.com>, Andy Shevchenko <andy@...nel.org>, ChiYuan Huang
<cy_huang@...htek.com>, <linux-iio@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, Andy Hsu <andy_ya_hsu@...ynn.com>
Subject: [PATCH] iio: adc: rtq6056: Correct the sign bit index
From: ChiYuan Huang <cy_huang@...htek.com>
The vshunt/current reported register is a signed 16bit integer. The
sign bit index should be '15', not '16'.
Fixes: 4396f45d211b ("iio: adc: Add rtq6056 support")
Reported-by: Andy Hsu <andy_ya_hsu@...ynn.com>
Signed-off-by: ChiYuan Huang <cy_huang@...htek.com>
---
Hi, Andy:
Thanks for reporting the value convert issue.
---
drivers/iio/adc/rtq6056.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/adc/rtq6056.c b/drivers/iio/adc/rtq6056.c
index ad9738228b7f..2bf3a09ac6b0 100644
--- a/drivers/iio/adc/rtq6056.c
+++ b/drivers/iio/adc/rtq6056.c
@@ -300,7 +300,7 @@ static int rtq6056_adc_read_channel(struct rtq6056_priv *priv,
return IIO_VAL_INT;
case RTQ6056_REG_SHUNTVOLT:
case RTQ6056_REG_CURRENT:
- *val = sign_extend32(regval, 16);
+ *val = sign_extend32(regval, 15);
return IIO_VAL_INT;
default:
return -EINVAL;
--
2.34.1
Powered by blists - more mailing lists