aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7134/saa7134-dvb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-dvb.c')
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c222
1 files changed, 183 insertions, 39 deletions
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index 6b61d9b2fcb5..fa8339879095 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -50,6 +50,10 @@ static unsigned int antenna_pwr = 0;
50module_param(antenna_pwr, int, 0444); 50module_param(antenna_pwr, int, 0444);
51MODULE_PARM_DESC(antenna_pwr,"enable antenna power (Pinnacle 300i)"); 51MODULE_PARM_DESC(antenna_pwr,"enable antenna power (Pinnacle 300i)");
52 52
53static int use_frontent = 0;
54module_param(use_frontent, int, 0644);
55MODULE_PARM_DESC(use_frontent,"for cards with multiple frontends (0: terrestrial, 1: satellite)");
56
53/* ------------------------------------------------------------------ */ 57/* ------------------------------------------------------------------ */
54static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on) 58static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on)
55{ 59{
@@ -293,7 +297,7 @@ static int philips_tu1216_tuner_60_set_params(struct dvb_frontend *fe, struct dv
293 return philips_tda6651_pll_set(0x60, fe, params); 297 return philips_tda6651_pll_set(0x60, fe, params);
294} 298}
295 299
296static int philips_tu1216_request_firmware(struct dvb_frontend *fe, 300static int philips_tda1004x_request_firmware(struct dvb_frontend *fe,
297 const struct firmware **fw, char *name) 301 const struct firmware **fw, char *name)
298{ 302{
299 struct saa7134_dev *dev = fe->dvb->priv; 303 struct saa7134_dev *dev = fe->dvb->priv;
@@ -308,7 +312,7 @@ static struct tda1004x_config philips_tu1216_60_config = {
308 .xtal_freq = TDA10046_XTAL_4M, 312 .xtal_freq = TDA10046_XTAL_4M,
309 .agc_config = TDA10046_AGC_DEFAULT, 313 .agc_config = TDA10046_AGC_DEFAULT,
310 .if_freq = TDA10046_FREQ_3617, 314 .if_freq = TDA10046_FREQ_3617,
311 .request_firmware = philips_tu1216_request_firmware, 315 .request_firmware = philips_tda1004x_request_firmware,
312}; 316};
313 317
314/* ------------------------------------------------------------------ */ 318/* ------------------------------------------------------------------ */
@@ -331,12 +335,12 @@ static struct tda1004x_config philips_tu1216_61_config = {
331 .xtal_freq = TDA10046_XTAL_4M, 335 .xtal_freq = TDA10046_XTAL_4M,
332 .agc_config = TDA10046_AGC_DEFAULT, 336 .agc_config = TDA10046_AGC_DEFAULT,
333 .if_freq = TDA10046_FREQ_3617, 337 .if_freq = TDA10046_FREQ_3617,
334 .request_firmware = philips_tu1216_request_firmware, 338 .request_firmware = philips_tda1004x_request_firmware,
335}; 339};
336 340
337/* ------------------------------------------------------------------ */ 341/* ------------------------------------------------------------------ */
338 342
339static int philips_europa_tuner_init(struct dvb_frontend *fe) 343static int philips_td1316_tuner_init(struct dvb_frontend *fe)
340{ 344{
341 struct saa7134_dev *dev = fe->dvb->priv; 345 struct saa7134_dev *dev = fe->dvb->priv;
342 static u8 msg[] = { 0x0b, 0xf5, 0x86, 0xab }; 346 static u8 msg[] = { 0x0b, 0xf5, 0x86, 0xab };
@@ -347,18 +351,8 @@ static int philips_europa_tuner_init(struct dvb_frontend *fe)
347 fe->ops.i2c_gate_ctrl(fe, 1); 351 fe->ops.i2c_gate_ctrl(fe, 1);
348 if (i2c_transfer(&dev->i2c_adap, &init_msg, 1) != 1) 352 if (i2c_transfer(&dev->i2c_adap, &init_msg, 1) != 1)
349 return -EIO; 353 return -EIO;
350 msleep(1);
351
352 /* switch the board to dvb mode */
353 init_msg.addr = 0x43;
354 init_msg.len = 0x02;
355 msg[0] = 0x00;
356 msg[1] = 0x40;
357 if (fe->ops.i2c_gate_ctrl) 354 if (fe->ops.i2c_gate_ctrl)
358 fe->ops.i2c_gate_ctrl(fe, 1); 355 fe->ops.i2c_gate_ctrl(fe, 0);
359 if (i2c_transfer(&dev->i2c_adap, &init_msg, 1) != 1)
360 return -EIO;
361
362 return 0; 356 return 0;
363} 357}
364 358
@@ -367,6 +361,22 @@ static int philips_td1316_tuner_set_params(struct dvb_frontend *fe, struct dvb_f
367 return philips_tda6651_pll_set(0x61, fe, params); 361 return philips_tda6651_pll_set(0x61, fe, params);
368} 362}
369 363
364static int philips_europa_tuner_init(struct dvb_frontend *fe)
365{
366 struct saa7134_dev *dev = fe->dvb->priv;
367 static u8 msg[] = { 0x00, 0x40};
368 struct i2c_msg init_msg = {.addr = 0x43,.flags = 0,.buf = msg,.len = sizeof(msg) };
369
370
371 if (philips_td1316_tuner_init(fe))
372 return -EIO;
373 msleep(1);
374 if (i2c_transfer(&dev->i2c_adap, &init_msg, 1) != 1)
375 return -EIO;
376
377 return 0;
378}
379
370static int philips_europa_tuner_sleep(struct dvb_frontend *fe) 380static int philips_europa_tuner_sleep(struct dvb_frontend *fe)
371{ 381{
372 struct saa7134_dev *dev = fe->dvb->priv; 382 struct saa7134_dev *dev = fe->dvb->priv;
@@ -671,7 +681,7 @@ static struct tda1004x_config tda827x_lifeview_config = {
671 .invert = 1, 681 .invert = 1,
672 .invert_oclk = 0, 682 .invert_oclk = 0,
673 .xtal_freq = TDA10046_XTAL_16M, 683 .xtal_freq = TDA10046_XTAL_16M,
674 .agc_config = TDA10046_AGC_TDA827X, 684 .agc_config = TDA10046_AGC_TDA827X_GP11,
675 .if_freq = TDA10046_FREQ_045, 685 .if_freq = TDA10046_FREQ_045,
676 .request_firmware = NULL, 686 .request_firmware = NULL,
677}; 687};
@@ -812,32 +822,40 @@ static int philips_tda827xa_tuner_sleep(u8 addr, struct dvb_frontend *fe)
812 if (fe->ops.i2c_gate_ctrl) 822 if (fe->ops.i2c_gate_ctrl)
813 fe->ops.i2c_gate_ctrl(fe, 1); 823 fe->ops.i2c_gate_ctrl(fe, 1);
814 i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); 824 i2c_transfer(&dev->i2c_adap, &tuner_msg, 1);
825 if (fe->ops.i2c_gate_ctrl)
826 fe->ops.i2c_gate_ctrl(fe, 0);
815 return 0; 827 return 0;
816} 828}
817 829
818/* ------------------------------------------------------------------ */ 830/* ------------------------------------------------------------------ */
819 831
820static int philips_tiger_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) 832static int tda8290_i2c_gate_ctrl(struct dvb_frontend* fe, int enable)
821{ 833{
822 int ret;
823 struct saa7134_dev *dev = fe->dvb->priv; 834 struct saa7134_dev *dev = fe->dvb->priv;
824 static u8 tda8290_close[] = { 0x21, 0xc0}; 835 static u8 tda8290_close[] = { 0x21, 0xc0};
825 static u8 tda8290_open[] = { 0x21, 0x80}; 836 static u8 tda8290_open[] = { 0x21, 0x80};
826 struct i2c_msg tda8290_msg = {.addr = 0x4b,.flags = 0, .len = 2}; 837 struct i2c_msg tda8290_msg = {.addr = 0x4b,.flags = 0, .len = 2};
827 838 if (enable) {
828 /* close tda8290 i2c bridge */ 839 tda8290_msg.buf = tda8290_close;
829 tda8290_msg.buf = tda8290_close; 840 } else {
830 ret = i2c_transfer(&dev->i2c_adap, &tda8290_msg, 1); 841 tda8290_msg.buf = tda8290_open;
831 if (ret != 1) 842 }
843 if (i2c_transfer(&dev->i2c_adap, &tda8290_msg, 1) != 1)
832 return -EIO; 844 return -EIO;
833 msleep(20); 845 msleep(20);
846 return 0;
847}
848
849/* ------------------------------------------------------------------ */
850
851static int philips_tiger_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
852{
853 int ret;
854
834 ret = philips_tda827xa_pll_set(0x61, fe, params); 855 ret = philips_tda827xa_pll_set(0x61, fe, params);
835 if (ret != 0) 856 if (ret != 0)
836 return ret; 857 return ret;
837 /* open tda8290 i2c bridge */ 858 return 0;
838 tda8290_msg.buf = tda8290_open;
839 i2c_transfer(&dev->i2c_adap, &tda8290_msg, 1);
840 return ret;
841} 859}
842 860
843static int philips_tiger_tuner_init(struct dvb_frontend *fe) 861static int philips_tiger_tuner_init(struct dvb_frontend *fe)
@@ -867,13 +885,80 @@ static struct tda1004x_config philips_tiger_config = {
867 .invert = 1, 885 .invert = 1,
868 .invert_oclk = 0, 886 .invert_oclk = 0,
869 .xtal_freq = TDA10046_XTAL_16M, 887 .xtal_freq = TDA10046_XTAL_16M,
870 .agc_config = TDA10046_AGC_TDA827X, 888 .agc_config = TDA10046_AGC_TDA827X_GP11,
889 .if_freq = TDA10046_FREQ_045,
890 .request_firmware = NULL,
891};
892/* ------------------------------------------------------------------ */
893
894static int cinergy_ht_tuner_init(struct dvb_frontend *fe)
895{
896 struct saa7134_dev *dev = fe->dvb->priv;
897 static u8 data[] = { 0x3c, 0x33, 0x62};
898 struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)};
899
900 if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1)
901 return -EIO;
902 return 0;
903}
904
905static int cinergy_ht_tuner_sleep(struct dvb_frontend *fe)
906{
907 struct saa7134_dev *dev = fe->dvb->priv;
908 static u8 data[] = { 0x3c, 0x33, 0x60};
909 struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)};
910
911 i2c_transfer(&dev->i2c_adap, &msg, 1);
912 philips_tda827xa_tuner_sleep( 0x61, fe);
913 return 0;
914}
915
916static struct tda1004x_config cinergy_ht_config = {
917 .demod_address = 0x08,
918 .invert = 1,
919 .invert_oclk = 0,
920 .xtal_freq = TDA10046_XTAL_16M,
921 .agc_config = TDA10046_AGC_TDA827X_GP01,
871 .if_freq = TDA10046_FREQ_045, 922 .if_freq = TDA10046_FREQ_045,
872 .request_firmware = NULL, 923 .request_firmware = NULL,
873}; 924};
874 925
875/* ------------------------------------------------------------------ */ 926/* ------------------------------------------------------------------ */
876 927
928static struct tda1004x_config pinnacle_pctv_310i_config = {
929 .demod_address = 0x08,
930 .invert = 1,
931 .invert_oclk = 0,
932 .xtal_freq = TDA10046_XTAL_16M,
933 .agc_config = TDA10046_AGC_TDA827X_GP11,
934 .if_freq = TDA10046_FREQ_045,
935 .request_firmware = philips_tda1004x_request_firmware,
936};
937
938/* ------------------------------------------------------------------ */
939
940static struct tda1004x_config hauppauge_hvr_1110_config = {
941 .demod_address = 0x08,
942 .invert = 1,
943 .invert_oclk = 0,
944 .xtal_freq = TDA10046_XTAL_16M,
945 .agc_config = TDA10046_AGC_TDA827X_GP11,
946 .if_freq = TDA10046_FREQ_045,
947 .request_firmware = philips_tda1004x_request_firmware,
948};
949
950/* ------------------------------------------------------------------ */
951
952static struct tda1004x_config asus_p7131_dual_config = {
953 .demod_address = 0x08,
954 .invert = 1,
955 .invert_oclk = 0,
956 .xtal_freq = TDA10046_XTAL_16M,
957 .agc_config = TDA10046_AGC_TDA827X_GP11,
958 .if_freq = TDA10046_FREQ_045,
959 .request_firmware = philips_tda1004x_request_firmware,
960};
961
877static int asus_p7131_dual_tuner_init(struct dvb_frontend *fe) 962static int asus_p7131_dual_tuner_init(struct dvb_frontend *fe)
878{ 963{
879 struct saa7134_dev *dev = fe->dvb->priv; 964 struct saa7134_dev *dev = fe->dvb->priv;
@@ -921,7 +1006,7 @@ static struct tda1004x_config lifeview_trio_config = {
921 .invert = 1, 1006 .invert = 1,
922 .invert_oclk = 0, 1007 .invert_oclk = 0,
923 .xtal_freq = TDA10046_XTAL_16M, 1008 .xtal_freq = TDA10046_XTAL_16M,
924 .agc_config = TDA10046_AGC_TDA827X_GPL, 1009 .agc_config = TDA10046_AGC_TDA827X_GP00,
925 .if_freq = TDA10046_FREQ_045, 1010 .if_freq = TDA10046_FREQ_045,
926 .request_firmware = NULL, 1011 .request_firmware = NULL,
927}; 1012};
@@ -958,7 +1043,7 @@ static struct tda1004x_config ads_tech_duo_config = {
958 .invert = 1, 1043 .invert = 1,
959 .invert_oclk = 0, 1044 .invert_oclk = 0,
960 .xtal_freq = TDA10046_XTAL_16M, 1045 .xtal_freq = TDA10046_XTAL_16M,
961 .agc_config = TDA10046_AGC_TDA827X_GPL, 1046 .agc_config = TDA10046_AGC_TDA827X_GP00,
962 .if_freq = TDA10046_FREQ_045, 1047 .if_freq = TDA10046_FREQ_045,
963 .request_firmware = NULL, 1048 .request_firmware = NULL,
964}; 1049};
@@ -983,7 +1068,7 @@ static struct tda1004x_config tevion_dvbt220rf_config = {
983 .invert = 1, 1068 .invert = 1,
984 .invert_oclk = 0, 1069 .invert_oclk = 0,
985 .xtal_freq = TDA10046_XTAL_16M, 1070 .xtal_freq = TDA10046_XTAL_16M,
986 .agc_config = TDA10046_AGC_TDA827X, 1071 .agc_config = TDA10046_AGC_TDA827X_GP11,
987 .if_freq = TDA10046_FREQ_045, 1072 .if_freq = TDA10046_FREQ_045,
988 .request_firmware = NULL, 1073 .request_firmware = NULL,
989}; 1074};
@@ -1028,7 +1113,7 @@ static struct tda1004x_config md8800_dvbt_config = {
1028 .invert = 1, 1113 .invert = 1,
1029 .invert_oclk = 0, 1114 .invert_oclk = 0,
1030 .xtal_freq = TDA10046_XTAL_16M, 1115 .xtal_freq = TDA10046_XTAL_16M,
1031 .agc_config = TDA10046_AGC_TDA827X, 1116 .agc_config = TDA10046_AGC_TDA827X_GP11,
1032 .if_freq = TDA10046_FREQ_045, 1117 .if_freq = TDA10046_FREQ_045,
1033 .request_firmware = NULL, 1118 .request_firmware = NULL,
1034}; 1119};
@@ -1168,6 +1253,29 @@ static int dvb_init(struct saa7134_dev *dev)
1168 &philips_tiger_config, 1253 &philips_tiger_config,
1169 &dev->i2c_adap); 1254 &dev->i2c_adap);
1170 if (dev->dvb.frontend) { 1255 if (dev->dvb.frontend) {
1256 dev->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl;
1257 dev->dvb.frontend->ops.tuner_ops.init = philips_tiger_tuner_init;
1258 dev->dvb.frontend->ops.tuner_ops.sleep = philips_tiger_tuner_sleep;
1259 dev->dvb.frontend->ops.tuner_ops.set_params = philips_tiger_tuner_set_params;
1260 }
1261 break;
1262 case SAA7134_BOARD_PINNACLE_PCTV_310i:
1263 dev->dvb.frontend = dvb_attach(tda10046_attach,
1264 &pinnacle_pctv_310i_config,
1265 &dev->i2c_adap);
1266 if (dev->dvb.frontend) {
1267 dev->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl;
1268 dev->dvb.frontend->ops.tuner_ops.init = philips_tiger_tuner_init;
1269 dev->dvb.frontend->ops.tuner_ops.sleep = philips_tiger_tuner_sleep;
1270 dev->dvb.frontend->ops.tuner_ops.set_params = philips_tiger_tuner_set_params;
1271 }
1272 break;
1273 case SAA7134_BOARD_HAUPPAUGE_HVR1110:
1274 dev->dvb.frontend = dvb_attach(tda10046_attach,
1275 &hauppauge_hvr_1110_config,
1276 &dev->i2c_adap);
1277 if (dev->dvb.frontend) {
1278 dev->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl;
1171 dev->dvb.frontend->ops.tuner_ops.init = philips_tiger_tuner_init; 1279 dev->dvb.frontend->ops.tuner_ops.init = philips_tiger_tuner_init;
1172 dev->dvb.frontend->ops.tuner_ops.sleep = philips_tiger_tuner_sleep; 1280 dev->dvb.frontend->ops.tuner_ops.sleep = philips_tiger_tuner_sleep;
1173 dev->dvb.frontend->ops.tuner_ops.set_params = philips_tiger_tuner_set_params; 1281 dev->dvb.frontend->ops.tuner_ops.set_params = philips_tiger_tuner_set_params;
@@ -1175,9 +1283,10 @@ static int dvb_init(struct saa7134_dev *dev)
1175 break; 1283 break;
1176 case SAA7134_BOARD_ASUSTeK_P7131_DUAL: 1284 case SAA7134_BOARD_ASUSTeK_P7131_DUAL:
1177 dev->dvb.frontend = dvb_attach(tda10046_attach, 1285 dev->dvb.frontend = dvb_attach(tda10046_attach,
1178 &philips_tiger_config, 1286 &asus_p7131_dual_config,
1179 &dev->i2c_adap); 1287 &dev->i2c_adap);
1180 if (dev->dvb.frontend) { 1288 if (dev->dvb.frontend) {
1289 dev->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl;
1181 dev->dvb.frontend->ops.tuner_ops.init = asus_p7131_dual_tuner_init; 1290 dev->dvb.frontend->ops.tuner_ops.init = asus_p7131_dual_tuner_init;
1182 dev->dvb.frontend->ops.tuner_ops.sleep = asus_p7131_dual_tuner_sleep; 1291 dev->dvb.frontend->ops.tuner_ops.sleep = asus_p7131_dual_tuner_sleep;
1183 dev->dvb.frontend->ops.tuner_ops.set_params = philips_tiger_tuner_set_params; 1292 dev->dvb.frontend->ops.tuner_ops.set_params = philips_tiger_tuner_set_params;
@@ -1194,12 +1303,27 @@ static int dvb_init(struct saa7134_dev *dev)
1194 } 1303 }
1195 break; 1304 break;
1196 case SAA7134_BOARD_FLYDVB_TRIO: 1305 case SAA7134_BOARD_FLYDVB_TRIO:
1197 dev->dvb.frontend = dvb_attach(tda10046_attach, 1306 if(! use_frontent) { //terrestrial
1198 &lifeview_trio_config, 1307 dev->dvb.frontend = dvb_attach(tda10046_attach,
1199 &dev->i2c_adap); 1308 &lifeview_trio_config,
1200 if (dev->dvb.frontend) { 1309 &dev->i2c_adap);
1201 dev->dvb.frontend->ops.tuner_ops.sleep = lifeview_trio_tuner_sleep; 1310 if (dev->dvb.frontend) {
1202 dev->dvb.frontend->ops.tuner_ops.set_params = lifeview_trio_tuner_set_params; 1311 dev->dvb.frontend->ops.tuner_ops.sleep = lifeview_trio_tuner_sleep;
1312 dev->dvb.frontend->ops.tuner_ops.set_params =
1313 lifeview_trio_tuner_set_params;
1314 }
1315 } else { //satellite
1316 dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap);
1317 if (dev->dvb.frontend) {
1318 if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x63,
1319 &dev->i2c_adap, 0) == NULL) {
1320 printk("%s: Lifeview Trio, No tda826x found!\n", __FUNCTION__);
1321 }
1322 if (dvb_attach(isl6421_attach, dev->dvb.frontend, &dev->i2c_adap,
1323 0x08, 0, 0) == NULL) {
1324 printk("%s: Lifeview Trio, No ISL6421 found!\n", __FUNCTION__);
1325 }
1326 }
1203 } 1327 }
1204 break; 1328 break;
1205 case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331: 1329 case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331:
@@ -1281,7 +1405,27 @@ static int dvb_init(struct saa7134_dev *dev)
1281 dev->dvb.frontend->ops.tuner_ops.set_params = philips_fmd1216_tuner_set_params; 1405 dev->dvb.frontend->ops.tuner_ops.set_params = philips_fmd1216_tuner_set_params;
1282 } 1406 }
1283 break; 1407 break;
1408 case SAA7134_BOARD_VIDEOMATE_DVBT_200A:
1409 dev->dvb.frontend = dvb_attach(tda10046_attach,
1410 &philips_europa_config,
1411 &dev->i2c_adap);
1412 if (dev->dvb.frontend) {
1413 dev->dvb.frontend->ops.tuner_ops.init = philips_td1316_tuner_init;
1414 dev->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params;
1415 }
1416 break;
1417 case SAA7134_BOARD_CINERGY_HT_PCMCIA:
1418 dev->dvb.frontend = dvb_attach(tda10046_attach,
1419 &cinergy_ht_config,
1420 &dev->i2c_adap);
1421 if (dev->dvb.frontend) {
1422 dev->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl;
1423 dev->dvb.frontend->ops.tuner_ops.init = cinergy_ht_tuner_init;
1424 dev->dvb.frontend->ops.tuner_ops.sleep = cinergy_ht_tuner_sleep;
1425 dev->dvb.frontend->ops.tuner_ops.set_params = philips_tiger_tuner_set_params;
1284 1426
1427 }
1428 break;
1285 default: 1429 default:
1286 printk("%s: Huh? unknown DVB card?\n",dev->name); 1430 printk("%s: Huh? unknown DVB card?\n",dev->name);
1287 break; 1431 break;