bdcf9005b5192f799d5d4131492472e71df5b953
[openwrt/staging/chunkeey.git] / target / linux / bcm27xx / patches-5.10 / 950-0289-media-i2c-imx290-Explicitly-set-v-h-blank-on-mode-ch.patch
1 From f7ff6542ad9cdee4a1e67a0243f7dcc93cceb08a 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 mode
5 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,