diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2012-05-01 11:57:57 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-05-14 14:00:49 -0400 |
commit | ab49ae0f201f1e7e07250d011fffde8ed2530175 (patch) | |
tree | 0fb1a572c621f44b3974c994b65e4a7ba9902201 /drivers/media/video/mxb.c | |
parent | 537fa492e084af58d16899f8d0f3f3516a4fbe7c (diff) |
[media] saa7146: fix querycap, vbi/video separation and g/s_register
The querycap ioctl returned an incorrect version number and incorrect
capabilities (mixing up vbi and video caps).
The reason for that was that video nodes could do vbi activities: that
should be separated between the vbi and video nodes.
There were also a few minor problems with dbg_g/s_register that have
been resolved. The mxb/saa7146 driver now passes the v4l2_compliance tests.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/mxb.c')
-rw-r--r-- | drivers/media/video/mxb.c | 41 |
1 files changed, 28 insertions, 13 deletions
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(®->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 | ||
668 | static int vidioc_s_register(struct file *file, void *fh, struct v4l2_dbg_register *reg) | 676 | static 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(®->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"); |