diff options
author | Andy Walls <awalls@radix.net> | 2009-05-16 21:43:43 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-06-16 17:21:14 -0400 |
commit | 86bc85b38602411a9582b829fdd0ee02cf582985 (patch) | |
tree | 5b55cc3ed192fe2e629b0cae7892963089d10299 /drivers/media/video/cx18 | |
parent | 929a3ad1525895c394cbe97a6b74792da9a865a6 (diff) |
V4L/DVB (11865): cx18: Tweak color burst gate delay and initial color sub-carrier freq
Fix the burst gate delays to use a crystal value of 28636360 as assumed by
the rest of the driver. Also have the initial color sub-carrier freq paramter
use the src decimation ratio per the documentation, instead of the actual
crystal/pixel clock ratio. The tracking circuit will find the correct color
subcarrier in any case, as long as we're close. Also fix up some debug print
statements.
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.c | 69 |
1 files changed, 48 insertions, 21 deletions
diff --git a/drivers/media/video/cx18/cx18-av-core.c b/drivers/media/video/cx18/cx18-av-core.c index 33ec269a0f5e..0b3d840cc2e2 100644 --- a/drivers/media/video/cx18/cx18-av-core.c +++ b/drivers/media/video/cx18/cx18-av-core.c | |||
@@ -277,8 +277,15 @@ void cx18_av_std_setup(struct cx18 *cx) | |||
277 | struct cx18_av_state *state = &cx->av_state; | 277 | struct cx18_av_state *state = &cx->av_state; |
278 | struct v4l2_subdev *sd = &state->sd; | 278 | struct v4l2_subdev *sd = &state->sd; |
279 | v4l2_std_id std = state->std; | 279 | v4l2_std_id std = state->std; |
280 | |||
281 | /* | ||
282 | * Video ADC crystal clock to pixel clock SRC decimation ratio | ||
283 | * 28.636360 MHz/13.5 Mpps * 256 = 0x21f.07b | ||
284 | */ | ||
285 | const int src_decimation = 0x21f; | ||
286 | |||
280 | int hblank, hactive, burst, vblank, vactive, sc; | 287 | int hblank, hactive, burst, vblank, vactive, sc; |
281 | int vblank656, src_decimation; | 288 | int vblank656; |
282 | int luma_lpf, uv_lpf, comb; | 289 | int luma_lpf, uv_lpf, comb; |
283 | u32 pll_int, pll_frac, pll_post; | 290 | u32 pll_int, pll_frac, pll_post; |
284 | 291 | ||
@@ -342,21 +349,31 @@ void cx18_av_std_setup(struct cx18 *cx) | |||
342 | hblank = 132; | 349 | hblank = 132; |
343 | hactive = 720; | 350 | hactive = 720; |
344 | 351 | ||
352 | /* | ||
353 | * Burst gate delay (for 625 line systems) | ||
354 | * Hsync leading edge to color burst rise = 5.6 us | ||
355 | * Color burst width = 2.25 us | ||
356 | * Gate width = 4 pixel clocks | ||
357 | * (5.6 us + 2.25/2 us) * 13.5 Mpps + 4/2 clocks = 92.79 clocks | ||
358 | */ | ||
345 | burst = 93; | 359 | burst = 93; |
346 | luma_lpf = 2; | 360 | luma_lpf = 2; |
347 | src_decimation = 0x21f; | ||
348 | if (std & V4L2_STD_PAL) { | 361 | if (std & V4L2_STD_PAL) { |
349 | uv_lpf = 1; | 362 | uv_lpf = 1; |
350 | comb = 0x20; | 363 | comb = 0x20; |
351 | sc = 688739; | 364 | /* sc = 4433618.75 * src_decimation/28636360 * 2^13 */ |
365 | sc = 688700; | ||
352 | } else if (std == V4L2_STD_PAL_Nc) { | 366 | } else if (std == V4L2_STD_PAL_Nc) { |
353 | uv_lpf = 1; | 367 | uv_lpf = 1; |
354 | comb = 0x20; | 368 | comb = 0x20; |
355 | sc = 556453; | 369 | /* sc = 3582056.25 * src_decimation/28636360 * 2^13 */ |
370 | sc = 556422; | ||
356 | } else { /* SECAM */ | 371 | } else { /* SECAM */ |
357 | uv_lpf = 0; | 372 | uv_lpf = 0; |
358 | comb = 0; | 373 | comb = 0; |
359 | sc = 672351; | 374 | /* (fr + fb)/2 = (4406260 + 4250000)/2 = 4328130 */ |
375 | /* sc = 4328130 * src_decimation/28636360 * 2^13 */ | ||
376 | sc = 672314; | ||
360 | } | 377 | } |
361 | } else { | 378 | } else { |
362 | /* | 379 | /* |
@@ -394,20 +411,30 @@ void cx18_av_std_setup(struct cx18 *cx) | |||
394 | luma_lpf = 1; | 411 | luma_lpf = 1; |
395 | uv_lpf = 1; | 412 | uv_lpf = 1; |
396 | 413 | ||
397 | src_decimation = 0x21f; | 414 | /* |
415 | * Burst gate delay (for 525 line systems) | ||
416 | * Hsync leading edge to color burst rise = 5.3 us | ||
417 | * Color burst width = 2.5 us | ||
418 | * Gate width = 4 pixel clocks | ||
419 | * (5.3 us + 2.5/2 us) * 13.5 Mpps + 4/2 clocks = 90.425 clocks | ||
420 | */ | ||
398 | if (std == V4L2_STD_PAL_60) { | 421 | if (std == V4L2_STD_PAL_60) { |
399 | burst = 0x5b; | 422 | burst = 90; |
400 | luma_lpf = 2; | 423 | luma_lpf = 2; |
401 | comb = 0x20; | 424 | comb = 0x20; |
402 | sc = 688739; | 425 | /* sc = 4433618.75 * src_decimation/28636360 * 2^13 */ |
426 | sc = 688700; | ||
403 | } else if (std == V4L2_STD_PAL_M) { | 427 | } else if (std == V4L2_STD_PAL_M) { |
404 | burst = 0x61; | 428 | /* The 97 needs to be verified against PAL-M timings */ |
429 | burst = 97; | ||
405 | comb = 0x20; | 430 | comb = 0x20; |
406 | sc = 555452; | 431 | /* sc = 3575611.49 * src_decimation/28636360 * 2^13 */ |
432 | sc = 555421; | ||
407 | } else { | 433 | } else { |
408 | burst = 0x5b; | 434 | burst = 90; |
409 | comb = 0x66; | 435 | comb = 0x66; |
410 | sc = 556063; | 436 | /* sc = 3579545.45.. * src_decimation/28636360 * 2^13 */ |
437 | sc = 556032; | ||
411 | } | 438 | } |
412 | } | 439 | } |
413 | 440 | ||
@@ -419,23 +446,23 @@ void cx18_av_std_setup(struct cx18 *cx) | |||
419 | pll_int, pll_frac, pll_post); | 446 | pll_int, pll_frac, pll_post); |
420 | 447 | ||
421 | if (pll_post) { | 448 | if (pll_post) { |
422 | int fin, fsc, pll; | 449 | int fsc, pll; |
423 | 450 | ||
424 | pll = (28636360L * ((((u64)pll_int) << 25) + pll_frac)) >> 25; | 451 | pll = (28636360L * ((((u64)pll_int) << 25) + pll_frac)) >> 25; |
425 | pll /= pll_post; | 452 | pll /= pll_post; |
426 | CX18_DEBUG_INFO_DEV(sd, "PLL = %d.%06d MHz\n", | 453 | CX18_DEBUG_INFO_DEV(sd, "Video PLL = %d.%06d MHz\n", |
427 | pll / 1000000, pll % 1000000); | 454 | pll / 1000000, pll % 1000000); |
428 | CX18_DEBUG_INFO_DEV(sd, "PLL/8 = %d.%06d MHz\n", | 455 | CX18_DEBUG_INFO_DEV(sd, "Pixel rate = %d.%06d Mpixel/sec\n", |
429 | pll / 8000000, (pll / 8) % 1000000); | 456 | pll / 8000000, (pll / 8) % 1000000); |
430 | 457 | ||
431 | fin = ((u64)src_decimation * pll) >> 12; | 458 | CX18_DEBUG_INFO_DEV(sd, "ADC XTAL/pixel clock decimation ratio " |
432 | CX18_DEBUG_INFO_DEV(sd, "ADC Sampling freq = %d.%06d MHz\n", | 459 | "= %d.%03d\n", src_decimation / 256, |
433 | fin / 1000000, fin % 1000000); | 460 | ((src_decimation % 256) * 1000) / 256); |
434 | 461 | ||
435 | fsc = (((u64)sc) * pll) >> 24L; | 462 | fsc = ((((u64)sc) * 28636360)/src_decimation) >> 13L; |
436 | CX18_DEBUG_INFO_DEV(sd, | 463 | CX18_DEBUG_INFO_DEV(sd, |
437 | "Chroma sub-carrier freq = %d.%06d MHz\n", | 464 | "Chroma sub-carrier initial freq = %d.%06d " |
438 | fsc / 1000000, fsc % 1000000); | 465 | "MHz\n", fsc / 1000000, fsc % 1000000); |
439 | 466 | ||
440 | CX18_DEBUG_INFO_DEV(sd, "hblank %i, hactive %i, vblank %i, " | 467 | CX18_DEBUG_INFO_DEV(sd, "hblank %i, hactive %i, vblank %i, " |
441 | "vactive %i, vblank656 %i, src_dec %i, " | 468 | "vactive %i, vblank656 %i, src_dec %i, " |