aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/marvell-ccic
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2015-03-04 04:48:00 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-03-23 15:01:15 -0400
commit17bef885249db5db921ac8cf6e23938a91a6cd7b (patch)
tree23f58ecb46904cc3fbe4f5f4fbbe53a6dc4c9735 /drivers/media/platform/marvell-ccic
parentd3e4bd8e10cd70d35a59854dcdcd7280c5ed240c (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.c48
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,
1568 struct v4l2_frmsizeenum *sizes) 1568 struct v4l2_frmsizeenum *sizes)
1569{ 1569{
1570 struct mcam_camera *cam = priv; 1570 struct mcam_camera *cam = priv;
1571 struct mcam_format_struct *f;
1572 struct v4l2_subdev_frame_size_enum fse = {
1573 .index = sizes->index,
1574 .which = V4L2_SUBDEV_FORMAT_ACTIVE,
1575 };
1571 int ret; 1576 int ret;
1572 1577
1578 f = mcam_find_format(sizes->pixel_format);
1579 if (f->pixelformat != sizes->pixel_format)
1580 return -EINVAL;
1581 fse.code = f->mbus_code;
1573 mutex_lock(&cam->s_mutex); 1582 mutex_lock(&cam->s_mutex);
1574 ret = sensor_call(cam, video, enum_framesizes, sizes); 1583 ret = sensor_call(cam, pad, enum_frame_size, NULL, &fse);
1575 mutex_unlock(&cam->s_mutex); 1584 mutex_unlock(&cam->s_mutex);
1576 return ret; 1585 if (ret)
1586 return ret;
1587 if (fse.min_width == fse.max_width &&
1588 fse.min_height == fse.max_height) {
1589 sizes->type = V4L2_FRMSIZE_TYPE_DISCRETE;
1590 sizes->discrete.width = fse.min_width;
1591 sizes->discrete.height = fse.min_height;
1592 return 0;
1593 }
1594 sizes->type = V4L2_FRMSIZE_TYPE_CONTINUOUS;
1595 sizes->stepwise.min_width = fse.min_width;
1596 sizes->stepwise.max_width = fse.max_width;
1597 sizes->stepwise.min_height = fse.min_height;
1598 sizes->stepwise.max_height = fse.max_height;
1599 sizes->stepwise.step_width = 1;
1600 sizes->stepwise.step_height = 1;
1601 return 0;
1577} 1602}
1578 1603
1579static int mcam_vidioc_enum_frameintervals(struct file *filp, void *priv, 1604static int mcam_vidioc_enum_frameintervals(struct file *filp, void *priv,
1580 struct v4l2_frmivalenum *interval) 1605 struct v4l2_frmivalenum *interval)
1581{ 1606{
1582 struct mcam_camera *cam = priv; 1607 struct mcam_camera *cam = priv;
1608 struct mcam_format_struct *f;
1609 struct v4l2_subdev_frame_interval_enum fie = {
1610 .index = interval->index,
1611 .width = interval->width,
1612 .height = interval->height,
1613 .which = V4L2_SUBDEV_FORMAT_ACTIVE,
1614 };
1583 int ret; 1615 int ret;
1584 1616
1617 f = mcam_find_format(interval->pixel_format);
1618 if (f->pixelformat != interval->pixel_format)
1619 return -EINVAL;
1620 fie.code = f->mbus_code;
1585 mutex_lock(&cam->s_mutex); 1621 mutex_lock(&cam->s_mutex);
1586 ret = sensor_call(cam, video, enum_frameintervals, interval); 1622 ret = sensor_call(cam, pad, enum_frame_interval, NULL, &fie);
1587 mutex_unlock(&cam->s_mutex); 1623 mutex_unlock(&cam->s_mutex);
1588 return ret; 1624 if (ret)
1625 return ret;
1626 interval->type = V4L2_FRMIVAL_TYPE_DISCRETE;
1627 interval->discrete = fie.interval;
1628 return 0;
1589} 1629}
1590 1630
1591#ifdef CONFIG_VIDEO_ADV_DEBUG 1631#ifdef CONFIG_VIDEO_ADV_DEBUG