iio: adc: ad7476: Add support for TI ADS786X ADCs
Subsystems (3)
PATCH v3 1/1 iio: adc: ad7476: Add support for TI ADS786X ADCs
Add support for Texas Instruments ADS7866, ADS7867 and ADS7868 8/10/12 bit Single channel ADC.
Datasheet: http://www.ti.com/lit/ds/symlink/ads7868.pdf
---
v3: Changes by Alexandru Ardelean <[email protected]>
- Modify Kconfig to clarify that the chip is not from AD, but from TI
drivers/iio/adc/Kconfig | 6 ++++-- drivers/iio/adc/ad7476.c | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-)
drivers/iio/adc/Kconfig +4 -2
@@ -57,14 +57,16 @@ config AD7298 module will be called ad7298. config AD7476 - tristate "Analog Devices AD7476 and similar 1-channel ADCs driver" + tristate "Analog Devices AD7476 1-channel ADCs driver and other similar devices from AD an TI" depends on SPI select IIO_BUFFER select IIO_TRIGGERED_BUFFER help Say yes here to build support for Analog Devices AD7273, AD7274, AD7276, AD7277, AD7278, AD7475, AD7476, AD7477, AD7478, AD7466, AD7467, AD7468, - AD7495, AD7910, AD7920, AD7920 SPI analog to digital converters (ADC). + AD7495, AD7910, AD7920, AD7920. SPI analog to digital converters (ADC). + And for Texas Instrumments ADS7866, ADS7867, ADS7868. SPI analog to + digital converters (ADC). To compile this driver as a module, choose M here: the module will be called ad7476.
drivers/iio/adc/ad7476.c +20 -0
@@ -59,6 +59,9 @@ enum ad7476_supported_device_ids {ID_ADC081S ,ID_ADC101S ,ID_ADC121S , +ID_ADS7866 , +ID_ADS7867 , + ID_ADS7868, };static irqreturn_t ad7476_trigger_handler (int irq,void *p)
@@ -157,6 +160,8 @@ static int ad7476_read_raw(struct iio_dev *indio_dev,#define AD7940_CHAN (bits) _AD7476_CHAN((bits), 15 - (bits), \ BIT(IIO_CHAN_INFO_RAW))#define AD7091R_CHAN (bits) _AD7476_CHAN((bits), 16 - (bits), 0) +#define ADS786X_CHAN (bits) _AD7476_CHAN((bits), 12 - (bits), \ + BIT(IIO_CHAN_INFO_RAW))static const struct ad7476_chip_info ad7476_chip_info_tbl[] = { [ID_AD7091R ] = {
@@ -209,6 +214,18 @@ static const struct ad7476_chip_info ad7476_chip_info_tbl[] = { .channel[0] = ADC081S_CHAN(12), .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), }, + [ID_ADS7866] = { + .channel[0] = ADS786X_CHAN(12), + .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), + }, + [ID_ADS7867] = { + .channel[0] = ADS786X_CHAN(10), + .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), + }, + [ID_ADS7868] = { + .channel[0] = ADS786X_CHAN(8), + .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), + }, };static const struct iio_info ad7476_info = {
@@ -314,6 +331,9 @@ static const struct spi_device_id ad7476_id[] = { {"adc081s", ID_ADC081S}, {"adc101s", ID_ADC101S}, {"adc121s", ID_ADC121S}, + {"ads7866", ID_ADS7866}, + {"ads7867", ID_ADS7867}, + {"ads7868", ID_ADS7868}, {} };MODULE_DEVICE_TABLE (spi, ad7476_id);
Signature · 1 line
2.20.1
Quoted 26 lines · Ricardo Ribalda Delgado
Add support for Texas Instruments ADS7866, ADS7867 and ADS7868 8/10/12 bit Single channel ADC.
Datasheet: http://www.ti.com/lit/ds/symlink/ads7868.pdf
Cc Alexandru Ardelean <[email protected]>Signed-off-by Ricardo Ribalda Delgado <[email protected]>---
v3: Changes by Alexandru Ardelean <[email protected]>- Modify
Kconfigto clarify that the chip is not from AD, but from TIdrivers/iio/adc/Kconfig | 6 ++++-- drivers/iio/adc/ad7476.c | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-)drivers/iio/adc/Kconfig +0
-1@@ -57,14 +57,16 @@ config AD7298 module will be called ad7298. config AD7476 - tristate "Analog Devices AD7476 and similar 1-channel ADCs driver"
drivers/iio/adc/Kconfig config AD7298 · line 68
Quoted 10 lines
drivers/iio/adc/Kconfig +3
-1+ tristate "Analog Devices AD7476 1-channel ADCs driver and other similar devices from AD an TI" depends on SPI select IIO_BUFFER select IIO_TRIGGERED_BUFFER help Say yes here to build support for Analog Devices AD7273, AD7274, AD7276, AD7277, AD7278, AD7475, AD7476, AD7477, AD7478, AD7466, AD7467, AD7468, - AD7495, AD7910, AD7920, AD7920 SPI analog to digital converters (ADC). + AD7495, AD7910, AD7920, AD7920. SPI analog to digital converters (ADC). + And for Texas Instrumments ADS7866, ADS7867, ADS7868. SPI analog to
Typo: Instrumments -> Instruments
drivers/iio/adc/Kconfig config AD7298 · line 69
Quoted 1 line
drivers/iio/adc/Kconfig +1
-0+ digital converters (ADC).
I would break it into a table-like format.
I didn't see if there is a common/recommended way of doing things for these drivers.
But something like:
Say yes here to build support for the following SPI analog
to digital converters (ADCs):
Analog Devices: AD7273, AD7274, AD7276, AD7277, AD7278,
AD7475, AD7476,
AD7477, AD7478, AD7466, AD7467,
AD7468, AD7495, AD7910,
AD7920
Texas Instruments: ADS7866, ADS7867, ADS7868Funny thing: I just noticed that the AD7920 was listed twice.
Quoted 58 lines
drivers/iio/adc/Kconfig +0
-0To compile this driver as a module, choose M here: the module will be called ad7476.drivers/iio/adc/ad7476.c +20
-1@@ -59,6 +59,9 @@ enum ad7476_supported_device_ids {ID_ADC081S ,ID_ADC101S ,ID_ADC121S , +ID_ADS7866 , +ID_ADS7867 , + ID_ADS7868, };static irqreturn_t ad7476_trigger_handler (int irq,void *p)@@ -157,6 +160,8 @@ static int ad7476_read_raw(struct iio_dev *indio_dev,#define AD7940_CHAN (bits) _AD7476_CHAN((bits), 15 - (bits), \ BIT(IIO_CHAN_INFO_RAW))#define AD7091R_CHAN (bits) _AD7476_CHAN((bits), 16 - (bits), 0) +#define ADS786X_CHAN (bits) _AD7476_CHAN((bits), 12 - (bits), \ + BIT(IIO_CHAN_INFO_RAW))static const struct ad7476_chip_info ad7476_chip_info_tbl[] = { [ID_AD7091R ] = {@@ -209,6 +214,18 @@ static const struct ad7476_chip_info ad7476_chip_info_tbl[] = { .channel[0] = ADC081S_CHAN(12), .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), }, + [ID_ADS7866] = { + .channel[0] = ADS786X_CHAN(12), + .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), + }, + [ID_ADS7867] = { + .channel[0] = ADS786X_CHAN(10), + .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), + }, + [ID_ADS7868] = { + .channel[0] = ADS786X_CHAN(8), + .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), + }, };static const struct iio_info ad7476_info = {@@ -314,6 +331,9 @@ static const struct spi_device_id ad7476_id[] = { {"adc081s", ID_ADC081S}, {"adc101s", ID_ADC101S}, {"adc121s", ID_ADC121S}, + {"ads7866", ID_ADS7866}, + {"ads7867", ID_ADS7867}, + {"ads7868", ID_ADS7868}, {} };MODULE_DEVICE_TABLE (spi, ad7476_id); --2.20.1