2a82da50b8
[ Upstream commit e71c5c89bcb165a02df35325aa13d1ee40112401 ] The ADC needs a voltage reference to work correctly. Users can provide an external voltage reference or use the chip internal reference to operate the ADC. The availability of an in chip reference for the ADC saves the user from having to supply an external voltage reference, which makes the external reference an optional property as described in the device tree documentation. Though, to use the internal reference, it must be enabled by writing to the configuration register. Enable AD7091R internal voltage reference if no external vref is supplied. Fixes: 260442cc5be4 ("iio: adc: ad7091r5: Add scale and external VREF support") Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com> Link: https://lore.kernel.org/r/b865033fa6a4fc4bf2b4a98ec51a6144e0f64f77.1703013352.git.marcelo.schmitt1@gmail.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
34 lines
816 B
C
Executable file
34 lines
816 B
C
Executable file
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* AD7091RX Analog to Digital converter driver
|
|
*
|
|
* Copyright 2014-2019 Analog Devices Inc.
|
|
*/
|
|
|
|
#ifndef __DRIVERS_IIO_ADC_AD7091R_BASE_H__
|
|
#define __DRIVERS_IIO_ADC_AD7091R_BASE_H__
|
|
|
|
#define AD7091R_REG_CONF_INT_VREF BIT(0)
|
|
|
|
/* AD7091R_REG_CH_LIMIT */
|
|
#define AD7091R_HIGH_LIMIT 0xFFF
|
|
#define AD7091R_LOW_LIMIT 0x0
|
|
|
|
struct device;
|
|
struct ad7091r_state;
|
|
|
|
struct ad7091r_chip_info {
|
|
unsigned int num_channels;
|
|
const struct iio_chan_spec *channels;
|
|
unsigned int vref_mV;
|
|
};
|
|
|
|
extern const struct iio_event_spec ad7091r_events[3];
|
|
|
|
extern const struct regmap_config ad7091r_regmap_config;
|
|
|
|
int ad7091r_probe(struct device *dev, const char *name,
|
|
const struct ad7091r_chip_info *chip_info,
|
|
struct regmap *map, int irq);
|
|
|
|
#endif /* __DRIVERS_IIO_ADC_AD7091R_BASE_H__ */
|