hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/drivers/media/platform/fsl-viu.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright 2008-2010 Freescale Semiconductor, Inc. All Rights Reserved.
34 *
....@@ -6,12 +7,6 @@
67 * Authors: Hongjun Chen <hong-jun.chen@freescale.com>
78 * Porting to 2.6.35 by DENX Software Engineering,
89 * Anatolij Gustschin <agust@denx.de>
9
- *
10
- * This program is free software; you can redistribute it and/or modify it
11
- * under the terms of the GNU General Public License as published by the
12
- * Free Software Foundation; either version 2 of the License, or (at your
13
- * option) any later version.
14
- *
1510 */
1611
1712 #include <linux/module.h>
....@@ -37,7 +32,7 @@
3732 #define VIU_VERSION "0.5.1"
3833
3934 /* Allow building this driver with COMPILE_TEST */
40
-#if !defined(CONFIG_PPC) && !defined(CONFIG_MICROBLAZE)
35
+#if !defined(CONFIG_PPC) && !defined(CONFIG_MICROBLAZE) && !defined(CONFIG_M68K)
4136 #define out_be32(v, a) iowrite32be(a, (void __iomem *)v)
4237 #define in_be32(a) ioread32be((void __iomem *)a)
4338 #endif
....@@ -219,7 +214,7 @@
219214 FIELD_NO = 0x01 << 28, /* Field number */
220215 DITHER_ON = 0x01 << 29, /* Dithering is on */
221216 ROUND_ON = 0x01 << 30, /* Round is on */
222
- MODE_32BIT = 0x01 << 31, /* Data in RGBa888,
217
+ MODE_32BIT = 1UL << 31, /* Data in RGBa888,
223218 * 0 in RGB565
224219 */
225220 };
....@@ -565,14 +560,9 @@
565560 static int vidioc_querycap(struct file *file, void *priv,
566561 struct v4l2_capability *cap)
567562 {
568
- strcpy(cap->driver, "viu");
569
- strcpy(cap->card, "viu");
570
- strcpy(cap->bus_info, "platform:viu");
571
- cap->device_caps = V4L2_CAP_VIDEO_CAPTURE |
572
- V4L2_CAP_STREAMING |
573
- V4L2_CAP_VIDEO_OVERLAY |
574
- V4L2_CAP_READWRITE;
575
- cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
563
+ strscpy(cap->driver, "viu", sizeof(cap->driver));
564
+ strscpy(cap->card, "viu", sizeof(cap->card));
565
+ strscpy(cap->bus_info, "platform:viu", sizeof(cap->bus_info));
576566 return 0;
577567 }
578568
....@@ -941,7 +931,7 @@
941931
942932 inp->type = V4L2_INPUT_TYPE_CAMERA;
943933 inp->std = fh->dev->vdev->tvnorms;
944
- strcpy(inp->name, "Camera");
934
+ strscpy(inp->name, "Camera", sizeof(inp->name));
945935 return 0;
946936 }
947937
....@@ -1090,7 +1080,7 @@
10901080
10911081 if (waitqueue_active(&buf->vb.done)) {
10921082 list_del(&buf->vb.queue);
1093
- v4l2_get_timestamp(&buf->vb.ts);
1083
+ buf->vb.ts = ktime_get_ns();
10941084 buf->vb.state = VIDEOBUF_DONE;
10951085 buf->vb.field_count++;
10961086 wake_up(&buf->vb.done);
....@@ -1385,6 +1375,8 @@
13851375 .release = video_device_release,
13861376
13871377 .tvnorms = V4L2_STD_NTSC_M | V4L2_STD_PAL,
1378
+ .device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING |
1379
+ V4L2_CAP_VIDEO_OVERLAY | V4L2_CAP_READWRITE,
13881380 };
13891381
13901382 static int viu_of_probe(struct platform_device *op)
....@@ -1494,7 +1486,7 @@
14941486
14951487 mutex_lock(&viu_dev->lock);
14961488
1497
- ret = video_register_device(viu_dev->vdev, VFL_TYPE_GRABBER, -1);
1489
+ ret = video_register_device(viu_dev->vdev, VFL_TYPE_VIDEO, -1);
14981490 if (ret < 0) {
14991491 video_device_release(viu_dev->vdev);
15001492 goto err_unlock;