diff options
author | Andy Walls <awalls@radix.net> | 2008-11-05 23:15:41 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-12-30 06:38:02 -0500 |
commit | 72c2d6d3ac91d1b9efb482ff4a8dd68e3d867965 (patch) | |
tree | 0e80f865ac4763e30eb7777360fbf3d860b140f0 /drivers/media/video/cx18/cx18-irq.c | |
parent | f68d0cf56761128e85ebc98d8de4776b89c30279 (diff) |
V4L/DVB (9593): cx18: Add outgoing mailbox mutexes and check for ack via waitq vs poll
Add mutexes to ensure exclusive access for outgoing driver to CX23418 mailboxes.
Also wait on a waitq for mailbox acknowledgement from the CX23418 instead of
polling.
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 | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/drivers/media/video/cx18/cx18-irq.c b/drivers/media/video/cx18/cx18-irq.c index 33f56c61ca74..37b931055d3a 100644 --- a/drivers/media/video/cx18/cx18-irq.c +++ b/drivers/media/video/cx18/cx18-irq.c | |||
@@ -38,7 +38,7 @@ void cx18_work_handler(struct work_struct *work) | |||
38 | cx18_dvb_work_handler(cx); | 38 | cx18_dvb_work_handler(cx); |
39 | } | 39 | } |
40 | 40 | ||
41 | static void epu_dma_done(struct cx18 *cx, struct cx18_mailbox *mb) | 41 | static void epu_dma_done(struct cx18 *cx, struct cx18_mailbox *mb, int rpu) |
42 | { | 42 | { |
43 | u32 handle = mb->args[0]; | 43 | u32 handle = mb->args[0]; |
44 | struct cx18_stream *s = NULL; | 44 | struct cx18_stream *s = NULL; |
@@ -59,7 +59,7 @@ static void epu_dma_done(struct cx18 *cx, struct cx18_mailbox *mb) | |||
59 | " handle %d\n", handle); | 59 | " handle %d\n", handle); |
60 | mb->error = CXERR_NOT_OPEN; | 60 | mb->error = CXERR_NOT_OPEN; |
61 | mb->cmd = 0; | 61 | mb->cmd = 0; |
62 | cx18_mb_ack(cx, mb); | 62 | cx18_mb_ack(cx, mb, rpu); |
63 | return; | 63 | return; |
64 | } | 64 | } |
65 | 65 | ||
@@ -86,13 +86,13 @@ static void epu_dma_done(struct cx18 *cx, struct cx18_mailbox *mb) | |||
86 | } | 86 | } |
87 | mb->error = 0; | 87 | mb->error = 0; |
88 | mb->cmd = 0; | 88 | mb->cmd = 0; |
89 | cx18_mb_ack(cx, mb); | 89 | cx18_mb_ack(cx, mb, rpu); |
90 | wake_up(&cx->dma_waitq); | 90 | wake_up(&cx->dma_waitq); |
91 | if (s->id != -1) | 91 | if (s->id != -1) |
92 | wake_up(&s->waitq); | 92 | wake_up(&s->waitq); |
93 | } | 93 | } |
94 | 94 | ||
95 | static void epu_debug(struct cx18 *cx, struct cx18_mailbox *mb) | 95 | static void epu_debug(struct cx18 *cx, struct cx18_mailbox *mb, int rpu) |
96 | { | 96 | { |
97 | char str[256] = { 0 }; | 97 | char str[256] = { 0 }; |
98 | char *p; | 98 | char *p; |
@@ -102,7 +102,7 @@ static void epu_debug(struct cx18 *cx, struct cx18_mailbox *mb) | |||
102 | cx18_memcpy_fromio(cx, str, cx->enc_mem + mb->args[1], 252); | 102 | cx18_memcpy_fromio(cx, str, cx->enc_mem + mb->args[1], 252); |
103 | str[252] = 0; | 103 | str[252] = 0; |
104 | } | 104 | } |
105 | cx18_mb_ack(cx, mb); | 105 | cx18_mb_ack(cx, mb, rpu); |
106 | CX18_DEBUG_INFO("%x %s\n", mb->args[0], str); | 106 | CX18_DEBUG_INFO("%x %s\n", mb->args[0], str); |
107 | p = strchr(str, '.'); | 107 | p = strchr(str, '.'); |
108 | if (!test_bit(CX18_F_I_LOADED_FW, &cx->i_flags) && p && p > str) | 108 | if (!test_bit(CX18_F_I_LOADED_FW, &cx->i_flags) && p && p > str) |
@@ -119,10 +119,10 @@ static void epu_cmd(struct cx18 *cx, u32 sw1) | |||
119 | 119 | ||
120 | switch (mb.cmd) { | 120 | switch (mb.cmd) { |
121 | case CX18_EPU_DMA_DONE: | 121 | case CX18_EPU_DMA_DONE: |
122 | epu_dma_done(cx, &mb); | 122 | epu_dma_done(cx, &mb, CPU); |
123 | break; | 123 | break; |
124 | case CX18_EPU_DEBUG: | 124 | case CX18_EPU_DEBUG: |
125 | epu_debug(cx, &mb); | 125 | epu_debug(cx, &mb, CPU); |
126 | break; | 126 | break; |
127 | default: | 127 | default: |
128 | CX18_WARN("Unknown CPU_TO_EPU mailbox command %#08x\n", | 128 | CX18_WARN("Unknown CPU_TO_EPU mailbox command %#08x\n", |
@@ -135,11 +135,6 @@ static void epu_cmd(struct cx18 *cx, u32 sw1) | |||
135 | cx18_memcpy_fromio(cx, &mb, &cx->scb->apu2epu_mb, sizeof(mb)); | 135 | cx18_memcpy_fromio(cx, &mb, &cx->scb->apu2epu_mb, sizeof(mb)); |
136 | CX18_WARN("Unknown APU_TO_EPU mailbox command %#08x\n", mb.cmd); | 136 | CX18_WARN("Unknown APU_TO_EPU mailbox command %#08x\n", mb.cmd); |
137 | } | 137 | } |
138 | |||
139 | if (sw1 & IRQ_HPU_TO_EPU) { | ||
140 | cx18_memcpy_fromio(cx, &mb, &cx->scb->hpu2epu_mb, sizeof(mb)); | ||
141 | CX18_WARN("Unknown HPU_TO_EPU mailbox command %#08x\n", mb.cmd); | ||
142 | } | ||
143 | } | 138 | } |
144 | 139 | ||
145 | static void xpu_ack(struct cx18 *cx, u32 sw2) | 140 | static void xpu_ack(struct cx18 *cx, u32 sw2) |
@@ -148,8 +143,6 @@ static void xpu_ack(struct cx18 *cx, u32 sw2) | |||
148 | wake_up(&cx->mb_cpu_waitq); | 143 | wake_up(&cx->mb_cpu_waitq); |
149 | if (sw2 & IRQ_APU_TO_EPU_ACK) | 144 | if (sw2 & IRQ_APU_TO_EPU_ACK) |
150 | wake_up(&cx->mb_apu_waitq); | 145 | wake_up(&cx->mb_apu_waitq); |
151 | if (sw2 & IRQ_HPU_TO_EPU_ACK) | ||
152 | wake_up(&cx->mb_hpu_waitq); | ||
153 | } | 146 | } |
154 | 147 | ||
155 | irqreturn_t cx18_irq_handler(int irq, void *dev_id) | 148 | irqreturn_t cx18_irq_handler(int irq, void *dev_id) |