diff options
author | Martin Zwickel <martin.zwickel@technotrend.de> | 2005-11-09 00:35:10 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-09 10:56:01 -0500 |
commit | 9691bb14d9ab646868a6392e9419070c304a9590 (patch) | |
tree | 1bbe492ebbaab8168db24a0e2328be08d5a14ed7 /drivers/media | |
parent | 29b2f784da28cc8289f17a07360997093b7b0156 (diff) |
[PATCH] dvb: add support for Technotrend Budget Card S1500
This patch adds support for the Technotrend Budget Card S1500 with a BSBE1
frontend and the LNBP21.
Signed-off-by: Martin Zwickel <martin.zwickel@technotrend.de>
Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Cc: Johannes Stezenbach <js@linuxtv.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb/ttpci/budget.c | 118 |
1 files changed, 108 insertions, 10 deletions
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c index 43d6c8268642..0f6ead848e4d 100644 --- a/drivers/media/dvb/ttpci/budget.c +++ b/drivers/media/dvb/ttpci/budget.c | |||
@@ -226,12 +226,14 @@ static int lnbp21_enable_high_lnb_voltage(struct dvb_frontend* fe, int arg) | |||
226 | return 0; | 226 | return 0; |
227 | } | 227 | } |
228 | 228 | ||
229 | static void lnbp21_init(struct budget* budget) | 229 | static int lnbp21_init(struct budget* budget) |
230 | { | 230 | { |
231 | u8 buf = 0x00; | 231 | u8 buf = 0x00; |
232 | struct i2c_msg msg = { .addr = 0x08, .flags = 0, .buf = &buf, .len = sizeof(buf) }; | 232 | struct i2c_msg msg = { .addr = 0x08, .flags = 0, .buf = &buf, .len = sizeof(buf) }; |
233 | 233 | ||
234 | i2c_transfer (&budget->i2c_adap, &msg, 1); | 234 | if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) |
235 | return -EIO; | ||
236 | return 0; | ||
235 | } | 237 | } |
236 | 238 | ||
237 | static int alps_bsrv2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 239 | static int alps_bsrv2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
@@ -273,7 +275,7 @@ static u8 alps_bsru6_inittab[] = { | |||
273 | 0x01, 0x15, | 275 | 0x01, 0x15, |
274 | 0x02, 0x00, | 276 | 0x02, 0x00, |
275 | 0x03, 0x00, | 277 | 0x03, 0x00, |
276 | 0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */ | 278 | 0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */ |
277 | 0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */ | 279 | 0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */ |
278 | 0x06, 0x40, /* DAC not used, set to high impendance mode */ | 280 | 0x06, 0x40, /* DAC not used, set to high impendance mode */ |
279 | 0x07, 0x00, /* DAC LSB */ | 281 | 0x07, 0x00, /* DAC LSB */ |
@@ -367,6 +369,80 @@ static struct stv0299_config alps_bsru6_config = { | |||
367 | .pll_set = alps_bsru6_pll_set, | 369 | .pll_set = alps_bsru6_pll_set, |
368 | }; | 370 | }; |
369 | 371 | ||
372 | static u8 alps_bsbe1_inittab[] = { | ||
373 | 0x01, 0x15, | ||
374 | 0x02, 0x30, | ||
375 | 0x03, 0x00, | ||
376 | 0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */ | ||
377 | 0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */ | ||
378 | 0x06, 0x40, /* DAC not used, set to high impendance mode */ | ||
379 | 0x07, 0x00, /* DAC LSB */ | ||
380 | 0x08, 0x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */ | ||
381 | 0x09, 0x00, /* FIFO */ | ||
382 | 0x0c, 0x51, /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */ | ||
383 | 0x0d, 0x82, /* DC offset compensation = ON, beta_agc1 = 2 */ | ||
384 | 0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */ | ||
385 | 0x10, 0x3f, // AGC2 0x3d | ||
386 | 0x11, 0x84, | ||
387 | 0x12, 0xb5, // Lock detect: -64 Carrier freq detect:on | ||
388 | 0x15, 0xc9, // lock detector threshold | ||
389 | 0x16, 0x00, | ||
390 | 0x17, 0x00, | ||
391 | 0x18, 0x00, | ||
392 | 0x19, 0x00, | ||
393 | 0x1a, 0x00, | ||
394 | 0x1f, 0x50, | ||
395 | 0x20, 0x00, | ||
396 | 0x21, 0x00, | ||
397 | 0x22, 0x00, | ||
398 | 0x23, 0x00, | ||
399 | 0x28, 0x00, // out imp: normal out type: parallel FEC mode:0 | ||
400 | 0x29, 0x1e, // 1/2 threshold | ||
401 | 0x2a, 0x14, // 2/3 threshold | ||
402 | 0x2b, 0x0f, // 3/4 threshold | ||
403 | 0x2c, 0x09, // 5/6 threshold | ||
404 | 0x2d, 0x05, // 7/8 threshold | ||
405 | 0x2e, 0x01, | ||
406 | 0x31, 0x1f, // test all FECs | ||
407 | 0x32, 0x19, // viterbi and synchro search | ||
408 | 0x33, 0xfc, // rs control | ||
409 | 0x34, 0x93, // error control | ||
410 | 0x0f, 0x92, // 0x80 = inverse AGC | ||
411 | 0xff, 0xff | ||
412 | }; | ||
413 | |||
414 | static int alps_bsbe1_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params) | ||
415 | { | ||
416 | int ret; | ||
417 | u8 data[4]; | ||
418 | u32 div; | ||
419 | struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; | ||
420 | |||
421 | if ((params->frequency < 950000) || (params->frequency > 2150000)) | ||
422 | return -EINVAL; | ||
423 | |||
424 | div = (params->frequency + (125 - 1)) / 125; // round correctly | ||
425 | data[0] = (div >> 8) & 0x7f; | ||
426 | data[1] = div & 0xff; | ||
427 | data[2] = 0x80 | ((div & 0x18000) >> 10) | 4; | ||
428 | data[3] = (params->frequency > 1530000) ? 0xE0 : 0xE4; | ||
429 | |||
430 | ret = i2c_transfer(i2c, &msg, 1); | ||
431 | return (ret != 1) ? -EIO : 0; | ||
432 | } | ||
433 | |||
434 | static struct stv0299_config alps_bsbe1_config = { | ||
435 | .demod_address = 0x68, | ||
436 | .inittab = alps_bsbe1_inittab, | ||
437 | .mclk = 88000000UL, | ||
438 | .invert = 1, | ||
439 | .enhanced_tuning = 0, | ||
440 | .skip_reinit = 0, | ||
441 | .min_delay_ms = 100, | ||
442 | .set_symbol_rate = alps_bsru6_set_symbol_rate, | ||
443 | .pll_set = alps_bsbe1_pll_set, | ||
444 | }; | ||
445 | |||
370 | static int alps_tdbe2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 446 | static int alps_tdbe2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
371 | { | 447 | { |
372 | struct budget* budget = (struct budget*) fe->dvb->priv; | 448 | struct budget* budget = (struct budget*) fe->dvb->priv; |
@@ -500,6 +576,19 @@ static u8 read_pwm(struct budget* budget) | |||
500 | static void frontend_init(struct budget *budget) | 576 | static void frontend_init(struct budget *budget) |
501 | { | 577 | { |
502 | switch(budget->dev->pci->subsystem_device) { | 578 | switch(budget->dev->pci->subsystem_device) { |
579 | case 0x1017: | ||
580 | // try the ALPS BSBE1 now | ||
581 | budget->dvb_frontend = stv0299_attach(&alps_bsbe1_config, &budget->i2c_adap); | ||
582 | if (budget->dvb_frontend) { | ||
583 | budget->dvb_frontend->ops->set_voltage = lnbp21_set_voltage; | ||
584 | budget->dvb_frontend->ops->enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage; | ||
585 | if (lnbp21_init(budget)) { | ||
586 | printk("%s: No LNBP21 found!\n", __FUNCTION__); | ||
587 | goto error_out; | ||
588 | } | ||
589 | } | ||
590 | |||
591 | break; | ||
503 | case 0x1003: // Hauppauge/TT Nova budget (stv0299/ALPS BSRU6(tsa5059) OR ves1893/ALPS BSRV2(sp5659)) | 592 | case 0x1003: // Hauppauge/TT Nova budget (stv0299/ALPS BSRU6(tsa5059) OR ves1893/ALPS BSRV2(sp5659)) |
504 | case 0x1013: | 593 | case 0x1013: |
505 | // try the ALPS BSRV2 first of all | 594 | // try the ALPS BSRV2 first of all |
@@ -554,7 +643,10 @@ static void frontend_init(struct budget *budget) | |||
554 | if (budget->dvb_frontend) { | 643 | if (budget->dvb_frontend) { |
555 | budget->dvb_frontend->ops->set_voltage = lnbp21_set_voltage; | 644 | budget->dvb_frontend->ops->set_voltage = lnbp21_set_voltage; |
556 | budget->dvb_frontend->ops->enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage; | 645 | budget->dvb_frontend->ops->enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage; |
557 | lnbp21_init(budget); | 646 | if (lnbp21_init(budget)) { |
647 | printk("%s: No LNBP21 found!\n", __FUNCTION__); | ||
648 | goto error_out; | ||
649 | } | ||
558 | break; | 650 | break; |
559 | } | 651 | } |
560 | } | 652 | } |
@@ -566,13 +658,17 @@ static void frontend_init(struct budget *budget) | |||
566 | budget->dev->pci->subsystem_vendor, | 658 | budget->dev->pci->subsystem_vendor, |
567 | budget->dev->pci->subsystem_device); | 659 | budget->dev->pci->subsystem_device); |
568 | } else { | 660 | } else { |
569 | if (dvb_register_frontend(&budget->dvb_adapter, budget->dvb_frontend)) { | 661 | if (dvb_register_frontend(&budget->dvb_adapter, budget->dvb_frontend)) |
570 | printk("budget: Frontend registration failed!\n"); | 662 | goto error_out; |
571 | if (budget->dvb_frontend->ops->release) | ||
572 | budget->dvb_frontend->ops->release(budget->dvb_frontend); | ||
573 | budget->dvb_frontend = NULL; | ||
574 | } | ||
575 | } | 663 | } |
664 | return; | ||
665 | |||
666 | error_out: | ||
667 | printk("budget: Frontend registration failed!\n"); | ||
668 | if (budget->dvb_frontend->ops->release) | ||
669 | budget->dvb_frontend->ops->release(budget->dvb_frontend); | ||
670 | budget->dvb_frontend = NULL; | ||
671 | return; | ||
576 | } | 672 | } |
577 | 673 | ||
578 | static int budget_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_data *info) | 674 | static int budget_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_data *info) |
@@ -618,6 +714,7 @@ static int budget_detach (struct saa7146_dev* dev) | |||
618 | 714 | ||
619 | static struct saa7146_extension budget_extension; | 715 | static struct saa7146_extension budget_extension; |
620 | 716 | ||
717 | MAKE_BUDGET_INFO(ttbs2, "TT-Budget/WinTV-NOVA-S PCI (rev AL/alps bsbe1 lnbp21 frontend)", BUDGET_TT); | ||
621 | MAKE_BUDGET_INFO(ttbs, "TT-Budget/WinTV-NOVA-S PCI", BUDGET_TT); | 718 | MAKE_BUDGET_INFO(ttbs, "TT-Budget/WinTV-NOVA-S PCI", BUDGET_TT); |
622 | MAKE_BUDGET_INFO(ttbc, "TT-Budget/WinTV-NOVA-C PCI", BUDGET_TT); | 719 | MAKE_BUDGET_INFO(ttbc, "TT-Budget/WinTV-NOVA-C PCI", BUDGET_TT); |
623 | MAKE_BUDGET_INFO(ttbt, "TT-Budget/WinTV-NOVA-T PCI", BUDGET_TT); | 720 | MAKE_BUDGET_INFO(ttbt, "TT-Budget/WinTV-NOVA-T PCI", BUDGET_TT); |
@@ -630,6 +727,7 @@ static struct pci_device_id pci_tbl[] = { | |||
630 | MAKE_EXTENSION_PCI(ttbc, 0x13c2, 0x1004), | 727 | MAKE_EXTENSION_PCI(ttbc, 0x13c2, 0x1004), |
631 | MAKE_EXTENSION_PCI(ttbt, 0x13c2, 0x1005), | 728 | MAKE_EXTENSION_PCI(ttbt, 0x13c2, 0x1005), |
632 | MAKE_EXTENSION_PCI(satel, 0x13c2, 0x1013), | 729 | MAKE_EXTENSION_PCI(satel, 0x13c2, 0x1013), |
730 | MAKE_EXTENSION_PCI(ttbs2, 0x13c2, 0x1017), | ||
633 | MAKE_EXTENSION_PCI(ttbs, 0x13c2, 0x1016), | 731 | MAKE_EXTENSION_PCI(ttbs, 0x13c2, 0x1016), |
634 | MAKE_EXTENSION_PCI(fsacs1,0x1131, 0x4f60), | 732 | MAKE_EXTENSION_PCI(fsacs1,0x1131, 0x4f60), |
635 | MAKE_EXTENSION_PCI(fsacs0,0x1131, 0x4f61), | 733 | MAKE_EXTENSION_PCI(fsacs0,0x1131, 0x4f61), |