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.c77
1 files changed, 70 insertions, 7 deletions
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c
index 7adfe17b0616..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);
@@ -368,6 +369,38 @@ static struct tda10086_config tda10086_config = {
368 .xtal_freq = TDA10086_XTAL_16M, 369 .xtal_freq = TDA10086_XTAL_16M,
369}; 370};
370 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
371static u8 read_pwm(struct budget* budget) 404static u8 read_pwm(struct budget* budget)
372{ 405{
373 u8 b = 0xff; 406 u8 b = 0xff;
@@ -383,6 +416,8 @@ static u8 read_pwm(struct budget* budget)
383 416
384static void frontend_init(struct budget *budget) 417static void frontend_init(struct budget *budget)
385{ 418{
419 (void)alps_bsbe1_config; /* avoid warning */
420
386 switch(budget->dev->pci->subsystem_device) { 421 switch(budget->dev->pci->subsystem_device) {
387 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))
388 case 0x1013: 423 case 0x1013:
@@ -428,15 +463,43 @@ static void frontend_init(struct budget *budget)
428 } 463 }
429 break; 464 break;
430 465
431 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) */
432 budget->dvb_frontend = dvb_attach(stv0299_attach, &alps_bsru6_config, &budget->i2c_adap); 467 {
433 if (budget->dvb_frontend) { 468 int subtype = i2c_readreg(&budget->i2c_adap, 0x50, 0x67);
434 budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params; 469
435 budget->dvb_frontend->tuner_priv = &budget->i2c_adap; 470 if (subtype < 0)
436 budget->dvb_frontend->ops.set_voltage = siemens_budget_set_voltage; 471 break;
437 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 }
438 } 500 }
439 break; 501 break;
502 }
440 503
441 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))
442 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);