forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/media/usb/s2255/s2255drv.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * s2255drv.c - a driver for the Sensoray 2255 USB video capture device
34 *
....@@ -20,16 +21,6 @@
2021 * -half size, color mode YUYV or YUV422P: all 4 channels at once
2122 * -full size, color mode YUYV or YUV422P 1/2 frame rate: all 4 channels
2223 * at once.
23
- *
24
- * This program is free software; you can redistribute it and/or modify
25
- * it under the terms of the GNU General Public License as published by
26
- * the Free Software Foundation; either version 2 of the License, or
27
- * (at your option) any later version.
28
- *
29
- * This program is distributed in the hope that it will be useful,
30
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
31
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32
- * GNU General Public License for more details.
3324 */
3425
3526 #include <linux/module.h>
....@@ -282,7 +273,6 @@
282273 }
283274
284275 struct s2255_fmt {
285
- char *name;
286276 u32 fourcc;
287277 int depth;
288278 };
....@@ -394,29 +384,23 @@
394384 /* JPEG formats must be defined last to support jpeg_enable parameter */
395385 static const struct s2255_fmt formats[] = {
396386 {
397
- .name = "4:2:2, packed, YUYV",
398387 .fourcc = V4L2_PIX_FMT_YUYV,
399388 .depth = 16
400389
401390 }, {
402
- .name = "4:2:2, packed, UYVY",
403391 .fourcc = V4L2_PIX_FMT_UYVY,
404392 .depth = 16
405393 }, {
406
- .name = "4:2:2, planar, YUV422P",
407394 .fourcc = V4L2_PIX_FMT_YUV422P,
408395 .depth = 16
409396
410397 }, {
411
- .name = "8bpp GREY",
412398 .fourcc = V4L2_PIX_FMT_GREY,
413399 .depth = 8
414400 }, {
415
- .name = "JPG",
416401 .fourcc = V4L2_PIX_FMT_JPEG,
417402 .depth = 24
418403 }, {
419
- .name = "MJPG",
420404 .fourcc = V4L2_PIX_FMT_MJPEG,
421405 .depth = 24
422406 }
....@@ -730,12 +714,9 @@
730714 struct s2255_vc *vc = video_drvdata(file);
731715 struct s2255_dev *dev = vc->dev;
732716
733
- strlcpy(cap->driver, "s2255", sizeof(cap->driver));
734
- strlcpy(cap->card, "s2255", sizeof(cap->card));
717
+ strscpy(cap->driver, "s2255", sizeof(cap->driver));
718
+ strscpy(cap->card, "s2255", sizeof(cap->card));
735719 usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info));
736
- cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING |
737
- V4L2_CAP_READWRITE;
738
- cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
739720 return 0;
740721 }
741722
....@@ -749,7 +730,6 @@
749730 if (!jpeg_enable && ((formats[index].fourcc == V4L2_PIX_FMT_JPEG) ||
750731 (formats[index].fourcc == V4L2_PIX_FMT_MJPEG)))
751732 return -EINVAL;
752
- strlcpy(f->description, formats[index].name, sizeof(f->description));
753733 f->pixelformat = formats[index].fourcc;
754734 return 0;
755735 }
....@@ -771,7 +751,6 @@
771751 f->fmt.pix.bytesperline = f->fmt.pix.width * (vc->fmt->depth >> 3);
772752 f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline;
773753 f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
774
- f->fmt.pix.priv = 0;
775754 return 0;
776755 }
777756
....@@ -823,7 +802,6 @@
823802 f->fmt.pix.bytesperline = (f->fmt.pix.width * fmt->depth) >> 3;
824803 f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline;
825804 f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
826
- f->fmt.pix.priv = 0;
827805 dprintk(vc->dev, 50, "%s: set width %d height %d field %d\n", __func__,
828806 f->fmt.pix.width, f->fmt.pix.height, f->fmt.pix.field);
829807 return 0;
....@@ -1195,10 +1173,10 @@
11951173 switch (dev->pid) {
11961174 case 0x2255:
11971175 default:
1198
- strlcpy(inp->name, "Composite", sizeof(inp->name));
1176
+ strscpy(inp->name, "Composite", sizeof(inp->name));
11991177 break;
12001178 case 0x2257:
1201
- strlcpy(inp->name, (vc->idx < 2) ? "Composite" : "S-Video",
1179
+ strscpy(inp->name, (vc->idx < 2) ? "Composite" : "S-Video",
12021180 sizeof(inp->name));
12031181 break;
12041182 }
....@@ -1666,14 +1644,16 @@
16661644 vc->vdev.ctrl_handler = &vc->hdl;
16671645 vc->vdev.lock = &dev->lock;
16681646 vc->vdev.v4l2_dev = &dev->v4l2_dev;
1647
+ vc->vdev.device_caps = V4L2_CAP_VIDEO_CAPTURE |
1648
+ V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
16691649 video_set_drvdata(&vc->vdev, vc);
16701650 if (video_nr == -1)
16711651 ret = video_register_device(&vc->vdev,
1672
- VFL_TYPE_GRABBER,
1652
+ VFL_TYPE_VIDEO,
16731653 video_nr);
16741654 else
16751655 ret = video_register_device(&vc->vdev,
1676
- VFL_TYPE_GRABBER,
1656
+ VFL_TYPE_VIDEO,
16771657 cur_nr + i);
16781658
16791659 if (ret) {