Commit 3aa4f48a authored by Hartmut Hackmann's avatar Hartmut Hackmann Committed by Linus Torvalds

[PATCH] v4l: 653: ts dma buffer synchronization was inverted

- TS DMA buffer synchronization was inverted
Signed-off-by: default avatarHartmut Hackmann <hartmut.hackmann@t.online.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f9e7a020
...@@ -46,17 +46,11 @@ static int buffer_activate(struct saa7134_dev *dev, ...@@ -46,17 +46,11 @@ static int buffer_activate(struct saa7134_dev *dev,
struct saa7134_buf *buf, struct saa7134_buf *buf,
struct saa7134_buf *next) struct saa7134_buf *next)
{ {
u32 control;
dprintk("buffer_activate [%p]",buf); dprintk("buffer_activate [%p]",buf);
buf->vb.state = STATE_ACTIVE; buf->vb.state = STATE_ACTIVE;
buf->top_seen = 0; 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) if (NULL == next)
next = buf; next = buf;
if (V4L2_FIELD_TOP == buf->vb.field) { if (V4L2_FIELD_TOP == buf->vb.field) {
...@@ -68,8 +62,6 @@ static int buffer_activate(struct saa7134_dev *dev, ...@@ -68,8 +62,6 @@ static int buffer_activate(struct saa7134_dev *dev,
saa_writel(SAA7134_RS_BA1(5),saa7134_buffer_base(next)); saa_writel(SAA7134_RS_BA1(5),saa7134_buffer_base(next));
saa_writel(SAA7134_RS_BA2(5),saa7134_buffer_base(buf)); 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 */ /* start DMA */
saa7134_set_dmabits(dev); saa7134_set_dmabits(dev);
...@@ -84,6 +76,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, ...@@ -84,6 +76,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
struct saa7134_dev *dev = q->priv_data; struct saa7134_dev *dev = q->priv_data;
struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb); struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb);
unsigned int lines, llength, size; unsigned int lines, llength, size;
u32 control;
int err; int err;
dprintk("buffer_prepare [%p,%s]\n",buf,v4l2_field_names[field]); dprintk("buffer_prepare [%p,%s]\n",buf,v4l2_field_names[field]);
...@@ -115,6 +108,18 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, ...@@ -115,6 +108,18 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
if (err) if (err)
goto oops; 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->vb.state = STATE_PREPARED;
buf->activate = buffer_activate; buf->activate = buffer_activate;
buf->vb.field = field; buf->vb.field = field;
...@@ -164,11 +169,11 @@ EXPORT_SYMBOL_GPL(saa7134_ts_qops); ...@@ -164,11 +169,11 @@ EXPORT_SYMBOL_GPL(saa7134_ts_qops);
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
/* exported stuff */ /* exported stuff */
static unsigned int tsbufs = 4; static unsigned int tsbufs = 8;
module_param(tsbufs, int, 0444); module_param(tsbufs, int, 0444);
MODULE_PARM_DESC(tsbufs,"number of ts buffers, range 2-32"); 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_param(ts_nr_packets, int, 0444);
MODULE_PARM_DESC(ts_nr_packets,"size of a ts buffers (in ts packets)"); MODULE_PARM_DESC(ts_nr_packets,"size of a ts buffers (in ts packets)");
...@@ -220,10 +225,10 @@ void saa7134_irq_ts_done(struct saa7134_dev *dev, unsigned long status) ...@@ -220,10 +225,10 @@ void saa7134_irq_ts_done(struct saa7134_dev *dev, unsigned long status)
if (dev->ts_q.curr) { if (dev->ts_q.curr) {
field = dev->ts_q.curr->vb.field; field = dev->ts_q.curr->vb.field;
if (field == V4L2_FIELD_TOP) { if (field == V4L2_FIELD_TOP) {
if ((status & 0x100000) != 0x100000) if ((status & 0x100000) != 0x000000)
goto done; goto done;
} else { } else {
if ((status & 0x100000) != 0x000000) if ((status & 0x100000) != 0x100000)
goto done; goto done;
} }
saa7134_buffer_finish(dev,&dev->ts_q,STATE_DONE); saa7134_buffer_finish(dev,&dev->ts_q,STATE_DONE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment