diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-10 22:04:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-10 22:04:49 -0400 |
commit | 4d9708ea5e5a45973df7cf965805fdfb185dd5bf (patch) | |
tree | 833a918e85f1e3bff8cb182517707d12836d10a8 /drivers/media/dvb-frontends/rtl2832_sdr.c | |
parent | 754c780953397dd5ee5191b7b3ca67e09088ce7a (diff) | |
parent | a66d05d504a24894a8fdf11e4569752f313e5764 (diff) |
Merge tag 'media/v3.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab:
- new IR driver: hix5hd2-ir
- the virtual test driver (vivi) was replaced by vivid, with has an
almost complete set of features to emulate most v4l2 devices and
properly test all sorts of userspace apps
- the as102 driver had several bugs fixed and was properly split into a
frontend and a core driver. With that, it got promoted from staging
into mainstream
- one new CI driver got added for CIMaX SP2/SP2HF (sp2 driver)
- one new frontend driver for Toshiba ISDB-T/ISDB-S demod (tc90522)
- one new PCI driver for ISDB-T/ISDB-S (pt3 driver)
- saa7134 driver got support for go7007-based devices
- added a new PCI driver for Techwell 68xx chipsets (tw68)
- a new platform driver was added (coda)
- new tuner drivers: mxl301rf and qm1d1c0042
- a new DVB USB driver was added for DVBSky S860 & similar devices
- added a new SDR driver (hackrf)
- usbtv got audio support
- several platform drivers are now compiled with COMPILE_TEST
- a series of compiler fixup patches, making sparse/spatch happier with
the media stuff and removing several warnings, especially on those
platform drivers that didn't use to compile on x86
- Support for several new modern devices got added
- lots of other fixes, improvements and cleanups
* tag 'media/v3.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (544 commits)
[media] ir-hix5hd2: fix build on c6x arch
[media] pt3: fix DTV FE I2C driver load error paths
Revert "[media] media: em28xx - remove reset_resume interface"
[media] exynos4-is: fix some warnings when compiling on arm64
[media] usb drivers: use %zu instead of %zd
[media] pci drivers: use %zu instead of %zd
[media] dvb-frontends: use %zu instead of %zd
[media] s5p-mfc: Fix several printk warnings
[media] s5p_mfc_opr: Fix warnings
[media] ti-vpe: Fix typecast
[media] s3c-camif: fix dma_addr_t printks
[media] s5p_mfc_opr_v6: get rid of warnings when compiled with 64 bits
[media] s5p_mfc_opr_v5: Fix lots of warnings on x86_64
[media] em28xx: Fix identation
[media] drxd: remove a dead code
[media] saa7146: remove return after BUG()
[media] cx88: remove return after BUG()
[media] cx88: fix cards table CodingStyle
[media] radio-sf16fmr2: declare some structs as static
[media] radio-sf16fmi: declare pnp_attached as static
...
Diffstat (limited to 'drivers/media/dvb-frontends/rtl2832_sdr.c')
-rw-r--r-- | drivers/media/dvb-frontends/rtl2832_sdr.c | 118 |
1 files changed, 56 insertions, 62 deletions
diff --git a/drivers/media/dvb-frontends/rtl2832_sdr.c b/drivers/media/dvb-frontends/rtl2832_sdr.c index 023e0f49c786..7bf98cf6bbe1 100644 --- a/drivers/media/dvb-frontends/rtl2832_sdr.c +++ b/drivers/media/dvb-frontends/rtl2832_sdr.c | |||
@@ -329,7 +329,7 @@ static int rtl2832_sdr_rd_reg_mask(struct rtl2832_sdr_state *s, u16 reg, | |||
329 | static struct rtl2832_sdr_frame_buf *rtl2832_sdr_get_next_fill_buf( | 329 | static struct rtl2832_sdr_frame_buf *rtl2832_sdr_get_next_fill_buf( |
330 | struct rtl2832_sdr_state *s) | 330 | struct rtl2832_sdr_state *s) |
331 | { | 331 | { |
332 | unsigned long flags = 0; | 332 | unsigned long flags; |
333 | struct rtl2832_sdr_frame_buf *buf = NULL; | 333 | struct rtl2832_sdr_frame_buf *buf = NULL; |
334 | 334 | ||
335 | spin_lock_irqsave(&s->queued_bufs_lock, flags); | 335 | spin_lock_irqsave(&s->queued_bufs_lock, flags); |
@@ -365,17 +365,19 @@ static unsigned int rtl2832_sdr_convert_stream(struct rtl2832_sdr_state *s, | |||
365 | dst_len = 0; | 365 | dst_len = 0; |
366 | } | 366 | } |
367 | 367 | ||
368 | /* calculate samping rate and output it in 10 seconds intervals */ | 368 | /* calculate sample rate and output it in 10 seconds intervals */ |
369 | if (unlikely(time_is_before_jiffies(s->jiffies_next))) { | 369 | if (unlikely(time_is_before_jiffies(s->jiffies_next))) { |
370 | #define MSECS 10000UL | 370 | #define MSECS 10000UL |
371 | unsigned int msecs = jiffies_to_msecs(jiffies - | ||
372 | s->jiffies_next + msecs_to_jiffies(MSECS)); | ||
371 | unsigned int samples = s->sample - s->sample_measured; | 373 | unsigned int samples = s->sample - s->sample_measured; |
372 | 374 | ||
373 | s->jiffies_next = jiffies + msecs_to_jiffies(MSECS); | 375 | s->jiffies_next = jiffies + msecs_to_jiffies(MSECS); |
374 | s->sample_measured = s->sample; | 376 | s->sample_measured = s->sample; |
375 | dev_dbg(&s->udev->dev, | 377 | dev_dbg(&s->udev->dev, |
376 | "slen=%d samples=%u msecs=%lu sampling rate=%lu\n", | 378 | "slen=%u samples=%u msecs=%u sample rate=%lu\n", |
377 | src_len, samples, MSECS, | 379 | src_len, samples, msecs, |
378 | samples * 1000UL / MSECS); | 380 | samples * 1000UL / msecs); |
379 | } | 381 | } |
380 | 382 | ||
381 | /* total number of I+Q pairs */ | 383 | /* total number of I+Q pairs */ |
@@ -394,8 +396,8 @@ static void rtl2832_sdr_urb_complete(struct urb *urb) | |||
394 | struct rtl2832_sdr_frame_buf *fbuf; | 396 | struct rtl2832_sdr_frame_buf *fbuf; |
395 | 397 | ||
396 | dev_dbg_ratelimited(&s->udev->dev, | 398 | dev_dbg_ratelimited(&s->udev->dev, |
397 | "%s: status=%d length=%d/%d errors=%d\n", | 399 | "status=%d length=%d/%d errors=%d\n", |
398 | __func__, urb->status, urb->actual_length, | 400 | urb->status, urb->actual_length, |
399 | urb->transfer_buffer_length, urb->error_count); | 401 | urb->transfer_buffer_length, urb->error_count); |
400 | 402 | ||
401 | switch (urb->status) { | 403 | switch (urb->status) { |
@@ -443,7 +445,7 @@ static int rtl2832_sdr_kill_urbs(struct rtl2832_sdr_state *s) | |||
443 | int i; | 445 | int i; |
444 | 446 | ||
445 | for (i = s->urbs_submitted - 1; i >= 0; i--) { | 447 | for (i = s->urbs_submitted - 1; i >= 0; i--) { |
446 | dev_dbg(&s->udev->dev, "%s: kill urb=%d\n", __func__, i); | 448 | dev_dbg(&s->udev->dev, "kill urb=%d\n", i); |
447 | /* stop the URB */ | 449 | /* stop the URB */ |
448 | usb_kill_urb(s->urb_list[i]); | 450 | usb_kill_urb(s->urb_list[i]); |
449 | } | 451 | } |
@@ -457,7 +459,7 @@ static int rtl2832_sdr_submit_urbs(struct rtl2832_sdr_state *s) | |||
457 | int i, ret; | 459 | int i, ret; |
458 | 460 | ||
459 | for (i = 0; i < s->urbs_initialized; i++) { | 461 | for (i = 0; i < s->urbs_initialized; i++) { |
460 | dev_dbg(&s->udev->dev, "%s: submit urb=%d\n", __func__, i); | 462 | dev_dbg(&s->udev->dev, "submit urb=%d\n", i); |
461 | ret = usb_submit_urb(s->urb_list[i], GFP_ATOMIC); | 463 | ret = usb_submit_urb(s->urb_list[i], GFP_ATOMIC); |
462 | if (ret) { | 464 | if (ret) { |
463 | dev_err(&s->udev->dev, | 465 | dev_err(&s->udev->dev, |
@@ -477,8 +479,7 @@ static int rtl2832_sdr_free_stream_bufs(struct rtl2832_sdr_state *s) | |||
477 | if (s->flags & USB_STATE_URB_BUF) { | 479 | if (s->flags & USB_STATE_URB_BUF) { |
478 | while (s->buf_num) { | 480 | while (s->buf_num) { |
479 | s->buf_num--; | 481 | s->buf_num--; |
480 | dev_dbg(&s->udev->dev, "%s: free buf=%d\n", | 482 | dev_dbg(&s->udev->dev, "free buf=%d\n", s->buf_num); |
481 | __func__, s->buf_num); | ||
482 | usb_free_coherent(s->udev, s->buf_size, | 483 | usb_free_coherent(s->udev, s->buf_size, |
483 | s->buf_list[s->buf_num], | 484 | s->buf_list[s->buf_num], |
484 | s->dma_addr[s->buf_num]); | 485 | s->dma_addr[s->buf_num]); |
@@ -494,24 +495,22 @@ static int rtl2832_sdr_alloc_stream_bufs(struct rtl2832_sdr_state *s) | |||
494 | s->buf_num = 0; | 495 | s->buf_num = 0; |
495 | s->buf_size = BULK_BUFFER_SIZE; | 496 | s->buf_size = BULK_BUFFER_SIZE; |
496 | 497 | ||
497 | dev_dbg(&s->udev->dev, | 498 | dev_dbg(&s->udev->dev, "all in all I will use %u bytes for streaming\n", |
498 | "%s: all in all I will use %u bytes for streaming\n", | 499 | MAX_BULK_BUFS * BULK_BUFFER_SIZE); |
499 | __func__, MAX_BULK_BUFS * BULK_BUFFER_SIZE); | ||
500 | 500 | ||
501 | for (s->buf_num = 0; s->buf_num < MAX_BULK_BUFS; s->buf_num++) { | 501 | for (s->buf_num = 0; s->buf_num < MAX_BULK_BUFS; s->buf_num++) { |
502 | s->buf_list[s->buf_num] = usb_alloc_coherent(s->udev, | 502 | s->buf_list[s->buf_num] = usb_alloc_coherent(s->udev, |
503 | BULK_BUFFER_SIZE, GFP_ATOMIC, | 503 | BULK_BUFFER_SIZE, GFP_ATOMIC, |
504 | &s->dma_addr[s->buf_num]); | 504 | &s->dma_addr[s->buf_num]); |
505 | if (!s->buf_list[s->buf_num]) { | 505 | if (!s->buf_list[s->buf_num]) { |
506 | dev_dbg(&s->udev->dev, "%s: alloc buf=%d failed\n", | 506 | dev_dbg(&s->udev->dev, "alloc buf=%d failed\n", |
507 | __func__, s->buf_num); | 507 | s->buf_num); |
508 | rtl2832_sdr_free_stream_bufs(s); | 508 | rtl2832_sdr_free_stream_bufs(s); |
509 | return -ENOMEM; | 509 | return -ENOMEM; |
510 | } | 510 | } |
511 | 511 | ||
512 | dev_dbg(&s->udev->dev, "%s: alloc buf=%d %p (dma %llu)\n", | 512 | dev_dbg(&s->udev->dev, "alloc buf=%d %p (dma %llu)\n", |
513 | __func__, s->buf_num, | 513 | s->buf_num, s->buf_list[s->buf_num], |
514 | s->buf_list[s->buf_num], | ||
515 | (long long)s->dma_addr[s->buf_num]); | 514 | (long long)s->dma_addr[s->buf_num]); |
516 | s->flags |= USB_STATE_URB_BUF; | 515 | s->flags |= USB_STATE_URB_BUF; |
517 | } | 516 | } |
@@ -527,8 +526,7 @@ static int rtl2832_sdr_free_urbs(struct rtl2832_sdr_state *s) | |||
527 | 526 | ||
528 | for (i = s->urbs_initialized - 1; i >= 0; i--) { | 527 | for (i = s->urbs_initialized - 1; i >= 0; i--) { |
529 | if (s->urb_list[i]) { | 528 | if (s->urb_list[i]) { |
530 | dev_dbg(&s->udev->dev, "%s: free urb=%d\n", | 529 | dev_dbg(&s->udev->dev, "free urb=%d\n", i); |
531 | __func__, i); | ||
532 | /* free the URBs */ | 530 | /* free the URBs */ |
533 | usb_free_urb(s->urb_list[i]); | 531 | usb_free_urb(s->urb_list[i]); |
534 | } | 532 | } |
@@ -544,10 +542,10 @@ static int rtl2832_sdr_alloc_urbs(struct rtl2832_sdr_state *s) | |||
544 | 542 | ||
545 | /* allocate the URBs */ | 543 | /* allocate the URBs */ |
546 | for (i = 0; i < MAX_BULK_BUFS; i++) { | 544 | for (i = 0; i < MAX_BULK_BUFS; i++) { |
547 | dev_dbg(&s->udev->dev, "%s: alloc urb=%d\n", __func__, i); | 545 | dev_dbg(&s->udev->dev, "alloc urb=%d\n", i); |
548 | s->urb_list[i] = usb_alloc_urb(0, GFP_ATOMIC); | 546 | s->urb_list[i] = usb_alloc_urb(0, GFP_ATOMIC); |
549 | if (!s->urb_list[i]) { | 547 | if (!s->urb_list[i]) { |
550 | dev_dbg(&s->udev->dev, "%s: failed\n", __func__); | 548 | dev_dbg(&s->udev->dev, "failed\n"); |
551 | for (j = 0; j < i; j++) | 549 | for (j = 0; j < i; j++) |
552 | usb_free_urb(s->urb_list[j]); | 550 | usb_free_urb(s->urb_list[j]); |
553 | return -ENOMEM; | 551 | return -ENOMEM; |
@@ -570,9 +568,9 @@ static int rtl2832_sdr_alloc_urbs(struct rtl2832_sdr_state *s) | |||
570 | /* Must be called with vb_queue_lock hold */ | 568 | /* Must be called with vb_queue_lock hold */ |
571 | static void rtl2832_sdr_cleanup_queued_bufs(struct rtl2832_sdr_state *s) | 569 | static void rtl2832_sdr_cleanup_queued_bufs(struct rtl2832_sdr_state *s) |
572 | { | 570 | { |
573 | unsigned long flags = 0; | 571 | unsigned long flags; |
574 | 572 | ||
575 | dev_dbg(&s->udev->dev, "%s:\n", __func__); | 573 | dev_dbg(&s->udev->dev, "\n"); |
576 | 574 | ||
577 | spin_lock_irqsave(&s->queued_bufs_lock, flags); | 575 | spin_lock_irqsave(&s->queued_bufs_lock, flags); |
578 | while (!list_empty(&s->queued_bufs)) { | 576 | while (!list_empty(&s->queued_bufs)) { |
@@ -591,7 +589,7 @@ static void rtl2832_sdr_release_sec(struct dvb_frontend *fe) | |||
591 | { | 589 | { |
592 | struct rtl2832_sdr_state *s = fe->sec_priv; | 590 | struct rtl2832_sdr_state *s = fe->sec_priv; |
593 | 591 | ||
594 | dev_dbg(&s->udev->dev, "%s:\n", __func__); | 592 | dev_dbg(&s->udev->dev, "\n"); |
595 | 593 | ||
596 | mutex_lock(&s->vb_queue_lock); | 594 | mutex_lock(&s->vb_queue_lock); |
597 | mutex_lock(&s->v4l2_lock); | 595 | mutex_lock(&s->v4l2_lock); |
@@ -613,7 +611,7 @@ static int rtl2832_sdr_querycap(struct file *file, void *fh, | |||
613 | { | 611 | { |
614 | struct rtl2832_sdr_state *s = video_drvdata(file); | 612 | struct rtl2832_sdr_state *s = video_drvdata(file); |
615 | 613 | ||
616 | dev_dbg(&s->udev->dev, "%s:\n", __func__); | 614 | dev_dbg(&s->udev->dev, "\n"); |
617 | 615 | ||
618 | strlcpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver)); | 616 | strlcpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver)); |
619 | strlcpy(cap->card, s->vdev.name, sizeof(cap->card)); | 617 | strlcpy(cap->card, s->vdev.name, sizeof(cap->card)); |
@@ -631,15 +629,15 @@ static int rtl2832_sdr_queue_setup(struct vb2_queue *vq, | |||
631 | { | 629 | { |
632 | struct rtl2832_sdr_state *s = vb2_get_drv_priv(vq); | 630 | struct rtl2832_sdr_state *s = vb2_get_drv_priv(vq); |
633 | 631 | ||
634 | dev_dbg(&s->udev->dev, "%s: *nbuffers=%d\n", __func__, *nbuffers); | 632 | dev_dbg(&s->udev->dev, "nbuffers=%d\n", *nbuffers); |
635 | 633 | ||
636 | /* Need at least 8 buffers */ | 634 | /* Need at least 8 buffers */ |
637 | if (vq->num_buffers + *nbuffers < 8) | 635 | if (vq->num_buffers + *nbuffers < 8) |
638 | *nbuffers = 8 - vq->num_buffers; | 636 | *nbuffers = 8 - vq->num_buffers; |
639 | *nplanes = 1; | 637 | *nplanes = 1; |
640 | sizes[0] = PAGE_ALIGN(s->buffersize); | 638 | sizes[0] = PAGE_ALIGN(s->buffersize); |
641 | dev_dbg(&s->udev->dev, "%s: nbuffers=%d sizes[0]=%d\n", | 639 | dev_dbg(&s->udev->dev, "nbuffers=%d sizes[0]=%d\n", |
642 | __func__, *nbuffers, sizes[0]); | 640 | *nbuffers, sizes[0]); |
643 | return 0; | 641 | return 0; |
644 | } | 642 | } |
645 | 643 | ||
@@ -659,7 +657,7 @@ static void rtl2832_sdr_buf_queue(struct vb2_buffer *vb) | |||
659 | struct rtl2832_sdr_state *s = vb2_get_drv_priv(vb->vb2_queue); | 657 | struct rtl2832_sdr_state *s = vb2_get_drv_priv(vb->vb2_queue); |
660 | struct rtl2832_sdr_frame_buf *buf = | 658 | struct rtl2832_sdr_frame_buf *buf = |
661 | container_of(vb, struct rtl2832_sdr_frame_buf, vb); | 659 | container_of(vb, struct rtl2832_sdr_frame_buf, vb); |
662 | unsigned long flags = 0; | 660 | unsigned long flags; |
663 | 661 | ||
664 | /* Check the device has not disconnected between prep and queuing */ | 662 | /* Check the device has not disconnected between prep and queuing */ |
665 | if (!s->udev) { | 663 | if (!s->udev) { |
@@ -681,7 +679,7 @@ static int rtl2832_sdr_set_adc(struct rtl2832_sdr_state *s) | |||
681 | u64 u64tmp; | 679 | u64 u64tmp; |
682 | u32 u32tmp; | 680 | u32 u32tmp; |
683 | 681 | ||
684 | dev_dbg(&s->udev->dev, "%s: f_adc=%u\n", __func__, s->f_adc); | 682 | dev_dbg(&s->udev->dev, "f_adc=%u\n", s->f_adc); |
685 | 683 | ||
686 | if (!test_bit(POWER_ON, &s->flags)) | 684 | if (!test_bit(POWER_ON, &s->flags)) |
687 | return 0; | 685 | return 0; |
@@ -715,8 +713,7 @@ static int rtl2832_sdr_set_adc(struct rtl2832_sdr_state *s) | |||
715 | u64tmp = -u64tmp; | 713 | u64tmp = -u64tmp; |
716 | u32tmp = u64tmp & 0x3fffff; | 714 | u32tmp = u64tmp & 0x3fffff; |
717 | 715 | ||
718 | dev_dbg(&s->udev->dev, "%s: f_if=%u if_ctl=%08x\n", | 716 | dev_dbg(&s->udev->dev, "f_if=%u if_ctl=%08x\n", f_if, u32tmp); |
719 | __func__, f_if, u32tmp); | ||
720 | 717 | ||
721 | buf[0] = (u32tmp >> 16) & 0xff; | 718 | buf[0] = (u32tmp >> 16) & 0xff; |
722 | buf[1] = (u32tmp >> 8) & 0xff; | 719 | buf[1] = (u32tmp >> 8) & 0xff; |
@@ -903,7 +900,7 @@ static void rtl2832_sdr_unset_adc(struct rtl2832_sdr_state *s) | |||
903 | { | 900 | { |
904 | int ret; | 901 | int ret; |
905 | 902 | ||
906 | dev_dbg(&s->udev->dev, "%s:\n", __func__); | 903 | dev_dbg(&s->udev->dev, "\n"); |
907 | 904 | ||
908 | /* PID filter */ | 905 | /* PID filter */ |
909 | ret = rtl2832_sdr_wr_regs(s, 0x061, "\xe0", 1); | 906 | ret = rtl2832_sdr_wr_regs(s, 0x061, "\xe0", 1); |
@@ -964,8 +961,8 @@ static int rtl2832_sdr_set_tuner_freq(struct rtl2832_sdr_state *s) | |||
964 | c->frequency = s->f_tuner; | 961 | c->frequency = s->f_tuner; |
965 | c->delivery_system = SYS_DVBT; | 962 | c->delivery_system = SYS_DVBT; |
966 | 963 | ||
967 | dev_dbg(&s->udev->dev, "%s: frequency=%u bandwidth=%d\n", | 964 | dev_dbg(&s->udev->dev, "frequency=%u bandwidth=%d\n", |
968 | __func__, c->frequency, c->bandwidth_hz); | 965 | c->frequency, c->bandwidth_hz); |
969 | 966 | ||
970 | if (!test_bit(POWER_ON, &s->flags)) | 967 | if (!test_bit(POWER_ON, &s->flags)) |
971 | return 0; | 968 | return 0; |
@@ -980,7 +977,7 @@ static int rtl2832_sdr_set_tuner(struct rtl2832_sdr_state *s) | |||
980 | { | 977 | { |
981 | struct dvb_frontend *fe = s->fe; | 978 | struct dvb_frontend *fe = s->fe; |
982 | 979 | ||
983 | dev_dbg(&s->udev->dev, "%s:\n", __func__); | 980 | dev_dbg(&s->udev->dev, "\n"); |
984 | 981 | ||
985 | if (fe->ops.tuner_ops.init) | 982 | if (fe->ops.tuner_ops.init) |
986 | fe->ops.tuner_ops.init(fe); | 983 | fe->ops.tuner_ops.init(fe); |
@@ -992,7 +989,7 @@ static void rtl2832_sdr_unset_tuner(struct rtl2832_sdr_state *s) | |||
992 | { | 989 | { |
993 | struct dvb_frontend *fe = s->fe; | 990 | struct dvb_frontend *fe = s->fe; |
994 | 991 | ||
995 | dev_dbg(&s->udev->dev, "%s:\n", __func__); | 992 | dev_dbg(&s->udev->dev, "\n"); |
996 | 993 | ||
997 | if (fe->ops.tuner_ops.sleep) | 994 | if (fe->ops.tuner_ops.sleep) |
998 | fe->ops.tuner_ops.sleep(fe); | 995 | fe->ops.tuner_ops.sleep(fe); |
@@ -1005,7 +1002,7 @@ static int rtl2832_sdr_start_streaming(struct vb2_queue *vq, unsigned int count) | |||
1005 | struct rtl2832_sdr_state *s = vb2_get_drv_priv(vq); | 1002 | struct rtl2832_sdr_state *s = vb2_get_drv_priv(vq); |
1006 | int ret; | 1003 | int ret; |
1007 | 1004 | ||
1008 | dev_dbg(&s->udev->dev, "%s:\n", __func__); | 1005 | dev_dbg(&s->udev->dev, "\n"); |
1009 | 1006 | ||
1010 | if (!s->udev) | 1007 | if (!s->udev) |
1011 | return -ENODEV; | 1008 | return -ENODEV; |
@@ -1054,7 +1051,7 @@ static void rtl2832_sdr_stop_streaming(struct vb2_queue *vq) | |||
1054 | { | 1051 | { |
1055 | struct rtl2832_sdr_state *s = vb2_get_drv_priv(vq); | 1052 | struct rtl2832_sdr_state *s = vb2_get_drv_priv(vq); |
1056 | 1053 | ||
1057 | dev_dbg(&s->udev->dev, "%s:\n", __func__); | 1054 | dev_dbg(&s->udev->dev, "\n"); |
1058 | 1055 | ||
1059 | mutex_lock(&s->v4l2_lock); | 1056 | mutex_lock(&s->v4l2_lock); |
1060 | 1057 | ||
@@ -1088,8 +1085,7 @@ static int rtl2832_sdr_g_tuner(struct file *file, void *priv, | |||
1088 | { | 1085 | { |
1089 | struct rtl2832_sdr_state *s = video_drvdata(file); | 1086 | struct rtl2832_sdr_state *s = video_drvdata(file); |
1090 | 1087 | ||
1091 | dev_dbg(&s->udev->dev, "%s: index=%d type=%d\n", | 1088 | dev_dbg(&s->udev->dev, "index=%d type=%d\n", v->index, v->type); |
1092 | __func__, v->index, v->type); | ||
1093 | 1089 | ||
1094 | if (v->index == 0) { | 1090 | if (v->index == 0) { |
1095 | strlcpy(v->name, "ADC: Realtek RTL2832", sizeof(v->name)); | 1091 | strlcpy(v->name, "ADC: Realtek RTL2832", sizeof(v->name)); |
@@ -1115,7 +1111,7 @@ static int rtl2832_sdr_s_tuner(struct file *file, void *priv, | |||
1115 | { | 1111 | { |
1116 | struct rtl2832_sdr_state *s = video_drvdata(file); | 1112 | struct rtl2832_sdr_state *s = video_drvdata(file); |
1117 | 1113 | ||
1118 | dev_dbg(&s->udev->dev, "%s:\n", __func__); | 1114 | dev_dbg(&s->udev->dev, "\n"); |
1119 | 1115 | ||
1120 | if (v->index > 1) | 1116 | if (v->index > 1) |
1121 | return -EINVAL; | 1117 | return -EINVAL; |
@@ -1127,8 +1123,8 @@ static int rtl2832_sdr_enum_freq_bands(struct file *file, void *priv, | |||
1127 | { | 1123 | { |
1128 | struct rtl2832_sdr_state *s = video_drvdata(file); | 1124 | struct rtl2832_sdr_state *s = video_drvdata(file); |
1129 | 1125 | ||
1130 | dev_dbg(&s->udev->dev, "%s: tuner=%d type=%d index=%d\n", | 1126 | dev_dbg(&s->udev->dev, "tuner=%d type=%d index=%d\n", |
1131 | __func__, band->tuner, band->type, band->index); | 1127 | band->tuner, band->type, band->index); |
1132 | 1128 | ||
1133 | if (band->tuner == 0) { | 1129 | if (band->tuner == 0) { |
1134 | if (band->index >= ARRAY_SIZE(bands_adc)) | 1130 | if (band->index >= ARRAY_SIZE(bands_adc)) |
@@ -1153,8 +1149,8 @@ static int rtl2832_sdr_g_frequency(struct file *file, void *priv, | |||
1153 | struct rtl2832_sdr_state *s = video_drvdata(file); | 1149 | struct rtl2832_sdr_state *s = video_drvdata(file); |
1154 | int ret = 0; | 1150 | int ret = 0; |
1155 | 1151 | ||
1156 | dev_dbg(&s->udev->dev, "%s: tuner=%d type=%d\n", | 1152 | dev_dbg(&s->udev->dev, "tuner=%d type=%d\n", |
1157 | __func__, f->tuner, f->type); | 1153 | f->tuner, f->type); |
1158 | 1154 | ||
1159 | if (f->tuner == 0) { | 1155 | if (f->tuner == 0) { |
1160 | f->frequency = s->f_adc; | 1156 | f->frequency = s->f_adc; |
@@ -1175,8 +1171,8 @@ static int rtl2832_sdr_s_frequency(struct file *file, void *priv, | |||
1175 | struct rtl2832_sdr_state *s = video_drvdata(file); | 1171 | struct rtl2832_sdr_state *s = video_drvdata(file); |
1176 | int ret, band; | 1172 | int ret, band; |
1177 | 1173 | ||
1178 | dev_dbg(&s->udev->dev, "%s: tuner=%d type=%d frequency=%u\n", | 1174 | dev_dbg(&s->udev->dev, "tuner=%d type=%d frequency=%u\n", |
1179 | __func__, f->tuner, f->type, f->frequency); | 1175 | f->tuner, f->type, f->frequency); |
1180 | 1176 | ||
1181 | /* ADC band midpoints */ | 1177 | /* ADC band midpoints */ |
1182 | #define BAND_ADC_0 ((bands_adc[0].rangehigh + bands_adc[1].rangelow) / 2) | 1178 | #define BAND_ADC_0 ((bands_adc[0].rangehigh + bands_adc[1].rangelow) / 2) |
@@ -1194,15 +1190,13 @@ static int rtl2832_sdr_s_frequency(struct file *file, void *priv, | |||
1194 | bands_adc[band].rangelow, | 1190 | bands_adc[band].rangelow, |
1195 | bands_adc[band].rangehigh); | 1191 | bands_adc[band].rangehigh); |
1196 | 1192 | ||
1197 | dev_dbg(&s->udev->dev, "%s: ADC frequency=%u Hz\n", | 1193 | dev_dbg(&s->udev->dev, "ADC frequency=%u Hz\n", s->f_adc); |
1198 | __func__, s->f_adc); | ||
1199 | ret = rtl2832_sdr_set_adc(s); | 1194 | ret = rtl2832_sdr_set_adc(s); |
1200 | } else if (f->tuner == 1) { | 1195 | } else if (f->tuner == 1) { |
1201 | s->f_tuner = clamp_t(unsigned int, f->frequency, | 1196 | s->f_tuner = clamp_t(unsigned int, f->frequency, |
1202 | bands_fm[0].rangelow, | 1197 | bands_fm[0].rangelow, |
1203 | bands_fm[0].rangehigh); | 1198 | bands_fm[0].rangehigh); |
1204 | dev_dbg(&s->udev->dev, "%s: RF frequency=%u Hz\n", | 1199 | dev_dbg(&s->udev->dev, "RF frequency=%u Hz\n", f->frequency); |
1205 | __func__, f->frequency); | ||
1206 | 1200 | ||
1207 | ret = rtl2832_sdr_set_tuner_freq(s); | 1201 | ret = rtl2832_sdr_set_tuner_freq(s); |
1208 | } else { | 1202 | } else { |
@@ -1217,7 +1211,7 @@ static int rtl2832_sdr_enum_fmt_sdr_cap(struct file *file, void *priv, | |||
1217 | { | 1211 | { |
1218 | struct rtl2832_sdr_state *s = video_drvdata(file); | 1212 | struct rtl2832_sdr_state *s = video_drvdata(file); |
1219 | 1213 | ||
1220 | dev_dbg(&s->udev->dev, "%s:\n", __func__); | 1214 | dev_dbg(&s->udev->dev, "\n"); |
1221 | 1215 | ||
1222 | if (f->index >= s->num_formats) | 1216 | if (f->index >= s->num_formats) |
1223 | return -EINVAL; | 1217 | return -EINVAL; |
@@ -1233,7 +1227,7 @@ static int rtl2832_sdr_g_fmt_sdr_cap(struct file *file, void *priv, | |||
1233 | { | 1227 | { |
1234 | struct rtl2832_sdr_state *s = video_drvdata(file); | 1228 | struct rtl2832_sdr_state *s = video_drvdata(file); |
1235 | 1229 | ||
1236 | dev_dbg(&s->udev->dev, "%s:\n", __func__); | 1230 | dev_dbg(&s->udev->dev, "\n"); |
1237 | 1231 | ||
1238 | f->fmt.sdr.pixelformat = s->pixelformat; | 1232 | f->fmt.sdr.pixelformat = s->pixelformat; |
1239 | f->fmt.sdr.buffersize = s->buffersize; | 1233 | f->fmt.sdr.buffersize = s->buffersize; |
@@ -1250,7 +1244,7 @@ static int rtl2832_sdr_s_fmt_sdr_cap(struct file *file, void *priv, | |||
1250 | struct vb2_queue *q = &s->vb_queue; | 1244 | struct vb2_queue *q = &s->vb_queue; |
1251 | int i; | 1245 | int i; |
1252 | 1246 | ||
1253 | dev_dbg(&s->udev->dev, "%s: pixelformat fourcc %4.4s\n", __func__, | 1247 | dev_dbg(&s->udev->dev, "pixelformat fourcc %4.4s\n", |
1254 | (char *)&f->fmt.sdr.pixelformat); | 1248 | (char *)&f->fmt.sdr.pixelformat); |
1255 | 1249 | ||
1256 | if (vb2_is_busy(q)) | 1250 | if (vb2_is_busy(q)) |
@@ -1280,7 +1274,7 @@ static int rtl2832_sdr_try_fmt_sdr_cap(struct file *file, void *priv, | |||
1280 | struct rtl2832_sdr_state *s = video_drvdata(file); | 1274 | struct rtl2832_sdr_state *s = video_drvdata(file); |
1281 | int i; | 1275 | int i; |
1282 | 1276 | ||
1283 | dev_dbg(&s->udev->dev, "%s: pixelformat fourcc %4.4s\n", __func__, | 1277 | dev_dbg(&s->udev->dev, "pixelformat fourcc %4.4s\n", |
1284 | (char *)&f->fmt.sdr.pixelformat); | 1278 | (char *)&f->fmt.sdr.pixelformat); |
1285 | 1279 | ||
1286 | memset(f->fmt.sdr.reserved, 0, sizeof(f->fmt.sdr.reserved)); | 1280 | memset(f->fmt.sdr.reserved, 0, sizeof(f->fmt.sdr.reserved)); |
@@ -1354,8 +1348,8 @@ static int rtl2832_sdr_s_ctrl(struct v4l2_ctrl *ctrl) | |||
1354 | int ret; | 1348 | int ret; |
1355 | 1349 | ||
1356 | dev_dbg(&s->udev->dev, | 1350 | dev_dbg(&s->udev->dev, |
1357 | "%s: id=%d name=%s val=%d min=%lld max=%lld step=%lld\n", | 1351 | "id=%d name=%s val=%d min=%lld max=%lld step=%lld\n", |
1358 | __func__, ctrl->id, ctrl->name, ctrl->val, | 1352 | ctrl->id, ctrl->name, ctrl->val, |
1359 | ctrl->minimum, ctrl->maximum, ctrl->step); | 1353 | ctrl->minimum, ctrl->maximum, ctrl->step); |
1360 | 1354 | ||
1361 | switch (ctrl->id) { | 1355 | switch (ctrl->id) { |
@@ -1432,7 +1426,7 @@ struct dvb_frontend *rtl2832_sdr_attach(struct dvb_frontend *fe, | |||
1432 | s->pixelformat = formats[0].pixelformat; | 1426 | s->pixelformat = formats[0].pixelformat; |
1433 | s->buffersize = formats[0].buffersize; | 1427 | s->buffersize = formats[0].buffersize; |
1434 | s->num_formats = NUM_FORMATS; | 1428 | s->num_formats = NUM_FORMATS; |
1435 | if (rtl2832_sdr_emulated_fmt == false) | 1429 | if (!rtl2832_sdr_emulated_fmt) |
1436 | s->num_formats -= 1; | 1430 | s->num_formats -= 1; |
1437 | 1431 | ||
1438 | mutex_init(&s->v4l2_lock); | 1432 | mutex_init(&s->v4l2_lock); |