Commit fca3469a authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[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: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent fd74d6eb
...@@ -437,6 +437,7 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) ...@@ -437,6 +437,7 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
{ {
struct v4l2_ctrl_handler *hdl = &dev->ctrl_handler; struct v4l2_ctrl_handler *hdl = &dev->ctrl_handler;
struct v4l2_pix_format *fmt; struct v4l2_pix_format *fmt;
struct v4l2_vbi_format *vbi;
struct saa7146_vv *vv; struct saa7146_vv *vv;
int err; int err;
...@@ -514,6 +515,20 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) ...@@ -514,6 +515,20 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
fmt->bytesperline = 3 * fmt->width; fmt->bytesperline = 3 * fmt->width;
fmt->sizeimage = fmt->bytesperline * fmt->height; fmt->sizeimage = fmt->bytesperline * fmt->height;
vbi = &vv->vbi_fmt;
vbi->sampling_rate = 27000000;
vbi->offset = 248; /* todo */
vbi->samples_per_line = 720 * 2;
vbi->sample_format = V4L2_PIX_FMT_GREY;
/* fixme: this only works for PAL */
vbi->start[0] = 5;
vbi->count[0] = 16;
vbi->start[1] = 312;
vbi->count[1] = 16;
init_timer(&vv->vbi_read_timeout);
vv->ov_fb.capability = V4L2_FBUF_CAP_LIST_CLIPPING; vv->ov_fb.capability = V4L2_FBUF_CAP_LIST_CLIPPING;
vv->ov_fb.flags = V4L2_FBUF_FLAG_PRIMARY; vv->ov_fb.flags = V4L2_FBUF_FLAG_PRIMARY;
dev->vv_data = vv; dev->vv_data = vv;
......
...@@ -344,7 +344,7 @@ static void vbi_stop(struct saa7146_fh *fh, struct file *file) ...@@ -344,7 +344,7 @@ static void vbi_stop(struct saa7146_fh *fh, struct file *file)
vv->vbi_streaming = NULL; vv->vbi_streaming = NULL;
del_timer(&vv->vbi_q.timeout); del_timer(&vv->vbi_q.timeout);
del_timer(&fh->vbi_read_timeout); del_timer(&vv->vbi_read_timeout);
spin_unlock_irqrestore(&dev->slock, flags); spin_unlock_irqrestore(&dev->slock, flags);
} }
...@@ -377,6 +377,7 @@ static void vbi_init(struct saa7146_dev *dev, struct saa7146_vv *vv) ...@@ -377,6 +377,7 @@ static void vbi_init(struct saa7146_dev *dev, struct saa7146_vv *vv)
static int vbi_open(struct saa7146_dev *dev, struct file *file) static int vbi_open(struct saa7146_dev *dev, struct file *file)
{ {
struct saa7146_fh *fh = file->private_data; struct saa7146_fh *fh = file->private_data;
struct saa7146_vv *vv = fh->dev->vv_data;
u32 arbtr_ctrl = saa7146_read(dev, PCI_BT_V1); u32 arbtr_ctrl = saa7146_read(dev, PCI_BT_V1);
int ret = 0; int ret = 0;
...@@ -395,19 +396,6 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file) ...@@ -395,19 +396,6 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file)
saa7146_write(dev, PCI_BT_V1, arbtr_ctrl); saa7146_write(dev, PCI_BT_V1, arbtr_ctrl);
saa7146_write(dev, MC2, (MASK_04|MASK_20)); saa7146_write(dev, MC2, (MASK_04|MASK_20));
memset(&fh->vbi_fmt,0,sizeof(fh->vbi_fmt));
fh->vbi_fmt.sampling_rate = 27000000;
fh->vbi_fmt.offset = 248; /* todo */
fh->vbi_fmt.samples_per_line = vbi_pixel_to_capture;
fh->vbi_fmt.sample_format = V4L2_PIX_FMT_GREY;
/* fixme: this only works for PAL */
fh->vbi_fmt.start[0] = 5;
fh->vbi_fmt.count[0] = 16;
fh->vbi_fmt.start[1] = 312;
fh->vbi_fmt.count[1] = 16;
videobuf_queue_sg_init(&fh->vbi_q, &vbi_qops, videobuf_queue_sg_init(&fh->vbi_q, &vbi_qops,
&dev->pci->dev, &dev->slock, &dev->pci->dev, &dev->slock,
V4L2_BUF_TYPE_VBI_CAPTURE, V4L2_BUF_TYPE_VBI_CAPTURE,
...@@ -415,9 +403,8 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file) ...@@ -415,9 +403,8 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file)
sizeof(struct saa7146_buf), sizeof(struct saa7146_buf),
file, &dev->v4l2_lock); file, &dev->v4l2_lock);
init_timer(&fh->vbi_read_timeout); vv->vbi_read_timeout.function = vbi_read_timeout;
fh->vbi_read_timeout.function = vbi_read_timeout; vv->vbi_read_timeout.data = (unsigned long)file;
fh->vbi_read_timeout.data = (unsigned long)file;
/* initialize the brs */ /* initialize the brs */
if ( 0 != (SAA7146_USE_PORT_B_FOR_VBI & dev->ext_vv_data->flags)) { 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,7 +475,7 @@ static ssize_t vbi_read(struct file *file, char __user *data, size_t count, loff
return -EBUSY; return -EBUSY;
} }
mod_timer(&fh->vbi_read_timeout, jiffies+BUFFER_TIMEOUT); mod_timer(&vv->vbi_read_timeout, jiffies+BUFFER_TIMEOUT);
ret = videobuf_read_stream(&fh->vbi_q, data, count, ppos, 1, ret = videobuf_read_stream(&fh->vbi_q, data, count, ppos, 1,
file->f_flags & O_NONBLOCK); file->f_flags & O_NONBLOCK);
/* /*
......
...@@ -613,7 +613,10 @@ static int vidioc_g_fmt_vid_overlay(struct file *file, void *fh, struct v4l2_for ...@@ -613,7 +613,10 @@ static int vidioc_g_fmt_vid_overlay(struct file *file, void *fh, struct v4l2_for
static int vidioc_g_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *f) static int vidioc_g_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *f)
{ {
f->fmt.vbi = ((struct saa7146_fh *)fh)->vbi_fmt; struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev;
struct saa7146_vv *vv = dev->vv_data;
f->fmt.vbi = vv->vbi_fmt;
return 0; return 0;
} }
......
...@@ -93,8 +93,6 @@ struct saa7146_fh { ...@@ -93,8 +93,6 @@ struct saa7146_fh {
/* vbi capture */ /* vbi capture */
struct videobuf_queue vbi_q; struct videobuf_queue vbi_q;
struct v4l2_vbi_format vbi_fmt;
struct timer_list vbi_read_timeout;
unsigned int resources; /* resource management for device open */ unsigned int resources; /* resource management for device open */
}; };
...@@ -106,6 +104,8 @@ struct saa7146_vv ...@@ -106,6 +104,8 @@ struct saa7146_vv
{ {
/* vbi capture */ /* vbi capture */
struct saa7146_dmaqueue vbi_q; struct saa7146_dmaqueue vbi_q;
struct v4l2_vbi_format vbi_fmt;
struct timer_list vbi_read_timeout;
/* vbi workaround interrupt queue */ /* vbi workaround interrupt queue */
wait_queue_head_t vbi_wq; wait_queue_head_t vbi_wq;
int vbi_fieldcount; int vbi_fieldcount;
......
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