summaryrefslogtreecommitdiff
path: root/linux/drivers/media
diff options
context:
space:
mode:
authorGerd Knorr <devnull@localhost>2004-09-06 10:40:21 +0000
committerGerd Knorr <devnull@localhost>2004-09-06 10:40:21 +0000
commit86e6c8cbd39e3f5ff9f121ff23f1c0b1741781b3 (patch)
tree196abc919eae7feaed3147732e8aaba88965984c /linux/drivers/media
parent05f9a06beff29d379571d105e161d99ffff72b03 (diff)
downloadmediapointer-dvb-s2-86e6c8cbd39e3f5ff9f121ff23f1c0b1741781b3.tar.gz
mediapointer-dvb-s2-86e6c8cbd39e3f5ff9f121ff23f1c0b1741781b3.tar.bz2
- cx88: misc dvb tweaks.
Diffstat (limited to 'linux/drivers/media')
-rw-r--r--linux/drivers/media/video/cx88/cx88-dvb.c12
-rw-r--r--linux/drivers/media/video/cx88/cx88-mpeg.c48
-rw-r--r--linux/drivers/media/video/cx88/cx88.h3
3 files changed, 42 insertions, 21 deletions
diff --git a/linux/drivers/media/video/cx88/cx88-dvb.c b/linux/drivers/media/video/cx88/cx88-dvb.c
index e6e1145a3..97e354d8a 100644
--- a/linux/drivers/media/video/cx88/cx88-dvb.c
+++ b/linux/drivers/media/video/cx88/cx88-dvb.c
@@ -98,9 +98,12 @@ static int dvb_thread(void *data)
buf = list_entry(dev->dvbq.stream.next,
struct videobuf_buffer, stream);
list_del(&buf->stream);
- err = videobuf_waiton(buf,0,0);
+ err = videobuf_waiton(buf,0,1);
+ BUG_ON(0 != err);
- /* stop_feed asked us to quit */
+ /* no more feeds left or stop_feed asked us to quit */
+ if (0 == dev->nfeeds)
+ break;
if (kthread_should_stop())
break;
@@ -108,13 +111,13 @@ static int dvb_thread(void *data)
if (buf->state == STATE_DONE)
dvb_dmx_swfilter(&dev->demux, buf->dma.vmalloc,
buf->size);
-
+
/* requeue buffer */
list_add_tail(&buf->stream,&dev->dvbq.stream);
spin_lock_irqsave(dev->dvbq.irqlock,flags);
dev->dvbq.ops->buf_queue(file,buf);
spin_unlock_irqrestore(dev->dvbq.irqlock,flags);
-
+
/* log errors if any */
if (dev->error_count || dev->stopper_count || dev->timeout_count) {
printk("%s: error=%d stopper=%d timeout=%d\n",
@@ -172,6 +175,7 @@ static int dvb_stop_feed(struct dvb_demux_feed *feed)
down(&dev->lock);
dev->nfeeds--;
if (0 == dev->nfeeds && NULL != dev->dvb_thread) {
+ cx8802_cancel_buffers(dev);
err = kthread_stop(dev->dvb_thread);
dev->dvb_thread = NULL;
}
diff --git a/linux/drivers/media/video/cx88/cx88-mpeg.c b/linux/drivers/media/video/cx88/cx88-mpeg.c
index a02423473..a878a5fa4 100644
--- a/linux/drivers/media/video/cx88/cx88-mpeg.c
+++ b/linux/drivers/media/video/cx88/cx88-mpeg.c
@@ -1,5 +1,5 @@
/*
- * $Id: cx88-mpeg.c,v 1.7 2004/08/31 14:08:45 kraxel Exp $
+ * $Id: cx88-mpeg.c,v 1.8 2004/09/06 10:40:21 kraxel Exp $
*
* Support for the mpeg transport stream transfers
* PCI function #2 of the cx2388x.
@@ -201,36 +201,51 @@ void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf)
/* ----------------------------------------------------------- */
-static void cx8802_timeout(unsigned long data)
+static void do_cancel_buffers(struct cx8802_dev *dev, char *reason, int restart)
{
- struct cx8802_dev *dev = (struct cx8802_dev*)data;
struct cx88_dmaqueue *q = &dev->mpegq;
struct cx88_buffer *buf;
unsigned long flags;
- dprintk(0, "cx8802_mpegport_timeout\n");
-
-#if 0 /* FIXME */
- mpegport_api_cmd(dev, IVTV_API_END_CAPTURE, 3, 0, 1, 0, 0x13);
-#endif
-
- cx88_sram_channel_dump(dev->core, &cx88_sram_channels[SRAM_CH28]);
- cx8802_shutdown(dev);
- dev->timeout_count++;
-
spin_lock_irqsave(&dev->slock,flags);
while (!list_empty(&q->active)) {
buf = list_entry(q->active.next, struct cx88_buffer, vb.queue);
list_del(&buf->vb.queue);
buf->vb.state = STATE_ERROR;
wake_up(&buf->vb.done);
- printk("%s: [%p/%d] timeout - dma=0x%08lx\n", dev->core->name,
- buf, buf->vb.i, (unsigned long)buf->risc.dma);
+ dprintk(1,"[%p/%d] %s - dma=0x%08lx\n",
+ buf, buf->vb.i, reason, (unsigned long)buf->risc.dma);
}
- cx8802_restart_queue(dev,q);
+ if (restart)
+ cx8802_restart_queue(dev,q);
spin_unlock_irqrestore(&dev->slock,flags);
}
+void cx8802_cancel_buffers(struct cx8802_dev *dev)
+{
+ struct cx88_dmaqueue *q = &dev->mpegq;
+
+ del_timer_sync(&q->timeout);
+ cx8802_shutdown(dev);
+ do_cancel_buffers(dev,"cancel",0);
+}
+
+static void cx8802_timeout(unsigned long data)
+{
+ struct cx8802_dev *dev = (struct cx8802_dev*)data;
+
+ dprintk(0, "%s\n",__FUNCTION__);
+
+#if 0 /* FIXME */
+ mpegport_api_cmd(dev, IVTV_API_END_CAPTURE, 3, 0, 1, 0, 0x13);
+#endif
+
+ cx88_sram_channel_dump(dev->core, &cx88_sram_channels[SRAM_CH28]);
+ cx8802_shutdown(dev);
+ dev->timeout_count++;
+ do_cancel_buffers(dev,"timeout",1);
+}
+
static void cx8802_mpeg_irq(struct cx8802_dev *dev)
{
struct cx88_core *core = dev->core;
@@ -385,6 +400,7 @@ void cx8802_fini_common(struct cx8802_dev *dev)
EXPORT_SYMBOL(cx8802_buf_prepare);
EXPORT_SYMBOL(cx8802_buf_queue);
+EXPORT_SYMBOL(cx8802_cancel_buffers);
EXPORT_SYMBOL(cx8802_init_common);
EXPORT_SYMBOL(cx8802_fini_common);
diff --git a/linux/drivers/media/video/cx88/cx88.h b/linux/drivers/media/video/cx88/cx88.h
index 0a2023f4c..8cc3a1753 100644
--- a/linux/drivers/media/video/cx88/cx88.h
+++ b/linux/drivers/media/video/cx88/cx88.h
@@ -1,5 +1,5 @@
/*
- * $Id: cx88.h,v 1.30 2004/09/06 09:25:29 kraxel Exp $
+ * $Id: cx88.h,v 1.31 2004/09/06 10:40:21 kraxel Exp $
*
* v4l2 device driver for cx2388x based TV cards
*
@@ -523,6 +523,7 @@ int cx88_audio_thread(void *data);
int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf);
void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf);
+void cx8802_cancel_buffers(struct cx8802_dev *dev);
int cx8802_init_common(struct cx8802_dev *dev);
void cx8802_fini_common(struct cx8802_dev *dev);