Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7a27b042 authored by Michael Hennerich's avatar Michael Hennerich Committed by Greg Kroah-Hartman
Browse files

IIO: ADC: New driver for AD7190/AD7192/AD7195 4 Channel SPI ADC



New driver for AD7190/AD7192/AD7195 4.8 kHz, Ultralow Noise, 24-Bit
Sigma-Delta ADC with PGA

These devices features a dual use data out ready DOUT/RDY output.
In order to avoid contentions on the SPI bus, it's necessary to use
spi bus locking. The DOUT/RDY output must also be wired to an
interrupt capable GPIO.

In INDIO_RING_TRIGGERED mode, this driver may block its SPI bus segment
for an extended period of time.

Changes since V1:

Add missing documentation.
Remove obsoleted include files.
Fix typos and style issues.
Fix buffer size.
Split ad7192_show() into two functions.
Avoid race condition add mutex.
Abandon IIO_CHAN macro.
Reorder elements in ad7192_platform_data.
Remove driver bus type.

Signed-off-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Acked-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 88b42f3a
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -711,3 +711,24 @@ Contact: linux-iio@xxxxxxxxxxxxxxx
Description:
		This attribute is used to read the amount of quadrature error
		present in the device at a given time.

What:		/sys/.../iio:deviceX/ac_excitation_en
KernelVersion:	3.1.0
Contact:	linux-iio@vger.kernel.org
Description:
		This attribute, if available, is used to enable the AC
		excitation mode found on some converters. In ac excitation mode,
		the polarity of the excitation voltage is reversed on
		alternate cycles, to eliminate DC errors.

What:		/sys/.../iio:deviceX/bridge_switch_en
KernelVersion:	3.1.0
Contact:	linux-iio@vger.kernel.org
Description:
		This attribute, if available, is used to close or open the
		bridge power down switch found on some converters.
		In bridge applications, such as strain gauges and load cells,
		the bridge itself consumes the majority of the current in the
		system. To minimize the current consumption of the system,
		the bridge can be disconnected (when it is not being used
		using the bridge_switch_en attribute.
+14 −0
Original line number Diff line number Diff line
@@ -161,6 +161,20 @@ config AD7816
	  Say yes here to build support for Analog Devices AD7816/7/8
	  temperature sensors and ADC.

config AD7192
	tristate "Analog Devices AD7190 AD7192 AD7195 ADC driver"
	depends on SPI
	select IIO_RING_BUFFER
	select IIO_SW_RING
	select IIO_TRIGGER
	help
	  Say yes here to build support for Analog Devices AD7190,
	  AD7192 or AD7195 SPI analog to digital convertors (ADC).
	  If unsure, say N (but it's safe to say "Y").

	  To compile this driver as a module, choose M here: the
	  module will be called ad7192.

config ADT75
	tristate "Analog Devices ADT75 temperature sensor driver"
	depends on I2C
+1 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ obj-$(CONFIG_AD7745) += ad7745.o
obj-$(CONFIG_AD7780) += ad7780.o
obj-$(CONFIG_AD7793) += ad7793.o
obj-$(CONFIG_AD7816) += ad7816.o
obj-$(CONFIG_AD7192) += ad7192.o
obj-$(CONFIG_ADT75) += adt75.o
obj-$(CONFIG_ADT7310) += adt7310.o
obj-$(CONFIG_ADT7410) += adt7410.o
+1189 −0

File added.

Preview size limit exceeded, changes collapsed.

+47 −0
Original line number Diff line number Diff line
/*
 * AD7190 AD7192 AD7195 SPI ADC driver
 *
 * Copyright 2011 Analog Devices Inc.
 *
 * Licensed under the GPL-2.
 */
#ifndef IIO_ADC_AD7192_H_
#define IIO_ADC_AD7192_H_

/*
 * TODO: struct ad7192_platform_data needs to go into include/linux/iio
 */

/**
 * struct ad7192_platform_data - platform/board specific information
 * @vref_mv:		the external reference voltage in millivolt
 * @clock_source_sel:	[0..3]
 *			0 External 4.92 MHz clock connected from MCLK1 to MCLK2
 *			1 External Clock applied to MCLK2
 *			2 Internal 4.92 MHz Clock not available at the MCLK2 pin
 *			3 Internal 4.92 MHz Clock available at the MCLK2 pin
 * @ext_clk_Hz:		the external clock frequency in Hz, if not set
 *			the driver uses the internal clock (16.776 MHz)
 * @refin2_en:		REFIN1/REFIN2 Reference Select (AD7190/2 only)
 * @rej60_en:		50/60Hz notch filter enable
 * @sinc3_en:		SINC3 filter enable (default SINC4)
 * @chop_en:		CHOP mode enable
 * @buf_en:		buffered input mode enable
 * @unipolar_en:	unipolar mode enable
 * @burnout_curr_en:	constant current generators on AIN(+|-) enable
 */

struct ad7192_platform_data {
	u16		vref_mv;
	u8		clock_source_sel;
	u32		ext_clk_Hz;
	bool		refin2_en;
	bool		rej60_en;
	bool		sinc3_en;
	bool		chop_en;
	bool		buf_en;
	bool		unipolar_en;
	bool		burnout_curr_en;
};

#endif /* IIO_ADC_AD7192_H_ */