[PATCH 2/3] iio: adc: mt6359-auxadc: mask conversion ready bit in mt6358_read_imp
From: Roman Vivchar via B4 Relay
Date: Tue Nov 03 2026 - 12:02:37 EST
From: Roman Vivchar <rva333@xxxxxxxxxxxxxx>
In mt6358_read_imp() the raw ADC value is returned directly without
masking out ready bit, resulting in incorrect battery voltage reporting.
Apply the mask to strip the ready bit, matching the behavior in
mt6359_auxadc_read_adc() function.
Fixes: 3587914bf61d ("iio: adc: Add support for MediaTek MT6357/8/9 Auxiliary ADC")
Signed-off-by: Roman Vivchar <rva333@xxxxxxxxxxxxxx>
---
drivers/iio/adc/mt6359-auxadc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/adc/mt6359-auxadc.c b/drivers/iio/adc/mt6359-auxadc.c
index 951d236f972b..09432d0974cf 100644
--- a/drivers/iio/adc/mt6359-auxadc.c
+++ b/drivers/iio/adc/mt6359-auxadc.c
@@ -502,7 +502,7 @@ static int mt6358_read_imp(struct mt6359_auxadc *adc_dev,
mt6358_stop_imp_conv(adc_dev);
if (vbat)
- *vbat = val_v;
+ *vbat = val_v & GENMASK(chan->scan_type.realbits - 1, 0);
if (ibat)
*ibat = 0;
--
2.56.0