Skip to content

Commit 6949d86

Browse files
hfruchet-stmchehab
authored andcommitted
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 <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent b5f6ec5 commit 6949d86

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

drivers/media/i2c/ov5640.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1966,9 +1966,11 @@ static int ov5640_set_fmt(struct v4l2_subdev *sd,
19661966
goto out;
19671967
}
19681968

1969-
sensor->current_mode = new_mode;
1970-
sensor->fmt = *mbus_fmt;
1971-
sensor->pending_mode_change = true;
1969+
if (new_mode != sensor->current_mode) {
1970+
sensor->current_mode = new_mode;
1971+
sensor->fmt = *mbus_fmt;
1972+
sensor->pending_mode_change = true;
1973+
}
19721974
out:
19731975
mutex_unlock(&sensor->lock);
19741976
return ret;
@@ -2508,8 +2510,10 @@ static int ov5640_s_frame_interval(struct v4l2_subdev *sd,
25082510
goto out;
25092511
}
25102512

2511-
sensor->current_mode = mode;
2512-
sensor->pending_mode_change = true;
2513+
if (mode != sensor->current_mode) {
2514+
sensor->current_mode = mode;
2515+
sensor->pending_mode_change = true;
2516+
}
25132517
out:
25142518
mutex_unlock(&sensor->lock);
25152519
return ret;

0 commit comments

Comments
 (0)