aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2013-04-10 13:26:52 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-04-14 19:02:15 -0400
commit5854bf88599545572ce89fba6c4fa0bf6b6e226c (patch)
tree4f6822285937c5fd0ca8298cb84ccb8ab84a05fe
parent3315c59a45d5314c935a7dd82ab3c324c0d01343 (diff)
[media] hdpvr: allow g/s/enum/querystd when in legacy mode
Both MythTV and gstreamer expect that they can set/get/query/enumerate the standards, even if the input is the component input for which standards really do not apply. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/usb/hdpvr/hdpvr-video.c37
1 files changed, 26 insertions, 11 deletions
diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpvr/hdpvr-video.c
index 43763097d9bf..774ba0e820be 100644
--- a/drivers/media/usb/hdpvr/hdpvr-video.c
+++ b/drivers/media/usb/hdpvr/hdpvr-video.c
@@ -571,13 +571,14 @@ static int vidioc_querycap(struct file *file, void *priv,
571 return 0; 571 return 0;
572} 572}
573 573
574static int vidioc_s_std(struct file *file, void *private_data, 574static int vidioc_s_std(struct file *file, void *_fh,
575 v4l2_std_id std) 575 v4l2_std_id std)
576{ 576{
577 struct hdpvr_device *dev = video_drvdata(file); 577 struct hdpvr_device *dev = video_drvdata(file);
578 struct hdpvr_fh *fh = _fh;
578 u8 std_type = 1; 579 u8 std_type = 1;
579 580
580 if (dev->options.video_input == HDPVR_COMPONENT) 581 if (!fh->legacy_mode && dev->options.video_input == HDPVR_COMPONENT)
581 return -ENODATA; 582 return -ENODATA;
582 if (dev->status != STATUS_IDLE) 583 if (dev->status != STATUS_IDLE)
583 return -EBUSY; 584 return -EBUSY;
@@ -590,25 +591,27 @@ static int vidioc_s_std(struct file *file, void *private_data,
590 return hdpvr_config_call(dev, CTRL_VIDEO_STD_TYPE, std_type); 591 return hdpvr_config_call(dev, CTRL_VIDEO_STD_TYPE, std_type);
591} 592}
592 593
593static int vidioc_g_std(struct file *file, void *private_data, 594static int vidioc_g_std(struct file *file, void *_fh,
594 v4l2_std_id *std) 595 v4l2_std_id *std)
595{ 596{
596 struct hdpvr_device *dev = video_drvdata(file); 597 struct hdpvr_device *dev = video_drvdata(file);
598 struct hdpvr_fh *fh = _fh;
597 599
598 if (dev->options.video_input == HDPVR_COMPONENT) 600 if (!fh->legacy_mode && dev->options.video_input == HDPVR_COMPONENT)
599 return -ENODATA; 601 return -ENODATA;
600 *std = dev->cur_std; 602 *std = dev->cur_std;
601 return 0; 603 return 0;
602} 604}
603 605
604static int vidioc_querystd(struct file *file, void *fh, v4l2_std_id *a) 606static int vidioc_querystd(struct file *file, void *_fh, v4l2_std_id *a)
605{ 607{
606 struct hdpvr_device *dev = video_drvdata(file); 608 struct hdpvr_device *dev = video_drvdata(file);
607 struct hdpvr_video_info *vid_info; 609 struct hdpvr_video_info *vid_info;
610 struct hdpvr_fh *fh = _fh;
608 611
609 if (dev->options.video_input == HDPVR_COMPONENT)
610 return -ENODATA;
611 *a = V4L2_STD_ALL; 612 *a = V4L2_STD_ALL;
613 if (dev->options.video_input == HDPVR_COMPONENT)
614 return fh->legacy_mode ? 0 : -ENODATA;
612 vid_info = get_video_info(dev); 615 vid_info = get_video_info(dev);
613 if (vid_info == NULL) 616 if (vid_info == NULL)
614 return 0; 617 return 0;
@@ -742,8 +745,7 @@ static const char *iname[] = {
742 [HDPVR_COMPOSITE] = "Composite", 745 [HDPVR_COMPOSITE] = "Composite",
743}; 746};
744 747
745static int vidioc_enum_input(struct file *file, void *priv, 748static int vidioc_enum_input(struct file *file, void *_fh, struct v4l2_input *i)
746 struct v4l2_input *i)
747{ 749{
748 unsigned int n; 750 unsigned int n;
749 751
@@ -764,7 +766,7 @@ static int vidioc_enum_input(struct file *file, void *priv,
764 return 0; 766 return 0;
765} 767}
766 768
767static int vidioc_s_input(struct file *file, void *private_data, 769static int vidioc_s_input(struct file *file, void *_fh,
768 unsigned int index) 770 unsigned int index)
769{ 771{
770 struct hdpvr_device *dev = video_drvdata(file); 772 struct hdpvr_device *dev = video_drvdata(file);
@@ -779,8 +781,20 @@ static int vidioc_s_input(struct file *file, void *private_data,
779 retval = hdpvr_config_call(dev, CTRL_VIDEO_INPUT_VALUE, index+1); 781 retval = hdpvr_config_call(dev, CTRL_VIDEO_INPUT_VALUE, index+1);
780 if (!retval) { 782 if (!retval) {
781 dev->options.video_input = index; 783 dev->options.video_input = index;
784 /*
785 * Unfortunately gstreamer calls ENUMSTD and bails out if it
786 * won't find any formats, even though component input is
787 * selected. This means that we have to leave tvnorms at
788 * V4L2_STD_ALL. We cannot use the 'legacy' trick since
789 * tvnorms is set at the device node level and not at the
790 * filehandle level.
791 *
792 * Comment this out for now, but if the legacy mode can be
793 * removed in the future, then this code should be enabled
794 * again.
782 dev->video_dev->tvnorms = 795 dev->video_dev->tvnorms =
783 index != HDPVR_COMPONENT ? V4L2_STD_ALL : 0; 796 (index != HDPVR_COMPONENT) ? V4L2_STD_ALL : 0;
797 */
784 } 798 }
785 799
786 return retval; 800 return retval;
@@ -1126,6 +1140,7 @@ static const struct video_device hdpvr_video_template = {
1126 .fops = &hdpvr_fops, 1140 .fops = &hdpvr_fops,
1127 .release = hdpvr_device_release, 1141 .release = hdpvr_device_release,
1128 .ioctl_ops = &hdpvr_ioctl_ops, 1142 .ioctl_ops = &hdpvr_ioctl_ops,
1143 .tvnorms = V4L2_STD_ALL,
1129}; 1144};
1130 1145
1131static const struct v4l2_ctrl_ops hdpvr_ctrl_ops = { 1146static const struct v4l2_ctrl_ops hdpvr_ctrl_ops = {