aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pwc/pwc-v4l.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2012-01-08 05:19:29 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-01-16 08:06:37 -0500
commit54d3fb3b11a7c38b112585e54b7af7cb3faa5c91 (patch)
tree5b44bf3d283d8ab52b08c43d0df5afcd8f4c2c5a /drivers/media/video/pwc/pwc-v4l.c
parent61bb725ef5a646d3fc8a64e41b020a65542cdae1 (diff)
[media] pwc: Make fps runtime configurable through s_parm, drop fps module param
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/pwc/pwc-v4l.c')
-rw-r--r--drivers/media/video/pwc/pwc-v4l.c61
1 files changed, 60 insertions, 1 deletions
diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c
index 80e25842e84a..ef422d0ac599 100644
--- a/drivers/media/video/pwc/pwc-v4l.c
+++ b/drivers/media/video/pwc/pwc-v4l.c
@@ -493,7 +493,7 @@ static int pwc_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f)
493 (pixelformat>>24)&255); 493 (pixelformat>>24)&255);
494 494
495 ret = pwc_set_video_mode(pdev, f->fmt.pix.width, f->fmt.pix.height, 495 ret = pwc_set_video_mode(pdev, f->fmt.pix.width, f->fmt.pix.height,
496 pdev->vframes, &compression); 496 30, &compression);
497 497
498 PWC_DEBUG_IOCTL("pwc_set_video_mode(), return=%d\n", ret); 498 PWC_DEBUG_IOCTL("pwc_set_video_mode(), return=%d\n", ret);
499 499
@@ -1094,6 +1094,63 @@ static int pwc_enum_frameintervals(struct file *file, void *fh,
1094 return 0; 1094 return 0;
1095} 1095}
1096 1096
1097static int pwc_g_parm(struct file *file, void *fh,
1098 struct v4l2_streamparm *parm)
1099{
1100 struct pwc_device *pdev = video_drvdata(file);
1101
1102 if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
1103 return -EINVAL;
1104
1105 memset(parm, 0, sizeof(*parm));
1106
1107 parm->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
1108 parm->parm.capture.readbuffers = MIN_FRAMES;
1109 parm->parm.capture.capability |= V4L2_CAP_TIMEPERFRAME;
1110 parm->parm.capture.timeperframe.denominator = pdev->vframes;
1111 parm->parm.capture.timeperframe.numerator = 1;
1112
1113 return 0;
1114}
1115
1116static int pwc_s_parm(struct file *file, void *fh,
1117 struct v4l2_streamparm *parm)
1118{
1119 struct pwc_device *pdev = video_drvdata(file);
1120 int compression = 0;
1121 int ret, fps;
1122
1123 if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE ||
1124 parm->parm.capture.timeperframe.numerator == 0)
1125 return -EINVAL;
1126
1127 if (pwc_test_n_set_capt_file(pdev, file))
1128 return -EBUSY;
1129
1130 fps = parm->parm.capture.timeperframe.denominator /
1131 parm->parm.capture.timeperframe.numerator;
1132
1133 mutex_lock(&pdev->udevlock);
1134 if (!pdev->udev) {
1135 ret = -ENODEV;
1136 goto leave;
1137 }
1138
1139 if (pdev->iso_init) {
1140 ret = -EBUSY;
1141 goto leave;
1142 }
1143
1144 ret = pwc_set_video_mode(pdev, pdev->width, pdev->height, fps,
1145 &compression);
1146
1147 pwc_g_parm(file, fh, parm);
1148
1149leave:
1150 mutex_unlock(&pdev->udevlock);
1151 return ret;
1152}
1153
1097static int pwc_log_status(struct file *file, void *priv) 1154static int pwc_log_status(struct file *file, void *priv)
1098{ 1155{
1099 struct pwc_device *pdev = video_drvdata(file); 1156 struct pwc_device *pdev = video_drvdata(file);
@@ -1120,4 +1177,6 @@ const struct v4l2_ioctl_ops pwc_ioctl_ops = {
1120 .vidioc_log_status = pwc_log_status, 1177 .vidioc_log_status = pwc_log_status,
1121 .vidioc_enum_framesizes = pwc_enum_framesizes, 1178 .vidioc_enum_framesizes = pwc_enum_framesizes,
1122 .vidioc_enum_frameintervals = pwc_enum_frameintervals, 1179 .vidioc_enum_frameintervals = pwc_enum_frameintervals,
1180 .vidioc_g_parm = pwc_g_parm,
1181 .vidioc_s_parm = pwc_s_parm,
1123}; 1182};