diff options
author | Andrew de Quincey <adq_dvb@lidskialf.net> | 2006-04-18 16:47:11 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-06-25 00:59:09 -0400 |
commit | 651b81be154ccf001890e77fbd45cdcac079e253 (patch) | |
tree | eaeeb814234b0f3c61fed95601dc35e02a9e0382 /drivers/media/dvb/ttusb-budget | |
parent | a79ddae9fe993adab8d728a7a2a6a4038f0861c8 (diff) |
V4L/DVB (3880): Convert dvb-ttusb-budget to refactored tuner code
Rename pll calls to appropriate tuner calls.
Remove pll functions from demod structures.
Hook tuner call into tuner_ops.
Add pll gate control calls where appropriate.
Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/ttusb-budget')
-rw-r--r-- | drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c index 95558608b03e..cd19ba628101 100644 --- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | |||
@@ -1048,7 +1048,7 @@ static u32 functionality(struct i2c_adapter *adapter) | |||
1048 | 1048 | ||
1049 | 1049 | ||
1050 | 1050 | ||
1051 | static int alps_tdmb7_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 1051 | static int alps_tdmb7_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
1052 | { | 1052 | { |
1053 | struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; | 1053 | struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; |
1054 | u8 data[4]; | 1054 | u8 data[4]; |
@@ -1068,14 +1068,13 @@ static int alps_tdmb7_pll_set(struct dvb_frontend* fe, struct dvb_frontend_param | |||
1068 | 1068 | ||
1069 | static struct cx22700_config alps_tdmb7_config = { | 1069 | static struct cx22700_config alps_tdmb7_config = { |
1070 | .demod_address = 0x43, | 1070 | .demod_address = 0x43, |
1071 | .pll_set = alps_tdmb7_pll_set, | ||
1072 | }; | 1071 | }; |
1073 | 1072 | ||
1074 | 1073 | ||
1075 | 1074 | ||
1076 | 1075 | ||
1077 | 1076 | ||
1078 | static int philips_tdm1316l_pll_init(struct dvb_frontend* fe) | 1077 | static int philips_tdm1316l_tuner_init(struct dvb_frontend* fe) |
1079 | { | 1078 | { |
1080 | struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; | 1079 | struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; |
1081 | static u8 td1316_init[] = { 0x0b, 0xf5, 0x85, 0xab }; | 1080 | static u8 td1316_init[] = { 0x0b, 0xf5, 0x85, 0xab }; |
@@ -1097,7 +1096,7 @@ static int philips_tdm1316l_pll_init(struct dvb_frontend* fe) | |||
1097 | return 0; | 1096 | return 0; |
1098 | } | 1097 | } |
1099 | 1098 | ||
1100 | static int philips_tdm1316l_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 1099 | static int philips_tdm1316l_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
1101 | { | 1100 | { |
1102 | struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; | 1101 | struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; |
1103 | u8 tuner_buf[4]; | 1102 | u8 tuner_buf[4]; |
@@ -1176,8 +1175,6 @@ static struct tda1004x_config philips_tdm1316l_config = { | |||
1176 | .demod_address = 0x8, | 1175 | .demod_address = 0x8, |
1177 | .invert = 1, | 1176 | .invert = 1, |
1178 | .invert_oclk = 0, | 1177 | .invert_oclk = 0, |
1179 | .pll_init = philips_tdm1316l_pll_init, | ||
1180 | .pll_set = philips_tdm1316l_pll_set, | ||
1181 | .request_firmware = philips_tdm1316l_request_firmware, | 1178 | .request_firmware = philips_tdm1316l_request_firmware, |
1182 | }; | 1179 | }; |
1183 | 1180 | ||
@@ -1299,7 +1296,7 @@ static int alps_stv0299_set_symbol_rate(struct dvb_frontend *fe, u32 srate, u32 | |||
1299 | return 0; | 1296 | return 0; |
1300 | } | 1297 | } |
1301 | 1298 | ||
1302 | static int philips_tsa5059_pll_set(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters *params) | 1299 | static int philips_tsa5059_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
1303 | { | 1300 | { |
1304 | struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; | 1301 | struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; |
1305 | u8 buf[4]; | 1302 | u8 buf[4]; |
@@ -1322,7 +1319,7 @@ static int philips_tsa5059_pll_set(struct dvb_frontend *fe, struct i2c_adapter * | |||
1322 | if (ttusb->revision == TTUSB_REV_2_2) | 1319 | if (ttusb->revision == TTUSB_REV_2_2) |
1323 | buf[3] |= 0x20; | 1320 | buf[3] |= 0x20; |
1324 | 1321 | ||
1325 | if (i2c_transfer(i2c, &msg, 1) != 1) | 1322 | if (i2c_transfer(&ttusb->i2c_adap, &msg, 1) != 1) |
1326 | return -EIO; | 1323 | return -EIO; |
1327 | 1324 | ||
1328 | return 0; | 1325 | return 0; |
@@ -1338,10 +1335,9 @@ static struct stv0299_config alps_stv0299_config = { | |||
1338 | .volt13_op0_op1 = STV0299_VOLT13_OP1, | 1335 | .volt13_op0_op1 = STV0299_VOLT13_OP1, |
1339 | .min_delay_ms = 100, | 1336 | .min_delay_ms = 100, |
1340 | .set_symbol_rate = alps_stv0299_set_symbol_rate, | 1337 | .set_symbol_rate = alps_stv0299_set_symbol_rate, |
1341 | .pll_set = philips_tsa5059_pll_set, | ||
1342 | }; | 1338 | }; |
1343 | 1339 | ||
1344 | static int ttusb_novas_grundig_29504_491_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | 1340 | static int ttusb_novas_grundig_29504_491_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
1345 | { | 1341 | { |
1346 | struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; | 1342 | struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; |
1347 | u8 buf[4]; | 1343 | u8 buf[4]; |
@@ -1364,10 +1360,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 = { | 1360 | static struct tda8083_config ttusb_novas_grundig_29504_491_config = { |
1365 | 1361 | ||
1366 | .demod_address = 0x68, | 1362 | .demod_address = 0x68, |
1367 | .pll_set = ttusb_novas_grundig_29504_491_pll_set, | ||
1368 | }; | 1363 | }; |
1369 | 1364 | ||
1370 | static int alps_tdbe2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 1365 | static int alps_tdbe2_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
1371 | { | 1366 | { |
1372 | struct ttusb* ttusb = fe->dvb->priv; | 1367 | struct ttusb* ttusb = fe->dvb->priv; |
1373 | u32 div; | 1368 | u32 div; |
@@ -1393,7 +1388,6 @@ static struct ves1820_config alps_tdbe2_config = { | |||
1393 | .xin = 57840000UL, | 1388 | .xin = 57840000UL, |
1394 | .invert = 1, | 1389 | .invert = 1, |
1395 | .selagc = VES1820_SELAGC_SIGNAMPERR, | 1390 | .selagc = VES1820_SELAGC_SIGNAMPERR, |
1396 | .pll_set = alps_tdbe2_pll_set, | ||
1397 | }; | 1391 | }; |
1398 | 1392 | ||
1399 | static u8 read_pwm(struct ttusb* ttusb) | 1393 | static u8 read_pwm(struct ttusb* ttusb) |
@@ -1417,6 +1411,8 @@ static void frontend_init(struct ttusb* ttusb) | |||
1417 | // try the stv0299 based first | 1411 | // try the stv0299 based first |
1418 | ttusb->fe = stv0299_attach(&alps_stv0299_config, &ttusb->i2c_adap); | 1412 | ttusb->fe = stv0299_attach(&alps_stv0299_config, &ttusb->i2c_adap); |
1419 | if (ttusb->fe != NULL) { | 1413 | if (ttusb->fe != NULL) { |
1414 | ttusb->fe->ops->tuner_ops.set_params = philips_tsa5059_tuner_set_params; | ||
1415 | |||
1420 | if(ttusb->revision == TTUSB_REV_2_2) { // ALPS BSBE1 | 1416 | if(ttusb->revision == TTUSB_REV_2_2) { // ALPS BSBE1 |
1421 | alps_stv0299_config.inittab = alps_bsbe1_inittab; | 1417 | alps_stv0299_config.inittab = alps_bsbe1_inittab; |
1422 | ttusb->fe->ops->set_voltage = lnbp21_set_voltage; | 1418 | ttusb->fe->ops->set_voltage = lnbp21_set_voltage; |
@@ -1429,28 +1425,35 @@ static void frontend_init(struct ttusb* ttusb) | |||
1429 | // Grundig 29504-491 | 1425 | // Grundig 29504-491 |
1430 | ttusb->fe = tda8083_attach(&ttusb_novas_grundig_29504_491_config, &ttusb->i2c_adap); | 1426 | ttusb->fe = tda8083_attach(&ttusb_novas_grundig_29504_491_config, &ttusb->i2c_adap); |
1431 | if (ttusb->fe != NULL) { | 1427 | if (ttusb->fe != NULL) { |
1428 | ttusb->fe->ops->tuner_ops.set_params = ttusb_novas_grundig_29504_491_tuner_set_params; | ||
1432 | ttusb->fe->ops->set_voltage = ttusb_set_voltage; | 1429 | ttusb->fe->ops->set_voltage = ttusb_set_voltage; |
1433 | break; | 1430 | break; |
1434 | } | 1431 | } |
1435 | |||
1436 | break; | 1432 | break; |
1437 | 1433 | ||
1438 | case 0x1004: // Hauppauge/TT DVB-C budget (ves1820/ALPS TDBE2(sp5659)) | 1434 | 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)); | 1435 | ttusb->fe = ves1820_attach(&alps_tdbe2_config, &ttusb->i2c_adap, read_pwm(ttusb)); |
1440 | if (ttusb->fe != NULL) | 1436 | if (ttusb->fe != NULL) { |
1437 | ttusb->fe->ops->tuner_ops.set_params = alps_tdbe2_tuner_set_params; | ||
1441 | break; | 1438 | break; |
1439 | } | ||
1442 | break; | 1440 | break; |
1443 | 1441 | ||
1444 | case 0x1005: // Hauppauge/TT Nova-USB-t budget (tda10046/Philips td1316(tda6651tt) OR cx22700/ALPS TDMB7(??)) | 1442 | case 0x1005: // Hauppauge/TT Nova-USB-t budget (tda10046/Philips td1316(tda6651tt) OR cx22700/ALPS TDMB7(??)) |
1445 | // try the ALPS TDMB7 first | 1443 | // try the ALPS TDMB7 first |
1446 | ttusb->fe = cx22700_attach(&alps_tdmb7_config, &ttusb->i2c_adap); | 1444 | ttusb->fe = cx22700_attach(&alps_tdmb7_config, &ttusb->i2c_adap); |
1447 | if (ttusb->fe != NULL) | 1445 | if (ttusb->fe != NULL) { |
1446 | ttusb->fe->ops->tuner_ops.set_params = alps_tdmb7_tuner_set_params; | ||
1448 | break; | 1447 | break; |
1448 | } | ||
1449 | 1449 | ||
1450 | // Philips td1316 | 1450 | // Philips td1316 |
1451 | ttusb->fe = tda10046_attach(&philips_tdm1316l_config, &ttusb->i2c_adap); | 1451 | ttusb->fe = tda10046_attach(&philips_tdm1316l_config, &ttusb->i2c_adap); |
1452 | if (ttusb->fe != NULL) | 1452 | if (ttusb->fe != NULL) { |
1453 | ttusb->fe->ops->tuner_ops.init = philips_tdm1316l_tuner_init; | ||
1454 | ttusb->fe->ops->tuner_ops.set_params = philips_tdm1316l_tuner_set_params; | ||
1453 | break; | 1455 | break; |
1456 | } | ||
1454 | break; | 1457 | break; |
1455 | } | 1458 | } |
1456 | 1459 | ||