diff options
author | Andy Walls <awalls@radix.net> | 2008-11-04 22:49:14 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-11-11 05:11:33 -0500 |
commit | 1d6782bda5c1fb2bca44af50647b45427d8ef4ec (patch) | |
tree | 11cc68f4410ca4850ff3d874900f628ed9326064 /drivers/media/video/cx18/cx18-irq.c | |
parent | c9ff1b689a5d605640f098afc37d6102ecef9876 (diff) |
V4L/DVB (9516): cx18: Move DVB buffer transfer handling from irq handler to work_queue
cx18: Move DVB buffer transfer handling from irq handler to work_queue thread.
In order to properly lock the epu2cpu mailbox for driver to CX23418 commands,
the DVB/TS buffer handling needs to be moved from the IRQ handler and IRQ
context to a work queue. This work_queue implmentation is strikingly similar
to the ivtv implementation - for better or worse.
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx18/cx18-irq.c')
-rw-r--r-- | drivers/media/video/cx18/cx18-irq.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/drivers/media/video/cx18/cx18-irq.c b/drivers/media/video/cx18/cx18-irq.c index c306e142c1c..5fbfbd0f149 100644 --- a/drivers/media/video/cx18/cx18-irq.c +++ b/drivers/media/video/cx18/cx18-irq.c | |||
@@ -29,6 +29,20 @@ | |||
29 | #include "cx18-mailbox.h" | 29 | #include "cx18-mailbox.h" |
30 | #include "cx18-vbi.h" | 30 | #include "cx18-vbi.h" |
31 | #include "cx18-scb.h" | 31 | #include "cx18-scb.h" |
32 | #include "cx18-dvb.h" | ||
33 | |||
34 | void cx18_work_handler(struct work_struct *work) | ||
35 | { | ||
36 | struct cx18 *cx = container_of(work, struct cx18, work); | ||
37 | if (test_and_clear_bit(CX18_F_I_WORK_INITED, &cx->i_flags)) { | ||
38 | struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 }; | ||
39 | /* This thread must use the FIFO scheduler as it | ||
40 | * is realtime sensitive. */ | ||
41 | sched_setscheduler(current, SCHED_FIFO, ¶m); | ||
42 | } | ||
43 | if (test_and_clear_bit(CX18_F_I_WORK_HANDLER_DVB, &cx->i_flags)) | ||
44 | cx18_dvb_work_handler(cx); | ||
45 | } | ||
32 | 46 | ||
33 | static void epu_dma_done(struct cx18 *cx, struct cx18_mailbox *mb) | 47 | static void epu_dma_done(struct cx18 *cx, struct cx18_mailbox *mb) |
34 | { | 48 | { |
@@ -65,17 +79,11 @@ static void epu_dma_done(struct cx18 *cx, struct cx18_mailbox *mb) | |||
65 | if (buf) { | 79 | if (buf) { |
66 | cx18_buf_sync_for_cpu(s, buf); | 80 | cx18_buf_sync_for_cpu(s, buf); |
67 | if (s->type == CX18_ENC_STREAM_TYPE_TS && s->dvb.enabled) { | 81 | if (s->type == CX18_ENC_STREAM_TYPE_TS && s->dvb.enabled) { |
68 | /* process the buffer here */ | 82 | CX18_DEBUG_HI_DMA("TS recv bytesused = %d\n", |
69 | CX18_DEBUG_HI_DMA("TS recv and sent bytesused=%d\n", | ||
70 | buf->bytesused); | 83 | buf->bytesused); |
71 | 84 | ||
72 | dvb_dmx_swfilter(&s->dvb.demux, buf->buf, | 85 | set_bit(CX18_F_I_WORK_HANDLER_DVB, &cx->i_flags); |
73 | buf->bytesused); | 86 | set_bit(CX18_F_I_HAVE_WORK, &cx->i_flags); |
74 | |||
75 | cx18_buf_sync_for_device(s, buf); | ||
76 | cx18_vapi(cx, CX18_CPU_DE_SET_MDL, 5, s->handle, | ||
77 | (void __iomem *)&cx->scb->cpu_mdl[buf->id] - cx->enc_mem, | ||
78 | 1, buf->id, s->buf_size); | ||
79 | } else | 87 | } else |
80 | set_bit(CX18_F_B_NEED_BUF_SWAP, &buf->b_flags); | 88 | set_bit(CX18_F_B_NEED_BUF_SWAP, &buf->b_flags); |
81 | } else { | 89 | } else { |
@@ -185,5 +193,8 @@ irqreturn_t cx18_irq_handler(int irq, void *dev_id) | |||
185 | if (sw1) | 193 | if (sw1) |
186 | epu_cmd(cx, sw1); | 194 | epu_cmd(cx, sw1); |
187 | 195 | ||
196 | if (test_and_clear_bit(CX18_F_I_HAVE_WORK, &cx->i_flags)) | ||
197 | queue_work(cx->work_queue, &cx->work); | ||
198 | |||
188 | return (sw1 || sw2 || hw2) ? IRQ_HANDLED : IRQ_NONE; | 199 | return (sw1 || sw2 || hw2) ? IRQ_HANDLED : IRQ_NONE; |
189 | } | 200 | } |