summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/saa7134/saa7134-ts.c
diff options
context:
space:
mode:
authorHartmut Hackmann <devnull@localhost>2005-09-11 19:46:10 +0000
committerHartmut Hackmann <devnull@localhost>2005-09-11 19:46:10 +0000
commit32a14280621f5dd05f011e76ee88264d7ee7c0d1 (patch)
tree290beed6d9c3bde4d455c8daa6da3278c9122926 /linux/drivers/media/video/saa7134/saa7134-ts.c
parentdc02e7f0890fa0aa26b84c367e2f1d15a400f7df (diff)
downloadmediapointer-dvb-s2-32a14280621f5dd05f011e76ee88264d7ee7c0d1.tar.gz
mediapointer-dvb-s2-32a14280621f5dd05f011e76ee88264d7ee7c0d1.tar.bz2
- TS DMA buffer synchronization was inverted
- DMA buffer size was not set correctly in the SAA713x Signed-off-by: Hartmut Hackmann <hartmut.hackmann@t.online.de>
Diffstat (limited to 'linux/drivers/media/video/saa7134/saa7134-ts.c')
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-ts.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/linux/drivers/media/video/saa7134/saa7134-ts.c b/linux/drivers/media/video/saa7134/saa7134-ts.c
index 7e611bc61..54b264455 100644
--- a/linux/drivers/media/video/saa7134/saa7134-ts.c
+++ b/linux/drivers/media/video/saa7134/saa7134-ts.c
@@ -1,5 +1,5 @@
/*
- * $Id: saa7134-ts.c,v 1.16 2005/07/15 21:44:14 mchehab Exp $
+ * $Id: saa7134-ts.c,v 1.17 2005/09/11 19:46:10 hhackmann Exp $
*
* device driver for philips saa7134 based TV cards
* video4linux video interface
@@ -48,17 +48,11 @@ static int buffer_activate(struct saa7134_dev *dev,
struct saa7134_buf *buf,
struct saa7134_buf *next)
{
- u32 control;
dprintk("buffer_activate [%p]",buf);
buf->vb.state = STATE_ACTIVE;
buf->top_seen = 0;
- /* dma: setup channel 5 (= TS) */
- control = SAA7134_RS_CONTROL_BURST_16 |
- SAA7134_RS_CONTROL_ME |
- (buf->pt->dma >> 12);
-
if (NULL == next)
next = buf;
if (V4L2_FIELD_TOP == buf->vb.field) {
@@ -70,8 +64,6 @@ static int buffer_activate(struct saa7134_dev *dev,
saa_writel(SAA7134_RS_BA1(5),saa7134_buffer_base(next));
saa_writel(SAA7134_RS_BA2(5),saa7134_buffer_base(buf));
}
- saa_writel(SAA7134_RS_PITCH(5),TS_PACKET_SIZE);
- saa_writel(SAA7134_RS_CONTROL(5),control);
/* start DMA */
saa7134_set_dmabits(dev);
@@ -86,6 +78,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
struct saa7134_dev *dev = q->priv_data;
struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb);
unsigned int lines, llength, size;
+ u32 control;
int err;
dprintk("buffer_prepare [%p,%s]\n",buf,v4l2_field_names[field]);
@@ -117,6 +110,18 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
if (err)
goto oops;
}
+
+ /* dma: setup channel 5 (= TS) */
+ control = SAA7134_RS_CONTROL_BURST_16 |
+ SAA7134_RS_CONTROL_ME |
+ (buf->pt->dma >> 12);
+
+ saa_writeb(SAA7134_TS_DMA0, ((lines-1)&0xff));
+ saa_writeb(SAA7134_TS_DMA1, (((lines-1)>>8)&0xff));
+ saa_writeb(SAA7134_TS_DMA2, ((((lines-1)>>16)&0x3f) | 0x00)); /* TSNOPIT=0, TSCOLAP=0 */
+ saa_writel(SAA7134_RS_PITCH(5),TS_PACKET_SIZE);
+ saa_writel(SAA7134_RS_CONTROL(5),control);
+
buf->vb.state = STATE_PREPARED;
buf->activate = buffer_activate;
buf->vb.field = field;
@@ -166,11 +171,11 @@ EXPORT_SYMBOL_GPL(saa7134_ts_qops);
/* ----------------------------------------------------------- */
/* exported stuff */
-static unsigned int tsbufs = 4;
+static unsigned int tsbufs = 8;
module_param(tsbufs, int, 0444);
MODULE_PARM_DESC(tsbufs,"number of ts buffers, range 2-32");
-static unsigned int ts_nr_packets = 30;
+static unsigned int ts_nr_packets = 64;
module_param(ts_nr_packets, int, 0444);
MODULE_PARM_DESC(ts_nr_packets,"size of a ts buffers (in ts packets)");
@@ -221,11 +226,11 @@ void saa7134_irq_ts_done(struct saa7134_dev *dev, unsigned long status)
spin_lock(&dev->slock);
if (dev->ts_q.curr) {
field = dev->ts_q.curr->vb.field;
- if (field == V4L2_FIELD_TOP) {
- if ((status & 0x100000) != 0x100000)
+ if (field == V4L2_FIELD_TOP) {
+ if ((status & 0x100000) != 0x000000)
goto done;
} else {
- if ((status & 0x100000) != 0x000000)
+ if ((status & 0x100000) != 0x100000)
goto done;
}
saa7134_buffer_finish(dev,&dev->ts_q,STATE_DONE);