diff options
author | Andrew de Quincey <adq_dvb@lidskialf.net> | 2006-09-05 16:58:20 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-09-26 11:30:35 -0400 |
commit | 1c72cfdcea00fbdcae37d096f2e58b4736d305fb (patch) | |
tree | beabfe726996b22c7174800ced86d3d9bb30c627 | |
parent | 00be2e7c64157c845afff56f25677da706b151b6 (diff) |
V4L/DVB (4607): Port budget-av to use the new tua6100 driver
Port budget-av to use the new tua6100 driver
Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | drivers/media/dvb/ttpci/Kconfig | 1 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/budget-av.c | 141 |
2 files changed, 3 insertions, 139 deletions
diff --git a/drivers/media/dvb/ttpci/Kconfig b/drivers/media/dvb/ttpci/Kconfig index 9ce932e97f23..3f4156f9b9c0 100644 --- a/drivers/media/dvb/ttpci/Kconfig +++ b/drivers/media/dvb/ttpci/Kconfig | |||
@@ -113,6 +113,7 @@ config DVB_BUDGET_AV | |||
113 | select DVB_STV0299 if !DVB_FE_CUSTOMISE | 113 | select DVB_STV0299 if !DVB_FE_CUSTOMISE |
114 | select DVB_TDA1004X if !DVB_FE_CUSTOMISE | 114 | select DVB_TDA1004X if !DVB_FE_CUSTOMISE |
115 | select DVB_TDA10021 if !DVB_FE_CUSTOMISE | 115 | select DVB_TDA10021 if !DVB_FE_CUSTOMISE |
116 | select DVB_TUA6100 if !DVB_FE_CUSTOMISE | ||
116 | select FW_LOADER | 117 | select FW_LOADER |
117 | help | 118 | help |
118 | Support for simple SAA7146 based DVB cards | 119 | Support for simple SAA7146 based DVB cards |
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c index 16ff8ae80d80..2235ff8b8a1d 100644 --- a/drivers/media/dvb/ttpci/budget-av.c +++ b/drivers/media/dvb/ttpci/budget-av.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include "stv0299.h" | 37 | #include "stv0299.h" |
38 | #include "tda10021.h" | 38 | #include "tda10021.h" |
39 | #include "tda1004x.h" | 39 | #include "tda1004x.h" |
40 | #include "tua6100.h" | ||
40 | #include "dvb-pll.h" | 41 | #include "dvb-pll.h" |
41 | #include <media/saa7146_vv.h> | 42 | #include <media/saa7146_vv.h> |
42 | #include <linux/module.h> | 43 | #include <linux/module.h> |
@@ -548,144 +549,6 @@ static int philips_su1278_ty_ci_tuner_set_params(struct dvb_frontend *fe, | |||
548 | return 0; | 549 | return 0; |
549 | } | 550 | } |
550 | 551 | ||
551 | #define MIN2(a,b) ((a) < (b) ? (a) : (b)) | ||
552 | #define MIN3(a,b,c) MIN2(MIN2(a,b),c) | ||
553 | |||
554 | static int philips_su1278sh2_tua6100_tuner_set_params(struct dvb_frontend *fe, | ||
555 | struct dvb_frontend_parameters *params) | ||
556 | { | ||
557 | u8 reg0 [2] = { 0x00, 0x00 }; | ||
558 | u8 reg1 [4] = { 0x01, 0x00, 0x00, 0x00 }; | ||
559 | u8 reg2 [3] = { 0x02, 0x00, 0x00 }; | ||
560 | int _fband; | ||
561 | int first_ZF; | ||
562 | int R, A, N, P, M; | ||
563 | struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = NULL,.len = 0 }; | ||
564 | int freq = params->frequency; | ||
565 | struct budget *budget = (struct budget *) fe->dvb->priv; | ||
566 | |||
567 | first_ZF = (freq) / 1000; | ||
568 | |||
569 | if (abs(MIN2(abs(first_ZF-1190),abs(first_ZF-1790))) < | ||
570 | abs(MIN3(abs(first_ZF-1202),abs(first_ZF-1542),abs(first_ZF-1890)))) | ||
571 | _fband = 2; | ||
572 | else | ||
573 | _fband = 3; | ||
574 | |||
575 | if (_fband == 2) { | ||
576 | if (((first_ZF >= 950) && (first_ZF < 1350)) || | ||
577 | ((first_ZF >= 1430) && (first_ZF < 1950))) | ||
578 | reg0[1] = 0x07; | ||
579 | else if (((first_ZF >= 1350) && (first_ZF < 1430)) || | ||
580 | ((first_ZF >= 1950) && (first_ZF < 2150))) | ||
581 | reg0[1] = 0x0B; | ||
582 | } | ||
583 | |||
584 | if(_fband == 3) { | ||
585 | if (((first_ZF >= 950) && (first_ZF < 1350)) || | ||
586 | ((first_ZF >= 1455) && (first_ZF < 1950))) | ||
587 | reg0[1] = 0x07; | ||
588 | else if (((first_ZF >= 1350) && (first_ZF < 1420)) || | ||
589 | ((first_ZF >= 1950) && (first_ZF < 2150))) | ||
590 | reg0[1] = 0x0B; | ||
591 | else if ((first_ZF >= 1420) && (first_ZF < 1455)) | ||
592 | reg0[1] = 0x0F; | ||
593 | } | ||
594 | |||
595 | if (first_ZF > 1525) | ||
596 | reg1[1] |= 0x80; | ||
597 | else | ||
598 | reg1[1] &= 0x7F; | ||
599 | |||
600 | if (_fband == 2) { | ||
601 | if (first_ZF > 1430) { /* 1430MHZ */ | ||
602 | reg1[1] &= 0xCF; /* N2 */ | ||
603 | reg2[1] &= 0xCF; /* R2 */ | ||
604 | reg2[1] |= 0x10; | ||
605 | } else { | ||
606 | reg1[1] &= 0xCF; /* N2 */ | ||
607 | reg1[1] |= 0x20; | ||
608 | reg2[1] &= 0xCF; /* R2 */ | ||
609 | reg2[1] |= 0x10; | ||
610 | } | ||
611 | } | ||
612 | |||
613 | if (_fband == 3) { | ||
614 | if ((first_ZF >= 1455) && | ||
615 | (first_ZF < 1630)) { | ||
616 | reg1[1] &= 0xCF; /* N2 */ | ||
617 | reg1[1] |= 0x20; | ||
618 | reg2[1] &= 0xCF; /* R2 */ | ||
619 | } else { | ||
620 | if (first_ZF < 1455) { | ||
621 | reg1[1] &= 0xCF; /* N2 */ | ||
622 | reg1[1] |= 0x20; | ||
623 | reg2[1] &= 0xCF; /* R2 */ | ||
624 | reg2[1] |= 0x10; | ||
625 | } else { | ||
626 | if (first_ZF >= 1630) { | ||
627 | reg1[1] &= 0xCF; /* N2 */ | ||
628 | reg2[1] &= 0xCF; /* R2 */ | ||
629 | reg2[1] |= 0x10; | ||
630 | } | ||
631 | } | ||
632 | } | ||
633 | } | ||
634 | |||
635 | /* set ports, enable P0 for symbol rates > 4Ms/s */ | ||
636 | if (params->u.qpsk.symbol_rate >= 4000000) | ||
637 | reg1[1] |= 0x0c; | ||
638 | else | ||
639 | reg1[1] |= 0x04; | ||
640 | |||
641 | reg2[1] |= 0x0c; | ||
642 | |||
643 | R = 64; | ||
644 | A = 64; | ||
645 | P = 64; //32 | ||
646 | |||
647 | M = (freq * R) / 4; /* in Mhz */ | ||
648 | N = (M - A * 1000) / (P * 1000); | ||
649 | |||
650 | reg1[1] |= (N >> 9) & 0x03; | ||
651 | reg1[2] = (N >> 1) & 0xff; | ||
652 | reg1[3] = (N << 7) & 0x80; | ||
653 | |||
654 | reg2[1] |= (R >> 8) & 0x03; | ||
655 | reg2[2] = R & 0xFF; /* R */ | ||
656 | |||
657 | reg1[3] |= A & 0x7f; /* A */ | ||
658 | |||
659 | if (P == 64) | ||
660 | reg1[1] |= 0x40; /* Prescaler 64/65 */ | ||
661 | |||
662 | reg0[1] |= 0x03; | ||
663 | |||
664 | /* already enabled - do not reenable i2c repeater or TX fails */ | ||
665 | if (fe->ops.i2c_gate_ctrl) | ||
666 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
667 | msg.buf = reg0; | ||
668 | msg.len = sizeof(reg0); | ||
669 | if (i2c_transfer(&budget->i2c_adap, &msg, 1) != 1) | ||
670 | return -EIO; | ||
671 | |||
672 | if (fe->ops.i2c_gate_ctrl) | ||
673 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
674 | msg.buf = reg1; | ||
675 | msg.len = sizeof(reg1); | ||
676 | if (i2c_transfer(&budget->i2c_adap, &msg, 1) != 1) | ||
677 | return -EIO; | ||
678 | |||
679 | if (fe->ops.i2c_gate_ctrl) | ||
680 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
681 | msg.buf = reg2; | ||
682 | msg.len = sizeof(reg2); | ||
683 | if (i2c_transfer(&budget->i2c_adap, &msg, 1) != 1) | ||
684 | return -EIO; | ||
685 | |||
686 | return 0; | ||
687 | } | ||
688 | |||
689 | static u8 typhoon_cinergy1200s_inittab[] = { | 552 | static u8 typhoon_cinergy1200s_inittab[] = { |
690 | 0x01, 0x15, | 553 | 0x01, 0x15, |
691 | 0x02, 0x30, | 554 | 0x02, 0x30, |
@@ -1102,7 +965,7 @@ static void frontend_init(struct budget_av *budget_av) | |||
1102 | fe = dvb_attach(stv0299_attach, &cinergy_1200s_1894_0010_config, | 965 | fe = dvb_attach(stv0299_attach, &cinergy_1200s_1894_0010_config, |
1103 | &budget_av->budget.i2c_adap); | 966 | &budget_av->budget.i2c_adap); |
1104 | if (fe) { | 967 | if (fe) { |
1105 | fe->ops.tuner_ops.set_params = philips_su1278sh2_tua6100_tuner_set_params; | 968 | dvb_attach(tua6100_attach, fe, 0x60, &budget_av->budget.i2c_adap); |
1106 | } | 969 | } |
1107 | } else { | 970 | } else { |
1108 | fe = dvb_attach(stv0299_attach, &typhoon_config, | 971 | fe = dvb_attach(stv0299_attach, &typhoon_config, |