diff options
-rw-r--r-- | drivers/media/video/v4l2-subdev.c | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/drivers/media/video/v4l2-subdev.c b/drivers/media/video/v4l2-subdev.c index 7d225389bfb1..268d80584101 100644 --- a/drivers/media/video/v4l2-subdev.c +++ b/drivers/media/video/v4l2-subdev.c | |||
@@ -228,6 +228,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
228 | 228 | ||
229 | case VIDIOC_SUBDEV_G_CROP: { | 229 | case VIDIOC_SUBDEV_G_CROP: { |
230 | struct v4l2_subdev_crop *crop = arg; | 230 | struct v4l2_subdev_crop *crop = arg; |
231 | struct v4l2_subdev_selection sel; | ||
232 | int rval; | ||
231 | 233 | ||
232 | if (crop->which != V4L2_SUBDEV_FORMAT_TRY && | 234 | if (crop->which != V4L2_SUBDEV_FORMAT_TRY && |
233 | crop->which != V4L2_SUBDEV_FORMAT_ACTIVE) | 235 | crop->which != V4L2_SUBDEV_FORMAT_ACTIVE) |
@@ -236,11 +238,27 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
236 | if (crop->pad >= sd->entity.num_pads) | 238 | if (crop->pad >= sd->entity.num_pads) |
237 | return -EINVAL; | 239 | return -EINVAL; |
238 | 240 | ||
239 | return v4l2_subdev_call(sd, pad, get_crop, subdev_fh, crop); | 241 | rval = v4l2_subdev_call(sd, pad, get_crop, subdev_fh, crop); |
242 | if (rval != -ENOIOCTLCMD) | ||
243 | return rval; | ||
244 | |||
245 | memset(&sel, 0, sizeof(sel)); | ||
246 | sel.which = crop->which; | ||
247 | sel.pad = crop->pad; | ||
248 | sel.target = V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL; | ||
249 | |||
250 | rval = v4l2_subdev_call( | ||
251 | sd, pad, get_selection, subdev_fh, &sel); | ||
252 | |||
253 | crop->rect = sel.r; | ||
254 | |||
255 | return rval; | ||
240 | } | 256 | } |
241 | 257 | ||
242 | case VIDIOC_SUBDEV_S_CROP: { | 258 | case VIDIOC_SUBDEV_S_CROP: { |
243 | struct v4l2_subdev_crop *crop = arg; | 259 | struct v4l2_subdev_crop *crop = arg; |
260 | struct v4l2_subdev_selection sel; | ||
261 | int rval; | ||
244 | 262 | ||
245 | if (crop->which != V4L2_SUBDEV_FORMAT_TRY && | 263 | if (crop->which != V4L2_SUBDEV_FORMAT_TRY && |
246 | crop->which != V4L2_SUBDEV_FORMAT_ACTIVE) | 264 | crop->which != V4L2_SUBDEV_FORMAT_ACTIVE) |
@@ -249,7 +267,22 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
249 | if (crop->pad >= sd->entity.num_pads) | 267 | if (crop->pad >= sd->entity.num_pads) |
250 | return -EINVAL; | 268 | return -EINVAL; |
251 | 269 | ||
252 | return v4l2_subdev_call(sd, pad, set_crop, subdev_fh, crop); | 270 | rval = v4l2_subdev_call(sd, pad, set_crop, subdev_fh, crop); |
271 | if (rval != -ENOIOCTLCMD) | ||
272 | return rval; | ||
273 | |||
274 | memset(&sel, 0, sizeof(sel)); | ||
275 | sel.which = crop->which; | ||
276 | sel.pad = crop->pad; | ||
277 | sel.target = V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL; | ||
278 | sel.r = crop->rect; | ||
279 | |||
280 | rval = v4l2_subdev_call( | ||
281 | sd, pad, set_selection, subdev_fh, &sel); | ||
282 | |||
283 | crop->rect = sel.r; | ||
284 | |||
285 | return rval; | ||
253 | } | 286 | } |
254 | 287 | ||
255 | case VIDIOC_SUBDEV_ENUM_MBUS_CODE: { | 288 | case VIDIOC_SUBDEV_ENUM_MBUS_CODE: { |