aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiu Ying <Ying.Liu@freescale.com>2014-07-03 02:57:04 -0400
committerLiu Ying <Ying.Liu@freescale.com>2014-07-03 09:25:16 -0400
commit9010f234160a387acc5477f054f89656fcdc1c7d (patch)
tree0323d7d1cc013cb2e9711e755fe2aecf216b3752
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)
-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 {
94 u16 raw_height; /*!< Raw height. */ 94 u16 raw_height; /*!< Raw height. */
95 u16 active_width; /*!< Active width. */ 95 u16 active_width; /*!< Active width. */
96 u16 active_height; /*!< Active height. */ 96 u16 active_height; /*!< Active height. */
97 int frame_rate; /*!< Frame rate. */
97} video_fmt_t; 98} video_fmt_t;
98 99
99/*! Description of video formats supported. 100/*! Description of video formats supported.
@@ -109,6 +110,7 @@ static video_fmt_t video_fmts[] = {
109 .raw_height = 525, /* SENS_FRM_HEIGHT */ 110 .raw_height = 525, /* SENS_FRM_HEIGHT */
110 .active_width = 720, /* ACT_FRM_WIDTH plus 1 */ 111 .active_width = 720, /* ACT_FRM_WIDTH plus 1 */
111 .active_height = 480, /* ACT_FRM_WIDTH plus 1 */ 112 .active_height = 480, /* ACT_FRM_WIDTH plus 1 */
113 .frame_rate = 30,
112 }, 114 },
113 { /*! (B, G, H, I, N) PAL */ 115 { /*! (B, G, H, I, N) PAL */
114 .v4l2_id = V4L2_STD_PAL, 116 .v4l2_id = V4L2_STD_PAL,
@@ -117,6 +119,7 @@ static video_fmt_t video_fmts[] = {
117 .raw_height = 625, 119 .raw_height = 625,
118 .active_width = 720, 120 .active_width = 720,
119 .active_height = 576, 121 .active_height = 576,
122 .frame_rate = 25,
120 }, 123 },
121 { /*! Unlocked standard */ 124 { /*! Unlocked standard */
122 .v4l2_id = V4L2_STD_ALL, 125 .v4l2_id = V4L2_STD_ALL,
@@ -125,6 +128,7 @@ static video_fmt_t video_fmts[] = {
125 .raw_height = 625, 128 .raw_height = 625,
126 .active_width = 720, 129 .active_width = 720,
127 .active_height = 576, 130 .active_height = 576,
131 .frame_rate = 0,
128 }, 132 },
129}; 133};
130 134
@@ -763,6 +767,37 @@ static int ioctl_enum_framesizes(struct v4l2_int_device *s,
763} 767}
764 768
765/*! 769/*!
770 * ioctl_enum_frameintervals - V4L2 sensor interface handler for
771 * VIDIOC_ENUM_FRAMEINTERVALS ioctl
772 * @s: pointer to standard V4L2 device structure
773 * @fival: standard V4L2 VIDIOC_ENUM_FRAMEINTERVALS ioctl structure
774 *
775 * Return 0 if successful, otherwise -EINVAL.
776 */
777static int ioctl_enum_frameintervals(struct v4l2_int_device *s,
778 struct v4l2_frmivalenum *fival)
779{
780 video_fmt_t fmt;
781 int i;
782
783 if (fival->index != 0)
784 return -EINVAL;
785
786 for (i = 0; i < ARRAY_SIZE(video_fmts) - 1; i++) {
787 fmt = video_fmts[i];
788 if (fival->width == fmt.active_width &&
789 fival->height == fmt.active_height) {
790 fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
791 fival->discrete.numerator = 1;
792 fival->discrete.denominator = fmt.frame_rate;
793 return 0;
794 }
795 }
796
797 return -EINVAL;
798}
799
800/*!
766 * ioctl_g_chip_ident - V4L2 sensor interface handler for 801 * ioctl_g_chip_ident - V4L2 sensor interface handler for
767 * VIDIOC_DBG_G_CHIP_IDENT ioctl 802 * VIDIOC_DBG_G_CHIP_IDENT ioctl
768 * @s: pointer to standard V4L2 device structure 803 * @s: pointer to standard V4L2 device structure
@@ -853,6 +888,8 @@ static struct v4l2_int_ioctl_desc adv7180_ioctl_desc[] = {
853 {vidioc_int_s_ctrl_num, (v4l2_int_ioctl_func*)ioctl_s_ctrl}, 888 {vidioc_int_s_ctrl_num, (v4l2_int_ioctl_func*)ioctl_s_ctrl},
854 {vidioc_int_enum_framesizes_num, 889 {vidioc_int_enum_framesizes_num,
855 (v4l2_int_ioctl_func *) ioctl_enum_framesizes}, 890 (v4l2_int_ioctl_func *) ioctl_enum_framesizes},
891 {vidioc_int_enum_frameintervals_num,
892 (v4l2_int_ioctl_func *) ioctl_enum_frameintervals},
856 {vidioc_int_g_chip_ident_num, 893 {vidioc_int_g_chip_ident_num,
857 (v4l2_int_ioctl_func *)ioctl_g_chip_ident}, 894 (v4l2_int_ioctl_func *)ioctl_g_chip_ident},
858}; 895};