aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorLiu Ying <Ying.Liu@freescale.com>2014-02-14 05:02:08 -0500
committerNitin Garg <nitin.garg@freescale.com>2014-04-16 09:57:32 -0400
commita4d412fc1e23d73f8d4124f332c22c5016492a7a (patch)
treef351f9b0a2c6d97d52354cf06bf18954c936d9e8 /drivers/media
parent172414645f1c2fd555414a7b5f1842dde5d92c00 (diff)
ENGR00299224 ov5640 mipi: support internal enum_frameintervals ioctrl
This patch adds internal v4l2 enum_frameintervals ioctrl support for the ov5640 mipi camera driver. Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/mxc/capture/ov5640_mipi.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/drivers/media/platform/mxc/capture/ov5640_mipi.c b/drivers/media/platform/mxc/capture/ov5640_mipi.c
index 79264bc63796..21b702f5782a 100644
--- a/drivers/media/platform/mxc/capture/ov5640_mipi.c
+++ b/drivers/media/platform/mxc/capture/ov5640_mipi.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2011-2013 Freescale Semiconductor, Inc. All Rights Reserved. 2 * Copyright (C) 2011-2014 Freescale Semiconductor, Inc. All Rights Reserved.
3 */ 3 */
4 4
5/* 5/*
@@ -70,6 +70,11 @@ enum ov5640_frame_rate {
70 ov5640_30_fps 70 ov5640_30_fps
71}; 71};
72 72
73static int ov5640_framerates[] = {
74 [ov5640_15_fps] = 15,
75 [ov5640_30_fps] = 30,
76};
77
73/* image size under 1280 * 960 are SUBSAMPLING 78/* image size under 1280 * 960 are SUBSAMPLING
74 * image size upper 1280 * 960 are SCALING 79 * image size upper 1280 * 960 are SCALING
75 */ 80 */
@@ -1770,6 +1775,37 @@ static int ioctl_enum_framesizes(struct v4l2_int_device *s,
1770} 1775}
1771 1776
1772/*! 1777/*!
1778 * ioctl_enum_frameintervals - V4L2 sensor interface handler for
1779 * VIDIOC_ENUM_FRAMEINTERVALS ioctl
1780 * @s: pointer to standard V4L2 device structure
1781 * @fival: standard V4L2 VIDIOC_ENUM_FRAMEINTERVALS ioctl structure
1782 *
1783 * Return 0 if successful, otherwise -EINVAL.
1784 */
1785static int ioctl_enum_frameintervals(struct v4l2_int_device *s,
1786 struct v4l2_frmivalenum *fival)
1787{
1788 int i, j, count = 0;
1789
1790 fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
1791 fival->discrete.numerator = 1;
1792
1793 for (i = 0; i < ARRAY_SIZE(ov5640_mode_info_data); i++)
1794 for (j = 0; j < (ov5640_mode_MAX + 1); j++)
1795 if (fival->pixel_format == ov5640_data.pix.pixelformat
1796 && fival->width == ov5640_mode_info_data[i][j].width
1797 && fival->height == ov5640_mode_info_data[i][j].height
1798 && ov5640_mode_info_data[i][j].init_data_ptr != NULL
1799 && fival->index == count++) {
1800 fival->discrete.denominator =
1801 ov5640_framerates[i];
1802 return 0;
1803 }
1804
1805 return -EINVAL;
1806}
1807
1808/*!
1773 * ioctl_g_chip_ident - V4L2 sensor interface handler for 1809 * ioctl_g_chip_ident - V4L2 sensor interface handler for
1774 * VIDIOC_DBG_G_CHIP_IDENT ioctl 1810 * VIDIOC_DBG_G_CHIP_IDENT ioctl
1775 * @s: pointer to standard V4L2 device structure 1811 * @s: pointer to standard V4L2 device structure
@@ -1913,6 +1949,8 @@ static struct v4l2_int_ioctl_desc ov5640_ioctl_desc[] = {
1913 {vidioc_int_s_ctrl_num, (v4l2_int_ioctl_func *) ioctl_s_ctrl}, 1949 {vidioc_int_s_ctrl_num, (v4l2_int_ioctl_func *) ioctl_s_ctrl},
1914 {vidioc_int_enum_framesizes_num, 1950 {vidioc_int_enum_framesizes_num,
1915 (v4l2_int_ioctl_func *) ioctl_enum_framesizes}, 1951 (v4l2_int_ioctl_func *) ioctl_enum_framesizes},
1952 {vidioc_int_enum_frameintervals_num,
1953 (v4l2_int_ioctl_func *) ioctl_enum_frameintervals},
1916 {vidioc_int_g_chip_ident_num, 1954 {vidioc_int_g_chip_ident_num,
1917 (v4l2_int_ioctl_func *) ioctl_g_chip_ident}, 1955 (v4l2_int_ioctl_func *) ioctl_g_chip_ident},
1918}; 1956};