1 From f77451147a60ac62a6cdbd06b14e7b292fff80d6 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
7 __v4l2_ctrl_modify_range only updates the current value should
8 it be invalid within the new range. That can leave modes producing
11 Explicitly update the HBLANK and VBLANK values so that on mode
12 change we revert to the default frame rate for the mode.
14 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
16 drivers/media/i2c/imx290.c | 10 ++++++++--
17 1 file changed, 8 insertions(+), 2 deletions(-)
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));
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);
32 + __v4l2_ctrl_s_ctrl(imx290->hblank,
33 + mode->hmax - mode->width);
35 + if (imx290->vblank) {
36 __v4l2_ctrl_modify_range(imx290->vblank,
37 mode->vmax - mode->height,
38 IMX290_VMAX_MAX - mode->height,
40 mode->vmax - mode->height);
41 + __v4l2_ctrl_s_ctrl(imx290->vblank,
42 + mode->vmax - mode->height);
45 __v4l2_ctrl_modify_range(imx290->exposure,
46 mode->vmax - mode->height,