media: v4l2: Make sure all drivers set _MPLANE caps in vdev->device_caps
authorBoris Brezillon <boris.brezillon@collabora.com>
Tue, 4 Jun 2019 07:06:24 +0000 (03:06 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Wed, 5 Jun 2019 11:45:37 +0000 (07:45 -0400)
This is needed if we want the core to be able to check _MPLANE support
without having to call the ->vidioc_querycap() hook.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
12 files changed:
drivers/media/platform/exynos-gsc/gsc-m2m.c
drivers/media/platform/exynos4-is/common.c
drivers/media/platform/exynos4-is/common.h
drivers/media/platform/exynos4-is/fimc-capture.c
drivers/media/platform/exynos4-is/fimc-isp-video.c
drivers/media/platform/exynos4-is/fimc-lite.c
drivers/media/platform/exynos4-is/fimc-m2m.c
drivers/media/platform/rcar_jpu.c
drivers/media/platform/s5p-mfc/s5p_mfc.c
drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
drivers/media/platform/ti-vpe/vpe.c

index c757f5d98bccf59b425bc2ec34ae1ab2afb2d8cb..cd02e3c233fce52aeafd7a51c19232d6826a35a2 100644 (file)
@@ -298,8 +298,6 @@ static int gsc_m2m_querycap(struct file *file, void *fh,
        strscpy(cap->card, GSC_MODULE_NAME " gscaler", sizeof(cap->card));
        snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
                 dev_name(&gsc->pdev->dev));
-       cap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M_MPLANE;
-       cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
        return 0;
 }
 
@@ -763,6 +761,8 @@ int gsc_register_m2m_device(struct gsc_dev *gsc)
        gsc->vdev.lock          = &gsc->lock;
        gsc->vdev.vfl_dir       = VFL_DIR_M2M;
        gsc->vdev.v4l2_dev      = &gsc->v4l2_dev;
+       gsc->vdev.device_caps   = V4L2_CAP_STREAMING |
+                                 V4L2_CAP_VIDEO_M2M_MPLANE;
        snprintf(gsc->vdev.name, sizeof(gsc->vdev.name), "%s.%d:m2m",
                                        GSC_MODULE_NAME, gsc->id);
 
index 76f557548dfcbf588ca654592314093f586ac7d3..d47a77c8d4d6dec0f61f51541266441ae01728ba 100644 (file)
@@ -37,15 +37,12 @@ struct v4l2_subdev *fimc_find_remote_sensor(struct media_entity *entity)
 }
 EXPORT_SYMBOL(fimc_find_remote_sensor);
 
-void __fimc_vidioc_querycap(struct device *dev, struct v4l2_capability *cap,
-                                               unsigned int caps)
+void __fimc_vidioc_querycap(struct device *dev, struct v4l2_capability *cap)
 {
        strscpy(cap->driver, dev->driver->name, sizeof(cap->driver));
        strscpy(cap->card, dev->driver->name, sizeof(cap->card));
        snprintf(cap->bus_info, sizeof(cap->bus_info),
                                "platform:%s", dev_name(dev));
-       cap->device_caps = caps;
-       cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
 }
 EXPORT_SYMBOL(__fimc_vidioc_querycap);
 
index 75b9c71d9419f8cf1553a670173eed73b795758b..58da94e7910ca5af3cb0bca1bd9abd2561c8e7c8 100644 (file)
@@ -12,5 +12,4 @@
 #include <media/v4l2-subdev.h>
 
 struct v4l2_subdev *fimc_find_remote_sensor(struct media_entity *entity);
