From: Hugues Fruchet Date: Wed, 4 Jul 2018 13:04:38 +0000 (-0400) Subject: media: ov5640: do not change mode if format or frame interval is unchanged X-Git-Tag: v5.15~8227^2~259 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6949d864776ef295ddc8f840d7d6a2dbe51bd9d1;p=platform%2Fkernel%2Flinux-starfive.git media: ov5640: do not change mode if format or frame interval is unchanged Save load of mode registers array when V4L2 client sets a format or a frame interval which selects the same mode than the current one. Signed-off-by: Hugues Fruchet Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c index 1ecbb7a..071f4bc 100644 --- a/drivers/media/i2c/ov5640.c +++ b/drivers/media/i2c/ov5640.c @@ -1966,9 +1966,11 @@ static int ov5640_set_fmt(struct v4l2_subdev *sd, goto out; } - sensor->current_mode = new_mode; - sensor->fmt = *mbus_fmt; - sensor->pending_mode_change = true; + if (new_mode != sensor->current_mode) { + sensor->current_mode = new_mode; + sensor->fmt = *mbus_fmt; + sensor->pending_mode_change = true; + } out: mutex_unlock(&sensor->lock); return ret; @@ -2508,8 +2510,10 @@ static int ov5640_s_frame_interval(struct v4l2_subdev *sd, goto out; } - sensor->current_mode = mode; - sensor->pending_mode_change = true; + if (mode != sensor->current_mode) { + sensor->current_mode = mode; + sensor->pending_mode_change = true; + } out: mutex_unlock(&sensor->lock); return ret;