| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * Support for a cx23417 mpeg encoder via cx23885 host port. |
|---|
| .. | .. |
|---|
| 8 | 9 | * - CX23885/7/8 support |
|---|
| 9 | 10 | * |
|---|
| 10 | 11 | * Includes parts from the ivtv driver <http://sourceforge.net/projects/ivtv/> |
|---|
| 11 | | - * |
|---|
| 12 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 13 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 14 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 15 | | - * (at your option) any later version. |
|---|
| 16 | | - * |
|---|
| 17 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 18 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 19 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 20 | | - * GNU General Public License for more details. |
|---|
| 21 | 12 | */ |
|---|
| 22 | 13 | |
|---|
| 23 | 14 | #include "cx23885.h" |
|---|
| .. | .. |
|---|
| 1280 | 1271 | return -EINVAL; |
|---|
| 1281 | 1272 | if (0 != t->index) |
|---|
| 1282 | 1273 | return -EINVAL; |
|---|
| 1283 | | - strcpy(t->name, "Television"); |
|---|
| 1274 | + strscpy(t->name, "Television", sizeof(t->name)); |
|---|
| 1284 | 1275 | call_all(dev, tuner, g_tuner, t); |
|---|
| 1285 | 1276 | |
|---|
| 1286 | 1277 | dprintk(1, "VIDIOC_G_TUNER: tuner type %d\n", t->type); |
|---|
| .. | .. |
|---|
| 1329 | 1320 | struct cx23885_dev *dev = video_drvdata(file); |
|---|
| 1330 | 1321 | struct cx23885_tsport *tsport = &dev->ts1; |
|---|
| 1331 | 1322 | |
|---|
| 1332 | | - strlcpy(cap->driver, dev->name, sizeof(cap->driver)); |
|---|
| 1333 | | - strlcpy(cap->card, cx23885_boards[tsport->dev->board].name, |
|---|
| 1323 | + strscpy(cap->driver, dev->name, sizeof(cap->driver)); |
|---|
| 1324 | + strscpy(cap->card, cx23885_boards[tsport->dev->board].name, |
|---|
| 1334 | 1325 | sizeof(cap->card)); |
|---|
| 1335 | 1326 | sprintf(cap->bus_info, "PCIe:%s", pci_name(dev->pci)); |
|---|
| 1336 | | - cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | |
|---|
| 1337 | | - V4L2_CAP_STREAMING; |
|---|
| 1327 | + cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | |
|---|
| 1328 | + V4L2_CAP_STREAMING | V4L2_CAP_VBI_CAPTURE | |
|---|
| 1329 | + V4L2_CAP_AUDIO | V4L2_CAP_DEVICE_CAPS; |
|---|
| 1338 | 1330 | if (dev->tuner_type != TUNER_ABSENT) |
|---|
| 1339 | | - cap->device_caps |= V4L2_CAP_TUNER; |
|---|
| 1340 | | - cap->capabilities = cap->device_caps | V4L2_CAP_VBI_CAPTURE | |
|---|
| 1341 | | - V4L2_CAP_AUDIO | V4L2_CAP_DEVICE_CAPS; |
|---|
| 1331 | + cap->capabilities |= V4L2_CAP_TUNER; |
|---|
| 1342 | 1332 | |
|---|
| 1343 | 1333 | return 0; |
|---|
| 1344 | 1334 | } |
|---|
| .. | .. |
|---|
| 1349 | 1339 | if (f->index != 0) |
|---|
| 1350 | 1340 | return -EINVAL; |
|---|
| 1351 | 1341 | |
|---|
| 1352 | | - strlcpy(f->description, "MPEG", sizeof(f->description)); |
|---|
| 1353 | 1342 | f->pixelformat = V4L2_PIX_FMT_MPEG; |
|---|
| 1354 | 1343 | |
|---|
| 1355 | 1344 | return 0; |
|---|
| .. | .. |
|---|
| 1527 | 1516 | dev->cxhdl.priv = dev; |
|---|
| 1528 | 1517 | dev->cxhdl.func = cx23885_api_func; |
|---|
| 1529 | 1518 | cx2341x_handler_set_50hz(&dev->cxhdl, tsport->height == 576); |
|---|
| 1530 | | - v4l2_ctrl_add_handler(&dev->ctrl_handler, &dev->cxhdl.hdl, NULL); |
|---|
| 1519 | + v4l2_ctrl_add_handler(&dev->ctrl_handler, &dev->cxhdl.hdl, NULL, false); |
|---|
| 1531 | 1520 | |
|---|
| 1532 | 1521 | /* Allocate and initialize V4L video device */ |
|---|
| 1533 | 1522 | dev->v4l_device = cx23885_video_dev_alloc(tsport, |
|---|
| .. | .. |
|---|
| 1551 | 1540 | video_set_drvdata(dev->v4l_device, dev); |
|---|
| 1552 | 1541 | dev->v4l_device->lock = &dev->lock; |
|---|
| 1553 | 1542 | dev->v4l_device->queue = q; |
|---|
| 1543 | + dev->v4l_device->device_caps = V4L2_CAP_VIDEO_CAPTURE | |
|---|
| 1544 | + V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; |
|---|
| 1545 | + if (dev->tuner_type != TUNER_ABSENT) |
|---|
| 1546 | + dev->v4l_device->device_caps |= V4L2_CAP_TUNER; |
|---|
| 1554 | 1547 | err = video_register_device(dev->v4l_device, |
|---|
| 1555 | | - VFL_TYPE_GRABBER, -1); |
|---|
| 1548 | + VFL_TYPE_VIDEO, -1); |
|---|
| 1556 | 1549 | if (err < 0) { |
|---|
| 1557 | 1550 | pr_info("%s: can't register mpeg device\n", dev->name); |
|---|
| 1558 | 1551 | return err; |
|---|
| .. | .. |
|---|
| 1561 | 1554 | pr_info("%s: registered device %s [mpeg]\n", |
|---|
| 1562 | 1555 | dev->name, video_device_node_name(dev->v4l_device)); |
|---|
| 1563 | 1556 | |
|---|
| 1564 | | - /* ST: Configure the encoder paramaters, but don't begin |
|---|
| 1557 | + /* ST: Configure the encoder parameters, but don't begin |
|---|
| 1565 | 1558 | * encoding, this resolves an issue where the first time the |
|---|
| 1566 | 1559 | * encoder is started video can be choppy. |
|---|
| 1567 | 1560 | */ |
|---|