aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/usb
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2013-03-19 08:53:29 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-04-14 18:59:44 -0400
commit8f69da955873f5e33b60ff117856a2bf1309a336 (patch)
treeba4432b8948be8eaf417dfd9f8ae0d85313a5d22 /drivers/media/usb
parentc7a2c84af549572c454a8d79011c7fac72b3e53d (diff)
[media] hdpvr: add g/querystd, remove deprecated current_norm
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/usb')
-rw-r--r--drivers/media/usb/hdpvr/hdpvr-video.c62
-rw-r--r--drivers/media/usb/hdpvr/hdpvr.h5
2 files changed, 54 insertions, 13 deletions
diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpvr/hdpvr-video.c
index e14bf494f107..042f204972a4 100644
--- a/drivers/media/usb/hdpvr/hdpvr-video.c
+++ b/drivers/media/usb/hdpvr/hdpvr-video.c
@@ -550,12 +550,50 @@ static int vidioc_s_std(struct file *file, void *private_data,
550 struct hdpvr_device *dev = video_drvdata(file); 550 struct hdpvr_device *dev = video_drvdata(file);
551 u8 std_type = 1; 551 u8 std_type = 1;
552 552
553 if (std & (V4L2_STD_NTSC | V4L2_STD_PAL_60)) 553 if (dev->options.video_input == HDPVR_COMPONENT)
554 return -ENODATA;
555 if (dev->status != STATUS_IDLE)
556 return -EBUSY;
557 if (std & V4L2_STD_525_60)
554 std_type = 0; 558 std_type = 0;
559 dev->cur_std = std;
560 dev->width = 720;
561 dev->height = std_type ? 576 : 480;
555 562
556 return hdpvr_config_call(dev, CTRL_VIDEO_STD_TYPE, std_type); 563 return hdpvr_config_call(dev, CTRL_VIDEO_STD_TYPE, std_type);
557} 564}
558 565
566static int vidioc_g_std(struct file *file, void *private_data,
567 v4l2_std_id *std)
568{
569 struct hdpvr_device *dev = video_drvdata(file);
570
571 if (dev->options.video_input == HDPVR_COMPONENT)
572 return -ENODATA;
573 *std = dev->cur_std;
574 return 0;
575}
576
577static int vidioc_querystd(struct file *file, void *fh, v4l2_std_id *a)
578{
579 struct hdpvr_device *dev = video_drvdata(file);
580 struct hdpvr_video_info *vid_info;
581
582 if (dev->options.video_input == HDPVR_COMPONENT)
583 return -ENODATA;
584 *a = V4L2_STD_ALL;
585 vid_info = get_video_info(dev);
586 if (vid_info == NULL)
587 return 0;
588 if (vid_info->width == 720 &&
589 (vid_info->height == 480 || vid_info->height == 576)) {
590 *a = (vid_info->height == 480) ?
591 V4L2_STD_525_60 : V4L2_STD_625_50;
592 }
593 kfree(vid_info);
594 return 0;
595}
596
559static const char *iname[] = { 597static const char *iname[] = {
560 [HDPVR_COMPONENT] = "Component", 598 [HDPVR_COMPONENT] = "Component",
561 [HDPVR_SVIDEO] = "S-Video", 599 [HDPVR_SVIDEO] = "S-Video",
@@ -565,7 +603,6 @@ static const char *iname[] = {
565static int vidioc_enum_input(struct file *file, void *priv, 603static int vidioc_enum_input(struct file *file, void *priv,
566 struct v4l2_input *i) 604 struct v4l2_input *i)
567{ 605{
568 struct hdpvr_device *dev = video_drvdata(file);
569 unsigned int n; 606 unsigned int n;
570 607
571 n = i->index; 608 n = i->index;
@@ -579,7 +616,8 @@ static int vidioc_enum_input(struct file *file, void *priv,
579 616
580 i->audioset = 1<<HDPVR_RCA_FRONT | 1<<HDPVR_RCA_BACK | 1<<HDPVR_SPDIF; 617 i->audioset = 1<<HDPVR_RCA_FRONT | 1<<HDPVR_RCA_BACK | 1<<HDPVR_SPDIF;
581 618
582 i->std = dev->video_dev->tvnorms; 619 i->capabilities = n ? V4L2_IN_CAP_STD : V4L2_IN_CAP_DV_TIMINGS;
620 i->std = n ? V4L2_STD_ALL : 0;
583 621
584 return 0; 622 return 0;
585} 623}
@@ -597,8 +635,11 @@ static int vidioc_s_input(struct file *file, void *private_data,
597 return -EBUSY; 635 return -EBUSY;
598 636
599 retval = hdpvr_config_call(dev, CTRL_VIDEO_INPUT_VALUE, index+1); 637 retval = hdpvr_config_call(dev, CTRL_VIDEO_INPUT_VALUE, index+1);
600 if (!retval) 638 if (!retval) {
601 dev->options.video_input = index; 639 dev->options.video_input = index;
640 dev->video_dev->tvnorms =
641 index != HDPVR_COMPONENT ? V4L2_STD_ALL : 0;
642 }
602 643
603 return retval; 644 return retval;
604} 645}
@@ -776,7 +817,6 @@ static int hdpvr_s_ctrl(struct v4l2_ctrl *ctrl)
776static int vidioc_enum_fmt_vid_cap(struct file *file, void *private_data, 817static int vidioc_enum_fmt_vid_cap(struct file *file, void *private_data,
777 struct v4l2_fmtdesc *f) 818 struct v4l2_fmtdesc *f)
778{ 819{
779
780 if (f->index != 0) 820 if (f->index != 0)
781 return -EINVAL; 821 return -EINVAL;
782 822
@@ -874,6 +914,8 @@ static int vidioc_try_encoder_cmd(struct file *filp, void *priv,
874static const struct v4l2_ioctl_ops hdpvr_ioctl_ops = { 914static const struct v4l2_ioctl_ops hdpvr_ioctl_ops = {
875 .vidioc_querycap = vidioc_querycap, 915 .vidioc_querycap = vidioc_querycap,
876 .vidioc_s_std = vidioc_s_std, 916 .vidioc_s_std = vidioc_s_std,
917 .vidioc_g_std = vidioc_g_std,
918 .vidioc_querystd = vidioc_querystd,
877 .vidioc_enum_input = vidioc_enum_input, 919 .vidioc_enum_input = vidioc_enum_input,
878 .vidioc_g_input = vidioc_g_input, 920 .vidioc_g_input = vidioc_g_input,
879 .vidioc_s_input = vidioc_s_input, 921 .vidioc_s_input = vidioc_s_input,
@@ -916,13 +958,6 @@ static const struct video_device hdpvr_video_template = {
916 .fops = &hdpvr_fops, 958 .fops = &hdpvr_fops,
917 .release = hdpvr_device_release, 959 .release = hdpvr_device_release,
918 .ioctl_ops = &hdpvr_ioctl_ops, 960 .ioctl_ops = &hdpvr_ioctl_ops,
919 .tvnorms =
920 V4L2_STD_NTSC | V4L2_STD_SECAM | V4L2_STD_PAL_B |
921 V4L2_STD_PAL_G | V4L2_STD_PAL_H | V4L2_STD_PAL_I |
922 V4L2_STD_PAL_D | V4L2_STD_PAL_M | V4L2_STD_PAL_N |
923 V4L2_STD_PAL_60,
924 .current_norm = V4L2_STD_NTSC | V4L2_STD_PAL_M |
925 V4L2_STD_PAL_60,
926}; 961};
927 962
928static const struct v4l2_ctrl_ops hdpvr_ctrl_ops = { 963static const struct v4l2_ctrl_ops hdpvr_ctrl_ops = {
@@ -937,6 +972,9 @@ int hdpvr_register_videodev(struct hdpvr_device *dev, struct device *parent,
937 bool ac3 = dev->flags & HDPVR_FLAG_AC3_CAP; 972 bool ac3 = dev->flags & HDPVR_FLAG_AC3_CAP;
938 int res; 973 int res;
939 974
975 dev->cur_std = V4L2_STD_525_60;
976 dev->width = 720;
977 dev->height = 480;
940 v4l2_ctrl_handler_init(hdl, 11); 978 v4l2_ctrl_handler_init(hdl, 11);
941 if (dev->fw_ver > 0x15) { 979 if (dev->fw_ver > 0x15) {
942 v4l2_ctrl_new_std(hdl, &hdpvr_ctrl_ops, 980 v4l2_ctrl_new_std(hdl, &hdpvr_ctrl_ops,
diff --git a/drivers/media/usb/hdpvr/hdpvr.h b/drivers/media/usb/hdpvr/hdpvr.h
index 1c1298138f0d..050c6b9fec53 100644
--- a/drivers/media/usb/hdpvr/hdpvr.h
+++ b/drivers/media/usb/hdpvr/hdpvr.h
@@ -78,6 +78,8 @@ struct hdpvr_device {
78 struct v4l2_ctrl *video_bitrate; 78 struct v4l2_ctrl *video_bitrate;
79 struct v4l2_ctrl *video_bitrate_peak; 79 struct v4l2_ctrl *video_bitrate_peak;
80 }; 80 };
81 /* v4l2 format */
82 uint width, height;
81 83
82 /* the max packet size of the bulk endpoint */ 84 /* the max packet size of the bulk endpoint */
83 size_t bulk_in_size; 85 size_t bulk_in_size;
@@ -87,8 +89,9 @@ struct hdpvr_device {
87 /* holds the current device status */ 89 /* holds the current device status */
88 __u8 status; 90 __u8 status;
89 91
90 /* holds the cureent set options */ 92 /* holds the current set options */
91 struct hdpvr_options options; 93 struct hdpvr_options options;
94 v4l2_std_id cur_std;
92 95
93 uint flags; 96 uint flags;
94 97