hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/media/platform/omap3isp/ispvideo.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * ispvideo.c
34 *
....@@ -7,13 +8,8 @@
78 *
89 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
910 * Sakari Ailus <sakari.ailus@iki.fi>
10
- *
11
- * This program is free software; you can redistribute it and/or modify
12
- * it under the terms of the GNU General Public License version 2 as
13
- * published by the Free Software Foundation.
1411 */
1512
16
-#include <asm/cacheflush.h>
1713 #include <linux/clk.h>
1814 #include <linux/mm.h>
1915 #include <linux/module.h>
....@@ -654,17 +650,13 @@
654650 {
655651 struct isp_video *video = video_drvdata(file);
656652
657
- strlcpy(cap->driver, ISP_VIDEO_DRIVER_NAME, sizeof(cap->driver));
658
- strlcpy(cap->card, video->video.name, sizeof(cap->card));
659
- strlcpy(cap->bus_info, "media", sizeof(cap->bus_info));
653
+ strscpy(cap->driver, ISP_VIDEO_DRIVER_NAME, sizeof(cap->driver));
654
+ strscpy(cap->card, video->video.name, sizeof(cap->card));
655
+ strscpy(cap->bus_info, "media", sizeof(cap->bus_info));
660656
661657 cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUTPUT
662658 | V4L2_CAP_STREAMING | V4L2_CAP_DEVICE_CAPS;
663659
664
- if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
665
- cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
666
- else
667
- cap->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
668660
669661 return 0;
670662 }
....@@ -711,7 +703,7 @@
711703 * requested.
712704 */
713705 format->fmt.pix.field = V4L2_FIELD_INTERLACED_TB;
714
- /* Fall-through */
706
+ fallthrough;
715707 case V4L2_FIELD_INTERLACED_TB:
716708 case V4L2_FIELD_INTERLACED_BT:
717709 /* Interlaced orders are only supported at the CCDC output. */
....@@ -940,7 +932,7 @@
940932 int ret;
941933
942934 mutex_lock(&video->queue_lock);
943
- ret = vb2_qbuf(&vfh->queue, b);
935
+ ret = vb2_qbuf(&vfh->queue, video->video.v4l2_dev->mdev, b);
944936 mutex_unlock(&video->queue_lock);
945937
946938 return ret;
....@@ -1027,8 +1019,8 @@
10271019
10281020 ctrls.count = 1;
10291021 ctrls.controls = &ctrl;
1030
-
1031
- ret = v4l2_g_ext_ctrls(pipe->external->ctrl_handler, &ctrls);
1022
+ ret = v4l2_g_ext_ctrls(pipe->external->ctrl_handler, &video->video,
1023
+ NULL, &ctrls);
10321024 if (ret < 0) {
10331025 dev_warn(isp->dev, "no pixel rate control in subdev %s\n",
10341026 pipe->external->name);
....@@ -1251,7 +1243,7 @@
12511243 if (input->index > 0)
12521244 return -EINVAL;
12531245
1254
- strlcpy(input->name, "camera", sizeof(input->name));
1246
+ strscpy(input->name, "camera", sizeof(input->name));
12551247 input->type = V4L2_INPUT_TYPE_CAMERA;
12561248
12571249 return 0;
....@@ -1318,7 +1310,7 @@
13181310 goto done;
13191311 }
13201312
1321
- ret = v4l2_pipeline_pm_use(&video->video.entity, 1);
1313
+ ret = v4l2_pipeline_pm_get(&video->video.entity);
13221314 if (ret < 0) {
13231315 omap3isp_put(video->isp);
13241316 goto done;
....@@ -1370,7 +1362,7 @@
13701362 vb2_queue_release(&handle->queue);
13711363 mutex_unlock(&video->queue_lock);
13721364
1373
- v4l2_pipeline_pm_use(&video->video.entity, 0);
1365
+ v4l2_pipeline_pm_put(&video->video.entity);
13741366
13751367 /* Release the file handle. */
13761368 v4l2_fh_del(vfh);
....@@ -1460,9 +1452,16 @@
14601452 video->video.fops = &isp_video_fops;
14611453 snprintf(video->video.name, sizeof(video->video.name),
14621454 "OMAP3 ISP %s %s", name, direction);
1463
- video->video.vfl_type = VFL_TYPE_GRABBER;
1455
+ video->video.vfl_type = VFL_TYPE_VIDEO;
14641456 video->video.release = video_device_release_empty;
14651457 video->video.ioctl_ops = &isp_video_ioctl_ops;
1458
+ if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
1459
+ video->video.device_caps = V4L2_CAP_VIDEO_CAPTURE
1460
+ | V4L2_CAP_STREAMING;
1461
+ else
1462
+ video->video.device_caps = V4L2_CAP_VIDEO_OUTPUT
1463
+ | V4L2_CAP_STREAMING;
1464
+
14661465 video->pipe.stream_state = ISP_PIPELINE_STREAM_STOPPED;
14671466
14681467 video_set_drvdata(&video->video, video);
....@@ -1484,7 +1483,7 @@
14841483
14851484 video->video.v4l2_dev = vdev;
14861485
1487
- ret = video_register_device(&video->video, VFL_TYPE_GRABBER, -1);
1486
+ ret = video_register_device(&video->video, VFL_TYPE_VIDEO, -1);
14881487 if (ret < 0)
14891488 dev_err(video->isp->dev,
14901489 "%s: could not register video device (%d)\n",
....@@ -1495,6 +1494,5 @@
14951494
14961495 void omap3isp_video_unregister(struct isp_video *video)
14971496 {
1498
- if (video_is_registered(&video->video))
1499
- video_unregister_device(&video->video);
1497
+ video_unregister_device(&video->video);
15001498 }