@@ -66,6 +66,7 @@ static int mp2629_read_raw(struct iio_dev *indio_dev,
int *val, int *val2, long mask)
{
struct mp2629_adc *info = iio_priv(indio_dev);
+ struct mp2629_data *ddata = dev_get_drvdata(info->dev);
unsigned int rval;
int ret;
@@ -75,8 +76,10 @@ static int mp2629_read_raw(struct iio_dev *indio_dev,
if (ret)
return ret;
- if (chan->channel == MP2629_INPUT_VOLT)
+ if (chan->channel == MP2629_INPUT_VOLT &&
+ ddata->chip_id == CHIP_ID_MP2629)
rval &= GENMASK(6, 0);
+
*val = rval;
return IIO_VAL_INT;