aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18/cx18-fileops.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-10-14 20:31:54 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-10-14 20:31:54 -0400
commit6dc6472581f693b5fc95aebedf67b4960fb85cf0 (patch)
tree06a5a9a08519950575505273eabced331ed51405 /drivers/media/video/cx18/cx18-fileops.c
parentee673eaa72d8d185012b1027a05e25aba18c267f (diff)
parent8acd3a60bcca17c6d89c73cee3ad6057eb83ba1e (diff)
Merge commit 'origin'
Manual fixup of conflicts on: arch/powerpc/include/asm/dcr-regs.h drivers/net/ibm_newemac/core.h
Diffstat (limited to 'drivers/media/video/cx18/cx18-fileops.c')
-rw-r--r--drivers/media/video/cx18/cx18-fileops.c47
1 files changed, 32 insertions, 15 deletions
diff --git a/drivers/media/video/cx18/cx18-fileops.c b/drivers/media/video/cx18/cx18-fileops.c
index 1e537fe04a23..5f9089907544 100644
--- a/drivers/media/video/cx18/cx18-fileops.c
+++ b/drivers/media/video/cx18/cx18-fileops.c
@@ -132,6 +132,7 @@ static void cx18_dualwatch(struct cx18 *cx)
132 u16 new_stereo_mode; 132 u16 new_stereo_mode;
133 const u16 stereo_mask = 0x0300; 133 const u16 stereo_mask = 0x0300;
134 const u16 dual = 0x0200; 134 const u16 dual = 0x0200;
135 u32 h;
135 136
136 new_stereo_mode = cx->params.audio_properties & stereo_mask; 137 new_stereo_mode = cx->params.audio_properties & stereo_mask;
137 memset(&vt, 0, sizeof(vt)); 138 memset(&vt, 0, sizeof(vt));
@@ -143,13 +144,21 @@ static void cx18_dualwatch(struct cx18 *cx)
143 if (new_stereo_mode == cx->dualwatch_stereo_mode) 144 if (new_stereo_mode == cx->dualwatch_stereo_mode)
144 return; 145 return;
145 146
146 new_bitmap = new_stereo_mode | (cx->params.audio_properties & ~stereo_mask); 147 new_bitmap = new_stereo_mode
148 | (cx->params.audio_properties & ~stereo_mask);
147 149
148 CX18_DEBUG_INFO("dualwatch: change stereo flag from 0x%x to 0x%x. new audio_bitmask=0x%ux\n", 150 CX18_DEBUG_INFO("dualwatch: change stereo flag from 0x%x to 0x%x. "
149 cx->dualwatch_stereo_mode, new_stereo_mode, new_bitmap); 151 "new audio_bitmask=0x%ux\n",
152 cx->dualwatch_stereo_mode, new_stereo_mode, new_bitmap);
150 153
151 if (cx18_vapi(cx, CX18_CPU_SET_AUDIO_PARAMETERS, 2, 154 h = cx18_find_handle(cx);
152 cx18_find_handle(cx), new_bitmap) == 0) { 155 if (h == CX18_INVALID_TASK_HANDLE) {
156 CX18_DEBUG_INFO("dualwatch: can't find valid task handle\n");
157 return;
158 }
159
160 if (cx18_vapi(cx,
161 CX18_CPU_SET_AUDIO_PARAMETERS, 2, h, new_bitmap) == 0) {
153 cx->dualwatch_stereo_mode = new_stereo_mode; 162 cx->dualwatch_stereo_mode = new_stereo_mode;
154 return; 163 return;
155 } 164 }
@@ -223,7 +232,7 @@ static struct cx18_buffer *cx18_get_buffer(struct cx18_stream *s, int non_block,
223 prepare_to_wait(&s->waitq, &wait, TASK_INTERRUPTIBLE); 232 prepare_to_wait(&s->waitq, &wait, TASK_INTERRUPTIBLE);
224 /* New buffers might have become available before we were added 233 /* New buffers might have become available before we were added
225 to the waitqueue */ 234 to the waitqueue */
226 if (!s->q_full.buffers) 235 if (!atomic_read(&s->q_full.buffers))
227 schedule(); 236 schedule();
228 finish_wait(&s->waitq, &wait); 237 finish_wait(&s->waitq, &wait);
229 if (signal_pending(current)) { 238 if (signal_pending(current)) {
@@ -509,7 +518,7 @@ unsigned int cx18_v4l2_enc_poll(struct file *filp, poll_table *wait)
509 CX18_DEBUG_HI_FILE("Encoder poll\n"); 518 CX18_DEBUG_HI_FILE("Encoder poll\n");
510 poll_wait(filp, &s->waitq, wait); 519 poll_wait(filp, &s->waitq, wait);
511 520
512 if (s->q_full.length || s->q_io.length) 521 if (atomic_read(&s->q_full.buffers) || atomic_read(&s->q_io.buffers))
513 return POLLIN | POLLRDNORM; 522 return POLLIN | POLLRDNORM;
514 if (eof) 523 if (eof)
515 return POLLHUP; 524 return POLLHUP;
@@ -695,20 +704,28 @@ int cx18_v4l2_open(struct inode *inode, struct file *filp)
695 704
696void cx18_mute(struct cx18 *cx) 705void cx18_mute(struct cx18 *cx)
697{ 706{
698 if (atomic_read(&cx->ana_capturing)) 707 u32 h;
699 cx18_vapi(cx, CX18_CPU_SET_AUDIO_MUTE, 2, 708 if (atomic_read(&cx->ana_capturing)) {
700 cx18_find_handle(cx), 1); 709 h = cx18_find_handle(cx);
710 if (h != CX18_INVALID_TASK_HANDLE)
711 cx18_vapi(cx, CX18_CPU_SET_AUDIO_MUTE, 2, h, 1);
712 else
713 CX18_ERR("Can't find valid task handle for mute\n");
714 }
701 CX18_DEBUG_INFO("Mute\n"); 715 CX18_DEBUG_INFO("Mute\n");
702} 716}
703 717
704void cx18_unmute(struct cx18 *cx) 718void cx18_unmute(struct cx18 *cx)
705{ 719{
720 u32 h;
706 if (atomic_read(&cx->ana_capturing)) { 721 if (atomic_read(&cx->ana_capturing)) {
707 cx18_msleep_timeout(100, 0); 722 h = cx18_find_handle(cx);
708 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 2, 723 if (h != CX18_INVALID_TASK_HANDLE) {
709 cx18_find_handle(cx), 12); 724 cx18_msleep_timeout(100, 0);
710 cx18_vapi(cx, CX18_CPU_SET_AUDIO_MUTE, 2, 725 cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 2, h, 12);
711 cx18_find_handle(cx), 0); 726 cx18_vapi(cx, CX18_CPU_SET_AUDIO_MUTE, 2, h, 0);
727 } else
728 CX18_ERR("Can't find valid task handle for unmute\n");
712 } 729 }
713 CX18_DEBUG_INFO("Unmute\n"); 730 CX18_DEBUG_INFO("Unmute\n");
714} 731}