From 8df719a2242a08bc032691f8fdbd4958aeaf3de4 Mon Sep 17 00:00:00 2001 From: "Bian,Guowei" Date: Mon, 5 Dec 2011 18:36:02 +0800 Subject: [PATCH] atomisp : Add support from mt9m114 sensor driver to skip frames. BZ:8545 This patch will support number of frames to skip at stream start from mt9m114 sensor driver. Change-Id: I7e724f19f51f9cb482a048d2af0da24df94d31ee Signed-off-by: Bian,Guowei Reviewed-on: http://android.intel.com:8080/30245 Reviewed-by: Toivonen, Tuukka Reviewed-by: Lampila, KalleX Tested-by: Lampila, KalleX Reviewed-by: buildbot Tested-by: buildbot --- drivers/media/video/mt9m114.c | 25 +++++++++++++++++++++++++ drivers/media/video/mt9m114.h | 8 +++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/mt9m114.c b/drivers/media/video/mt9m114.c index 42ab9b2..62b1cb8 100644 --- a/drivers/media/video/mt9m114.c +++ b/drivers/media/video/mt9m114.c @@ -1299,6 +1299,26 @@ mt9m114_set_pad_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, return 0; } +static int mt9m114_g_skip_frames(struct v4l2_subdev *sd, u32 *frames) +{ + int index; + struct mt9m114_device *snr = to_mt9m114_sensor(sd); + + if (frames == NULL) + return -EINVAL; + + for (index = 0; index < N_RES; index++) { + if (mt9m114_res[index].res == snr->res) + break; + } + + if (index >= N_RES) + return -EINVAL; + + *frames = mt9m114_res[index].skip_frames; + + return 0; +} static const struct v4l2_subdev_video_ops mt9m114_video_ops = { .try_mbus_fmt = mt9m114_try_mbus_fmt, .s_mbus_fmt = mt9m114_set_mbus_fmt, @@ -1308,6 +1328,10 @@ static const struct v4l2_subdev_video_ops mt9m114_video_ops = { .enum_frameintervals = mt9m114_enum_frameintervals, }; +static struct v4l2_subdev_sensor_ops mt9m114_sensor_ops = { + .g_skip_frames = mt9m114_g_skip_frames, +}; + static const struct v4l2_subdev_core_ops mt9m114_core_ops = { .g_chip_ident = mt9m114_g_chip_ident, .queryctrl = mt9m114_queryctrl, @@ -1328,6 +1352,7 @@ static const struct v4l2_subdev_ops mt9m114_ops = { .core = &mt9m114_core_ops, .video = &mt9m114_video_ops, .pad = &mt9m114_pad_ops, + .sensor = &mt9m114_sensor_ops, }; static const struct media_entity_operations mt9m114_entity_ops = { diff --git a/drivers/media/video/mt9m114.h b/drivers/media/video/mt9m114.h index baca32d..547a293 100644 --- a/drivers/media/video/mt9m114.h +++ b/drivers/media/video/mt9m114.h @@ -210,7 +210,6 @@ struct mt9m114_device { struct v4l2_mbus_framefmt format; struct camera_sensor_platform_data *platform_data; - int fmt_idx; int real_model_id; int nctx; int power; @@ -266,6 +265,7 @@ struct mt9m114_res_struct { int width; int height; int fps; + int skip_frames; bool used; struct regval_list *regs; }; @@ -300,6 +300,7 @@ static struct mt9m114_res_struct mt9m114_res[] = { .fps = 30, .used = 0, .regs = NULL, + .skip_frames = 1, }, { .desc = "QVGA", @@ -309,6 +310,7 @@ static struct mt9m114_res_struct mt9m114_res[] = { .fps = 30, .used = 0, .regs = NULL, + .skip_frames = 1, }, { .desc = "VGA", @@ -318,6 +320,7 @@ static struct mt9m114_res_struct mt9m114_res[] = { .fps = 30, .used = 0, .regs = NULL, + .skip_frames = 1, }, { .desc = "480p", @@ -327,6 +330,7 @@ static struct mt9m114_res_struct mt9m114_res[] = { .fps = 30, .used = 0, .regs = NULL, + .skip_frames = 1, }, { .desc = "720p", @@ -336,6 +340,7 @@ static struct mt9m114_res_struct mt9m114_res[] = { .fps = 30, .used = 0, .regs = NULL, + .skip_frames = 1, }, { .desc = "960P", @@ -345,6 +350,7 @@ static struct mt9m114_res_struct mt9m114_res[] = { .fps = 15, .used = 0, .regs = NULL, + .skip_frames = 1, }, }; #define N_RES (ARRAY_SIZE(mt9m114_res)) -- 2.7.4