summaryrefslogtreecommitdiff
path: root/linux/drivers/media
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-04-13 11:40:10 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-13 11:40:10 -0300
commitf608f62c7cd71c356a71c48404a1d6a898f2b01d (patch)
treeb672e7cf7e5bc35e9cb05a09485847c611126d0f /linux/drivers/media
parent99a713aed39a24dc2f0ba5dd70f202757554c382 (diff)
downloadmediapointer-dvb-s2-f608f62c7cd71c356a71c48404a1d6a898f2b01d.tar.gz
mediapointer-dvb-s2-f608f62c7cd71c356a71c48404a1d6a898f2b01d.tar.bz2
Fix capture start/stop and timeout
From: Mauro Carvalho Chehab <mchehab@infradead.org> Also removes the dead restart_video_queue() function Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media')
-rw-r--r--linux/drivers/media/video/em28xx/em28xx-video.c88
1 files changed, 5 insertions, 83 deletions
diff --git a/linux/drivers/media/video/em28xx/em28xx-video.c b/linux/drivers/media/video/em28xx/em28xx-video.c
index 06ecc3e3f..81e21f538 100644
--- a/linux/drivers/media/video/em28xx/em28xx-video.c
+++ b/linux/drivers/media/video/em28xx/em28xx-video.c
@@ -440,12 +440,6 @@ static void em28xx_irq_callback(struct urb *urb)
urb->status);
}
-#if 0 /* Bad idea. There are problems that cause a load of valid, but
- empty, data packets. Don't reset the timeout unless we've actually
- got a frame. I've had xawtv hang in free_buffer due to this! */
- if (rc >= 0)
- mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT);
-#endif
spin_unlock_irqrestore(&dev->slock,flags);
}
@@ -485,7 +479,7 @@ static void em28xx_uninit_isoc(struct em28xx *dev)
dev->isoc_ctl.num_bufs=0;
- // em28xx_capture_start(dev, 0); - FIXME - how could I restart it?
+ em28xx_capture_start(dev, 0);
}
#if 0
@@ -593,6 +587,8 @@ static int em28xx_start_thread( struct em28xx_dmaqueue *dma_q)
init_waitqueue_head(&dma_q->wq);
+ em28xx_capture_start(dev, 1);
+
/* submit urbs and enables IRQ */
for (i = 0; i < dev->isoc_ctl.num_bufs; i++) {
rc = usb_submit_urb(dev->isoc_ctl.urb[i], GFP_ATOMIC);
@@ -610,71 +606,6 @@ static int em28xx_start_thread( struct em28xx_dmaqueue *dma_q)
return 0;
}
-#if 0
-static int restart_video_queue(struct em28xx_dmaqueue *dma_q)
-{
- struct em28xx *dev= container_of(dma_q,struct em28xx,vidq);
-
- struct em28xx_buffer *buf, *prev;
- struct list_head *item;
-
- em28xx_videodbg("%s dma_q=0x%08lx\n",
- __FUNCTION__,(unsigned long)dma_q);
-
- if (!list_empty(&dma_q->active)) {
- buf = list_entry(dma_q->active.next, struct em28xx_buffer, vb.queue);
- em28xx_videodbg("restart_queue [%p/%d]: restart dma\n",
- buf, buf->vb.i);
- em28xx_stop_thread(dma_q);
- em28xx_start_thread(dma_q, buf);
-
- /* cancel all outstanding capture / vbi requests */
- list_for_each(item,&dma_q->active) {
- buf = list_entry(item, struct em28xx_buffer, vb.queue);
-
- list_del(&buf->vb.queue);
- buf->vb.state = VIDEOBUF_ERROR;
- wake_up(&buf->vb.done);
- }
- mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT);
-
- return 0;
- }
-
- prev = NULL;
- for (;;) {
- if (list_empty(&dma_q->queued))
- return 0;
- buf = list_entry(dma_q->queued.next, struct em28xx_buffer, vb.queue);
- if (NULL == prev) {
- list_del(&buf->vb.queue);
- list_add_tail(&buf->vb.queue,&dma_q->active);
-
- em28xx_videodbg("Restarting video dma\n");
- em28xx_stop_thread(dma_q);
- em28xx_start_thread(dma_q, buf);
-
- buf->vb.state = VIDEOBUF_ACTIVE;
- mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT);
- em28xx_videodbg("[%p/%d] restart_queue -"
- " first active\n", buf, buf->vb.i);
-
- } else if (prev->vb.width == buf->vb.width &&
- prev->vb.height == buf->vb.height &&
- prev->fmt == buf->fmt) {
- list_del(&buf->vb.queue);
- list_add_tail(&buf->vb.queue,&dma_q->active);
- buf->vb.state = VIDEOBUF_ACTIVE;
- em28xx_videodbg("[%p/%d] restart_queue -"
- " move to active\n",buf,buf->vb.i);
- } else {
- return 0;
- }
- prev = buf;
- }
-}
-#endif
-
static void em28xx_vid_timeout(unsigned long data)
{
struct em28xx *dev = (struct em28xx*)data;
@@ -692,8 +623,9 @@ static void em28xx_vid_timeout(unsigned long data)
em28xx_videodbg("em28xx/0: [%p/%d] timeout\n",
buf, buf->vb.i);
}
+ /* Instead of trying to restart, just sets timeout again */
+ mod_timer(&vidq->timeout, jiffies + BUFFER_TIMEOUT);
- /* restart_video_queue(vidq); */
spin_unlock_irqrestore(&dev->slock,flags);
}
@@ -771,7 +703,6 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb,
if (rc<0)
goto fail;
- /* FIXME - should probably be done in response to STREAMON */
rc = em28xx_start_thread(vidq);
if (rc<0)
goto fail;
@@ -1104,7 +1035,6 @@ static int vidioc_s_fmt_cap(struct file *file, void *priv,
get_scale(dev, dev->width, dev->height, &dev->hscale, &dev->vscale);
em28xx_set_alternate(dev);
- em28xx_capture_start(dev, 1); /* ??? */
em28xx_resolution_set(dev);
mutex_unlock(&dev->lock);
@@ -1534,14 +1464,6 @@ static int vidioc_streamon(struct file *file, void *priv,
if (unlikely(res_get(fh) < 0))
return -EBUSY;
- /* We can't do this from buffer_queue or anything called from
- there, since it's called with IRQs disabled and the spinlock held,
- and this uses USB functions that may sleep
-
- FIXME FIXME FIXME - putting this here means it may not always
- be called when it needs to be */
- em28xx_capture_start(dev, 1);
-
return (videobuf_streamon(&fh->vb_vidq));
}