| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * cx18 ioctl system call |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> |
|---|
| 7 | 8 | * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 10 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 11 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 12 | | - * (at your option) any later version. |
|---|
| 13 | | - * |
|---|
| 14 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 15 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 16 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 17 | | - * GNU General Public License for more details. |
|---|
| 18 | 9 | */ |
|---|
| 19 | 10 | |
|---|
| 20 | 11 | #include "cx18-driver.h" |
|---|
| .. | .. |
|---|
| 87 | 78 | return 0; |
|---|
| 88 | 79 | } |
|---|
| 89 | 80 | for (i = 0; i < 32; i++) { |
|---|
| 90 | | - if ((1 << i) & set) |
|---|
| 81 | + if (BIT(i) & set) |
|---|
| 91 | 82 | return 1 << i; |
|---|
| 92 | 83 | } |
|---|
| 93 | 84 | return 0; |
|---|
| .. | .. |
|---|
| 394 | 385 | struct v4l2_capability *vcap) |
|---|
| 395 | 386 | { |
|---|
| 396 | 387 | struct cx18_open_id *id = fh2id(fh); |
|---|
| 397 | | - struct cx18_stream *s = video_drvdata(file); |
|---|
| 398 | 388 | struct cx18 *cx = id->cx; |
|---|
| 399 | 389 | |
|---|
| 400 | | - strlcpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver)); |
|---|
| 401 | | - strlcpy(vcap->card, cx->card_name, sizeof(vcap->card)); |
|---|
| 390 | + strscpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver)); |
|---|
| 391 | + strscpy(vcap->card, cx->card_name, sizeof(vcap->card)); |
|---|
| 402 | 392 | snprintf(vcap->bus_info, sizeof(vcap->bus_info), |
|---|
| 403 | 393 | "PCI:%s", pci_name(cx->pci_dev)); |
|---|
| 404 | | - vcap->capabilities = cx->v4l2_cap; /* capabilities */ |
|---|
| 405 | | - vcap->device_caps = s->v4l2_dev_caps; /* device capabilities */ |
|---|
| 406 | | - vcap->capabilities |= V4L2_CAP_DEVICE_CAPS; |
|---|
| 394 | + vcap->capabilities = cx->v4l2_cap | V4L2_CAP_DEVICE_CAPS; |
|---|
| 407 | 395 | return 0; |
|---|
| 408 | 396 | } |
|---|
| 409 | 397 | |
|---|
| .. | .. |
|---|
| 441 | 429 | return cx18_get_input(cx, vin->index, vin); |
|---|
| 442 | 430 | } |
|---|
| 443 | 431 | |
|---|
| 444 | | -static int cx18_cropcap(struct file *file, void *fh, |
|---|
| 445 | | - struct v4l2_cropcap *cropcap) |
|---|
| 432 | +static int cx18_g_pixelaspect(struct file *file, void *fh, |
|---|
| 433 | + int type, struct v4l2_fract *f) |
|---|
| 446 | 434 | { |
|---|
| 447 | 435 | struct cx18 *cx = fh2id(fh)->cx; |
|---|
| 448 | 436 | |
|---|
| 449 | | - if (cropcap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
|---|
| 437 | + if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
|---|
| 450 | 438 | return -EINVAL; |
|---|
| 451 | | - cropcap->pixelaspect.numerator = cx->is_50hz ? 54 : 11; |
|---|
| 452 | | - cropcap->pixelaspect.denominator = cx->is_50hz ? 59 : 10; |
|---|
| 439 | + |
|---|
| 440 | + f->numerator = cx->is_50hz ? 54 : 11; |
|---|
| 441 | + f->denominator = cx->is_50hz ? 59 : 10; |
|---|
| 453 | 442 | return 0; |
|---|
| 454 | 443 | } |
|---|
| 455 | 444 | |
|---|
| .. | .. |
|---|
| 477 | 466 | struct v4l2_fmtdesc *fmt) |
|---|
| 478 | 467 | { |
|---|
| 479 | 468 | static const struct v4l2_fmtdesc formats[] = { |
|---|
| 480 | | - { 0, V4L2_BUF_TYPE_VIDEO_CAPTURE, 0, |
|---|
| 481 | | - "HM12 (YUV 4:1:1)", V4L2_PIX_FMT_HM12, { 0, 0, 0, 0 } |
|---|
| 469 | + { |
|---|
| 470 | + .index = 0, |
|---|
| 471 | + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, |
|---|
| 472 | + .description = "HM12 (YUV 4:1:1)", |
|---|
| 473 | + .pixelformat = V4L2_PIX_FMT_HM12, |
|---|
| 482 | 474 | }, |
|---|
| 483 | | - { 1, V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FMT_FLAG_COMPRESSED, |
|---|
| 484 | | - "MPEG", V4L2_PIX_FMT_MPEG, { 0, 0, 0, 0 } |
|---|
| 475 | + { |
|---|
| 476 | + .index = 1, |
|---|
| 477 | + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, |
|---|
| 478 | + .flags = V4L2_FMT_FLAG_COMPRESSED, |
|---|
| 479 | + .description = "MPEG", |
|---|
| 480 | + .pixelformat = V4L2_PIX_FMT_MPEG, |
|---|
| 485 | 481 | }, |
|---|
| 486 | | - { 2, V4L2_BUF_TYPE_VIDEO_CAPTURE, 0, |
|---|
| 487 | | - "UYVY 4:2:2", V4L2_PIX_FMT_UYVY, { 0, 0, 0, 0 } |
|---|
| 482 | + { |
|---|
| 483 | + .index = 2, |
|---|
| 484 | + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, |
|---|
| 485 | + .description = "UYVY 4:2:2", |
|---|
| 486 | + .pixelformat = V4L2_PIX_FMT_UYVY, |
|---|
| 488 | 487 | }, |
|---|
| 489 | 488 | }; |
|---|
| 490 | 489 | |
|---|
| .. | .. |
|---|
| 632 | 631 | cx18_call_all(cx, tuner, g_tuner, vt); |
|---|
| 633 | 632 | |
|---|
| 634 | 633 | if (vt->type == V4L2_TUNER_RADIO) |
|---|
| 635 | | - strlcpy(vt->name, "cx18 Radio Tuner", sizeof(vt->name)); |
|---|
| 634 | + strscpy(vt->name, "cx18 Radio Tuner", sizeof(vt->name)); |
|---|
| 636 | 635 | else |
|---|
| 637 | | - strlcpy(vt->name, "cx18 TV Tuner", sizeof(vt->name)); |
|---|
| 636 | + strscpy(vt->name, "cx18 TV Tuner", sizeof(vt->name)); |
|---|
| 638 | 637 | return 0; |
|---|
| 639 | 638 | } |
|---|
| 640 | 639 | |
|---|
| .. | .. |
|---|
| 675 | 674 | struct cx18_enc_idx_entry *e_buf; |
|---|
| 676 | 675 | |
|---|
| 677 | 676 | /* Frame type lookup: 1=I, 2=P, 4=B */ |
|---|
| 678 | | - const int mapping[8] = { |
|---|
| 677 | + static const int mapping[8] = { |
|---|
| 679 | 678 | -1, V4L2_ENC_IDX_FRAME_I, V4L2_ENC_IDX_FRAME_P, |
|---|
| 680 | 679 | -1, V4L2_ENC_IDX_FRAME_B, -1, -1, -1 |
|---|
| 681 | 680 | }; |
|---|
| .. | .. |
|---|
| 1079 | 1078 | .vidioc_g_audio = cx18_g_audio, |
|---|
| 1080 | 1079 | .vidioc_enumaudio = cx18_enumaudio, |
|---|
| 1081 | 1080 | .vidioc_enum_input = cx18_enum_input, |
|---|
| 1082 | | - .vidioc_cropcap = cx18_cropcap, |
|---|
| 1081 | + .vidioc_g_pixelaspect = cx18_g_pixelaspect, |
|---|
| 1083 | 1082 | .vidioc_g_selection = cx18_g_selection, |
|---|
| 1084 | 1083 | .vidioc_g_input = cx18_g_input, |
|---|
| 1085 | 1084 | .vidioc_s_input = cx18_s_input, |
|---|