From 72dd93851271b7fd6ed840e01eef33b34aba4426 Mon Sep 17 00:00:00 2001 From: David Wu Date: Wed, 13 Feb 2019 17:29:08 +0800 Subject: [PATCH] iio: adc: rockchip: Don't return fail at probe when the regulator is dummy If the referenced regulator is a dummy, the voltage is invalid, but someone doesn't need the voltage, just need the adc value, so don't return fail at probe when the regulator is dummy. If he wants the voltage, configures the actual referenced regulator at dts. Change-Id: I8eaecc1a8e7e57c3a87aa69b9b852735bf4a025a Signed-off-by: David Wu --- drivers/iio/adc/rockchip_saradc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c index 204e5dbf03ce..c266169dfe61 100644 --- a/drivers/iio/adc/rockchip_saradc.c +++ b/drivers/iio/adc/rockchip_saradc.c @@ -116,6 +116,10 @@ static int rockchip_saradc_read_raw(struct iio_dev *indio_dev, mutex_unlock(&indio_dev->mlock); return IIO_VAL_INT; case IIO_CHAN_INFO_SCALE: + /* It is a dummy regulator */ + if (info->uv_vref < 0) + return info->uv_vref; + *val = info->uv_vref / 1000; *val2 = chan->scan_type.realbits; return IIO_VAL_FRACTIONAL_LOG2;