[media] v4l2: replace try_mbus_fmt by set_fmt
[deliverable/linux.git] / drivers / media / i2c / saa6752hs.c
index b3829078d646f46721f4b42fe674c5383fbd3c1d..ba3c4156644d50d34d487b41d7d2d661d32ee06f 100644 (file)
@@ -574,10 +574,17 @@ static int saa6752hs_get_fmt(struct v4l2_subdev *sd,
        return 0;
 }
 
-static int saa6752hs_try_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *f)
+static int saa6752hs_set_fmt(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_format *format)
 {
+       struct v4l2_mbus_framefmt *f = &format->format;
+       struct saa6752hs_state *h = to_state(sd);
        int dist_352, dist_480, dist_720;
 
+       if (format->pad)
+               return -EINVAL;
+
        f->code = MEDIA_BUS_FMT_FIXED;
 
        dist_352 = abs(f->width - 352);
@@ -598,15 +605,11 @@ static int saa6752hs_try_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_frame
        }
        f->field = V4L2_FIELD_INTERLACED;
        f->colorspace = V4L2_COLORSPACE_SMPTE170M;
-       return 0;
-}
 
-static int saa6752hs_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *f)
-{
-       struct saa6752hs_state *h = to_state(sd);
-
-       if (f->code != MEDIA_BUS_FMT_FIXED)
-               return -EINVAL;
+       if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
+               cfg->try_fmt = *f;
+               return 0;
+       }
 
        /*
          FIXME: translate and round width/height into EMPRESS
@@ -620,7 +623,9 @@ static int saa6752hs_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefm
          D1     | 720x576 | 720x480
        */
 
-       saa6752hs_try_mbus_fmt(sd, f);
+       if (f->code != MEDIA_BUS_FMT_FIXED)
+               return -EINVAL;
+
        if (f->width == 720)
                h->video_format = SAA6752HS_VF_D1;
        else if (f->width == 480)
@@ -653,12 +658,11 @@ static const struct v4l2_subdev_core_ops saa6752hs_core_ops = {
 
 static const struct v4l2_subdev_video_ops saa6752hs_video_ops = {
        .s_std = saa6752hs_s_std,
-       .s_mbus_fmt = saa6752hs_s_mbus_fmt,
-       .try_mbus_fmt = saa6752hs_try_mbus_fmt,
 };
 
 static const struct v4l2_subdev_pad_ops saa6752hs_pad_ops = {
        .get_fmt = saa6752hs_get_fmt,
+       .set_fmt = saa6752hs_set_fmt,
 };
 
 static const struct v4l2_subdev_ops saa6752hs_ops = {
This page took 0.026773 seconds and 5 git commands to generate.