aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx88
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx88')
-rw-r--r--drivers/media/video/cx88/cx88-alsa.c4
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c5
-rw-r--r--drivers/media/video/cx88/cx88-core.c6
-rw-r--r--drivers/media/video/cx88/cx88-dvb.c5
-rw-r--r--drivers/media/video/cx88/cx88-mpeg.c28
-rw-r--r--drivers/media/video/cx88/cx88-vbi.c7
-rw-r--r--drivers/media/video/cx88/cx88-video.c35
-rw-r--r--drivers/media/video/cx88/cx88.h6
8 files changed, 56 insertions, 40 deletions
diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c
index 3170b8f72c68..f9d87b86492c 100644
--- a/drivers/media/video/cx88/cx88-alsa.c
+++ b/drivers/media/video/cx88/cx88-alsa.c
@@ -303,7 +303,7 @@ static int dsp_buffer_free(snd_cx88_card_t *chip)
303 BUG_ON(!chip->dma_size); 303 BUG_ON(!chip->dma_size);
304 304
305 dprintk(2,"Freeing buffer\n"); 305 dprintk(2,"Freeing buffer\n");
306 videobuf_dma_pci_unmap(chip->pci, &chip->dma_risc); 306 videobuf_pci_dma_unmap(chip->pci, &chip->dma_risc);
307 videobuf_dma_free(&chip->dma_risc); 307 videobuf_dma_free(&chip->dma_risc);
308 btcx_riscmem_free(chip->pci,&chip->buf->risc); 308 btcx_riscmem_free(chip->pci,&chip->buf->risc);
309 kfree(chip->buf); 309 kfree(chip->buf);
@@ -429,7 +429,7 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
429 videobuf_dma_init_kernel(&buf->vb.dma,PCI_DMA_FROMDEVICE, 429 videobuf_dma_init_kernel(&buf->vb.dma,PCI_DMA_FROMDEVICE,
430 (PAGE_ALIGN(buf->vb.size) >> PAGE_SHIFT)); 430 (PAGE_ALIGN(buf->vb.size) >> PAGE_SHIFT));
431 431
432 videobuf_dma_pci_map(chip->pci,&buf->vb.dma); 432 videobuf_pci_dma_map(chip->pci,&buf->vb.dma);
433 433
434 434
435 cx88_risc_databuffer(chip->pci, &buf->risc, 435 cx88_risc_databuffer(chip->pci, &buf->risc,
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index a502a4d6e4ae..e100d8ef369a 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -1341,7 +1341,7 @@ bb_buf_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
1341 enum v4l2_field field) 1341 enum v4l2_field field)
1342{ 1342{
1343 struct cx8802_fh *fh = q->priv_data; 1343 struct cx8802_fh *fh = q->priv_data;
1344 return cx8802_buf_prepare(fh->dev, (struct cx88_buffer*)vb, field); 1344 return cx8802_buf_prepare(q, fh->dev, (struct cx88_buffer*)vb, field);
1345} 1345}
1346 1346
1347static void 1347static void
@@ -1354,8 +1354,7 @@ bb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb)
1354static void 1354static void
1355bb_buf_release(struct videobuf_queue *q, struct videobuf_buffer *vb) 1355bb_buf_release(struct videobuf_queue *q, struct videobuf_buffer *vb)
1356{ 1356{
1357 struct cx8802_fh *fh = q->priv_data; 1357 cx88_free_buffer(q, (struct cx88_buffer*)vb);
1358 cx88_free_buffer(fh->dev->pci, (struct cx88_buffer*)vb);
1359} 1358}
1360 1359
1361static struct videobuf_queue_ops blackbird_qops = { 1360static struct videobuf_queue_ops blackbird_qops = {
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
index c2cdbafdb77b..2c3d9f1999be 100644
--- a/drivers/media/video/cx88/cx88-core.c
+++ b/drivers/media/video/cx88/cx88-core.c
@@ -213,13 +213,13 @@ int cx88_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc,
213} 213}
214 214
215void 215void
216cx88_free_buffer(struct pci_dev *pci, struct cx88_buffer *buf) 216cx88_free_buffer(struct videobuf_queue *q, struct cx88_buffer *buf)
217{ 217{
218 BUG_ON(in_interrupt()); 218 BUG_ON(in_interrupt());
219 videobuf_waiton(&buf->vb,0,0); 219 videobuf_waiton(&buf->vb,0,0);
220 videobuf_dma_pci_unmap(pci, &buf->vb.dma); 220 videobuf_dma_unmap(q, &buf->vb.dma);
221 videobuf_dma_free(&buf->vb.dma); 221 videobuf_dma_free(&buf->vb.dma);
222 btcx_riscmem_free(pci, &buf->risc); 222 btcx_riscmem_free((struct pci_dev *)q->dev, &buf->risc);
223 buf->vb.state = STATE_NEEDS_INIT; 223 buf->vb.state = STATE_NEEDS_INIT;
224} 224}
225 225
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index a9fc2695b157..f0ea9b5cdbc2 100644
--- a/drivers/media/video/cx88/cx88-dvb.c
+++ b/drivers/media/video/cx88/cx88-dvb.c
@@ -90,7 +90,7 @@ static int dvb_buf_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
90 enum v4l2_field field) 90 enum v4l2_field field)
91{ 91{
92 struct cx8802_dev *dev = q->priv_data; 92 struct cx8802_dev *dev = q->priv_data;
93 return cx8802_buf_prepare(dev, (struct cx88_buffer*)vb,field); 93 return cx8802_buf_prepare(q, dev, (struct cx88_buffer*)vb,field);
94} 94}
95 95
96static void dvb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) 96static void dvb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb)
@@ -101,8 +101,7 @@ static void dvb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb)
101 101
102static void dvb_buf_release(struct videobuf_queue *q, struct videobuf_buffer *vb) 102static void dvb_buf_release(struct videobuf_queue *q, struct videobuf_buffer *vb)
103{ 103{
104 struct cx8802_dev *dev = q->priv_data; 104 cx88_free_buffer(q, (struct cx88_buffer*)vb);
105 cx88_free_buffer(dev->pci, (struct cx88_buffer*)vb);
106} 105}
107 106
108static struct videobuf_queue_ops dvb_qops = { 107static struct videobuf_queue_ops dvb_qops = {
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c
index c79cc1d2bf8b..7d16888b4a86 100644
--- a/drivers/media/video/cx88/cx88-mpeg.c
+++ b/drivers/media/video/cx88/cx88-mpeg.c
@@ -163,8 +163,8 @@ static int cx8802_restart_queue(struct cx8802_dev *dev,
163 163
164/* ------------------------------------------------------------------ */ 164/* ------------------------------------------------------------------ */
165 165
166int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf, 166int cx8802_buf_prepare(struct videobuf_queue *q, struct cx8802_dev *dev,
167 enum v4l2_field field) 167 struct cx88_buffer *buf, enum v4l2_field field)
168{ 168{
169 int size = dev->ts_packet_size * dev->ts_packet_count; 169 int size = dev->ts_packet_size * dev->ts_packet_count;
170 int rc; 170 int rc;
@@ -179,7 +179,7 @@ int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf,
179 buf->vb.size = size; 179 buf->vb.size = size;
180 buf->vb.field = field /*V4L2_FIELD_TOP*/; 180 buf->vb.field = field /*V4L2_FIELD_TOP*/;
181 181
182 if (0 != (rc = videobuf_iolock(dev->pci,&buf->vb,NULL))) 182 if (0 != (rc = videobuf_iolock(q,&buf->vb,NULL)))
183 goto fail; 183 goto fail;
184 cx88_risc_databuffer(dev->pci, &buf->risc, 184 cx88_risc_databuffer(dev->pci, &buf->risc,
185 buf->vb.dma.sglist, 185 buf->vb.dma.sglist,
@@ -189,36 +189,36 @@ int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf,
189 return 0; 189 return 0;
190 190
191 fail: 191 fail:
192 cx88_free_buffer(dev->pci,buf); 192 cx88_free_buffer(q,buf);
193 return rc; 193 return rc;
194} 194}
195 195
196void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf) 196void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf)
197{ 197{
198 struct cx88_buffer *prev; 198 struct cx88_buffer *prev;
199 struct cx88_dmaqueue *q = &dev->mpegq; 199 struct cx88_dmaqueue *cx88q = &dev->mpegq;
200 200
201 dprintk( 1, "cx8802_buf_queue\n" ); 201 dprintk( 1, "cx8802_buf_queue\n" );
202 /* add jump to stopper */ 202 /* add jump to stopper */
203 buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP | RISC_IRQ1 | RISC_CNT_INC); 203 buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP | RISC_IRQ1 | RISC_CNT_INC);
204 buf->risc.jmp[1] = cpu_to_le32(q->stopper.dma); 204 buf->risc.jmp[1] = cpu_to_le32(cx88q->stopper.dma);
205 205
206 if (list_empty(&q->active)) { 206 if (list_empty(&cx88q->active)) {
207 dprintk( 0, "queue is empty - first active\n" ); 207 dprintk( 0, "queue is empty - first active\n" );
208 list_add_tail(&buf->vb.queue,&q->active); 208 list_add_tail(&buf->vb.queue,&cx88q->active);
209 cx8802_start_dma(dev, q, buf); 209 cx8802_start_dma(dev, cx88q, buf);
210 buf->vb.state = STATE_ACTIVE; 210 buf->vb.state = STATE_ACTIVE;
211 buf->count = q->count++; 211 buf->count = cx88q->count++;
212 mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); 212 mod_timer(&cx88q->timeout, jiffies+BUFFER_TIMEOUT);
213 dprintk(0,"[%p/%d] %s - first active\n", 213 dprintk(0,"[%p/%d] %s - first active\n",
214 buf, buf->vb.i, __FUNCTION__); 214 buf, buf->vb.i, __FUNCTION__);
215 215
216 } else { 216 } else {
217 dprintk( 1, "queue is not empty - append to active\n" ); 217 dprintk( 1, "queue is not empty - append to active\n" );
218 prev = list_entry(q->active.prev, struct cx88_buffer, vb.queue); 218 prev = list_entry(cx88q->active.prev, struct cx88_buffer, vb.queue);
219 list_add_tail(&buf->vb.queue,&q->active); 219 list_add_tail(&buf->vb.queue,&cx88q->active);
220 buf->vb.state = STATE_ACTIVE; 220 buf->vb.state = STATE_ACTIVE;
221 buf->count = q->count++; 221 buf->count = cx88q->count++;
222 prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); 222 prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
223 dprintk( 1, "[%p/%d] %s - append to active\n", 223 dprintk( 1, "[%p/%d] %s - append to active\n",
224 buf, buf->vb.i, __FUNCTION__); 224 buf, buf->vb.i, __FUNCTION__);
diff --git a/drivers/media/video/cx88/cx88-vbi.c b/drivers/media/video/cx88/cx88-vbi.c
index 9bc6c8995581..846faadc9f1c 100644
--- a/drivers/media/video/cx88/cx88-vbi.c
+++ b/drivers/media/video/cx88/cx88-vbi.c
@@ -175,7 +175,7 @@ vbi_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
175 buf->vb.size = size; 175 buf->vb.size = size;
176 buf->vb.field = V4L2_FIELD_SEQ_TB; 176 buf->vb.field = V4L2_FIELD_SEQ_TB;
177 177
178 if (0 != (rc = videobuf_iolock(dev->pci,&buf->vb,NULL))) 178 if (0 != (rc = videobuf_iolock(q,&buf->vb,NULL)))
179 goto fail; 179 goto fail;
180 cx88_risc_buffer(dev->pci, &buf->risc, 180 cx88_risc_buffer(dev->pci, &buf->risc,
181 buf->vb.dma.sglist, 181 buf->vb.dma.sglist,
@@ -187,7 +187,7 @@ vbi_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
187 return 0; 187 return 0;
188 188
189 fail: 189 fail:
190 cx88_free_buffer(dev->pci,buf); 190 cx88_free_buffer(q,buf);
191 return rc; 191 return rc;
192} 192}
193 193
@@ -227,9 +227,8 @@ vbi_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
227static void vbi_release(struct videobuf_queue *q, struct videobuf_buffer *vb) 227static void vbi_release(struct videobuf_queue *q, struct videobuf_buffer *vb)
228{ 228{
229 struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb); 229 struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb);
230 struct cx8800_fh *fh = q->priv_data;
231 230
232 cx88_free_buffer(fh->dev->pci,buf); 231 cx88_free_buffer(q,buf);
233} 232}
234 233
235struct videobuf_queue_ops cx8800_vbi_qops = { 234struct videobuf_queue_ops cx8800_vbi_qops = {
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 6c97aa740d27..72a417b31745 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -564,7 +564,7 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
564 564
565 if (STATE_NEEDS_INIT == buf->vb.state) { 565 if (STATE_NEEDS_INIT == buf->vb.state) {
566 init_buffer = 1; 566 init_buffer = 1;
567 if (0 != (rc = videobuf_iolock(dev->pci,&buf->vb,NULL))) 567 if (0 != (rc = videobuf_iolock(q,&buf->vb,NULL)))
568 goto fail; 568 goto fail;
569 } 569 }
570 570
@@ -614,7 +614,7 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
614 return 0; 614 return 0;
615 615
616 fail: 616 fail:
617 cx88_free_buffer(dev->pci,buf); 617 cx88_free_buffer(q,buf);
618 return rc; 618 return rc;
619} 619}
620 620
@@ -671,9 +671,8 @@ buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
671static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) 671static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb)
672{ 672{
673 struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb); 673 struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb);
674 struct cx8800_fh *fh = q->priv_data;
675 674
676 cx88_free_buffer(fh->dev->pci,buf); 675 cx88_free_buffer(q,buf);
677} 676}
678 677
679static struct videobuf_queue_ops cx8800_video_qops = { 678static struct videobuf_queue_ops cx8800_video_qops = {
@@ -1251,9 +1250,17 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio,
1251{ 1250{
1252 int err; 1251 int err;
1253 1252
1254 dprintk(2, "CORE IOCTL: 0x%x\n", cmd ); 1253 if (video_debug) {
1255 if (video_debug > 1) 1254 if (video_debug > 1) {
1256 v4l_print_ioctl(core->name,cmd); 1255 if (_IOC_DIR(cmd) & _IOC_WRITE)
1256 v4l_printk_ioctl_arg("cx88(w)",cmd, arg);
1257 else if (!_IOC_DIR(cmd) & _IOC_READ) {
1258 v4l_print_ioctl("cx88", cmd);
1259 }
1260 } else
1261 v4l_print_ioctl(core->name,cmd);
1262
1263 }
1257 1264
1258 switch (cmd) { 1265 switch (cmd) {
1259 /* ---------- tv norms ---------- */ 1266 /* ---------- tv norms ---------- */
@@ -1460,7 +1467,19 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio,
1460static int video_ioctl(struct inode *inode, struct file *file, 1467static int video_ioctl(struct inode *inode, struct file *file,
1461 unsigned int cmd, unsigned long arg) 1468 unsigned int cmd, unsigned long arg)
1462{ 1469{
1463 return video_usercopy(inode, file, cmd, arg, video_do_ioctl); 1470 int retval;
1471
1472 retval=video_usercopy(inode, file, cmd, arg, video_do_ioctl);
1473
1474 if (video_debug > 1) {
1475 if (retval < 0) {
1476 v4l_print_ioctl("cx88(err)", cmd);
1477 printk(KERN_DEBUG "cx88(err): errcode=%d\n",retval);
1478 } else if (_IOC_DIR(cmd) & _IOC_READ)
1479 v4l_printk_ioctl_arg("cx88(r)",cmd, (void *)arg);
1480 }
1481
1482 return retval;
1464} 1483}
1465 1484
1466/* ----------------------------------------------------------- */ 1485/* ----------------------------------------------------------- */
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index cfa8668784b4..5b2e499eab22 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -485,7 +485,7 @@ extern int
485cx88_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, 485cx88_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc,
486 u32 reg, u32 mask, u32 value); 486 u32 reg, u32 mask, u32 value);
487extern void 487extern void
488cx88_free_buffer(struct pci_dev *pci, struct cx88_buffer *buf); 488cx88_free_buffer(struct videobuf_queue *q, struct cx88_buffer *buf);
489 489
490extern void cx88_risc_disasm(struct cx88_core *core, 490extern void cx88_risc_disasm(struct cx88_core *core,
491 struct btcx_riscmem *risc); 491 struct btcx_riscmem *risc);
@@ -577,8 +577,8 @@ void cx88_ir_irq(struct cx88_core *core);
577/* ----------------------------------------------------------- */ 577/* ----------------------------------------------------------- */
578/* cx88-mpeg.c */ 578/* cx88-mpeg.c */
579 579
580int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf, 580int cx8802_buf_prepare(struct videobuf_queue *q,struct cx8802_dev *dev,
581 enum v4l2_field field); 581 struct cx88_buffer *buf, enum v4l2_field field);
582void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf); 582void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf);
583void cx8802_cancel_buffers(struct cx8802_dev *dev); 583void cx8802_cancel_buffers(struct cx8802_dev *dev);
584 584