]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: imx335: Set vblank immediately
authorPaul Elder <paul.elder@ideasonboard.com>
Fri, 28 Feb 2025 09:17:31 +0000 (18:17 +0900)
committerHans Verkuil <hverkuil@xs4all.nl>
Tue, 4 Mar 2025 12:35:32 +0000 (13:35 +0100)
When the vblank v4l2 control is set, it does not get written to the
hardware unless exposure is also changed. Change the behavior such that
the vblank is written immediately when the control is set, as setting
the vblank without changing the exposure is a valid use case (such as
for changing the frame rate).

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
drivers/media/i2c/imx335.c

index fcfd1d851bd4aac1c71df2d6eead3f5901e27c29..0beb80b8c4581548fdc64a4822a7298c9ee524b4 100644 (file)
@@ -559,12 +559,14 @@ static int imx335_set_ctrl(struct v4l2_ctrl *ctrl)
                        imx335->vblank,
                        imx335->vblank + imx335->cur_mode->height);
 
-               return __v4l2_ctrl_modify_range(imx335->exp_ctrl,
-                                               IMX335_EXPOSURE_MIN,
-                                               imx335->vblank +
-                                               imx335->cur_mode->height -
-                                               IMX335_EXPOSURE_OFFSET,
-                                               1, IMX335_EXPOSURE_DEFAULT);
+               ret = __v4l2_ctrl_modify_range(imx335->exp_ctrl,
+                                              IMX335_EXPOSURE_MIN,
+                                              imx335->vblank +
+                                              imx335->cur_mode->height -
+                                              IMX335_EXPOSURE_OFFSET,
+                                              1, IMX335_EXPOSURE_DEFAULT);
+               if (ret)
+                       return ret;
        }
 
        /*
@@ -575,6 +577,13 @@ static int imx335_set_ctrl(struct v4l2_ctrl *ctrl)
                return 0;
 
        switch (ctrl->id) {
+       case V4L2_CID_VBLANK:
+               exposure = imx335->exp_ctrl->val;
+               analog_gain = imx335->again_ctrl->val;
+
+               ret = imx335_update_exp_gain(imx335, exposure, analog_gain);
+
+               break;
        case V4L2_CID_EXPOSURE:
                exposure = ctrl->val;
                analog_gain = imx335->again_ctrl->val;