Skip to content

Commit dd952d3

Browse files
committed
iio: adc: ad4630: Use filtered DMA Engine buffer for single-channel ADCs
Use the new filtered DMA buffer variant to avoid pushing noise to IIO buffers when single-channel ADCs are used. Signed-off-by: Marcelo Schmitt <[email protected]>
1 parent 8ff837c commit dd952d3

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

drivers/iio/adc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ config AD4630
8383
select IIO_BUFFER
8484
select IIO_BUFFER_DMA
8585
select IIO_BUFFER_DMAENGINE
86+
select IIO_BUFFER_DMAENGINE_FILTERED
8687
help
8788
Say yes here to build support for Analog Devices AD4630 high speed
8889
SPI analog to digital converters (ADC).

drivers/iio/adc/ad4630.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,8 +1540,13 @@ static int ad4630_probe(struct spi_device *spi)
15401540
return dev_err_probe(dev, PTR_ERR(rx_dma),
15411541
"failed to get offload RX DMA\n");
15421542

1543-
ret = devm_iio_dmaengine_buffer_setup_with_handle(dev, indio_dev,
1544-
rx_dma, IIO_BUFFER_DIRECTION_IN);
1543+
if (indio_dev->num_channels == 1)
1544+
ret = devm_iio_dmaengine_filtered_buffer_setup_with_handle(dev,
1545+
indio_dev, rx_dma,
1546+
IIO_BUFFER_DIRECTION_IN);
1547+
else
1548+
ret = devm_iio_dmaengine_buffer_setup_with_handle(dev, indio_dev,
1549+
rx_dma, IIO_BUFFER_DIRECTION_IN);
15451550
if (ret)
15461551
return dev_err_probe(dev, ret,
15471552
"Failed to get DMA buffer\n");
@@ -1638,3 +1643,4 @@ MODULE_AUTHOR("Liviu Adace <[email protected]>");
16381643
MODULE_DESCRIPTION("Analog Devices AD4630 and ADAQ4224 ADC family driver");
16391644
MODULE_LICENSE("GPL v2");
16401645
MODULE_IMPORT_NS(IIO_DMAENGINE_BUFFER);
1646+
MODULE_IMPORT_NS(IIO_DMAENGINE_FILTERED_BUFFER);

0 commit comments

Comments
 (0)