| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | |
|---|
| 3 | 4 | bttv - Bt848 frame grabber driver |
|---|
| .. | .. |
|---|
| 19 | 20 | Copyright (C) 2005, 2006 Michael H. Schimek <mschimek@gmx.at> |
|---|
| 20 | 21 | Sponsored by OPQ Systems AB |
|---|
| 21 | 22 | |
|---|
| 22 | | - This program is free software; you can redistribute it and/or modify |
|---|
| 23 | | - it under the terms of the GNU General Public License as published by |
|---|
| 24 | | - the Free Software Foundation; either version 2 of the License, or |
|---|
| 25 | | - (at your option) any later version. |
|---|
| 26 | | - |
|---|
| 27 | | - This program is distributed in the hope that it will be useful, |
|---|
| 28 | | - but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 29 | | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 30 | | - GNU General Public License for more details. |
|---|
| 31 | | - |
|---|
| 32 | | - You should have received a copy of the GNU General Public License |
|---|
| 33 | | - along with this program; if not, write to the Free Software |
|---|
| 34 | | - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|---|
| 35 | 23 | */ |
|---|
| 36 | 24 | |
|---|
| 37 | 25 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
|---|
| .. | .. |
|---|
| 515 | 503 | packed pixel formats must come first */ |
|---|
| 516 | 504 | static const struct bttv_format formats[] = { |
|---|
| 517 | 505 | { |
|---|
| 518 | | - .name = "8 bpp, gray", |
|---|
| 519 | 506 | .fourcc = V4L2_PIX_FMT_GREY, |
|---|
| 520 | 507 | .btformat = BT848_COLOR_FMT_Y8, |
|---|
| 521 | 508 | .depth = 8, |
|---|
| 522 | 509 | .flags = FORMAT_FLAGS_PACKED, |
|---|
| 523 | 510 | },{ |
|---|
| 524 | | - .name = "8 bpp, dithered color", |
|---|
| 525 | 511 | .fourcc = V4L2_PIX_FMT_HI240, |
|---|
| 526 | 512 | .btformat = BT848_COLOR_FMT_RGB8, |
|---|
| 527 | 513 | .depth = 8, |
|---|
| 528 | 514 | .flags = FORMAT_FLAGS_PACKED | FORMAT_FLAGS_DITHER, |
|---|
| 529 | 515 | },{ |
|---|
| 530 | | - .name = "15 bpp RGB, le", |
|---|
| 531 | 516 | .fourcc = V4L2_PIX_FMT_RGB555, |
|---|
| 532 | 517 | .btformat = BT848_COLOR_FMT_RGB15, |
|---|
| 533 | 518 | .depth = 16, |
|---|
| 534 | 519 | .flags = FORMAT_FLAGS_PACKED, |
|---|
| 535 | 520 | },{ |
|---|
| 536 | | - .name = "15 bpp RGB, be", |
|---|
| 537 | 521 | .fourcc = V4L2_PIX_FMT_RGB555X, |
|---|
| 538 | 522 | .btformat = BT848_COLOR_FMT_RGB15, |
|---|
| 539 | 523 | .btswap = 0x03, /* byteswap */ |
|---|
| 540 | 524 | .depth = 16, |
|---|
| 541 | 525 | .flags = FORMAT_FLAGS_PACKED, |
|---|
| 542 | 526 | },{ |
|---|
| 543 | | - .name = "16 bpp RGB, le", |
|---|
| 544 | 527 | .fourcc = V4L2_PIX_FMT_RGB565, |
|---|
| 545 | 528 | .btformat = BT848_COLOR_FMT_RGB16, |
|---|
| 546 | 529 | .depth = 16, |
|---|
| 547 | 530 | .flags = FORMAT_FLAGS_PACKED, |
|---|
| 548 | 531 | },{ |
|---|
| 549 | | - .name = "16 bpp RGB, be", |
|---|
| 550 | 532 | .fourcc = V4L2_PIX_FMT_RGB565X, |
|---|
| 551 | 533 | .btformat = BT848_COLOR_FMT_RGB16, |
|---|
| 552 | 534 | .btswap = 0x03, /* byteswap */ |
|---|
| 553 | 535 | .depth = 16, |
|---|
| 554 | 536 | .flags = FORMAT_FLAGS_PACKED, |
|---|
| 555 | 537 | },{ |
|---|
| 556 | | - .name = "24 bpp RGB, le", |
|---|
| 557 | 538 | .fourcc = V4L2_PIX_FMT_BGR24, |
|---|
| 558 | 539 | .btformat = BT848_COLOR_FMT_RGB24, |
|---|
| 559 | 540 | .depth = 24, |
|---|
| 560 | 541 | .flags = FORMAT_FLAGS_PACKED, |
|---|
| 561 | 542 | },{ |
|---|
| 562 | | - .name = "32 bpp RGB, le", |
|---|
| 563 | 543 | .fourcc = V4L2_PIX_FMT_BGR32, |
|---|
| 564 | 544 | .btformat = BT848_COLOR_FMT_RGB32, |
|---|
| 565 | 545 | .depth = 32, |
|---|
| 566 | 546 | .flags = FORMAT_FLAGS_PACKED, |
|---|
| 567 | 547 | },{ |
|---|
| 568 | | - .name = "32 bpp RGB, be", |
|---|
| 569 | 548 | .fourcc = V4L2_PIX_FMT_RGB32, |
|---|
| 570 | 549 | .btformat = BT848_COLOR_FMT_RGB32, |
|---|
| 571 | 550 | .btswap = 0x0f, /* byte+word swap */ |
|---|
| 572 | 551 | .depth = 32, |
|---|
| 573 | 552 | .flags = FORMAT_FLAGS_PACKED, |
|---|
| 574 | 553 | },{ |
|---|
| 575 | | - .name = "4:2:2, packed, YUYV", |
|---|
| 576 | 554 | .fourcc = V4L2_PIX_FMT_YUYV, |
|---|
| 577 | 555 | .btformat = BT848_COLOR_FMT_YUY2, |
|---|
| 578 | 556 | .depth = 16, |
|---|
| 579 | 557 | .flags = FORMAT_FLAGS_PACKED, |
|---|
| 580 | 558 | },{ |
|---|
| 581 | | - .name = "4:2:2, packed, UYVY", |
|---|
| 582 | 559 | .fourcc = V4L2_PIX_FMT_UYVY, |
|---|
| 583 | 560 | .btformat = BT848_COLOR_FMT_YUY2, |
|---|
| 584 | 561 | .btswap = 0x03, /* byteswap */ |
|---|
| 585 | 562 | .depth = 16, |
|---|
| 586 | 563 | .flags = FORMAT_FLAGS_PACKED, |
|---|
| 587 | 564 | },{ |
|---|
| 588 | | - .name = "4:2:2, planar, Y-Cb-Cr", |
|---|
| 589 | 565 | .fourcc = V4L2_PIX_FMT_YUV422P, |
|---|
| 590 | 566 | .btformat = BT848_COLOR_FMT_YCrCb422, |
|---|
| 591 | 567 | .depth = 16, |
|---|
| .. | .. |
|---|
| 593 | 569 | .hshift = 1, |
|---|
| 594 | 570 | .vshift = 0, |
|---|
| 595 | 571 | },{ |
|---|
| 596 | | - .name = "4:2:0, planar, Y-Cb-Cr", |
|---|
| 597 | 572 | .fourcc = V4L2_PIX_FMT_YUV420, |
|---|
| 598 | 573 | .btformat = BT848_COLOR_FMT_YCrCb422, |
|---|
| 599 | 574 | .depth = 12, |
|---|
| .. | .. |
|---|
| 601 | 576 | .hshift = 1, |
|---|
| 602 | 577 | .vshift = 1, |
|---|
| 603 | 578 | },{ |
|---|
| 604 | | - .name = "4:2:0, planar, Y-Cr-Cb", |
|---|
| 605 | 579 | .fourcc = V4L2_PIX_FMT_YVU420, |
|---|
| 606 | 580 | .btformat = BT848_COLOR_FMT_YCrCb422, |
|---|
| 607 | 581 | .depth = 12, |
|---|
| .. | .. |
|---|
| 609 | 583 | .hshift = 1, |
|---|
| 610 | 584 | .vshift = 1, |
|---|
| 611 | 585 | },{ |
|---|
| 612 | | - .name = "4:1:1, planar, Y-Cb-Cr", |
|---|
| 613 | 586 | .fourcc = V4L2_PIX_FMT_YUV411P, |
|---|
| 614 | 587 | .btformat = BT848_COLOR_FMT_YCrCb411, |
|---|
| 615 | 588 | .depth = 12, |
|---|
| .. | .. |
|---|
| 617 | 590 | .hshift = 2, |
|---|
| 618 | 591 | .vshift = 0, |
|---|
| 619 | 592 | },{ |
|---|
| 620 | | - .name = "4:1:0, planar, Y-Cb-Cr", |
|---|
| 621 | 593 | .fourcc = V4L2_PIX_FMT_YUV410, |
|---|
| 622 | 594 | .btformat = BT848_COLOR_FMT_YCrCb411, |
|---|
| 623 | 595 | .depth = 9, |
|---|
| .. | .. |
|---|
| 625 | 597 | .hshift = 2, |
|---|
| 626 | 598 | .vshift = 2, |
|---|
| 627 | 599 | },{ |
|---|
| 628 | | - .name = "4:1:0, planar, Y-Cr-Cb", |
|---|
| 629 | 600 | .fourcc = V4L2_PIX_FMT_YVU410, |
|---|
| 630 | 601 | .btformat = BT848_COLOR_FMT_YCrCb411, |
|---|
| 631 | 602 | .depth = 9, |
|---|
| .. | .. |
|---|
| 633 | 604 | .hshift = 2, |
|---|
| 634 | 605 | .vshift = 2, |
|---|
| 635 | 606 | },{ |
|---|
| 636 | | - .name = "raw scanlines", |
|---|
| 637 | 607 | .fourcc = -1, |
|---|
| 638 | 608 | .btformat = BT848_COLOR_FMT_RAW, |
|---|
| 639 | 609 | .depth = 8, |
|---|
| .. | .. |
|---|
| 2040 | 2010 | max_width = max_width & width_mask; |
|---|
| 2041 | 2011 | |
|---|
| 2042 | 2012 | /* Max. scale factor is 16:1 for frames, 8:1 for fields. */ |
|---|
| 2043 | | - min_height = min_height; |
|---|
| 2044 | 2013 | /* Min. scale factor is 1:1. */ |
|---|
| 2045 | 2014 | max_height >>= !V4L2_FIELD_HAS_BOTH(field); |
|---|
| 2046 | 2015 | |
|---|
| .. | .. |
|---|
| 2363 | 2332 | field = V4L2_FIELD_SEQ_TB; |
|---|
| 2364 | 2333 | break; |
|---|
| 2365 | 2334 | } |
|---|
| 2366 | | - /* fall through */ |
|---|
| 2335 | + fallthrough; |
|---|
| 2367 | 2336 | default: /* FIELD_ANY case */ |
|---|
| 2368 | 2337 | height2 = btv->crop[!!fh->do_crop].rect.height >> 1; |
|---|
| 2369 | 2338 | field = (f->fmt.pix.height > height2) |
|---|
| .. | .. |
|---|
| 2436 | 2405 | |
|---|
| 2437 | 2406 | f->fmt.pix.field = field; |
|---|
| 2438 | 2407 | |
|---|
| 2439 | | - /* update our state informations */ |
|---|
| 2408 | + /* update our state information */ |
|---|
| 2440 | 2409 | fh->fmt = fmt; |
|---|
| 2441 | 2410 | fh->cap.field = f->fmt.pix.field; |
|---|
| 2442 | 2411 | fh->cap.last = V4L2_FIELD_NONE; |
|---|
| .. | .. |
|---|
| 2466 | 2435 | static int bttv_querycap(struct file *file, void *priv, |
|---|
| 2467 | 2436 | struct v4l2_capability *cap) |
|---|
| 2468 | 2437 | { |
|---|
| 2469 | | - struct video_device *vdev = video_devdata(file); |
|---|
| 2470 | 2438 | struct bttv_fh *fh = priv; |
|---|
| 2471 | 2439 | struct bttv *btv = fh->btv; |
|---|
| 2472 | 2440 | |
|---|
| 2473 | 2441 | if (0 == v4l2) |
|---|
| 2474 | 2442 | return -EINVAL; |
|---|
| 2475 | 2443 | |
|---|
| 2476 | | - strlcpy(cap->driver, "bttv", sizeof(cap->driver)); |
|---|
| 2477 | | - strlcpy(cap->card, btv->video_dev.name, sizeof(cap->card)); |
|---|
| 2444 | + strscpy(cap->driver, "bttv", sizeof(cap->driver)); |
|---|
| 2445 | + strscpy(cap->card, btv->video_dev.name, sizeof(cap->card)); |
|---|
| 2478 | 2446 | snprintf(cap->bus_info, sizeof(cap->bus_info), |
|---|
| 2479 | 2447 | "PCI:%s", pci_name(btv->c.pci)); |
|---|
| 2480 | | - cap->capabilities = |
|---|
| 2481 | | - V4L2_CAP_VIDEO_CAPTURE | |
|---|
| 2482 | | - V4L2_CAP_READWRITE | |
|---|
| 2483 | | - V4L2_CAP_STREAMING | |
|---|
| 2484 | | - V4L2_CAP_DEVICE_CAPS; |
|---|
| 2448 | + cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | |
|---|
| 2449 | + V4L2_CAP_STREAMING | V4L2_CAP_DEVICE_CAPS; |
|---|
| 2485 | 2450 | if (no_overlay <= 0) |
|---|
| 2486 | 2451 | cap->capabilities |= V4L2_CAP_VIDEO_OVERLAY; |
|---|
| 2487 | 2452 | if (video_is_registered(&btv->vbi_dev)) |
|---|
| 2488 | 2453 | cap->capabilities |= V4L2_CAP_VBI_CAPTURE; |
|---|
| 2489 | | - if (video_is_registered(&btv->radio_dev)) |
|---|
| 2454 | + if (video_is_registered(&btv->radio_dev)) { |
|---|
| 2490 | 2455 | cap->capabilities |= V4L2_CAP_RADIO; |
|---|
| 2456 | + if (btv->has_tea575x) |
|---|
| 2457 | + cap->capabilities |= V4L2_CAP_HW_FREQ_SEEK; |
|---|
| 2458 | + } |
|---|
| 2491 | 2459 | |
|---|
| 2492 | 2460 | /* |
|---|
| 2493 | 2461 | * No need to lock here: those vars are initialized during board |
|---|
| .. | .. |
|---|
| 2497 | 2465 | cap->capabilities |= V4L2_CAP_RDS_CAPTURE; |
|---|
| 2498 | 2466 | if (btv->tuner_type != TUNER_ABSENT) |
|---|
| 2499 | 2467 | cap->capabilities |= V4L2_CAP_TUNER; |
|---|
| 2500 | | - if (vdev->vfl_type == VFL_TYPE_GRABBER) |
|---|
| 2501 | | - cap->device_caps = cap->capabilities & |
|---|
| 2502 | | - (V4L2_CAP_VIDEO_CAPTURE | |
|---|
| 2503 | | - V4L2_CAP_READWRITE | |
|---|
| 2504 | | - V4L2_CAP_STREAMING | |
|---|
| 2505 | | - V4L2_CAP_VIDEO_OVERLAY | |
|---|
| 2506 | | - V4L2_CAP_TUNER); |
|---|
| 2507 | | - else if (vdev->vfl_type == VFL_TYPE_VBI) |
|---|
| 2508 | | - cap->device_caps = cap->capabilities & |
|---|
| 2509 | | - (V4L2_CAP_VBI_CAPTURE | |
|---|
| 2510 | | - V4L2_CAP_READWRITE | |
|---|
| 2511 | | - V4L2_CAP_STREAMING | |
|---|
| 2512 | | - V4L2_CAP_TUNER); |
|---|
| 2513 | | - else { |
|---|
| 2514 | | - cap->device_caps = V4L2_CAP_RADIO | V4L2_CAP_TUNER; |
|---|
| 2515 | | - if (btv->has_saa6588) |
|---|
| 2516 | | - cap->device_caps |= V4L2_CAP_READWRITE | |
|---|
| 2517 | | - V4L2_CAP_RDS_CAPTURE; |
|---|
| 2518 | | - if (btv->has_tea575x) |
|---|
| 2519 | | - cap->device_caps |= V4L2_CAP_HW_FREQ_SEEK; |
|---|
| 2520 | | - } |
|---|
| 2521 | 2468 | return 0; |
|---|
| 2522 | 2469 | } |
|---|
| 2523 | 2470 | |
|---|
| .. | .. |
|---|
| 2535 | 2482 | return -EINVAL; |
|---|
| 2536 | 2483 | |
|---|
| 2537 | 2484 | f->pixelformat = formats[i].fourcc; |
|---|
| 2538 | | - strlcpy(f->description, formats[i].name, sizeof(f->description)); |
|---|
| 2539 | 2485 | |
|---|
| 2540 | 2486 | return i; |
|---|
| 2541 | 2487 | } |
|---|
| .. | .. |
|---|
| 2782 | 2728 | t->rxsubchans = V4L2_TUNER_SUB_MONO; |
|---|
| 2783 | 2729 | t->capability = V4L2_TUNER_CAP_NORM; |
|---|
| 2784 | 2730 | bttv_call_all(btv, tuner, g_tuner, t); |
|---|
| 2785 | | - strcpy(t->name, "Television"); |
|---|
| 2731 | + strscpy(t->name, "Television", sizeof(t->name)); |
|---|
| 2786 | 2732 | t->type = V4L2_TUNER_ANALOG_TV; |
|---|
| 2787 | 2733 | if (btread(BT848_DSTATUS)&BT848_DSTATUS_HLOC) |
|---|
| 2788 | 2734 | t->signal = 0xffff; |
|---|
| .. | .. |
|---|
| 2793 | 2739 | return 0; |
|---|
| 2794 | 2740 | } |
|---|
| 2795 | 2741 | |
|---|
| 2796 | | -static int bttv_cropcap(struct file *file, void *priv, |
|---|
| 2797 | | - struct v4l2_cropcap *cap) |
|---|
| 2742 | +static int bttv_g_pixelaspect(struct file *file, void *priv, |
|---|
| 2743 | + int type, struct v4l2_fract *f) |
|---|
| 2798 | 2744 | { |
|---|
| 2799 | 2745 | struct bttv_fh *fh = priv; |
|---|
| 2800 | 2746 | struct bttv *btv = fh->btv; |
|---|
| 2801 | 2747 | |
|---|
| 2802 | | - if (cap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && |
|---|
| 2803 | | - cap->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) |
|---|
| 2748 | + if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
|---|
| 2804 | 2749 | return -EINVAL; |
|---|
| 2805 | 2750 | |
|---|
| 2806 | 2751 | /* defrect and bounds are set via g_selection */ |
|---|
| 2807 | | - cap->pixelaspect = bttv_tvnorms[btv->tvnorm].cropcap.pixelaspect; |
|---|
| 2808 | | - |
|---|
| 2752 | + *f = bttv_tvnorms[btv->tvnorm].cropcap.pixelaspect; |
|---|
| 2809 | 2753 | return 0; |
|---|
| 2810 | 2754 | } |
|---|
| 2811 | 2755 | |
|---|
| .. | .. |
|---|
| 3020 | 2964 | |
|---|
| 3021 | 2965 | dprintk("open dev=%s\n", video_device_node_name(vdev)); |
|---|
| 3022 | 2966 | |
|---|
| 3023 | | - if (vdev->vfl_type == VFL_TYPE_GRABBER) { |
|---|
| 2967 | + if (vdev->vfl_type == VFL_TYPE_VIDEO) { |
|---|
| 3024 | 2968 | type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
|---|
| 3025 | 2969 | } else if (vdev->vfl_type == VFL_TYPE_VBI) { |
|---|
| 3026 | 2970 | type = V4L2_BUF_TYPE_VBI_CAPTURE; |
|---|
| .. | .. |
|---|
| 3067 | 3011 | V4L2 apps we now reset the cropping parameters as seen through |
|---|
| 3068 | 3012 | this fh, which is to say VIDIOC_G_SELECTION and scaling limit checks |
|---|
| 3069 | 3013 | will use btv->crop[0], the default cropping parameters for the |
|---|
| 3070 | | - current video standard, and VIDIOC_S_FMT will not implicitely |
|---|
| 3014 | + current video standard, and VIDIOC_S_FMT will not implicitly |
|---|
| 3071 | 3015 | change the cropping parameters until VIDIOC_S_SELECTION has been |
|---|
| 3072 | 3016 | called. */ |
|---|
| 3073 | 3017 | fh->do_crop = !reset_crop; /* module parameter */ |
|---|
| .. | .. |
|---|
| 3163 | 3107 | .vidioc_g_fmt_vbi_cap = bttv_g_fmt_vbi_cap, |
|---|
| 3164 | 3108 | .vidioc_try_fmt_vbi_cap = bttv_try_fmt_vbi_cap, |
|---|
| 3165 | 3109 | .vidioc_s_fmt_vbi_cap = bttv_s_fmt_vbi_cap, |
|---|
| 3166 | | - .vidioc_cropcap = bttv_cropcap, |
|---|
| 3110 | + .vidioc_g_pixelaspect = bttv_g_pixelaspect, |
|---|
| 3167 | 3111 | .vidioc_reqbufs = bttv_reqbufs, |
|---|
| 3168 | 3112 | .vidioc_querybuf = bttv_querybuf, |
|---|
| 3169 | 3113 | .vidioc_qbuf = bttv_qbuf, |
|---|
| .. | .. |
|---|
| 3257 | 3201 | |
|---|
| 3258 | 3202 | if (0 != t->index) |
|---|
| 3259 | 3203 | return -EINVAL; |
|---|
| 3260 | | - strcpy(t->name, "Radio"); |
|---|
| 3204 | + strscpy(t->name, "Radio", sizeof(t->name)); |
|---|
| 3261 | 3205 | t->type = V4L2_TUNER_RADIO; |
|---|
| 3262 | 3206 | radio_enable(btv); |
|---|
| 3263 | 3207 | |
|---|
| .. | .. |
|---|
| 3603 | 3547 | bttv_irq_wakeup_video(struct bttv *btv, struct bttv_buffer_set *wakeup, |
|---|
| 3604 | 3548 | struct bttv_buffer_set *curr, unsigned int state) |
|---|
| 3605 | 3549 | { |
|---|
| 3606 | | - struct timeval ts; |
|---|
| 3607 | | - |
|---|
| 3608 | | - v4l2_get_timestamp(&ts); |
|---|
| 3550 | + u64 ts = ktime_get_ns(); |
|---|
| 3609 | 3551 | |
|---|
| 3610 | 3552 | if (wakeup->top == wakeup->bottom) { |
|---|
| 3611 | 3553 | if (NULL != wakeup->top && curr->top != wakeup->top) { |
|---|
| .. | .. |
|---|
| 3646 | 3588 | if (NULL == wakeup) |
|---|
| 3647 | 3589 | return; |
|---|
| 3648 | 3590 | |
|---|
| 3649 | | - v4l2_get_timestamp(&wakeup->vb.ts); |
|---|
| 3591 | + wakeup->vb.ts = ktime_get_ns(); |
|---|
| 3650 | 3592 | wakeup->vb.field_count = btv->field_count; |
|---|
| 3651 | 3593 | wakeup->vb.state = state; |
|---|
| 3652 | 3594 | wake_up(&wakeup->vb.done); |
|---|
| .. | .. |
|---|
| 3716 | 3658 | btv->curr.top = NULL; |
|---|
| 3717 | 3659 | bttv_risc_hook(btv, RISC_SLOT_O_FIELD, NULL, 0); |
|---|
| 3718 | 3660 | |
|---|
| 3719 | | - v4l2_get_timestamp(&wakeup->vb.ts); |
|---|
| 3661 | + wakeup->vb.ts = ktime_get_ns(); |
|---|
| 3720 | 3662 | wakeup->vb.field_count = btv->field_count; |
|---|
| 3721 | 3663 | wakeup->vb.state = VIDEOBUF_DONE; |
|---|
| 3722 | 3664 | wake_up(&wakeup->vb.done); |
|---|
| .. | .. |
|---|
| 3956 | 3898 | |
|---|
| 3957 | 3899 | /* video */ |
|---|
| 3958 | 3900 | vdev_init(btv, &btv->video_dev, &bttv_video_template, "video"); |
|---|
| 3901 | + btv->video_dev.device_caps = V4L2_CAP_VIDEO_CAPTURE | |
|---|
| 3902 | + V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; |
|---|
| 3903 | + if (btv->tuner_type != TUNER_ABSENT) |
|---|
| 3904 | + btv->video_dev.device_caps |= V4L2_CAP_TUNER; |
|---|
| 3905 | + if (no_overlay <= 0) |
|---|
| 3906 | + btv->video_dev.device_caps |= V4L2_CAP_VIDEO_OVERLAY; |
|---|
| 3959 | 3907 | |
|---|
| 3960 | | - if (video_register_device(&btv->video_dev, VFL_TYPE_GRABBER, |
|---|
| 3908 | + if (video_register_device(&btv->video_dev, VFL_TYPE_VIDEO, |
|---|
| 3961 | 3909 | video_nr[btv->c.nr]) < 0) |
|---|
| 3962 | 3910 | goto err; |
|---|
| 3963 | 3911 | pr_info("%d: registered device %s\n", |
|---|
| .. | .. |
|---|
| 3970 | 3918 | |
|---|
| 3971 | 3919 | /* vbi */ |
|---|
| 3972 | 3920 | vdev_init(btv, &btv->vbi_dev, &bttv_video_template, "vbi"); |
|---|
| 3921 | + btv->vbi_dev.device_caps = V4L2_CAP_VBI_CAPTURE | V4L2_CAP_READWRITE | |
|---|
| 3922 | + V4L2_CAP_STREAMING; |
|---|
| 3923 | + if (btv->tuner_type != TUNER_ABSENT) |
|---|
| 3924 | + btv->vbi_dev.device_caps |= V4L2_CAP_TUNER; |
|---|
| 3973 | 3925 | |
|---|
| 3974 | 3926 | if (video_register_device(&btv->vbi_dev, VFL_TYPE_VBI, |
|---|
| 3975 | 3927 | vbi_nr[btv->c.nr]) < 0) |
|---|
| .. | .. |
|---|
| 3981 | 3933 | return 0; |
|---|
| 3982 | 3934 | /* radio */ |
|---|
| 3983 | 3935 | vdev_init(btv, &btv->radio_dev, &radio_template, "radio"); |
|---|
| 3936 | + btv->radio_dev.device_caps = V4L2_CAP_RADIO | V4L2_CAP_TUNER; |
|---|
| 3937 | + if (btv->has_saa6588) |
|---|
| 3938 | + btv->radio_dev.device_caps |= V4L2_CAP_READWRITE | |
|---|
| 3939 | + V4L2_CAP_RDS_CAPTURE; |
|---|
| 3940 | + if (btv->has_tea575x) |
|---|
| 3941 | + btv->radio_dev.device_caps |= V4L2_CAP_HW_FREQ_SEEK; |
|---|
| 3984 | 3942 | btv->radio_dev.ctrl_handler = &btv->radio_ctrl_handler; |
|---|
| 3985 | 3943 | if (video_register_device(&btv->radio_dev, VFL_TYPE_RADIO, |
|---|
| 3986 | 3944 | radio_nr[btv->c.nr]) < 0) |
|---|
| .. | .. |
|---|
| 4214 | 4172 | /* register video4linux + input */ |
|---|
| 4215 | 4173 | if (!bttv_tvcards[btv->c.type].no_video) { |
|---|
| 4216 | 4174 | v4l2_ctrl_add_handler(&btv->radio_ctrl_handler, hdl, |
|---|
| 4217 | | - v4l2_ctrl_radio_filter); |
|---|
| 4175 | + v4l2_ctrl_radio_filter, false); |
|---|
| 4218 | 4176 | if (btv->radio_ctrl_handler.error) { |
|---|
| 4219 | 4177 | result = btv->radio_ctrl_handler.error; |
|---|
| 4220 | 4178 | goto fail2; |
|---|