aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2007-07-17 17:29:45 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-07-30 15:26:26 -0400
commit9896bbc1972e3a0595f06c23692a20150a789308 (patch)
tree1dc4b82182251bc747c8f40b3a791607124c39dd /drivers/media
parent603d6f2c8f9f3604f9c6c1f8903efc2df30a000f (diff)
V4L/DVB (5891): zr36067: Turn off raw capture properly
When raw capture was turned off, the current capturing frame (v4l_grab_frame) wasn't reset to NO_GRAB_ACTIVE. If capture was turned back on, the driver would think this frame was currently being captured, and wait for it to complete before starting a new frame. The hardware on the other hand would not be actively capturing a frame. The result was the driver would wait forever for v4l_grab_frame to be captured. Some calls to zr36057_set_memgrab(0) were missing spin-locks, which have been added. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Acked-by: Ronald S. Bultje <rbultje@ronald.bitfreak.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/zoran_device.c17
-rw-r--r--drivers/media/video/zoran_driver.c15
2 files changed, 26 insertions, 6 deletions
diff --git a/drivers/media/video/zoran_device.c b/drivers/media/video/zoran_device.c
index d9640ec4b9b0..ba2f4ed29483 100644
--- a/drivers/media/video/zoran_device.c
+++ b/drivers/media/video/zoran_device.c
@@ -620,11 +620,17 @@ zr36057_set_memgrab (struct zoran *zr,
620 int mode) 620 int mode)
621{ 621{
622 if (mode) { 622 if (mode) {
623 if (btread(ZR36057_VSSFGR) & 623 /* We only check SnapShot and not FrameGrab here. SnapShot==1
624 (ZR36057_VSSFGR_SnapShot | ZR36057_VSSFGR_FrameGrab)) 624 * means a capture is already in progress, but FrameGrab==1
625 * doesn't necessary mean that. It's more correct to say a 1
626 * to 0 transition indicates a capture completed. If a
627 * capture is pending when capturing is tuned off, FrameGrab
628 * will be stuck at 1 until capturing is turned back on.
629 */
630 if (btread(ZR36057_VSSFGR) & ZR36057_VSSFGR_SnapShot)
625 dprintk(1, 631 dprintk(1,
626 KERN_WARNING 632 KERN_WARNING
627 "%s: zr36057_set_memgrab(1) with SnapShot or FrameGrab on!?\n", 633 "%s: zr36057_set_memgrab(1) with SnapShot on!?\n",
628 ZR_DEVNAME(zr)); 634 ZR_DEVNAME(zr));
629 635
630 /* switch on VSync interrupts */ 636 /* switch on VSync interrupts */
@@ -641,11 +647,12 @@ zr36057_set_memgrab (struct zoran *zr,
641 647
642 zr->v4l_memgrab_active = 1; 648 zr->v4l_memgrab_active = 1;
643 } else { 649 } else {
644 zr->v4l_memgrab_active = 0;
645
646 /* switch off VSync interrupts */ 650 /* switch off VSync interrupts */
647 btand(~zr->card.vsync_int, ZR36057_ICR); // SW 651 btand(~zr->card.vsync_int, ZR36057_ICR); // SW
648 652
653 zr->v4l_memgrab_active = 0;
654 zr->v4l_grab_frame = NO_GRAB_ACTIVE;
655
649 /* reenable grabbing to screen if it was running */ 656 /* reenable grabbing to screen if it was running */
650 if (zr->v4l_overlay_active) { 657 if (zr->v4l_overlay_active) {
651 zr36057_overlay(zr, 1); 658 zr36057_overlay(zr, 1);
diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c
index ec9ae6c61bd5..72a037b75d63 100644
--- a/drivers/media/video/zoran_driver.c
+++ b/drivers/media/video/zoran_driver.c
@@ -1188,10 +1188,14 @@ zoran_close_end_session (struct file *file)
1188 1188
1189 /* v4l capture */ 1189 /* v4l capture */
1190 if (fh->v4l_buffers.active != ZORAN_FREE) { 1190 if (fh->v4l_buffers.active != ZORAN_FREE) {
1191 long flags;
1192
1193 spin_lock_irqsave(&zr->spinlock, flags);
1191 zr36057_set_memgrab(zr, 0); 1194 zr36057_set_memgrab(zr, 0);
1192 zr->v4l_buffers.allocated = 0; 1195 zr->v4l_buffers.allocated = 0;
1193 zr->v4l_buffers.active = fh->v4l_buffers.active = 1196 zr->v4l_buffers.active = fh->v4l_buffers.active =
1194 ZORAN_FREE; 1197 ZORAN_FREE;
1198 spin_unlock_irqrestore(&zr->spinlock, flags);
1195 } 1199 }
1196 1200
1197 /* v4l buffers */ 1201 /* v4l buffers */
@@ -3456,8 +3460,13 @@ zoran_do_ioctl (struct inode *inode,
3456 goto strmoff_unlock_and_return; 3460 goto strmoff_unlock_and_return;
3457 3461
3458 /* unload capture */ 3462 /* unload capture */
3459 if (zr->v4l_memgrab_active) 3463 if (zr->v4l_memgrab_active) {
3464 long flags;
3465
3466 spin_lock_irqsave(&zr->spinlock, flags);
3460 zr36057_set_memgrab(zr, 0); 3467 zr36057_set_memgrab(zr, 0);
3468 spin_unlock_irqrestore(&zr->spinlock, flags);
3469 }
3461 3470
3462 for (i = 0; i < fh->v4l_buffers.num_buffers; i++) 3471 for (i = 0; i < fh->v4l_buffers.num_buffers; i++)
3463 zr->v4l_buffers.buffer[i].state = 3472 zr->v4l_buffers.buffer[i].state =
@@ -4392,11 +4401,15 @@ zoran_vm_close (struct vm_area_struct *vma)
4392 mutex_lock(&zr->resource_lock); 4401 mutex_lock(&zr->resource_lock);
4393 4402
4394 if (fh->v4l_buffers.active != ZORAN_FREE) { 4403 if (fh->v4l_buffers.active != ZORAN_FREE) {
4404 long flags;
4405
4406 spin_lock_irqsave(&zr->spinlock, flags);
4395 zr36057_set_memgrab(zr, 0); 4407 zr36057_set_memgrab(zr, 0);
4396 zr->v4l_buffers.allocated = 0; 4408 zr->v4l_buffers.allocated = 0;
4397 zr->v4l_buffers.active = 4409 zr->v4l_buffers.active =
4398 fh->v4l_buffers.active = 4410 fh->v4l_buffers.active =
4399 ZORAN_FREE; 4411 ZORAN_FREE;
4412 spin_unlock_irqrestore(&zr->spinlock, flags);
4400 } 4413 }
4401 //v4l_fbuffer_free(file); 4414 //v4l_fbuffer_free(file);
4402 fh->v4l_buffers.allocated = 0; 4415 fh->v4l_buffers.allocated = 0;