Thread (23 messages) 23 messages, 3 authors, 2013-08-20

Re: [PATCH 4/4] iio: ti_am335x_adc: Add continuous sampling and trigger support

flat view

From: Zubair Lutfullah : <hidden>
Date: 2013-08-16 22:26:24
Also in: linux-iio, lkml

On Fri, Aug 16, 2013 at 02:53:40PM +0200, Sebastian Andrzej Siewior wrote:
* Zubair Lutfullah | 2013-08-13 21:05:03 [+0100]:
quoted
diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index 3ceac3e..0d7e313 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -24,16 +24,28 @@
…
quoted
+static irqreturn_t tiadc_irq(int irq, void *private)
+{
+	struct iio_dev *idev = private;
+	struct tiadc_device *adc_dev = iio_priv(idev);
+	unsigned int status, config;
+	status = tiadc_readl(adc_dev, REG_IRQSTATUS);
+
+	/* FIFO Overrun. Clear flag. Disable/Enable ADC to recover */
+	if (status & IRQENB_FIFO1OVRRUN) {
+		config = tiadc_readl(adc_dev, REG_CTRL);
+		config &= ~(CNTRLREG_TSCSSENB);
+		tiadc_writel(adc_dev, REG_CTRL, config);
+		tiadc_writel(adc_dev, REG_IRQSTATUS, IRQENB_FIFO1OVRRUN |
+				IRQENB_FIFO1UNDRFLW | IRQENB_FIFO1THRES);
+		tiadc_writel(adc_dev, REG_CTRL, (config | CNTRLREG_TSCSSENB));
I have no idea how other handle this but shouldn't you somehow inform
*anyone* that you lost some samples due to this overrun?

Sebastian
The ref manual states that TSCADC module doesn't recover 
from overrun interrupts. Thats why the disable enable of
the module here to handle the situation.
And of course, clearing interrupt flags.
The data is lost.

Informing someone about lost samples is important indeed.
But a print statement in this area causes more overruns.

I'm open to some input on how to inform userspace of such 
a situation.

Thanks
Zubair
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help