.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Driver for the Conexant CX25821 PCIe bridge |
---|
3 | 4 | * |
---|
.. | .. |
---|
6 | 7 | * Based on Steven Toth <stoth@linuxtv.org> cx25821 driver |
---|
7 | 8 | * Parts adapted/taken from Eduardo Moscoso Rubino |
---|
8 | 9 | * Copyright (C) 2009 Eduardo Moscoso Rubino <moscoso@TopoLogica.com> |
---|
9 | | - * |
---|
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 as published by |
---|
13 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
14 | | - * (at your option) any later version. |
---|
15 | | - * |
---|
16 | | - * This program is distributed in the hope that it will be useful, |
---|
17 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
18 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
19 | | - * |
---|
20 | | - * GNU General Public License for more details. |
---|
21 | 10 | */ |
---|
22 | 11 | |
---|
23 | 12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
---|
.. | .. |
---|
46 | 35 | |
---|
47 | 36 | static const struct cx25821_fmt formats[] = { |
---|
48 | 37 | { |
---|
49 | | - .name = "4:1:1, packed, Y41P", |
---|
50 | 38 | .fourcc = V4L2_PIX_FMT_Y41P, |
---|
51 | 39 | .depth = 12, |
---|
52 | 40 | .flags = FORMAT_FLAGS_PACKED, |
---|
53 | 41 | }, { |
---|
54 | | - .name = "4:2:2, packed, YUYV", |
---|
55 | 42 | .fourcc = V4L2_PIX_FMT_YUYV, |
---|
56 | 43 | .depth = 16, |
---|
57 | 44 | .flags = FORMAT_FLAGS_PACKED, |
---|
.. | .. |
---|
226 | 213 | break; |
---|
227 | 214 | } |
---|
228 | 215 | |
---|
229 | | - dprintk(2, "[%p/%d] buffer_prep - %dx%d %dbpp \"%s\" - dma=0x%08lx\n", |
---|
| 216 | + dprintk(2, "[%p/%d] buffer_prep - %dx%d %dbpp 0x%08x - dma=0x%08lx\n", |
---|
230 | 217 | buf, buf->vb.vb2_buf.index, chan->width, chan->height, |
---|
231 | | - chan->fmt->depth, chan->fmt->name, |
---|
| 218 | + chan->fmt->depth, chan->fmt->fourcc, |
---|
232 | 219 | (unsigned long)buf->risc.dma); |
---|
233 | 220 | |
---|
234 | 221 | return ret; |
---|
.. | .. |
---|
322 | 309 | if (unlikely(f->index >= ARRAY_SIZE(formats))) |
---|
323 | 310 | return -EINVAL; |
---|
324 | 311 | |
---|
325 | | - strlcpy(f->description, formats[f->index].name, sizeof(f->description)); |
---|
326 | 312 | f->pixelformat = formats[f->index].fourcc; |
---|
327 | 313 | |
---|
328 | 314 | return 0; |
---|
.. | .. |
---|
437 | 423 | { |
---|
438 | 424 | struct cx25821_channel *chan = video_drvdata(file); |
---|
439 | 425 | struct cx25821_dev *dev = chan->dev; |
---|
440 | | - const u32 cap_input = V4L2_CAP_VIDEO_CAPTURE | |
---|
441 | | - V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; |
---|
442 | | - const u32 cap_output = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_READWRITE; |
---|
443 | 426 | |
---|
444 | | - strcpy(cap->driver, "cx25821"); |
---|
445 | | - strlcpy(cap->card, cx25821_boards[dev->board].name, sizeof(cap->card)); |
---|
| 427 | + strscpy(cap->driver, "cx25821", sizeof(cap->driver)); |
---|
| 428 | + strscpy(cap->card, cx25821_boards[dev->board].name, sizeof(cap->card)); |
---|
446 | 429 | sprintf(cap->bus_info, "PCIe:%s", pci_name(dev->pci)); |
---|
447 | | - if (chan->id >= VID_CHANNEL_NUM) |
---|
448 | | - cap->device_caps = cap_output; |
---|
449 | | - else |
---|
450 | | - cap->device_caps = cap_input; |
---|
451 | | - cap->capabilities = cap_input | cap_output | V4L2_CAP_DEVICE_CAPS; |
---|
| 430 | + cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUTPUT | |
---|
| 431 | + V4L2_CAP_READWRITE | V4L2_CAP_STREAMING | |
---|
| 432 | + V4L2_CAP_DEVICE_CAPS; |
---|
452 | 433 | return 0; |
---|
453 | 434 | } |
---|
454 | 435 | |
---|
.. | .. |
---|
486 | 467 | |
---|
487 | 468 | i->type = V4L2_INPUT_TYPE_CAMERA; |
---|
488 | 469 | i->std = CX25821_NORMS; |
---|
489 | | - strcpy(i->name, "Composite"); |
---|
| 470 | + strscpy(i->name, "Composite", sizeof(i->name)); |
---|
490 | 471 | return 0; |
---|
491 | 472 | } |
---|
492 | 473 | |
---|
.. | .. |
---|
534 | 515 | |
---|
535 | 516 | o->type = V4L2_INPUT_TYPE_CAMERA; |
---|
536 | 517 | o->std = CX25821_NORMS; |
---|
537 | | - strcpy(o->name, "Composite"); |
---|
| 518 | + strscpy(o->name, "Composite", sizeof(o->name)); |
---|
538 | 519 | return 0; |
---|
539 | 520 | } |
---|
540 | 521 | |
---|
.. | .. |
---|
635 | 616 | .minor = -1, |
---|
636 | 617 | .ioctl_ops = &video_ioctl_ops, |
---|
637 | 618 | .tvnorms = CX25821_NORMS, |
---|
| 619 | + .device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | |
---|
| 620 | + V4L2_CAP_STREAMING, |
---|
638 | 621 | }; |
---|
639 | 622 | |
---|
640 | 623 | static const struct v4l2_file_operations video_out_fops = { |
---|
.. | .. |
---|
668 | 651 | .minor = -1, |
---|
669 | 652 | .ioctl_ops = &video_out_ioctl_ops, |
---|
670 | 653 | .tvnorms = CX25821_NORMS, |
---|
| 654 | + .device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_READWRITE, |
---|
671 | 655 | }; |
---|
672 | 656 | |
---|
673 | 657 | void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num) |
---|
.. | .. |
---|
773 | 757 | snprintf(vdev->name, sizeof(vdev->name), "%s #%d", dev->name, i); |
---|
774 | 758 | video_set_drvdata(vdev, chan); |
---|
775 | 759 | |
---|
776 | | - err = video_register_device(vdev, VFL_TYPE_GRABBER, |
---|
| 760 | + err = video_register_device(vdev, VFL_TYPE_VIDEO, |
---|
777 | 761 | video_nr[dev->nr]); |
---|
778 | 762 | |
---|
779 | 763 | if (err < 0) |
---|