atomisp : Add support from mt9m114 sensor driver to skip frames.
authorBian,Guowei <guowei.bian@intel.com>
Mon, 5 Dec 2011 10:36:02 +0000 (18:36 +0800)
committerbuildbot <buildbot@intel.com>
Tue, 17 Jan 2012 22:07:50 +0000 (14:07 -0800)
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 <guowei.bian@intel.com>
Reviewed-on: http://android.intel.com:8080/30245
Reviewed-by: Toivonen, Tuukka <tuukka.toivonen@intel.com>
Reviewed-by: Lampila, KalleX <kallex.lampila@intel.com>
Tested-by: Lampila, KalleX <kallex.lampila@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
drivers/media/video/mt9m114.c
drivers/media/video/mt9m114.h

index 42ab9b2..62b1cb8 100644 (file)
@@ -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 = {
index baca32d..547a293 100644 (file)
@@ -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))