Skip to content

Commit bb2d011

Browse files
pinchartlHans Verkuil
authored andcommitted
media: i2c: imx219: Fix crop rectangle setting when changing format
When moving the imx219 driver to the subdev active state, commit e8a5b1d ("media: i2c: imx219: Use subdev active state") used the pad crop rectangle stored in the subdev state to report the crop rectangle of the active mode. That crop rectangle was however not set in the state when setting the format, which resulted in reporting an incorrect crop rectangle to userspace. Fix it. Fixes: e8a5b1d ("media: i2c: imx219: Use subdev active state") Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
1 parent 5cb218f commit bb2d011

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/media/i2c/imx219.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,18 +750,24 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
750750
const struct imx219_mode *mode;
751751
int exposure_max, exposure_def, hblank;
752752
struct v4l2_mbus_framefmt *format;
753+
struct v4l2_rect *crop;
753754

754755
mode = v4l2_find_nearest_size(supported_modes,
755756
ARRAY_SIZE(supported_modes),
756757
width, height,
757758
fmt->format.width, fmt->format.height);
758759

759760
imx219_update_pad_format(imx219, mode, &fmt->format, fmt->format.code);
761+
760762
format = v4l2_subdev_get_pad_format(sd, sd_state, 0);
763+
crop = v4l2_subdev_get_pad_crop(sd, sd_state, 0);
761764

762765
if (imx219->mode == mode && format->code == fmt->format.code)
763766
return 0;
764767

768+
*format = fmt->format;
769+
*crop = mode->crop;
770+
765771
if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
766772
imx219->mode = mode;
767773
/* Update limits and set FPS to default */
@@ -788,8 +794,6 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
788794
hblank);
789795
}
790796

791-
*format = fmt->format;
792-
793797
return 0;
794798
}
795799

0 commit comments

Comments
 (0)