diff options
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-ts.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/drivers/media/video/saa7134/saa7134-ts.c b/drivers/media/video/saa7134/saa7134-ts.c index 463885601ab4..cdfd69873ba9 100644 --- a/drivers/media/video/saa7134/saa7134-ts.c +++ b/drivers/media/video/saa7134/saa7134-ts.c | |||
@@ -46,17 +46,11 @@ static int buffer_activate(struct saa7134_dev *dev, | |||
46 | struct saa7134_buf *buf, | 46 | struct saa7134_buf *buf, |
47 | struct saa7134_buf *next) | 47 | struct saa7134_buf *next) |
48 | { | 48 | { |
49 | u32 control; | ||
50 | 49 | ||
51 | dprintk("buffer_activate [%p]",buf); | 50 | dprintk("buffer_activate [%p]",buf); |
52 | buf->vb.state = STATE_ACTIVE; | 51 | buf->vb.state = STATE_ACTIVE; |
53 | buf->top_seen = 0; | 52 | buf->top_seen = 0; |
54 | 53 | ||
55 | /* dma: setup channel 5 (= TS) */ | ||
56 | control = SAA7134_RS_CONTROL_BURST_16 | | ||
57 | SAA7134_RS_CONTROL_ME | | ||
58 | (buf->pt->dma >> 12); | ||
59 | |||
60 | if (NULL == next) | 54 | if (NULL == next) |
61 | next = buf; | 55 | next = buf; |
62 | if (V4L2_FIELD_TOP == buf->vb.field) { | 56 | if (V4L2_FIELD_TOP == buf->vb.field) { |
@@ -68,8 +62,6 @@ static int buffer_activate(struct saa7134_dev *dev, | |||
68 | saa_writel(SAA7134_RS_BA1(5),saa7134_buffer_base(next)); | 62 | saa_writel(SAA7134_RS_BA1(5),saa7134_buffer_base(next)); |
69 | saa_writel(SAA7134_RS_BA2(5),saa7134_buffer_base(buf)); | 63 | saa_writel(SAA7134_RS_BA2(5),saa7134_buffer_base(buf)); |
70 | } | 64 | } |
71 | saa_writel(SAA7134_RS_PITCH(5),TS_PACKET_SIZE); | ||
72 | saa_writel(SAA7134_RS_CONTROL(5),control); | ||
73 | 65 | ||
74 | /* start DMA */ | 66 | /* start DMA */ |
75 | saa7134_set_dmabits(dev); | 67 | saa7134_set_dmabits(dev); |
@@ -84,6 +76,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, | |||
84 | struct saa7134_dev *dev = q->priv_data; | 76 | struct saa7134_dev *dev = q->priv_data; |
85 | struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb); | 77 | struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb); |
86 | unsigned int lines, llength, size; | 78 | unsigned int lines, llength, size; |
79 | u32 control; | ||
87 | int err; | 80 | int err; |
88 | 81 | ||
89 | dprintk("buffer_prepare [%p,%s]\n",buf,v4l2_field_names[field]); | 82 | 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 | if (err) | 108 | if (err) |
116 | goto oops; | 109 | goto oops; |
117 | } | 110 | } |
111 | |||
112 | /* dma: setup channel 5 (= TS) */ | ||
113 | control = SAA7134_RS_CONTROL_BURST_16 | | ||
114 | SAA7134_RS_CONTROL_ME | | ||
115 | (buf->pt->dma >> 12); | ||
116 | |||
117 | saa_writeb(SAA7134_TS_DMA0, ((lines-1)&0xff)); | ||
118 | saa_writeb(SAA7134_TS_DMA1, (((lines-1)>>8)&0xff)); | ||
119 | saa_writeb(SAA7134_TS_DMA2, ((((lines-1)>>16)&0x3f) | 0x00)); /* TSNOPIT=0, TSCOLAP=0 */ | ||
120 | saa_writel(SAA7134_RS_PITCH(5),TS_PACKET_SIZE); | ||
121 | saa_writel(SAA7134_RS_CONTROL(5),control); | ||
122 | |||
118 | buf->vb.state = STATE_PREPARED; | 123 | buf->vb.state = STATE_PREPARED; |
119 | buf->activate = buffer_activate; | 124 | buf->activate = buffer_activate; |
120 | buf->vb.field = field; | 125 | buf->vb.field = field; |
@@ -164,11 +169,11 @@ EXPORT_SYMBOL_GPL(saa7134_ts_qops); | |||
164 | /* ----------------------------------------------------------- */ | 169 | /* ----------------------------------------------------------- */ |
165 | /* exported stuff */ | 170 | /* exported stuff */ |
166 | 171 | ||
167 | static unsigned int tsbufs = 4; | 172 | static unsigned int tsbufs = 8; |
168 | module_param(tsbufs, int, 0444); | 173 | module_param(tsbufs, int, 0444); |
169 | MODULE_PARM_DESC(tsbufs,"number of ts buffers, range 2-32"); | 174 | MODULE_PARM_DESC(tsbufs,"number of ts buffers, range 2-32"); |
170 | 175 | ||
171 | static unsigned int ts_nr_packets = 30; | 176 | static unsigned int ts_nr_packets = 64; |
172 | module_param(ts_nr_packets, int, 0444); | 177 | module_param(ts_nr_packets, int, 0444); |
173 | MODULE_PARM_DESC(ts_nr_packets,"size of a ts buffers (in ts packets)"); | 178 | MODULE_PARM_DESC(ts_nr_packets,"size of a ts buffers (in ts packets)"); |
174 | 179 | ||
@@ -220,10 +225,10 @@ void saa7134_irq_ts_done(struct saa7134_dev *dev, unsigned long status) | |||
220 | if (dev->ts_q.curr) { | 225 | if (dev->ts_q.curr) { |
221 | field = dev->ts_q.curr->vb.field; | 226 | field = dev->ts_q.curr->vb.field; |
222 | if (field == V4L2_FIELD_TOP) { | 227 | if (field == V4L2_FIELD_TOP) { |
223 | if ((status & 0x100000) != 0x100000) | 228 | if ((status & 0x100000) != 0x000000) |
224 | goto done; | 229 | goto done; |
225 | } else { | 230 | } else { |
226 | if ((status & 0x100000) != 0x000000) | 231 | if ((status & 0x100000) != 0x100000) |
227 | goto done; | 232 | goto done; |
228 | } | 233 | } |
229 | saa7134_buffer_finish(dev,&dev->ts_q,STATE_DONE); | 234 | saa7134_buffer_finish(dev,&dev->ts_q,STATE_DONE); |