aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb/frontends/stv0299.c8
-rw-r--r--drivers/media/dvb/frontends/stv0299.h1
-rw-r--r--drivers/media/dvb/ttpci/budget-av.c156
3 files changed, 165 insertions, 0 deletions
diff --git a/drivers/media/dvb/frontends/stv0299.c b/drivers/media/dvb/frontends/stv0299.c
index 177d71d56b67..1085bd15d56d 100644
--- a/drivers/media/dvb/frontends/stv0299.c
+++ b/drivers/media/dvb/frontends/stv0299.c
@@ -131,6 +131,13 @@ static int stv0299_readregs (struct stv0299_state* state, u8 reg1, u8 *b, u8 len
131 return ret == 2 ? 0 : ret; 131 return ret == 2 ? 0 : ret;
132} 132}
133 133
134int stv0299_enable_plli2c (struct dvb_frontend* fe)
135{
136 struct stv0299_state* state = fe->demodulator_priv;
137
138 return stv0299_writeregI(state, 0x05, 0xb5); /* enable i2c repeater on stv0299 */
139}
140
134static int stv0299_set_FEC (struct stv0299_state* state, fe_code_rate_t fec) 141static int stv0299_set_FEC (struct stv0299_state* state, fe_code_rate_t fec)
135{ 142{
136 dprintk ("%s\n", __FUNCTION__); 143 dprintk ("%s\n", __FUNCTION__);
@@ -717,5 +724,6 @@ MODULE_AUTHOR("Ralph Metzler, Holger Waechtler, Peter Schildmann, Felix Domke, "
717 "Andreas Oberritter, Andrew de Quincey, Kenneth Aafløy"); 724 "Andreas Oberritter, Andrew de Quincey, Kenneth Aafløy");
718MODULE_LICENSE("GPL"); 725MODULE_LICENSE("GPL");
719 726
727EXPORT_SYMBOL(stv0299_enable_plli2c);
720EXPORT_SYMBOL(stv0299_writereg); 728EXPORT_SYMBOL(stv0299_writereg);
721EXPORT_SYMBOL(stv0299_attach); 729EXPORT_SYMBOL(stv0299_attach);
diff --git a/drivers/media/dvb/frontends/stv0299.h b/drivers/media/dvb/frontends/stv0299.h
index 9af3d71c89db..32c87b4c2f13 100644
--- a/drivers/media/dvb/frontends/stv0299.h
+++ b/drivers/media/dvb/frontends/stv0299.h
@@ -94,6 +94,7 @@ struct stv0299_config
94}; 94};
95 95
96extern int stv0299_writereg (struct dvb_frontend* fe, u8 reg, u8 data); 96extern int stv0299_writereg (struct dvb_frontend* fe, u8 reg, u8 data);
97extern int stv0299_enable_plli2c (struct dvb_frontend* fe);
97 98
98extern struct dvb_frontend* stv0299_attach(const struct stv0299_config* config, 99extern struct dvb_frontend* stv0299_attach(const struct stv0299_config* config,
99 struct i2c_adapter* i2c); 100 struct i2c_adapter* i2c);
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c
index 8bc784ab1972..9a33f6d5d923 100644
--- a/drivers/media/dvb/ttpci/budget-av.c
+++ b/drivers/media/dvb/ttpci/budget-av.c
@@ -502,6 +502,140 @@ static int philips_su1278_ty_ci_pll_set(struct dvb_frontend *fe,
502 return 0; 502 return 0;
503} 503}
504 504
505#define MIN2(a,b) ((a) < (b) ? (a) : (b))
506#define MIN3(a,b,c) MIN2(MIN2(a,b),c)
507
508static int philips_su1278sh2_tua6100_pll_set(struct dvb_frontend *fe,
509 struct i2c_adapter *i2c,
510 struct dvb_frontend_parameters *params)
511{
512 u8 reg0 [2] = { 0x00, 0x00 };
513 u8 reg1 [4] = { 0x01, 0x00, 0x00, 0x00 };
514 u8 reg2 [3] = { 0x02, 0x00, 0x00 };
515 int _fband;
516 int first_ZF;
517 int R, A, N, P, M;
518 struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = NULL,.len = 0 };
519 int freq = params->frequency;
520
521 first_ZF = (freq) / 1000;
522
523 if (abs(MIN2(abs(first_ZF-1190),abs(first_ZF-1790))) <
524 abs(MIN3(abs(first_ZF-1202),abs(first_ZF-1542),abs(first_ZF-1890))))
525 _fband = 2;
526 else
527 _fband = 3;
528
529 if (_fband == 2) {
530 if (((first_ZF >= 950) && (first_ZF < 1350)) ||
531 ((first_ZF >= 1430) && (first_ZF < 1950)))
532 reg0[1] = 0x07;
533 else if (((first_ZF >= 1350) && (first_ZF < 1430)) ||
534 ((first_ZF >= 1950) && (first_ZF < 2150)))
535 reg0[1] = 0x0B;
536 }
537
538 if(_fband == 3) {
539 if (((first_ZF >= 950) && (first_ZF < 1350)) ||
540 ((first_ZF >= 1455) && (first_ZF < 1950)))
541 reg0[1] = 0x07;
542 else if (((first_ZF >= 1350) && (first_ZF < 1420)) ||
543 ((first_ZF >= 1950) && (first_ZF < 2150)))
544 reg0[1] = 0x0B;
545 else if ((first_ZF >= 1420) && (first_ZF < 1455))
546 reg0[1] = 0x0F;
547 }
548
549 if (first_ZF > 1525)
550 reg1[1] |= 0x80;
551 else
552 reg1[1] &= 0x7F;
553
554 if (_fband == 2) {
555 if (first_ZF > 1430) { /* 1430MHZ */
556 reg1[1] &= 0xCF; /* N2 */
557 reg2[1] &= 0xCF; /* R2 */
558 reg2[1] |= 0x10;
559 } else {
560 reg1[1] &= 0xCF; /* N2 */
561 reg1[1] |= 0x20;
562 reg2[1] &= 0xCF; /* R2 */
563 reg2[1] |= 0x10;
564 }
565 }
566
567 if (_fband == 3) {
568 if ((first_ZF >= 1455) &&
569 (first_ZF < 1630)) {
570 reg1[1] &= 0xCF; /* N2 */
571 reg1[1] |= 0x20;
572 reg2[1] &= 0xCF; /* R2 */
573 } else {
574 if (first_ZF < 1455) {
575 reg1[1] &= 0xCF; /* N2 */
576 reg1[1] |= 0x20;
577 reg2[1] &= 0xCF; /* R2 */
578 reg2[1] |= 0x10;
579 } else {
580 if (first_ZF >= 1630) {
581 reg1[1] &= 0xCF; /* N2 */
582 reg2[1] &= 0xCF; /* R2 */
583 reg2[1] |= 0x10;
584 }
585 }
586 }
587 }
588
589 /* set ports, enable P0 for symbol rates > 4Ms/s */
590 if (params->u.qpsk.symbol_rate >= 4000000)
591 reg1[1] |= 0x0c;
592 else
593 reg1[1] |= 0x04;
594
595 reg2[1] |= 0x0c;
596
597 R = 64;
598 A = 64;
599 P = 64; //32
600
601 M = (freq * R) / 4; /* in Mhz */
602 N = (M - A * 1000) / (P * 1000);
603
604 reg1[1] |= (N >> 9) & 0x03;
605 reg1[2] = (N >> 1) & 0xff;
606 reg1[3] = (N << 7) & 0x80;
607
608 reg2[1] |= (R >> 8) & 0x03;
609 reg2[2] = R & 0xFF; /* R */
610
611 reg1[3] |= A & 0x7f; /* A */
612
613 if (P == 64)
614 reg1[1] |= 0x40; /* Prescaler 64/65 */
615
616 reg0[1] |= 0x03;
617
618 /* already enabled - do not reenable i2c repeater or TX fails */
619 msg.buf = reg0;
620 msg.len = sizeof(reg0);
621 if (i2c_transfer(i2c, &msg, 1) != 1)
622 return -EIO;
623
624 stv0299_enable_plli2c(fe);
625 msg.buf = reg1;
626 msg.len = sizeof(reg1);
627 if (i2c_transfer(i2c, &msg, 1) != 1)
628 return -EIO;
629
630 stv0299_enable_plli2c(fe);
631 msg.buf = reg2;
632 msg.len = sizeof(reg2);
633 if (i2c_transfer(i2c, &msg, 1) != 1)
634 return -EIO;
635
636 return 0;
637}
638
505static u8 typhoon_cinergy1200s_inittab[] = { 639static u8 typhoon_cinergy1200s_inittab[] = {
506 0x01, 0x15, 640 0x01, 0x15,
507 0x02, 0x30, 641 0x02, 0x30,
@@ -571,6 +705,18 @@ static struct stv0299_config cinergy_1200s_config = {
571 .pll_set = philips_su1278_ty_ci_pll_set, 705 .pll_set = philips_su1278_ty_ci_pll_set,
572}; 706};
573 707
708static struct stv0299_config cinergy_1200s_1894_0010_config = {
709 .demod_address = 0x68,
710 .inittab = typhoon_cinergy1200s_inittab,
711 .mclk = 88000000UL,
712 .invert = 1,
713 .skip_reinit = 0,
714 .lock_output = STV0229_LOCKOUTPUT_1,
715 .volt13_op0_op1 = STV0299_VOLT13_OP0,
716 .min_delay_ms = 100,
717 .set_symbol_rate = philips_su1278_ty_ci_set_symbol_rate,
718 .pll_set = philips_su1278sh2_tua6100_pll_set,
719};
574 720
575static int philips_cu1216_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) 721static int philips_cu1216_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
576{ 722{
@@ -767,6 +913,15 @@ static void frontend_init(struct budget_av *budget_av)
767 switch (saa->pci->subsystem_device) { 913 switch (saa->pci->subsystem_device) {
768 914
769 case SUBID_DVBS_KNC1: 915 case SUBID_DVBS_KNC1:
916 if (saa->pci->subsystem_vendor == 0x1894) {
917 fe = stv0299_attach(&cinergy_1200s_1894_0010_config,
918 &budget_av->budget.i2c_adap);
919 } else {
920 fe = stv0299_attach(&typhoon_config,
921 &budget_av->budget.i2c_adap);
922 }
923 break;
924
770 case SUBID_DVBS_KNC1_PLUS: 925 case SUBID_DVBS_KNC1_PLUS:
771 case SUBID_DVBS_TYPHOON: 926 case SUBID_DVBS_TYPHOON:
772 fe = stv0299_attach(&typhoon_config, 927 fe = stv0299_attach(&typhoon_config,
@@ -1021,6 +1176,7 @@ MAKE_BUDGET_INFO(cin1200t, "Terratec Cinergy 1200 DVB-T", BUDGET_CIN1200T);
1021static struct pci_device_id pci_tbl[] = { 1176static struct pci_device_id pci_tbl[] = {
1022 MAKE_EXTENSION_PCI(knc1s, 0x1131, 0x4f56), 1177 MAKE_EXTENSION_PCI(knc1s, 0x1131, 0x4f56),
1023 MAKE_EXTENSION_PCI(knc1s, 0x1131, 0x0010), 1178 MAKE_EXTENSION_PCI(knc1s, 0x1131, 0x0010),
1179 MAKE_EXTENSION_PCI(knc1s, 0x1894, 0x0010),
1024 MAKE_EXTENSION_PCI(knc1sp, 0x1131, 0x0011), 1180 MAKE_EXTENSION_PCI(knc1sp, 0x1131, 0x0011),
1025 MAKE_EXTENSION_PCI(knc1c, 0x1894, 0x0020), 1181 MAKE_EXTENSION_PCI(knc1c, 0x1894, 0x0020),
1026 MAKE_EXTENSION_PCI(knc1cp, 0x1894, 0x0021), 1182 MAKE_EXTENSION_PCI(knc1cp, 0x1894, 0x0021),