Re: [PATCH v2 1/6] iio: adc: ti-ads1298: fix the data read path

From: Mike Looijmans

Date: Mon Nov 02 2026 - 01:02:50 EST


Resent, this one got out as a HTML mail and the company mail server added some bits... Sorry for the inconvenience.


Met vriendelijke groet / kind regards,

Mike Looijmans
System Expert


TOPIC Embedded Systems B.V.
Materiaalweg 4, 5681 RJ Best
The Netherlands

T: +31 (0) 499 33 69 79
E: mike.looijmans@xxxxxxxx
W: www.topic.nl

Please consider the environment before printing this e-mail
On 02-11-2026 01:08, Jonathan Cameron wrote:
Complicated sounding solution. Can we claim buffered mode instead?
That would ensure the update_scan_mode and this don't race and mostly
would be taking an uncontended lock.
I don't see how to do it where the race is. The sample is pushed from
ads1298_rdata_complete(), the completion of that spi_async(), which the
SPI core "invokes in a context which can't sleep".
Ah. I'd missed that complexity and was assuming this was a normal
threaded interrupt handler. One simplification here would be to stop using
async spi and instead just use synchronous spi in an interrupt thread which
is how most drivers handle similar flows.

The async SPI is there for a reason - at least the hardware we had at the time would drop samples with the threaded interrupt solution.

The hardware wasn't really designed with an application CPU in mind, or they would have added a small FIFO to reduce the interrupt rate. At its nominal 500 Hz frequency the interrupt rate is already 1 kHz.

--
Mike Looijmans
System Expert

TOPIC Embedded Products B.V.
Materiaalweg 4, 5681 RJ Best
The Netherlands

T: +31 (0) 499 33 69 69
E:mike.looijmans@xxxxxxxx
W:www.topic.nl