aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx88
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-08-23 15:37:49 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-09 21:14:55 -0400
commitc1accaa21bdef38ec0f36eaaf7ce3384fff9d0c5 (patch)
tree3a2c8206555af6c9e2eecdb20b052be70e6b93dd /drivers/media/video/cx88
parent7a7d9a89d0307b1743d782197e2c5fc5ddf183f3 (diff)
V4L/DVB (6252): Adapt drivers to use the newer videobuf modules
PCI-dependent videobuf_foo methods were renamed as videobuf_pci_foo. Also, videobuf_dmabuf is now part of videobuf-dma-sg private struct. So, to access it, a subroutine call is needed. This patch renames all occurences of those function calls to be consistent with the video-buf split. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org> http://thread.gmane.org/gmane.comp.video.video4linux/34978/focus=34981 Reviewed-by: Ricardo Cerqueira <v4l@cerqueira.org>
Diffstat (limited to 'drivers/media/video/cx88')
-rw-r--r--drivers/media/video/cx88/Kconfig2
-rw-r--r--drivers/media/video/cx88/cx88-alsa.c24
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c2
-rw-r--r--drivers/media/video/cx88/cx88-core.c6
-rw-r--r--drivers/media/video/cx88/cx88-dvb.c2
-rw-r--r--drivers/media/video/cx88/cx88-mpeg.c3
-rw-r--r--drivers/media/video/cx88/cx88-vbi.c3
-rw-r--r--drivers/media/video/cx88/cx88-video.c38
-rw-r--r--drivers/media/video/cx88/cx88.h2
9 files changed, 36 insertions, 46 deletions
diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig
index f750a543c961..c68ba74d44ec 100644
--- a/drivers/media/video/cx88/Kconfig
+++ b/drivers/media/video/cx88/Kconfig
@@ -4,7 +4,7 @@ config VIDEO_CX88
4 select I2C_ALGOBIT 4 select I2C_ALGOBIT
5 select FW_LOADER 5 select FW_LOADER
6 select VIDEO_BTCX 6 select VIDEO_BTCX
7 select VIDEO_BUF 7 select VIDEOBUF_DMA_SG
8 select VIDEO_TUNER 8 select VIDEO_TUNER
9 select VIDEO_TVEEPROM 9 select VIDEO_TVEEPROM
10 select VIDEO_IR 10 select VIDEO_IR
diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c
index f4abed454fd4..90c36c5705c3 100644
--- a/drivers/media/video/cx88/cx88-alsa.c
+++ b/drivers/media/video/cx88/cx88-alsa.c
@@ -72,7 +72,7 @@ struct cx88_audio_dev {
72 unsigned int period_size; 72 unsigned int period_size;
73 unsigned int num_periods; 73 unsigned int num_periods;
74 74
75 struct videobuf_dmabuf dma_risc; 75 struct videobuf_dmabuf *dma_risc;
76 76
77 struct cx88_buffer *buf; 77 struct cx88_buffer *buf;
78 78
@@ -282,11 +282,12 @@ static int dsp_buffer_free(snd_cx88_card_t *chip)
282 BUG_ON(!chip->dma_size); 282 BUG_ON(!chip->dma_size);
283 283
284 dprintk(2,"Freeing buffer\n"); 284 dprintk(2,"Freeing buffer\n");
285 videobuf_pci_dma_unmap(chip->pci, &chip->dma_risc); 285 videobuf_pci_dma_unmap(chip->pci, chip->dma_risc);
286 videobuf_dma_free(&chip->dma_risc); 286 videobuf_dma_free(chip->dma_risc);
287 btcx_riscmem_free(chip->pci,&chip->buf->risc); 287 btcx_riscmem_free(chip->pci,&chip->buf->risc);
288 kfree(chip->buf); 288 kfree(chip->buf);
289 289
290 chip->dma_risc = NULL;
290 chip->dma_size = 0; 291 chip->dma_size = 0;
291 292
292 return 0; 293 return 0;
@@ -366,6 +367,8 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
366 struct snd_pcm_hw_params * hw_params) 367 struct snd_pcm_hw_params * hw_params)
367{ 368{
368 snd_cx88_card_t *chip = snd_pcm_substream_chip(substream); 369 snd_cx88_card_t *chip = snd_pcm_substream_chip(substream);
370 struct videobuf_dmabuf *dma;
371
369 struct cx88_buffer *buf; 372 struct cx88_buffer *buf;
370 int ret; 373 int ret;
371 374
@@ -381,7 +384,7 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
381 BUG_ON(!chip->dma_size); 384 BUG_ON(!chip->dma_size);
382 BUG_ON(chip->num_periods & (chip->num_periods-1)); 385 BUG_ON(chip->num_periods & (chip->num_periods-1));
383 386
384 buf = kzalloc(sizeof(*buf), GFP_KERNEL); 387 buf = videobuf_pci_alloc(sizeof(*buf));
385 if (NULL == buf) 388 if (NULL == buf)
386 return -ENOMEM; 389 return -ENOMEM;
387 390
@@ -392,17 +395,18 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
392 buf->vb.height = chip->num_periods; 395 buf->vb.height = chip->num_periods;
393 buf->vb.size = chip->dma_size; 396 buf->vb.size = chip->dma_size;
394 397
395 videobuf_dma_init(&buf->vb.dma); 398 dma=videobuf_to_dma(&buf->vb);
396 ret = videobuf_dma_init_kernel(&buf->vb.dma, PCI_DMA_FROMDEVICE, 399 videobuf_dma_init(dma);
400 ret = videobuf_dma_init_kernel(dma, PCI_DMA_FROMDEVICE,
397 (PAGE_ALIGN(buf->vb.size) >> PAGE_SHIFT)); 401 (PAGE_ALIGN(buf->vb.size) >> PAGE_SHIFT));
398 if (ret < 0) 402 if (ret < 0)
399 goto error; 403 goto error;
400 404
401 ret = videobuf_pci_dma_map(chip->pci,&buf->vb.dma); 405 ret = videobuf_pci_dma_map(chip->pci,dma);
402 if (ret < 0) 406 if (ret < 0)
403 goto error; 407 goto error;
404 408
405 ret = cx88_risc_databuffer(chip->pci, &buf->risc, buf->vb.dma.sglist, 409 ret = cx88_risc_databuffer(chip->pci, &buf->risc, dma->sglist,
406 buf->vb.width, buf->vb.height, 1); 410 buf->vb.width, buf->vb.height, 1);
407 if (ret < 0) 411 if (ret < 0)
408 goto error; 412 goto error;
@@ -414,9 +418,9 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
414 buf->vb.state = STATE_PREPARED; 418 buf->vb.state = STATE_PREPARED;
415 419
416 chip->buf = buf; 420 chip->buf = buf;
417 chip->dma_risc = buf->vb.dma; 421 chip->dma_risc = dma;
418 422
419 substream->runtime->dma_area = chip->dma_risc.vmalloc; 423 substream->runtime->dma_area = chip->dma_risc->vmalloc;
420 substream->runtime->dma_bytes = chip->dma_size; 424 substream->runtime->dma_bytes = chip->dma_size;
421 substream->runtime->dma_addr = 0; 425 substream->runtime->dma_addr = 0;
422 return 0; 426 return 0;
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index fcaf4f51293f..6d6f5048d762 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -1111,7 +1111,7 @@ static int mpeg_open(struct inode *inode, struct file *file)
1111 file->private_data = fh; 1111 file->private_data = fh;
1112 fh->dev = dev; 1112 fh->dev = dev;
1113 1113
1114 videobuf_queue_init(&fh->mpegq, &blackbird_qops, 1114 videobuf_queue_pci_init(&fh->mpegq, &blackbird_qops,
1115 dev->pci, &dev->slock, 1115 dev->pci, &dev->slock,
1116 V4L2_BUF_TYPE_VIDEO_CAPTURE, 1116 V4L2_BUF_TYPE_VIDEO_CAPTURE,
1117 V4L2_FIELD_INTERLACED, 1117 V4L2_FIELD_INTERLACED,
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
index 716154828ff0..85609b41f86e 100644
--- a/drivers/media/video/cx88/cx88-core.c
+++ b/drivers/media/video/cx88/cx88-core.c
@@ -213,10 +213,12 @@ int cx88_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc,
213void 213void
214cx88_free_buffer(struct videobuf_queue *q, struct cx88_buffer *buf) 214cx88_free_buffer(struct videobuf_queue *q, struct cx88_buffer *buf)
215{ 215{
216 struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
217
216 BUG_ON(in_interrupt()); 218 BUG_ON(in_interrupt());
217 videobuf_waiton(&buf->vb,0,0); 219 videobuf_waiton(&buf->vb,0,0);
218 videobuf_dma_unmap(q, &buf->vb.dma); 220 videobuf_dma_unmap(q, dma);
219 videobuf_dma_free(&buf->vb.dma); 221 videobuf_dma_free(dma);
220 btcx_riscmem_free((struct pci_dev *)q->dev, &buf->risc); 222 btcx_riscmem_free((struct pci_dev *)q->dev, &buf->risc);
221 buf->vb.state = STATE_NEEDS_INIT; 223 buf->vb.state = STATE_NEEDS_INIT;
222} 224}
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index 00d0e43785a0..d16e5c6d21c0 100644
--- a/drivers/media/video/cx88/cx88-dvb.c
+++ b/drivers/media/video/cx88/cx88-dvb.c
@@ -710,7 +710,7 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv)
710 710
711 /* dvb stuff */ 711 /* dvb stuff */
712 printk(KERN_INFO "%s/2: cx2388x based DVB/ATSC card\n", core->name); 712 printk(KERN_INFO "%s/2: cx2388x based DVB/ATSC card\n", core->name);
713 videobuf_queue_init(&dev->dvb.dvbq, &dvb_qops, 713 videobuf_queue_pci_init(&dev->dvb.dvbq, &dvb_qops,
714 dev->pci, &dev->slock, 714 dev->pci, &dev->slock,
715 V4L2_BUF_TYPE_VIDEO_CAPTURE, 715 V4L2_BUF_TYPE_VIDEO_CAPTURE,
716 V4L2_FIELD_TOP, 716 V4L2_FIELD_TOP,
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c
index d302793fcfb9..a652f294d23d 100644
--- a/drivers/media/video/cx88/cx88-mpeg.c
+++ b/drivers/media/video/cx88/cx88-mpeg.c
@@ -237,6 +237,7 @@ int cx8802_buf_prepare(struct videobuf_queue *q, struct cx8802_dev *dev,
237 struct cx88_buffer *buf, enum v4l2_field field) 237 struct cx88_buffer *buf, enum v4l2_field field)
238{ 238{
239 int size = dev->ts_packet_size * dev->ts_packet_count; 239 int size = dev->ts_packet_size * dev->ts_packet_count;
240 struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
240 int rc; 241 int rc;
241 242
242 dprintk(1, "%s: %p\n", __FUNCTION__, buf); 243 dprintk(1, "%s: %p\n", __FUNCTION__, buf);
@@ -252,7 +253,7 @@ int cx8802_buf_prepare(struct videobuf_queue *q, struct cx8802_dev *dev,
252 if (0 != (rc = videobuf_iolock(q,&buf->vb,NULL))) 253 if (0 != (rc = videobuf_iolock(q,&buf->vb,NULL)))
253 goto fail; 254 goto fail;
254 cx88_risc_databuffer(dev->pci, &buf->risc, 255 cx88_risc_databuffer(dev->pci, &buf->risc,
255 buf->vb.dma.sglist, 256 dma->sglist,
256 buf->vb.width, buf->vb.height, 0); 257 buf->vb.width, buf->vb.height, 0);
257 } 258 }
258 buf->vb.state = STATE_PREPARED; 259 buf->vb.state = STATE_PREPARED;
diff --git a/drivers/media/video/cx88/cx88-vbi.c b/drivers/media/video/cx88/cx88-vbi.c
index 72c1d19fa79f..aa40505c4b3a 100644
--- a/drivers/media/video/cx88/cx88-vbi.c
+++ b/drivers/media/video/cx88/cx88-vbi.c
@@ -172,6 +172,7 @@ vbi_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
172 return -EINVAL; 172 return -EINVAL;
173 173
174 if (STATE_NEEDS_INIT == buf->vb.state) { 174 if (STATE_NEEDS_INIT == buf->vb.state) {
175 struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
175 buf->vb.width = VBI_LINE_LENGTH; 176 buf->vb.width = VBI_LINE_LENGTH;
176 buf->vb.height = VBI_LINE_COUNT; 177 buf->vb.height = VBI_LINE_COUNT;
177 buf->vb.size = size; 178 buf->vb.size = size;
@@ -180,7 +181,7 @@ vbi_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
180 if (0 != (rc = videobuf_iolock(q,&buf->vb,NULL))) 181 if (0 != (rc = videobuf_iolock(q,&buf->vb,NULL)))
181 goto fail; 182 goto fail;
182 cx88_risc_buffer(dev->pci, &buf->risc, 183 cx88_risc_buffer(dev->pci, &buf->risc,
183 buf->vb.dma.sglist, 184 dma->sglist,
184 0, buf->vb.width * buf->vb.height, 185 0, buf->vb.width * buf->vb.height,
185 buf->vb.width, 0, 186 buf->vb.width, 0,
186 buf->vb.height); 187 buf->vb.height);
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 705c29b002ea..1439b7268532 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -534,6 +534,7 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
534 struct cx8800_dev *dev = fh->dev; 534 struct cx8800_dev *dev = fh->dev;
535 struct cx88_core *core = dev->core; 535 struct cx88_core *core = dev->core;
536 struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb); 536 struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb);
537 struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
537 int rc, init_buffer = 0; 538 int rc, init_buffer = 0;
538 539
539 BUG_ON(NULL == fh->fmt); 540 BUG_ON(NULL == fh->fmt);
@@ -566,30 +567,30 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
566 switch (buf->vb.field) { 567 switch (buf->vb.field) {
567 case V4L2_FIELD_TOP: 568 case V4L2_FIELD_TOP:
568 cx88_risc_buffer(dev->pci, &buf->risc, 569 cx88_risc_buffer(dev->pci, &buf->risc,
569 buf->vb.dma.sglist, 0, UNSET, 570 dma->sglist, 0, UNSET,
570 buf->bpl, 0, buf->vb.height); 571 buf->bpl, 0, buf->vb.height);
571 break; 572 break;
572 case V4L2_FIELD_BOTTOM: 573 case V4L2_FIELD_BOTTOM:
573 cx88_risc_buffer(dev->pci, &buf->risc, 574 cx88_risc_buffer(dev->pci, &buf->risc,
574 buf->vb.dma.sglist, UNSET, 0, 575 dma->sglist, UNSET, 0,
575 buf->bpl, 0, buf->vb.height); 576 buf->bpl, 0, buf->vb.height);
576 break; 577 break;
577 case V4L2_FIELD_INTERLACED: 578 case V4L2_FIELD_INTERLACED:
578 cx88_risc_buffer(dev->pci, &buf->risc, 579 cx88_risc_buffer(dev->pci, &buf->risc,
579 buf->vb.dma.sglist, 0, buf->bpl, 580 dma->sglist, 0, buf->bpl,
580 buf->bpl, buf->bpl, 581 buf->bpl, buf->bpl,
581 buf->vb.height >> 1); 582 buf->vb.height >> 1);
582 break; 583 break;
583 case V4L2_FIELD_SEQ_TB: 584 case V4L2_FIELD_SEQ_TB:
584 cx88_risc_buffer(dev->pci, &buf->risc, 585 cx88_risc_buffer(dev->pci, &buf->risc,
585 buf->vb.dma.sglist, 586 dma->sglist,
586 0, buf->bpl * (buf->vb.height >> 1), 587 0, buf->bpl * (buf->vb.height >> 1),
587 buf->bpl, 0, 588 buf->bpl, 0,
588 buf->vb.height >> 1); 589 buf->vb.height >> 1);
589 break; 590 break;
590 case V4L2_FIELD_SEQ_BT: 591 case V4L2_FIELD_SEQ_BT:
591 cx88_risc_buffer(dev->pci, &buf->risc, 592 cx88_risc_buffer(dev->pci, &buf->risc,
592 buf->vb.dma.sglist, 593 dma->sglist,
593 buf->bpl * (buf->vb.height >> 1), 0, 594 buf->bpl * (buf->vb.height >> 1), 0,
594 buf->bpl, 0, 595 buf->bpl, 0,
595 buf->vb.height >> 1); 596 buf->vb.height >> 1);
@@ -752,13 +753,13 @@ static int video_open(struct inode *inode, struct file *file)
752 fh->height = 240; 753 fh->height = 240;
753 fh->fmt = format_by_fourcc(V4L2_PIX_FMT_BGR24); 754 fh->fmt = format_by_fourcc(V4L2_PIX_FMT_BGR24);
754 755
755 videobuf_queue_init(&fh->vidq, &cx8800_video_qops, 756 videobuf_queue_pci_init(&fh->vidq, &cx8800_video_qops,
756 dev->pci, &dev->slock, 757 dev->pci, &dev->slock,
757 V4L2_BUF_TYPE_VIDEO_CAPTURE, 758 V4L2_BUF_TYPE_VIDEO_CAPTURE,
758 V4L2_FIELD_INTERLACED, 759 V4L2_FIELD_INTERLACED,
759 sizeof(struct cx88_buffer), 760 sizeof(struct cx88_buffer),
760 fh); 761 fh);
761 videobuf_queue_init(&fh->vbiq, &cx8800_vbi_qops, 762 videobuf_queue_pci_init(&fh->vbiq, &cx8800_vbi_qops,
762 dev->pci, &dev->slock, 763 dev->pci, &dev->slock,
763 V4L2_BUF_TYPE_VBI_CAPTURE, 764 V4L2_BUF_TYPE_VBI_CAPTURE,
764 V4L2_FIELD_SEQ_TB, 765 V4L2_FIELD_SEQ_TB,
@@ -1104,28 +1105,9 @@ static int vidioc_enum_fmt_cap (struct file *file, void *priv,
1104#ifdef CONFIG_VIDEO_V4L1_COMPAT 1105#ifdef CONFIG_VIDEO_V4L1_COMPAT
1105static int vidiocgmbuf (struct file *file, void *priv, struct video_mbuf *mbuf) 1106static int vidiocgmbuf (struct file *file, void *priv, struct video_mbuf *mbuf)
1106{ 1107{
1107 struct cx8800_fh *fh = priv; 1108 struct cx8800_fh *fh = priv;
1108 struct videobuf_queue *q;
1109 struct v4l2_requestbuffers req;
1110 unsigned int i;
1111 int err;
1112 1109
1113 q = get_queue(fh); 1110 return videobuf_cgmbuf (get_queue(fh), mbuf, 8);
1114 memset(&req,0,sizeof(req));
1115 req.type = q->type;
1116 req.count = 8;
1117 req.memory = V4L2_MEMORY_MMAP;
1118 err = videobuf_reqbufs(q,&req);
1119 if (err < 0)
1120 return err;
1121
1122 mbuf->frames = req.count;
1123 mbuf->size = 0;
1124 for (i = 0; i < mbuf->frames; i++) {
1125 mbuf->offsets[i] = q->bufs[i]->boff;
1126 mbuf->size += q->bufs[i]->bsize;
1127 }
1128 return 0;
1129} 1111}
1130#endif 1112#endif
1131 1113
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index 0e4f8e278671..875a9abab2a2 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -28,7 +28,7 @@
28#include <media/v4l2-common.h> 28#include <media/v4l2-common.h>
29#include <media/tuner.h> 29#include <media/tuner.h>
30#include <media/tveeprom.h> 30#include <media/tveeprom.h>
31#include <media/video-buf.h> 31#include <media/videobuf-dma-sg.h>
32#include <media/cx2341x.h> 32#include <media/cx2341x.h>
33#include <media/audiochip.h> 33#include <media/audiochip.h>
34#if defined(CONFIG_VIDEO_BUF_DVB) || defined(CONFIG_VIDEO_BUF_DVB_MODULE) 34#if defined(CONFIG_VIDEO_BUF_DVB) || defined(CONFIG_VIDEO_BUF_DVB_MODULE)