diff options
Diffstat (limited to 'drivers/media/video/pwc/pwc-v4l.c')
-rw-r--r-- | drivers/media/video/pwc/pwc-v4l.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c index d5e6bc850643..e20251d05bf6 100644 --- a/drivers/media/video/pwc/pwc-v4l.c +++ b/drivers/media/video/pwc/pwc-v4l.c | |||
@@ -1193,6 +1193,64 @@ int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1193 | return 0; | 1193 | return 0; |
1194 | } | 1194 | } |
1195 | 1195 | ||
1196 | case VIDIOC_ENUM_FRAMESIZES: | ||
1197 | { | ||
1198 | struct v4l2_frmsizeenum *fsize = arg; | ||
1199 | unsigned int i = 0, index = fsize->index; | ||
1200 | |||
1201 | if (fsize->pixel_format == V4L2_PIX_FMT_YUV420) { | ||
1202 | for (i = 0; i < PSZ_MAX; i++) { | ||
1203 | if (pdev->image_mask & (1UL << i)) { | ||
1204 | if (!index--) { | ||
1205 | fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE; | ||
1206 | fsize->discrete.width = pwc_image_sizes[i].x; | ||
1207 | fsize->discrete.height = pwc_image_sizes[i].y; | ||
1208 | return 0; | ||
1209 | } | ||
1210 | } | ||
1211 | } | ||
1212 | } else if (fsize->index == 0 && | ||
1213 | ((fsize->pixel_format == V4L2_PIX_FMT_PWC1 && DEVICE_USE_CODEC1(pdev->type)) || | ||
1214 | (fsize->pixel_format == V4L2_PIX_FMT_PWC2 && DEVICE_USE_CODEC23(pdev->type)))) { | ||
1215 | |||
1216 | fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE; | ||
1217 | fsize->discrete.width = pdev->abs_max.x; | ||
1218 | fsize->discrete.height = pdev->abs_max.y; | ||
1219 | return 0; | ||
1220 | } | ||
1221 | return -EINVAL; | ||
1222 | } | ||
1223 | |||
1224 | case VIDIOC_ENUM_FRAMEINTERVALS: | ||
1225 | { | ||
1226 | struct v4l2_frmivalenum *fival = arg; | ||
1227 | int size = -1; | ||
1228 | unsigned int i; | ||
1229 | |||
1230 | for (i = 0; i < PSZ_MAX; i++) { | ||
1231 | if (pwc_image_sizes[i].x == fival->width && | ||
1232 | pwc_image_sizes[i].y == fival->height) { | ||
1233 | size = i; | ||
1234 | break; | ||
1235 | } | ||
1236 | } | ||
1237 | |||
1238 | /* TODO: Support raw format */ | ||
1239 | if (size < 0 || fival->pixel_format != V4L2_PIX_FMT_YUV420) { | ||
1240 | return -EINVAL; | ||
1241 | } | ||
1242 | |||
1243 | i = pwc_get_fps(pdev, fival->index, size); | ||
1244 | if (!i) | ||
1245 | return -EINVAL; | ||
1246 | |||
1247 | fival->type = V4L2_FRMIVAL_TYPE_DISCRETE; | ||
1248 | fival->discrete.numerator = 1; | ||
1249 | fival->discrete.denominator = i; | ||
1250 | |||
1251 | return 0; | ||
1252 | } | ||
1253 | |||
1196 | default: | 1254 | default: |
1197 | return pwc_ioctl(pdev, cmd, arg); | 1255 | return pwc_ioctl(pdev, cmd, arg); |
1198 | } /* ..switch */ | 1256 | } /* ..switch */ |