diff options
author | Andy Walls <awalls@radix.net> | 2009-01-30 22:33:02 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:42:38 -0400 |
commit | 302df9702192a68578916ef922c33370cbba350d (patch) | |
tree | eab3173a4b82ec26c89b82c50e9bfb0fe2477953 /drivers/media/video/cx18/cx18-driver.c | |
parent | 4325dff220918c2ced82d16c3475d9a5afb1cab3 (diff) |
V4L/DVB (10439): cx18: Clean-up and enable sliced VBI handling
Removed legacy ivtv state variables, added comments, and cleaned
up sliced VBI related code. Enabled sliced VBI.
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx18/cx18-driver.c')
-rw-r--r-- | drivers/media/video/cx18/cx18-driver.c | 49 |
1 files changed, 3 insertions, 46 deletions
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c index 062f1910e8dd..842ce636e45c 100644 --- a/drivers/media/video/cx18/cx18-driver.c +++ b/drivers/media/video/cx18/cx18-driver.c | |||
@@ -586,7 +586,8 @@ static int __devinit cx18_init_struct1(struct cx18 *cx) | |||
586 | (cx->params.video_temporal_filter_mode << 1) | | 586 | (cx->params.video_temporal_filter_mode << 1) | |
587 | (cx->params.video_median_filter_type << 2); | 587 | (cx->params.video_median_filter_type << 2); |
588 | cx->params.port = CX2341X_PORT_MEMORY; | 588 | cx->params.port = CX2341X_PORT_MEMORY; |
589 | cx->params.capabilities = CX2341X_CAP_HAS_TS | CX2341X_CAP_HAS_AC3; | 589 | cx->params.capabilities = |
590 | CX2341X_CAP_HAS_TS | CX2341X_CAP_HAS_AC3 | CX2341X_CAP_HAS_SLICED_VBI; | ||
590 | init_waitqueue_head(&cx->cap_w); | 591 | init_waitqueue_head(&cx->cap_w); |
591 | init_waitqueue_head(&cx->mb_apu_waitq); | 592 | init_waitqueue_head(&cx->mb_apu_waitq); |
592 | init_waitqueue_head(&cx->mb_cpu_waitq); | 593 | init_waitqueue_head(&cx->mb_cpu_waitq); |
@@ -596,49 +597,6 @@ static int __devinit cx18_init_struct1(struct cx18 *cx) | |||
596 | cx->vbi.in.type = V4L2_BUF_TYPE_VBI_CAPTURE; | 597 | cx->vbi.in.type = V4L2_BUF_TYPE_VBI_CAPTURE; |
597 | cx->vbi.sliced_in = &cx->vbi.in.fmt.sliced; | 598 | cx->vbi.sliced_in = &cx->vbi.in.fmt.sliced; |
598 | 599 | ||
599 | /* | ||
600 | * The VBI line sizes depend on the pixel clock and the horiz rate | ||
601 | * | ||
602 | * (1/Fh)*(2*Fp) = Samples/line | ||
603 | * = 4 bytes EAV + Anc data in hblank + 4 bytes SAV + active samples | ||
604 | * | ||
605 | * Sliced VBI is sent as ancillary data during horizontal blanking | ||
606 | * Raw VBI is sent as active video samples during vertcal blanking | ||
607 | * | ||
608 | * We use a BT.656 pxiel clock of 13.5 MHz and a BT.656 active line | ||
609 | * length of 720 pixels @ 4:2:2 sampling. Thus... | ||
610 | * | ||
611 | * For systems that use a 15.734 kHz horizontal rate, such as | ||
612 | * NTSC-M, PAL-M, PAL-60, and other 60 Hz/525 line systems, we have: | ||
613 | * | ||
614 | * (1/15.734 kHz) * 2 * 13.5 MHz = 1716 samples/line = | ||
615 | * 4 bytes SAV + 268 bytes anc data + 4 bytes SAV + 1440 active samples | ||
616 | * | ||
617 | * For systems that use a 15.625 kHz horizontal rate, such as | ||
618 | * PAL-B/G/H, PAL-I, SECAM-L and other 50 Hz/625 line systems, we have: | ||
619 | * | ||
620 | * (1/15.625 kHz) * 2 * 13.5 MHz = 1728 samples/line = | ||
621 | * 4 bytes SAV + 280 bytes anc data + 4 bytes SAV + 1440 active samples | ||
622 | * | ||
623 | */ | ||
624 | |||
625 | /* FIXME: init these based on tuner std & modify when std changes */ | ||
626 | /* CX18-AV-Core number of VBI samples output per horizontal line */ | ||
627 | cx->vbi.raw_decoder_line_size = 1444; /* 4 byte SAV + 2 * 720 */ | ||
628 | cx->vbi.sliced_decoder_line_size = 272; /* 60 Hz: 268+4, 50 Hz: 280+4 */ | ||
629 | |||
630 | /* CX18-AV-Core VBI samples/line possibly rounded up */ | ||
631 | cx->vbi.raw_size = 1444; /* Real max size is 1444 */ | ||
632 | cx->vbi.sliced_size = 284; /* Real max size is 284 */ | ||
633 | |||
634 | /* | ||
635 | * CX18-AV-Core SAV/EAV RP codes in VIP 1.x mode | ||
636 | * Task Field VerticalBlank HorizontalBlank 0 0 0 0 | ||
637 | */ | ||
638 | cx->vbi.raw_decoder_sav_odd_field = 0x20; /* V */ | ||
639 | cx->vbi.raw_decoder_sav_even_field = 0x60; /* FV */ | ||
640 | cx->vbi.sliced_decoder_sav_odd_field = 0xB0; /* T VH - actually EAV */ | ||
641 | cx->vbi.sliced_decoder_sav_even_field = 0xF0; /* TFVH - actually EAV */ | ||
642 | return 0; | 600 | return 0; |
643 | } | 601 | } |
644 | 602 | ||
@@ -671,7 +629,6 @@ static void __devinit cx18_init_struct2(struct cx18 *cx) | |||
671 | cx->av_state.aud_input = CX18_AV_AUDIO8; | 629 | cx->av_state.aud_input = CX18_AV_AUDIO8; |
672 | cx->av_state.audclk_freq = 48000; | 630 | cx->av_state.audclk_freq = 48000; |
673 | cx->av_state.audmode = V4L2_TUNER_MODE_LANG1; | 631 | cx->av_state.audmode = V4L2_TUNER_MODE_LANG1; |
674 | /* FIXME - 8 is NTSC value, investigate */ | ||
675 | cx->av_state.vbi_line_offset = 8; | 632 | cx->av_state.vbi_line_offset = 8; |
676 | } | 633 | } |
677 | 634 | ||
@@ -936,7 +893,7 @@ static int __devinit cx18_probe(struct pci_dev *pci_dev, | |||
936 | * suboptimal, as the CVBS and SVideo inputs could use a different std | 893 | * suboptimal, as the CVBS and SVideo inputs could use a different std |
937 | * and the buffer could end up being too small in that case. | 894 | * and the buffer could end up being too small in that case. |
938 | */ | 895 | */ |
939 | vbi_buf_size = cx->vbi.raw_size * (cx->is_60hz ? 24 : 36) / 2; | 896 | vbi_buf_size = vbi_active_samples * (cx->is_60hz ? 24 : 36) / 2; |
940 | cx->stream_buf_size[CX18_ENC_STREAM_TYPE_VBI] = vbi_buf_size; | 897 | cx->stream_buf_size[CX18_ENC_STREAM_TYPE_VBI] = vbi_buf_size; |
941 | 898 | ||
942 | if (cx->stream_buffers[CX18_ENC_STREAM_TYPE_VBI] < 0) | 899 | if (cx->stream_buffers[CX18_ENC_STREAM_TYPE_VBI] < 0) |