diff options
Diffstat (limited to 'drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c')
-rw-r--r-- | drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | 264 |
1 files changed, 216 insertions, 48 deletions
diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c index 6ceae38125c7..14559ef6153c 100644 --- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | |||
@@ -30,6 +30,8 @@ | |||
30 | #include "tda1004x.h" | 30 | #include "tda1004x.h" |
31 | #include "stv0299.h" | 31 | #include "stv0299.h" |
32 | #include "tda8083.h" | 32 | #include "tda8083.h" |
33 | #include "stv0297.h" | ||
34 | #include "lnbp21.h" | ||
33 | 35 | ||
34 | #include <linux/dvb/frontend.h> | 36 | #include <linux/dvb/frontend.h> |
35 | #include <linux/dvb/dmx.h> | 37 | #include <linux/dvb/dmx.h> |
@@ -486,31 +488,6 @@ static int ttusb_send_diseqc(struct dvb_frontend* fe, | |||
486 | } | 488 | } |
487 | #endif | 489 | #endif |
488 | 490 | ||
489 | static int lnbp21_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage) | ||
490 | { | ||
491 | struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; | ||
492 | int ret; | ||
493 | u8 data[1]; | ||
494 | struct i2c_msg msg = { .addr = 0x08, .flags = 0, .buf = data, .len = sizeof(data) }; | ||
495 | |||
496 | switch(voltage) { | ||
497 | case SEC_VOLTAGE_OFF: | ||
498 | data[0] = 0x00; | ||
499 | break; | ||
500 | case SEC_VOLTAGE_13: | ||
501 | data[0] = 0x44; | ||
502 | break; | ||
503 | case SEC_VOLTAGE_18: | ||
504 | data[0] = 0x4c; | ||
505 | break; | ||
506 | default: | ||
507 | return -EINVAL; | ||
508 | }; | ||
509 | |||
510 | ret = i2c_transfer(&ttusb->i2c_adap, &msg, 1); | ||
511 | return (ret != 1) ? -EIO : 0; | ||
512 | } | ||
513 | |||
514 | static int ttusb_update_lnb(struct ttusb *ttusb) | 491 | static int ttusb_update_lnb(struct ttusb *ttusb) |
515 | { | 492 | { |
516 | u8 b[] = { 0xaa, ++ttusb->c, 0x16, 5, /*power: */ 1, | 493 | u8 b[] = { 0xaa, ++ttusb->c, 0x16, 5, /*power: */ 1, |
@@ -1048,7 +1025,7 @@ static u32 functionality(struct i2c_adapter *adapter) | |||
1048 | 1025 | ||
1049 | 1026 | ||
1050 | 1027 | ||
1051 | static int alps_tdmb7_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 1028 | static int alps_tdmb7_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
1052 | { | 1029 | { |
1053 | struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; | 1030 | struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; |
1054 | u8 data[4]; | 1031 | u8 data[4]; |
@@ -1062,20 +1039,21 @@ static int alps_tdmb7_pll_set(struct dvb_frontend* fe, struct dvb_frontend_param | |||
1062 | data[2] = ((div >> 10) & 0x60) | 0x85; | 1039 | data[2] = ((div >> 10) & 0x60) | 0x85; |
1063 | data[3] = params->frequency < 592000000 ? 0x40 : 0x80; | 1040 | data[3] = params->frequency < 592000000 ? 0x40 : 0x80; |
1064 | 1041 | ||
1042 | if (fe->ops.i2c_gate_ctrl) | ||
1043 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
1065 | if (i2c_transfer(&ttusb->i2c_adap, &msg, 1) != 1) return -EIO; | 1044 | if (i2c_transfer(&ttusb->i2c_adap, &msg, 1) != 1) return -EIO; |
1066 | return 0; | 1045 | return 0; |
1067 | } | 1046 | } |
1068 | 1047 | ||
1069 | static struct cx22700_config alps_tdmb7_config = { | 1048 | static struct cx22700_config alps_tdmb7_config = { |
1070 | .demod_address = 0x43, | 1049 | .demod_address = 0x43, |
1071 | .pll_set = alps_tdmb7_pll_set, | ||
1072 | }; | 1050 | }; |
1073 | 1051 | ||
1074 | 1052 | ||
1075 | 1053 | ||
1076 | 1054 | ||
1077 | 1055 | ||
1078 | static int philips_tdm1316l_pll_init(struct dvb_frontend* fe) | 1056 | static int philips_tdm1316l_tuner_init(struct dvb_frontend* fe) |
1079 | { | 1057 | { |
1080 | struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; | 1058 | struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; |
1081 | static u8 td1316_init[] = { 0x0b, 0xf5, 0x85, 0xab }; | 1059 | static u8 td1316_init[] = { 0x0b, 0xf5, 0x85, 0xab }; |
@@ -1083,6 +1061,8 @@ static int philips_tdm1316l_pll_init(struct dvb_frontend* fe) | |||
1083 | struct i2c_msg tuner_msg = { .addr=0x60, .flags=0, .buf=td1316_init, .len=sizeof(td1316_init) }; | 1061 | struct i2c_msg tuner_msg = { .addr=0x60, .flags=0, .buf=td1316_init, .len=sizeof(td1316_init) }; |
1084 | 1062 | ||
1085 | // setup PLL configuration | 1063 | // setup PLL configuration |
1064 | if (fe->ops.i2c_gate_ctrl) | ||
1065 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
1086 | if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) return -EIO; | 1066 | if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) return -EIO; |
1087 | msleep(1); | 1067 | msleep(1); |
1088 | 1068 | ||
@@ -1090,6 +1070,8 @@ static int philips_tdm1316l_pll_init(struct dvb_frontend* fe) | |||
1090 | tuner_msg.addr = 0x65; | 1070 | tuner_msg.addr = 0x65; |
1091 | tuner_msg.buf = disable_mc44BC374c; | 1071 | tuner_msg.buf = disable_mc44BC374c; |
1092 | tuner_msg.len = sizeof(disable_mc44BC374c); | 1072 | tuner_msg.len = sizeof(disable_mc44BC374c); |
1073 | if (fe->ops.i2c_gate_ctrl) | ||
1074 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
1093 | if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) { | 1075 | if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) { |
1094 | i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1); | 1076 | i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1); |
1095 | } | 1077 | } |
@@ -1097,7 +1079,7 @@ static int philips_tdm1316l_pll_init(struct dvb_frontend* fe) | |||
1097 | return 0; | 1079 | return 0; |
1098 | } | 1080 | } |
1099 | 1081 | ||
1100 | static int philips_tdm1316l_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 1082 | static int philips_tdm1316l_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
1101 | { | 1083 | { |
1102 | struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; | 1084 | struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; |
1103 | u8 tuner_buf[4]; | 1085 | u8 tuner_buf[4]; |
@@ -1157,6 +1139,8 @@ static int philips_tdm1316l_pll_set(struct dvb_frontend* fe, struct dvb_frontend | |||
1157 | tuner_buf[2] = 0xca; | 1139 | tuner_buf[2] = 0xca; |
1158 | tuner_buf[3] = (cp << 5) | (filter << 3) | band; | 1140 | tuner_buf[3] = (cp << 5) | (filter << 3) | band; |
1159 | 1141 | ||
1142 | if (fe->ops.i2c_gate_ctrl) | ||
1143 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
1160 | if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) | 1144 | if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) |
1161 | return -EIO; | 1145 | return -EIO; |
1162 | 1146 | ||
@@ -1176,8 +1160,6 @@ static struct tda1004x_config philips_tdm1316l_config = { | |||
1176 | .demod_address = 0x8, | 1160 | .demod_address = 0x8, |
1177 | .invert = 1, | 1161 | .invert = 1, |
1178 | .invert_oclk = 0, | 1162 | .invert_oclk = 0, |
1179 | .pll_init = philips_tdm1316l_pll_init, | ||
1180 | .pll_set = philips_tdm1316l_pll_set, | ||
1181 | .request_firmware = philips_tdm1316l_request_firmware, | 1163 | .request_firmware = philips_tdm1316l_request_firmware, |
1182 | }; | 1164 | }; |
1183 | 1165 | ||
@@ -1299,7 +1281,7 @@ static int alps_stv0299_set_symbol_rate(struct dvb_frontend *fe, u32 srate, u32 | |||
1299 | return 0; | 1281 | return 0; |
1300 | } | 1282 | } |
1301 | 1283 | ||
1302 | static int philips_tsa5059_pll_set(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters *params) | 1284 | static int philips_tsa5059_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
1303 | { | 1285 | { |
1304 | struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; | 1286 | struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; |
1305 | u8 buf[4]; | 1287 | u8 buf[4]; |
@@ -1322,7 +1304,9 @@ static int philips_tsa5059_pll_set(struct dvb_frontend *fe, struct i2c_adapter * | |||
1322 | if (ttusb->revision == TTUSB_REV_2_2) | 1304 | if (ttusb->revision == TTUSB_REV_2_2) |
1323 | buf[3] |= 0x20; | 1305 | buf[3] |= 0x20; |
1324 | 1306 | ||
1325 | if (i2c_transfer(i2c, &msg, 1) != 1) | 1307 | if (fe->ops.i2c_gate_ctrl) |
1308 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
1309 | if (i2c_transfer(&ttusb->i2c_adap, &msg, 1) != 1) | ||
1326 | return -EIO; | 1310 | return -EIO; |
1327 | 1311 | ||
1328 | return 0; | 1312 | return 0; |
@@ -1338,10 +1322,9 @@ static struct stv0299_config alps_stv0299_config = { | |||
1338 | .volt13_op0_op1 = STV0299_VOLT13_OP1, | 1322 | .volt13_op0_op1 = STV0299_VOLT13_OP1, |
1339 | .min_delay_ms = 100, | 1323 | .min_delay_ms = 100, |
1340 | .set_symbol_rate = alps_stv0299_set_symbol_rate, | 1324 | .set_symbol_rate = alps_stv0299_set_symbol_rate, |
1341 | .pll_set = philips_tsa5059_pll_set, | ||
1342 | }; | 1325 | }; |
1343 | 1326 | ||
1344 | static int ttusb_novas_grundig_29504_491_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | 1327 | static int ttusb_novas_grundig_29504_491_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
1345 | { | 1328 | { |
1346 | struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; | 1329 | struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; |
1347 | u8 buf[4]; | 1330 | u8 buf[4]; |
@@ -1355,6 +1338,8 @@ static int ttusb_novas_grundig_29504_491_pll_set(struct dvb_frontend *fe, struct | |||
1355 | buf[2] = 0x8e; | 1338 | buf[2] = 0x8e; |
1356 | buf[3] = 0x00; | 1339 | buf[3] = 0x00; |
1357 | 1340 | ||
1341 | if (fe->ops.i2c_gate_ctrl) | ||
1342 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
1358 | if (i2c_transfer(&ttusb->i2c_adap, &msg, 1) != 1) | 1343 | if (i2c_transfer(&ttusb->i2c_adap, &msg, 1) != 1) |
1359 | return -EIO; | 1344 | return -EIO; |
1360 | 1345 | ||
@@ -1364,10 +1349,9 @@ static int ttusb_novas_grundig_29504_491_pll_set(struct dvb_frontend *fe, struct | |||
1364 | static struct tda8083_config ttusb_novas_grundig_29504_491_config = { | 1349 | static struct tda8083_config ttusb_novas_grundig_29504_491_config = { |
1365 | 1350 | ||
1366 | .demod_address = 0x68, | 1351 | .demod_address = 0x68, |
1367 | .pll_set = ttusb_novas_grundig_29504_491_pll_set, | ||
1368 | }; | 1352 | }; |
1369 | 1353 | ||
1370 | static int alps_tdbe2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 1354 | static int alps_tdbe2_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
1371 | { | 1355 | { |
1372 | struct ttusb* ttusb = fe->dvb->priv; | 1356 | struct ttusb* ttusb = fe->dvb->priv; |
1373 | u32 div; | 1357 | u32 div; |
@@ -1381,6 +1365,8 @@ static int alps_tdbe2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_param | |||
1381 | data[2] = 0x85 | ((div >> 10) & 0x60); | 1365 | data[2] = 0x85 | ((div >> 10) & 0x60); |
1382 | data[3] = (params->frequency < 174000000 ? 0x88 : params->frequency < 470000000 ? 0x84 : 0x81); | 1366 | data[3] = (params->frequency < 174000000 ? 0x88 : params->frequency < 470000000 ? 0x84 : 0x81); |
1383 | 1367 | ||
1368 | if (fe->ops.i2c_gate_ctrl) | ||
1369 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
1384 | if (i2c_transfer (&ttusb->i2c_adap, &msg, 1) != 1) | 1370 | if (i2c_transfer (&ttusb->i2c_adap, &msg, 1) != 1) |
1385 | return -EIO; | 1371 | return -EIO; |
1386 | 1372 | ||
@@ -1393,7 +1379,6 @@ static struct ves1820_config alps_tdbe2_config = { | |||
1393 | .xin = 57840000UL, | 1379 | .xin = 57840000UL, |
1394 | .invert = 1, | 1380 | .invert = 1, |
1395 | .selagc = VES1820_SELAGC_SIGNAMPERR, | 1381 | .selagc = VES1820_SELAGC_SIGNAMPERR, |
1396 | .pll_set = alps_tdbe2_pll_set, | ||
1397 | }; | 1382 | }; |
1398 | 1383 | ||
1399 | static u8 read_pwm(struct ttusb* ttusb) | 1384 | static u8 read_pwm(struct ttusb* ttusb) |
@@ -1410,6 +1395,174 @@ static u8 read_pwm(struct ttusb* ttusb) | |||
1410 | } | 1395 | } |
1411 | 1396 | ||
1412 | 1397 | ||
1398 | static int dvbc_philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | ||
1399 | { | ||
1400 | struct ttusb *ttusb = (struct ttusb *) fe->dvb->priv; | ||
1401 | u8 tuner_buf[5]; | ||
1402 | struct i2c_msg tuner_msg = {.addr = 0x60, | ||
1403 | .flags = 0, | ||
1404 | .buf = tuner_buf, | ||
1405 | .len = sizeof(tuner_buf) }; | ||
1406 | int tuner_frequency = 0; | ||
1407 | u8 band, cp, filter; | ||
1408 | |||
1409 | // determine charge pump | ||
1410 | tuner_frequency = params->frequency; | ||
1411 | if (tuner_frequency < 87000000) {return -EINVAL;} | ||
1412 | else if (tuner_frequency < 130000000) {cp = 3; band = 1;} | ||
1413 | else if (tuner_frequency < 160000000) {cp = 5; band = 1;} | ||
1414 | else if (tuner_frequency < 200000000) {cp = 6; band = 1;} | ||
1415 | else if (tuner_frequency < 290000000) {cp = 3; band = 2;} | ||
1416 | else if (tuner_frequency < 420000000) {cp = 5; band = 2;} | ||
1417 | else if (tuner_frequency < 480000000) {cp = 6; band = 2;} | ||
1418 | else if (tuner_frequency < 620000000) {cp = 3; band = 4;} | ||
1419 | else if (tuner_frequency < 830000000) {cp = 5; band = 4;} | ||
1420 | else if (tuner_frequency < 895000000) {cp = 7; band = 4;} | ||
1421 | else {return -EINVAL;} | ||
1422 | |||
1423 | // assume PLL filter should always be 8MHz for the moment. | ||
1424 | filter = 1; | ||
1425 | |||
1426 | // calculate divisor | ||
1427 | // (Finput + Fif)/Fref; Fif = 36125000 Hz, Fref = 62500 Hz | ||
1428 | tuner_frequency = ((params->frequency + 36125000) / 62500); | ||
1429 | |||
1430 | // setup tuner buffer | ||
1431 | tuner_buf[0] = tuner_frequency >> 8; | ||
1432 | tuner_buf[1] = tuner_frequency & 0xff; | ||
1433 | tuner_buf[2] = 0xc8; | ||
1434 | tuner_buf[3] = (cp << 5) | (filter << 3) | band; | ||
1435 | tuner_buf[4] = 0x80; | ||
1436 | |||
1437 | if (fe->ops.i2c_gate_ctrl) | ||
1438 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
1439 | if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) { | ||
1440 | printk("dvb-ttusb-budget: dvbc_philips_tdm1316l_pll_set Error 1\n"); | ||
1441 | return -EIO; | ||
1442 | } | ||
1443 | |||
1444 | msleep(50); | ||
1445 | |||
1446 | if (fe->ops.i2c_gate_ctrl) | ||
1447 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
1448 | if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) { | ||
1449 | printk("dvb-ttusb-budget: dvbc_philips_tdm1316l_pll_set Error 2\n"); | ||
1450 | return -EIO; | ||
1451 | } | ||
1452 | |||
1453 | msleep(1); | ||
1454 | |||
1455 | return 0; | ||
1456 | } | ||
1457 | |||
1458 | static u8 dvbc_philips_tdm1316l_inittab[] = { | ||
1459 | 0x80, 0x21, | ||
1460 | 0x80, 0x20, | ||
1461 | 0x81, 0x01, | ||
1462 | 0x81, 0x00, | ||
1463 | 0x00, 0x09, | ||
1464 | 0x01, 0x69, | ||
1465 | 0x03, 0x00, | ||
1466 | 0x04, 0x00, | ||
1467 | 0x07, 0x00, | ||
1468 | 0x08, 0x00, | ||
1469 | 0x20, 0x00, | ||
1470 | 0x21, 0x40, | ||
1471 | 0x22, 0x00, | ||
1472 | 0x23, 0x00, | ||
1473 | 0x24, 0x40, | ||
1474 | 0x25, 0x88, | ||
1475 | 0x30, 0xff, | ||
1476 | 0x31, 0x00, | ||
1477 | 0x32, 0xff, | ||
1478 | 0x33, 0x00, | ||
1479 | 0x34, 0x50, | ||
1480 | 0x35, 0x7f, | ||
1481 | 0x36, 0x00, | ||
1482 | 0x37, 0x20, | ||
1483 | 0x38, 0x00, | ||
1484 | 0x40, 0x1c, | ||
1485 | 0x41, 0xff, | ||
1486 | 0x42, 0x29, | ||
1487 | 0x43, 0x20, | ||
1488 | 0x44, 0xff, | ||
1489 | 0x45, 0x00, | ||
1490 | 0x46, 0x00, | ||
1491 | 0x49, 0x04, | ||
1492 | 0x4a, 0xff, | ||
1493 | 0x4b, 0x7f, | ||
1494 | 0x52, 0x30, | ||
1495 | 0x55, 0xae, | ||
1496 | 0x56, 0x47, | ||
1497 | 0x57, 0xe1, | ||
1498 | 0x58, 0x3a, | ||
1499 | 0x5a, 0x1e, | ||
1500 | 0x5b, 0x34, | ||
1501 | 0x60, 0x00, | ||
1502 | 0x63, 0x00, | ||
1503 | 0x64, 0x00, | ||
1504 | 0x65, 0x00, | ||
1505 | 0x66, 0x00, | ||
1506 | 0x67, 0x00, | ||
1507 | 0x68, 0x00, | ||
1508 | 0x69, 0x00, | ||
1509 | 0x6a, 0x02, | ||
1510 | 0x6b, 0x00, | ||
1511 | 0x70, 0xff, | ||
1512 | 0x71, 0x00, | ||
1513 | 0x72, 0x00, | ||
1514 | 0x73, 0x00, | ||
1515 | 0x74, 0x0c, | ||
1516 | 0x80, 0x00, | ||
1517 | 0x81, 0x00, | ||
1518 | 0x82, 0x00, | ||
1519 | 0x83, 0x00, | ||
1520 | 0x84, 0x04, | ||
1521 | 0x85, 0x80, | ||
1522 | 0x86, 0x24, | ||
1523 | 0x87, 0x78, | ||
1524 | 0x88, 0x00, | ||
1525 | 0x89, 0x00, | ||
1526 | 0x90, 0x01, | ||
1527 | 0x91, 0x01, | ||
1528 | 0xa0, 0x00, | ||
1529 | 0xa1, 0x00, | ||
1530 | 0xa2, 0x00, | ||
1531 | 0xb0, 0x91, | ||
1532 | 0xb1, 0x0b, | ||
1533 | 0xc0, 0x4b, | ||
1534 | 0xc1, 0x00, | ||
1535 | 0xc2, 0x00, | ||
1536 | 0xd0, 0x00, | ||
1537 | 0xd1, 0x00, | ||
1538 | 0xd2, 0x00, | ||
1539 | 0xd3, 0x00, | ||
1540 | 0xd4, 0x00, | ||
1541 | 0xd5, 0x00, | ||
1542 | 0xde, 0x00, | ||
1543 | 0xdf, 0x00, | ||
1544 | 0x61, 0x38, | ||
1545 | 0x62, 0x0a, | ||
1546 | 0x53, 0x13, | ||
1547 | 0x59, 0x08, | ||
1548 | 0x55, 0x00, | ||
1549 | 0x56, 0x40, | ||
1550 | 0x57, 0x08, | ||
1551 | 0x58, 0x3d, | ||
1552 | 0x88, 0x10, | ||
1553 | 0xa0, 0x00, | ||
1554 | 0xa0, 0x00, | ||
1555 | 0xa0, 0x00, | ||
1556 | 0xa0, 0x04, | ||
1557 | 0xff, 0xff, | ||
1558 | }; | ||
1559 | |||
1560 | static struct stv0297_config dvbc_philips_tdm1316l_config = { | ||
1561 | .demod_address = 0x1c, | ||
1562 | .inittab = dvbc_philips_tdm1316l_inittab, | ||
1563 | .invert = 0, | ||
1564 | }; | ||
1565 | |||
1413 | static void frontend_init(struct ttusb* ttusb) | 1566 | static void frontend_init(struct ttusb* ttusb) |
1414 | { | 1567 | { |
1415 | switch(le16_to_cpu(ttusb->dev->descriptor.idProduct)) { | 1568 | switch(le16_to_cpu(ttusb->dev->descriptor.idProduct)) { |
@@ -1417,11 +1570,13 @@ static void frontend_init(struct ttusb* ttusb) | |||
1417 | // try the stv0299 based first | 1570 | // try the stv0299 based first |
1418 | ttusb->fe = stv0299_attach(&alps_stv0299_config, &ttusb->i2c_adap); | 1571 | ttusb->fe = stv0299_attach(&alps_stv0299_config, &ttusb->i2c_adap); |
1419 | if (ttusb->fe != NULL) { | 1572 | if (ttusb->fe != NULL) { |
1573 | ttusb->fe->ops.tuner_ops.set_params = philips_tsa5059_tuner_set_params; | ||
1574 | |||
1420 | if(ttusb->revision == TTUSB_REV_2_2) { // ALPS BSBE1 | 1575 | if(ttusb->revision == TTUSB_REV_2_2) { // ALPS BSBE1 |
1421 | alps_stv0299_config.inittab = alps_bsbe1_inittab; | 1576 | alps_stv0299_config.inittab = alps_bsbe1_inittab; |
1422 | ttusb->fe->ops->set_voltage = lnbp21_set_voltage; | 1577 | lnbp21_attach(ttusb->fe, &ttusb->i2c_adap, 0, 0); |
1423 | } else { // ALPS BSRU6 | 1578 | } else { // ALPS BSRU6 |
1424 | ttusb->fe->ops->set_voltage = ttusb_set_voltage; | 1579 | ttusb->fe->ops.set_voltage = ttusb_set_voltage; |
1425 | } | 1580 | } |
1426 | break; | 1581 | break; |
1427 | } | 1582 | } |
@@ -1429,28 +1584,41 @@ static void frontend_init(struct ttusb* ttusb) | |||
1429 | // Grundig 29504-491 | 1584 | // Grundig 29504-491 |
1430 | ttusb->fe = tda8083_attach(&ttusb_novas_grundig_29504_491_config, &ttusb->i2c_adap); | 1585 | ttusb->fe = tda8083_attach(&ttusb_novas_grundig_29504_491_config, &ttusb->i2c_adap); |
1431 | if (ttusb->fe != NULL) { | 1586 | if (ttusb->fe != NULL) { |
1432 | ttusb->fe->ops->set_voltage = ttusb_set_voltage; | 1587 | ttusb->fe->ops.tuner_ops.set_params = ttusb_novas_grundig_29504_491_tuner_set_params; |
1588 | ttusb->fe->ops.set_voltage = ttusb_set_voltage; | ||
1433 | break; | 1589 | break; |
1434 | } | 1590 | } |
1435 | |||
1436 | break; | 1591 | break; |
1437 | 1592 | ||
1438 | case 0x1004: // Hauppauge/TT DVB-C budget (ves1820/ALPS TDBE2(sp5659)) | 1593 | case 0x1004: // Hauppauge/TT DVB-C budget (ves1820/ALPS TDBE2(sp5659)) |
1439 | ttusb->fe = ves1820_attach(&alps_tdbe2_config, &ttusb->i2c_adap, read_pwm(ttusb)); | 1594 | ttusb->fe = ves1820_attach(&alps_tdbe2_config, &ttusb->i2c_adap, read_pwm(ttusb)); |
1440 | if (ttusb->fe != NULL) | 1595 | if (ttusb->fe != NULL) { |
1596 | ttusb->fe->ops.tuner_ops.set_params = alps_tdbe2_tuner_set_params; | ||
1597 | break; | ||
1598 | } | ||
1599 | |||
1600 | ttusb->fe = stv0297_attach(&dvbc_philips_tdm1316l_config, &ttusb->i2c_adap); | ||
1601 | if (ttusb->fe != NULL) { | ||
1602 | ttusb->fe->ops.tuner_ops.set_params = dvbc_philips_tdm1316l_tuner_set_params; | ||
1441 | break; | 1603 | break; |
1604 | } | ||
1442 | break; | 1605 | break; |
1443 | 1606 | ||
1444 | case 0x1005: // Hauppauge/TT Nova-USB-t budget (tda10046/Philips td1316(tda6651tt) OR cx22700/ALPS TDMB7(??)) | 1607 | case 0x1005: // Hauppauge/TT Nova-USB-t budget (tda10046/Philips td1316(tda6651tt) OR cx22700/ALPS TDMB7(??)) |
1445 | // try the ALPS TDMB7 first | 1608 | // try the ALPS TDMB7 first |
1446 | ttusb->fe = cx22700_attach(&alps_tdmb7_config, &ttusb->i2c_adap); | 1609 | ttusb->fe = cx22700_attach(&alps_tdmb7_config, &ttusb->i2c_adap); |
1447 | if (ttusb->fe != NULL) | 1610 | if (ttusb->fe != NULL) { |
1611 | ttusb->fe->ops.tuner_ops.set_params = alps_tdmb7_tuner_set_params; | ||
1448 | break; | 1612 | break; |
1613 | } | ||
1449 | 1614 | ||
1450 | // Philips td1316 | 1615 | // Philips td1316 |
1451 | ttusb->fe = tda10046_attach(&philips_tdm1316l_config, &ttusb->i2c_adap); | 1616 | ttusb->fe = tda10046_attach(&philips_tdm1316l_config, &ttusb->i2c_adap); |
1452 | if (ttusb->fe != NULL) | 1617 | if (ttusb->fe != NULL) { |
1618 | ttusb->fe->ops.tuner_ops.init = philips_tdm1316l_tuner_init; | ||
1619 | ttusb->fe->ops.tuner_ops.set_params = philips_tdm1316l_tuner_set_params; | ||
1453 | break; | 1620 | break; |
1621 | } | ||
1454 | break; | 1622 | break; |
1455 | } | 1623 | } |
1456 | 1624 | ||
@@ -1461,8 +1629,8 @@ static void frontend_init(struct ttusb* ttusb) | |||
1461 | } else { | 1629 | } else { |
1462 | if (dvb_register_frontend(&ttusb->adapter, ttusb->fe)) { | 1630 | if (dvb_register_frontend(&ttusb->adapter, ttusb->fe)) { |
1463 | printk("dvb-ttusb-budget: Frontend registration failed!\n"); | 1631 | printk("dvb-ttusb-budget: Frontend registration failed!\n"); |
1464 | if (ttusb->fe->ops->release) | 1632 | if (ttusb->fe->ops.release) |
1465 | ttusb->fe->ops->release(ttusb->fe); | 1633 | ttusb->fe->ops.release(ttusb->fe); |
1466 | ttusb->fe = NULL; | 1634 | ttusb->fe = NULL; |
1467 | } | 1635 | } |
1468 | } | 1636 | } |
@@ -1507,7 +1675,7 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
1507 | 1675 | ||
1508 | mutex_unlock(&ttusb->semi2c); | 1676 | mutex_unlock(&ttusb->semi2c); |
1509 | 1677 | ||
1510 | if ((result = dvb_register_adapter(&ttusb->adapter, "Technotrend/Hauppauge Nova-USB", THIS_MODULE)) < 0) { | 1678 | if ((result = dvb_register_adapter(&ttusb->adapter, "Technotrend/Hauppauge Nova-USB", THIS_MODULE, &udev->dev)) < 0) { |
1511 | ttusb_free_iso_urbs(ttusb); | 1679 | ttusb_free_iso_urbs(ttusb); |
1512 | kfree(ttusb); | 1680 | kfree(ttusb); |
1513 | return result; | 1681 | return result; |