aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/usb/em28xx/em28xx-video.c
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2012-09-07 06:31:54 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-01-04 21:56:38 -0500
commitd8c95c08ef1127c8777dc3a1177143cf8a5b86ef (patch)
treec7662ea2c8b0ba33a970c7f56f9c3209097c2aa8 /drivers/media/usb/em28xx/em28xx-video.c
parent7f529794847bc2ff509967e5ad54fce7d885de93 (diff)
[media] em28xx: std fixes: don't implement in webcam mode, and fix std changes
When in webcam mode the STD API shouldn't be implemented. When changing the standard the resolution wasn't updated, and there was no check against streaming-in-progress. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/usb/em28xx/em28xx-video.c')
-rw-r--r--drivers/media/usb/em28xx/em28xx-video.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
index a91a2484bc98..7000e22e11a8 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -909,6 +909,8 @@ static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *norm)
909 struct em28xx *dev = fh->dev; 909 struct em28xx *dev = fh->dev;
910 int rc; 910 int rc;
911 911
912 if (dev->board.is_webcam)
913 return -ENOTTY;
912 rc = check_dev(dev); 914 rc = check_dev(dev);
913 if (rc < 0) 915 if (rc < 0)
914 return rc; 916 return rc;
@@ -924,6 +926,8 @@ static int vidioc_querystd(struct file *file, void *priv, v4l2_std_id *norm)
924 struct em28xx *dev = fh->dev; 926 struct em28xx *dev = fh->dev;
925 int rc; 927 int rc;
926 928
929 if (dev->board.is_webcam)
930 return -ENOTTY;
927 rc = check_dev(dev); 931 rc = check_dev(dev);
928 if (rc < 0) 932 if (rc < 0)
929 return rc; 933 return rc;
@@ -940,15 +944,24 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm)
940 struct v4l2_format f; 944 struct v4l2_format f;
941 int rc; 945 int rc;
942 946
947 if (dev->board.is_webcam)
948 return -ENOTTY;
949 if (*norm == dev->norm)
950 return 0;
943 rc = check_dev(dev); 951 rc = check_dev(dev);
944 if (rc < 0) 952 if (rc < 0)
945 return rc; 953 return rc;
946 954
955 if (videobuf_queue_is_busy(&fh->vb_vidq)) {
956 em28xx_errdev("%s queue busy\n", __func__);
957 return -EBUSY;
958 }
959
947 dev->norm = *norm; 960 dev->norm = *norm;
948 961
949 /* Adjusts width/height, if needed */ 962 /* Adjusts width/height, if needed */
950 f.fmt.pix.width = dev->width; 963 f.fmt.pix.width = 720;
951 f.fmt.pix.height = dev->height; 964 f.fmt.pix.height = (*norm & V4L2_STD_525_60) ? 480 : 576;
952 vidioc_try_fmt_vid_cap(file, priv, &f); 965 vidioc_try_fmt_vid_cap(file, priv, &f);
953 966
954 /* set new image size */ 967 /* set new image size */
@@ -1034,6 +1047,9 @@ static int vidioc_enum_input(struct file *file, void *priv,
1034 i->type = V4L2_INPUT_TYPE_TUNER; 1047 i->type = V4L2_INPUT_TYPE_TUNER;
1035 1048
1036 i->std = dev->vdev->tvnorms; 1049 i->std = dev->vdev->tvnorms;
1050 /* webcams do not have the STD API */
1051 if (dev->board.is_webcam)
1052 i->capabilities = 0;
1037 1053
1038 return 0; 1054 return 0;
1039} 1055}
@@ -2059,7 +2075,6 @@ static const struct video_device em28xx_video_template = {
2059 .ioctl_ops = &video_ioctl_ops, 2075 .ioctl_ops = &video_ioctl_ops,
2060 2076
2061 .tvnorms = V4L2_STD_ALL, 2077 .tvnorms = V4L2_STD_ALL,
2062 .current_norm = V4L2_STD_PAL,
2063}; 2078};
2064 2079
2065static const struct v4l2_file_operations radio_fops = { 2080static const struct v4l2_file_operations radio_fops = {
@@ -2109,6 +2124,8 @@ static struct video_device *em28xx_vdev_init(struct em28xx *dev,
2109 vfd->debug = video_debug; 2124 vfd->debug = video_debug;
2110 vfd->lock = &dev->lock; 2125 vfd->lock = &dev->lock;
2111 set_bit(V4L2_FL_USE_FH_PRIO, &vfd->flags); 2126 set_bit(V4L2_FL_USE_FH_PRIO, &vfd->flags);
2127 if (dev->board.is_webcam)
2128 vfd->tvnorms = 0;
2112 2129
2113 snprintf(vfd->name, sizeof(vfd->name), "%s %s", 2130 snprintf(vfd->name, sizeof(vfd->name), "%s %s",
2114 dev->name, type_name); 2131 dev->name, type_name);
@@ -2127,7 +2144,7 @@ int em28xx_register_analog_devices(struct em28xx *dev)
2127 dev->name, EM28XX_VERSION); 2144 dev->name, EM28XX_VERSION);
2128 2145
2129 /* set default norm */ 2146 /* set default norm */
2130 dev->norm = em28xx_video_template.current_norm; 2147 dev->norm = V4L2_STD_PAL;
2131 v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_std, dev->norm); 2148 v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_std, dev->norm);
2132 dev->interlaced = EM28XX_INTERLACED_DEFAULT; 2149 dev->interlaced = EM28XX_INTERLACED_DEFAULT;
2133 2150