media: tc358840: fix code for format update
Ken Chang [Thu, 31 Mar 2016 11:37:04 +0000 (19:37 +0800)]
mbus_fmt_code shall be update only for
V4L2_SUBDEV_FORMAT_ACTIVE.

Bug 200184254

Change-Id: I8ed3e81ff50fe663fc33ea2b6380ef6ce4c33e10
Signed-off-by: Ken Chang <kenc@nvidia.com>
(cherry picked from commit 53f3463519b9ea393fc6b482603926b5cd383117)
Reviewed-on: http://git-master/r/1118318
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/1141888
Reviewed-by: Jihoon Bang <jbang@nvidia.com>

drivers/media/i2c/tc358840.c

index a10116f..1f5b9de 100644 (file)
@@ -1517,7 +1517,6 @@ static int tc358840_set_fmt(struct v4l2_subdev *sd,
        switch (code) {
        case V4L2_MBUS_FMT_RGB888_1X24:
        case V4L2_MBUS_FMT_UYVY8_1X16:
-               state->mbus_fmt_code = code;
                break;
        default:
                return -EINVAL;
@@ -1529,6 +1528,7 @@ static int tc358840_set_fmt(struct v4l2_subdev *sd,
        v4l2_dbg(3, debug, sd, "%s(): format->which=%d\n",
                __func__, format->which);
 
+       state->mbus_fmt_code = format->format.code;
        enable_stream(sd, false);
        tc358840_set_csi(sd);
        tc358840_set_csi_mbus_config(sd);