Skip to content

Commit 41297c6

Browse files
RaduSabau1jic23
authored andcommitted
iio: adc: ad4691: add triggered buffer support
Add buffered capture support using the IIO triggered buffer framework. CNV Burst Mode: the GP pin identified by interrupt-names in the device tree is configured as DATA_READY output. The IRQ handler stops conversions and fires the IIO trigger; the trigger handler executes a pre-built SPI message that reads all active channels from the AVG_IN accumulator registers and then resets accumulator state and restarts conversions for the next cycle. Manual Mode: CNV is tied to SPI CS so each transfer simultaneously reads the previous result and starts the next conversion (pipelined N+1 scheme). At preenable time a pre-built, optimised SPI message of N+1 transfers is constructed (N channel reads plus one NOOP to drain the pipeline). The trigger handler executes the message in a single spi_sync() call and collects the results. An external trigger (e.g. iio-trig-hrtimer) is required to drive the trigger at the desired sample rate. Both modes share the same trigger handler and push a complete scan — one big-endian 16-bit (__be16) slot per active channel, densely packed in scan_index order, followed by a timestamp. The CNV Burst Mode sampling frequency (PWM period) is exposed as a buffer-level attribute via IIO_DEVICE_ATTR. Signed-off-by: Radu Sabau <radu.sabau@analog.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
1 parent 4085044 commit 41297c6

2 files changed

Lines changed: 572 additions & 4 deletions

File tree

drivers/iio/adc/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ config AD4691
148148
tristate "Analog Devices AD4691 Family ADC Driver"
149149
depends on SPI
150150
depends on REGULATOR || COMPILE_TEST
151+
select IIO_BUFFER
152+
select IIO_TRIGGERED_BUFFER
151153
select REGMAP
152154
help
153155
Say yes here to build support for Analog Devices AD4691 Family MuxSAR

0 commit comments

Comments
 (0)