IIO ADC support for AD7923
Subsystems (2)
PATCH v2 1/1 IIO ADC support for AD7923
This patch adds support for Analog Devices AD7923 ADC in the IIO Subsystem.
drivers/iio/adc/Kconfig +12 -0
@@ -30,6 +30,18 @@ To compile this driver as a module, choose M here: the module will be called ad7298. +config AD7923 + tristate "Analog Devices AD7923 ADC driver" + depends on SPI + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say yes here to build support for Analog Devices AD7923 + 4 Channel ADC with temperature sensor. + + To compile this driver as a module, choose M here: the + module will be called ad7923. + config AD7791 tristate "Analog Devices AD7791 ADC driver" depends on SPI
drivers/iio/adc/Makefile +1 -0
@@ -5,6 +5,7 @@ obj-$(CONFIG_AD_SIGMA_DELTA) += ad_sigma_delta.o obj-$(CONFIG_AD7266) += ad7266.o obj-$(CONFIG_AD7298) += ad7298.o +obj-$(CONFIG_AD7923) += ad7923.o obj-$(CONFIG_AD7476) += ad7476.o obj-$(CONFIG_AD7791) += ad7791.o obj-$(CONFIG_AD7793) += ad7793.o
drivers/iio/adc/ad7923.c +298 -0
298 lines not on this page · raw message
Quoted 4 lines · Christophe Leroy
This patch adds support for Analog Devices AD7923 ADC in the IIO Subsystem.
Signed-off-by Patrick Vasseur <[email protected]>Signed-off-by Christophe Leroy <[email protected]>
Looks good to me except for one small, but important issue.
[...]
Quoted 3 lines
diff -urN
linux-next-e347c98/drivers/iio/adc/ad7923.clinux-next-e347c98.new/drivers/iio/adc/ad7923.cdrivers/iio/adc/ad7923.c +0
-0
[...]
drivers/iio/adc/ad7923.c line 55
Quoted 4 lines
drivers/iio/adc/ad7923.c +4
-0+ +struct ad7923_state { +struct spi_device *spi; +struct spi_transfer ring_xfer[6 ];
I think 5 is the max number of transfers, one for each channel and one extra to read the last result.
drivers/iio/adc/ad7923.c line 64
Quoted 9 lines
drivers/iio/adc/ad7923.c +9
-0+struct spi_transfer scan_single_xfer[2 ]; +struct spi_message ring_msg; +struct spi_message scan_single_msg; +/* +* DMA (thus cache coherency maintenance) requires the +* transfer buffers to live in their own cache lines. +*/ +__be16 rx_buf[4 ]____cacheline_aligned ; +__be16 tx_buf[2 ];
The tx buffer also needs to be 4 elements.
Quoted 1 line
+};
[...]
Quoted 6 lines · Lars-Peter Clausen
Quoted 4 lines · Christophe Leroy
This patch adds support for Analog Devices AD7923 ADC in the IIO Subsystem.
Signed-off-by Patrick Vasseur <[email protected]>Signed-off-by Christophe Leroy <[email protected]>Looks good to me except for one small, but important issue.
Oh, many thanks. Good points .
I'll fix it and resubmit.
Christophe