-void __fimc_vidioc_querycap(struct device *dev, struct v4l2_capability *cap,
-                           unsigned int caps);
+void __fimc_vidioc_querycap(struct device *dev, struct v4l2_capability *cap);
index de4af0357a3c562e39653fe6e26f5662a837a101..ecfa6ab4a19d9caea64f70c1ee9231362b790780 100644 (file)
@@ -728,8 +728,7 @@ static int fimc_cap_querycap(struct file *file, void *priv,
 {
        struct fimc_dev *fimc = video_drvdata(file);
 
-       __fimc_vidioc_querycap(&fimc->pdev->dev, cap, V4L2_CAP_STREAMING |
-                                       V4L2_CAP_VIDEO_CAPTURE_MPLANE);
+       __fimc_vidioc_querycap(&fimc->pdev->dev, cap);
        return 0;
 }
 
@@ -1765,6 +1764,7 @@ static int fimc_register_capture_device(struct fimc_dev *fimc,
        vfd->release    = video_device_release_empty;
        vfd->queue      = q;
        vfd->lock       = &fimc->lock;
+       vfd->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_CAPTURE_MPLANE;
 
        video_set_drvdata(vfd, fimc);
        vid_cap = &fimc->vid_cap;
index bb35a2017f21c797fcdf62a521bd5d9de8689a16..ad8dd672d4a71cfb4376c1797e57762cf3ed3c8f 100644 (file)
@@ -349,7 +349,7 @@ static int isp_video_querycap(struct file *file, void *priv,
 {
        struct fimc_isp *isp = video_drvdata(file);
 
-       __fimc_vidioc_querycap(&isp->pdev->dev, cap, V4L2_CAP_STREAMING);
+       __fimc_vidioc_querycap(&isp->pdev->dev, cap);
        return 0;
 }
 
@@ -614,6 +614,7 @@ int fimc_isp_video_device_register(struct fimc_isp *isp,
        vdev->minor = -1;
        vdev->release = video_device_release_empty;
        vdev->lock = &isp->video_lock;
+       vdev->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_CAPTURE_MPLANE;
 
        iv->pad.flags = MEDIA_PAD_FL_SINK;
        ret = media_entity_pads_init(&vdev->entity, 1, &iv->pad);
index 96f0a8a0dcae591f8a069b565a2ca3cf48976eef..a16b5bed59bbe09cfa38c53a2b840f6ac339ba3e 100644 (file)
@@ -658,9 +658,6 @@ static int fimc_lite_querycap(struct file *file, void *priv,
        strscpy(cap->card, FIMC_LITE_DRV_NAME, sizeof(cap->card));
        snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
                                        dev_name(&fimc->pdev->dev));
-
-       cap->device_caps = V4L2_CAP_STREAMING;
-       cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
        return 0;
 }
 
@@ -1282,6 +1279,7 @@ static int fimc_lite_subdev_registered(struct v4l2_subdev *sd)
        vfd->minor = -1;
        vfd->release = video_device_release_empty;
        vfd->queue = q;
+       vfd->device_caps = V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_STREAMING;
        fimc->reqbufs_count = 0;
 
        INIT_LIST_HEAD(&fimc->pending_buf_q);
index 1bea1ce4091e4e9d2326b63059cfee85248128ae..17e5bf4810f49f76508d4dd0bc0aaac9cf7cfc4d 100644 (file)
@@ -236,9 +236,8 @@ static int fimc_m2m_querycap(struct file *file, void *fh,
                                     struct v4l2_capability *cap)
 {
        struct fimc_dev *fimc = video_drvdata(file);
-       unsigned int caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M_MPLANE;
 
-       __fimc_vidioc_querycap(&fimc->pdev->dev, cap, caps);
+       __fimc_vidioc_querycap(&fimc->pdev->dev, cap);
        return 0;
 }
 
@@ -736,6 +735,7 @@ int fimc_register_m2m_device(struct fimc_dev *fimc,
        vfd->release = video_device_release_empty;
        vfd->lock = &fimc->lock;
        vfd->vfl_dir = VFL_DIR_M2M;
+       vfd->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M_MPLANE;
        set_bit(V4L2_FL_QUIRK_INVERTED_CROP, &vfd->flags);
 
        snprintf(vfd->name, sizeof(vfd->name), "fimc.%d.m2m", fimc->id);
index 1dfd2eb65920012e346c30095c08af67740fcfb9..9b6eadef6858cfe73bebef61d57c9a2adba8d78a 100644 (file)
@@ -671,8 +671,6 @@ static int jpu_querycap(struct file *file, void *priv,
        strscpy(cap->driver, DRV_NAME, sizeof(cap->driver));
        snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
                 dev_name(ctx->jpu->dev));
-       cap->device_caps |= V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M_MPLANE;
-       cap->capabilities = V4L2_CAP_DEVICE_CAPS | cap->device_caps;
        memset(cap->reserved, 0, sizeof(cap->reserved));
 
        return 0;
@@ -1662,6 +1660,8 @@ static int jpu_probe(struct platform_device *pdev)
        jpu->vfd_encoder.lock           = &jpu->mutex;
        jpu->vfd_encoder.v4l2_dev       = &jpu->v4l2_dev;
        jpu->vfd_encoder.vfl_dir        = VFL_DIR_M2M;
+       jpu->vfd_encoder.device_caps    = V4L2_CAP_STREAMING |
+                                         V4L2_CAP_VIDEO_M2M_MPLANE;
 
        ret = video_register_device(&jpu->vfd_encoder, VFL_TYPE_GRABBER, -1);
        if (ret) {
@@ -1679,6 +1679,8 @@ static int jpu_probe(struct platform_device *pdev)
        jpu->vfd_decoder.lock           = &jpu->mutex;
        jpu->vfd_decoder.v4l2_dev       = &jpu->v4l2_dev;
        jpu->vfd_decoder.vfl_dir        = VFL_DIR_M2M;
+       jpu->vfd_decoder.device_caps    = V4L2_CAP_STREAMING |
+                                         V4L2_CAP_VIDEO_M2M_MPLANE;
 
        ret = video_register_device(&jpu->vfd_decoder, VFL_TYPE_GRABBER, -1);
        if (ret) {
index 9a53d3908b527b2f4b439d1b48ad3d54ac632987..6ff57018a3534f73d8938968466ae63ca2520ac7 100644 (file)
@@ -1348,6 +1348,7 @@ static int s5p_mfc_probe(struct platform_device *pdev)
        vfd->lock       = &dev->mfc_mutex;
        vfd->v4l2_dev   = &dev->v4l2_dev;
        vfd->vfl_dir    = VFL_DIR_M2M;
+       vfd->device_caps = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING;
        set_bit(V4L2_FL_QUIRK_INVERTED_CROP, &vfd->flags);
        snprintf(vfd->name, sizeof(vfd->name), "%s", S5P_MFC_DEC_NAME);
        dev->vfd_dec    = vfd;
@@ -1366,6 +1367,7 @@ static int s5p_mfc_probe(struct platform_device *pdev)
        vfd->lock       = &dev->mfc_mutex;
        vfd->v4l2_dev   = &dev->v4l2_dev;
        vfd->vfl_dir    = VFL_DIR_M2M;
+       vfd->device_caps = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING;
        snprintf(vfd->name, sizeof(vfd->name), "%s", S5P_MFC_ENC_NAME);
        dev->vfd_enc    = vfd;
        video_set_drvdata(vfd, dev);
index e111f9c47179157af3df486fe1e8490982b02836..d29e5bc736510f5a6a27f3f24a79f8e4e46fdc41 100644 (file)
@@ -275,13 +275,6 @@ static int vidioc_querycap(struct file *file, void *priv,
        strscpy(cap->card, dev->vfd_dec->name, sizeof(cap->card));
        snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
                 dev_name(&dev->plat_dev->dev));
-       /*
-        * This is only a mem-to-mem video device. The capture and output
-        * device capability flags are left only for backward compatibility
-        * and are scheduled for removal.
-        */
-       cap->device_caps = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING;
-       cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
        return 0;
 }
 
index 5505e4fc20907ddd961decb2e6e9047048faedf8..5ab1231b4189f4c805485b3b0622b2e8ac9c0ce1 100644 (file)
@@ -1317,13 +1317,6 @@ static int vidioc_querycap(struct file *file, void *priv,
        strscpy(cap->card, dev->vfd_enc->name, sizeof(cap->card));
        snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
                 dev_name(&dev->plat_dev->dev));
-       /*
-        * This is only a mem-to-mem video device. The capture and output
-        * device capability flags are left only for backward compatibility
-        * and are scheduled for removal.
-        */
-       cap->device_caps = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING;
-       cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
        return 0;
 }
 
index 1e40eafec28405df8e13d8cab613a9a91294db3d..a61ac426853a630ec5470abce6e6a69bcc3496e4 100644 (file)
@@ -1495,8 +1495,6 @@ static int vpe_querycap(struct file *file, void *priv,
        strscpy(cap->card, VPE_MODULE_NAME, sizeof(cap->card));
        snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
                VPE_MODULE_NAME);
-       cap->device_caps  = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING;
-       cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
        return 0;
 }
 
@@ -2411,6 +2409,7 @@ static const struct video_device vpe_videodev = {
        .minor          = -1,
        .release        = video_device_release_empty,
        .vfl_dir        = VFL_DIR_M2M,
+       .device_caps    = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING,
 };
 
 static const struct v4l2_m2m_ops m2m_ops = {