summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/cx18/cx18-queue.c
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2008-11-15 23:38:19 -0500
committerAndy Walls <awalls@radix.net>2008-11-15 23:38:19 -0500
commitc2343663850d8931f75a7dfe4317c62732c6fce1 (patch)
tree09c49cb2aeb791c37def408456cfa580846cf1ff /linux/drivers/media/video/cx18/cx18-queue.c
parent60c3a3c2818fb9a088b9f2ea033fbc671fb3abc8 (diff)
downloadmediapointer-dvb-s2-c2343663850d8931f75a7dfe4317c62732c6fce1.tar.gz
mediapointer-dvb-s2-c2343663850d8931f75a7dfe4317c62732c6fce1.tar.bz2
cx18: Major rewrite of interrupt handling for incoming mailbox processing
From: Andy Walls <awalls@radix.net> A major rewrite of interrupt handling for incoming mailbox processing, to split the timing critical steps from the the deferrable steps as the sending XPU on the CX23418 will time out and overwrite our incoming mailboxes rather quickly. Setup a pool of work "order forms" for the irq handler to send jobs to the new work handler routine which uses the kernel default work queue to do the deferrable work. Started optimizing some of the cx18-io calls as they are now the low hanging fruit for recoving microseconds back from the timeline. Future optimizations will get rid of mmio read retries, mmio stats logging, and combine smaller functions in the irq path into the larger ones to save ~2 us each. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
Diffstat (limited to 'linux/drivers/media/video/cx18/cx18-queue.c')
-rw-r--r--linux/drivers/media/video/cx18/cx18-queue.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/linux/drivers/media/video/cx18/cx18-queue.c b/linux/drivers/media/video/cx18/cx18-queue.c
index 174682c25..c5a81aed6 100644
--- a/linux/drivers/media/video/cx18/cx18-queue.c
+++ b/linux/drivers/media/video/cx18/cx18-queue.c
@@ -75,30 +75,37 @@ struct cx18_buffer *cx18_dequeue(struct cx18_stream *s, struct cx18_queue *q)
return buf;
}
-struct cx18_buffer *cx18_queue_get_buf_irq(struct cx18_stream *s, u32 id,
+struct cx18_buffer *cx18_queue_get_buf(struct cx18_stream *s, u32 id,
u32 bytesused)
{
struct cx18 *cx = s->cx;
struct list_head *p;
+ unsigned long flags = 0;
- spin_lock(&s->qlock);
+ spin_lock_irqsave(&s->qlock, flags);
list_for_each(p, &s->q_free.list) {
struct cx18_buffer *buf =
list_entry(p, struct cx18_buffer, list);
- if (buf->id != id)
+ if (buf->id != id) {
+ CX18_DEBUG_HI_DMA("Skipping buffer %d searching for %d "
+ "in stream %s q_free\n", buf->id, id,
+ s->name);
continue;
+ }
buf->bytesused = bytesused;
- atomic_dec(&s->q_free.buffers);
- atomic_inc(&s->q_full.buffers);
- s->q_full.bytesused += buf->bytesused;
- list_move_tail(&buf->list, &s->q_full.list);
+ if (s->type != CX18_ENC_STREAM_TYPE_TS) {
+ atomic_dec(&s->q_free.buffers);
+ atomic_inc(&s->q_full.buffers);
+ s->q_full.bytesused += buf->bytesused;
+ list_move_tail(&buf->list, &s->q_full.list);
+ }
- spin_unlock(&s->qlock);
+ spin_unlock_irqrestore(&s->qlock, flags);
return buf;
}
- spin_unlock(&s->qlock);
+ spin_unlock_irqrestore(&s->qlock, flags);
CX18_ERR("Cannot find buffer %d for stream %s\n", id, s->name);
return NULL;
}