Skip to contentSkip to conversation

patch "iio: adc: ad7380: fix SPI offload trigger rate" added to char-misc-linus

PATCH [email protected] 1 participant 1 message Nov 13, 2025

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

iio: adc: ad7380: fix SPI offload trigger rate

to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-linus branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.

If you have any questions about this process, please let me know.

From 632757312d7eb320b66ca60e0cfe098ec53cee08 Mon Sep 17 00:00:00 2001
From: David Lechner <[email protected]>
Date: Fri, 19 Sep 2025 15:50:34 -0500
Subject: iio: adc: ad7380: fix SPI offload trigger rate

Add a special case to double the SPI offload trigger rate when all channels of a single-ended chip are enabled in a buffered read.

The single-ended chips in the AD738x family can only do simultaneous sampling of half their channels and have a multiplexer to allow reading the other half. To comply with the IIO definition of sampling_frequency, we need to trigger twice as often when the sequencer is enabled to so that both banks can be read in a single sample period.

Fixes bbeaec81a03e ("iio: ad7380: add support for SPI offload")
---
 drivers/iio/adc/ad7380.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/iio/adc/ad7380.c +8 -0
index fa251dc1aae6..bfd908deefc0 100644
@@ -1227,6 +1227,14 @@ static int ad7380_offload_buffer_postenable(struct iio_dev *indio_dev)
 	if (ret)
 		return ret;
 
+	/*
+	 * When the sequencer is required to read all channels, we need to
+	 * trigger twice per sample period in order to read one complete set
+	 * of samples.
+	 */
+	if (st->seq)
+		config.periodic.frequency_hz *= 2;
+
 	ret = spi_offload_trigger_enable(st->offload, st->offload_trigger, &config);
 	if (ret)
 		spi_unoptimize_message(&st->offload_msg);
Signature · 1 line
2.51.2