Commit dddc9e92 authored by Gerd Knorr's avatar Gerd Knorr Committed by Linus Torvalds

[PATCH] v4l: saa7146 update

Adapt saa7134 driver to video-buf changes.
Signed-off-by: default avatarGerd Knorr <kraxel@bytesex.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 20a508a0
...@@ -349,7 +349,7 @@ static int fops_mmap(struct file *file, struct vm_area_struct * vma) ...@@ -349,7 +349,7 @@ static int fops_mmap(struct file *file, struct vm_area_struct * vma)
BUG(); BUG();
return 0; return 0;
} }
return videobuf_mmap_mapper(vma,q); return videobuf_mmap_mapper(q,vma);
} }
static unsigned int fops_poll(struct file *file, struct poll_table_struct *wait) static unsigned int fops_poll(struct file *file, struct poll_table_struct *wait)
...@@ -362,7 +362,7 @@ static unsigned int fops_poll(struct file *file, struct poll_table_struct *wait) ...@@ -362,7 +362,7 @@ static unsigned int fops_poll(struct file *file, struct poll_table_struct *wait)
if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) { if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) {
if( 0 == fh->vbi_q.streaming ) if( 0 == fh->vbi_q.streaming )
return videobuf_poll_stream(file, file->private_data, &fh->vbi_q, wait); return videobuf_poll_stream(file, &fh->vbi_q, wait);
q = &fh->vbi_q; q = &fh->vbi_q;
} else { } else {
DEB_D(("using video queue.\n")); DEB_D(("using video queue.\n"));
......
...@@ -213,9 +213,9 @@ static int buffer_activate(struct saa7146_dev *dev, ...@@ -213,9 +213,9 @@ static int buffer_activate(struct saa7146_dev *dev,
return 0; return 0;
} }
static int buffer_prepare(void *priv, struct videobuf_buffer *vb,enum v4l2_field field) static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,enum v4l2_field field)
{ {
struct file *file = priv; struct file *file = q->priv_data;
struct saa7146_fh *fh = file->private_data; struct saa7146_fh *fh = file->private_data;
struct saa7146_dev *dev = fh->dev; struct saa7146_dev *dev = fh->dev;
struct saa7146_buf *buf = (struct saa7146_buf *)vb; struct saa7146_buf *buf = (struct saa7146_buf *)vb;
...@@ -265,7 +265,7 @@ static int buffer_prepare(void *priv, struct videobuf_buffer *vb,enum v4l2_field ...@@ -265,7 +265,7 @@ static int buffer_prepare(void *priv, struct videobuf_buffer *vb,enum v4l2_field
return err; return err;
} }
static int buffer_setup(void *priv, unsigned int *count, unsigned int *size) static int buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size)
{ {
int llength,lines; int llength,lines;
...@@ -280,9 +280,9 @@ static int buffer_setup(void *priv, unsigned int *count, unsigned int *size) ...@@ -280,9 +280,9 @@ static int buffer_setup(void *priv, unsigned int *count, unsigned int *size)
return 0; return 0;
} }
static void buffer_queue(void *priv, struct videobuf_buffer *vb) static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb)
{ {
struct file *file = priv; struct file *file = q->priv_data;
struct saa7146_fh *fh = file->private_data; struct saa7146_fh *fh = file->private_data;
struct saa7146_dev *dev = fh->dev; struct saa7146_dev *dev = fh->dev;
struct saa7146_vv *vv = dev->vv_data; struct saa7146_vv *vv = dev->vv_data;
...@@ -292,9 +292,9 @@ static void buffer_queue(void *priv, struct videobuf_buffer *vb) ...@@ -292,9 +292,9 @@ static void buffer_queue(void *priv, struct videobuf_buffer *vb)
saa7146_buffer_queue(dev,&vv->vbi_q,buf); saa7146_buffer_queue(dev,&vv->vbi_q,buf);
} }
static void buffer_release(void *priv, struct videobuf_buffer *vb) static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb)
{ {
struct file *file = priv; struct file *file = q->priv_data;
struct saa7146_fh *fh = file->private_data; struct saa7146_fh *fh = file->private_data;
struct saa7146_dev *dev = fh->dev; struct saa7146_dev *dev = fh->dev;
struct saa7146_buf *buf = (struct saa7146_buf *)vb; struct saa7146_buf *buf = (struct saa7146_buf *)vb;
...@@ -334,7 +334,7 @@ static void vbi_stop(struct saa7146_fh *fh, struct file *file) ...@@ -334,7 +334,7 @@ static void vbi_stop(struct saa7146_fh *fh, struct file *file)
saa7146_buffer_finish(dev,&vv->vbi_q,STATE_DONE); saa7146_buffer_finish(dev,&vv->vbi_q,STATE_DONE);
} }
videobuf_queue_cancel(file,&fh->vbi_q); videobuf_queue_cancel(&fh->vbi_q);
vv->vbi_streaming = NULL; vv->vbi_streaming = NULL;
...@@ -407,7 +407,8 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file) ...@@ -407,7 +407,8 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file)
dev->pci, &dev->slock, dev->pci, &dev->slock,
V4L2_BUF_TYPE_VBI_CAPTURE, V4L2_BUF_TYPE_VBI_CAPTURE,
V4L2_FIELD_SEQ_TB, // FIXME: does this really work? V4L2_FIELD_SEQ_TB, // FIXME: does this really work?
sizeof(struct saa7146_buf)); sizeof(struct saa7146_buf),
file);
init_MUTEX(&fh->vbi_q.lock); init_MUTEX(&fh->vbi_q.lock);
init_timer(&fh->vbi_read_timeout); init_timer(&fh->vbi_read_timeout);
...@@ -483,7 +484,7 @@ static ssize_t vbi_read(struct file *file, char __user *data, size_t count, loff ...@@ -483,7 +484,7 @@ static ssize_t vbi_read(struct file *file, char __user *data, size_t count, loff
} }
mod_timer(&fh->vbi_read_timeout, jiffies+BUFFER_TIMEOUT); mod_timer(&fh->vbi_read_timeout, jiffies+BUFFER_TIMEOUT);
ret = videobuf_read_stream(file, &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);
/* /*
printk("BASE_ODD3: 0x%08x\n", saa7146_read(dev, BASE_ODD3)); printk("BASE_ODD3: 0x%08x\n", saa7146_read(dev, BASE_ODD3));
......
...@@ -1137,7 +1137,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int ...@@ -1137,7 +1137,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
case VIDIOC_REQBUFS: { case VIDIOC_REQBUFS: {
struct v4l2_requestbuffers *req = arg; struct v4l2_requestbuffers *req = arg;
DEB_D(("VIDIOC_REQBUFS, type:%d\n",req->type)); DEB_D(("VIDIOC_REQBUFS, type:%d\n",req->type));
return videobuf_reqbufs(file,q,req); return videobuf_reqbufs(q,req);
} }
case VIDIOC_QUERYBUF: { case VIDIOC_QUERYBUF: {
struct v4l2_buffer *buf = arg; struct v4l2_buffer *buf = arg;
...@@ -1147,14 +1147,14 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int ...@@ -1147,14 +1147,14 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
case VIDIOC_QBUF: { case VIDIOC_QBUF: {
struct v4l2_buffer *buf = arg; struct v4l2_buffer *buf = arg;
int ret = 0; int ret = 0;
ret = videobuf_qbuf(file,q,buf); ret = videobuf_qbuf(q,buf);
DEB_D(("VIDIOC_QBUF: ret:%d, index:%d\n",ret,buf->index)); DEB_D(("VIDIOC_QBUF: ret:%d, index:%d\n",ret,buf->index));
return ret; return ret;
} }
case VIDIOC_DQBUF: { case VIDIOC_DQBUF: {
struct v4l2_buffer *buf = arg; struct v4l2_buffer *buf = arg;
int ret = 0; int ret = 0;
ret = videobuf_dqbuf(file,q,buf,file->f_flags & O_NONBLOCK); ret = videobuf_dqbuf(q,buf,file->f_flags & O_NONBLOCK);
DEB_D(("VIDIOC_DQBUF: ret:%d, index:%d\n",ret,buf->index)); DEB_D(("VIDIOC_DQBUF: ret:%d, index:%d\n",ret,buf->index));
return ret; return ret;
} }
...@@ -1166,7 +1166,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int ...@@ -1166,7 +1166,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
if( 0 != err) { if( 0 != err) {
return err; return err;
} }
err = videobuf_streamon(file,q); err = videobuf_streamon(q);
return err; return err;
} }
case VIDIOC_STREAMOFF: { case VIDIOC_STREAMOFF: {
...@@ -1187,7 +1187,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int ...@@ -1187,7 +1187,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
return -EBUSY; return -EBUSY;
} }
err = videobuf_streamoff(file,q); err = videobuf_streamoff(q);
if (0 != err) { if (0 != err) {
DEB_D(("warning: videobuf_streamoff() failed.\n")); DEB_D(("warning: videobuf_streamoff() failed.\n"));
video_end(fh, file); video_end(fh, file);
...@@ -1210,7 +1210,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int ...@@ -1210,7 +1210,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
q = &fh->video_q; q = &fh->video_q;
down(&q->lock); down(&q->lock);
err = videobuf_mmap_setup(file,q,gbuffers,gbufsize, err = videobuf_mmap_setup(q,gbuffers,gbufsize,
V4L2_MEMORY_MMAP); V4L2_MEMORY_MMAP);
if (err < 0) { if (err < 0) {
up(&q->lock); up(&q->lock);
...@@ -1247,9 +1247,10 @@ static int buffer_activate (struct saa7146_dev *dev, ...@@ -1247,9 +1247,10 @@ static int buffer_activate (struct saa7146_dev *dev,
return 0; return 0;
} }
static int buffer_prepare(void *priv, struct videobuf_buffer *vb, enum v4l2_field field) static int buffer_prepare(struct videobuf_queue *q,
struct videobuf_buffer *vb, enum v4l2_field field)
{ {
struct file *file = priv; struct file *file = q->priv_data;
struct saa7146_fh *fh = file->private_data; struct saa7146_fh *fh = file->private_data;
struct saa7146_dev *dev = fh->dev; struct saa7146_dev *dev = fh->dev;
struct saa7146_vv *vv = dev->vv_data; struct saa7146_vv *vv = dev->vv_data;
...@@ -1330,9 +1331,9 @@ static int buffer_prepare(void *priv, struct videobuf_buffer *vb, enum v4l2_fiel ...@@ -1330,9 +1331,9 @@ static int buffer_prepare(void *priv, struct videobuf_buffer *vb, enum v4l2_fiel
return err; return err;
} }
static int buffer_setup(void *priv, unsigned int *count, unsigned int *size) static int buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size)
{ {
struct file *file = priv; struct file *file = q->priv_data;
struct saa7146_fh *fh = file->private_data; struct saa7146_fh *fh = file->private_data;
if (0 == *count || *count > MAX_SAA7146_CAPTURE_BUFFERS) if (0 == *count || *count > MAX_SAA7146_CAPTURE_BUFFERS)
...@@ -1350,9 +1351,9 @@ static int buffer_setup(void *priv, unsigned int *count, unsigned int *size) ...@@ -1350,9 +1351,9 @@ static int buffer_setup(void *priv, unsigned int *count, unsigned int *size)
return 0; return 0;
} }
static void buffer_queue(void *priv, struct videobuf_buffer *vb) static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb)
{ {
struct file *file = priv; struct file *file = q->priv_data;
struct saa7146_fh *fh = file->private_data; struct saa7146_fh *fh = file->private_data;
struct saa7146_dev *dev = fh->dev; struct saa7146_dev *dev = fh->dev;
struct saa7146_vv *vv = dev->vv_data; struct saa7146_vv *vv = dev->vv_data;
...@@ -1363,9 +1364,9 @@ static void buffer_queue(void *priv, struct videobuf_buffer *vb) ...@@ -1363,9 +1364,9 @@ static void buffer_queue(void *priv, struct videobuf_buffer *vb)
} }
static void buffer_release(void *priv, struct videobuf_buffer *vb) static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb)
{ {
struct file *file = priv; struct file *file = q->priv_data;
struct saa7146_fh *fh = file->private_data; struct saa7146_fh *fh = file->private_data;
struct saa7146_dev *dev = fh->dev; struct saa7146_dev *dev = fh->dev;
struct saa7146_buf *buf = (struct saa7146_buf *)vb; struct saa7146_buf *buf = (struct saa7146_buf *)vb;
...@@ -1419,7 +1420,8 @@ static int video_open(struct saa7146_dev *dev, struct file *file) ...@@ -1419,7 +1420,8 @@ static int video_open(struct saa7146_dev *dev, struct file *file)
dev->pci, &dev->slock, dev->pci, &dev->slock,
V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_BUF_TYPE_VIDEO_CAPTURE,
V4L2_FIELD_INTERLACED, V4L2_FIELD_INTERLACED,
sizeof(struct saa7146_buf)); sizeof(struct saa7146_buf),
file);
init_MUTEX(&fh->video_q.lock); init_MUTEX(&fh->video_q.lock);
...@@ -1485,7 +1487,7 @@ static ssize_t video_read(struct file *file, char __user *data, size_t count, lo ...@@ -1485,7 +1487,7 @@ static ssize_t video_read(struct file *file, char __user *data, size_t count, lo
goto out; goto out;
} }
ret = videobuf_read_one(file,&fh->video_q , data, count, ppos, ret = videobuf_read_one(&fh->video_q, data, count, ppos,
file->f_flags & O_NONBLOCK); file->f_flags & O_NONBLOCK);
if (ret != 0) { if (ret != 0) {
video_end(fh, file); video_end(fh, file);
......
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