[media] v4l2: replace try_mbus_fmt by set_fmt in bridge drivers
authorHans Verkuil <hans.verkuil@cisco.com>
Thu, 9 Apr 2015 07:05:35 +0000 (04:05 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Fri, 1 May 2015 11:59:28 +0000 (08:59 -0300)
Replace all calls to try_mbus_fmt in bridge drivers by calls to the
set_fmt pad op.

[mchehab@osg.samsung.com: fix a merge conflict at mcam-core.c]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Scott Jiang <scott.jiang.linux@gmail.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/pci/saa7134/saa7134-empress.c
drivers/media/platform/blackfin/bfin_capture.c
drivers/media/platform/marvell-ccic/mcam-core.c
drivers/media/platform/soc_camera/atmel-isi.c
drivers/media/platform/soc_camera/mx2_camera.c
drivers/media/platform/soc_camera/mx3_camera.c
drivers/media/platform/soc_camera/omap1_camera.c
drivers/media/platform/soc_camera/pxa_camera.c
drivers/media/platform/soc_camera/rcar_vin.c
drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c
drivers/media/platform/via-camera.c

index 22632f9e34e6c2f82c54d13677bdd5b8079c3902..dc14930be909426cbe4139a532735c8de21de51b 100644 (file)
@@ -157,11 +157,14 @@ static int empress_try_fmt_vid_cap(struct file *file, void *priv,
                                struct v4l2_format *f)
 {
        struct saa7134_dev *dev = video_drvdata(file);
-       struct v4l2_mbus_framefmt mbus_fmt;
+       struct v4l2_subdev_pad_config pad_cfg;
+       struct v4l2_subdev_format format = {
+               .which = V4L2_SUBDEV_FORMAT_TRY,
+       };
 
-       v4l2_fill_mbus_format(&mbus_fmt, &f->fmt.pix, MEDIA_BUS_FMT_FIXED);
-       saa_call_all(dev, video, try_mbus_fmt, &mbus_fmt);
-       v4l2_fill_pix_format(&f->fmt.pix, &mbus_fmt);
+       v4l2_fill_mbus_format(&format.format, &f->fmt.pix, MEDIA_BUS_FMT_FIXED);
+       saa_call_all(dev, pad, set_fmt, &pad_cfg, &format);
+       v4l2_fill_pix_format(&f->fmt.pix, &format.format);
 
        f->fmt.pix.pixelformat  = V4L2_PIX_FMT_MPEG;
        f->fmt.pix.sizeimage    = TS_PACKET_SIZE * dev->ts.nr_packets;
index 6ea11b1e755e60905d4214cb99e48a4f962df5b1..aa50eba623c390d3a8bc75cc0d65ff0d4a1fdc4e 100644 (file)
@@ -602,7 +602,10 @@ static int bcap_try_format(struct bcap_device *bcap,
 {
        struct bcap_format *sf = bcap->sensor_formats;
        struct bcap_format *fmt = NULL;
-       struct v4l2_mbus_framefmt mbus_fmt;
+       struct v4l2_subdev_pad_config pad_cfg;
+       struct v4l2_subdev_format format = {
+               .which = V4L2_SUBDEV_FORMAT_TRY,
+       };
        int ret, i;
 
        for (i = 0; i < bcap->num_sensor_formats; i++) {
@@ -613,16 +616,16 @@ static int bcap_try_format(struct bcap_device *bcap,
        if (i == bcap->num_sensor_formats)
                fmt = &sf[0];
 
-       v4l2_fill_mbus_format(&mbus_fmt, pixfmt, fmt->mbus_code);
-       ret = v4l2_subdev_call(bcap->sd, video,
-                               try_mbus_fmt, &mbus_fmt);
+       v4l2_fill_mbus_format(&format.format, pixfmt, fmt->mbus_code);
+       ret = v4l2_subdev_call(bcap->sd, pad, set_fmt, &pad_cfg,
+                               &format);
        if (ret < 0)
                return ret;
-       v4l2_fill_pix_format(pixfmt, &mbus_fmt);
+       v4l2_fill_pix_format(pixfmt, &format.format);
        if (bcap_fmt) {
                for (i = 0; i < bcap->num_sensor_formats; i++) {
                        fmt = &sf[i];
-                       if (mbus_fmt.code == fmt->mbus_code)
+                       if (format.format.code == fmt->mbus_code)
                                break;
                }
                *bcap_fmt = *fmt;
index 42f63974592ca8ce33409ad45f50640559c37a98..c2ebc12917a71fd48a14eae49c258e701764c861 100644 (file)
@@ -1351,14 +1351,17 @@ static int mcam_vidioc_try_fmt_vid_cap(struct file *filp, void *priv,
        struct mcam_camera *cam = video_drvdata(filp);
        struct mcam_format_struct *f;
        struct v4l2_pix_format *pix = &fmt->fmt.pix;
-       struct v4l2_mbus_framefmt mbus_fmt;
+       struct v4l2_subdev_pad_config pad_cfg;
+       struct v4l2_subdev_format format = {
+               .which = V4L2_SUBDEV_FORMAT_TRY,
+       };
        int ret;
 
        f = mcam_find_format(pix->pixelformat);
        pix->pixelformat = f->pixelformat;
-       v4l2_fill_mbus_format(&mbus_fmt, pix, f->mbus_code);
-       ret = sensor_call(cam, video, try_mbus_fmt, &mbus_fmt);
-       v4l2_fill_pix_format(pix, &mbus_fmt);
+       v4l2_fill_mbus_format(&format.format, pix, f->mbus_code);
+       ret = sensor_call(cam, pad, set_fmt, &pad_cfg, &format);
+       v4l2_fill_pix_format(pix, &format.format);
        pix->bytesperline = pix->width * f->bpp;
        switch (f->pixelformat) {
        case V4L2_PIX_FMT_YUV420:
index cbb7e22cab40c7176bb06dea4c62b13aaf008577..903dbf27d0e07bfcbf366a5cf2f0496bd2b41894 100644 (file)
@@ -535,7 +535,11 @@ static int isi_camera_try_fmt(struct soc_camera_device *icd,
        struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
        const struct soc_camera_format_xlate *xlate;
        struct v4l2_pix_format *pix = &f->fmt.pix;
-       struct v4l2_mbus_framefmt mf;
+       struct v4l2_subdev_pad_config pad_cfg;
+       struct v4l2_subdev_format format = {
+               .which = V4L2_SUBDEV_FORMAT_TRY,
+       };
+       struct v4l2_mbus_framefmt *mf = &format.format;
        u32 pixfmt = pix->pixelformat;
        int ret;
 
@@ -552,21 +556,21 @@ static int isi_camera_try_fmt(struct soc_camera_device *icd,
                pix->width = MAX_SUPPORT_WIDTH;
 
        /* limit to sensor capabilities */
-       mf.width        = pix->width;
-       mf.height       = pix->height;
-       mf.field        = pix->field;
-       mf.colorspace   = pix->colorspace;
-       mf.code         = xlate->code;
+       mf->width       = pix->width;
+       mf->height      = pix->height;
+       mf->field       = pix->field;
+       mf->colorspace  = pix->colorspace;
+       mf->code        = xlate->code;
 
-       ret = v4l2_subdev_call(sd, video, try_mbus_fmt, &mf);
+       ret = v4l2_subdev_call(sd, pad, set_fmt, &pad_cfg, &format);
        if (ret < 0)
                return ret;
 
-       pix->width      = mf.width;
-       pix->height     = mf.height;
-       pix->colorspace = mf.colorspace;
+       pix->width      = mf->width;
+       pix->height     = mf->height;
+       pix->colorspace = mf->colorspace;
 
-       switch (mf.field) {
+       switch (mf->field) {
        case V4L2_FIELD_ANY:
                pix->field = V4L2_FIELD_NONE;
                break;
@@ -574,7 +578,7 @@ static int isi_camera_try_fmt(struct soc_camera_device *icd,
                break;
        default:
                dev_err(icd->parent, "Field type %d unsupported.\n",
-                       mf.field);
+                       mf->field);
                ret = -EINVAL;
        }
 
index a1b426458719730ba844597178da16c36a1d6921..d45f50a3a9ebfad89d56c9efee8495a815fd1836 100644 (file)
@@ -1187,7 +1187,11 @@ static int mx2_camera_try_fmt(struct soc_camera_device *icd,
        struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
        const struct soc_camera_format_xlate *xlate;
        struct v4l2_pix_format *pix = &f->fmt.pix;
-       struct v4l2_mbus_framefmt mf;
+       struct v4l2_subdev_pad_config pad_cfg;
+       struct v4l2_subdev_format format = {
+               .which = V4L2_SUBDEV_FORMAT_TRY,
+       };
+       struct v4l2_mbus_framefmt *mf = &format.format;
        __u32 pixfmt = pix->pixelformat;
        struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
        struct mx2_camera_dev *pcdev = ici->priv;
@@ -1210,13 +1214,13 @@ static int mx2_camera_try_fmt(struct soc_camera_device *icd,
        pix->width &= ~0x7;
 
        /* limit to sensor capabilities */
-       mf.width        = pix->width;
-       mf.height       = pix->height;
-       mf.field        = pix->field;
-       mf.colorspace   = pix->colorspace;
-       mf.code         = xlate->code;
+       mf->width       = pix->width;
+       mf->height      = pix->height;
+       mf->field       = pix->field;
+       mf->colorspace  = pix->colorspace;
+       mf->code        = xlate->code;
 
-       ret = v4l2_subdev_call(sd, video, try_mbus_fmt, &mf);
+       ret = v4l2_subdev_call(sd, pad, set_fmt, &pad_cfg, &format);
        if (ret < 0)
                return ret;
 
@@ -1227,29 +1231,29 @@ static int mx2_camera_try_fmt(struct soc_camera_device *icd,
        emma_prp = mx27_emma_prp_get_format(xlate->code,
                                            xlate->host_fmt->fourcc);
 
-       if ((mf.width != pix->width || mf.height != pix->height) &&
+       if ((mf->width != pix->width || mf->height != pix->height) &&
                emma_prp->cfg.in_fmt == PRP_CNTL_DATA_IN_YUV422) {
-               if (mx2_emmaprp_resize(pcdev, &mf, pix, false) < 0)
+               if (mx2_emmaprp_resize(pcdev, mf, pix, false) < 0)
                        dev_dbg(icd->parent, "%s: can't resize\n", __func__);
        }
 
-       if (mf.field == V4L2_FIELD_ANY)
-               mf.field = V4L2_FIELD_NONE;
+       if (mf->field == V4L2_FIELD_ANY)
+               mf->field = V4L2_FIELD_NONE;
        /*
         * Driver supports interlaced images provided they have
         * both fields so that they can be processed as if they
         * were progressive.
         */
-       if (mf.field != V4L2_FIELD_NONE && !V4L2_FIELD_HAS_BOTH(mf.field)) {
+       if (mf->field != V4L2_FIELD_NONE && !V4L2_FIELD_HAS_BOTH(mf->field)) {
                dev_err(icd->parent, "Field type %d unsupported.\n",
-                               mf.field);
+                               mf->field);
                return -EINVAL;
        }
 
-       pix->width      = mf.width;
-       pix->height     = mf.height;
-       pix->field      = mf.field;
-       pix->colorspace = mf.colorspace;
+       pix->width      = mf->width;
+       pix->height     = mf->height;
+       pix->field      = mf->field;
+       pix->colorspace = mf->colorspace;
 
        dev_dbg(icd->parent, "%s: returned params: width = %d, height = %d\n",
                __func__, pix->width, pix->height);
index 6c34dbb878b21ae6f4adabab7b4c35dea9aa7c2d..f63501771072a72b15511bf6b5c26251af51ea7a 100644 (file)
@@ -912,7 +912,11 @@ static int mx3_camera_try_fmt(struct soc_camera_device *icd,
        struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
        const struct soc_camera_format_xlate *xlate;
        struct v4l2_pix_format *pix = &f->fmt.pix;
-       struct v4l2_mbus_framefmt mf;
+       struct v4l2_subdev_pad_config pad_cfg;
+       struct v4l2_subdev_format format = {
+               .which = V4L2_SUBDEV_FORMAT_TRY,
+       };
+       struct v4l2_mbus_framefmt *mf = &format.format;
        __u32 pixfmt = pix->pixelformat;
        int ret;
 
@@ -929,21 +933,21 @@ static int mx3_camera_try_fmt(struct soc_camera_device *icd,
                pix->width = 4096;
 
        /* limit to sensor capabilities */
-       mf.width        = pix->width;
-       mf.height       = pix->height;
-       mf.field        = pix->field;
-       mf.colorspace   = pix->colorspace;
-       mf.code         = xlate->code;
+       mf->width       = pix->width;
+       mf->height      = pix->height;
+       mf->field       = pix->field;
+       mf->colorspace  = pix->colorspace;
+       mf->code        = xlate->code;
 
-       ret = v4l2_subdev_call(sd, video, try_mbus_fmt, &mf);
+       ret = v4l2_subdev_call(sd, pad, set_fmt, &pad_cfg, &format);
        if (ret < 0)
                return ret;
 
-       pix->width      = mf.width;
-       pix->height     = mf.height;
-       pix->colorspace = mf.colorspace;
+       pix->width      = mf->width;
+       pix->height     = mf->height;
+       pix->colorspace = mf->colorspace;
 
-       switch (mf.field) {
+       switch (mf->field) {
        case V4L2_FIELD_ANY:
                pix->field = V4L2_FIELD_NONE;
                break;
@@ -951,7 +955,7 @@ static int mx3_camera_try_fmt(struct soc_camera_device *icd,
                break;
        default:
                dev_err(icd->parent, "Field type %d unsupported.\n",
-                       mf.field);
+                       mf->field);
                ret = -EINVAL;
        }
 
index 6663645d1be443eabfe79c21249fcf045dfff412..2a715e1e22def1e57d5e8b05f57ef90a83d43443 100644 (file)
@@ -1322,7 +1322,11 @@ static int omap1_cam_try_fmt(struct soc_camera_device *icd,
        struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
        const struct soc_camera_format_xlate *xlate;
        struct v4l2_pix_format *pix = &f->fmt.pix;
-       struct v4l2_mbus_framefmt mf;
+       struct v4l2_subdev_pad_config pad_cfg;
+       struct v4l2_subdev_format format = {
+               .which = V4L2_SUBDEV_FORMAT_TRY,
+       };
+       struct v4l2_mbus_framefmt *mf = &format.format;
        int ret;
        /* TODO: limit to mx1 hardware capabilities */
 
@@ -1333,21 +1337,21 @@ static int omap1_cam_try_fmt(struct soc_camera_device *icd,
                return -EINVAL;
        }
 
-       mf.width        = pix->width;
-       mf.height       = pix->height;
-       mf.field        = pix->field;
-       mf.colorspace   = pix->colorspace;
-       mf.code         = xlate->code;
+       mf->width       = pix->width;
+       mf->height      = pix->height;
+       mf->field       = pix->field;
+       mf->colorspace  = pix->colorspace;
+       mf->code        = xlate->code;
 
        /* limit to sensor capabilities */
-       ret = v4l2_subdev_call(sd, video, try_mbus_fmt, &mf);
+       ret = v4l2_subdev_call(sd, pad, set_fmt, &pad_cfg, &format);
        if (ret < 0)
                return ret;
 
-       pix->width      = mf.width;
-       pix->height     = mf.height;
-       pix->field      = mf.field;
-       pix->colorspace = mf.colorspace;
+       pix->width      = mf->width;
+       pix->height     = mf->height;
+       pix->field      = mf->field;
+       pix->colorspace = mf->colorspace;
 
        return 0;
 }
index 48999f3cb2bbda37f0ef83e425b3be78c5c6bb6f..7ccd76f7ca1ad40ae53b423681cb9f439cab997a 100644 (file)
@@ -1488,7 +1488,11 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd,
        struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
        const struct soc_camera_format_xlate *xlate;
        struct v4l2_pix_format *pix = &f->fmt.pix;
-       struct v4l2_mbus_framefmt mf;
+       struct v4l2_subdev_pad_config pad_cfg;
+       struct v4l2_subdev_format format = {
+               .which = V4L2_SUBDEV_FORMAT_TRY,
+       };
+       struct v4l2_mbus_framefmt *mf = &format.format;
        __u32 pixfmt = pix->pixelformat;
        int ret;
 
@@ -1509,22 +1513,22 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd,
                              pixfmt == V4L2_PIX_FMT_YUV422P ? 4 : 0);
 
        /* limit to sensor capabilities */
-       mf.width        = pix->width;
-       mf.height       = pix->height;
+       mf->width       = pix->width;
+       mf->height      = pix->height;
        /* Only progressive video supported so far */
-       mf.field        = V4L2_FIELD_NONE;
-       mf.colorspace   = pix->colorspace;
-       mf.code         = xlate->code;
+       mf->field       = V4L2_FIELD_NONE;
+       mf->colorspace  = pix->colorspace;
+       mf->code        = xlate->code;
 
-       ret = v4l2_subdev_call(sd, video, try_mbus_fmt, &mf);
+       ret = v4l2_subdev_call(sd, pad, set_fmt, &pad_cfg, &format);
        if (ret < 0)
                return ret;
 
-       pix->width      = mf.width;
-       pix->height     = mf.height;
-       pix->colorspace = mf.colorspace;
+       pix->width      = mf->width;
+       pix->height     = mf->height;
+       pix->colorspace = mf->colorspace;
 
-       switch (mf.field) {
+       switch (mf->field) {
        case V4L2_FIELD_ANY:
        case V4L2_FIELD_NONE:
                pix->field      = V4L2_FIELD_NONE;
@@ -1532,7 +1536,7 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd,
        default:
                /* TODO: support interlaced at least in pass-through mode */
                dev_err(icd->parent, "Field type %d unsupported.\n",
-                       mf.field);
+                       mf->field);
                return -EINVAL;
        }
 
index 08fa61099dde9422751f93769306474f53346d5e..063285a8dcf54db5453e14d4702162a0de09798e 100644 (file)
@@ -1683,7 +1683,11 @@ static int rcar_vin_try_fmt(struct soc_camera_device *icd,
        const struct soc_camera_format_xlate *xlate;
        struct v4l2_pix_format *pix = &f->fmt.pix;
        struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
-       struct v4l2_mbus_framefmt mf;
+       struct v4l2_subdev_pad_config pad_cfg;
+       struct v4l2_subdev_format format = {
+               .which = V4L2_SUBDEV_FORMAT_TRY,
+       };
+       struct v4l2_mbus_framefmt *mf = &format.format;
        __u32 pixfmt = pix->pixelformat;
        int width, height;
        int ret;
@@ -1710,25 +1714,25 @@ static int rcar_vin_try_fmt(struct soc_camera_device *icd,
        pix->sizeimage = 0;
 
        /* limit to sensor capabilities */
-       mf.width = pix->width;
-       mf.height = pix->height;
-       mf.field = pix->field;
-       mf.code = xlate->code;
-       mf.colorspace = pix->colorspace;
+       mf->width = pix->width;
+       mf->height = pix->height;
+       mf->field = pix->field;
+       mf->code = xlate->code;
+       mf->colorspace = pix->colorspace;
 
        ret = v4l2_device_call_until_err(sd->v4l2_dev, soc_camera_grp_id(icd),
-                                        video, try_mbus_fmt, &mf);
+                                        pad, set_fmt, &pad_cfg, &format);
        if (ret < 0)
                return ret;
 
        /* Adjust only if VIN cannot scale */
-       if (pix->width > mf.width * 2)
-               pix->width = mf.width * 2;
-       if (pix->height > mf.height * 3)
-               pix->height = mf.height * 3;
+       if (pix->width > mf->width * 2)
+               pix->width = mf->width * 2;
+       if (pix->height > mf->height * 3)
+               pix->height = mf->height * 3;
 
-       pix->field = mf.field;
-       pix->colorspace = mf.colorspace;
+       pix->field = mf->field;
+       pix->colorspace = mf->colorspace;
 
        if (pixfmt == V4L2_PIX_FMT_NV16) {
                /* FIXME: check against rect_max after converting soc-camera */
@@ -1739,12 +1743,12 @@ static int rcar_vin_try_fmt(struct soc_camera_device *icd,
                         * requested a bigger rectangle, it will not return a
                         * smaller one.
                         */
-                       mf.width = VIN_MAX_WIDTH;
-                       mf.height = VIN_MAX_HEIGHT;
+                       mf->width = VIN_MAX_WIDTH;
+                       mf->height = VIN_MAX_HEIGHT;
                        ret = v4l2_device_call_until_err(sd->v4l2_dev,
                                                         soc_camera_grp_id(icd),
-                                                        video, try_mbus_fmt,
-                                                        &mf);
+                                                        pad, set_fmt, &pad_cfg,
+                                                        &format);
                        if (ret < 0) {
                                dev_err(icd->parent,
                                        "client try_fmt() = %d\n", ret);
@@ -1752,9 +1756,9 @@ static int rcar_vin_try_fmt(struct soc_camera_device *icd,
                        }
                }
                /* We will scale exactly */
-               if (mf.width > width)
+               if (mf->width > width)
                        pix->width = width;
-               if (mf.height > height)
+               if (mf->height > height)
                        pix->height = height;
        }
 
index 566fd74c46396b649a2331f8b8cd58e761a6f8ec..91c48ab6cd13697e2ffaf113f3ee344dd27e129a 100644 (file)
@@ -1499,7 +1499,11 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
        const struct soc_camera_format_xlate *xlate;
        struct v4l2_pix_format *pix = &f->fmt.pix;
        struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
-       struct v4l2_mbus_framefmt mf;
+       struct v4l2_subdev_pad_config pad_cfg;
+       struct v4l2_subdev_format format = {
+               .which = V4L2_SUBDEV_FORMAT_TRY,
+       };
+       struct v4l2_mbus_framefmt *mf = &format.format;
        __u32 pixfmt = pix->pixelformat;
        int width, height;
        int ret;
@@ -1527,21 +1531,21 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
        height = pix->height;
 
        /* limit to sensor capabilities */
-       mf.width        = pix->width;
-       mf.height       = pix->height;
-       mf.field        = pix->field;
-       mf.code         = xlate->code;
-       mf.colorspace   = pix->colorspace;
+       mf->width       = pix->width;
+       mf->height      = pix->height;
+       mf->field       = pix->field;
+       mf->code        = xlate->code;
+       mf->colorspace  = pix->colorspace;
 
        ret = v4l2_device_call_until_err(sd->v4l2_dev, soc_camera_grp_id(icd),
-                                        video, try_mbus_fmt, &mf);
+                                        pad, set_fmt, &pad_cfg, &format);
        if (ret < 0)
                return ret;
 
-       pix->width      = mf.width;
-       pix->height     = mf.height;
-       pix->field      = mf.field;
-       pix->colorspace = mf.colorspace;
+       pix->width      = mf->width;
+       pix->height     = mf->height;
+       pix->field      = mf->field;
+       pix->colorspace = mf->colorspace;
 
        switch (pixfmt) {
        case V4L2_PIX_FMT_NV12:
@@ -1556,11 +1560,11 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
                         * requested a bigger rectangle, it will not return a
                         * smaller one.
                         */
-                       mf.width = pcdev->max_width;
-                       mf.height = pcdev->max_height;
+                       mf->width = pcdev->max_width;
+                       mf->height = pcdev->max_height;
                        ret = v4l2_device_call_until_err(sd->v4l2_dev,
-                                       soc_camera_grp_id(icd), video,
-                                       try_mbus_fmt, &mf);
+                                       soc_camera_grp_id(icd), pad,
+                                       set_fmt, &pad_cfg, &format);
                        if (ret < 0) {
                                /* Shouldn't actually happen... */
                                dev_err(icd->parent,
@@ -1569,9 +1573,9 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
                        }
                }
                /* We will scale exactly */
-               if (mf.width > width)
+               if (mf->width > width)
                        pix->width = width;
-               if (mf.height > height)
+               if (mf->height > height)
                        pix->height = height;
 
                pix->bytesperline = max(pix->bytesperline, pix->width);
index 678ed9f353cbb6011c5deeafebd545fb5a13c4db..6331d6b99d23ba5151a923cb4524c7bb8c8d37c6 100644 (file)
@@ -903,14 +903,17 @@ static int viacam_do_try_fmt(struct via_camera *cam,
                struct v4l2_pix_format *upix, struct v4l2_pix_format *spix)
 {
        int ret;
-       struct v4l2_mbus_framefmt mbus_fmt;
+       struct v4l2_subdev_pad_config pad_cfg;
+       struct v4l2_subdev_format format = {
+               .which = V4L2_SUBDEV_FORMAT_TRY,
+       };
        struct via_format *f = via_find_format(upix->pixelformat);
 
        upix->pixelformat = f->pixelformat;
        viacam_fmt_pre(upix, spix);
-       v4l2_fill_mbus_format(&mbus_fmt, spix, f->mbus_code);
-       ret = sensor_call(cam, video, try_mbus_fmt, &mbus_fmt);
-       v4l2_fill_pix_format(spix, &mbus_fmt);
+       v4l2_fill_mbus_format(&format.format, spix, f->mbus_code);
+       ret = sensor_call(cam, pad, set_fmt, &pad_cfg, &format);
+       v4l2_fill_pix_format(spix, &format.format);
        viacam_fmt_post(upix, spix);
        return ret;
 }