aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2009-05-10 21:14:29 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-06-16 17:21:14 -0400
commit5ab740522fbee3a2ef83554b9a9c92692c8c0f74 (patch)
tree73b353ad969e281650a53e9ed1c55c4c5a1d3cb7 /drivers/media/video/cx18
parent1bc7f51c57c52cfac1a455d8f8ef99703e719e55 (diff)
V4L/DVB (11863): cx18: Initial attempt to get sliced VBI working for 625 line systems
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>
Diffstat (limited to 'drivers/media/video/cx18')
-rw-r--r--drivers/media/video/cx18/cx18-av-core.c59
-rw-r--r--drivers/media/video/cx18/cx18-av-vbi.c4
-rw-r--r--drivers/media/video/cx18/cx18-streams.c8
3 files changed, 56 insertions, 15 deletions
diff --git a/drivers/media/video/cx18/cx18-av-core.c b/drivers/media/video/cx18/cx18-av-core.c
index 2b07b156340b..d98010e0da9c 100644
--- a/drivers/media/video/cx18/cx18-av-core.c
+++ b/drivers/media/video/cx18/cx18-av-core.c
@@ -288,17 +288,52 @@ void cx18_av_std_setup(struct cx18 *cx)
288 else 288 else
289 cx18_av_write(cx, 0x49f, 0x14); 289 cx18_av_write(cx, 0x49f, 0x14);
290 290
291 /*
292 * Note: At the end of a field, there are 3 sets of half line duration
293 * (double horizontal rate) pulses:
294 *
295 * 5 (625) or 6 (525) half-lines to blank for the vertical retrace
296 * 5 (625) or 6 (525) vertical sync pulses of half line duration
297 * 5 (625) or 6 (525) half-lines of equalization pulses
298 */
291 if (std & V4L2_STD_625_50) { 299 if (std & V4L2_STD_625_50) {
292 /* FIXME - revisit these for Sliced VBI */ 300 /*
301 * The following relationships of half line counts should hold:
302 * 625 = vblank656 + vactive + postvactive
303 * 10 = vblank656 - vblank = vsync pulses + equalization pulses
304 *
305 * vblank656: half lines after line 625/mid-313 of blanked video
306 * vblank: half lines, after line 5/317, of blanked video
307 * vactive: half lines of active video
308 * postvactive: 5 half lines after the end of active video
309 *
310 * As far as I can tell:
311 * vblank656 starts counting from the falling edge of the first
312 * vsync pulse (start of line 1 or mid-313)
313 * vblank starts counting from the after the 5 vsync pulses and
314 * 5 or 4 equalization pulses (start of line 6 or 318)
315 *
316 * For 625 line systems the driver will extract VBI information
317 * from lines 6-23 and lines 318-335 (but the slicer can only
318 * handle 17 lines, not the 18 in the vblank region).
319 */
320 vblank656 = 46; /* lines 1 - 23 & 313 - 335 */
321 vblank = 36; /* lines 6 - 23 & 318 - 335 */
322 vactive = 574; /* lines 24 - 310 & 336 - 622 */
323
324 /*
325 * For a 13.5 Mpps clock and 15,625 Hz line rate, a line is
326 * is 864 pixels = 720 active + 144 blanking. ITU-R BT.601
327 * specifies 12 luma clock periods or ~ 0.9 * 13.5 Mpps after
328 * the end of active video to start a horizontal line, so that
329 * leaves 132 pixels of hblank to ignore.
330 */
293 hblank = 132; 331 hblank = 132;
294 hactive = 720; 332 hactive = 720;
295 burst = 93;
296 vblank = 36;
297 vactive = 580;
298 vblank656 = 40;
299 src_decimation = 0x21f;
300 333
334 burst = 93;
301 luma_lpf = 2; 335 luma_lpf = 2;
336 src_decimation = 0x21f;
302 if (std & V4L2_STD_PAL) { 337 if (std & V4L2_STD_PAL) {
303 uv_lpf = 1; 338 uv_lpf = 1;
304 comb = 0x20; 339 comb = 0x20;
@@ -315,13 +350,13 @@ void cx18_av_std_setup(struct cx18 *cx)
315 } else { 350 } else {
316 /* 351 /*
317 * The following relationships of half line counts should hold: 352 * The following relationships of half line counts should hold:
318 * 525 = vsync + vactive + vblank656 353 * 525 = prevsync + vblank656 + vactive
319 * 12 = vblank656 - vblank 354 * 12 = vblank656 - vblank = vsync pulses + equalization pulses
320 * 355 *
321 * vsync: always 6 half-lines of vsync pulses 356 * prevsync: 6 half-lines before the vsync pulses
322 * vactive: half lines of active video
323 * vblank656: half lines, after line 3/mid-266, of blanked video 357 * vblank656: half lines, after line 3/mid-266, of blanked video
324 * vblank: half lines, after line 9/272, of blanked video 358 * vblank: half lines, after line 9/272, of blanked video
359 * vactive: half lines of active video
325 * 360 *
326 * As far as I can tell: 361 * As far as I can tell:
327 * vblank656 starts counting from the falling edge of the first 362 * 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)
954 * cx18_av_std_setup(), above standard values: 989 * cx18_av_std_setup(), above standard values:
955 * 990 *
956 * 480 + 1 for 60 Hz systems 991 * 480 + 1 for 60 Hz systems
957 * 576 + 4 for 50 Hz systems 992 * 576 - 2 for 50 Hz systems
958 */ 993 */
959 Vlines = pix->height + (is_50Hz ? 4 : 1); 994 Vlines = pix->height + (is_50Hz ? -2 : 1);
960 995
961 /* 996 /*
962 * Invalid height and width scaling requests are: 997 * Invalid height and width scaling requests are:
diff --git a/drivers/media/video/cx18/cx18-av-vbi.c b/drivers/media/video/cx18/cx18-av-vbi.c
index 23b31670bf1d..640121448eb9 100644
--- a/drivers/media/video/cx18/cx18-av-vbi.c
+++ b/drivers/media/video/cx18/cx18-av-vbi.c
@@ -255,8 +255,8 @@ int cx18_av_vbi_s_fmt(struct cx18 *cx, struct v4l2_format *fmt)
255 } 255 }
256 256
257 cx18_av_write(cx, 0x43c, 0x16); 257 cx18_av_write(cx, 0x43c, 0x16);
258 /* FIXME - should match vblank set in cx18_av_std_setup() */ 258 /* Should match vblank set in cx18_av_std_setup() */
259 cx18_av_write(cx, 0x474, is_pal ? 0x2a : 26); 259 cx18_av_write(cx, 0x474, is_pal ? 36 : 26);
260 return 0; 260 return 0;
261} 261}
262 262
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c
index 41a1b2618aac..a0800393316e 100644
--- a/drivers/media/video/cx18/cx18-streams.c
+++ b/drivers/media/video/cx18/cx18-streams.c
@@ -371,9 +371,15 @@ static void cx18_vbi_setup(struct cx18_stream *s)
371 * Tell the encoder to capture 21-4+1=18 lines per field, 371 * Tell the encoder to capture 21-4+1=18 lines per field,
372 * since we want lines 10 through 21. 372 * since we want lines 10 through 21.
373 * 373 *
374 * For 625/50 systems, according to the VIP 2 & BT.656 std:
375 * The EAV RP code's Field bit toggles on line 1, a few lines
376 * after the Vertcal Blank bit has already toggled.
377 * Tell the encoder to capture 23-1+1=23 lines per field,
378 * since we want lines 6 through 23.
379 *
374 * FIXME - revisit for 625/50 systems 380 * FIXME - revisit for 625/50 systems
375 */ 381 */
376 lines = cx->is_60hz ? (21 - 4 + 1) * 2 : 38; 382 lines = cx->is_60hz ? (21 - 4 + 1) * 2 : (23 - 1 + 1) * 2;
377 } 383 }
378 384
379 data[0] = s->handle; 385 data[0] = s->handle;