drivers: imx274: adding multiple sensor modes
Josh Kuo [Thu, 23 Jun 2016 05:52:39 +0000 (13:52 +0800)]
adding multiple sensor modes for imx274.

support 4k@60fps, 4k@30fps and 1080p@60fps

Bug 1769654

Change-Id: I1753d63e0c8adaafc59951de8c67b6314da24304
Signed-off-by: Josh Kuo <joshk@nvidia.com>
Reviewed-on: http://git-master/r/1170059
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bhanu Murthy V <bmurthyv@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Shiva Dubey <sdubey@nvidia.com>
Reviewed-by: Jihoon Bang <jbang@nvidia.com>

drivers/media/i2c/imx274.c
drivers/media/i2c/imx274_mode_tbls.h

index 81145fe..d750036 100644 (file)
@@ -47,7 +47,7 @@
 #define IMX274_DEFAULT_EXPOSURE_COARSE \
        (IMX274_DEFAULT_FRAME_LENGTH-IMX274_MAX_COARSE_DIFF)
 
-#define IMX274_DEFAULT_MODE    IMX274_MODE_3840X2160
+#define IMX274_DEFAULT_MODE    IMX274_MODE_3840X2160_60FPS
 
 #define IMX274_DEFAULT_WIDTH   3840
 #define IMX274_DEFAULT_HEIGHT  2160
@@ -440,7 +440,7 @@ static int imx274_s_stream(struct v4l2_subdev *sd, int enable)
 
        imx274_write_table(priv, mode_table[IMX274_MODE_STOP_STREAM]);
 
-       dev_dbg(&client->dev, "%s mode[%d]\n", __func__, s_data->mode);
+       dev_info(&client->dev, "%s mode[%d]\n", __func__, s_data->mode);
 
        err = imx274_write_table(priv, mode_table[s_data->mode]);
        if (err)
@@ -654,7 +654,9 @@ static int imx274_set_frame_length(struct imx274 *priv, s32 val)
        }
 
        dev_dbg(&priv->i2c_client->dev,
-               "%s: frame_rate: %d vmax: %u\n", __func__, frame_rate, vmax);
+               "%s: frame_rate: %d vmax: %u svr %d\n",
+                __func__, frame_rate, vmax, svr);
+
        return 0;
 
 fail:
index d0d9aae..416ae8d 100644 (file)
@@ -384,6 +384,7 @@ static imx274_reg mode_1280X720[] = {
 
 enum {
        IMX274_MODE_3840X2160,
+       IMX274_MODE_3840X2160_60FPS,
        IMX274_MODE_1920X1080,
        IMX274_MODE_1280X720,
        IMX274_MODE_START_STREAM,
@@ -392,7 +393,8 @@ enum {
 };
 
 static const imx274_reg *mode_table[] = {
-       [IMX274_MODE_3840X2160] = mode_3840X2160_60fps,
+       [IMX274_MODE_3840X2160] = mode_3840X2160,
+       [IMX274_MODE_3840X2160_60FPS] = mode_3840X2160_60fps,
        [IMX274_MODE_1920X1080] = mode_1920X1080,
        [IMX274_MODE_1280X720] = mode_1280X720,
 
@@ -401,14 +403,22 @@ static const imx274_reg *mode_table[] = {
        [IMX274_MODE_TEST_PATTERN]              = tp_colorbars,
 };
 
-static const int imx274_framerates[] = {
+static const int imx274_30_fr[] = {
        30,
+};
+
+static const int imx274_60_fr[] = {
+       60,
+};
+
+static const int imx274_mode_1920X1080_60_fr[] = {
        60,
 };
 
 static const struct camera_common_frmfmt imx274_frmfmt[] = {
-       {{3840, 2160},  imx274_framerates, 2, 0, IMX274_MODE_3840X2160},
-       {{1920, 1080},  imx274_framerates, 2, 0, IMX274_MODE_1920X1080},
-       {{1280, 720},   imx274_framerates, 2, 0, IMX274_MODE_1280X720},
+       {{3864, 2160},  imx274_60_fr, 1, 0, IMX274_MODE_3840X2160_60FPS},
+       {{3864, 2160},  imx274_30_fr, 1, 0, IMX274_MODE_3840X2160},
+       {{1932, 1080},  imx274_60_fr, 1, 0, IMX274_MODE_1920X1080},
+       {{1280, 720},   imx274_60_fr, 1, 0, IMX274_MODE_1280X720},
 };
 #endif  /* __IMX274_I2C_TABLES__ */