[media] v4l2-subdev: support new 'which' field in enum_mbus_code
authorHans Verkuil <hans.verkuil@cisco.com>
Wed, 4 Mar 2015 09:47:57 +0000 (01:47 -0800)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Mon, 23 Mar 2015 18:46:38 +0000 (11:46 -0700)
Support the new 'which' field in the enum_mbus_code ops. Most drivers do not
need to be changed since they always return the same enumeration regardless
of the 'which' field.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
13 files changed:
drivers/media/platform/am437x/am437x-vpfe.c
drivers/media/platform/omap3isp/ispccdc.c
drivers/media/platform/omap3isp/ispccp2.c
drivers/media/platform/omap3isp/ispcsi2.c
drivers/media/platform/omap3isp/ispresizer.c
drivers/media/platform/vsp1/vsp1_bru.c
drivers/media/platform/vsp1/vsp1_lif.c
drivers/media/platform/vsp1/vsp1_lut.c
drivers/media/platform/vsp1/vsp1_sru.c
drivers/media/platform/vsp1/vsp1_uds.c
drivers/staging/media/omap4iss/iss_csi2.c
drivers/staging/media/omap4iss/iss_ipipeif.c
drivers/staging/media/omap4iss/iss_resizer.c

index 56a5cb0d215203f242b55e7609c4ddf6e7b4bc8f..8b413be8d598f0574a9bd982e8b834b55c8829af 100644 (file)
@@ -2327,6 +2327,7 @@ vpfe_async_bound(struct v4l2_async_notifier *notifier,
 
                memset(&mbus_code, 0, sizeof(mbus_code));
                mbus_code.index = j;
+               mbus_code.which = V4L2_SUBDEV_FORMAT_ACTIVE;
                ret = v4l2_subdev_call(subdev, pad, enum_mbus_code,
                               NULL, &mbus_code);
                if (ret)
index b0431a988d474602e78d8c4ed5867c5b99c5e448..818aa524edbca81f80a9139bce87f8e58c7f8a71 100644 (file)
@@ -2133,7 +2133,7 @@ static int ccdc_enum_mbus_code(struct v4l2_subdev *sd,
 
        case CCDC_PAD_SOURCE_OF:
                format = __ccdc_get_format(ccdc, cfg, code->pad,
-                                          V4L2_SUBDEV_FORMAT_TRY);
+                                          code->which);
 
                if (format->code == MEDIA_BUS_FMT_YUYV8_2X8 ||
                    format->code == MEDIA_BUS_FMT_UYVY8_2X8) {
@@ -2164,7 +2164,7 @@ static int ccdc_enum_mbus_code(struct v4l2_subdev *sd,
                        return -EINVAL;
 
                format = __ccdc_get_format(ccdc, cfg, code->pad,
-                                          V4L2_SUBDEV_FORMAT_TRY);
+                                          code->which);
 
                /* A pixel code equal to 0 means that the video port doesn't
                 * support the input format. Don't enumerate any pixel code.
index 3f10c3af3a0ad56cb49ce487f56d13f042bfe08e..1d79368c1ba6eb7a4c60d814d7f418d28ae06752 100644 (file)
@@ -703,7 +703,7 @@ static int ccp2_enum_mbus_code(struct v4l2_subdev *sd,
                        return -EINVAL;
 
                format = __ccp2_get_format(ccp2, cfg, CCP2_PAD_SINK,
-                                             V4L2_SUBDEV_FORMAT_TRY);
+                                             code->which);
                code->code = format->code;
        }
 
index 12ca63f2bf53555d24902c317467e597aff12320..bde734cba86ec140a97741f74342a2cd5bfd040a 100644 (file)
@@ -909,7 +909,7 @@ static int csi2_enum_mbus_code(struct v4l2_subdev *sd,
                code->code = csi2_input_fmts[code->index];
        } else {
                format = __csi2_get_format(csi2, cfg, CSI2_PAD_SINK,
-                                          V4L2_SUBDEV_FORMAT_TRY);
+                                          code->which);
                switch (code->index) {
                case 0:
                        /* Passthrough sink pad code */
index 3ede27bc0a456ba8338d752f0acc66fe8bfbf8fa..02549fa8a94dc4b013920f81c2d727f972cb7621 100644 (file)
@@ -1431,7 +1431,7 @@ static int resizer_enum_mbus_code(struct v4l2_subdev *sd,
                        return -EINVAL;
 
                format = __resizer_get_format(res, cfg, RESZ_PAD_SINK,
-                                             V4L2_SUBDEV_FORMAT_TRY);
+                                             code->which);
                code->code = format->code;
        }
 
index 31ad0b634e0cb91c99e0de09bbca64fe87f0e796..7dd763311c0f3974bd7fd43ddd790628723148b2 100644 (file)
@@ -190,6 +190,7 @@ static int bru_enum_mbus_code(struct v4l2_subdev *subdev,
                MEDIA_BUS_FMT_ARGB8888_1X32,
                MEDIA_BUS_FMT_AYUV8_1X32,
        };
+       struct vsp1_bru *bru = to_bru(subdev);
        struct v4l2_mbus_framefmt *format;
 
        if (code->pad == BRU_PAD_SINK(0)) {
@@ -201,7 +202,8 @@ static int bru_enum_mbus_code(struct v4l2_subdev *subdev,
                if (code->index)
                        return -EINVAL;
 
-               format = v4l2_subdev_get_try_format(subdev, cfg, BRU_PAD_SINK(0));
+               format = vsp1_entity_get_pad_format(&bru->entity, cfg,
+                                                   BRU_PAD_SINK(0), code->which);
                code->code = format->code;
        }
 
index b91c925a9887da0f0766f92ba0269c74e1614935..60f1bd85d48af1509252b46d8337f854fd64193e 100644 (file)
@@ -81,6 +81,7 @@ static int lif_enum_mbus_code(struct v4l2_subdev *subdev,
                MEDIA_BUS_FMT_ARGB8888_1X32,
                MEDIA_BUS_FMT_AYUV8_1X32,
        };
+       struct vsp1_lif *lif = to_lif(subdev);
 
        if (code->pad == LIF_PAD_SINK) {
                if (code->index >= ARRAY_SIZE(codes))
@@ -96,7 +97,8 @@ static int lif_enum_mbus_code(struct v4l2_subdev *subdev,
                if (code->index)
                        return -EINVAL;
 
-               format = v4l2_subdev_get_try_format(subdev, cfg, LIF_PAD_SINK);
+               format = vsp1_entity_get_pad_format(&lif->entity, cfg,
+                                                   LIF_PAD_SINK, code->which);
                code->code = format->code;
        }
 
index 003363d9a5d8344a3c128c1c39eddec50110305d..8aa8c111301ca670ef382f315b0092aa0ae2ef07 100644 (file)
@@ -90,6 +90,7 @@ static int lut_enum_mbus_code(struct v4l2_subdev *subdev,
                MEDIA_BUS_FMT_AHSV8888_1X32,
                MEDIA_BUS_FMT_AYUV8_1X32,
        };
+       struct vsp1_lut *lut = to_lut(subdev);
        struct v4l2_mbus_framefmt *format;
 
        if (code->pad == LUT_PAD_SINK) {
@@ -104,7 +105,8 @@ static int lut_enum_mbus_code(struct v4l2_subdev *subdev,
                if (code->index)
                        return -EINVAL;
 
-               format = v4l2_subdev_get_try_format(subdev, cfg, LUT_PAD_SINK);
+               format = vsp1_entity_get_pad_format(&lut->entity, cfg,
+                                                   LUT_PAD_SINK, code->which);
                code->code = format->code;
        }
 
index c51dcee228bc0a0b6ce1035fd8fa7f691114a7fa..554340d4e2b33ed3b890518b9433e106c63d53cd 100644 (file)
@@ -173,6 +173,7 @@ static int sru_enum_mbus_code(struct v4l2_subdev *subdev,
                MEDIA_BUS_FMT_ARGB8888_1X32,
                MEDIA_BUS_FMT_AYUV8_1X32,
        };
+       struct vsp1_sru *sru = to_sru(subdev);
        struct v4l2_mbus_framefmt *format;
 
        if (code->pad == SRU_PAD_SINK) {
@@ -187,7 +188,8 @@ static int sru_enum_mbus_code(struct v4l2_subdev *subdev,
                if (code->index)
                        return -EINVAL;
 
-               format = v4l2_subdev_get_try_format(subdev, cfg, SRU_PAD_SINK);
+               format = vsp1_entity_get_pad_format(&sru->entity, cfg,
+                                                   SRU_PAD_SINK, code->which);
                code->code = format->code;
        }
 
index 08d916d5d1acd2fa5fa69259ba075ce77307d272..ef4d307f80d14376888ae51506123e78e706db28 100644 (file)
@@ -176,6 +176,7 @@ static int uds_enum_mbus_code(struct v4l2_subdev *subdev,
                MEDIA_BUS_FMT_ARGB8888_1X32,
                MEDIA_BUS_FMT_AYUV8_1X32,
        };
+       struct vsp1_uds *uds = to_uds(subdev);
 
        if (code->pad == UDS_PAD_SINK) {
                if (code->index >= ARRAY_SIZE(codes))
@@ -191,7 +192,8 @@ static int uds_enum_mbus_code(struct v4l2_subdev *subdev,
                if (code->index)
                        return -EINVAL;
 
-               format = v4l2_subdev_get_try_format(subdev, cfg, UDS_PAD_SINK);
+               format = vsp1_entity_get_pad_format(&uds->entity, cfg,
+                                                   UDS_PAD_SINK, code->which);
                code->code = format->code;
        }
 
index e404ad4fd987167f37397f70155474044f789456..2d5079deb631aa24221462d537515ea38e2d15c3 100644 (file)
@@ -908,7 +908,7 @@ static int csi2_enum_mbus_code(struct v4l2_subdev *sd,
                code->code = csi2_input_fmts[code->index];
        } else {
                format = __csi2_get_format(csi2, cfg, CSI2_PAD_SINK,
-                                          V4L2_SUBDEV_FORMAT_TRY);
+                                          code->which);
                switch (code->index) {
                case 0:
                        /* Passthrough sink pad code */
index 948edcca870482d73f4f6e90e56f4781836ad496..b8e7277499d23a0b13cdf1dbaf7e3371ac958525 100644 (file)
@@ -467,7 +467,7 @@ static int ipipeif_enum_mbus_code(struct v4l2_subdev *sd,
                        return -EINVAL;
 
                format = __ipipeif_get_format(ipipeif, cfg, IPIPEIF_PAD_SINK,
-                                             V4L2_SUBDEV_FORMAT_TRY);
+                                             code->which);
 
                code->code = format->code;
                break;
index f9b0aac91e9db9e48479a50ac8fa5f1bae03379e..075b876e8e6803ab40f263eb16cdf1a382dd3b97 100644 (file)
@@ -513,7 +513,7 @@ static int resizer_enum_mbus_code(struct v4l2_subdev *sd,
 
        case RESIZER_PAD_SOURCE_MEM:
                format = __resizer_get_format(resizer, cfg, RESIZER_PAD_SINK,
-                                             V4L2_SUBDEV_FORMAT_TRY);
+                                             code->which);
 
                if (code->index == 0) {
                        code->code = format->code;