]> Gentwo Git Trees - linux/.git/commitdiff
iio: adc: rtq6056: Correct the sign bit index
authorChiYuan Huang <cy_huang@richtek.com>
Thu, 18 Sep 2025 03:10:59 +0000 (11:10 +0800)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 13 Oct 2025 07:38:08 +0000 (08:38 +0100)
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@wiwynn.com>
Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/rtq6056.c

index ad9738228b7f2db3f3b6cfc01fd97e43b579b687..2bf3a09ac6b0416d1afea85de3d343ed503ac3b9 100644 (file)
@@ -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;