diff options
author | Nuno Sá | 2022-09-12 10:12:22 +0200 |
---|---|---|
committer | Jonathan Cameron | 2022-09-21 18:42:55 +0100 |
commit | 096d2dac25f9947d1cb1e16a16468de8fda685e6 (patch) | |
tree | a818ea5c6a4e52d741e8c543002ec67f097c7212 /drivers/iio | |
parent | f4f43f01cff2f29779343ade755191afd2581c77 (diff) |
iio: adc: ad7923: support extended range
By default the driver was always setting the RANGE bit which means that
the analog input goes from 0 to VREF. However, we might want to have 0
to 2xVREF. This change adds a new Firmware property to allow for the
extended range while keeping the default behavior if nothing is provided.
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20220912081223.173584-3-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio')
-rw-r--r-- | drivers/iio/adc/ad7923.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/iio/adc/ad7923.c b/drivers/iio/adc/ad7923.c index 502253f53d96..9d6bf6d0927a 100644 --- a/drivers/iio/adc/ad7923.c +++ b/drivers/iio/adc/ad7923.c @@ -8,6 +8,7 @@ #include <linux/device.h> #include <linux/kernel.h> +#include <linux/property.h> #include <linux/slab.h> #include <linux/sysfs.h> #include <linux/spi/spi.h> @@ -300,6 +301,7 @@ static void ad7923_regulator_disable(void *data) static int ad7923_probe(struct spi_device *spi) { + u32 ad7923_range = AD7923_RANGE; struct ad7923_state *st; struct iio_dev *indio_dev; const struct ad7923_chip_info *info; @@ -311,8 +313,11 @@ static int ad7923_probe(struct spi_device *spi) st = iio_priv(indio_dev); + if (device_property_read_bool(&spi->dev, "adi,range-double")) + ad7923_range = 0; + st->spi = spi; - st->settings = AD7923_CODING | AD7923_RANGE | + st->settings = AD7923_CODING | ad7923_range | AD7923_PM_MODE_WRITE(AD7923_PM_MODE_OPS); info = &ad7923_chip_info[spi_get_device_id(spi)->driver_data]; |