mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] iio: adc: max1027: complete the EOC wait when using an external trigger
@ 2026-11-15 20:45 Jonathan Cameron
  0 siblings, 0 replies; only message in thread
From: Jonathan Cameron @ 2026-11-15 20:45 UTC (permalink / raw)
  To: linux-iio, Miquel Raynal
  Cc: David Lechner, Nuno Sá,
	Andy Shevchenko, linux-kernel, Jonathan Cameron

From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>

When an external trigger is in use, max1027_trigger_handler() starts the
conversion and then waits in max1027_wait_eoc() for the end of conversion
interrupt to complete(&st->complete). However max1027_handler() only
completes it when the buffer is disabled. With the buffer enabled it
instead polls the current trigger, which is the external trigger
that is still being handled, so the poll does nothing,
the wait times out and every sample fails with -ETIMEDOUT.

Complete the wait when the buffer is enabled but the device's own
trigger is not in use, as the comment above the check already
describes.

Fixes: 075d3280b4a1 ("iio: adc: max1027: Allow all kind of triggers to be used")
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>

---

The comment clearly states that we should just complete for
triggers other than the one provided by this device, but the
code doesn't do this. Ideal would be if someone has the part and
can test this.

LLM spotted the issue whilst doing some other cleanup and
prepared the patch.

I think the reason this got past testing was that the code was
fixed to actually return an error on timeout whereas a bug
previously meant it always dropped through and carried on.
---
 drivers/iio/adc/max1027.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
index d475cc91108d..65a0e85faca9 100644
--- a/drivers/iio/adc/max1027.c
+++ b/drivers/iio/adc/max1027.c
@@ -478,7 +478,7 @@ static irqreturn_t max1027_handler(int irq, void *private)
 	 * with another device. The core will then call the relevant handler to
 	 * perform the data processing step.
 	 */
-	if (!iio_buffer_enabled(indio_dev))
+	if (!iio_buffer_enabled(indio_dev) || !iio_trigger_using_own(indio_dev))
 		complete(&st->complete);
 	else
 		iio_trigger_poll(st->trig);
-- 
2.56.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-15 20:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-15 20:45 [PATCH] iio: adc: max1027: complete the EOC wait when using an external trigger Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®