| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Mirics MSi2500 driver |
|---|
| 3 | 4 | * Mirics MSi3101 SDR Dongle driver |
|---|
| 4 | 5 | * |
|---|
| 5 | 6 | * Copyright (C) 2013 Antti Palosaari <crope@iki.fi> |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 8 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 9 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 10 | | - * (at your option) any later version. |
|---|
| 11 | | - * |
|---|
| 12 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 13 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | | - * GNU General Public License for more details. |
|---|
| 16 | 7 | * |
|---|
| 17 | 8 | * That driver is somehow based of pwc driver: |
|---|
| 18 | 9 | * (C) 1999-2004 Nemosoft Unv. |
|---|
| .. | .. |
|---|
| 75 | 66 | |
|---|
| 76 | 67 | /* stream formats */ |
|---|
| 77 | 68 | struct msi2500_format { |
|---|
| 78 | | - char *name; |
|---|
| 79 | 69 | u32 pixelformat; |
|---|
| 80 | 70 | u32 buffersize; |
|---|
| 81 | 71 | }; |
|---|
| .. | .. |
|---|
| 83 | 73 | /* format descriptions for capture and preview */ |
|---|
| 84 | 74 | static struct msi2500_format formats[] = { |
|---|
| 85 | 75 | { |
|---|
| 86 | | - .name = "Complex S8", |
|---|
| 87 | 76 | .pixelformat = V4L2_SDR_FMT_CS8, |
|---|
| 88 | 77 | .buffersize = 3 * 1008, |
|---|
| 89 | 78 | #if 0 |
|---|
| 90 | 79 | }, { |
|---|
| 91 | | - .name = "10+2-bit signed", |
|---|
| 92 | 80 | .pixelformat = MSI2500_PIX_FMT_SDR_MSI2500_384, |
|---|
| 93 | 81 | }, { |
|---|
| 94 | | - .name = "12-bit signed", |
|---|
| 95 | 82 | .pixelformat = MSI2500_PIX_FMT_SDR_S12, |
|---|
| 96 | 83 | #endif |
|---|
| 97 | 84 | }, { |
|---|
| 98 | | - .name = "Complex S14LE", |
|---|
| 99 | 85 | .pixelformat = V4L2_SDR_FMT_CS14LE, |
|---|
| 100 | 86 | .buffersize = 3 * 1008, |
|---|
| 101 | 87 | }, { |
|---|
| 102 | | - .name = "Complex U8 (emulated)", |
|---|
| 103 | 88 | .pixelformat = V4L2_SDR_FMT_CU8, |
|---|
| 104 | 89 | .buffersize = 3 * 1008, |
|---|
| 105 | 90 | }, { |
|---|
| 106 | | - .name = "Complex U16LE (emulated)", |
|---|
| 107 | 91 | .pixelformat = V4L2_SDR_FMT_CU16LE, |
|---|
| 108 | 92 | .buffersize = 3 * 1008, |
|---|
| 109 | 93 | }, |
|---|
| .. | .. |
|---|
| 604 | 588 | |
|---|
| 605 | 589 | dev_dbg(dev->dev, "\n"); |
|---|
| 606 | 590 | |
|---|
| 607 | | - strlcpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver)); |
|---|
| 608 | | - strlcpy(cap->card, dev->vdev.name, sizeof(cap->card)); |
|---|
| 591 | + strscpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver)); |
|---|
| 592 | + strscpy(cap->card, dev->vdev.name, sizeof(cap->card)); |
|---|
| 609 | 593 | usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info)); |
|---|
| 610 | | - cap->device_caps = V4L2_CAP_SDR_CAPTURE | V4L2_CAP_STREAMING | |
|---|
| 611 | | - V4L2_CAP_READWRITE | V4L2_CAP_TUNER; |
|---|
| 612 | | - cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; |
|---|
| 613 | 594 | return 0; |
|---|
| 614 | 595 | } |
|---|
| 615 | 596 | |
|---|
| .. | .. |
|---|
| 916 | 897 | if (f->index >= dev->num_formats) |
|---|
| 917 | 898 | return -EINVAL; |
|---|
| 918 | 899 | |
|---|
| 919 | | - strlcpy(f->description, formats[f->index].name, sizeof(f->description)); |
|---|
| 920 | 900 | f->pixelformat = formats[f->index].pixelformat; |
|---|
| 921 | 901 | |
|---|
| 922 | 902 | return 0; |
|---|
| .. | .. |
|---|
| 1017 | 997 | dev_dbg(dev->dev, "index=%d\n", v->index); |
|---|
| 1018 | 998 | |
|---|
| 1019 | 999 | if (v->index == 0) { |
|---|
| 1020 | | - strlcpy(v->name, "Mirics MSi2500", sizeof(v->name)); |
|---|
| 1000 | + strscpy(v->name, "Mirics MSi2500", sizeof(v->name)); |
|---|
| 1021 | 1001 | v->type = V4L2_TUNER_ADC; |
|---|
| 1022 | 1002 | v->capability = V4L2_TUNER_CAP_1HZ | V4L2_TUNER_CAP_FREQ_BANDS; |
|---|
| 1023 | 1003 | v->rangelow = 1200000; |
|---|
| .. | .. |
|---|
| 1278 | 1258 | } |
|---|
| 1279 | 1259 | |
|---|
| 1280 | 1260 | /* currently all controls are from subdev */ |
|---|
| 1281 | | - v4l2_ctrl_add_handler(&dev->hdl, sd->ctrl_handler, NULL); |
|---|
| 1261 | + v4l2_ctrl_add_handler(&dev->hdl, sd->ctrl_handler, NULL, true); |
|---|
| 1282 | 1262 | |
|---|
| 1283 | 1263 | dev->v4l2_dev.ctrl_handler = &dev->hdl; |
|---|
| 1284 | 1264 | dev->vdev.v4l2_dev = &dev->v4l2_dev; |
|---|
| 1285 | 1265 | dev->vdev.lock = &dev->v4l2_lock; |
|---|
| 1266 | + dev->vdev.device_caps = V4L2_CAP_SDR_CAPTURE | V4L2_CAP_STREAMING | |
|---|
| 1267 | + V4L2_CAP_READWRITE | V4L2_CAP_TUNER; |
|---|
| 1286 | 1268 | |
|---|
| 1287 | 1269 | ret = video_register_device(&dev->vdev, VFL_TYPE_SDR, -1); |
|---|
| 1288 | 1270 | if (ret) { |
|---|