hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/drivers/media/pci/tw68/tw68-video.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * tw68 functions to handle video data
34 *
....@@ -13,16 +14,6 @@
1314 * Refactored and updated to the latest v4l core frameworks:
1415 *
1516 * Copyright (C) 2014 Hans Verkuil <hverkuil@xs4all.nl>
16
- *
17
- * This program is free software; you can redistribute it and/or modify
18
- * it under the terms of the GNU General Public License as published by
19
- * the Free Software Foundation; either version 2 of the License, or
20
- * (at your option) any later version.
21
- *
22
- * This program is distributed in the hope that it will be useful,
23
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
- * GNU General Public License for more details.
2617 */
2718
2819 #include <linux/module.h>
....@@ -43,53 +34,43 @@
4334 */
4435 static const struct tw68_format formats[] = {
4536 {
46
- .name = "15 bpp RGB, le",
4737 .fourcc = V4L2_PIX_FMT_RGB555,
4838 .depth = 16,
4939 .twformat = ColorFormatRGB15,
5040 }, {
51
- .name = "15 bpp RGB, be",
5241 .fourcc = V4L2_PIX_FMT_RGB555X,
5342 .depth = 16,
5443 .twformat = ColorFormatRGB15 | ColorFormatBSWAP,
5544 }, {
56
- .name = "16 bpp RGB, le",
5745 .fourcc = V4L2_PIX_FMT_RGB565,
5846 .depth = 16,
5947 .twformat = ColorFormatRGB16,
6048 }, {
61
- .name = "16 bpp RGB, be",
6249 .fourcc = V4L2_PIX_FMT_RGB565X,
6350 .depth = 16,
6451 .twformat = ColorFormatRGB16 | ColorFormatBSWAP,
6552 }, {
66
- .name = "24 bpp RGB, le",
6753 .fourcc = V4L2_PIX_FMT_BGR24,
6854 .depth = 24,
6955 .twformat = ColorFormatRGB24,
7056 }, {
71
- .name = "24 bpp RGB, be",
7257 .fourcc = V4L2_PIX_FMT_RGB24,
7358 .depth = 24,
7459 .twformat = ColorFormatRGB24 | ColorFormatBSWAP,
7560 }, {
76
- .name = "32 bpp RGB, le",
7761 .fourcc = V4L2_PIX_FMT_BGR32,
7862 .depth = 32,
7963 .twformat = ColorFormatRGB32,
8064 }, {
81
- .name = "32 bpp RGB, be",
8265 .fourcc = V4L2_PIX_FMT_RGB32,
8366 .depth = 32,
8467 .twformat = ColorFormatRGB32 | ColorFormatBSWAP |
8568 ColorFormatWSWAP,
8669 }, {
87
- .name = "4:2:2 packed, YUYV",
8870 .fourcc = V4L2_PIX_FMT_YUYV,
8971 .depth = 16,
9072 .twformat = ColorFormatYUY2,
9173 }, {
92
- .name = "4:2:2 packed, UYVY",
9374 .fourcc = V4L2_PIX_FMT_UYVY,
9475 .depth = 16,
9576 .twformat = ColorFormatYUY2 | ColorFormatBSWAP,
....@@ -446,7 +427,7 @@
446427 /*
447428 * buffer_prepare
448429 *
449
- * Set the ancilliary information into the buffer structure. This
430
+ * Set the ancillary information into the buffer structure. This
450431 * includes generating the necessary risc program if it hasn't already
451432 * been done for the current buffer format.
452433 * The structure fh contains the details of the format requested by the
....@@ -601,7 +582,6 @@
601582 f->fmt.pix.sizeimage =
602583 f->fmt.pix.height * f->fmt.pix.bytesperline;
603584 f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
604
- f->fmt.pix.priv = 0;
605585 return 0;
606586 }
607587
....@@ -734,16 +714,10 @@
734714 {
735715 struct tw68_dev *dev = video_drvdata(file);
736716
737
- strcpy(cap->driver, "tw68");
738
- strlcpy(cap->card, "Techwell Capture Card",
717
+ strscpy(cap->driver, "tw68", sizeof(cap->driver));
718
+ strscpy(cap->card, "Techwell Capture Card",
739719 sizeof(cap->card));
740720 sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci));
741
- cap->device_caps =
742
- V4L2_CAP_VIDEO_CAPTURE |
743
- V4L2_CAP_READWRITE |
744
- V4L2_CAP_STREAMING;
745
-
746
- cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
747721 return 0;
748722 }
749723
....@@ -788,9 +762,6 @@
788762 {
789763 if (f->index >= FORMATS)
790764 return -EINVAL;
791
-
792
- strlcpy(f->description, formats[f->index].name,
793
- sizeof(f->description));
794765
795766 f->pixelformat = formats[f->index].fourcc;
796767
....@@ -922,6 +893,8 @@
922893 .ioctl_ops = &video_ioctl_ops,
923894 .release = video_device_release_empty,
924895 .tvnorms = TW68_NORMS,
896
+ .device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
897
+ V4L2_CAP_STREAMING,
925898 };
926899
927900 /* ------------------------------------------------------------------ */
....@@ -989,7 +962,7 @@
989962 dev->vdev.lock = &dev->lock;
990963 dev->vdev.queue = &dev->vidq;
991964 video_set_drvdata(&dev->vdev, dev);
992
- return video_register_device(&dev->vdev, VFL_TYPE_GRABBER, video_nr);
965
+ return video_register_device(&dev->vdev, VFL_TYPE_VIDEO, video_nr);
993966 }
994967
995968 /*