aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2012-05-01 10:28:20 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-05-14 13:58:39 -0400
commitfca3469aa844e2ae993445aa5f41397003199be7 (patch)
tree84484f23df213f2c2ff147536639f6f43106e06c /drivers
parentfd74d6eb4c2c1caa18208df32d9d38b5fe9738fc (diff)
[media] saa7146: move vbi fields from saa7146_fh to saa7146_vv
This fields are global and don't belong in a fh struct. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/common/saa7146_fops.c15
-rw-r--r--drivers/media/common/saa7146_vbi.c23
-rw-r--r--drivers/media/common/saa7146_video.c5
3 files changed, 24 insertions, 19 deletions
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c
index b8d0d7df5d67..776dfc35be57 100644
--- a/drivers/media/common/saa7146_fops.c
+++ b/drivers/media/common/saa7146_fops.c
@@ -437,6 +437,7 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
437{ 437{
438 struct v4l2_ctrl_handler *hdl = &dev->ctrl_handler; 438 struct v4l2_ctrl_handler *hdl = &dev->ctrl_handler;
439 struct v4l2_pix_format *fmt; 439 struct v4l2_pix_format *fmt;
440 struct v4l2_vbi_format *vbi;
440 struct saa7146_vv *vv; 441 struct saa7146_vv *vv;
441 int err; 442 int err;
442 443
@@ -514,6 +515,20 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
514 fmt->bytesperline = 3 * fmt->width; 515 fmt->bytesperline = 3 * fmt->width;
515 fmt->sizeimage = fmt->bytesperline * fmt->height; 516 fmt->sizeimage = fmt->bytesperline * fmt->height;
516 517
518 vbi = &vv->vbi_fmt;
519 vbi->sampling_rate = 27000000;
520 vbi->offset = 248; /* todo */
521 vbi->samples_per_line = 720 * 2;
522 vbi->sample_format = V4L2_PIX_FMT_GREY;
523
524 /* fixme: this only works for PAL */
525 vbi->start[0] = 5;
526 vbi->count[0] = 16;
527 vbi->start[1] = 312;
528 vbi->count[1] = 16;
529
530 init_timer(&vv->vbi_read_timeout);
531
517 vv->ov_fb.capability = V4L2_FBUF_CAP_LIST_CLIPPING; 532 vv->ov_fb.capability = V4L2_FBUF_CAP_LIST_CLIPPING;
518 vv->ov_fb.flags = V4L2_FBUF_FLAG_PRIMARY; 533 vv->ov_fb.flags = V4L2_FBUF_FLAG_PRIMARY;
519 dev->vv_data = vv; 534 dev->vv_data = vv;
diff --git a/drivers/media/common/saa7146_vbi.c b/drivers/media/common/saa7146_vbi.c
index b2e718343739..c930aa01f023 100644
--- a/drivers/media/common/saa7146_vbi.c
+++ b/drivers/media/common/saa7146_vbi.c
@@ -344,7 +344,7 @@ static void vbi_stop(struct saa7146_fh *fh, struct file *file)
344 vv->vbi_streaming = NULL; 344 vv->vbi_streaming = NULL;
345 345
346 del_timer(&vv->vbi_q.timeout); 346 del_timer(&vv->vbi_q.timeout);
347 del_timer(&fh->vbi_read_timeout); 347 del_timer(&vv->vbi_read_timeout);
348 348
349 spin_unlock_irqrestore(&dev->slock, flags); 349 spin_unlock_irqrestore(&dev->slock, flags);
350} 350}
@@ -377,6 +377,7 @@ static void vbi_init(struct saa7146_dev *dev, struct saa7146_vv *vv)
377static int vbi_open(struct saa7146_dev *dev, struct file *file) 377static int vbi_open(struct saa7146_dev *dev, struct file *file)
378{ 378{
379 struct saa7146_fh *fh = file->private_data; 379 struct saa7146_fh *fh = file->private_data;
380 struct saa7146_vv *vv = fh->dev->vv_data;
380 381
381 u32 arbtr_ctrl = saa7146_read(dev, PCI_BT_V1); 382 u32 arbtr_ctrl = saa7146_read(dev, PCI_BT_V1);
382 int ret = 0; 383 int ret = 0;
@@ -395,19 +396,6 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file)
395 saa7146_write(dev, PCI_BT_V1, arbtr_ctrl); 396 saa7146_write(dev, PCI_BT_V1, arbtr_ctrl);
396 saa7146_write(dev, MC2, (MASK_04|MASK_20)); 397 saa7146_write(dev, MC2, (MASK_04|MASK_20));
397 398
398 memset(&fh->vbi_fmt,0,sizeof(fh->vbi_fmt));
399
400 fh->vbi_fmt.sampling_rate = 27000000;
401 fh->vbi_fmt.offset = 248; /* todo */
402 fh->vbi_fmt.samples_per_line = vbi_pixel_to_capture;
403 fh->vbi_fmt.sample_format = V4L2_PIX_FMT_GREY;
404
405 /* fixme: this only works for PAL */
406 fh->vbi_fmt.start[0] = 5;
407 fh->vbi_fmt.count[0] = 16;
408 fh->vbi_fmt.start[1] = 312;
409 fh->vbi_fmt.count[1] = 16;
410
411 videobuf_queue_sg_init(&fh->vbi_q, &vbi_qops, 399 videobuf_queue_sg_init(&fh->vbi_q, &vbi_qops,
412 &dev->pci->dev, &dev->slock, 400 &dev->pci->dev, &dev->slock,
413 V4L2_BUF_TYPE_VBI_CAPTURE, 401 V4L2_BUF_TYPE_VBI_CAPTURE,
@@ -415,9 +403,8 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file)
415 sizeof(struct saa7146_buf), 403 sizeof(struct saa7146_buf),
416 file, &dev->v4l2_lock); 404 file, &dev->v4l2_lock);
417 405
418 init_timer(&fh->vbi_read_timeout); 406 vv->vbi_read_timeout.function = vbi_read_timeout;
419 fh->vbi_read_timeout.function = vbi_read_timeout; 407 vv->vbi_read_timeout.data = (unsigned long)file;
420 fh->vbi_read_timeout.data = (unsigned long)file;
421 408
422 /* initialize the brs */ 409 /* initialize the brs */
423 if ( 0 != (SAA7146_USE_PORT_B_FOR_VBI & dev->ext_vv_data->flags)) { 410 if ( 0 != (SAA7146_USE_PORT_B_FOR_VBI & dev->ext_vv_data->flags)) {
@@ -488,7 +475,7 @@ static ssize_t vbi_read(struct file *file, char __user *data, size_t count, loff
488 return -EBUSY; 475 return -EBUSY;
489 } 476 }
490 477
491 mod_timer(&fh->vbi_read_timeout, jiffies+BUFFER_TIMEOUT); 478 mod_timer(&vv->vbi_read_timeout, jiffies+BUFFER_TIMEOUT);
492 ret = videobuf_read_stream(&fh->vbi_q, data, count, ppos, 1, 479 ret = videobuf_read_stream(&fh->vbi_q, data, count, ppos, 1,
493 file->f_flags & O_NONBLOCK); 480 file->f_flags & O_NONBLOCK);
494/* 481/*
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c
index f57dccf851c1..9a99835e1e44 100644
--- a/drivers/media/common/saa7146_video.c
+++ b/drivers/media/common/saa7146_video.c
@@ -613,7 +613,10 @@ static int vidioc_g_fmt_vid_overlay(struct file *file, void *fh, struct v4l2_for
613 613
614static int vidioc_g_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *f) 614static int vidioc_g_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *f)
615{ 615{
616 f->fmt.vbi = ((struct saa7146_fh *)fh)->vbi_fmt; 616 struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev;
617 struct saa7146_vv *vv = dev->vv_data;
618
619 f->fmt.vbi = vv->vbi_fmt;
617 return 0; 620 return 0;
618} 621}
619 622