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

From
Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date
2013-08-19 17:12:42
Also in
linux-iio, lkml
Reply to
Zubair Lutfullah, 2013-08-13
* Zubair Lutfullah | 2013-08-13 21:05:03 [+0100]:
quoted hunk ↗ jump to hunk
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
…
+static irqreturn_t tiadc_irq(int irq, void *private)
+{
…
+		wake_up_interruptible(&adc_dev->wq_data_avail);
…
+}
…
+static irqreturn_t tiadc_trigger_h(int irq, void *p)
+{
…
+	schedule_work(&adc_dev->poll_work);
…
+}
…
+static void tiadc_adc_work(struct work_struct *work_s)
+{
…
+		wait_event_interruptible(adc_dev->wq_data_avail,
+					(adc_dev->data_avail == 1));
…
+}
This is not very nice. The problem is that you might sleep in a
workqueue and so the other jobs will wait until you are done. I'm think
it is better if you create your own worker here instead using the
system's.
I'm looking into DMA support for this so once your code is working it
should be possible to switch to DMA instead reading byte wise from the
fifo.
How did you test the whole thing? Do you have a test program which
selects a few sources and reads them in continuous mode?

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thread (23 messages) 23 messages, 3 authors, last reply 2013-08-20
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help