media: atomisp: Fix device_caps reporting of the registered video-devs
authorHans de Goede <hdegoede@redhat.com>
Sat, 27 Aug 2022 13:54:27 +0000 (15:54 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Sat, 24 Sep 2022 07:47:11 +0000 (09:47 +0200)
atomisp_subdev_register_entities() had V4L2_CAP_VIDEO_CAPTURE /
V4L2_CAP_VIDEO_OUT swapped. Or-ing in V4L2_CAP_VIDEO_OUT for
the nodes which allow capturing from the camera and or-ing in
V4L2_CAP_VIDEO_CAPTURE for the file-injection node
(mem2mem use of the ISP).

Things happen to still work for the capture device-nodes because
the "shared" caps also included V4L2_CAP_VIDEO_CAPTURE, so those
shared nodes advertised V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUT.

Fix things so that only the correct caps are advertised.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/staging/media/atomisp/pci/atomisp_subdev.c

index 394fe69..6d53391 100644 (file)
@@ -1314,16 +1314,12 @@ int atomisp_subdev_register_entities(struct atomisp_sub_device *asd,
                                     struct v4l2_device *vdev)
 {
        int ret;
-       u32 device_caps;
 
        /*
         * FIXME: check if all device caps are properly initialized.
-        * Should any of those use V4L2_CAP_META_OUTPUT? Probably yes.
+        * Should any of those use V4L2_CAP_META_CAPTURE? Probably yes.
         */
 
-       device_caps = V4L2_CAP_VIDEO_CAPTURE |
-                     V4L2_CAP_STREAMING;
-
        /* Register the subdev and video node. */
 
        ret = v4l2_device_register_subdev(vdev, &asd->subdev);
@@ -1331,39 +1327,34 @@ int atomisp_subdev_register_entities(struct atomisp_sub_device *asd,
                goto error;
 
        asd->video_out_preview.vdev.v4l2_dev = vdev;
-       asd->video_out_preview.vdev.device_caps = device_caps |
-                                                 V4L2_CAP_VIDEO_OUTPUT;
+       asd->video_out_preview.vdev.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
        ret = video_register_device(&asd->video_out_preview.vdev,
                                    VFL_TYPE_VIDEO, -1);
        if (ret < 0)
                goto error;
 
        asd->video_out_capture.vdev.v4l2_dev = vdev;
-       asd->video_out_capture.vdev.device_caps = device_caps |
-                                                 V4L2_CAP_VIDEO_OUTPUT;
+       asd->video_out_capture.vdev.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
        ret = video_register_device(&asd->video_out_capture.vdev,
                                    VFL_TYPE_VIDEO, -1);
        if (ret < 0)
                goto error;
 
        asd->video_out_vf.vdev.v4l2_dev = vdev;
-       asd->video_out_vf.vdev.device_caps = device_caps |
-                                            V4L2_CAP_VIDEO_OUTPUT;
+       asd->video_out_vf.vdev.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
        ret = video_register_device(&asd->video_out_vf.vdev,
                                    VFL_TYPE_VIDEO, -1);
        if (ret < 0)
                goto error;
 
        asd->video_out_video_capture.vdev.v4l2_dev = vdev;
-       asd->video_out_video_capture.vdev.device_caps = device_caps |
-                                                       V4L2_CAP_VIDEO_OUTPUT;
+       asd->video_out_video_capture.vdev.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
        ret = video_register_device(&asd->video_out_video_capture.vdev,
                                    VFL_TYPE_VIDEO, -1);
        if (ret < 0)
                goto error;
        asd->video_acc.vdev.v4l2_dev = vdev;
-       asd->video_acc.vdev.device_caps = device_caps |
-                                         V4L2_CAP_VIDEO_OUTPUT;
+       asd->video_acc.vdev.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
        ret = video_register_device(&asd->video_acc.vdev,
                                    VFL_TYPE_VIDEO, -1);
        if (ret < 0)
@@ -1377,8 +1368,7 @@ int atomisp_subdev_register_entities(struct atomisp_sub_device *asd,
                return 0;
 
        asd->video_in.vdev.v4l2_dev = vdev;
-       asd->video_in.vdev.device_caps = device_caps |
-                                         V4L2_CAP_VIDEO_CAPTURE;
+       asd->video_in.vdev.device_caps = V4L2_CAP_VIDEO_OUT | V4L2_CAP_STREAMING;
        ret = video_register_device(&asd->video_in.vdev,
                                    VFL_TYPE_VIDEO, -1);
        if (ret < 0)