media: i2c: imx219: Fix crop rectangle setting when changing format
When moving the imx219 driver to the subdev active state, commite8a5b1df00
("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:e8a5b1df00
("media: i2c: imx219: Use subdev active state") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
parent
5cb218ffc5
commit
bb2d01127f
|
@ -750,6 +750,7 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
|
|||
const struct imx219_mode *mode;
|
||||
int exposure_max, exposure_def, hblank;
|
||||
struct v4l2_mbus_framefmt *format;
|
||||
struct v4l2_rect *crop;
|
||||
|
||||
mode = v4l2_find_nearest_size(supported_modes,
|
||||
ARRAY_SIZE(supported_modes),
|
||||
|
@ -757,11 +758,16 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
|
|||
fmt->format.width, fmt->format.height);
|
||||
|
||||
imx219_update_pad_format(imx219, mode, &fmt->format, fmt->format.code);
|
||||
|
||||
format = v4l2_subdev_get_pad_format(sd, sd_state, 0);
|
||||
crop = v4l2_subdev_get_pad_crop(sd, sd_state, 0);
|
||||
|
||||
if (imx219->mode == mode && format->code == fmt->format.code)
|
||||
return 0;
|
||||
|
||||
*format = fmt->format;
|
||||
*crop = mode->crop;
|
||||
|
||||
if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
|
||||
imx219->mode = mode;
|
||||
/* Update limits and set FPS to default */
|
||||
|
@ -788,8 +794,6 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
|
|||
hblank);
|
||||
}
|
||||
|
||||
*format = fmt->format;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue