aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorManu Abraham <abraham.manu@gmail.com>2006-06-21 09:41:37 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-06-25 01:05:19 -0400
commit63ad4e445d683fc1bee748171a7fcb589546bf04 (patch)
tree46868ceff6747454a10db50e12d82e40b74e058b /drivers/media
parent77e0be12100a3d40abfa46ef54c323b6cfff41ed (diff)
V4L/DVB (4177): DCTNEW and ATSC fixes
Signed-off-by: Manu Abraham <manu@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/bt8xx/dst.c92
-rw-r--r--drivers/media/dvb/bt8xx/dst_common.h1
2 files changed, 63 insertions, 30 deletions
diff --git a/drivers/media/dvb/bt8xx/dst.c b/drivers/media/dvb/bt8xx/dst.c
index ff562fdae4a5..638131af9733 100644
--- a/drivers/media/dvb/bt8xx/dst.c
+++ b/drivers/media/dvb/bt8xx/dst.c
@@ -466,29 +466,41 @@ static int dst_set_symbolrate(struct dst_state *state, u32 srate)
466 } 466 }
467 dprintk(verbose, DST_INFO, 1, "set symrate %u", srate); 467 dprintk(verbose, DST_INFO, 1, "set symrate %u", srate);
468 srate /= 1000; 468 srate /= 1000;
469 if (state->type_flags & DST_TYPE_HAS_SYMDIV) { 469 if (state->dst_type == DST_TYPE_IS_SAT) {
470 sval = srate; 470 if (state->type_flags & DST_TYPE_HAS_SYMDIV) {
471 sval <<= 20; 471 sval = srate;
472 do_div(sval, 88000); 472 sval <<= 20;
473 symcalc = (u32) sval; 473 do_div(sval, 88000);
474 dprintk(verbose, DST_INFO, 1, "set symcalc %u", symcalc); 474 symcalc = (u32) sval;
475 state->tx_tuna[5] = (u8) (symcalc >> 12); 475 dprintk(verbose, DST_INFO, 1, "set symcalc %u", symcalc);
476 state->tx_tuna[6] = (u8) (symcalc >> 4); 476 state->tx_tuna[5] = (u8) (symcalc >> 12);
477 state->tx_tuna[7] = (u8) (symcalc << 4); 477 state->tx_tuna[6] = (u8) (symcalc >> 4);
478 } else { 478 state->tx_tuna[7] = (u8) (symcalc << 4);
479 state->tx_tuna[5] = (u8) (srate >> 16) & 0x7f; 479 } else {
480 state->tx_tuna[6] = (u8) (srate >> 8); 480 state->tx_tuna[5] = (u8) (srate >> 16) & 0x7f;
481 state->tx_tuna[7] = (u8) srate; 481 state->tx_tuna[6] = (u8) (srate >> 8);
482 } 482 state->tx_tuna[7] = (u8) srate;
483 state->tx_tuna[8] &= ~0x20; 483 }
484 if (state->type_flags & DST_TYPE_HAS_OBS_REGS) { 484 state->tx_tuna[8] &= ~0x20;
485 if (srate > 8000) 485 if (state->type_flags & DST_TYPE_HAS_OBS_REGS) {
486 state->tx_tuna[8] |= 0x20; 486 if (srate > 8000)
487 state->tx_tuna[8] |= 0x20;
488 }
489 } else if (state->dst_type == DST_TYPE_IS_CABLE) {
490 dprintk(verbose, DST_DEBUG, 1, "%s", state->fw_name);
491 if (!strncmp(state->fw_name, "DCTNEW", 6)) {
492 state->tx_tuna[5] = (u8) (srate >> 8);
493 state->tx_tuna[6] = (u8) srate;
494 state->tx_tuna[7] = 0x00;
495 } else if (!strncmp(state->fw_name, "DCT-CI", 6)) {
496 state->tx_tuna[5] = 0x00;
497 state->tx_tuna[6] = (u8) (srate >> 8);
498 state->tx_tuna[7] = (u8) srate;
499 }
487 } 500 }
488 return 0; 501 return 0;
489} 502}
490 503
491
492static int dst_set_modulation(struct dst_state *state, fe_modulation_t modulation) 504static int dst_set_modulation(struct dst_state *state, fe_modulation_t modulation)
493{ 505{
494 if (state->dst_type != DST_TYPE_IS_CABLE) 506 if (state->dst_type != DST_TYPE_IS_CABLE)
@@ -509,7 +521,10 @@ static int dst_set_modulation(struct dst_state *state, fe_modulation_t modulatio
509 state->tx_tuna[8] = 0x80; 521 state->tx_tuna[8] = 0x80;
510 break; 522 break;
511 case QAM_256: 523 case QAM_256:
512 state->tx_tuna[8] = 0x00; 524 if (!strncmp(state->fw_name, "DCTNEW", 6))
525 state->tx_tuna[8] = 0xff;
526 else if (!strncmp(state->fw_name, "DCT-CI", 6))
527 state->tx_tuna[8] = 0x00;
513 break; 528 break;
514 case QPSK: 529 case QPSK:
515 case QAM_AUTO: 530 case QAM_AUTO:
@@ -647,6 +662,13 @@ struct tuner_types tuner_list[] = {
647 { 662 {
648 .tuner_type = TUNER_TYPE_UNKNOWN, 663 .tuner_type = TUNER_TYPE_UNKNOWN,
649 .tuner_name = "UNKNOWN", 664 .tuner_name = "UNKNOWN",
665 .board_name = "VP2021",
666 .fw_name = "DCTNEW"
667 },
668
669 {
670 .tuner_type = TUNER_TYPE_UNKNOWN,
671 .tuner_name = "UNKNOWN",
650 .board_name = "VP2030", 672 .board_name = "VP2030",
651 .fw_name = "DCT-CI" 673 .fw_name = "DCT-CI"
652 }, 674 },
@@ -831,7 +853,7 @@ static struct dst_types dst_tlist[] = {
831 .device_id = "DCTNEW", 853 .device_id = "DCTNEW",
832 .offset = 1, 854 .offset = 1,
833 .dst_type = DST_TYPE_IS_CABLE, 855 .dst_type = DST_TYPE_IS_CABLE,
834 .type_flags = DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_3 | DST_TYPE_HAS_FW_BUILD, 856 .type_flags = DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_3 | DST_TYPE_HAS_FW_BUILD | DST_TYPE_MULTI_FE,
835 .dst_feature = 0, 857 .dst_feature = 0,
836 .tuner_type = 0 858 .tuner_type = 0
837 }, 859 },
@@ -1099,8 +1121,7 @@ static int dst_get_device_id(struct dst_state *state)
1099 /* Card capabilities */ 1121 /* Card capabilities */
1100 state->dst_hw_cap = p_dst_type->dst_feature; 1122 state->dst_hw_cap = p_dst_type->dst_feature;
1101 dprintk(verbose, DST_ERROR, 1, "Recognise [%s]", p_dst_type->device_id); 1123 dprintk(verbose, DST_ERROR, 1, "Recognise [%s]", p_dst_type->device_id);
1102 1124 strncpy(&state->fw_name[0], p_dst_type->device_id, 6);
1103// if (p_dst_type->tuner_type != TUNER_TYPE_MULTI) {
1104 /* Multiple tuners */ 1125 /* Multiple tuners */
1105 if (p_dst_type->tuner_type & TUNER_TYPE_MULTI) { 1126 if (p_dst_type->tuner_type & TUNER_TYPE_MULTI) {
1106 switch (use_dst_type) { 1127 switch (use_dst_type) {
@@ -1319,8 +1340,12 @@ static int dst_get_tuna(struct dst_state *state)
1319 state->diseq_flags &= ~(HAS_LOCK); 1340 state->diseq_flags &= ~(HAS_LOCK);
1320 if (!dst_wait_dst_ready(state, NO_DELAY)) 1341 if (!dst_wait_dst_ready(state, NO_DELAY))
1321 return -EIO; 1342 return -EIO;
1322 if (state->type_flags & DST_TYPE_HAS_NEWTUNE) 1343// if (state->type_flags & DST_TYPE_HAS_NEWTUNE)
1323 /* how to get variable length reply ???? */ 1344// /* how to get variable length reply ???? */
1345 if ((state->type_flags & DST_TYPE_HAS_NEWTUNE) &&
1346 !(state->dst_type == DST_TYPE_IS_CABLE) &&
1347 !(state->dst_type == DST_TYPE_IS_ATSC))
1348
1324 retval = read_dst(state, state->rx_tuna, 10); 1349 retval = read_dst(state, state->rx_tuna, 10);
1325 else 1350 else
1326 retval = read_dst(state, &state->rx_tuna[2], FIXED_COMM); 1351 retval = read_dst(state, &state->rx_tuna[2], FIXED_COMM);
@@ -1328,7 +1353,11 @@ static int dst_get_tuna(struct dst_state *state)
1328 dprintk(verbose, DST_DEBUG, 1, "read not successful"); 1353 dprintk(verbose, DST_DEBUG, 1, "read not successful");
1329 return retval; 1354 return retval;
1330 } 1355 }
1331 if (state->type_flags & DST_TYPE_HAS_NEWTUNE) { 1356// if (state->type_flags & DST_TYPE_HAS_NEWTUNE) {
1357 if ((state->type_flags & DST_TYPE_HAS_NEWTUNE) &&
1358 !(state->dst_type == DST_TYPE_IS_CABLE) &&
1359 !(state->dst_type == DST_TYPE_IS_ATSC) {
1360
1332 if (state->rx_tuna[9] != dst_check_sum(&state->rx_tuna[0], 9)) { 1361 if (state->rx_tuna[9] != dst_check_sum(&state->rx_tuna[0], 9)) {
1333 dprintk(verbose, DST_INFO, 1, "checksum failure ? "); 1362 dprintk(verbose, DST_INFO, 1, "checksum failure ? ");
1334 return -EIO; 1363 return -EIO;
@@ -1374,7 +1403,11 @@ static int dst_write_tuna(struct dvb_frontend *fe)
1374 dprintk(verbose, DST_DEBUG, 1, "DST Communication initialization failed."); 1403 dprintk(verbose, DST_DEBUG, 1, "DST Communication initialization failed.");
1375 goto error; 1404 goto error;
1376 } 1405 }
1377 if (state->type_flags & DST_TYPE_HAS_NEWTUNE) { 1406// if (state->type_flags & DST_TYPE_HAS_NEWTUNE) {
1407 if ((state->type_flags & DST_TYPE_HAS_NEWTUNE) &&
1408 (!(state->dst_type == DST_TYPE_IS_CABLE)) &&
1409 (!(state->dst_type == DST_TYPE_IS_ATSC))) {
1410
1378 state->tx_tuna[9] = dst_check_sum(&state->tx_tuna[0], 9); 1411 state->tx_tuna[9] = dst_check_sum(&state->tx_tuna[0], 9);
1379 retval = write_dst(state, &state->tx_tuna[0], 10); 1412 retval = write_dst(state, &state->tx_tuna[0], 10);
1380 } else { 1413 } else {
@@ -1528,8 +1561,7 @@ static int dst_init(struct dvb_frontend *fe)
1528 static u8 sat_tuna_204[] = { 0x00, 0x00, 0x03, 0xb6, 0x01, 0x55, 0xbd, 0x50, 0x00, 0x00 }; 1561 static u8 sat_tuna_204[] = { 0x00, 0x00, 0x03, 0xb6, 0x01, 0x55, 0xbd, 0x50, 0x00, 0x00 };
1529 static u8 ter_tuna_188[] = { 0x09, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 }; 1562 static u8 ter_tuna_188[] = { 0x09, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 };
1530 static u8 ter_tuna_204[] = { 0x00, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 }; 1563 static u8 ter_tuna_204[] = { 0x00, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 };
1531 static u8 cab_tuna_204[] = { 0x00, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 }; 1564 static u8 cable_tuna[] = { 0x00, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 };
1532 static u8 cab_tuna_188[] = { 0x09, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 };
1533 static u8 atsc_tuner[] = { 0x00, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 }; 1565 static u8 atsc_tuner[] = { 0x00, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 };
1534 1566
1535 state->inversion = INVERSION_OFF; 1567 state->inversion = INVERSION_OFF;
@@ -1544,7 +1576,7 @@ static int dst_init(struct dvb_frontend *fe)
1544 else if (state->dst_type == DST_TYPE_IS_TERR) 1576 else if (state->dst_type == DST_TYPE_IS_TERR)
1545 memcpy(state->tx_tuna, ((state->type_flags & DST_TYPE_HAS_NEWTUNE) ? ter_tuna_188 : ter_tuna_204), sizeof (ter_tuna_204)); 1577 memcpy(state->tx_tuna, ((state->type_flags & DST_TYPE_HAS_NEWTUNE) ? ter_tuna_188 : ter_tuna_204), sizeof (ter_tuna_204));
1546 else if (state->dst_type == DST_TYPE_IS_CABLE) 1578 else if (state->dst_type == DST_TYPE_IS_CABLE)
1547 memcpy(state->tx_tuna, ((state->type_flags & DST_TYPE_HAS_NEWTUNE) ? cab_tuna_188 : cab_tuna_204), sizeof (cab_tuna_204)); 1579 memcpy(state->tx_tuna, cable_tuna, sizeof (cable_tuna));
1548 else if (state->dst_type == DST_TYPE_IS_ATSC) 1580 else if (state->dst_type == DST_TYPE_IS_ATSC)
1549 memcpy(state->tx_tuna, atsc_tuner, sizeof (atsc_tuner)); 1581 memcpy(state->tx_tuna, atsc_tuner, sizeof (atsc_tuner));
1550 1582
diff --git a/drivers/media/dvb/bt8xx/dst_common.h b/drivers/media/dvb/bt8xx/dst_common.h
index abdaec848e17..cb5a6ebffe02 100644
--- a/drivers/media/dvb/bt8xx/dst_common.h
+++ b/drivers/media/dvb/bt8xx/dst_common.h
@@ -138,6 +138,7 @@ struct dst_state {
138 u32 tuner_type; 138 u32 tuner_type;
139 char *tuner_name; 139 char *tuner_name;
140 struct mutex dst_mutex; 140 struct mutex dst_mutex;
141 u8 fw_name[8];
141}; 142};
142 143
143struct tuner_types { 144struct tuner_types {