.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * tw68 functions to handle video data |
---|
3 | 4 | * |
---|
.. | .. |
---|
13 | 14 | * Refactored and updated to the latest v4l core frameworks: |
---|
14 | 15 | * |
---|
15 | 16 | * 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. |
---|
26 | 17 | */ |
---|
27 | 18 | |
---|
28 | 19 | #include <linux/module.h> |
---|
.. | .. |
---|
43 | 34 | */ |
---|
44 | 35 | static const struct tw68_format formats[] = { |
---|
45 | 36 | { |
---|
46 | | - .name = "15 bpp RGB, le", |
---|
47 | 37 | .fourcc = V4L2_PIX_FMT_RGB555, |
---|
48 | 38 | .depth = 16, |
---|
49 | 39 | .twformat = ColorFormatRGB15, |
---|
50 | 40 | }, { |
---|
51 | | - .name = "15 bpp RGB, be", |
---|
52 | 41 | .fourcc = V4L2_PIX_FMT_RGB555X, |
---|
53 | 42 | .depth = 16, |
---|
54 | 43 | .twformat = ColorFormatRGB15 | ColorFormatBSWAP, |
---|
55 | 44 | }, { |
---|
56 | | - .name = "16 bpp RGB, le", |
---|
57 | 45 | .fourcc = V4L2_PIX_FMT_RGB565, |
---|
58 | 46 | .depth = 16, |
---|
59 | 47 | .twformat = ColorFormatRGB16, |
---|
60 | 48 | }, { |
---|
61 | | - .name = "16 bpp RGB, be", |
---|
62 | 49 | .fourcc = V4L2_PIX_FMT_RGB565X, |
---|
63 | 50 | .depth = 16, |
---|
64 | 51 | .twformat = ColorFormatRGB16 | ColorFormatBSWAP, |
---|
65 | 52 | }, { |
---|
66 | | - .name = "24 bpp RGB, le", |
---|
67 | 53 | .fourcc = V4L2_PIX_FMT_BGR24, |
---|
68 | 54 | .depth = 24, |
---|
69 | 55 | .twformat = ColorFormatRGB24, |
---|
70 | 56 | }, { |
---|
71 | | - .name = "24 bpp RGB, be", |
---|
72 | 57 | .fourcc = V4L2_PIX_FMT_RGB24, |
---|
73 | 58 | .depth = 24, |
---|
74 | 59 | .twformat = ColorFormatRGB24 | ColorFormatBSWAP, |
---|
75 | 60 | }, { |
---|
76 | | - .name = "32 bpp RGB, le", |
---|
77 | 61 | .fourcc = V4L2_PIX_FMT_BGR32, |
---|
78 | 62 | .depth = 32, |
---|
79 | 63 | .twformat = ColorFormatRGB32, |
---|
80 | 64 | }, { |
---|
81 | | - .name = "32 bpp RGB, be", |
---|
82 | 65 | .fourcc = V4L2_PIX_FMT_RGB32, |
---|
83 | 66 | .depth = 32, |
---|
84 | 67 | .twformat = ColorFormatRGB32 | ColorFormatBSWAP | |
---|
85 | 68 | ColorFormatWSWAP, |
---|
86 | 69 | }, { |
---|
87 | | - .name = "4:2:2 packed, YUYV", |
---|
88 | 70 | .fourcc = V4L2_PIX_FMT_YUYV, |
---|
89 | 71 | .depth = 16, |
---|
90 | 72 | .twformat = ColorFormatYUY2, |
---|
91 | 73 | }, { |
---|
92 | | - .name = "4:2:2 packed, UYVY", |
---|
93 | 74 | .fourcc = V4L2_PIX_FMT_UYVY, |
---|
94 | 75 | .depth = 16, |
---|
95 | 76 | .twformat = ColorFormatYUY2 | ColorFormatBSWAP, |
---|
.. | .. |
---|
446 | 427 | /* |
---|
447 | 428 | * buffer_prepare |
---|
448 | 429 | * |
---|
449 | | - * Set the ancilliary information into the buffer structure. This |
---|
| 430 | + * Set the ancillary information into the buffer structure. This |
---|
450 | 431 | * includes generating the necessary risc program if it hasn't already |
---|
451 | 432 | * been done for the current buffer format. |
---|
452 | 433 | * The structure fh contains the details of the format requested by the |
---|
.. | .. |
---|
601 | 582 | f->fmt.pix.sizeimage = |
---|
602 | 583 | f->fmt.pix.height * f->fmt.pix.bytesperline; |
---|
603 | 584 | f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; |
---|
604 | | - f->fmt.pix.priv = 0; |
---|
605 | 585 | return 0; |
---|
606 | 586 | } |
---|
607 | 587 | |
---|
.. | .. |
---|
734 | 714 | { |
---|
735 | 715 | struct tw68_dev *dev = video_drvdata(file); |
---|
736 | 716 | |
---|
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", |
---|
739 | 719 | sizeof(cap->card)); |
---|
740 | 720 | 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; |
---|
747 | 721 | return 0; |
---|
748 | 722 | } |
---|
749 | 723 | |
---|
.. | .. |
---|
788 | 762 | { |
---|
789 | 763 | if (f->index >= FORMATS) |
---|
790 | 764 | return -EINVAL; |
---|
791 | | - |
---|
792 | | - strlcpy(f->description, formats[f->index].name, |
---|
793 | | - sizeof(f->description)); |
---|
794 | 765 | |
---|
795 | 766 | f->pixelformat = formats[f->index].fourcc; |
---|
796 | 767 | |
---|
.. | .. |
---|
922 | 893 | .ioctl_ops = &video_ioctl_ops, |
---|
923 | 894 | .release = video_device_release_empty, |
---|
924 | 895 | .tvnorms = TW68_NORMS, |
---|
| 896 | + .device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | |
---|
| 897 | + V4L2_CAP_STREAMING, |
---|
925 | 898 | }; |
---|
926 | 899 | |
---|
927 | 900 | /* ------------------------------------------------------------------ */ |
---|
.. | .. |
---|
989 | 962 | dev->vdev.lock = &dev->lock; |
---|
990 | 963 | dev->vdev.queue = &dev->vidq; |
---|
991 | 964 | 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); |
---|
993 | 966 | } |
---|
994 | 967 | |
---|
995 | 968 | /* |
---|