aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/bt8xx/dvb-bt8xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/bt8xx/dvb-bt8xx.c')
-rw-r--r--drivers/media/dvb/bt8xx/dvb-bt8xx.c114
1 files changed, 90 insertions, 24 deletions
diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
index c5c7672cd538..2e398090cf63 100644
--- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c
+++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
@@ -34,6 +34,7 @@
34#include "dvb_frontend.h" 34#include "dvb_frontend.h"
35#include "dvb-bt8xx.h" 35#include "dvb-bt8xx.h"
36#include "bt878.h" 36#include "bt878.h"
37#include "dvb-pll.h"
37 38
38static int debug; 39static int debug;
39 40
@@ -279,7 +280,7 @@ static int microtune_mt7202dtf_pll_set(struct dvb_frontend* fe, struct dvb_front
279 data[0] = (div >> 8) & 0x7f; 280 data[0] = (div >> 8) & 0x7f;
280 data[1] = div & 0xff; 281 data[1] = div & 0xff;
281 data[2] = ((div >> 10) & 0x60) | cfg; 282 data[2] = ((div >> 10) & 0x60) | cfg;
282 data[3] = cpump | band_select; 283 data[3] = (cpump << 6) | band_select;
283 284
284 i2c_transfer(card->i2c_adapter, &msg, 1); 285 i2c_transfer(card->i2c_adapter, &msg, 1);
285 return (div * 166666 - 36000000); 286 return (div * 166666 - 36000000);
@@ -522,9 +523,7 @@ static void digitv_alps_tded4_reset(struct dvb_bt8xx_card *bt)
522 /* 523 /*
523 * Reset the frontend, must be called before trying 524 * Reset the frontend, must be called before trying
524 * to initialise the MT352 or mt352_attach 525 * to initialise the MT352 or mt352_attach
525 * will fail. 526 * will fail. Same goes for the nxt6000 frontend.
526 *
527 * Presumably not required for the NXT6000 frontend.
528 * 527 *
529 */ 528 */
530 529
@@ -546,14 +545,63 @@ static struct mt352_config digitv_alps_tded4_config = {
546 .pll_set = digitv_alps_tded4_pll_set, 545 .pll_set = digitv_alps_tded4_pll_set,
547}; 546};
548 547
548static int tdvs_tua6034_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
549{
550 struct dvb_bt8xx_card *card = (struct dvb_bt8xx_card *) fe->dvb->priv;
551 u8 buf[4];
552 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) };
553 int err;
554
555 dvb_pll_configure(&dvb_pll_tdvs_tua6034, buf, params->frequency, 0);
556 dprintk("%s: tuner at 0x%02x bytes: 0x%02x 0x%02x 0x%02x 0x%02x\n",
557 __FUNCTION__, msg.addr, buf[0],buf[1],buf[2],buf[3]);
558 if ((err = i2c_transfer(card->i2c_adapter, &msg, 1)) != 1) {
559 printk(KERN_WARNING "dvb-bt8xx: %s error "
560 "(addr %02x <- %02x, err = %i)\n",
561 __FUNCTION__, buf[0], buf[1], err);
562 if (err < 0)
563 return err;
564 else
565 return -EREMOTEIO;
566 }
567
568 /* Set the Auxiliary Byte. */
569 buf[2] &= ~0x20;
570 buf[2] |= 0x18;
571 buf[3] = 0x50;
572 i2c_transfer(card->i2c_adapter, &msg, 1);
573
574 return 0;
575}
576
577static struct lgdt330x_config tdvs_tua6034_config = {
578 .demod_address = 0x0e,
579 .demod_chip = LGDT3303,
580 .serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */
581 .pll_set = tdvs_tua6034_pll_set,
582};
583
584static void lgdt330x_reset(struct dvb_bt8xx_card *bt)
585{
586 /* Set pin 27 of the lgdt3303 chip high to reset the frontend */
587
588 /* Pulse the reset line */
589 bttv_write_gpio(bt->bttv_nr, 0x00e00007, 0x00000001); /* High */
590 bttv_write_gpio(bt->bttv_nr, 0x00e00007, 0x00000000); /* Low */
591 msleep(100);
592
593 bttv_write_gpio(bt->bttv_nr, 0x00e00007, 0x00000001); /* High */
594 msleep(100);
595}
596
549static void frontend_init(struct dvb_bt8xx_card *card, u32 type) 597static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
550{ 598{
551 int ret; 599 int ret;
552 struct dst_state* state = NULL; 600 struct dst_state* state = NULL;
553 601
554 switch(type) { 602 switch(type) {
555#ifdef BTTV_DVICO_DVBT_LITE 603#ifdef BTTV_BOARD_DVICO_DVBT_LITE
556 case BTTV_DVICO_DVBT_LITE: 604 case BTTV_BOARD_DVICO_DVBT_LITE:
557 card->fe = mt352_attach(&thomson_dtt7579_config, card->i2c_adapter); 605 card->fe = mt352_attach(&thomson_dtt7579_config, card->i2c_adapter);
558 if (card->fe != NULL) { 606 if (card->fe != NULL) {
559 card->fe->ops->info.frequency_min = 174000000; 607 card->fe->ops->info.frequency_min = 174000000;
@@ -562,10 +610,19 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
562 break; 610 break;
563#endif 611#endif
564 612
565#ifdef BTTV_TWINHAN_VP3021 613#ifdef BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE
566 case BTTV_TWINHAN_VP3021: 614 case BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE:
615 lgdt330x_reset(card);
616 card->fe = lgdt330x_attach(&tdvs_tua6034_config, card->i2c_adapter);
617 if (card->fe != NULL)
618 dprintk ("dvb_bt8xx: lgdt330x detected\n");
619 break;
620#endif
621
622#ifdef BTTV_BOARD_TWINHAN_VP3021
623 case BTTV_BOARD_TWINHAN_VP3021:
567#else 624#else
568 case BTTV_NEBULA_DIGITV: 625 case BTTV_BOARD_NEBULA_DIGITV:
569#endif 626#endif
570 /* 627 /*
571 * It is possible to determine the correct frontend using the I2C bus (see the Nebula SDK); 628 * It is possible to determine the correct frontend using the I2C bus (see the Nebula SDK);
@@ -573,6 +630,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
573 */ 630 */
574 631
575 /* Old Nebula (marked (c)2003 on high profile pci card) has nxt6000 demod */ 632 /* Old Nebula (marked (c)2003 on high profile pci card) has nxt6000 demod */
633 digitv_alps_tded4_reset(card);
576 card->fe = nxt6000_attach(&vp3021_alps_tded4_config, card->i2c_adapter); 634 card->fe = nxt6000_attach(&vp3021_alps_tded4_config, card->i2c_adapter);
577 if (card->fe != NULL) { 635 if (card->fe != NULL) {
578 dprintk ("dvb_bt8xx: an nxt6000 was detected on your digitv card\n"); 636 dprintk ("dvb_bt8xx: an nxt6000 was detected on your digitv card\n");
@@ -587,11 +645,11 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
587 dprintk ("dvb_bt8xx: an mt352 was detected on your digitv card\n"); 645 dprintk ("dvb_bt8xx: an mt352 was detected on your digitv card\n");
588 break; 646 break;
589 647
590 case BTTV_AVDVBT_761: 648 case BTTV_BOARD_AVDVBT_761:
591 card->fe = sp887x_attach(&microtune_mt7202dtf_config, card->i2c_adapter); 649 card->fe = sp887x_attach(&microtune_mt7202dtf_config, card->i2c_adapter);
592 break; 650 break;
593 651
594 case BTTV_AVDVBT_771: 652 case BTTV_BOARD_AVDVBT_771:
595 card->fe = mt352_attach(&advbt771_samsung_tdtc9251dh0_config, card->i2c_adapter); 653 card->fe = mt352_attach(&advbt771_samsung_tdtc9251dh0_config, card->i2c_adapter);
596 if (card->fe != NULL) { 654 if (card->fe != NULL) {
597 card->fe->ops->info.frequency_min = 174000000; 655 card->fe->ops->info.frequency_min = 174000000;
@@ -599,7 +657,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
599 } 657 }
600 break; 658 break;
601 659
602 case BTTV_TWINHAN_DST: 660 case BTTV_BOARD_TWINHAN_DST:
603 /* DST is not a frontend driver !!! */ 661 /* DST is not a frontend driver !!! */
604 state = (struct dst_state *) kmalloc(sizeof (struct dst_state), GFP_KERNEL); 662 state = (struct dst_state *) kmalloc(sizeof (struct dst_state), GFP_KERNEL);
605 /* Setup the Card */ 663 /* Setup the Card */
@@ -620,11 +678,11 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
620 ret = dst_ca_attach(state, &card->dvb_adapter); 678 ret = dst_ca_attach(state, &card->dvb_adapter);
621 break; 679 break;
622 680
623 case BTTV_PINNACLESAT: 681 case BTTV_BOARD_PINNACLESAT:
624 card->fe = cx24110_attach(&pctvsat_config, card->i2c_adapter); 682 card->fe = cx24110_attach(&pctvsat_config, card->i2c_adapter);
625 break; 683 break;
626 684
627 case BTTV_PC_HDTV: 685 case BTTV_BOARD_PC_HDTV:
628 card->fe = or51211_attach(&or51211_config, card->i2c_adapter); 686 card->fe = or51211_attach(&or51211_config, card->i2c_adapter);
629 break; 687 break;
630 } 688 }
@@ -746,7 +804,7 @@ static int dvb_bt8xx_probe(struct device *dev)
746 card->i2c_adapter = &sub->core->i2c_adap; 804 card->i2c_adapter = &sub->core->i2c_adap;
747 805
748 switch(sub->core->type) { 806 switch(sub->core->type) {
749 case BTTV_PINNACLESAT: 807 case BTTV_BOARD_PINNACLESAT:
750 card->gpio_mode = 0x0400c060; 808 card->gpio_mode = 0x0400c060;
751 /* should be: BT878_A_GAIN=0,BT878_A_PWRDN,BT878_DA_DPM,BT878_DA_SBR, 809 /* should be: BT878_A_GAIN=0,BT878_A_PWRDN,BT878_DA_DPM,BT878_DA_SBR,
752 BT878_DA_IOM=1,BT878_DA_APP to enable serial highspeed mode. */ 810 BT878_DA_IOM=1,BT878_DA_APP to enable serial highspeed mode. */
@@ -754,8 +812,8 @@ static int dvb_bt8xx_probe(struct device *dev)
754 card->irq_err_ignore = 0; 812 card->irq_err_ignore = 0;
755 break; 813 break;
756 814
757#ifdef BTTV_DVICO_DVBT_LITE 815#ifdef BTTV_BOARD_DVICO_DVBT_LITE
758 case BTTV_DVICO_DVBT_LITE: 816 case BTTV_BOARD_DVICO_DVBT_LITE:
759#endif 817#endif
760 card->gpio_mode = 0x0400C060; 818 card->gpio_mode = 0x0400C060;
761 card->op_sync_orin = 0; 819 card->op_sync_orin = 0;
@@ -765,26 +823,34 @@ static int dvb_bt8xx_probe(struct device *dev)
765 * DA_APP(parallel) */ 823 * DA_APP(parallel) */
766 break; 824 break;
767 825
768#ifdef BTTV_TWINHAN_VP3021 826#ifdef BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE
769 case BTTV_TWINHAN_VP3021: 827 case BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE:
828#endif
829 card->gpio_mode = 0x0400c060;
830 card->op_sync_orin = BT878_RISC_SYNC_MASK;
831 card->irq_err_ignore = BT878_AFBUS | BT878_AFDSR;
832 break;
833
834#ifdef BTTV_BOARD_TWINHAN_VP3021
835 case BTTV_BOARD_TWINHAN_VP3021:
770#else 836#else
771 case BTTV_NEBULA_DIGITV: 837 case BTTV_BOARD_NEBULA_DIGITV:
772#endif 838#endif
773 case BTTV_AVDVBT_761: 839 case BTTV_BOARD_AVDVBT_761:
774 card->gpio_mode = (1 << 26) | (1 << 14) | (1 << 5); 840 card->gpio_mode = (1 << 26) | (1 << 14) | (1 << 5);
775 card->op_sync_orin = 0; 841 card->op_sync_orin = 0;
776 card->irq_err_ignore = 0; 842 card->irq_err_ignore = 0;
777 /* A_PWRDN DA_SBR DA_APP (high speed serial) */ 843 /* A_PWRDN DA_SBR DA_APP (high speed serial) */
778 break; 844 break;
779 845
780 case BTTV_AVDVBT_771: //case 0x07711461: 846 case BTTV_BOARD_AVDVBT_771: //case 0x07711461:
781 card->gpio_mode = 0x0400402B; 847 card->gpio_mode = 0x0400402B;
782 card->op_sync_orin = BT878_RISC_SYNC_MASK; 848 card->op_sync_orin = BT878_RISC_SYNC_MASK;
783 card->irq_err_ignore = 0; 849 card->irq_err_ignore = 0;
784 /* A_PWRDN DA_SBR DA_APP[0] PKTP=10 RISC_ENABLE FIFO_ENABLE*/ 850 /* A_PWRDN DA_SBR DA_APP[0] PKTP=10 RISC_ENABLE FIFO_ENABLE*/
785 break; 851 break;
786 852
787 case BTTV_TWINHAN_DST: 853 case BTTV_BOARD_TWINHAN_DST:
788 card->gpio_mode = 0x2204f2c; 854 card->gpio_mode = 0x2204f2c;
789 card->op_sync_orin = BT878_RISC_SYNC_MASK; 855 card->op_sync_orin = BT878_RISC_SYNC_MASK;
790 card->irq_err_ignore = BT878_APABORT | BT878_ARIPERR | 856 card->irq_err_ignore = BT878_APABORT | BT878_ARIPERR |
@@ -802,7 +868,7 @@ static int dvb_bt8xx_probe(struct device *dev)
802 * RISC+FIFO ENABLE */ 868 * RISC+FIFO ENABLE */
803 break; 869 break;
804 870
805 case BTTV_PC_HDTV: 871 case BTTV_BOARD_PC_HDTV:
806 card->gpio_mode = 0x0100EC7B; 872 card->gpio_mode = 0x0100EC7B;
807 card->op_sync_orin = 0; 873 card->op_sync_orin = 0;
808 card->irq_err_ignore = 0; 874 card->irq_err_ignore = 0;