aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/common/saa7146_fops.c8
-rw-r--r--drivers/media/common/saa7146_video.c35
-rw-r--r--drivers/media/dvb/ttpci/av7110_v4l.c24
-rw-r--r--drivers/media/dvb/ttpci/budget-av.c6
-rw-r--r--drivers/media/video/hexium_gemini.c12
-rw-r--r--drivers/media/video/hexium_orion.c6
-rw-r--r--drivers/media/video/mxb.c41
-rw-r--r--include/media/saa7146.h2
-rw-r--r--include/media/saa7146_vv.h4
9 files changed, 92 insertions, 46 deletions
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c
index dfb396568ab6..428a543ec2ce 100644
--- a/drivers/media/common/saa7146_fops.c
+++ b/drivers/media/common/saa7146_fops.c
@@ -478,7 +478,8 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
478 v4l2_ctrl_handler_free(hdl); 478 v4l2_ctrl_handler_free(hdl);
479 return -ENOMEM; 479 return -ENOMEM;
480 } 480 }
481 ext_vv->ops = saa7146_video_ioctl_ops; 481 ext_vv->vid_ops = saa7146_video_ioctl_ops;
482 ext_vv->vbi_ops = saa7146_vbi_ioctl_ops;
482 ext_vv->core_ops = &saa7146_video_ioctl_ops; 483 ext_vv->core_ops = &saa7146_video_ioctl_ops;
483 484
484 DEB_EE("dev:%p\n", dev); 485 DEB_EE("dev:%p\n", dev);
@@ -579,7 +580,10 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev,
579 return -ENOMEM; 580 return -ENOMEM;
580 581
581 vfd->fops = &video_fops; 582 vfd->fops = &video_fops;
582 vfd->ioctl_ops = &dev->ext_vv_data->ops; 583 if (type == VFL_TYPE_GRABBER)
584 vfd->ioctl_ops = &dev->ext_vv_data->vid_ops;
585 else
586 vfd->ioctl_ops = &dev->ext_vv_data->vbi_ops;
583 vfd->release = video_device_release; 587 vfd->release = video_device_release;
584 /* Locking in file operations other than ioctl should be done by 588 /* Locking in file operations other than ioctl should be done by
585 the driver, not the V4L2 core. 589 the driver, not the V4L2 core.
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c
index 4ca9a2561513..9d193208b892 100644
--- a/drivers/media/common/saa7146_video.c
+++ b/drivers/media/common/saa7146_video.c
@@ -446,18 +446,24 @@ static int video_end(struct saa7146_fh *fh, struct file *file)
446 446
447static int vidioc_querycap(struct file *file, void *fh, struct v4l2_capability *cap) 447static int vidioc_querycap(struct file *file, void *fh, struct v4l2_capability *cap)
448{ 448{
449 struct video_device *vdev = video_devdata(file);
449 struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev; 450 struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev;
450 451
451 strcpy((char *)cap->driver, "saa7146 v4l2"); 452 strcpy((char *)cap->driver, "saa7146 v4l2");
452 strlcpy((char *)cap->card, dev->ext->name, sizeof(cap->card)); 453 strlcpy((char *)cap->card, dev->ext->name, sizeof(cap->card));
453 sprintf((char *)cap->bus_info, "PCI:%s", pci_name(dev->pci)); 454 sprintf((char *)cap->bus_info, "PCI:%s", pci_name(dev->pci));
454 cap->version = SAA7146_VERSION_CODE;
455 cap->device_caps = 455 cap->device_caps =
456 V4L2_CAP_VIDEO_CAPTURE | 456 V4L2_CAP_VIDEO_CAPTURE |
457 V4L2_CAP_VIDEO_OVERLAY | 457 V4L2_CAP_VIDEO_OVERLAY |
458 V4L2_CAP_READWRITE | 458 V4L2_CAP_READWRITE |
459 V4L2_CAP_STREAMING; 459 V4L2_CAP_STREAMING;
460 cap->device_caps |= dev->ext_vv_data->capabilities; 460 cap->device_caps |= dev->ext_vv_data->capabilities;
461 if (vdev->vfl_type == VFL_TYPE_GRABBER)
462 cap->device_caps &=
463 ~(V4L2_CAP_VBI_CAPTURE | V4L2_CAP_SLICED_VBI_OUTPUT);
464 else
465 cap->device_caps &=
466 ~(V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OVERLAY);
461 cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; 467 cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
462 return 0; 468 return 0;
463} 469}
@@ -990,10 +996,14 @@ static int vidioc_g_chip_ident(struct file *file, void *__fh,
990 996
991 chip->ident = V4L2_IDENT_NONE; 997 chip->ident = V4L2_IDENT_NONE;
992 chip->revision = 0; 998 chip->revision = 0;
993 if (chip->match.type == V4L2_CHIP_MATCH_HOST && !chip->match.addr) { 999 if (chip->match.type == V4L2_CHIP_MATCH_HOST) {
994 chip->ident = V4L2_IDENT_SAA7146; 1000 if (v4l2_chip_match_host(&chip->match))
1001 chip->ident = V4L2_IDENT_SAA7146;
995 return 0; 1002 return 0;
996 } 1003 }
1004 if (chip->match.type != V4L2_CHIP_MATCH_I2C_DRIVER &&
1005 chip->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
1006 return -EINVAL;
997 return v4l2_device_call_until_err(&dev->v4l2_dev, 0, 1007 return v4l2_device_call_until_err(&dev->v4l2_dev, 0,
998 core, g_chip_ident, chip); 1008 core, g_chip_ident, chip);
999} 1009}
@@ -1008,7 +1018,6 @@ const struct v4l2_ioctl_ops saa7146_video_ioctl_ops = {
1008 .vidioc_g_fmt_vid_overlay = vidioc_g_fmt_vid_overlay, 1018 .vidioc_g_fmt_vid_overlay = vidioc_g_fmt_vid_overlay,
1009 .vidioc_try_fmt_vid_overlay = vidioc_try_fmt_vid_overlay, 1019 .vidioc_try_fmt_vid_overlay = vidioc_try_fmt_vid_overlay,
1010 .vidioc_s_fmt_vid_overlay = vidioc_s_fmt_vid_overlay, 1020 .vidioc_s_fmt_vid_overlay = vidioc_s_fmt_vid_overlay,
1011 .vidioc_g_fmt_vbi_cap = vidioc_g_fmt_vbi_cap,
1012 .vidioc_g_chip_ident = vidioc_g_chip_ident, 1021 .vidioc_g_chip_ident = vidioc_g_chip_ident,
1013 1022
1014 .vidioc_overlay = vidioc_overlay, 1023 .vidioc_overlay = vidioc_overlay,
@@ -1027,6 +1036,24 @@ const struct v4l2_ioctl_ops saa7146_video_ioctl_ops = {
1027 .vidioc_unsubscribe_event = v4l2_event_unsubscribe, 1036 .vidioc_unsubscribe_event = v4l2_event_unsubscribe,
1028}; 1037};
1029 1038
1039const struct v4l2_ioctl_ops saa7146_vbi_ioctl_ops = {
1040 .vidioc_querycap = vidioc_querycap,
1041 .vidioc_g_fmt_vbi_cap = vidioc_g_fmt_vbi_cap,
1042 .vidioc_g_chip_ident = vidioc_g_chip_ident,
1043
1044 .vidioc_reqbufs = vidioc_reqbufs,
1045 .vidioc_querybuf = vidioc_querybuf,
1046 .vidioc_qbuf = vidioc_qbuf,
1047 .vidioc_dqbuf = vidioc_dqbuf,
1048 .vidioc_g_std = vidioc_g_std,
1049 .vidioc_s_std = vidioc_s_std,
1050 .vidioc_streamon = vidioc_streamon,
1051 .vidioc_streamoff = vidioc_streamoff,
1052 .vidioc_g_parm = vidioc_g_parm,
1053 .vidioc_subscribe_event = v4l2_ctrl_subscribe_event,
1054 .vidioc_unsubscribe_event = v4l2_event_unsubscribe,
1055};
1056
1030/*********************************************************************************/ 1057/*********************************************************************************/
1031/* buffer handling functions */ 1058/* buffer handling functions */
1032 1059
diff --git a/drivers/media/dvb/ttpci/av7110_v4l.c b/drivers/media/dvb/ttpci/av7110_v4l.c
index ee8ee1d481fa..f1dc6e76a6a1 100644
--- a/drivers/media/dvb/ttpci/av7110_v4l.c
+++ b/drivers/media/dvb/ttpci/av7110_v4l.c
@@ -802,18 +802,18 @@ int av7110_init_v4l(struct av7110 *av7110)
802 ERR("cannot init capture device. skipping\n"); 802 ERR("cannot init capture device. skipping\n");
803 return -ENODEV; 803 return -ENODEV;
804 } 804 }
805 vv_data->ops.vidioc_enum_input = vidioc_enum_input; 805 vv_data->vid_ops.vidioc_enum_input = vidioc_enum_input;
806 vv_data->ops.vidioc_g_input = vidioc_g_input; 806 vv_data->vid_ops.vidioc_g_input = vidioc_g_input;
807 vv_data->ops.vidioc_s_input = vidioc_s_input; 807 vv_data->vid_ops.vidioc_s_input = vidioc_s_input;
808 vv_data->ops.vidioc_g_tuner = vidioc_g_tuner; 808 vv_data->vid_ops.vidioc_g_tuner = vidioc_g_tuner;
809 vv_data->ops.vidioc_s_tuner = vidioc_s_tuner; 809 vv_data->vid_ops.vidioc_s_tuner = vidioc_s_tuner;
810 vv_data->ops.vidioc_g_frequency = vidioc_g_frequency; 810 vv_data->vid_ops.vidioc_g_frequency = vidioc_g_frequency;
811 vv_data->ops.vidioc_s_frequency = vidioc_s_frequency; 811 vv_data->vid_ops.vidioc_s_frequency = vidioc_s_frequency;
812 vv_data->ops.vidioc_g_audio = vidioc_g_audio; 812 vv_data->vid_ops.vidioc_g_audio = vidioc_g_audio;
813 vv_data->ops.vidioc_s_audio = vidioc_s_audio; 813 vv_data->vid_ops.vidioc_s_audio = vidioc_s_audio;
814 vv_data->ops.vidioc_g_sliced_vbi_cap = vidioc_g_sliced_vbi_cap; 814 vv_data->vbi_ops.vidioc_g_sliced_vbi_cap = vidioc_g_sliced_vbi_cap;
815 vv_data->ops.vidioc_g_fmt_sliced_vbi_out = vidioc_g_fmt_sliced_vbi_out; 815 vv_data->vbi_ops.vidioc_g_fmt_sliced_vbi_out = vidioc_g_fmt_sliced_vbi_out;
816 vv_data->ops.vidioc_s_fmt_sliced_vbi_out = vidioc_s_fmt_sliced_vbi_out; 816 vv_data->vbi_ops.vidioc_s_fmt_sliced_vbi_out = vidioc_s_fmt_sliced_vbi_out;
817 817
818 if (saa7146_register_device(&av7110->v4l_dev, dev, "av7110", VFL_TYPE_GRABBER)) { 818 if (saa7146_register_device(&av7110->v4l_dev, dev, "av7110", VFL_TYPE_GRABBER)) {
819 ERR("cannot register capture device. skipping\n"); 819 ERR("cannot register capture device. skipping\n");
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c
index 8b32e282bf5d..12ddb53c58dc 100644
--- a/drivers/media/dvb/ttpci/budget-av.c
+++ b/drivers/media/dvb/ttpci/budget-av.c
@@ -1483,9 +1483,9 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio
1483 ERR("cannot init vv subsystem\n"); 1483 ERR("cannot init vv subsystem\n");
1484 return err; 1484 return err;
1485 } 1485 }
1486 vv_data.ops.vidioc_enum_input = vidioc_enum_input; 1486 vv_data.vid_ops.vidioc_enum_input = vidioc_enum_input;
1487 vv_data.ops.vidioc_g_input = vidioc_g_input; 1487 vv_data.vid_ops.vidioc_g_input = vidioc_g_input;
1488 vv_data.ops.vidioc_s_input = vidioc_s_input; 1488 vv_data.vid_ops.vidioc_s_input = vidioc_s_input;
1489 1489
1490 if ((err = saa7146_register_device(&budget_av->vd, dev, "knc1", VFL_TYPE_GRABBER))) { 1490 if ((err = saa7146_register_device(&budget_av->vd, dev, "knc1", VFL_TYPE_GRABBER))) {
1491 /* fixme: proper cleanup here */ 1491 /* fixme: proper cleanup here */
diff --git a/drivers/media/video/hexium_gemini.c b/drivers/media/video/hexium_gemini.c
index a62322d5c0d8..22650322d0a9 100644
--- a/drivers/media/video/hexium_gemini.c
+++ b/drivers/media/video/hexium_gemini.c
@@ -399,12 +399,12 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d
399 hexium->cur_input = 0; 399 hexium->cur_input = 0;
400 400
401 saa7146_vv_init(dev, &vv_data); 401 saa7146_vv_init(dev, &vv_data);
402 vv_data.ops.vidioc_queryctrl = vidioc_queryctrl; 402 vv_data.vid_ops.vidioc_queryctrl = vidioc_queryctrl;
403 vv_data.ops.vidioc_g_ctrl = vidioc_g_ctrl; 403 vv_data.vid_ops.vidioc_g_ctrl = vidioc_g_ctrl;
404 vv_data.ops.vidioc_s_ctrl = vidioc_s_ctrl; 404 vv_data.vid_ops.vidioc_s_ctrl = vidioc_s_ctrl;
405 vv_data.ops.vidioc_enum_input = vidioc_enum_input; 405 vv_data.vid_ops.vidioc_enum_input = vidioc_enum_input;
406 vv_data.ops.vidioc_g_input = vidioc_g_input; 406 vv_data.vid_ops.vidioc_g_input = vidioc_g_input;
407 vv_data.ops.vidioc_s_input = vidioc_s_input; 407 vv_data.vid_ops.vidioc_s_input = vidioc_s_input;
408 ret = saa7146_register_device(&hexium->video_dev, dev, "hexium gemini", VFL_TYPE_GRABBER); 408 ret = saa7146_register_device(&hexium->video_dev, dev, "hexium gemini", VFL_TYPE_GRABBER);
409 if (ret < 0) { 409 if (ret < 0) {
410 pr_err("cannot register capture v4l2 device. skipping.\n"); 410 pr_err("cannot register capture v4l2 device. skipping.\n");
diff --git a/drivers/media/video/hexium_orion.c b/drivers/media/video/hexium_orion.c
index 23debc967d94..e549339f32d6 100644
--- a/drivers/media/video/hexium_orion.c
+++ b/drivers/media/video/hexium_orion.c
@@ -371,9 +371,9 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d
371 DEB_EE("\n"); 371 DEB_EE("\n");
372 372
373 saa7146_vv_init(dev, &vv_data); 373 saa7146_vv_init(dev, &vv_data);
374 vv_data.ops.vidioc_enum_input = vidioc_enum_input; 374 vv_data.vid_ops.vidioc_enum_input = vidioc_enum_input;
375 vv_data.ops.vidioc_g_input = vidioc_g_input; 375 vv_data.vid_ops.vidioc_g_input = vidioc_g_input;
376 vv_data.ops.vidioc_s_input = vidioc_s_input; 376 vv_data.vid_ops.vidioc_s_input = vidioc_s_input;
377 if (0 != saa7146_register_device(&hexium->video_dev, dev, "hexium orion", VFL_TYPE_GRABBER)) { 377 if (0 != saa7146_register_device(&hexium->video_dev, dev, "hexium orion", VFL_TYPE_GRABBER)) {
378 pr_err("cannot register capture v4l2 device. skipping.\n"); 378 pr_err("cannot register capture v4l2 device. skipping.\n");
379 return -1; 379 return -1;
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c
index db0c5ddec87f..d2d261291158 100644
--- a/drivers/media/video/mxb.c
+++ b/drivers/media/video/mxb.c
@@ -662,13 +662,28 @@ static int vidioc_g_register(struct file *file, void *fh, struct v4l2_dbg_regist
662{ 662{
663 struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev; 663 struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev;
664 664
665 return call_all(dev, core, g_register, reg); 665 if (!capable(CAP_SYS_ADMIN))
666 return -EPERM;
667 if (v4l2_chip_match_host(&reg->match)) {
668 reg->val = saa7146_read(dev, reg->reg);
669 reg->size = 4;
670 return 0;
671 }
672 call_all(dev, core, g_register, reg);
673 return 0;
666} 674}
667 675
668static int vidioc_s_register(struct file *file, void *fh, struct v4l2_dbg_register *reg) 676static int vidioc_s_register(struct file *file, void *fh, struct v4l2_dbg_register *reg)
669{ 677{
670 struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev; 678 struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev;
671 679
680 if (!capable(CAP_SYS_ADMIN))
681 return -EPERM;
682 if (v4l2_chip_match_host(&reg->match)) {
683 saa7146_write(dev, reg->reg, reg->val);
684 reg->size = 4;
685 return 0;
686 }
672 return call_all(dev, core, s_register, reg); 687 return call_all(dev, core, s_register, reg);
673} 688}
674#endif 689#endif
@@ -689,19 +704,19 @@ static int mxb_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data
689 } 704 }
690 mxb = (struct mxb *)dev->ext_priv; 705 mxb = (struct mxb *)dev->ext_priv;
691 706
692 vv_data.ops.vidioc_enum_input = vidioc_enum_input; 707 vv_data.vid_ops.vidioc_enum_input = vidioc_enum_input;
693 vv_data.ops.vidioc_g_input = vidioc_g_input; 708 vv_data.vid_ops.vidioc_g_input = vidioc_g_input;
694 vv_data.ops.vidioc_s_input = vidioc_s_input; 709 vv_data.vid_ops.vidioc_s_input = vidioc_s_input;
695 vv_data.ops.vidioc_g_tuner = vidioc_g_tuner; 710 vv_data.vid_ops.vidioc_g_tuner = vidioc_g_tuner;
696 vv_data.ops.vidioc_s_tuner = vidioc_s_tuner; 711 vv_data.vid_ops.vidioc_s_tuner = vidioc_s_tuner;
697 vv_data.ops.vidioc_g_frequency = vidioc_g_frequency; 712 vv_data.vid_ops.vidioc_g_frequency = vidioc_g_frequency;
698 vv_data.ops.vidioc_s_frequency = vidioc_s_frequency; 713 vv_data.vid_ops.vidioc_s_frequency = vidioc_s_frequency;
699 vv_data.ops.vidioc_enumaudio = vidioc_enumaudio; 714 vv_data.vid_ops.vidioc_enumaudio = vidioc_enumaudio;
700 vv_data.ops.vidioc_g_audio = vidioc_g_audio; 715 vv_data.vid_ops.vidioc_g_audio = vidioc_g_audio;
701 vv_data.ops.vidioc_s_audio = vidioc_s_audio; 716 vv_data.vid_ops.vidioc_s_audio = vidioc_s_audio;
702#ifdef CONFIG_VIDEO_ADV_DEBUG 717#ifdef CONFIG_VIDEO_ADV_DEBUG
703 vv_data.ops.vidioc_g_register = vidioc_g_register; 718 vv_data.vid_ops.vidioc_g_register = vidioc_g_register;
704 vv_data.ops.vidioc_s_register = vidioc_s_register; 719 vv_data.vid_ops.vidioc_s_register = vidioc_s_register;
705#endif 720#endif
706 if (saa7146_register_device(&mxb->video_dev, dev, "mxb", VFL_TYPE_GRABBER)) { 721 if (saa7146_register_device(&mxb->video_dev, dev, "mxb", VFL_TYPE_GRABBER)) {
707 ERR("cannot register capture v4l2 device. skipping.\n"); 722 ERR("cannot register capture v4l2 device. skipping.\n");
diff --git a/include/media/saa7146.h b/include/media/saa7146.h
index c791940c579b..773e527deabe 100644
--- a/include/media/saa7146.h
+++ b/include/media/saa7146.h
@@ -18,8 +18,6 @@
18#include <linux/vmalloc.h> /* for vmalloc() */ 18#include <linux/vmalloc.h> /* for vmalloc() */
19#include <linux/mm.h> /* for vmalloc_to_page() */ 19#include <linux/mm.h> /* for vmalloc_to_page() */
20 20
21#define SAA7146_VERSION_CODE 0x000600 /* 0.6.0 */
22
23#define saa7146_write(sxy,adr,dat) writel((dat),(sxy->mem+(adr))) 21#define saa7146_write(sxy,adr,dat) writel((dat),(sxy->mem+(adr)))
24#define saa7146_read(sxy,adr) readl(sxy->mem+(adr)) 22#define saa7146_read(sxy,adr) readl(sxy->mem+(adr))
25 23
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h
index 2bbdf3046be6..944ecdf3530f 100644
--- a/include/media/saa7146_vv.h
+++ b/include/media/saa7146_vv.h
@@ -161,7 +161,8 @@ struct saa7146_ext_vv
161 int (*std_callback)(struct saa7146_dev*, struct saa7146_standard *); 161 int (*std_callback)(struct saa7146_dev*, struct saa7146_standard *);
162 162
163 /* the extension can override this */ 163 /* the extension can override this */
164 struct v4l2_ioctl_ops ops; 164 struct v4l2_ioctl_ops vid_ops;
165 struct v4l2_ioctl_ops vbi_ops;
165 /* pointer to the saa7146 core ops */ 166 /* pointer to the saa7146 core ops */
166 const struct v4l2_ioctl_ops *core_ops; 167 const struct v4l2_ioctl_ops *core_ops;
167 168
@@ -200,6 +201,7 @@ void saa7146_set_gpio(struct saa7146_dev *saa, u8 pin, u8 data);
200 201
201/* from saa7146_video.c */ 202/* from saa7146_video.c */
202extern const struct v4l2_ioctl_ops saa7146_video_ioctl_ops; 203extern const struct v4l2_ioctl_ops saa7146_video_ioctl_ops;
204extern const struct v4l2_ioctl_ops saa7146_vbi_ioctl_ops;
203extern struct saa7146_use_ops saa7146_video_uops; 205extern struct saa7146_use_ops saa7146_video_uops;
204int saa7146_start_preview(struct saa7146_fh *fh); 206int saa7146_start_preview(struct saa7146_fh *fh);
205int saa7146_stop_preview(struct saa7146_fh *fh); 207int saa7146_stop_preview(struct saa7146_fh *fh);