diff --git a/drivers/media/i2c/imx290.c b/drivers/media/i2c/imx290.c index 43e2f294a53b0ce52be046d43c8e54fd317e3660..255f669853068bc91ab99f6a6d15c34852b5a184 100644 --- a/drivers/media/i2c/imx290.c +++ b/drivers/media/i2c/imx290.c @@ -618,6 +618,24 @@ static int imx290_set_vmax(struct imx290 *imx290, u32 val) if (ret) dev_err(imx290->dev, "Unable to write vmax\n"); + /* + * Changing vblank changes the allowed range for exposure. + * We don't supply the current exposure as default here as it + * may lie outside the new range. We will reset it just below. + */ + __v4l2_ctrl_modify_range(imx290->exposure, + IMX290_EXPOSURE_MIN, + vmax - 2, + IMX290_EXPOSURE_STEP, + vmax - 2); + + /* + * Becuse of the way exposure works for this sensor, updating + * vblank causes the effective exposure to change, so we must + * set it back to the "new" correct value. + */ + imx290_set_exposure(imx290, imx290->exposure->val); + return ret; }