@@ -710,36 +710,20 @@ static int ov02c10_set_format(struct v4l2_subdev *sd,
fmt->format.height);
ov02c10_update_pad_format(mode, &fmt->format);
- if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
- *v4l2_subdev_state_get_format(sd_state, fmt->pad) = fmt->format;
- } else {
- ov02c10->cur_mode = mode;
-
- /* Update limits and set FPS to default */
- vblank_def = mode->vts_min * ov02c10->mipi_lanes - mode->height;
- __v4l2_ctrl_modify_range(ov02c10->vblank,
- mode->vts_min - mode->height,
- OV02C10_VTS_MAX - mode->height, 1,
- vblank_def);
- __v4l2_ctrl_s_ctrl(ov02c10->vblank, vblank_def);
- h_blank = mode->hts - mode->width;
- __v4l2_ctrl_modify_range(ov02c10->hblank, h_blank, h_blank, 1,
- h_blank);
- }
-
- return 0;
-}
-
-static int ov02c10_get_format(struct v4l2_subdev *sd,
- struct v4l2_subdev_state *sd_state,
- struct v4l2_subdev_format *fmt)
-{
- struct ov02c10 *ov02c10 = to_ov02c10(sd);
+ *v4l2_subdev_state_get_format(sd_state, fmt->pad) = fmt->format;
if (fmt->which == V4L2_SUBDEV_FORMAT_TRY)
- fmt->format = *v4l2_subdev_state_get_format(sd_state, fmt->pad);
- else
- ov02c10_update_pad_format(ov02c10->cur_mode, &fmt->format);
+ return 0;
+
+ ov02c10->cur_mode = mode;
+
+ /* Update limits and set FPS to default */
+ vblank_def = mode->vts_min * ov02c10->mipi_lanes - mode->height;
+ __v4l2_ctrl_modify_range(ov02c10->vblank, mode->vts_min - mode->height,
+ OV02C10_VTS_MAX - mode->height, 1, vblank_def);
+ __v4l2_ctrl_s_ctrl(ov02c10->vblank, vblank_def);
+ h_blank = mode->hts - mode->width;
+ __v4l2_ctrl_modify_range(ov02c10->hblank, h_blank, h_blank, 1, h_blank);
return 0;
}
@@ -789,7 +773,7 @@ static const struct v4l2_subdev_video_ops ov02c10_video_ops = {
static const struct v4l2_subdev_pad_ops ov02c10_pad_ops = {
.set_fmt = ov02c10_set_format,
- .get_fmt = ov02c10_get_format,
+ .get_fmt = v4l2_subdev_get_fmt,
.enum_mbus_code = ov02c10_enum_mbus_code,
.enum_frame_size = ov02c10_enum_frame_size,
.enable_streams = ov02c10_enable_streams,
Store current-mode format in active-state format on non try set_format() calls and use v4l2_subdev_get_fmt() as v4l2_subdev_pad_ops.get_fmt(). Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- drivers/media/i2c/ov02c10.c | 42 ++++++++++++------------------------- 1 file changed, 13 insertions(+), 29 deletions(-)