diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-10-28 11:26:12 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-28 11:26:12 -0400 |
commit | 7a9787e1eba95a166265e6a260cf30af04ef0a99 (patch) | |
tree | e730a4565e0318140d2fbd2f0415d18a339d7336 /drivers/media/video/saa7134/saa7134-dvb.c | |
parent | 41b9eb264c8407655db57b60b4457fe1b2ec9977 (diff) | |
parent | 0173a3265b228da319ceb9c1ec6a5682fd1b2d92 (diff) |
Merge commit 'v2.6.28-rc2' into x86/pci-ioapic-boot-irq-quirks
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-dvb.c')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-dvb.c | 266 |
1 files changed, 174 insertions, 92 deletions
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index 341b101b0357..8c46115d4c79 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c | |||
@@ -535,11 +535,16 @@ static int configure_tda827x_fe(struct saa7134_dev *dev, | |||
535 | struct tda1004x_config *cdec_conf, | 535 | struct tda1004x_config *cdec_conf, |
536 | struct tda827x_config *tuner_conf) | 536 | struct tda827x_config *tuner_conf) |
537 | { | 537 | { |
538 | dev->dvb.frontend = dvb_attach(tda10046_attach, cdec_conf, &dev->i2c_adap); | 538 | struct videobuf_dvb_frontend *fe0; |
539 | if (dev->dvb.frontend) { | 539 | |
540 | /* Get the first frontend */ | ||
541 | fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1); | ||
542 | |||
543 | fe0->dvb.frontend = dvb_attach(tda10046_attach, cdec_conf, &dev->i2c_adap); | ||
544 | if (fe0->dvb.frontend) { | ||
540 | if (cdec_conf->i2c_gate) | 545 | if (cdec_conf->i2c_gate) |
541 | dev->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl; | 546 | fe0->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl; |
542 | if (dvb_attach(tda827x_attach, dev->dvb.frontend, | 547 | if (dvb_attach(tda827x_attach, fe0->dvb.frontend, |
543 | cdec_conf->tuner_address, | 548 | cdec_conf->tuner_address, |
544 | &dev->i2c_adap, tuner_conf)) | 549 | &dev->i2c_adap, tuner_conf)) |
545 | return 0; | 550 | return 0; |
@@ -553,7 +558,6 @@ static int configure_tda827x_fe(struct saa7134_dev *dev, | |||
553 | /* ------------------------------------------------------------------ */ | 558 | /* ------------------------------------------------------------------ */ |
554 | 559 | ||
555 | static struct tda827x_config tda827x_cfg_0 = { | 560 | static struct tda827x_config tda827x_cfg_0 = { |
556 | .tuner_callback = saa7134_tuner_callback, | ||
557 | .init = philips_tda827x_tuner_init, | 561 | .init = philips_tda827x_tuner_init, |
558 | .sleep = philips_tda827x_tuner_sleep, | 562 | .sleep = philips_tda827x_tuner_sleep, |
559 | .config = 0, | 563 | .config = 0, |
@@ -561,7 +565,6 @@ static struct tda827x_config tda827x_cfg_0 = { | |||
561 | }; | 565 | }; |
562 | 566 | ||
563 | static struct tda827x_config tda827x_cfg_1 = { | 567 | static struct tda827x_config tda827x_cfg_1 = { |
564 | .tuner_callback = saa7134_tuner_callback, | ||
565 | .init = philips_tda827x_tuner_init, | 568 | .init = philips_tda827x_tuner_init, |
566 | .sleep = philips_tda827x_tuner_sleep, | 569 | .sleep = philips_tda827x_tuner_sleep, |
567 | .config = 1, | 570 | .config = 1, |
@@ -569,7 +572,6 @@ static struct tda827x_config tda827x_cfg_1 = { | |||
569 | }; | 572 | }; |
570 | 573 | ||
571 | static struct tda827x_config tda827x_cfg_2 = { | 574 | static struct tda827x_config tda827x_cfg_2 = { |
572 | .tuner_callback = saa7134_tuner_callback, | ||
573 | .init = philips_tda827x_tuner_init, | 575 | .init = philips_tda827x_tuner_init, |
574 | .sleep = philips_tda827x_tuner_sleep, | 576 | .sleep = philips_tda827x_tuner_sleep, |
575 | .config = 2, | 577 | .config = 2, |
@@ -577,7 +579,6 @@ static struct tda827x_config tda827x_cfg_2 = { | |||
577 | }; | 579 | }; |
578 | 580 | ||
579 | static struct tda827x_config tda827x_cfg_2_sw42 = { | 581 | static struct tda827x_config tda827x_cfg_2_sw42 = { |
580 | .tuner_callback = saa7134_tuner_callback, | ||
581 | .init = philips_tda827x_tuner_init, | 582 | .init = philips_tda827x_tuner_init, |
582 | .sleep = philips_tda827x_tuner_sleep, | 583 | .sleep = philips_tda827x_tuner_sleep, |
583 | .config = 2, | 584 | .config = 2, |
@@ -799,6 +800,20 @@ static struct tda1004x_config twinhan_dtv_dvb_3056_config = { | |||
799 | .request_firmware = philips_tda1004x_request_firmware | 800 | .request_firmware = philips_tda1004x_request_firmware |
800 | }; | 801 | }; |
801 | 802 | ||
803 | static struct tda1004x_config asus_tiger_3in1_config = { | ||
804 | .demod_address = 0x0b, | ||
805 | .invert = 1, | ||
806 | .invert_oclk = 0, | ||
807 | .xtal_freq = TDA10046_XTAL_16M, | ||
808 | .agc_config = TDA10046_AGC_TDA827X, | ||
809 | .gpio_config = TDA10046_GP11_I, | ||
810 | .if_freq = TDA10046_FREQ_045, | ||
811 | .i2c_gate = 0x4b, | ||
812 | .tuner_address = 0x61, | ||
813 | .antenna_switch = 1, | ||
814 | .request_firmware = philips_tda1004x_request_firmware | ||
815 | }; | ||
816 | |||
802 | /* ------------------------------------------------------------------ | 817 | /* ------------------------------------------------------------------ |
803 | * special case: this card uses saa713x GPIO22 for the mode switch | 818 | * special case: this card uses saa713x GPIO22 for the mode switch |
804 | */ | 819 | */ |
@@ -822,7 +837,6 @@ static int ads_duo_tuner_sleep(struct dvb_frontend *fe) | |||
822 | } | 837 | } |
823 | 838 | ||
824 | static struct tda827x_config ads_duo_cfg = { | 839 | static struct tda827x_config ads_duo_cfg = { |
825 | .tuner_callback = saa7134_tuner_callback, | ||
826 | .init = ads_duo_tuner_init, | 840 | .init = ads_duo_tuner_init, |
827 | .sleep = ads_duo_tuner_sleep, | 841 | .sleep = ads_duo_tuner_sleep, |
828 | .config = 0 | 842 | .config = 0 |
@@ -935,12 +949,30 @@ static int dvb_init(struct saa7134_dev *dev) | |||
935 | { | 949 | { |
936 | int ret; | 950 | int ret; |
937 | int attach_xc3028 = 0; | 951 | int attach_xc3028 = 0; |
952 | struct videobuf_dvb_frontend *fe0; | ||
953 | |||
954 | /* FIXME: add support for multi-frontend */ | ||
955 | mutex_init(&dev->frontends.lock); | ||
956 | INIT_LIST_HEAD(&dev->frontends.felist); | ||
957 | dev->frontends.active_fe_id = 0; | ||
958 | |||
959 | printk(KERN_INFO "%s() allocating 1 frontend\n", __func__); | ||
960 | |||
961 | if (videobuf_dvb_alloc_frontend(&dev->frontends, 1) == NULL) { | ||
962 | printk(KERN_ERR "%s() failed to alloc\n", __func__); | ||
963 | return -ENOMEM; | ||
964 | } | ||
965 | |||
966 | /* Get the first frontend */ | ||
967 | fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1); | ||
968 | if (!fe0) | ||
969 | return -EINVAL; | ||
938 | 970 | ||
939 | /* init struct videobuf_dvb */ | 971 | /* init struct videobuf_dvb */ |
940 | dev->ts.nr_bufs = 32; | 972 | dev->ts.nr_bufs = 32; |
941 | dev->ts.nr_packets = 32*4; | 973 | dev->ts.nr_packets = 32*4; |
942 | dev->dvb.name = dev->name; | 974 | fe0->dvb.name = dev->name; |
943 | videobuf_queue_sg_init(&dev->dvb.dvbq, &saa7134_ts_qops, | 975 | videobuf_queue_sg_init(&fe0->dvb.dvbq, &saa7134_ts_qops, |
944 | &dev->pci->dev, &dev->slock, | 976 | &dev->pci->dev, &dev->slock, |
945 | V4L2_BUF_TYPE_VIDEO_CAPTURE, | 977 | V4L2_BUF_TYPE_VIDEO_CAPTURE, |
946 | V4L2_FIELD_ALTERNATE, | 978 | V4L2_FIELD_ALTERNATE, |
@@ -950,47 +982,47 @@ static int dvb_init(struct saa7134_dev *dev) | |||
950 | switch (dev->board) { | 982 | switch (dev->board) { |
951 | case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: | 983 | case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: |
952 | dprintk("pinnacle 300i dvb setup\n"); | 984 | dprintk("pinnacle 300i dvb setup\n"); |
953 | dev->dvb.frontend = dvb_attach(mt352_attach, &pinnacle_300i, | 985 | fe0->dvb.frontend = dvb_attach(mt352_attach, &pinnacle_300i, |
954 | &dev->i2c_adap); | 986 | &dev->i2c_adap); |
955 | if (dev->dvb.frontend) { | 987 | if (fe0->dvb.frontend) { |
956 | dev->dvb.frontend->ops.tuner_ops.set_params = mt352_pinnacle_tuner_set_params; | 988 | fe0->dvb.frontend->ops.tuner_ops.set_params = mt352_pinnacle_tuner_set_params; |
957 | } | 989 | } |
958 | break; | 990 | break; |
959 | case SAA7134_BOARD_AVERMEDIA_777: | 991 | case SAA7134_BOARD_AVERMEDIA_777: |
960 | case SAA7134_BOARD_AVERMEDIA_A16AR: | 992 | case SAA7134_BOARD_AVERMEDIA_A16AR: |
961 | dprintk("avertv 777 dvb setup\n"); | 993 | dprintk("avertv 777 dvb setup\n"); |
962 | dev->dvb.frontend = dvb_attach(mt352_attach, &avermedia_777, | 994 | fe0->dvb.frontend = dvb_attach(mt352_attach, &avermedia_777, |
963 | &dev->i2c_adap); | 995 | &dev->i2c_adap); |
964 | if (dev->dvb.frontend) { | 996 | if (fe0->dvb.frontend) { |
965 | dvb_attach(simple_tuner_attach, dev->dvb.frontend, | 997 | dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
966 | &dev->i2c_adap, 0x61, | 998 | &dev->i2c_adap, 0x61, |
967 | TUNER_PHILIPS_TD1316); | 999 | TUNER_PHILIPS_TD1316); |
968 | } | 1000 | } |
969 | break; | 1001 | break; |
970 | case SAA7134_BOARD_AVERMEDIA_A16D: | 1002 | case SAA7134_BOARD_AVERMEDIA_A16D: |
971 | dprintk("AverMedia A16D dvb setup\n"); | 1003 | dprintk("AverMedia A16D dvb setup\n"); |
972 | dev->dvb.frontend = dvb_attach(mt352_attach, | 1004 | fe0->dvb.frontend = dvb_attach(mt352_attach, |
973 | &avermedia_xc3028_mt352_dev, | 1005 | &avermedia_xc3028_mt352_dev, |
974 | &dev->i2c_adap); | 1006 | &dev->i2c_adap); |
975 | attach_xc3028 = 1; | 1007 | attach_xc3028 = 1; |
976 | break; | 1008 | break; |
977 | case SAA7134_BOARD_MD7134: | 1009 | case SAA7134_BOARD_MD7134: |
978 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 1010 | fe0->dvb.frontend = dvb_attach(tda10046_attach, |
979 | &medion_cardbus, | 1011 | &medion_cardbus, |
980 | &dev->i2c_adap); | 1012 | &dev->i2c_adap); |
981 | if (dev->dvb.frontend) { | 1013 | if (fe0->dvb.frontend) { |
982 | dvb_attach(simple_tuner_attach, dev->dvb.frontend, | 1014 | dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
983 | &dev->i2c_adap, medion_cardbus.tuner_address, | 1015 | &dev->i2c_adap, medion_cardbus.tuner_address, |
984 | TUNER_PHILIPS_FMD1216ME_MK3); | 1016 | TUNER_PHILIPS_FMD1216ME_MK3); |
985 | } | 1017 | } |
986 | break; | 1018 | break; |
987 | case SAA7134_BOARD_PHILIPS_TOUGH: | 1019 | case SAA7134_BOARD_PHILIPS_TOUGH: |
988 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 1020 | fe0->dvb.frontend = dvb_attach(tda10046_attach, |
989 | &philips_tu1216_60_config, | 1021 | &philips_tu1216_60_config, |
990 | &dev->i2c_adap); | 1022 | &dev->i2c_adap); |
991 | if (dev->dvb.frontend) { | 1023 | if (fe0->dvb.frontend) { |
992 | dev->dvb.frontend->ops.tuner_ops.init = philips_tu1216_init; | 1024 | fe0->dvb.frontend->ops.tuner_ops.init = philips_tu1216_init; |
993 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tda6651_pll_set; | 1025 | fe0->dvb.frontend->ops.tuner_ops.set_params = philips_tda6651_pll_set; |
994 | } | 1026 | } |
995 | break; | 1027 | break; |
996 | case SAA7134_BOARD_FLYDVBTDUO: | 1028 | case SAA7134_BOARD_FLYDVBTDUO: |
@@ -1001,24 +1033,24 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1001 | break; | 1033 | break; |
1002 | case SAA7134_BOARD_PHILIPS_EUROPA: | 1034 | case SAA7134_BOARD_PHILIPS_EUROPA: |
1003 | case SAA7134_BOARD_VIDEOMATE_DVBT_300: | 1035 | case SAA7134_BOARD_VIDEOMATE_DVBT_300: |
1004 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 1036 | fe0->dvb.frontend = dvb_attach(tda10046_attach, |
1005 | &philips_europa_config, | 1037 | &philips_europa_config, |
1006 | &dev->i2c_adap); | 1038 | &dev->i2c_adap); |
1007 | if (dev->dvb.frontend) { | 1039 | if (fe0->dvb.frontend) { |
1008 | dev->original_demod_sleep = dev->dvb.frontend->ops.sleep; | 1040 | dev->original_demod_sleep = fe0->dvb.frontend->ops.sleep; |
1009 | dev->dvb.frontend->ops.sleep = philips_europa_demod_sleep; | 1041 | fe0->dvb.frontend->ops.sleep = philips_europa_demod_sleep; |
1010 | dev->dvb.frontend->ops.tuner_ops.init = philips_europa_tuner_init; | 1042 | fe0->dvb.frontend->ops.tuner_ops.init = philips_europa_tuner_init; |
1011 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_europa_tuner_sleep; | 1043 | fe0->dvb.frontend->ops.tuner_ops.sleep = philips_europa_tuner_sleep; |
1012 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params; | 1044 | fe0->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params; |
1013 | } | 1045 | } |
1014 | break; | 1046 | break; |
1015 | case SAA7134_BOARD_VIDEOMATE_DVBT_200: | 1047 | case SAA7134_BOARD_VIDEOMATE_DVBT_200: |
1016 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 1048 | fe0->dvb.frontend = dvb_attach(tda10046_attach, |
1017 | &philips_tu1216_61_config, | 1049 | &philips_tu1216_61_config, |
1018 | &dev->i2c_adap); | 1050 | &dev->i2c_adap); |
1019 | if (dev->dvb.frontend) { | 1051 | if (fe0->dvb.frontend) { |
1020 | dev->dvb.frontend->ops.tuner_ops.init = philips_tu1216_init; | 1052 | fe0->dvb.frontend->ops.tuner_ops.init = philips_tu1216_init; |
1021 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tda6651_pll_set; | 1053 | fe0->dvb.frontend->ops.tuner_ops.set_params = philips_tda6651_pll_set; |
1022 | } | 1054 | } |
1023 | break; | 1055 | break; |
1024 | case SAA7134_BOARD_KWORLD_DVBT_210: | 1056 | case SAA7134_BOARD_KWORLD_DVBT_210: |
@@ -1057,14 +1089,14 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1057 | &tda827x_cfg_0) < 0) | 1089 | &tda827x_cfg_0) < 0) |
1058 | goto dettach_frontend; | 1090 | goto dettach_frontend; |
1059 | } else { /* satellite */ | 1091 | } else { /* satellite */ |
1060 | dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap); | 1092 | fe0->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap); |
1061 | if (dev->dvb.frontend) { | 1093 | if (fe0->dvb.frontend) { |
1062 | if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x63, | 1094 | if (dvb_attach(tda826x_attach, fe0->dvb.frontend, 0x63, |
1063 | &dev->i2c_adap, 0) == NULL) { | 1095 | &dev->i2c_adap, 0) == NULL) { |
1064 | wprintk("%s: Lifeview Trio, No tda826x found!\n", __func__); | 1096 | wprintk("%s: Lifeview Trio, No tda826x found!\n", __func__); |
1065 | goto dettach_frontend; | 1097 | goto dettach_frontend; |
1066 | } | 1098 | } |
1067 | if (dvb_attach(isl6421_attach, dev->dvb.frontend, &dev->i2c_adap, | 1099 | if (dvb_attach(isl6421_attach, fe0->dvb.frontend, &dev->i2c_adap, |
1068 | 0x08, 0, 0) == NULL) { | 1100 | 0x08, 0, 0) == NULL) { |
1069 | wprintk("%s: Lifeview Trio, No ISL6421 found!\n", __func__); | 1101 | wprintk("%s: Lifeview Trio, No ISL6421 found!\n", __func__); |
1070 | goto dettach_frontend; | 1102 | goto dettach_frontend; |
@@ -1074,11 +1106,11 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1074 | break; | 1106 | break; |
1075 | case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331: | 1107 | case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331: |
1076 | case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS: | 1108 | case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS: |
1077 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 1109 | fe0->dvb.frontend = dvb_attach(tda10046_attach, |
1078 | &ads_tech_duo_config, | 1110 | &ads_tech_duo_config, |
1079 | &dev->i2c_adap); | 1111 | &dev->i2c_adap); |
1080 | if (dev->dvb.frontend) { | 1112 | if (fe0->dvb.frontend) { |
1081 | if (dvb_attach(tda827x_attach,dev->dvb.frontend, | 1113 | if (dvb_attach(tda827x_attach,fe0->dvb.frontend, |
1082 | ads_tech_duo_config.tuner_address, &dev->i2c_adap, | 1114 | ads_tech_duo_config.tuner_address, &dev->i2c_adap, |
1083 | &ads_duo_cfg) == NULL) { | 1115 | &ads_duo_cfg) == NULL) { |
1084 | wprintk("no tda827x tuner found at addr: %02x\n", | 1116 | wprintk("no tda827x tuner found at addr: %02x\n", |
@@ -1099,15 +1131,15 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1099 | &tda827x_cfg_0) < 0) | 1131 | &tda827x_cfg_0) < 0) |
1100 | goto dettach_frontend; | 1132 | goto dettach_frontend; |
1101 | } else { /* satellite */ | 1133 | } else { /* satellite */ |
1102 | dev->dvb.frontend = dvb_attach(tda10086_attach, | 1134 | fe0->dvb.frontend = dvb_attach(tda10086_attach, |
1103 | &flydvbs, &dev->i2c_adap); | 1135 | &flydvbs, &dev->i2c_adap); |
1104 | if (dev->dvb.frontend) { | 1136 | if (fe0->dvb.frontend) { |
1105 | struct dvb_frontend *fe = dev->dvb.frontend; | 1137 | struct dvb_frontend *fe = fe0->dvb.frontend; |
1106 | u8 dev_id = dev->eedata[2]; | 1138 | u8 dev_id = dev->eedata[2]; |
1107 | u8 data = 0xc4; | 1139 | u8 data = 0xc4; |
1108 | struct i2c_msg msg = {.addr = 0x08, .flags = 0, .len = 1}; | 1140 | struct i2c_msg msg = {.addr = 0x08, .flags = 0, .len = 1}; |
1109 | 1141 | ||
1110 | if (dvb_attach(tda826x_attach, dev->dvb.frontend, | 1142 | if (dvb_attach(tda826x_attach, fe0->dvb.frontend, |
1111 | 0x60, &dev->i2c_adap, 0) == NULL) { | 1143 | 0x60, &dev->i2c_adap, 0) == NULL) { |
1112 | wprintk("%s: Medion Quadro, no tda826x " | 1144 | wprintk("%s: Medion Quadro, no tda826x " |
1113 | "found !\n", __func__); | 1145 | "found !\n", __func__); |
@@ -1141,30 +1173,31 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1141 | } | 1173 | } |
1142 | break; | 1174 | break; |
1143 | case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180: | 1175 | case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180: |
1144 | dev->dvb.frontend = dvb_attach(nxt200x_attach, &avertvhda180, | 1176 | fe0->dvb.frontend = dvb_attach(nxt200x_attach, &avertvhda180, |
1145 | &dev->i2c_adap); | 1177 | &dev->i2c_adap); |
1146 | if (dev->dvb.frontend) | 1178 | if (fe0->dvb.frontend) |
1147 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 1179 | dvb_attach(dvb_pll_attach, fe0->dvb.frontend, 0x61, |
1148 | NULL, DVB_PLL_TDHU2); | 1180 | NULL, DVB_PLL_TDHU2); |
1149 | break; | 1181 | break; |
1182 | case SAA7134_BOARD_ADS_INSTANT_HDTV_PCI: | ||
1150 | case SAA7134_BOARD_KWORLD_ATSC110: | 1183 | case SAA7134_BOARD_KWORLD_ATSC110: |
1151 | dev->dvb.frontend = dvb_attach(nxt200x_attach, &kworldatsc110, | 1184 | fe0->dvb.frontend = dvb_attach(nxt200x_attach, &kworldatsc110, |
1152 | &dev->i2c_adap); | 1185 | &dev->i2c_adap); |
1153 | if (dev->dvb.frontend) | 1186 | if (fe0->dvb.frontend) |
1154 | dvb_attach(simple_tuner_attach, dev->dvb.frontend, | 1187 | dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
1155 | &dev->i2c_adap, 0x61, | 1188 | &dev->i2c_adap, 0x61, |
1156 | TUNER_PHILIPS_TUV1236D); | 1189 | TUNER_PHILIPS_TUV1236D); |
1157 | break; | 1190 | break; |
1158 | case SAA7134_BOARD_FLYDVBS_LR300: | 1191 | case SAA7134_BOARD_FLYDVBS_LR300: |
1159 | dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, | 1192 | fe0->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, |
1160 | &dev->i2c_adap); | 1193 | &dev->i2c_adap); |
1161 | if (dev->dvb.frontend) { | 1194 | if (fe0->dvb.frontend) { |
1162 | if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x60, | 1195 | if (dvb_attach(tda826x_attach, fe0->dvb.frontend, 0x60, |
1163 | &dev->i2c_adap, 0) == NULL) { | 1196 | &dev->i2c_adap, 0) == NULL) { |
1164 | wprintk("%s: No tda826x found!\n", __func__); | 1197 | wprintk("%s: No tda826x found!\n", __func__); |
1165 | goto dettach_frontend; | 1198 | goto dettach_frontend; |
1166 | } | 1199 | } |
1167 | if (dvb_attach(isl6421_attach, dev->dvb.frontend, | 1200 | if (dvb_attach(isl6421_attach, fe0->dvb.frontend, |
1168 | &dev->i2c_adap, 0x08, 0, 0) == NULL) { | 1201 | &dev->i2c_adap, 0x08, 0, 0) == NULL) { |
1169 | wprintk("%s: No ISL6421 found!\n", __func__); | 1202 | wprintk("%s: No ISL6421 found!\n", __func__); |
1170 | goto dettach_frontend; | 1203 | goto dettach_frontend; |
@@ -1172,25 +1205,25 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1172 | } | 1205 | } |
1173 | break; | 1206 | break; |
1174 | case SAA7134_BOARD_ASUS_EUROPA2_HYBRID: | 1207 | case SAA7134_BOARD_ASUS_EUROPA2_HYBRID: |
1175 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 1208 | fe0->dvb.frontend = dvb_attach(tda10046_attach, |
1176 | &medion_cardbus, | 1209 | &medion_cardbus, |
1177 | &dev->i2c_adap); | 1210 | &dev->i2c_adap); |
1178 | if (dev->dvb.frontend) { | 1211 | if (fe0->dvb.frontend) { |
1179 | dev->original_demod_sleep = dev->dvb.frontend->ops.sleep; | 1212 | dev->original_demod_sleep = fe0->dvb.frontend->ops.sleep; |
1180 | dev->dvb.frontend->ops.sleep = philips_europa_demod_sleep; | 1213 | fe0->dvb.frontend->ops.sleep = philips_europa_demod_sleep; |
1181 | 1214 | ||
1182 | dvb_attach(simple_tuner_attach, dev->dvb.frontend, | 1215 | dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
1183 | &dev->i2c_adap, medion_cardbus.tuner_address, | 1216 | &dev->i2c_adap, medion_cardbus.tuner_address, |
1184 | TUNER_PHILIPS_FMD1216ME_MK3); | 1217 | TUNER_PHILIPS_FMD1216ME_MK3); |
1185 | } | 1218 | } |
1186 | break; | 1219 | break; |
1187 | case SAA7134_BOARD_VIDEOMATE_DVBT_200A: | 1220 | case SAA7134_BOARD_VIDEOMATE_DVBT_200A: |
1188 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 1221 | fe0->dvb.frontend = dvb_attach(tda10046_attach, |
1189 | &philips_europa_config, | 1222 | &philips_europa_config, |
1190 | &dev->i2c_adap); | 1223 | &dev->i2c_adap); |
1191 | if (dev->dvb.frontend) { | 1224 | if (fe0->dvb.frontend) { |
1192 | dev->dvb.frontend->ops.tuner_ops.init = philips_td1316_tuner_init; | 1225 | fe0->dvb.frontend->ops.tuner_ops.init = philips_td1316_tuner_init; |
1193 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params; | 1226 | fe0->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params; |
1194 | } | 1227 | } |
1195 | break; | 1228 | break; |
1196 | case SAA7134_BOARD_CINERGY_HT_PCMCIA: | 1229 | case SAA7134_BOARD_CINERGY_HT_PCMCIA: |
@@ -1229,15 +1262,15 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1229 | goto dettach_frontend; | 1262 | goto dettach_frontend; |
1230 | break; | 1263 | break; |
1231 | case SAA7134_BOARD_PHILIPS_SNAKE: | 1264 | case SAA7134_BOARD_PHILIPS_SNAKE: |
1232 | dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, | 1265 | fe0->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, |
1233 | &dev->i2c_adap); | 1266 | &dev->i2c_adap); |
1234 | if (dev->dvb.frontend) { | 1267 | if (fe0->dvb.frontend) { |
1235 | if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x60, | 1268 | if (dvb_attach(tda826x_attach, fe0->dvb.frontend, 0x60, |
1236 | &dev->i2c_adap, 0) == NULL) { | 1269 | &dev->i2c_adap, 0) == NULL) { |
1237 | wprintk("%s: No tda826x found!\n", __func__); | 1270 | wprintk("%s: No tda826x found!\n", __func__); |
1238 | goto dettach_frontend; | 1271 | goto dettach_frontend; |
1239 | } | 1272 | } |
1240 | if (dvb_attach(lnbp21_attach, dev->dvb.frontend, | 1273 | if (dvb_attach(lnbp21_attach, fe0->dvb.frontend, |
1241 | &dev->i2c_adap, 0, 0) == NULL) { | 1274 | &dev->i2c_adap, 0, 0) == NULL) { |
1242 | wprintk("%s: No lnbp21 found!\n", __func__); | 1275 | wprintk("%s: No lnbp21 found!\n", __func__); |
1243 | goto dettach_frontend; | 1276 | goto dettach_frontend; |
@@ -1259,23 +1292,24 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1259 | saa7134_set_gpio(dev, 25, 0); | 1292 | saa7134_set_gpio(dev, 25, 0); |
1260 | msleep(10); | 1293 | msleep(10); |
1261 | saa7134_set_gpio(dev, 25, 1); | 1294 | saa7134_set_gpio(dev, 25, 1); |
1262 | dev->dvb.frontend = dvb_attach(mt352_attach, | 1295 | fe0->dvb.frontend = dvb_attach(mt352_attach, |
1263 | &avermedia_xc3028_mt352_dev, | 1296 | &avermedia_xc3028_mt352_dev, |
1264 | &dev->i2c_adap); | 1297 | &dev->i2c_adap); |
1265 | attach_xc3028 = 1; | 1298 | attach_xc3028 = 1; |
1299 | break; | ||
1266 | case SAA7134_BOARD_MD7134_BRIDGE_2: | 1300 | case SAA7134_BOARD_MD7134_BRIDGE_2: |
1267 | dev->dvb.frontend = dvb_attach(tda10086_attach, | 1301 | fe0->dvb.frontend = dvb_attach(tda10086_attach, |
1268 | &sd1878_4m, &dev->i2c_adap); | 1302 | &sd1878_4m, &dev->i2c_adap); |
1269 | if (dev->dvb.frontend) { | 1303 | if (fe0->dvb.frontend) { |
1270 | struct dvb_frontend *fe; | 1304 | struct dvb_frontend *fe; |
1271 | if (dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, | 1305 | if (dvb_attach(dvb_pll_attach, fe0->dvb.frontend, 0x60, |
1272 | &dev->i2c_adap, DVB_PLL_PHILIPS_SD1878_TDA8261) == NULL) { | 1306 | &dev->i2c_adap, DVB_PLL_PHILIPS_SD1878_TDA8261) == NULL) { |
1273 | wprintk("%s: MD7134 DVB-S, no SD1878 " | 1307 | wprintk("%s: MD7134 DVB-S, no SD1878 " |
1274 | "found !\n", __func__); | 1308 | "found !\n", __func__); |
1275 | goto dettach_frontend; | 1309 | goto dettach_frontend; |
1276 | } | 1310 | } |
1277 | /* we need to open the i2c gate (we know it exists) */ | 1311 | /* we need to open the i2c gate (we know it exists) */ |
1278 | fe = dev->dvb.frontend; | 1312 | fe = fe0->dvb.frontend; |
1279 | fe->ops.i2c_gate_ctrl(fe, 1); | 1313 | fe->ops.i2c_gate_ctrl(fe, 1); |
1280 | if (dvb_attach(isl6405_attach, fe, | 1314 | if (dvb_attach(isl6405_attach, fe, |
1281 | &dev->i2c_adap, 0x08, 0, 0) == NULL) { | 1315 | &dev->i2c_adap, 0x08, 0, 0) == NULL) { |
@@ -1290,6 +1324,45 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1290 | fe->ops.enable_high_lnb_voltage = md8800_set_high_voltage; | 1324 | fe->ops.enable_high_lnb_voltage = md8800_set_high_voltage; |
1291 | } | 1325 | } |
1292 | break; | 1326 | break; |
1327 | case SAA7134_BOARD_AVERMEDIA_M103: | ||
1328 | saa7134_set_gpio(dev, 25, 0); | ||
1329 | msleep(10); | ||
1330 | saa7134_set_gpio(dev, 25, 1); | ||
1331 | fe0->dvb.frontend = dvb_attach(mt352_attach, | ||
1332 | &avermedia_xc3028_mt352_dev, | ||
1333 | &dev->i2c_adap); | ||
1334 | attach_xc3028 = 1; | ||
1335 | break; | ||
1336 | case SAA7134_BOARD_ASUSTeK_TIGER_3IN1: | ||
1337 | if (!use_frontend) { /* terrestrial */ | ||
1338 | if (configure_tda827x_fe(dev, &asus_tiger_3in1_config, | ||
1339 | &tda827x_cfg_2) < 0) | ||
1340 | goto dettach_frontend; | ||
1341 | } else { /* satellite */ | ||
1342 | fe0->dvb.frontend = dvb_attach(tda10086_attach, | ||
1343 | &flydvbs, &dev->i2c_adap); | ||
1344 | if (fe0->dvb.frontend) { | ||
1345 | if (dvb_attach(tda826x_attach, | ||
1346 | fe0->dvb.frontend, 0x60, | ||
1347 | &dev->i2c_adap, 0) == NULL) { | ||
1348 | wprintk("%s: Asus Tiger 3in1, no " | ||
1349 | "tda826x found!\n", __func__); | ||
1350 | goto dettach_frontend; | ||
1351 | } | ||
1352 | if (dvb_attach(lnbp21_attach, fe0->dvb.frontend, | ||
1353 | &dev->i2c_adap, 0, 0) == NULL) { | ||
1354 | wprintk("%s: Asus Tiger 3in1, no lnbp21" | ||
1355 | " found!\n", __func__); | ||
1356 | goto dettach_frontend; | ||
1357 | } | ||
1358 | } | ||
1359 | } | ||
1360 | break; | ||
1361 | case SAA7134_BOARD_ASUSTeK_TIGER: | ||
1362 | if (configure_tda827x_fe(dev, &philips_tiger_config, | ||
1363 | &tda827x_cfg_0) < 0) | ||
1364 | goto dettach_frontend; | ||
1365 | break; | ||
1293 | default: | 1366 | default: |
1294 | wprintk("Huh? unknown DVB card?\n"); | 1367 | wprintk("Huh? unknown DVB card?\n"); |
1295 | break; | 1368 | break; |
@@ -1302,10 +1375,10 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1302 | .i2c_addr = 0x61, | 1375 | .i2c_addr = 0x61, |
1303 | }; | 1376 | }; |
1304 | 1377 | ||
1305 | if (!dev->dvb.frontend) | 1378 | if (!fe0->dvb.frontend) |
1306 | return -1; | 1379 | return -1; |
1307 | 1380 | ||
1308 | fe = dvb_attach(xc2028_attach, dev->dvb.frontend, &cfg); | 1381 | fe = dvb_attach(xc2028_attach, fe0->dvb.frontend, &cfg); |
1309 | if (!fe) { | 1382 | if (!fe) { |
1310 | printk(KERN_ERR "%s/2: xc3028 attach failed\n", | 1383 | printk(KERN_ERR "%s/2: xc3028 attach failed\n", |
1311 | dev->name); | 1384 | dev->name); |
@@ -1313,38 +1386,47 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1313 | } | 1386 | } |
1314 | } | 1387 | } |
1315 | 1388 | ||
1316 | if (NULL == dev->dvb.frontend) { | 1389 | if (NULL == fe0->dvb.frontend) { |
1317 | printk(KERN_ERR "%s/dvb: frontend initialization failed\n", dev->name); | 1390 | printk(KERN_ERR "%s/dvb: frontend initialization failed\n", dev->name); |
1318 | return -1; | 1391 | return -1; |
1319 | } | 1392 | } |
1393 | /* define general-purpose callback pointer */ | ||
1394 | fe0->dvb.frontend->callback = saa7134_tuner_callback; | ||
1320 | 1395 | ||
1321 | /* register everything else */ | 1396 | /* register everything else */ |
1322 | ret = videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev, &dev->pci->dev, | 1397 | ret = videobuf_dvb_register_bus(&dev->frontends, THIS_MODULE, dev, |
1323 | adapter_nr); | 1398 | &dev->pci->dev, adapter_nr, 0); |
1324 | 1399 | ||
1325 | /* this sequence is necessary to make the tda1004x load its firmware | 1400 | /* this sequence is necessary to make the tda1004x load its firmware |
1326 | * and to enter analog mode of hybrid boards | 1401 | * and to enter analog mode of hybrid boards |
1327 | */ | 1402 | */ |
1328 | if (!ret) { | 1403 | if (!ret) { |
1329 | if (dev->dvb.frontend->ops.init) | 1404 | if (fe0->dvb.frontend->ops.init) |
1330 | dev->dvb.frontend->ops.init(dev->dvb.frontend); | 1405 | fe0->dvb.frontend->ops.init(fe0->dvb.frontend); |
1331 | if (dev->dvb.frontend->ops.sleep) | 1406 | if (fe0->dvb.frontend->ops.sleep) |
1332 | dev->dvb.frontend->ops.sleep(dev->dvb.frontend); | 1407 | fe0->dvb.frontend->ops.sleep(fe0->dvb.frontend); |
1333 | if (dev->dvb.frontend->ops.tuner_ops.sleep) | 1408 | if (fe0->dvb.frontend->ops.tuner_ops.sleep) |
1334 | dev->dvb.frontend->ops.tuner_ops.sleep(dev->dvb.frontend); | 1409 | fe0->dvb.frontend->ops.tuner_ops.sleep(fe0->dvb.frontend); |
1335 | } | 1410 | } |
1336 | return ret; | 1411 | return ret; |
1337 | 1412 | ||
1338 | dettach_frontend: | 1413 | dettach_frontend: |
1339 | if (dev->dvb.frontend) | 1414 | if (fe0->dvb.frontend) |
1340 | dvb_frontend_detach(dev->dvb.frontend); | 1415 | dvb_frontend_detach(fe0->dvb.frontend); |
1341 | dev->dvb.frontend = NULL; | 1416 | fe0->dvb.frontend = NULL; |
1342 | 1417 | ||
1343 | return -1; | 1418 | return -1; |
1344 | } | 1419 | } |
1345 | 1420 | ||
1346 | static int dvb_fini(struct saa7134_dev *dev) | 1421 | static int dvb_fini(struct saa7134_dev *dev) |
1347 | { | 1422 | { |
1423 | struct videobuf_dvb_frontend *fe0; | ||
1424 | |||
1425 | /* Get the first frontend */ | ||
1426 | fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1); | ||
1427 | if (!fe0) | ||
1428 | return -EINVAL; | ||
1429 | |||
1348 | /* FIXME: I suspect that this code is bogus, since the entry for | 1430 | /* FIXME: I suspect that this code is bogus, since the entry for |
1349 | Pinnacle 300I DVB-T PAL already defines the proper init to allow | 1431 | Pinnacle 300I DVB-T PAL already defines the proper init to allow |
1350 | the detection of mt2032 (TDA9887_PORT2_INACTIVE) | 1432 | the detection of mt2032 (TDA9887_PORT2_INACTIVE) |
@@ -1364,7 +1446,7 @@ static int dvb_fini(struct saa7134_dev *dev) | |||
1364 | u8 data = 0x80; | 1446 | u8 data = 0x80; |
1365 | struct i2c_msg msg = {.addr = 0x08, .buf = &data, .flags = 0, .len = 1}; | 1447 | struct i2c_msg msg = {.addr = 0x08, .buf = &data, .flags = 0, .len = 1}; |
1366 | struct dvb_frontend *fe; | 1448 | struct dvb_frontend *fe; |
1367 | fe = dev->dvb.frontend; | 1449 | fe = fe0->dvb.frontend; |
1368 | if (fe->ops.i2c_gate_ctrl) { | 1450 | if (fe->ops.i2c_gate_ctrl) { |
1369 | fe->ops.i2c_gate_ctrl(fe, 1); | 1451 | fe->ops.i2c_gate_ctrl(fe, 1); |
1370 | i2c_transfer(&dev->i2c_adap, &msg, 1); | 1452 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
@@ -1372,8 +1454,8 @@ static int dvb_fini(struct saa7134_dev *dev) | |||
1372 | } | 1454 | } |
1373 | } | 1455 | } |
1374 | } | 1456 | } |
1375 | if (dev->dvb.frontend) | 1457 | if (fe0->dvb.frontend) |
1376 | videobuf_dvb_unregister(&dev->dvb); | 1458 | videobuf_dvb_unregister_bus(&dev->frontends); |
1377 | return 0; | 1459 | return 0; |
1378 | } | 1460 | } |
1379 | 1461 | ||