aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/ttpci
diff options
context:
space:
mode:
authorHartmut Birr <e9hack@googlemail.com>2007-04-21 18:37:17 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-04-27 14:45:47 -0400
commitaa323ac89c5724de89656fcf31590d19e74594ec (patch)
treea556247ba3e2d78e14e974105d6a34fc094849e5 /drivers/media/dvb/ttpci
parentfd9c66e269a44bd3c6c615957c79b21f3dde69af (diff)
V4L/DVB (5543): Tda10023: Add support for frontend TDA10023
Add support for the frontend TDA10023 and add cards that need the tda10023. Signed-off-by: Hartmut Birr <e9hack@googlemail.com> Signed-off-by: Georg Acher <acher@in.tum.de> Signed-off-by: Oliver Endriss <o.endriss@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/ttpci')
-rw-r--r--drivers/media/dvb/ttpci/Kconfig2
-rw-r--r--drivers/media/dvb/ttpci/budget-av.c105
-rw-r--r--drivers/media/dvb/ttpci/budget-core.c16
-rw-r--r--drivers/media/dvb/ttpci/budget.h3
4 files changed, 99 insertions, 27 deletions
diff --git a/drivers/media/dvb/ttpci/Kconfig b/drivers/media/dvb/ttpci/Kconfig
index 3cd319ff0e68..7751628e1415 100644
--- a/drivers/media/dvb/ttpci/Kconfig
+++ b/drivers/media/dvb/ttpci/Kconfig
@@ -67,6 +67,7 @@ config DVB_BUDGET
67 select DVB_L64781 if !DVB_FE_CUSTOMISE 67 select DVB_L64781 if !DVB_FE_CUSTOMISE
68 select DVB_TDA8083 if !DVB_FE_CUSTOMISE 68 select DVB_TDA8083 if !DVB_FE_CUSTOMISE
69 select DVB_TDA10021 if !DVB_FE_CUSTOMISE 69 select DVB_TDA10021 if !DVB_FE_CUSTOMISE
70 select DVB_TDA10023 if !DVB_FE_CUSTOMISE
70 select DVB_S5H1420 if !DVB_FE_CUSTOMISE 71 select DVB_S5H1420 if !DVB_FE_CUSTOMISE
71 select DVB_TDA10086 if !DVB_FE_CUSTOMISE 72 select DVB_TDA10086 if !DVB_FE_CUSTOMISE
72 select DVB_TDA826X if !DVB_FE_CUSTOMISE 73 select DVB_TDA826X if !DVB_FE_CUSTOMISE
@@ -111,6 +112,7 @@ config DVB_BUDGET_AV
111 select DVB_STV0299 if !DVB_FE_CUSTOMISE 112 select DVB_STV0299 if !DVB_FE_CUSTOMISE
112 select DVB_TDA1004X if !DVB_FE_CUSTOMISE 113 select DVB_TDA1004X if !DVB_FE_CUSTOMISE
113 select DVB_TDA10021 if !DVB_FE_CUSTOMISE 114 select DVB_TDA10021 if !DVB_FE_CUSTOMISE
115 select DVB_TDA10023 if !DVB_FE_CUSTOMISE
114 select DVB_TUA6100 if !DVB_FE_CUSTOMISE 116 select DVB_TUA6100 if !DVB_FE_CUSTOMISE
115 select FW_LOADER 117 select FW_LOADER
116 help 118 help
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c
index 54ca3a3288e7..5680aa57c93e 100644
--- a/drivers/media/dvb/ttpci/budget-av.c
+++ b/drivers/media/dvb/ttpci/budget-av.c
@@ -35,7 +35,7 @@
35 35
36#include "budget.h" 36#include "budget.h"
37#include "stv0299.h" 37#include "stv0299.h"
38#include "tda10021.h" 38#include "tda1002x.h"
39#include "tda1004x.h" 39#include "tda1004x.h"
40#include "tua6100.h" 40#include "tua6100.h"
41#include "dvb-pll.h" 41#include "dvb-pll.h"
@@ -611,37 +611,60 @@ static struct stv0299_config cinergy_1200s_1894_0010_config = {
611static int philips_cu1216_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) 611static int philips_cu1216_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
612{ 612{
613 struct budget *budget = (struct budget *) fe->dvb->priv; 613 struct budget *budget = (struct budget *) fe->dvb->priv;
614 u8 buf[4]; 614 u8 buf[6];
615 struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = buf,.len = sizeof(buf) }; 615 struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = buf,.len = sizeof(buf) };
616 int i;
616 617
618#define CU1216_IF 36125000
617#define TUNER_MUL 62500 619#define TUNER_MUL 62500
618 620
619 u32 div = (params->frequency + 36125000 + TUNER_MUL / 2) / TUNER_MUL; 621 u32 div = (params->frequency + CU1216_IF + TUNER_MUL / 2) / TUNER_MUL;
620 622
621 buf[0] = (div >> 8) & 0x7f; 623 buf[0] = (div >> 8) & 0x7f;
622 buf[1] = div & 0xff; 624 buf[1] = div & 0xff;
623 buf[2] = 0x86; 625 buf[2] = 0xce;
624 buf[3] = (params->frequency < 150000000 ? 0x01 : 626 buf[3] = (params->frequency < 150000000 ? 0x01 :
625 params->frequency < 445000000 ? 0x02 : 0x04); 627 params->frequency < 445000000 ? 0x02 : 0x04);
628 buf[4] = 0xde;
629 buf[5] = 0x20;
626 630
627 if (fe->ops.i2c_gate_ctrl) 631 if (fe->ops.i2c_gate_ctrl)
628 fe->ops.i2c_gate_ctrl(fe, 1); 632 fe->ops.i2c_gate_ctrl(fe, 1);
629 if (i2c_transfer(&budget->i2c_adap, &msg, 1) != 1) 633 if (i2c_transfer(&budget->i2c_adap, &msg, 1) != 1)
630 return -EIO; 634 return -EIO;
635
636 /* wait for the pll lock */
637 msg.flags = I2C_M_RD;
638 msg.len = 1;
639 for (i = 0; i < 20; i++) {
640 if (fe->ops.i2c_gate_ctrl)
641 fe->ops.i2c_gate_ctrl(fe, 1);
642 if (i2c_transfer(&budget->i2c_adap, &msg, 1) == 1 && (buf[0] & 0x40))
643 break;
644 msleep(10);
645 }
646
647 /* switch the charge pump to the lower current */
648 msg.flags = 0;
649 msg.len = 2;
650 msg.buf = &buf[2];
651 buf[2] &= ~0x40;
652 if (fe->ops.i2c_gate_ctrl)
653 fe->ops.i2c_gate_ctrl(fe, 1);
654 if (i2c_transfer(&budget->i2c_adap, &msg, 1) != 1)
655 return -EIO;
656
631 return 0; 657 return 0;
632} 658}
633 659
634static struct tda10021_config philips_cu1216_config = { 660static struct tda1002x_config philips_cu1216_config = {
635 .demod_address = 0x0c, 661 .demod_address = 0x0c,
636}; 662};
637 663
638static struct tda10021_config philips_cu1216_config_altaddress = { 664static struct tda1002x_config philips_cu1216_config_altaddress = {
639 .demod_address = 0x0d, 665 .demod_address = 0x0d,
640}; 666};
641 667
642
643
644
645static int philips_tu1216_tuner_init(struct dvb_frontend *fe) 668static int philips_tu1216_tuner_init(struct dvb_frontend *fe)
646{ 669{
647 struct budget *budget = (struct budget *) fe->dvb->priv; 670 struct budget *budget = (struct budget *) fe->dvb->priv;
@@ -888,24 +911,28 @@ static u8 read_pwm(struct budget_av *budget_av)
888 return pwm; 911 return pwm;
889} 912}
890 913
891#define SUBID_DVBS_KNC1 0x0010 914#define SUBID_DVBS_KNC1 0x0010
892#define SUBID_DVBS_KNC1_PLUS 0x0011 915#define SUBID_DVBS_KNC1_PLUS 0x0011
893#define SUBID_DVBS_TYPHOON 0x4f56 916#define SUBID_DVBS_TYPHOON 0x4f56
894#define SUBID_DVBS_CINERGY1200 0x1154 917#define SUBID_DVBS_CINERGY1200 0x1154
895#define SUBID_DVBS_CYNERGY1200N 0x1155 918#define SUBID_DVBS_CYNERGY1200N 0x1155
896 919#define SUBID_DVBS_TV_STAR 0x0014
897#define SUBID_DVBS_TV_STAR 0x0014 920#define SUBID_DVBS_TV_STAR_CI 0x0016
898#define SUBID_DVBS_TV_STAR_CI 0x0016 921#define SUBID_DVBS_EASYWATCH_1 0x001a
899#define SUBID_DVBS_EASYWATCH_1 0x001a 922#define SUBID_DVBS_EASYWATCH 0x001e
900#define SUBID_DVBS_EASYWATCH 0x001e 923
901#define SUBID_DVBC_EASYWATCH 0x002a 924#define SUBID_DVBC_EASYWATCH 0x002a
902#define SUBID_DVBC_KNC1 0x0020 925#define SUBID_DVBC_EASYWATCH_MK3 0x002c
903#define SUBID_DVBC_KNC1_PLUS 0x0021 926#define SUBID_DVBC_KNC1 0x0020
904#define SUBID_DVBC_CINERGY1200 0x1156 927#define SUBID_DVBC_KNC1_PLUS 0x0021
905 928#define SUBID_DVBC_KNC1_MK3 0x0022
906#define SUBID_DVBT_KNC1_PLUS 0x0031 929#define SUBID_DVBC_KNC1_PLUS_MK3 0x0023
907#define SUBID_DVBT_KNC1 0x0030 930#define SUBID_DVBC_CINERGY1200 0x1156
908#define SUBID_DVBT_CINERGY1200 0x1157 931#define SUBID_DVBC_CINERGY1200_MK3 0x1176
932
933#define SUBID_DVBT_KNC1_PLUS 0x0031
934#define SUBID_DVBT_KNC1 0x0030
935#define SUBID_DVBT_CINERGY1200 0x1157
909 936
910static void frontend_init(struct budget_av *budget_av) 937static void frontend_init(struct budget_av *budget_av)
911{ 938{
@@ -924,6 +951,7 @@ static void frontend_init(struct budget_av *budget_av)
924 case SUBID_DVBC_KNC1_PLUS: 951 case SUBID_DVBC_KNC1_PLUS:
925 case SUBID_DVBT_KNC1_PLUS: 952 case SUBID_DVBT_KNC1_PLUS:
926 case SUBID_DVBC_EASYWATCH: 953 case SUBID_DVBC_EASYWATCH:
954 case SUBID_DVBC_KNC1_PLUS_MK3:
927 saa7146_setgpio(saa, 3, SAA7146_GPIO_OUTHI); 955 saa7146_setgpio(saa, 3, SAA7146_GPIO_OUTHI);
928 break; 956 break;
929 } 957 }
@@ -980,6 +1008,7 @@ static void frontend_init(struct budget_av *budget_av)
980 case SUBID_DVBC_CINERGY1200: 1008 case SUBID_DVBC_CINERGY1200:
981 case SUBID_DVBC_EASYWATCH: 1009 case SUBID_DVBC_EASYWATCH:
982 budget_av->reinitialise_demod = 1; 1010 budget_av->reinitialise_demod = 1;
1011 budget_av->budget.dev->i2c_bitrate = SAA7146_I2C_BUS_BIT_RATE_240;
983 fe = dvb_attach(tda10021_attach, &philips_cu1216_config, 1012 fe = dvb_attach(tda10021_attach, &philips_cu1216_config,
984 &budget_av->budget.i2c_adap, 1013 &budget_av->budget.i2c_adap,
985 read_pwm(budget_av)); 1014 read_pwm(budget_av));
@@ -992,6 +1021,20 @@ static void frontend_init(struct budget_av *budget_av)
992 } 1021 }
993 break; 1022 break;
994 1023
1024 case SUBID_DVBC_EASYWATCH_MK3:
1025 case SUBID_DVBC_CINERGY1200_MK3:
1026 case SUBID_DVBC_KNC1_MK3:
1027 case SUBID_DVBC_KNC1_PLUS_MK3:
1028 budget_av->reinitialise_demod = 1;
1029 budget_av->budget.dev->i2c_bitrate = SAA7146_I2C_BUS_BIT_RATE_240;
1030 fe = dvb_attach(tda10023_attach, &philips_cu1216_config,
1031 &budget_av->budget.i2c_adap,
1032 read_pwm(budget_av));
1033 if (fe) {
1034 fe->ops.tuner_ops.set_params = philips_cu1216_tuner_set_params;
1035 }
1036 break;
1037
995 case SUBID_DVBT_KNC1: 1038 case SUBID_DVBT_KNC1:
996 case SUBID_DVBT_KNC1_PLUS: 1039 case SUBID_DVBT_KNC1_PLUS:
997 case SUBID_DVBT_CINERGY1200: 1040 case SUBID_DVBT_CINERGY1200:
@@ -1220,12 +1263,16 @@ MAKE_BUDGET_INFO(kncxs, "KNC TV STAR DVB-S", BUDGET_TVSTAR);
1220MAKE_BUDGET_INFO(satewpls, "Satelco EasyWatch DVB-S light", BUDGET_TVSTAR); 1263MAKE_BUDGET_INFO(satewpls, "Satelco EasyWatch DVB-S light", BUDGET_TVSTAR);
1221MAKE_BUDGET_INFO(satewpls1, "Satelco EasyWatch DVB-S light", BUDGET_KNC1S); 1264MAKE_BUDGET_INFO(satewpls1, "Satelco EasyWatch DVB-S light", BUDGET_KNC1S);
1222MAKE_BUDGET_INFO(satewplc, "Satelco EasyWatch DVB-C", BUDGET_KNC1CP); 1265MAKE_BUDGET_INFO(satewplc, "Satelco EasyWatch DVB-C", BUDGET_KNC1CP);
1266MAKE_BUDGET_INFO(satewcmk3, "Satelco EasyWatch DVB-C MK3", BUDGET_KNC1C_MK3);
1223MAKE_BUDGET_INFO(knc1sp, "KNC1 DVB-S Plus", BUDGET_KNC1SP); 1267MAKE_BUDGET_INFO(knc1sp, "KNC1 DVB-S Plus", BUDGET_KNC1SP);
1224MAKE_BUDGET_INFO(knc1cp, "KNC1 DVB-C Plus", BUDGET_KNC1CP); 1268MAKE_BUDGET_INFO(knc1cp, "KNC1 DVB-C Plus", BUDGET_KNC1CP);
1269MAKE_BUDGET_INFO(knc1cmk3, "KNC1 DVB-C MK3", BUDGET_KNC1C_MK3);
1270MAKE_BUDGET_INFO(knc1cpmk3, "KNC1 DVB-C Plus MK3", BUDGET_KNC1CP_MK3);
1225MAKE_BUDGET_INFO(knc1tp, "KNC1 DVB-T Plus", BUDGET_KNC1TP); 1271MAKE_BUDGET_INFO(knc1tp, "KNC1 DVB-T Plus", BUDGET_KNC1TP);
1226MAKE_BUDGET_INFO(cin1200s, "TerraTec Cinergy 1200 DVB-S", BUDGET_CIN1200S); 1272MAKE_BUDGET_INFO(cin1200s, "TerraTec Cinergy 1200 DVB-S", BUDGET_CIN1200S);
1227MAKE_BUDGET_INFO(cin1200sn, "TerraTec Cinergy 1200 DVB-S", BUDGET_CIN1200S); 1273MAKE_BUDGET_INFO(cin1200sn, "TerraTec Cinergy 1200 DVB-S", BUDGET_CIN1200S);
1228MAKE_BUDGET_INFO(cin1200c, "Terratec Cinergy 1200 DVB-C", BUDGET_CIN1200C); 1274MAKE_BUDGET_INFO(cin1200c, "Terratec Cinergy 1200 DVB-C", BUDGET_CIN1200C);
1275MAKE_BUDGET_INFO(cin1200cmk3, "Terratec Cinergy 1200 DVB-C MK3", BUDGET_CIN1200C_MK3);
1229MAKE_BUDGET_INFO(cin1200t, "Terratec Cinergy 1200 DVB-T", BUDGET_CIN1200T); 1276MAKE_BUDGET_INFO(cin1200t, "Terratec Cinergy 1200 DVB-T", BUDGET_CIN1200T);
1230 1277
1231static struct pci_device_id pci_tbl[] = { 1278static struct pci_device_id pci_tbl[] = {
@@ -1239,13 +1286,17 @@ static struct pci_device_id pci_tbl[] = {
1239 MAKE_EXTENSION_PCI(satewpls, 0x1894, 0x001e), 1286 MAKE_EXTENSION_PCI(satewpls, 0x1894, 0x001e),
1240 MAKE_EXTENSION_PCI(satewpls1, 0x1894, 0x001a), 1287 MAKE_EXTENSION_PCI(satewpls1, 0x1894, 0x001a),
1241 MAKE_EXTENSION_PCI(satewplc, 0x1894, 0x002a), 1288 MAKE_EXTENSION_PCI(satewplc, 0x1894, 0x002a),
1289 MAKE_EXTENSION_PCI(satewcmk3, 0x1894, 0x002c),
1242 MAKE_EXTENSION_PCI(knc1c, 0x1894, 0x0020), 1290 MAKE_EXTENSION_PCI(knc1c, 0x1894, 0x0020),
1243 MAKE_EXTENSION_PCI(knc1cp, 0x1894, 0x0021), 1291 MAKE_EXTENSION_PCI(knc1cp, 0x1894, 0x0021),
1292 MAKE_EXTENSION_PCI(knc1cmk3, 0x1894, 0x0022),
1293 MAKE_EXTENSION_PCI(knc1cpmk3, 0x1894, 0x0023),
1244 MAKE_EXTENSION_PCI(knc1t, 0x1894, 0x0030), 1294 MAKE_EXTENSION_PCI(knc1t, 0x1894, 0x0030),
1245 MAKE_EXTENSION_PCI(knc1tp, 0x1894, 0x0031), 1295 MAKE_EXTENSION_PCI(knc1tp, 0x1894, 0x0031),
1246 MAKE_EXTENSION_PCI(cin1200s, 0x153b, 0x1154), 1296 MAKE_EXTENSION_PCI(cin1200s, 0x153b, 0x1154),
1247 MAKE_EXTENSION_PCI(cin1200sn, 0x153b, 0x1155), 1297 MAKE_EXTENSION_PCI(cin1200sn, 0x153b, 0x1155),
1248 MAKE_EXTENSION_PCI(cin1200c, 0x153b, 0x1156), 1298 MAKE_EXTENSION_PCI(cin1200c, 0x153b, 0x1156),
1299 MAKE_EXTENSION_PCI(cin1200cmk3, 0x153b, 0x1176),
1249 MAKE_EXTENSION_PCI(cin1200t, 0x153b, 0x1157), 1300 MAKE_EXTENSION_PCI(cin1200t, 0x153b, 0x1157),
1250 { 1301 {
1251 .vendor = 0, 1302 .vendor = 0,
diff --git a/drivers/media/dvb/ttpci/budget-core.c b/drivers/media/dvb/ttpci/budget-core.c
index cef9d8d8a122..6b97dc1e6b65 100644
--- a/drivers/media/dvb/ttpci/budget-core.c
+++ b/drivers/media/dvb/ttpci/budget-core.c
@@ -109,6 +109,19 @@ static int start_ts_capture(struct budget *budget)
109 saa7146_write(dev, MC2, (MASK_10 | MASK_26)); 109 saa7146_write(dev, MC2, (MASK_10 | MASK_26));
110 saa7146_write(dev, BRS_CTRL, 0x60000000); 110 saa7146_write(dev, BRS_CTRL, 0x60000000);
111 break; 111 break;
112 case BUDGET_CIN1200C_MK3:
113 case BUDGET_KNC1C_MK3:
114 case BUDGET_KNC1CP_MK3:
115 if (budget->video_port == BUDGET_VIDEO_PORTA) {
116 saa7146_write(dev, DD1_INIT, 0x06000200);
117 saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26));
118 saa7146_write(dev, BRS_CTRL, 0x00000000);
119 } else {
120 saa7146_write(dev, DD1_INIT, 0x00000600);
121 saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26));
122 saa7146_write(dev, BRS_CTRL, 0x60000000);
123 }
124 break;
112 default: 125 default:
113 if (budget->video_port == BUDGET_VIDEO_PORTA) { 126 if (budget->video_port == BUDGET_VIDEO_PORTA) {
114 saa7146_write(dev, DD1_INIT, 0x06000200); 127 saa7146_write(dev, DD1_INIT, 0x06000200);
@@ -418,6 +431,9 @@ int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev,
418 case BUDGET_KNC1C: 431 case BUDGET_KNC1C:
419 case BUDGET_KNC1CP: 432 case BUDGET_KNC1CP:
420 case BUDGET_CIN1200C: 433 case BUDGET_CIN1200C:
434 case BUDGET_KNC1C_MK3:
435 case BUDGET_KNC1CP_MK3:
436 case BUDGET_CIN1200C_MK3:
421 budget->buffer_width = TS_WIDTH_DVBC; 437 budget->buffer_width = TS_WIDTH_DVBC;
422 max_bufsize = TS_MAX_BUFSIZE_K_DVBC; 438 max_bufsize = TS_MAX_BUFSIZE_K_DVBC;
423 height_mask = TS_HEIGHT_MASK_DVBC; 439 height_mask = TS_HEIGHT_MASK_DVBC;
diff --git a/drivers/media/dvb/ttpci/budget.h b/drivers/media/dvb/ttpci/budget.h
index e8a5c79178e1..d764ffa728b0 100644
--- a/drivers/media/dvb/ttpci/budget.h
+++ b/drivers/media/dvb/ttpci/budget.h
@@ -99,6 +99,9 @@ static struct saa7146_pci_extension_data x_var = { \
99#define BUDGET_KNC1CP 12 99#define BUDGET_KNC1CP 12
100#define BUDGET_KNC1TP 13 100#define BUDGET_KNC1TP 13
101#define BUDGET_TVSTAR 14 101#define BUDGET_TVSTAR 14
102#define BUDGET_CIN1200C_MK3 15
103#define BUDGET_KNC1C_MK3 16
104#define BUDGET_KNC1CP_MK3 17
102 105
103#define BUDGET_VIDEO_PORTA 0 106#define BUDGET_VIDEO_PORTA 0
104#define BUDGET_VIDEO_PORTB 1 107#define BUDGET_VIDEO_PORTB 1