751f46db352245d919ae5ef905cbd1173f57a7cc
[openwrt/openwrt.git] /
1 From 0a47c61cee411b3ada4413f6cebae8cdb06f062e Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Tue, 7 Jul 2020 10:31:53 +0100
4 Subject: [PATCH] media: i2c: imx290: Explicitly set v&h blank on
5 mode change
6
7 __v4l2_ctrl_modify_range only updates the current value should
8 it be invalid within the new range. That can leave modes producing
9 odd frame rates.
10
11 Explicitly update the HBLANK and VBLANK values so that on mode
12 change we revert to the default frame rate for the mode.
13
14 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
15 ---
16 drivers/media/i2c/imx290.c | 10 ++++++++--
17 1 file changed, 8 insertions(+), 2 deletions(-)
18
19 --- a/drivers/media/i2c/imx290.c
20 +++ b/drivers/media/i2c/imx290.c
21 @@ -796,17 +796,23 @@ static int imx290_set_fmt(struct v4l2_su
22 __v4l2_ctrl_s_ctrl_int64(imx290->pixel_rate,
23 imx290_calc_pixel_rate(imx290));
24
25 - if (imx290->hblank)
26 + if (imx290->hblank) {
27 __v4l2_ctrl_modify_range(imx290->hblank,
28 imx290->hmax_min - mode->width,
29 IMX290_HMAX_MAX - mode->width,
30 1, mode->hmax - mode->width);
31 - if (imx290->vblank)
32 + __v4l2_ctrl_s_ctrl(imx290->hblank,
33 + mode->hmax - mode->width);
34 + }
35 + if (imx290->vblank) {
36 __v4l2_ctrl_modify_range(imx290->vblank,
37 mode->vmax - mode->height,
38 IMX290_VMAX_MAX - mode->height,
39 1,
40 mode->vmax - mode->height);
41 + __v4l2_ctrl_s_ctrl(imx290->vblank,
42 + mode->vmax - mode->height);
43 + }
44 if (imx290->exposure)
45 __v4l2_ctrl_modify_range(imx290->exposure,
46 mode->vmax - mode->height,