[media] v4l2: replace try_mbus_fmt by set_fmt
[deliverable/linux.git] / drivers / media / i2c / soc_camera / ov6650.c
index 29f73a55a31244b712fa932cb3f9f29484efe213..1f8af1ee8352bf3efacd1a607d670bca7cdd0b2f 100644 (file)
@@ -685,16 +685,20 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
                mf->width = priv->rect.width >> half_scale;
                mf->height = priv->rect.height >> half_scale;
        }
-
        return ret;
 }
 
-static int ov6650_try_fmt(struct v4l2_subdev *sd,
-                         struct v4l2_mbus_framefmt *mf)
+static int ov6650_set_fmt(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_format *format)
 {
+       struct v4l2_mbus_framefmt *mf = &format->format;
        struct i2c_client *client = v4l2_get_subdevdata(sd);
        struct ov6650 *priv = to_ov6650(client);
 
+       if (format->pad)
+               return -EINVAL;
+
        if (is_unscaled_ok(mf->width, mf->height, &priv->rect))
                v4l_bound_align_image(&mf->width, 2, W_CIF, 1,
                                &mf->height, 2, H_CIF, 1, 0);
@@ -718,6 +722,10 @@ static int ov6650_try_fmt(struct v4l2_subdev *sd,
                break;
        }
 
+       if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
+               return ov6650_s_fmt(sd, mf);
+       cfg->try_fmt = *mf;
+
        return 0;
 }
 
@@ -935,8 +943,6 @@ static int ov6650_s_mbus_config(struct v4l2_subdev *sd,
 
 static struct v4l2_subdev_video_ops ov6650_video_ops = {
        .s_stream       = ov6650_s_stream,
-       .s_mbus_fmt     = ov6650_s_fmt,
-       .try_mbus_fmt   = ov6650_try_fmt,
        .cropcap        = ov6650_cropcap,
        .g_crop         = ov6650_g_crop,
        .s_crop         = ov6650_s_crop,
@@ -949,6 +955,7 @@ static struct v4l2_subdev_video_ops ov6650_video_ops = {
 static const struct v4l2_subdev_pad_ops ov6650_pad_ops = {
        .enum_mbus_code = ov6650_enum_mbus_code,
        .get_fmt        = ov6650_get_fmt,
+       .set_fmt        = ov6650_set_fmt,
 };
 
 static struct v4l2_subdev_ops ov6650_subdev_ops = {
This page took 0.121701 seconds and 5 git commands to generate.