1 From 8e9c9047f05e165d158b3718528fc8bcdaf856e8 Mon Sep 17 00:00:00 2001
2 From: David Plowman <david.plowman@raspberrypi.com>
3 Date: Thu, 18 Feb 2021 11:58:29 +0000
4 Subject: [PATCH] media: i2c: imx290: Handle exposure correctly when
7 When vblank changes we must modify the exposure range. Also, with this
8 sensor, the effective exposure time implicitly changes when vblank
9 does, so we have to reset it after every vblank update.
11 Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
13 drivers/media/i2c/imx290.c | 18 ++++++++++++++++++
14 1 file changed, 18 insertions(+)
16 --- a/drivers/media/i2c/imx290.c
17 +++ b/drivers/media/i2c/imx290.c
18 @@ -618,6 +618,24 @@ static int imx290_set_vmax(struct imx290
20 dev_err(imx290->dev, "Unable to write vmax\n");
23 + * Changing vblank changes the allowed range for exposure.
24 + * We don't supply the current exposure as default here as it
25 + * may lie outside the new range. We will reset it just below.
27 + __v4l2_ctrl_modify_range(imx290->exposure,
28 + IMX290_EXPOSURE_MIN,
30 + IMX290_EXPOSURE_STEP,
34 + * Becuse of the way exposure works for this sensor, updating
35 + * vblank causes the effective exposure to change, so we must
36 + * set it back to the "new" correct value.
38 + imx290_set_exposure(imx290, imx290->exposure->val);