aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/common')
-rw-r--r--drivers/media/common/saa7146_fops.c37
1 files changed, 33 insertions, 4 deletions
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c
index a9ff5b5af1cf..b614612be7b4 100644
--- a/drivers/media/common/saa7146_fops.c
+++ b/drivers/media/common/saa7146_fops.c
@@ -253,7 +253,10 @@ static int fops_open(struct inode *inode, struct file *file)
253 253
254 if( fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) { 254 if( fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) {
255 DEB_S(("initializing vbi...\n")); 255 DEB_S(("initializing vbi...\n"));
256 result = saa7146_vbi_uops.open(dev,file); 256 if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE)
257 result = saa7146_vbi_uops.open(dev,file);
258 if (dev->ext_vv_data->vbi_fops.open)
259 dev->ext_vv_data->vbi_fops.open(inode, file);
257 } else { 260 } else {
258 DEB_S(("initializing video...\n")); 261 DEB_S(("initializing video...\n"));
259 result = saa7146_video_uops.open(dev,file); 262 result = saa7146_video_uops.open(dev,file);
@@ -289,7 +292,10 @@ static int fops_release(struct inode *inode, struct file *file)
289 return -ERESTARTSYS; 292 return -ERESTARTSYS;
290 293
291 if( fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) { 294 if( fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) {
292 saa7146_vbi_uops.release(dev,file); 295 if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE)
296 saa7146_vbi_uops.release(dev,file);
297 if (dev->ext_vv_data->vbi_fops.release)
298 dev->ext_vv_data->vbi_fops.release(inode, file);
293 } else { 299 } else {
294 saa7146_video_uops.release(dev,file); 300 saa7146_video_uops.release(dev,file);
295 } 301 }
@@ -382,7 +388,10 @@ static ssize_t fops_read(struct file *file, char __user *data, size_t count, lof
382 } 388 }
383 case V4L2_BUF_TYPE_VBI_CAPTURE: { 389 case V4L2_BUF_TYPE_VBI_CAPTURE: {
384// DEB_EE(("V4L2_BUF_TYPE_VBI_CAPTURE: file:%p, data:%p, count:%lu\n", file, data, (unsigned long)count)); 390// DEB_EE(("V4L2_BUF_TYPE_VBI_CAPTURE: file:%p, data:%p, count:%lu\n", file, data, (unsigned long)count));
385 return saa7146_vbi_uops.read(file,data,count,ppos); 391 if (fh->dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE)
392 return saa7146_vbi_uops.read(file,data,count,ppos);
393 else
394 return -EINVAL;
386 } 395 }
387 break; 396 break;
388 default: 397 default:
@@ -391,12 +400,31 @@ static ssize_t fops_read(struct file *file, char __user *data, size_t count, lof
391 } 400 }
392} 401}
393 402
403static ssize_t fops_write(struct file *file, const char __user *data, size_t count, loff_t *ppos)
404{
405 struct saa7146_fh *fh = file->private_data;
406
407 switch (fh->type) {
408 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
409 return -EINVAL;
410 case V4L2_BUF_TYPE_VBI_CAPTURE:
411 if (fh->dev->ext_vv_data->vbi_fops.write)
412 return fh->dev->ext_vv_data->vbi_fops.write(file, data, count, ppos);
413 else
414 return -EINVAL;
415 default:
416 BUG();
417 return -EINVAL;
418 }
419}
420
394static struct file_operations video_fops = 421static struct file_operations video_fops =
395{ 422{
396 .owner = THIS_MODULE, 423 .owner = THIS_MODULE,
397 .open = fops_open, 424 .open = fops_open,
398 .release = fops_release, 425 .release = fops_release,
399 .read = fops_read, 426 .read = fops_read,
427 .write = fops_write,
400 .poll = fops_poll, 428 .poll = fops_poll,
401 .mmap = fops_mmap, 429 .mmap = fops_mmap,
402 .ioctl = fops_ioctl, 430 .ioctl = fops_ioctl,
@@ -468,7 +496,8 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
468 memset(vv->d_clipping.cpu_addr, 0x0, SAA7146_CLIPPING_MEM); 496 memset(vv->d_clipping.cpu_addr, 0x0, SAA7146_CLIPPING_MEM);
469 497
470 saa7146_video_uops.init(dev,vv); 498 saa7146_video_uops.init(dev,vv);
471 saa7146_vbi_uops.init(dev,vv); 499 if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE)
500 saa7146_vbi_uops.init(dev,vv);
472 501
473 dev->vv_data = vv; 502 dev->vv_data = vv;
474 dev->vv_callback = &vv_callback; 503 dev->vv_callback = &vv_callback;