media: ov5640: fix framerate update
authorHugues Fruchet <hugues.fruchet@st.com>
Thu, 4 Oct 2018 11:21:57 +0000 (07:21 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Fri, 5 Oct 2018 15:04:39 +0000 (11:04 -0400)
Changing framerate right before streamon had no effect,
the new framerate value was taken into account only at
next streamon, fix this.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/i2c/ov5640.c

index 73a4bd7c0291ba8c7c4740367b5f0c7f02f66e56..eaefdb58653b700bb639adc6b26a44e0f5fd514c 100644 (file)
@@ -2573,8 +2573,6 @@ static int ov5640_s_frame_interval(struct v4l2_subdev *sd,
        if (frame_rate < 0)
                frame_rate = OV5640_15_FPS;
 
-       sensor->current_fr = frame_rate;
-       sensor->frame_interval = fi->interval;
        mode = ov5640_find_mode(sensor, frame_rate, mode->hact,
                                mode->vact, true);
        if (!mode) {
@@ -2582,7 +2580,10 @@ static int ov5640_s_frame_interval(struct v4l2_subdev *sd,
                goto out;
        }
 
-       if (mode != sensor->current_mode) {
+       if (mode != sensor->current_mode ||
+           frame_rate != sensor->current_fr) {
+               sensor->current_fr = frame_rate;
+               sensor->frame_interval = fi->interval;
                sensor->current_mode = mode;
                sensor->pending_mode_change = true;
        }