The current logic only requires to call ov5640_set_mode, which will in turn
change the clock rates according to the mode and frame interval, when a new
mode is set up.

However, when only the frame interval is changed but the mode isn't,
ov5640_set_mode is never called and the resulting frame rate will be old or
default one. Fix this by requiring that ov5640_set_mode is called when the
frame interval is changed as well.

Signed-off-by: Maxime Ripard <maxime.rip...@bootlin.com>
---
 drivers/media/i2c/ov5640.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
index 818411400ef6..e01d2cb93c67 100644
--- a/drivers/media/i2c/ov5640.c
+++ b/drivers/media/i2c/ov5640.c
@@ -2638,8 +2638,12 @@ static int ov5640_s_frame_interval(struct v4l2_subdev 
*sd,
                goto out;
        }
 
-       sensor->current_fr = frame_rate;
-       sensor->frame_interval = fi->interval;
+       if (frame_rate != sensor->current_fr) {
+               sensor->current_fr = frame_rate;
+               sensor->frame_interval = fi->interval;
+               sensor->pending_mode_change = true;
+       }
+
        mode = ov5640_find_mode(sensor, frame_rate, mode->hact,
                                mode->vact, true);
        if (!mode) {
-- 
2.19.1

Reply via email to