diff options
author | Steven Toth <stoth@linuxtv.org> | 2008-10-11 10:05:50 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-17 16:23:10 -0400 |
commit | 363c35fc448943c3d6121332d28bcda2d2fbf87c (patch) | |
tree | 739864d237b7fa60bef51bc510fe55c888b606ca /drivers/media/video/saa7134 | |
parent | 548da7625c825eccc31b4b3865ae5389c3660486 (diff) |
V4L/DVB (9222): S2API: Add Multiple-frontend on a single adapter support.
A detailed description from the original patches 2 years ago:
"The WinTV-HVR3000 has a single transport bus which is shared between
a DVB-T and DVB-S modulator. These patches build on the bus acquisition
cx88 work from a few weeks ago to add support for this.
So to applications the HVR3000 looks like this:
/dev/dvb/adapter0/fe0 (cx24123 DVB-S demod)
/dev/dvb/adapter0/fe1 (cx22702 DVB-T demod)
Additional boards continue as before, eg:
/dev/dvb/adapter1/fe0 (lgdt3302 ATSC demod)
The basic change is removing the single instance of the videobuf_dvb in
cx8802_dev and saa7134_dev(?) and replacing it with a list and some
supporting functions.
*NOTE* This branch was taken before v4l-dvb was closed for 2.6.19 so
two or three current cx88 patches appear to be reversed by this tree,
this will be cleaned up in the near future. The patches missing change
the mutex handing to core->lock, fix an enumeration problem."
It should be recognised that a number of people have been maintaining
this patchset. Significant levels of Kudos to everyone one involved,
including but not limited to:
Darron Broad
Fabio M. Di Nitto
Carlo Scarfoglio
Hans Werner
Without the work of these people, and countless others, my two year old
patches would of died on the Mercurial linuxtv.org vine a long time
ago.
TODO: Revise these patches a little further so that the need for
demux1 and dvr0 is optional, not mandatory on the HVR3000.
HISTORY (darron):
This is the last update to MFE prepared by Hans which is based
upon the `scratchpad' diff created by Carlo.
All MFE work prior to that point must be attributed to Fabio
who ported and maintained Steve's original patch up to that
time.
Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Darron Broad <darron@kewl.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/saa7134')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-dvb.c | 205 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134.h | 2 |
2 files changed, 112 insertions, 95 deletions
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index 87c10983266f..8ada0497fa03 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c | |||
@@ -535,11 +535,15 @@ 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 | fe0 = videobuf_dvb_get_frontend(&dev->frontends, 0); | ||
541 | |||
542 | fe0->dvb.frontend = dvb_attach(tda10046_attach, cdec_conf, &dev->i2c_adap); | ||
543 | if (fe0->dvb.frontend) { | ||
540 | if (cdec_conf->i2c_gate) | 544 | if (cdec_conf->i2c_gate) |
541 | dev->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl; | 545 | fe0->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl; |
542 | if (dvb_attach(tda827x_attach, dev->dvb.frontend, | 546 | if (dvb_attach(tda827x_attach, fe0->dvb.frontend, |
543 | cdec_conf->tuner_address, | 547 | cdec_conf->tuner_address, |
544 | &dev->i2c_adap, tuner_conf)) | 548 | &dev->i2c_adap, tuner_conf)) |
545 | return 0; | 549 | return 0; |
@@ -944,12 +948,18 @@ static int dvb_init(struct saa7134_dev *dev) | |||
944 | { | 948 | { |
945 | int ret; | 949 | int ret; |
946 | int attach_xc3028 = 0; | 950 | int attach_xc3028 = 0; |
951 | struct videobuf_dvb_frontend *fe0; | ||
952 | |||
953 | /* Get the first frontend */ | ||
954 | fe0 = videobuf_dvb_get_frontend(&dev->frontends, 0); | ||
955 | if (!fe0) | ||
956 | return -EINVAL; | ||
947 | 957 | ||
948 | /* init struct videobuf_dvb */ | 958 | /* init struct videobuf_dvb */ |
949 | dev->ts.nr_bufs = 32; | 959 | dev->ts.nr_bufs = 32; |
950 | dev->ts.nr_packets = 32*4; | 960 | dev->ts.nr_packets = 32*4; |
951 | dev->dvb.name = dev->name; | 961 | fe0->dvb.name = dev->name; |
952 | videobuf_queue_sg_init(&dev->dvb.dvbq, &saa7134_ts_qops, | 962 | videobuf_queue_sg_init(&fe0->dvb.dvbq, &saa7134_ts_qops, |
953 | &dev->pci->dev, &dev->slock, | 963 | &dev->pci->dev, &dev->slock, |
954 | V4L2_BUF_TYPE_VIDEO_CAPTURE, | 964 | V4L2_BUF_TYPE_VIDEO_CAPTURE, |
955 | V4L2_FIELD_ALTERNATE, | 965 | V4L2_FIELD_ALTERNATE, |
@@ -959,47 +969,47 @@ static int dvb_init(struct saa7134_dev *dev) | |||
959 | switch (dev->board) { | 969 | switch (dev->board) { |
960 | case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: | 970 | case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: |
961 | dprintk("pinnacle 300i dvb setup\n"); | 971 | dprintk("pinnacle 300i dvb setup\n"); |
962 | dev->dvb.frontend = dvb_attach(mt352_attach, &pinnacle_300i, | 972 | fe0->dvb.frontend = dvb_attach(mt352_attach, &pinnacle_300i, |
963 | &dev->i2c_adap); | 973 | &dev->i2c_adap); |
964 | if (dev->dvb.frontend) { | 974 | if (fe0->dvb.frontend) { |
965 | dev->dvb.frontend->ops.tuner_ops.set_params = mt352_pinnacle_tuner_set_params; | 975 | fe0->dvb.frontend->ops.tuner_ops.set_params = mt352_pinnacle_tuner_set_params; |
966 | } | 976 | } |
967 | break; | 977 | break; |
968 | case SAA7134_BOARD_AVERMEDIA_777: | 978 | case SAA7134_BOARD_AVERMEDIA_777: |
969 | case SAA7134_BOARD_AVERMEDIA_A16AR: | 979 | case SAA7134_BOARD_AVERMEDIA_A16AR: |
970 | dprintk("avertv 777 dvb setup\n"); | 980 | dprintk("avertv 777 dvb setup\n"); |
971 | dev->dvb.frontend = dvb_attach(mt352_attach, &avermedia_777, | 981 | fe0->dvb.frontend = dvb_attach(mt352_attach, &avermedia_777, |
972 | &dev->i2c_adap); | 982 | &dev->i2c_adap); |
973 | if (dev->dvb.frontend) { | 983 | if (fe0->dvb.frontend) { |
974 | dvb_attach(simple_tuner_attach, dev->dvb.frontend, | 984 | dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
975 | &dev->i2c_adap, 0x61, | 985 | &dev->i2c_adap, 0x61, |
976 | TUNER_PHILIPS_TD1316); | 986 | TUNER_PHILIPS_TD1316); |
977 | } | 987 | } |
978 | break; | 988 | break; |
979 | case SAA7134_BOARD_AVERMEDIA_A16D: | 989 | case SAA7134_BOARD_AVERMEDIA_A16D: |
980 | dprintk("AverMedia A16D dvb setup\n"); | 990 | dprintk("AverMedia A16D dvb setup\n"); |
981 | dev->dvb.frontend = dvb_attach(mt352_attach, | 991 | fe0->dvb.frontend = dvb_attach(mt352_attach, |
982 | &avermedia_xc3028_mt352_dev, | 992 | &avermedia_xc3028_mt352_dev, |
983 | &dev->i2c_adap); | 993 | &dev->i2c_adap); |
984 | attach_xc3028 = 1; | 994 | attach_xc3028 = 1; |
985 | break; | 995 | break; |
986 | case SAA7134_BOARD_MD7134: | 996 | case SAA7134_BOARD_MD7134: |
987 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 997 | fe0->dvb.frontend = dvb_attach(tda10046_attach, |
988 | &medion_cardbus, | 998 | &medion_cardbus, |
989 | &dev->i2c_adap); | 999 | &dev->i2c_adap); |
990 | if (dev->dvb.frontend) { | 1000 | if (fe0->dvb.frontend) { |
991 | dvb_attach(simple_tuner_attach, dev->dvb.frontend, | 1001 | dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
992 | &dev->i2c_adap, medion_cardbus.tuner_address, | 1002 | &dev->i2c_adap, medion_cardbus.tuner_address, |
993 | TUNER_PHILIPS_FMD1216ME_MK3); | 1003 | TUNER_PHILIPS_FMD1216ME_MK3); |
994 | } | 1004 | } |
995 | break; | 1005 | break; |
996 | case SAA7134_BOARD_PHILIPS_TOUGH: | 1006 | case SAA7134_BOARD_PHILIPS_TOUGH: |
997 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 1007 | fe0->dvb.frontend = dvb_attach(tda10046_attach, |
998 | &philips_tu1216_60_config, | 1008 | &philips_tu1216_60_config, |
999 | &dev->i2c_adap); | 1009 | &dev->i2c_adap); |
1000 | if (dev->dvb.frontend) { | 1010 | if (fe0->dvb.frontend) { |
1001 | dev->dvb.frontend->ops.tuner_ops.init = philips_tu1216_init; | 1011 | fe0->dvb.frontend->ops.tuner_ops.init = philips_tu1216_init; |
1002 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tda6651_pll_set; | 1012 | fe0->dvb.frontend->ops.tuner_ops.set_params = philips_tda6651_pll_set; |
1003 | } | 1013 | } |
1004 | break; | 1014 | break; |
1005 | case SAA7134_BOARD_FLYDVBTDUO: | 1015 | case SAA7134_BOARD_FLYDVBTDUO: |
@@ -1010,24 +1020,24 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1010 | break; | 1020 | break; |
1011 | case SAA7134_BOARD_PHILIPS_EUROPA: | 1021 | case SAA7134_BOARD_PHILIPS_EUROPA: |
1012 | case SAA7134_BOARD_VIDEOMATE_DVBT_300: | 1022 | case SAA7134_BOARD_VIDEOMATE_DVBT_300: |
1013 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 1023 | fe0->dvb.frontend = dvb_attach(tda10046_attach, |
1014 | &philips_europa_config, | 1024 | &philips_europa_config, |
1015 | &dev->i2c_adap); | 1025 | &dev->i2c_adap); |
1016 | if (dev->dvb.frontend) { | 1026 | if (fe0->dvb.frontend) { |
1017 | dev->original_demod_sleep = dev->dvb.frontend->ops.sleep; | 1027 | dev->original_demod_sleep = fe0->dvb.frontend->ops.sleep; |
1018 | dev->dvb.frontend->ops.sleep = philips_europa_demod_sleep; | 1028 | fe0->dvb.frontend->ops.sleep = philips_europa_demod_sleep; |
1019 | dev->dvb.frontend->ops.tuner_ops.init = philips_europa_tuner_init; | 1029 | fe0->dvb.frontend->ops.tuner_ops.init = philips_europa_tuner_init; |
1020 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_europa_tuner_sleep; | 1030 | fe0->dvb.frontend->ops.tuner_ops.sleep = philips_europa_tuner_sleep; |
1021 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params; | 1031 | fe0->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params; |
1022 | } | 1032 | } |
1023 | break; | 1033 | break; |
1024 | case SAA7134_BOARD_VIDEOMATE_DVBT_200: | 1034 | case SAA7134_BOARD_VIDEOMATE_DVBT_200: |
1025 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 1035 | fe0->dvb.frontend = dvb_attach(tda10046_attach, |
1026 | &philips_tu1216_61_config, | 1036 | &philips_tu1216_61_config, |
1027 | &dev->i2c_adap); | 1037 | &dev->i2c_adap); |
1028 | if (dev->dvb.frontend) { | 1038 | if (fe0->dvb.frontend) { |
1029 | dev->dvb.frontend->ops.tuner_ops.init = philips_tu1216_init; | 1039 | fe0->dvb.frontend->ops.tuner_ops.init = philips_tu1216_init; |
1030 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tda6651_pll_set; | 1040 | fe0->dvb.frontend->ops.tuner_ops.set_params = philips_tda6651_pll_set; |
1031 | } | 1041 | } |
1032 | break; | 1042 | break; |
1033 | case SAA7134_BOARD_KWORLD_DVBT_210: | 1043 | case SAA7134_BOARD_KWORLD_DVBT_210: |
@@ -1060,20 +1070,20 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1060 | &tda827x_cfg_0) < 0) | 1070 | &tda827x_cfg_0) < 0) |
1061 | goto dettach_frontend; | 1071 | goto dettach_frontend; |
1062 | break; | 1072 | break; |
1063 | case SAA7134_BOARD_FLYDVB_TRIO: | 1073 | case SAA7134_BOARD_FLYDVB_TRIO: // XXXXXX multifrontend |
1064 | if (!use_frontend) { /* terrestrial */ | 1074 | if (!use_frontend) { /* terrestrial */ |
1065 | if (configure_tda827x_fe(dev, &lifeview_trio_config, | 1075 | if (configure_tda827x_fe(dev, &lifeview_trio_config, |
1066 | &tda827x_cfg_0) < 0) | 1076 | &tda827x_cfg_0) < 0) |
1067 | goto dettach_frontend; | 1077 | goto dettach_frontend; |
1068 | } else { /* satellite */ | 1078 | } else { /* satellite */ |
1069 | dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap); | 1079 | fe0->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap); |
1070 | if (dev->dvb.frontend) { | 1080 | if (fe0->dvb.frontend) { |
1071 | if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x63, | 1081 | if (dvb_attach(tda826x_attach, fe0->dvb.frontend, 0x63, |
1072 | &dev->i2c_adap, 0) == NULL) { | 1082 | &dev->i2c_adap, 0) == NULL) { |
1073 | wprintk("%s: Lifeview Trio, No tda826x found!\n", __func__); | 1083 | wprintk("%s: Lifeview Trio, No tda826x found!\n", __func__); |
1074 | goto dettach_frontend; | 1084 | goto dettach_frontend; |
1075 | } | 1085 | } |
1076 | if (dvb_attach(isl6421_attach, dev->dvb.frontend, &dev->i2c_adap, | 1086 | if (dvb_attach(isl6421_attach, fe0->dvb.frontend, &dev->i2c_adap, |
1077 | 0x08, 0, 0) == NULL) { | 1087 | 0x08, 0, 0) == NULL) { |
1078 | wprintk("%s: Lifeview Trio, No ISL6421 found!\n", __func__); | 1088 | wprintk("%s: Lifeview Trio, No ISL6421 found!\n", __func__); |
1079 | goto dettach_frontend; | 1089 | goto dettach_frontend; |
@@ -1083,11 +1093,11 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1083 | break; | 1093 | break; |
1084 | case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331: | 1094 | case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331: |
1085 | case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS: | 1095 | case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS: |
1086 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 1096 | fe0->dvb.frontend = dvb_attach(tda10046_attach, |
1087 | &ads_tech_duo_config, | 1097 | &ads_tech_duo_config, |
1088 | &dev->i2c_adap); | 1098 | &dev->i2c_adap); |
1089 | if (dev->dvb.frontend) { | 1099 | if (fe0->dvb.frontend) { |
1090 | if (dvb_attach(tda827x_attach,dev->dvb.frontend, | 1100 | if (dvb_attach(tda827x_attach,fe0->dvb.frontend, |
1091 | ads_tech_duo_config.tuner_address, &dev->i2c_adap, | 1101 | ads_tech_duo_config.tuner_address, &dev->i2c_adap, |
1092 | &ads_duo_cfg) == NULL) { | 1102 | &ads_duo_cfg) == NULL) { |
1093 | wprintk("no tda827x tuner found at addr: %02x\n", | 1103 | wprintk("no tda827x tuner found at addr: %02x\n", |
@@ -1108,15 +1118,15 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1108 | &tda827x_cfg_0) < 0) | 1118 | &tda827x_cfg_0) < 0) |
1109 | goto dettach_frontend; | 1119 | goto dettach_frontend; |
1110 | } else { /* satellite */ | 1120 | } else { /* satellite */ |
1111 | dev->dvb.frontend = dvb_attach(tda10086_attach, | 1121 | fe0->dvb.frontend = dvb_attach(tda10086_attach, |
1112 | &flydvbs, &dev->i2c_adap); | 1122 | &flydvbs, &dev->i2c_adap); |
1113 | if (dev->dvb.frontend) { | 1123 | if (fe0->dvb.frontend) { |
1114 | struct dvb_frontend *fe = dev->dvb.frontend; | 1124 | struct dvb_frontend *fe = fe0->dvb.frontend; |
1115 | u8 dev_id = dev->eedata[2]; | 1125 | u8 dev_id = dev->eedata[2]; |
1116 | u8 data = 0xc4; | 1126 | u8 data = 0xc4; |
1117 | struct i2c_msg msg = {.addr = 0x08, .flags = 0, .len = 1}; | 1127 | struct i2c_msg msg = {.addr = 0x08, .flags = 0, .len = 1}; |
1118 | 1128 | ||
1119 | if (dvb_attach(tda826x_attach, dev->dvb.frontend, | 1129 | if (dvb_attach(tda826x_attach, fe0->dvb.frontend, |
1120 | 0x60, &dev->i2c_adap, 0) == NULL) { | 1130 | 0x60, &dev->i2c_adap, 0) == NULL) { |
1121 | wprintk("%s: Medion Quadro, no tda826x " | 1131 | wprintk("%s: Medion Quadro, no tda826x " |
1122 | "found !\n", __func__); | 1132 | "found !\n", __func__); |
@@ -1150,31 +1160,31 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1150 | } | 1160 | } |
1151 | break; | 1161 | break; |
1152 | case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180: | 1162 | case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180: |
1153 | dev->dvb.frontend = dvb_attach(nxt200x_attach, &avertvhda180, | 1163 | fe0->dvb.frontend = dvb_attach(nxt200x_attach, &avertvhda180, |
1154 | &dev->i2c_adap); | 1164 | &dev->i2c_adap); |
1155 | if (dev->dvb.frontend) | 1165 | if (fe0->dvb.frontend) |
1156 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 1166 | dvb_attach(dvb_pll_attach, fe0->dvb.frontend, 0x61, |
1157 | NULL, DVB_PLL_TDHU2); | 1167 | NULL, DVB_PLL_TDHU2); |
1158 | break; | 1168 | break; |
1159 | case SAA7134_BOARD_ADS_INSTANT_HDTV_PCI: | 1169 | case SAA7134_BOARD_ADS_INSTANT_HDTV_PCI: |
1160 | case SAA7134_BOARD_KWORLD_ATSC110: | 1170 | case SAA7134_BOARD_KWORLD_ATSC110: |
1161 | dev->dvb.frontend = dvb_attach(nxt200x_attach, &kworldatsc110, | 1171 | fe0->dvb.frontend = dvb_attach(nxt200x_attach, &kworldatsc110, |
1162 | &dev->i2c_adap); | 1172 | &dev->i2c_adap); |
1163 | if (dev->dvb.frontend) | 1173 | if (fe0->dvb.frontend) |
1164 | dvb_attach(simple_tuner_attach, dev->dvb.frontend, | 1174 | dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
1165 | &dev->i2c_adap, 0x61, | 1175 | &dev->i2c_adap, 0x61, |
1166 | TUNER_PHILIPS_TUV1236D); | 1176 | TUNER_PHILIPS_TUV1236D); |
1167 | break; | 1177 | break; |
1168 | case SAA7134_BOARD_FLYDVBS_LR300: | 1178 | case SAA7134_BOARD_FLYDVBS_LR300: |
1169 | dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, | 1179 | fe0->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, |
1170 | &dev->i2c_adap); | 1180 | &dev->i2c_adap); |
1171 | if (dev->dvb.frontend) { | 1181 | if (fe0->dvb.frontend) { |
1172 | if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x60, | 1182 | if (dvb_attach(tda826x_attach, fe0->dvb.frontend, 0x60, |
1173 | &dev->i2c_adap, 0) == NULL) { | 1183 | &dev->i2c_adap, 0) == NULL) { |
1174 | wprintk("%s: No tda826x found!\n", __func__); | 1184 | wprintk("%s: No tda826x found!\n", __func__); |
1175 | goto dettach_frontend; | 1185 | goto dettach_frontend; |
1176 | } | 1186 | } |
1177 | if (dvb_attach(isl6421_attach, dev->dvb.frontend, | 1187 | if (dvb_attach(isl6421_attach, fe0->dvb.frontend, |
1178 | &dev->i2c_adap, 0x08, 0, 0) == NULL) { | 1188 | &dev->i2c_adap, 0x08, 0, 0) == NULL) { |
1179 | wprintk("%s: No ISL6421 found!\n", __func__); | 1189 | wprintk("%s: No ISL6421 found!\n", __func__); |
1180 | goto dettach_frontend; | 1190 | goto dettach_frontend; |
@@ -1182,25 +1192,25 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1182 | } | 1192 | } |
1183 | break; | 1193 | break; |
1184 | case SAA7134_BOARD_ASUS_EUROPA2_HYBRID: | 1194 | case SAA7134_BOARD_ASUS_EUROPA2_HYBRID: |
1185 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 1195 | fe0->dvb.frontend = dvb_attach(tda10046_attach, |
1186 | &medion_cardbus, | 1196 | &medion_cardbus, |
1187 | &dev->i2c_adap); | 1197 | &dev->i2c_adap); |
1188 | if (dev->dvb.frontend) { | 1198 | if (fe0->dvb.frontend) { |
1189 | dev->original_demod_sleep = dev->dvb.frontend->ops.sleep; | 1199 | dev->original_demod_sleep = fe0->dvb.frontend->ops.sleep; |
1190 | dev->dvb.frontend->ops.sleep = philips_europa_demod_sleep; | 1200 | fe0->dvb.frontend->ops.sleep = philips_europa_demod_sleep; |
1191 | 1201 | ||
1192 | dvb_attach(simple_tuner_attach, dev->dvb.frontend, | 1202 | dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
1193 | &dev->i2c_adap, medion_cardbus.tuner_address, | 1203 | &dev->i2c_adap, medion_cardbus.tuner_address, |
1194 | TUNER_PHILIPS_FMD1216ME_MK3); | 1204 | TUNER_PHILIPS_FMD1216ME_MK3); |
1195 | } | 1205 | } |
1196 | break; | 1206 | break; |
1197 | case SAA7134_BOARD_VIDEOMATE_DVBT_200A: | 1207 | case SAA7134_BOARD_VIDEOMATE_DVBT_200A: |
1198 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 1208 | fe0->dvb.frontend = dvb_attach(tda10046_attach, |
1199 | &philips_europa_config, | 1209 | &philips_europa_config, |
1200 | &dev->i2c_adap); | 1210 | &dev->i2c_adap); |
1201 | if (dev->dvb.frontend) { | 1211 | if (fe0->dvb.frontend) { |
1202 | dev->dvb.frontend->ops.tuner_ops.init = philips_td1316_tuner_init; | 1212 | fe0->dvb.frontend->ops.tuner_ops.init = philips_td1316_tuner_init; |
1203 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params; | 1213 | fe0->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params; |
1204 | } | 1214 | } |
1205 | break; | 1215 | break; |
1206 | case SAA7134_BOARD_CINERGY_HT_PCMCIA: | 1216 | case SAA7134_BOARD_CINERGY_HT_PCMCIA: |
@@ -1239,15 +1249,15 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1239 | goto dettach_frontend; | 1249 | goto dettach_frontend; |
1240 | break; | 1250 | break; |
1241 | case SAA7134_BOARD_PHILIPS_SNAKE: | 1251 | case SAA7134_BOARD_PHILIPS_SNAKE: |
1242 | dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, | 1252 | fe0->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, |
1243 | &dev->i2c_adap); | 1253 | &dev->i2c_adap); |
1244 | if (dev->dvb.frontend) { | 1254 | if (fe0->dvb.frontend) { |
1245 | if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x60, | 1255 | if (dvb_attach(tda826x_attach, fe0->dvb.frontend, 0x60, |
1246 | &dev->i2c_adap, 0) == NULL) { | 1256 | &dev->i2c_adap, 0) == NULL) { |
1247 | wprintk("%s: No tda826x found!\n", __func__); | 1257 | wprintk("%s: No tda826x found!\n", __func__); |
1248 | goto dettach_frontend; | 1258 | goto dettach_frontend; |
1249 | } | 1259 | } |
1250 | if (dvb_attach(lnbp21_attach, dev->dvb.frontend, | 1260 | if (dvb_attach(lnbp21_attach, fe0->dvb.frontend, |
1251 | &dev->i2c_adap, 0, 0) == NULL) { | 1261 | &dev->i2c_adap, 0, 0) == NULL) { |
1252 | wprintk("%s: No lnbp21 found!\n", __func__); | 1262 | wprintk("%s: No lnbp21 found!\n", __func__); |
1253 | goto dettach_frontend; | 1263 | goto dettach_frontend; |
@@ -1269,24 +1279,24 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1269 | saa7134_set_gpio(dev, 25, 0); | 1279 | saa7134_set_gpio(dev, 25, 0); |
1270 | msleep(10); | 1280 | msleep(10); |
1271 | saa7134_set_gpio(dev, 25, 1); | 1281 | saa7134_set_gpio(dev, 25, 1); |
1272 | dev->dvb.frontend = dvb_attach(mt352_attach, | 1282 | fe0->dvb.frontend = dvb_attach(mt352_attach, |
1273 | &avermedia_xc3028_mt352_dev, | 1283 | &avermedia_xc3028_mt352_dev, |
1274 | &dev->i2c_adap); | 1284 | &dev->i2c_adap); |
1275 | attach_xc3028 = 1; | 1285 | attach_xc3028 = 1; |
1276 | break; | 1286 | break; |
1277 | case SAA7134_BOARD_MD7134_BRIDGE_2: | 1287 | case SAA7134_BOARD_MD7134_BRIDGE_2: |
1278 | dev->dvb.frontend = dvb_attach(tda10086_attach, | 1288 | fe0->dvb.frontend = dvb_attach(tda10086_attach, |
1279 | &sd1878_4m, &dev->i2c_adap); | 1289 | &sd1878_4m, &dev->i2c_adap); |
1280 | if (dev->dvb.frontend) { | 1290 | if (fe0->dvb.frontend) { |
1281 | struct dvb_frontend *fe; | 1291 | struct dvb_frontend *fe; |
1282 | if (dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, | 1292 | if (dvb_attach(dvb_pll_attach, fe0->dvb.frontend, 0x60, |
1283 | &dev->i2c_adap, DVB_PLL_PHILIPS_SD1878_TDA8261) == NULL) { | 1293 | &dev->i2c_adap, DVB_PLL_PHILIPS_SD1878_TDA8261) == NULL) { |
1284 | wprintk("%s: MD7134 DVB-S, no SD1878 " | 1294 | wprintk("%s: MD7134 DVB-S, no SD1878 " |
1285 | "found !\n", __func__); | 1295 | "found !\n", __func__); |
1286 | goto dettach_frontend; | 1296 | goto dettach_frontend; |
1287 | } | 1297 | } |
1288 | /* we need to open the i2c gate (we know it exists) */ | 1298 | /* we need to open the i2c gate (we know it exists) */ |
1289 | fe = dev->dvb.frontend; | 1299 | fe = fe0->dvb.frontend; |
1290 | fe->ops.i2c_gate_ctrl(fe, 1); | 1300 | fe->ops.i2c_gate_ctrl(fe, 1); |
1291 | if (dvb_attach(isl6405_attach, fe, | 1301 | if (dvb_attach(isl6405_attach, fe, |
1292 | &dev->i2c_adap, 0x08, 0, 0) == NULL) { | 1302 | &dev->i2c_adap, 0x08, 0, 0) == NULL) { |
@@ -1305,7 +1315,7 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1305 | saa7134_set_gpio(dev, 25, 0); | 1315 | saa7134_set_gpio(dev, 25, 0); |
1306 | msleep(10); | 1316 | msleep(10); |
1307 | saa7134_set_gpio(dev, 25, 1); | 1317 | saa7134_set_gpio(dev, 25, 1); |
1308 | dev->dvb.frontend = dvb_attach(mt352_attach, | 1318 | fe0->dvb.frontend = dvb_attach(mt352_attach, |
1309 | &avermedia_xc3028_mt352_dev, | 1319 | &avermedia_xc3028_mt352_dev, |
1310 | &dev->i2c_adap); | 1320 | &dev->i2c_adap); |
1311 | attach_xc3028 = 1; | 1321 | attach_xc3028 = 1; |
@@ -1316,17 +1326,17 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1316 | &tda827x_cfg_2) < 0) | 1326 | &tda827x_cfg_2) < 0) |
1317 | goto dettach_frontend; | 1327 | goto dettach_frontend; |
1318 | } else { /* satellite */ | 1328 | } else { /* satellite */ |
1319 | dev->dvb.frontend = dvb_attach(tda10086_attach, | 1329 | fe0->dvb.frontend = dvb_attach(tda10086_attach, |
1320 | &flydvbs, &dev->i2c_adap); | 1330 | &flydvbs, &dev->i2c_adap); |
1321 | if (dev->dvb.frontend) { | 1331 | if (fe0->dvb.frontend) { |
1322 | if (dvb_attach(tda826x_attach, | 1332 | if (dvb_attach(tda826x_attach, |
1323 | dev->dvb.frontend, 0x60, | 1333 | fe0->dvb.frontend, 0x60, |
1324 | &dev->i2c_adap, 0) == NULL) { | 1334 | &dev->i2c_adap, 0) == NULL) { |
1325 | wprintk("%s: Asus Tiger 3in1, no " | 1335 | wprintk("%s: Asus Tiger 3in1, no " |
1326 | "tda826x found!\n", __func__); | 1336 | "tda826x found!\n", __func__); |
1327 | goto dettach_frontend; | 1337 | goto dettach_frontend; |
1328 | } | 1338 | } |
1329 | if (dvb_attach(lnbp21_attach, dev->dvb.frontend, | 1339 | if (dvb_attach(lnbp21_attach, fe0->dvb.frontend, |
1330 | &dev->i2c_adap, 0, 0) == NULL) { | 1340 | &dev->i2c_adap, 0, 0) == NULL) { |
1331 | wprintk("%s: Asus Tiger 3in1, no lnbp21" | 1341 | wprintk("%s: Asus Tiger 3in1, no lnbp21" |
1332 | " found!\n", __func__); | 1342 | " found!\n", __func__); |
@@ -1352,10 +1362,10 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1352 | .i2c_addr = 0x61, | 1362 | .i2c_addr = 0x61, |
1353 | }; | 1363 | }; |
1354 | 1364 | ||
1355 | if (!dev->dvb.frontend) | 1365 | if (!fe0->dvb.frontend) |
1356 | return -1; | 1366 | return -1; |
1357 | 1367 | ||
1358 | fe = dvb_attach(xc2028_attach, dev->dvb.frontend, &cfg); | 1368 | fe = dvb_attach(xc2028_attach, fe0->dvb.frontend, &cfg); |
1359 | if (!fe) { | 1369 | if (!fe) { |
1360 | printk(KERN_ERR "%s/2: xc3028 attach failed\n", | 1370 | printk(KERN_ERR "%s/2: xc3028 attach failed\n", |
1361 | dev->name); | 1371 | dev->name); |
@@ -1363,40 +1373,47 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1363 | } | 1373 | } |
1364 | } | 1374 | } |
1365 | 1375 | ||
1366 | if (NULL == dev->dvb.frontend) { | 1376 | if (NULL == fe0->dvb.frontend) { |
1367 | printk(KERN_ERR "%s/dvb: frontend initialization failed\n", dev->name); | 1377 | printk(KERN_ERR "%s/dvb: frontend initialization failed\n", dev->name); |
1368 | return -1; | 1378 | return -1; |
1369 | } | 1379 | } |
1370 | /* define general-purpose callback pointer */ | 1380 | /* define general-purpose callback pointer */ |
1371 | dev->dvb.frontend->callback = saa7134_tuner_callback; | 1381 | fe0->dvb.frontend->callback = saa7134_tuner_callback; |
1372 | 1382 | ||
1373 | /* register everything else */ | 1383 | /* register everything else */ |
1374 | ret = videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev, &dev->pci->dev, | 1384 | ret = videobuf_dvb_register_bus(&dev->frontends, THIS_MODULE, dev, |
1375 | adapter_nr); | 1385 | &dev->pci->dev, adapter_nr); |
1376 | 1386 | ||
1377 | /* this sequence is necessary to make the tda1004x load its firmware | 1387 | /* this sequence is necessary to make the tda1004x load its firmware |
1378 | * and to enter analog mode of hybrid boards | 1388 | * and to enter analog mode of hybrid boards |
1379 | */ | 1389 | */ |
1380 | if (!ret) { | 1390 | if (!ret) { |
1381 | if (dev->dvb.frontend->ops.init) | 1391 | if (fe0->dvb.frontend->ops.init) |
1382 | dev->dvb.frontend->ops.init(dev->dvb.frontend); | 1392 | fe0->dvb.frontend->ops.init(fe0->dvb.frontend); |
1383 | if (dev->dvb.frontend->ops.sleep) | 1393 | if (fe0->dvb.frontend->ops.sleep) |
1384 | dev->dvb.frontend->ops.sleep(dev->dvb.frontend); | 1394 | fe0->dvb.frontend->ops.sleep(fe0->dvb.frontend); |
1385 | if (dev->dvb.frontend->ops.tuner_ops.sleep) | 1395 | if (fe0->dvb.frontend->ops.tuner_ops.sleep) |
1386 | dev->dvb.frontend->ops.tuner_ops.sleep(dev->dvb.frontend); | 1396 | fe0->dvb.frontend->ops.tuner_ops.sleep(fe0->dvb.frontend); |
1387 | } | 1397 | } |
1388 | return ret; | 1398 | return ret; |
1389 | 1399 | ||
1390 | dettach_frontend: | 1400 | dettach_frontend: |
1391 | if (dev->dvb.frontend) | 1401 | if (fe0->dvb.frontend) |
1392 | dvb_frontend_detach(dev->dvb.frontend); | 1402 | dvb_frontend_detach(fe0->dvb.frontend); |
1393 | dev->dvb.frontend = NULL; | 1403 | fe0->dvb.frontend = NULL; |
1394 | 1404 | ||
1395 | return -1; | 1405 | return -1; |
1396 | } | 1406 | } |
1397 | 1407 | ||
1398 | static int dvb_fini(struct saa7134_dev *dev) | 1408 | static int dvb_fini(struct saa7134_dev *dev) |
1399 | { | 1409 | { |
1410 | struct videobuf_dvb_frontend *fe0; | ||
1411 | |||
1412 | /* Get the first frontend */ | ||
1413 | fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1); | ||
1414 | if (!fe0) | ||
1415 | return -EINVAL; | ||
1416 | |||
1400 | /* FIXME: I suspect that this code is bogus, since the entry for | 1417 | /* FIXME: I suspect that this code is bogus, since the entry for |
1401 | Pinnacle 300I DVB-T PAL already defines the proper init to allow | 1418 | Pinnacle 300I DVB-T PAL already defines the proper init to allow |
1402 | the detection of mt2032 (TDA9887_PORT2_INACTIVE) | 1419 | the detection of mt2032 (TDA9887_PORT2_INACTIVE) |
@@ -1416,7 +1433,7 @@ static int dvb_fini(struct saa7134_dev *dev) | |||
1416 | u8 data = 0x80; | 1433 | u8 data = 0x80; |
1417 | struct i2c_msg msg = {.addr = 0x08, .buf = &data, .flags = 0, .len = 1}; | 1434 | struct i2c_msg msg = {.addr = 0x08, .buf = &data, .flags = 0, .len = 1}; |
1418 | struct dvb_frontend *fe; | 1435 | struct dvb_frontend *fe; |
1419 | fe = dev->dvb.frontend; | 1436 | fe = fe0->dvb.frontend; |
1420 | if (fe->ops.i2c_gate_ctrl) { | 1437 | if (fe->ops.i2c_gate_ctrl) { |
1421 | fe->ops.i2c_gate_ctrl(fe, 1); | 1438 | fe->ops.i2c_gate_ctrl(fe, 1); |
1422 | i2c_transfer(&dev->i2c_adap, &msg, 1); | 1439 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
@@ -1424,8 +1441,8 @@ static int dvb_fini(struct saa7134_dev *dev) | |||
1424 | } | 1441 | } |
1425 | } | 1442 | } |
1426 | } | 1443 | } |
1427 | if (dev->dvb.frontend) | 1444 | if (fe0->dvb.frontend) |
1428 | videobuf_dvb_unregister(&dev->dvb); | 1445 | videobuf_dvb_unregister_bus(&dev->frontends); |
1429 | return 0; | 1446 | return 0; |
1430 | } | 1447 | } |
1431 | 1448 | ||
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 491ab1f8fdd3..24096d6e1ef8 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
@@ -581,7 +581,7 @@ struct saa7134_dev { | |||
581 | 581 | ||
582 | #if defined(CONFIG_VIDEO_SAA7134_DVB) || defined(CONFIG_VIDEO_SAA7134_DVB_MODULE) | 582 | #if defined(CONFIG_VIDEO_SAA7134_DVB) || defined(CONFIG_VIDEO_SAA7134_DVB_MODULE) |
583 | /* SAA7134_MPEG_DVB only */ | 583 | /* SAA7134_MPEG_DVB only */ |
584 | struct videobuf_dvb dvb; | 584 | struct videobuf_dvb_frontends frontends; |
585 | int (*original_demod_sleep)(struct dvb_frontend *fe); | 585 | int (*original_demod_sleep)(struct dvb_frontend *fe); |
586 | int (*original_set_voltage)(struct dvb_frontend *fe, fe_sec_voltage_t voltage); | 586 | int (*original_set_voltage)(struct dvb_frontend *fe, fe_sec_voltage_t voltage); |
587 | int (*original_set_high_voltage)(struct dvb_frontend *fe, long arg); | 587 | int (*original_set_high_voltage)(struct dvb_frontend *fe, long arg); |