summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLiu Ying <Ying.Liu@freescale.com>2014-07-03 14:57:04 +0800
committerLiu Ying <Ying.Liu@freescale.com>2014-07-03 21:25:16 +0800
commit9010f234160a387acc5477f054f89656fcdc1c7d (patch)
tree0323d7d1cc013cb2e9711e755fe2aecf216b3752 /drivers
parent0d83d7e87d8d16a097c3c8bec6fa6ac25da225be (diff)
ENGR00321119 media: mxc: ADV7180: Support internal vidioc enum frame intervals
This patch adds internal vidioc enum frame intervals support so that the user space may know the frame rate ADV7180 generates. Signed-off-by: Liu Ying <Ying.Liu@freescale.com> (cherry picked from commit 7de57c22a1a9ddd06166ffdb4d319fc5c1f6feb7)
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/platform/mxc/capture/adv7180.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/media/platform/mxc/capture/adv7180.c b/drivers/media/platform/mxc/capture/adv7180.c
index 3e3b5454e92e..e359e81ebb5d 100644
--- a/drivers/media/platform/mxc/capture/adv7180.c
+++ b/drivers/media/platform/mxc/capture/adv7180.c
@@ -94,6 +94,7 @@ typedef struct {
u16 raw_height; /*!< Raw height. */
u16 active_width; /*!< Active width. */
u16 active_height; /*!< Active height. */
+ int frame_rate; /*!< Frame rate. */
} video_fmt_t;
/*! Description of video formats supported.
@@ -109,6 +110,7 @@ static video_fmt_t video_fmts[] = {
.raw_height = 525, /* SENS_FRM_HEIGHT */
.active_width = 720, /* ACT_FRM_WIDTH plus 1 */
.active_height = 480, /* ACT_FRM_WIDTH plus 1 */
+ .frame_rate = 30,
},
{ /*! (B, G, H, I, N) PAL */
.v4l2_id = V4L2_STD_PAL,
@@ -117,6 +119,7 @@ static video_fmt_t video_fmts[] = {
.raw_height = 625,
.active_width = 720,
.active_height = 576,
+ .frame_rate = 25,
},
{ /*! Unlocked standard */
.v4l2_id = V4L2_STD_ALL,
@@ -125,6 +128,7 @@ static video_fmt_t video_fmts[] = {
.raw_height = 625,
.active_width = 720,
.active_height = 576,
+ .frame_rate = 0,
},
};
@@ -763,6 +767,37 @@ static int ioctl_enum_framesizes(struct v4l2_int_device *s,
}
/*!
+ * ioctl_enum_frameintervals - V4L2 sensor interface handler for
+ * VIDIOC_ENUM_FRAMEINTERVALS ioctl
+ * @s: pointer to standard V4L2 device structure
+ * @fival: standard V4L2 VIDIOC_ENUM_FRAMEINTERVALS ioctl structure
+ *
+ * Return 0 if successful, otherwise -EINVAL.
+ */
+static int ioctl_enum_frameintervals(struct v4l2_int_device *s,
+ struct v4l2_frmivalenum *fival)
+{
+ video_fmt_t fmt;
+ int i;
+
+ if (fival->index != 0)
+ return -EINVAL;
+
+ for (i = 0; i < ARRAY_SIZE(video_fmts) - 1; i++) {
+ fmt = video_fmts[i];
+ if (fival->width == fmt.active_width &&
+ fival->height == fmt.active_height) {
+ fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
+ fival->discrete.numerator = 1;
+ fival->discrete.denominator = fmt.frame_rate;
+ return 0;
+ }
+ }
+
+ return -EINVAL;
+}
+
+/*!
* ioctl_g_chip_ident - V4L2 sensor interface handler for
* VIDIOC_DBG_G_CHIP_IDENT ioctl
* @s: pointer to standard V4L2 device structure
@@ -853,6 +888,8 @@ static struct v4l2_int_ioctl_desc adv7180_ioctl_desc[] = {
{vidioc_int_s_ctrl_num, (v4l2_int_ioctl_func*)ioctl_s_ctrl},
{vidioc_int_enum_framesizes_num,
(v4l2_int_ioctl_func *) ioctl_enum_framesizes},
+ {vidioc_int_enum_frameintervals_num,
+ (v4l2_int_ioctl_func *) ioctl_enum_frameintervals},
{vidioc_int_g_chip_ident_num,
(v4l2_int_ioctl_func *)ioctl_g_chip_ident},
};