aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/ttpci/budget.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/ttpci/budget.c')
-rw-r--r--drivers/media/dvb/ttpci/budget.c111
1 files changed, 99 insertions, 12 deletions
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c
index 14b00f57b5de..2293d80c6e51 100644
--- a/drivers/media/dvb/ttpci/budget.c
+++ b/drivers/media/dvb/ttpci/budget.c
@@ -45,6 +45,7 @@
45#include "tda826x.h" 45#include "tda826x.h"
46#include "lnbp21.h" 46#include "lnbp21.h"
47#include "bsru6.h" 47#include "bsru6.h"
48#include "bsbe1.h"
48 49
49static int diseqc_method; 50static int diseqc_method;
50module_param(diseqc_method, int, 0444); 51module_param(diseqc_method, int, 0444);
@@ -257,11 +258,17 @@ static struct ves1820_config alps_tdbe2_config = {
257 258
258static int grundig_29504_401_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) 259static int grundig_29504_401_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
259{ 260{
260 struct budget* budget = (struct budget*) fe->dvb->priv; 261 struct budget *budget = fe->dvb->priv;
262 u8 *tuner_addr = fe->tuner_priv;
261 u32 div; 263 u32 div;
262 u8 cfg, cpump, band_select; 264 u8 cfg, cpump, band_select;
263 u8 data[4]; 265 u8 data[4];
264 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; 266 struct i2c_msg msg = { .flags = 0, .buf = data, .len = sizeof(data) };
267
268 if (tuner_addr)
269 msg.addr = *tuner_addr;
270 else
271 msg.addr = 0x61;
265 272
266 div = (36125000 + params->frequency) / 166666; 273 div = (36125000 + params->frequency) / 166666;
267 274
@@ -292,6 +299,12 @@ static struct l64781_config grundig_29504_401_config = {
292 .demod_address = 0x55, 299 .demod_address = 0x55,
293}; 300};
294 301
302static struct l64781_config grundig_29504_401_config_activy = {
303 .demod_address = 0x54,
304};
305
306static u8 tuner_address_grundig_29504_401_activy = 0x60;
307
295static int grundig_29504_451_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) 308static int grundig_29504_451_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
296{ 309{
297 struct budget* budget = (struct budget*) fe->dvb->priv; 310 struct budget* budget = (struct budget*) fe->dvb->priv;
@@ -346,14 +359,48 @@ static int s5h1420_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend
346static struct s5h1420_config s5h1420_config = { 359static struct s5h1420_config s5h1420_config = {
347 .demod_address = 0x53, 360 .demod_address = 0x53,
348 .invert = 1, 361 .invert = 1,
362 .cdclk_polarity = 1,
349}; 363};
350 364
351static struct tda10086_config tda10086_config = { 365static struct tda10086_config tda10086_config = {
352 .demod_address = 0x0e, 366 .demod_address = 0x0e,
353 .invert = 0, 367 .invert = 0,
354 .diseqc_tone = 1, 368 .diseqc_tone = 1,
369 .xtal_freq = TDA10086_XTAL_16M,
355}; 370};
356 371
372static struct stv0299_config alps_bsru6_config_activy = {
373 .demod_address = 0x68,
374 .inittab = alps_bsru6_inittab,
375 .mclk = 88000000UL,
376 .invert = 1,
377 .op0_off = 1,
378 .min_delay_ms = 100,
379 .set_symbol_rate = alps_bsru6_set_symbol_rate,
380};
381
382static struct stv0299_config alps_bsbe1_config_activy = {
383 .demod_address = 0x68,
384 .inittab = alps_bsbe1_inittab,
385 .mclk = 88000000UL,
386 .invert = 1,
387 .op0_off = 1,
388 .min_delay_ms = 100,
389 .set_symbol_rate = alps_bsbe1_set_symbol_rate,
390};
391
392
393static int i2c_readreg(struct i2c_adapter *i2c, u8 adr, u8 reg)
394{
395 u8 val;
396 struct i2c_msg msg[] = {
397 { .addr = adr, .flags = 0, .buf = &reg, .len = 1 },
398 { .addr = adr, .flags = I2C_M_RD, .buf = &val, .len = 1 }
399 };
400
401 return (i2c_transfer(i2c, msg, 2) != 2) ? -EIO : val;
402}
403
357static u8 read_pwm(struct budget* budget) 404static u8 read_pwm(struct budget* budget)
358{ 405{
359 u8 b = 0xff; 406 u8 b = 0xff;
@@ -369,6 +416,8 @@ static u8 read_pwm(struct budget* budget)
369 416
370static void frontend_init(struct budget *budget) 417static void frontend_init(struct budget *budget)
371{ 418{
419 (void)alps_bsbe1_config; /* avoid warning */
420
372 switch(budget->dev->pci->subsystem_device) { 421 switch(budget->dev->pci->subsystem_device) {
373 case 0x1003: // Hauppauge/TT Nova budget (stv0299/ALPS BSRU6(tsa5059) OR ves1893/ALPS BSRV2(sp5659)) 422 case 0x1003: // Hauppauge/TT Nova budget (stv0299/ALPS BSRU6(tsa5059) OR ves1893/ALPS BSRV2(sp5659))
374 case 0x1013: 423 case 0x1013:
@@ -414,15 +463,43 @@ static void frontend_init(struct budget *budget)
414 } 463 }
415 break; 464 break;
416 465
417 case 0x4f60: // Fujitsu Siemens Activy Budget-S PCI rev AL (stv0299/ALPS BSRU6(tsa5059)) 466 case 0x4f60: /* Fujitsu Siemens Activy Budget-S PCI rev AL (stv0299/tsa5059) */
418 budget->dvb_frontend = dvb_attach(stv0299_attach, &alps_bsru6_config, &budget->i2c_adap); 467 {
419 if (budget->dvb_frontend) { 468 int subtype = i2c_readreg(&budget->i2c_adap, 0x50, 0x67);
420 budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params; 469
421 budget->dvb_frontend->tuner_priv = &budget->i2c_adap; 470 if (subtype < 0)
422 budget->dvb_frontend->ops.set_voltage = siemens_budget_set_voltage; 471 break;
423 budget->dvb_frontend->ops.dishnetwork_send_legacy_command = NULL; 472 /* fixme: find a better way to identify the card */
473 if (subtype < 0x36) {
474 /* assume ALPS BSRU6 */
475 budget->dvb_frontend = dvb_attach(stv0299_attach, &alps_bsru6_config_activy, &budget->i2c_adap);
476 if (budget->dvb_frontend) {
477 printk(KERN_INFO "budget: tuner ALPS BSRU6 detected\n");
478 budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params;
479 budget->dvb_frontend->tuner_priv = &budget->i2c_adap;
480 budget->dvb_frontend->ops.set_voltage = siemens_budget_set_voltage;
481 budget->dvb_frontend->ops.dishnetwork_send_legacy_command = NULL;
482 break;
483 }
484 } else {
485 /* assume ALPS BSBE1 */
486 /* reset tuner */
487 saa7146_setgpio(budget->dev, 3, SAA7146_GPIO_OUTLO);
488 msleep(50);
489 saa7146_setgpio(budget->dev, 3, SAA7146_GPIO_OUTHI);
490 msleep(250);
491 budget->dvb_frontend = dvb_attach(stv0299_attach, &alps_bsbe1_config_activy, &budget->i2c_adap);
492 if (budget->dvb_frontend) {
493 printk(KERN_INFO "budget: tuner ALPS BSBE1 detected\n");
494 budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsbe1_tuner_set_params;
495 budget->dvb_frontend->tuner_priv = &budget->i2c_adap;
496 budget->dvb_frontend->ops.set_voltage = siemens_budget_set_voltage;
497 budget->dvb_frontend->ops.dishnetwork_send_legacy_command = NULL;
498 break;
499 }
424 } 500 }
425 break; 501 break;
502 }
426 503
427 case 0x4f61: // Fujitsu Siemens Activy Budget-S PCI rev GR (tda8083/Grundig 29504-451(tsa5522)) 504 case 0x4f61: // Fujitsu Siemens Activy Budget-S PCI rev GR (tda8083/Grundig 29504-451(tsa5522))
428 budget->dvb_frontend = dvb_attach(tda8083_attach, &grundig_29504_451_config, &budget->i2c_adap); 505 budget->dvb_frontend = dvb_attach(tda8083_attach, &grundig_29504_451_config, &budget->i2c_adap);
@@ -433,12 +510,20 @@ static void frontend_init(struct budget *budget)
433 } 510 }
434 break; 511 break;
435 512
513 case 0x5f61: /* Fujitsu Siemens Activy Budget-T PCI rev GR (L64781/Grundig 29504-401(tsa5060)) */
514 budget->dvb_frontend = dvb_attach(l64781_attach, &grundig_29504_401_config_activy, &budget->i2c_adap);
515 if (budget->dvb_frontend) {
516 budget->dvb_frontend->tuner_priv = &tuner_address_grundig_29504_401_activy;
517 budget->dvb_frontend->ops.tuner_ops.set_params = grundig_29504_401_tuner_set_params;
518 }
519 break;
520
436 case 0x1016: // Hauppauge/TT Nova-S SE (samsung s5h1420/????(tda8260)) 521 case 0x1016: // Hauppauge/TT Nova-S SE (samsung s5h1420/????(tda8260))
437 budget->dvb_frontend = dvb_attach(s5h1420_attach, &s5h1420_config, &budget->i2c_adap); 522 budget->dvb_frontend = dvb_attach(s5h1420_attach, &s5h1420_config, &budget->i2c_adap);
438 if (budget->dvb_frontend) { 523 if (budget->dvb_frontend) {
439 budget->dvb_frontend->ops.tuner_ops.set_params = s5h1420_tuner_set_params; 524 budget->dvb_frontend->ops.tuner_ops.set_params = s5h1420_tuner_set_params;
440 if (dvb_attach(lnbp21_attach, budget->dvb_frontend, &budget->i2c_adap, 0, 0) == NULL) { 525 if (dvb_attach(lnbp21_attach, budget->dvb_frontend, &budget->i2c_adap, 0, 0) == NULL) {
441 printk("%s: No LNBP21 found!\n", __FUNCTION__); 526 printk("%s: No LNBP21 found!\n", __func__);
442 goto error_out; 527 goto error_out;
443 } 528 }
444 break; 529 break;
@@ -454,9 +539,9 @@ static void frontend_init(struct budget *budget)
454 budget->dvb_frontend = dvb_attach(tda10086_attach, &tda10086_config, &budget->i2c_adap); 539 budget->dvb_frontend = dvb_attach(tda10086_attach, &tda10086_config, &budget->i2c_adap);
455 if (budget->dvb_frontend) { 540 if (budget->dvb_frontend) {
456 if (dvb_attach(tda826x_attach, budget->dvb_frontend, 0x60, &budget->i2c_adap, 0) == NULL) 541 if (dvb_attach(tda826x_attach, budget->dvb_frontend, 0x60, &budget->i2c_adap, 0) == NULL)
457 printk("%s: No tda826x found!\n", __FUNCTION__); 542 printk("%s: No tda826x found!\n", __func__);
458 if (dvb_attach(lnbp21_attach, budget->dvb_frontend, &budget->i2c_adap, 0, 0) == NULL) { 543 if (dvb_attach(lnbp21_attach, budget->dvb_frontend, &budget->i2c_adap, 0, 0) == NULL) {
459 printk("%s: No LNBP21 found!\n", __FUNCTION__); 544 printk("%s: No LNBP21 found!\n", __func__);
460 goto error_out; 545 goto error_out;
461 } 546 }
462 break; 547 break;
@@ -537,6 +622,7 @@ MAKE_BUDGET_INFO(satel, "SATELCO Multimedia PCI", BUDGET_TT_HW_DISEQC);
537MAKE_BUDGET_INFO(ttbs1401, "TT-Budget-S-1401 PCI", BUDGET_TT); 622MAKE_BUDGET_INFO(ttbs1401, "TT-Budget-S-1401 PCI", BUDGET_TT);
538MAKE_BUDGET_INFO(fsacs0, "Fujitsu Siemens Activy Budget-S PCI (rev GR/grundig frontend)", BUDGET_FS_ACTIVY); 623MAKE_BUDGET_INFO(fsacs0, "Fujitsu Siemens Activy Budget-S PCI (rev GR/grundig frontend)", BUDGET_FS_ACTIVY);
539MAKE_BUDGET_INFO(fsacs1, "Fujitsu Siemens Activy Budget-S PCI (rev AL/alps frontend)", BUDGET_FS_ACTIVY); 624MAKE_BUDGET_INFO(fsacs1, "Fujitsu Siemens Activy Budget-S PCI (rev AL/alps frontend)", BUDGET_FS_ACTIVY);
625MAKE_BUDGET_INFO(fsact, "Fujitsu Siemens Activy Budget-T PCI (rev GR/Grundig frontend)", BUDGET_FS_ACTIVY);
540 626
541static struct pci_device_id pci_tbl[] = { 627static struct pci_device_id pci_tbl[] = {
542 MAKE_EXTENSION_PCI(ttbs, 0x13c2, 0x1003), 628 MAKE_EXTENSION_PCI(ttbs, 0x13c2, 0x1003),
@@ -547,6 +633,7 @@ static struct pci_device_id pci_tbl[] = {
547 MAKE_EXTENSION_PCI(ttbs1401, 0x13c2, 0x1018), 633 MAKE_EXTENSION_PCI(ttbs1401, 0x13c2, 0x1018),
548 MAKE_EXTENSION_PCI(fsacs1,0x1131, 0x4f60), 634 MAKE_EXTENSION_PCI(fsacs1,0x1131, 0x4f60),
549 MAKE_EXTENSION_PCI(fsacs0,0x1131, 0x4f61), 635 MAKE_EXTENSION_PCI(fsacs0,0x1131, 0x4f61),
636 MAKE_EXTENSION_PCI(fsact, 0x1131, 0x5f61),
550 { 637 {
551 .vendor = 0, 638 .vendor = 0,
552 } 639 }