]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
V4L/DVB (11863): cx18: Initial attempt to get sliced VBI working for 625 line systems
authorAndy Walls <awalls@radix.net>
Mon, 11 May 2009 01:14:29 +0000 (22:14 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 16 Jun 2009 21:21:14 +0000 (18:21 -0300)
Initial changes to get sliced VBI for 625 line system working.  This is patch
is untested.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/cx18/cx18-av-core.c
drivers/media/video/cx18/cx18-av-vbi.c
drivers/media/video/cx18/cx18-streams.c

index 2b07b156340bc9d54826f0b0b384dbe5a0fcf34f..d98010e0da9c91bf412d8b56c12916e82d5f8e20 100644 (file)
@@ -288,17 +288,52 @@ void cx18_av_std_setup(struct cx18 *cx)
        else
                cx18_av_write(cx, 0x49f, 0x14);
 
+       /*
+        * Note: At the end of a field, there are 3 sets of half line duration
+        * (double horizontal rate) pulses:
+        *
+        * 5 (625) or 6 (525) half-lines to blank for the vertical retrace
+        * 5 (625) or 6 (525) vertical sync pulses of half line duration
+        * 5 (625) or 6 (525) half-lines of equalization pulses
+        */
        if (std & V4L2_STD_625_50) {
-               /* FIXME - revisit these for Sliced VBI */
+               /*
+                * The following relationships of half line counts should hold:
+                * 625 = vblank656 + vactive + postvactive
+                * 10 = vblank656 - vblank = vsync pulses + equalization pulses
+                *
+                * vblank656: half lines after line 625/mid-313 of blanked video
+                * vblank:    half lines, after line 5/317, of blanked video
+                * vactive:   half lines of active video
+                * postvactive: 5 half lines after the end of active video
+                *
+                * As far as I can tell:
+                * vblank656 starts counting from the falling edge of the first
+                *      vsync pulse (start of line 1 or mid-313)
+                * vblank starts counting from the after the 5 vsync pulses and
+                *      5 or 4 equalization pulses (start of line 6 or 318)
+                *
+                * For 625 line systems the driver will extract VBI information
+                * from lines 6-23 and lines 318-335 (but the slicer can only
+                * handle 17 lines, not the 18 in the vblank region).
+                */
+               vblank656 = 46; /* lines  1 -  23  &  313 - 335 */
+               vblank = 36;    /* lines  6 -  23  &  318 - 335 */
+               vactive = 574;  /* lines 24 - 310  &  336 - 622 */
+
+               /*
+                * For a 13.5 Mpps clock and 15,625 Hz line rate, a line is
+                * is 864 pixels = 720 active + 144 blanking.  ITU-R BT.601
+                * specifies 12 luma clock periods or ~ 0.9 * 13.5 Mpps after
+                * the end of active video to start a horizontal line, so that
+                * leaves 132 pixels of hblank to ignore.
+                */
                hblank = 132;
                hactive = 720;
-               burst = 93;
-               vblank = 36;
-               vactive = 580;
-               vblank656 = 40;
-               src_decimation = 0x21f;
 
+               burst = 93;
                luma_lpf = 2;
+               src_decimation = 0x21f;
                if (std & V4L2_STD_PAL) {
                        uv_lpf = 1;
                        comb = 0x20;
@@ -315,13 +350,13 @@ void cx18_av_std_setup(struct cx18 *cx)
        } else {
                /*
                 * The following relationships of half line counts should hold:
-                * 525 = vsync + vactive + vblank656
-                * 12 = vblank656 - vblank
+                * 525 = prevsync + vblank656 + vactive
+                * 12 = vblank656 - vblank = vsync pulses + equalization pulses
                 *
-                * vsync:     always 6 half-lines of vsync pulses
-                * vactive:   half lines of active video
+                * prevsync:  6 half-lines before the vsync pulses
                 * vblank656: half lines, after line 3/mid-266, of blanked video
                 * vblank:    half lines, after line 9/272, of blanked video
+                * vactive:   half lines of active video
                 *
                 * As far as I can tell:
                 * vblank656 starts counting from the falling edge of the first
@@ -954,9 +989,9 @@ static int cx18_av_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
                 * cx18_av_std_setup(), above standard values:
                 *
                 * 480 + 1 for 60 Hz systems
-                * 576 + 4 for 50 Hz systems
+                * 576 - 2 for 50 Hz systems
                 */
-               Vlines = pix->height + (is_50Hz ? 4 : 1);
+               Vlines = pix->height + (is_50Hz ? -2 : 1);
 
                /*
                 * Invalid height and width scaling requests are:
index 23b31670bf1dbc9143028ac2b68b78a1fb6844a1..640121448eb92262e93bb09cb6eeb097660bc1e2 100644 (file)
@@ -255,8 +255,8 @@ int cx18_av_vbi_s_fmt(struct cx18 *cx, struct v4l2_format *fmt)
        }
 
        cx18_av_write(cx, 0x43c, 0x16);
-       /* FIXME - should match vblank set in cx18_av_std_setup() */
-       cx18_av_write(cx, 0x474, is_pal ? 0x2a : 26);
+       /* Should match vblank set in cx18_av_std_setup() */
+       cx18_av_write(cx, 0x474, is_pal ? 36 : 26);
        return 0;
 }
 
index 41a1b2618aac4670f273e669b4e40438aba556e4..a0800393316e419660b79139e4f8c0d937b9048a 100644 (file)
@@ -371,9 +371,15 @@ static void cx18_vbi_setup(struct cx18_stream *s)
                 * Tell the encoder to capture 21-4+1=18 lines per field,
                 * since we want lines 10 through 21.
                 *
+                * For 625/50 systems, according to the VIP 2 & BT.656 std:
+                * The EAV RP code's Field bit toggles on line 1, a few lines
+                * after the Vertcal Blank bit has already toggled.
+                * Tell the encoder to capture 23-1+1=23 lines per field,
+                * since we want lines 6 through 23.
+                *
                 * FIXME - revisit for 625/50 systems
                 */
-               lines = cx->is_60hz ? (21 - 4 + 1) * 2 : 38;
+               lines = cx->is_60hz ? (21 - 4 + 1) * 2 : (23 - 1 + 1) * 2;
        }
 
        data[0] = s->handle;