diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2015-03-04 01:48:00 -0800 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-03-23 12:01:15 -0700 |
commit | 17bef885249db5db921ac8cf6e23938a91a6cd7b (patch) | |
tree | 23f58ecb46904cc3fbe4f5f4fbbe53a6dc4c9735 /drivers/media/platform/marvell-ccic | |
parent | d3e4bd8e10cd70d35a59854dcdcd7280c5ed240c (diff) |
[media] v4l2-subdev: add support for the new enum_frame_interval 'which' field
Support the new 'which' field in the enum_frame_interval ops. Most drivers do not
need to be changed since they always returns the same enumeration regardless
of the 'which' field.
Tested for ov7670 and marvell-ccic on a OLPC XO-1 laptop.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/platform/marvell-ccic')
-rw-r--r-- | drivers/media/platform/marvell-ccic/mcam-core.c | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/drivers/media/platform/marvell-ccic/mcam-core.c b/drivers/media/platform/marvell-ccic/mcam-core.c index dd5b1415f974..9c64b5d01c6a 100644 --- a/drivers/media/platform/marvell-ccic/mcam-core.c +++ b/drivers/media/platform/marvell-ccic/mcam-core.c @@ -1568,24 +1568,64 @@ static int mcam_vidioc_enum_framesizes(struct file *filp, void *priv, struct v4l2_frmsizeenum *sizes) { struct mcam_camera *cam = priv; + struct mcam_format_struct *f; + struct v4l2_subdev_frame_size_enum fse = { + .index = sizes->index, + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; int ret; + f = mcam_find_format(sizes->pixel_format); + if (f->pixelformat != sizes->pixel_format) + return -EINVAL; + fse.code = f->mbus_code; mutex_lock(&cam->s_mutex); - ret = sensor_call(cam, video, enum_framesizes, sizes); + ret = sensor_call(cam, pad, enum_frame_size, NULL, &fse); mutex_unlock(&cam->s_mutex); - return ret; + if (ret) + return ret; + if (fse.min_width == fse.max_width && + fse.min_height == fse.max_height) { + sizes->type = V4L2_FRMSIZE_TYPE_DISCRETE; + sizes->discrete.width = fse.min_width; + sizes->discrete.height = fse.min_height; + return 0; + } + sizes->type = V4L2_FRMSIZE_TYPE_CONTINUOUS; + sizes->stepwise.min_width = fse.min_width; + sizes->stepwise.max_width = fse.max_width; + sizes->stepwise.min_height = fse.min_height; + sizes->stepwise.max_height = fse.max_height; + sizes->stepwise.step_width = 1; + sizes->stepwise.step_height = 1; + return 0; } static int mcam_vidioc_enum_frameintervals(struct file *filp, void *priv, struct v4l2_frmivalenum *interval) { struct mcam_camera *cam = priv; + struct mcam_format_struct *f; + struct v4l2_subdev_frame_interval_enum fie = { + .index = interval->index, + .width = interval->width, + .height = interval->height, + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; int ret; + f = mcam_find_format(interval->pixel_format); + if (f->pixelformat != interval->pixel_format) + return -EINVAL; + fie.code = f->mbus_code; mutex_lock(&cam->s_mutex); - ret = sensor_call(cam, video, enum_frameintervals, interval); + ret = sensor_call(cam, pad, enum_frame_interval, NULL, &fie); mutex_unlock(&cam->s_mutex); - return ret; + if (ret) + return ret; + interval->type = V4L2_FRMIVAL_TYPE_DISCRETE; + interval->discrete = fie.interval; + return 0; } #ifdef CONFIG_VIDEO_ADV_DEBUG |