diff options
author | klaas de waal <klaas.de.waal@gmail.com> | 2009-03-25 16:53:02 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:43:42 -0400 |
commit | cf47d878e5c7825836abf8d37fde025f7676db2b (patch) | |
tree | 188d364de147b3f663501bb2a22f26d5069ff389 /drivers/media/common | |
parent | 5ed2b6419ef48efda66a71d4b26bd2fa6b6a1ac7 (diff) |
V4L/DVB (11236): tda827x: fix locking issues with DVB-C
Separate tuning table for DVB-C solves tuning problem at 388MHz
TechnoTrend C-1501 DVB-C card does not lock on 388MHz. I assume that
existing frequency table is valid for DVB-T.
This is suggested by the name of the table: tda827xa_dvbt.
Added a table for DVB-C with the name tda827xa_dvbc.
Added runtime selection of the DVB-C table when the tuner is type
FE_QAM.
This should leave the behaviour of this driver with with DVB_T tuners
unchanged. This modification is in file tda827x.c
The tda827x.c gives the following warning message when debug=1:
tda827x: tda827x_config not defined, cannot set LNA gain!
Solved this by adding a tda827x_config struct in budget-ci.c.
Signed-off-by: Klaas de Waal <klaas.de.waal@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/common')
-rw-r--r-- | drivers/media/common/tuners/tda827x.c | 54 |
1 files changed, 45 insertions, 9 deletions
diff --git a/drivers/media/common/tuners/tda827x.c b/drivers/media/common/tuners/tda827x.c index 8cd55a83b381..36a7bc7585ab 100644 --- a/drivers/media/common/tuners/tda827x.c +++ b/drivers/media/common/tuners/tda827x.c | |||
@@ -351,7 +351,7 @@ struct tda827xa_data { | |||
351 | u8 gc3; | 351 | u8 gc3; |
352 | }; | 352 | }; |
353 | 353 | ||
354 | static const struct tda827xa_data tda827xa_dvbt[] = { | 354 | static struct tda827xa_data tda827xa_dvbt[] = { |
355 | { .lomax = 56875000, .svco = 3, .spd = 4, .scr = 0, .sbs = 0, .gc3 = 1}, | 355 | { .lomax = 56875000, .svco = 3, .spd = 4, .scr = 0, .sbs = 0, .gc3 = 1}, |
356 | { .lomax = 67250000, .svco = 0, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 1}, | 356 | { .lomax = 67250000, .svco = 0, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 1}, |
357 | { .lomax = 81250000, .svco = 1, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 1}, | 357 | { .lomax = 81250000, .svco = 1, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 1}, |
@@ -381,6 +381,36 @@ static const struct tda827xa_data tda827xa_dvbt[] = { | |||
381 | { .lomax = 0, .svco = 0, .spd = 0, .scr = 0, .sbs = 0, .gc3 = 0} | 381 | { .lomax = 0, .svco = 0, .spd = 0, .scr = 0, .sbs = 0, .gc3 = 0} |
382 | }; | 382 | }; |
383 | 383 | ||
384 | static struct tda827xa_data tda827xa_dvbc[] = { | ||
385 | { .lomax = 50125000, .svco = 2, .spd = 4, .scr = 2, .sbs = 0, .gc3 = 3}, | ||
386 | { .lomax = 58500000, .svco = 3, .spd = 4, .scr = 2, .sbs = 0, .gc3 = 3}, | ||
387 | { .lomax = 69250000, .svco = 0, .spd = 3, .scr = 2, .sbs = 0, .gc3 = 3}, | ||
388 | { .lomax = 83625000, .svco = 1, .spd = 3, .scr = 2, .sbs = 0, .gc3 = 3}, | ||
389 | { .lomax = 97500000, .svco = 2, .spd = 3, .scr = 2, .sbs = 0, .gc3 = 3}, | ||
390 | { .lomax = 100250000, .svco = 2, .spd = 3, .scr = 2, .sbs = 1, .gc3 = 1}, | ||
391 | { .lomax = 117000000, .svco = 3, .spd = 3, .scr = 2, .sbs = 1, .gc3 = 1}, | ||
392 | { .lomax = 138500000, .svco = 0, .spd = 2, .scr = 2, .sbs = 1, .gc3 = 1}, | ||
393 | { .lomax = 167250000, .svco = 1, .spd = 2, .scr = 2, .sbs = 1, .gc3 = 1}, | ||
394 | { .lomax = 187000000, .svco = 2, .spd = 2, .scr = 2, .sbs = 1, .gc3 = 1}, | ||
395 | { .lomax = 200500000, .svco = 2, .spd = 2, .scr = 2, .sbs = 2, .gc3 = 1}, | ||
396 | { .lomax = 234000000, .svco = 3, .spd = 2, .scr = 2, .sbs = 2, .gc3 = 3}, | ||
397 | { .lomax = 277000000, .svco = 0, .spd = 1, .scr = 2, .sbs = 2, .gc3 = 3}, | ||
398 | { .lomax = 325000000, .svco = 1, .spd = 1, .scr = 2, .sbs = 2, .gc3 = 1}, | ||
399 | { .lomax = 334500000, .svco = 1, .spd = 1, .scr = 2, .sbs = 3, .gc3 = 3}, | ||
400 | { .lomax = 401000000, .svco = 2, .spd = 1, .scr = 2, .sbs = 3, .gc3 = 3}, | ||
401 | { .lomax = 468000000, .svco = 3, .spd = 1, .scr = 2, .sbs = 3, .gc3 = 1}, | ||
402 | { .lomax = 535000000, .svco = 0, .spd = 0, .scr = 1, .sbs = 3, .gc3 = 1}, | ||
403 | { .lomax = 554000000, .svco = 0, .spd = 0, .scr = 2, .sbs = 3, .gc3 = 1}, | ||
404 | { .lomax = 638000000, .svco = 1, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 1}, | ||
405 | { .lomax = 669000000, .svco = 1, .spd = 0, .scr = 2, .sbs = 4, .gc3 = 1}, | ||
406 | { .lomax = 720000000, .svco = 2, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 1}, | ||
407 | { .lomax = 802000000, .svco = 2, .spd = 0, .scr = 2, .sbs = 4, .gc3 = 1}, | ||
408 | { .lomax = 835000000, .svco = 3, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 1}, | ||
409 | { .lomax = 885000000, .svco = 3, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 1}, | ||
410 | { .lomax = 911000000, .svco = 3, .spd = 0, .scr = 2, .sbs = 4, .gc3 = 1}, | ||
411 | { .lomax = 0, .svco = 0, .spd = 0, .scr = 0, .sbs = 0, .gc3 = 0} | ||
412 | }; | ||
413 | |||
384 | static struct tda827xa_data tda827xa_analog[] = { | 414 | static struct tda827xa_data tda827xa_analog[] = { |
385 | { .lomax = 56875000, .svco = 3, .spd = 4, .scr = 0, .sbs = 0, .gc3 = 3}, | 415 | { .lomax = 56875000, .svco = 3, .spd = 4, .scr = 0, .sbs = 0, .gc3 = 3}, |
386 | { .lomax = 67250000, .svco = 0, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 3}, | 416 | { .lomax = 67250000, .svco = 0, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 3}, |
@@ -484,6 +514,7 @@ static int tda827xa_set_params(struct dvb_frontend *fe, | |||
484 | struct dvb_frontend_parameters *params) | 514 | struct dvb_frontend_parameters *params) |
485 | { | 515 | { |
486 | struct tda827x_priv *priv = fe->tuner_priv; | 516 | struct tda827x_priv *priv = fe->tuner_priv; |
517 | struct tda827xa_data *frequency_map = tda827xa_dvbt; | ||
487 | u8 buf[11]; | 518 | u8 buf[11]; |
488 | 519 | ||
489 | struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0, | 520 | struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0, |
@@ -510,22 +541,27 @@ static int tda827xa_set_params(struct dvb_frontend *fe, | |||
510 | } | 541 | } |
511 | tuner_freq = params->frequency + if_freq; | 542 | tuner_freq = params->frequency + if_freq; |
512 | 543 | ||
544 | if (fe->ops.info.type == FE_QAM) { | ||
545 | dprintk("%s select tda827xa_dvbc\n", __func__); | ||
546 | frequency_map = tda827xa_dvbc; | ||
547 | } | ||
548 | |||
513 | i = 0; | 549 | i = 0; |
514 | while (tda827xa_dvbt[i].lomax < tuner_freq) { | 550 | while (frequency_map[i].lomax < tuner_freq) { |
515 | if(tda827xa_dvbt[i + 1].lomax == 0) | 551 | if (frequency_map[i + 1].lomax == 0) |
516 | break; | 552 | break; |
517 | i++; | 553 | i++; |
518 | } | 554 | } |
519 | 555 | ||
520 | N = ((tuner_freq + 31250) / 62500) << tda827xa_dvbt[i].spd; | 556 | N = ((tuner_freq + 31250) / 62500) << frequency_map[i].spd; |
521 | buf[0] = 0; // subaddress | 557 | buf[0] = 0; // subaddress |
522 | buf[1] = N >> 8; | 558 | buf[1] = N >> 8; |
523 | buf[2] = N & 0xff; | 559 | buf[2] = N & 0xff; |
524 | buf[3] = 0; | 560 | buf[3] = 0; |
525 | buf[4] = 0x16; | 561 | buf[4] = 0x16; |
526 | buf[5] = (tda827xa_dvbt[i].spd << 5) + (tda827xa_dvbt[i].svco << 3) + | 562 | buf[5] = (frequency_map[i].spd << 5) + (frequency_map[i].svco << 3) + |
527 | tda827xa_dvbt[i].sbs; | 563 | frequency_map[i].sbs; |
528 | buf[6] = 0x4b + (tda827xa_dvbt[i].gc3 << 4); | 564 | buf[6] = 0x4b + (frequency_map[i].gc3 << 4); |
529 | buf[7] = 0x1c; | 565 | buf[7] = 0x1c; |
530 | buf[8] = 0x06; | 566 | buf[8] = 0x06; |
531 | buf[9] = 0x24; | 567 | buf[9] = 0x24; |
@@ -584,7 +620,7 @@ static int tda827xa_set_params(struct dvb_frontend *fe, | |||
584 | 620 | ||
585 | /* correct CP value */ | 621 | /* correct CP value */ |
586 | buf[0] = 0x30; | 622 | buf[0] = 0x30; |
587 | buf[1] = 0x10 + tda827xa_dvbt[i].scr; | 623 | buf[1] = 0x10 + frequency_map[i].scr; |
588 | rc = tuner_transfer(fe, &msg, 1); | 624 | rc = tuner_transfer(fe, &msg, 1); |
589 | if (rc < 0) | 625 | if (rc < 0) |
590 | goto err; | 626 | goto err; |
@@ -599,7 +635,7 @@ static int tda827xa_set_params(struct dvb_frontend *fe, | |||
599 | msleep(3); | 635 | msleep(3); |
600 | /* freeze AGC1 */ | 636 | /* freeze AGC1 */ |
601 | buf[0] = 0x50; | 637 | buf[0] = 0x50; |
602 | buf[1] = 0x4f + (tda827xa_dvbt[i].gc3 << 4); | 638 | buf[1] = 0x4f + (frequency_map[i].gc3 << 4); |
603 | rc = tuner_transfer(fe, &msg, 1); | 639 | rc = tuner_transfer(fe, &msg, 1); |
604 | if (rc < 0) | 640 | if (rc < 0) |
605 | goto err; | 641 | goto err; |