aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18/cx18-driver.c
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2008-12-12 18:00:29 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-30 06:38:33 -0500
commitaf009cf635141858642864a26602e379e97bf7d6 (patch)
treeab533c73375ed26f2575efe5ba12a3b3f9b22d4c /drivers/media/video/cx18/cx18-driver.c
parentdd073434b5285121007860914a004320d644ee7e (diff)
V4L/DVB (9806): cx18: Enable raw VBI capture
A combined authorship patch from Hans Verkuil and Andy Walls. Raw VBI can now be captured but requires a video capture to be in progress as well. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> 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.c49
1 files changed, 42 insertions, 7 deletions
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c
index e845cd653bb8..863ebf06a829 100644
--- a/drivers/media/video/cx18/cx18-driver.c
+++ b/drivers/media/video/cx18/cx18-driver.c
@@ -596,13 +596,47 @@ static int __devinit cx18_init_struct1(struct cx18 *cx)
596 /* VBI */ 596 /* VBI */
597 cx->vbi.in.type = V4L2_BUF_TYPE_VBI_CAPTURE; 597 cx->vbi.in.type = V4L2_BUF_TYPE_VBI_CAPTURE;
598 cx->vbi.sliced_in = &cx->vbi.in.fmt.sliced; 598 cx->vbi.sliced_in = &cx->vbi.in.fmt.sliced;
599 cx->vbi.raw_size = 1456; 599
600 cx->vbi.raw_decoder_line_size = 1456; 600 /*
601 cx->vbi.raw_decoder_sav_odd_field = 0x20; 601 * The VBI line sizes depend on the pixel clock and the horiz rate
602 cx->vbi.raw_decoder_sav_even_field = 0x60; 602 *
603 cx->vbi.sliced_decoder_line_size = 272; 603 * (1/Fh)*(2*Fp) = Samples/line
604 cx->vbi.sliced_decoder_sav_odd_field = 0xB0; 604 * = 4 bytes EAV + Anc data in hblank + 4 bytes SAV + active samples
605 cx->vbi.sliced_decoder_sav_even_field = 0xF0; 605 *
606 * Sliced VBI is sent as ancillary data during horizontal blanking
607 * Raw VBI is sent as active video samples during vertcal blanking
608 *
609 * We use a BT.656 pxiel clock of 13.5 MHz and a BT.656 active line
610 * length of 720 pixels @ 4:2:2 sampling. Thus...
611 *
612 * For NTSC:
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 PAL:
618 *
619 * (1/15,625 kHz) * 2 * 13.5 MHz = 1728 samples/line =
620 * 4 bytes SAV + 280 bytes anc data + 4 bytes SAV + 1440 active samples
621 *
622 */
623
624 /* CX18-AV-Core number of VBI samples output per horizontal line */
625 cx->vbi.raw_decoder_line_size = 1444; /* 4 byte SAV + 2 * 720 */
626 cx->vbi.sliced_decoder_line_size = 272; /* 60 Hz: 268+4, 50 Hz: 280+4 */
627
628 /* CX18-AV-Core VBI samples/line possibly rounded up */
629 cx->vbi.raw_size = 1444; /* Real max size is 1444 */
630 cx->vbi.sliced_size = 284; /* Real max size is 284 */
631
632 /*
633 * CX18-AV-Core SAV/EAV RP codes in VIP 1.x mode
634 * Task Field VerticalBlank HorizontalBlank 0 0 0 0
635 */
636 cx->vbi.raw_decoder_sav_odd_field = 0x20; /* V */
637 cx->vbi.raw_decoder_sav_even_field = 0x60; /* FV */
638 cx->vbi.sliced_decoder_sav_odd_field = 0xB0; /* T VH - actually EAV */
639 cx->vbi.sliced_decoder_sav_even_field = 0xF0; /* TFVH - actually EAV */
606 return 0; 640 return 0;
607} 641}
608 642
@@ -635,6 +669,7 @@ static void __devinit cx18_init_struct2(struct cx18 *cx)
635 cx->av_state.aud_input = CX18_AV_AUDIO8; 669 cx->av_state.aud_input = CX18_AV_AUDIO8;
636 cx->av_state.audclk_freq = 48000; 670 cx->av_state.audclk_freq = 48000;
637 cx->av_state.audmode = V4L2_TUNER_MODE_LANG1; 671 cx->av_state.audmode = V4L2_TUNER_MODE_LANG1;
672 /* FIXME - 8 is NTSC value, investigate */
638 cx->av_state.vbi_line_offset = 8; 673 cx->av_state.vbi_line_offset = 8;
639} 674}
640 675