]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - drivers/media/pci/bt8xx/bttv-cards.c
Linux 4.11-rc1
[mirror_ubuntu-bionic-kernel.git] / drivers / media / pci / bt8xx / bttv-cards.c
1 /*
2
3 bttv-cards.c
4
5 this file has configuration informations - card-specific stuff
6 like the big tvcards array for the most part
7
8 Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de)
9 & Marcus Metzler (mocm@thp.uni-koeln.de)
10 (c) 1999-2001 Gerd Knorr <kraxel@goldbach.in-berlin.de>
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25
26 */
27
28 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
29
30 #include <linux/delay.h>
31 #include <linux/module.h>
32 #include <linux/kmod.h>
33 #include <linux/init.h>
34 #include <linux/pci.h>
35 #include <linux/vmalloc.h>
36 #include <linux/firmware.h>
37 #include <net/checksum.h>
38
39 #include <asm/unaligned.h>
40 #include <asm/io.h>
41
42 #include "bttvp.h"
43 #include <media/v4l2-common.h>
44 #include <media/i2c/tvaudio.h>
45 #include "bttv-audio-hook.h"
46
47 /* fwd decl */
48 static void boot_msp34xx(struct bttv *btv, int pin);
49 static void hauppauge_eeprom(struct bttv *btv);
50 static void avermedia_eeprom(struct bttv *btv);
51 static void osprey_eeprom(struct bttv *btv, const u8 ee[256]);
52 static void modtec_eeprom(struct bttv *btv);
53 static void init_PXC200(struct bttv *btv);
54 static void init_RTV24(struct bttv *btv);
55 static void init_PCI8604PW(struct bttv *btv);
56
57 static void rv605_muxsel(struct bttv *btv, unsigned int input);
58 static void eagle_muxsel(struct bttv *btv, unsigned int input);
59 static void xguard_muxsel(struct bttv *btv, unsigned int input);
60 static void ivc120_muxsel(struct bttv *btv, unsigned int input);
61 static void gvc1100_muxsel(struct bttv *btv, unsigned int input);
62
63 static void PXC200_muxsel(struct bttv *btv, unsigned int input);
64
65 static void picolo_tetra_muxsel(struct bttv *btv, unsigned int input);
66 static void picolo_tetra_init(struct bttv *btv);
67
68 static void tibetCS16_muxsel(struct bttv *btv, unsigned int input);
69 static void tibetCS16_init(struct bttv *btv);
70
71 static void kodicom4400r_muxsel(struct bttv *btv, unsigned int input);
72 static void kodicom4400r_init(struct bttv *btv);
73
74 static void sigmaSLC_muxsel(struct bttv *btv, unsigned int input);
75 static void sigmaSQ_muxsel(struct bttv *btv, unsigned int input);
76
77 static void geovision_muxsel(struct bttv *btv, unsigned int input);
78
79 static void phytec_muxsel(struct bttv *btv, unsigned int input);
80
81 static void gv800s_muxsel(struct bttv *btv, unsigned int input);
82 static void gv800s_init(struct bttv *btv);
83
84 static void td3116_muxsel(struct bttv *btv, unsigned int input);
85
86 static int terratec_active_radio_upgrade(struct bttv *btv);
87 static int tea575x_init(struct bttv *btv);
88 static void identify_by_eeprom(struct bttv *btv,
89 unsigned char eeprom_data[256]);
90 static int pvr_boot(struct bttv *btv);
91
92 /* config variables */
93 static unsigned int triton1;
94 static unsigned int vsfx;
95 static unsigned int latency = UNSET;
96 int no_overlay=-1;
97
98 static unsigned int card[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
99 static unsigned int pll[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
100 static unsigned int tuner[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
101 static unsigned int svhs[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
102 static unsigned int remote[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
103 static unsigned int audiodev[BTTV_MAX];
104 static unsigned int saa6588[BTTV_MAX];
105 static struct bttv *master[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = NULL };
106 static unsigned int autoload = UNSET;
107 static unsigned int gpiomask = UNSET;
108 static unsigned int audioall = UNSET;
109 static unsigned int audiomux[5] = { [ 0 ... 4 ] = UNSET };
110
111 /* insmod options */
112 module_param(triton1, int, 0444);
113 module_param(vsfx, int, 0444);
114 module_param(no_overlay, int, 0444);
115 module_param(latency, int, 0444);
116 module_param(gpiomask, int, 0444);
117 module_param(audioall, int, 0444);
118 module_param(autoload, int, 0444);
119
120 module_param_array(card, int, NULL, 0444);
121 module_param_array(pll, int, NULL, 0444);
122 module_param_array(tuner, int, NULL, 0444);
123 module_param_array(svhs, int, NULL, 0444);
124 module_param_array(remote, int, NULL, 0444);
125 module_param_array(audiodev, int, NULL, 0444);
126 module_param_array(audiomux, int, NULL, 0444);
127
128 MODULE_PARM_DESC(triton1, "set ETBF pci config bit [enable bug compatibility for triton1 + others]");
129 MODULE_PARM_DESC(vsfx, "set VSFX pci config bit [yet another chipset flaw workaround]");
130 MODULE_PARM_DESC(latency,"pci latency timer");
131 MODULE_PARM_DESC(card,"specify TV/grabber card model, see CARDLIST file for a list");
132 MODULE_PARM_DESC(pll, "specify installed crystal (0=none, 28=28 MHz, 35=35 MHz, 14=14 MHz)");
133 MODULE_PARM_DESC(tuner,"specify installed tuner type");
134 MODULE_PARM_DESC(autoload, "obsolete option, please do not use anymore");
135 MODULE_PARM_DESC(audiodev, "specify audio device:\n"
136 "\t\t-1 = no audio\n"
137 "\t\t 0 = autodetect (default)\n"
138 "\t\t 1 = msp3400\n"
139 "\t\t 2 = tda7432\n"
140 "\t\t 3 = tvaudio");
141 MODULE_PARM_DESC(saa6588, "if 1, then load the saa6588 RDS module, default (0) is to use the card definition.");
142 MODULE_PARM_DESC(no_overlay, "allow override overlay default (0 disables, 1 enables) [some VIA/SIS chipsets are known to have problem with overlay]");
143
144 /* ----------------------------------------------------------------------- */
145 /* list of card IDs for bt878+ cards */
146
147 static struct CARD {
148 unsigned id;
149 int cardnr;
150 char *name;
151 } cards[] = {
152 { 0x13eb0070, BTTV_BOARD_HAUPPAUGE878, "Hauppauge WinTV" },
153 { 0x39000070, BTTV_BOARD_HAUPPAUGE878, "Hauppauge WinTV-D" },
154 { 0x45000070, BTTV_BOARD_HAUPPAUGEPVR, "Hauppauge WinTV/PVR" },
155 { 0xff000070, BTTV_BOARD_OSPREY1x0, "Osprey-100" },
156 { 0xff010070, BTTV_BOARD_OSPREY2x0_SVID,"Osprey-200" },
157 { 0xff020070, BTTV_BOARD_OSPREY500, "Osprey-500" },
158 { 0xff030070, BTTV_BOARD_OSPREY2000, "Osprey-2000" },
159 { 0xff040070, BTTV_BOARD_OSPREY540, "Osprey-540" },
160 { 0xff070070, BTTV_BOARD_OSPREY440, "Osprey-440" },
161
162 { 0x00011002, BTTV_BOARD_ATI_TVWONDER, "ATI TV Wonder" },
163 { 0x00031002, BTTV_BOARD_ATI_TVWONDERVE,"ATI TV Wonder/VE" },
164
165 { 0x6606107d, BTTV_BOARD_WINFAST2000, "Leadtek WinFast TV 2000" },
166 { 0x6607107d, BTTV_BOARD_WINFASTVC100, "Leadtek WinFast VC 100" },
167 { 0x6609107d, BTTV_BOARD_WINFAST2000, "Leadtek TV 2000 XP" },
168 { 0x263610b4, BTTV_BOARD_STB2, "STB TV PCI FM, Gateway P/N 6000704" },
169 { 0x264510b4, BTTV_BOARD_STB2, "STB TV PCI FM, Gateway P/N 6000704" },
170 { 0x402010fc, BTTV_BOARD_GVBCTV3PCI, "I-O Data Co. GV-BCTV3/PCI" },
171 { 0x405010fc, BTTV_BOARD_GVBCTV4PCI, "I-O Data Co. GV-BCTV4/PCI" },
172 { 0x407010fc, BTTV_BOARD_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" },
173 { 0xd01810fc, BTTV_BOARD_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" },
174
175 { 0x001211bd, BTTV_BOARD_PINNACLE, "Pinnacle PCTV" },
176 /* some cards ship with byteswapped IDs ... */
177 { 0x1200bd11, BTTV_BOARD_PINNACLE, "Pinnacle PCTV [bswap]" },
178 { 0xff00bd11, BTTV_BOARD_PINNACLE, "Pinnacle PCTV [bswap]" },
179 /* this seems to happen as well ... */
180 { 0xff1211bd, BTTV_BOARD_PINNACLE, "Pinnacle PCTV" },
181
182 { 0x3000121a, BTTV_BOARD_VOODOOTV_200, "3Dfx VoodooTV 200" },
183 { 0x263710b4, BTTV_BOARD_VOODOOTV_FM, "3Dfx VoodooTV FM" },
184 { 0x3060121a, BTTV_BOARD_STB2, "3Dfx VoodooTV 100/ STB OEM" },
185
186 { 0x3000144f, BTTV_BOARD_MAGICTVIEW063, "(Askey Magic/others) TView99 CPH06x" },
187 { 0xa005144f, BTTV_BOARD_MAGICTVIEW063, "CPH06X TView99-Card" },
188 { 0x3002144f, BTTV_BOARD_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH05x" },
189 { 0x3005144f, BTTV_BOARD_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH061/06L (T1/LC)" },
190 { 0x5000144f, BTTV_BOARD_MAGICTVIEW061, "Askey CPH050" },
191 { 0x300014ff, BTTV_BOARD_MAGICTVIEW061, "TView 99 (CPH061)" },
192 { 0x300214ff, BTTV_BOARD_PHOEBE_TVMAS, "Phoebe TV Master (CPH060)" },
193
194 { 0x00011461, BTTV_BOARD_AVPHONE98, "AVerMedia TVPhone98" },
195 { 0x00021461, BTTV_BOARD_AVERMEDIA98, "AVermedia TVCapture 98" },
196 { 0x00031461, BTTV_BOARD_AVPHONE98, "AVerMedia TVPhone98" },
197 { 0x00041461, BTTV_BOARD_AVERMEDIA98, "AVerMedia TVCapture 98" },
198 { 0x03001461, BTTV_BOARD_AVERMEDIA98, "VDOMATE TV TUNER CARD" },
199
200 { 0x1117153b, BTTV_BOARD_TERRATVALUE, "Terratec TValue (Philips PAL B/G)" },
201 { 0x1118153b, BTTV_BOARD_TERRATVALUE, "Terratec TValue (Temic PAL B/G)" },
202 { 0x1119153b, BTTV_BOARD_TERRATVALUE, "Terratec TValue (Philips PAL I)" },
203 { 0x111a153b, BTTV_BOARD_TERRATVALUE, "Terratec TValue (Temic PAL I)" },
204
205 { 0x1123153b, BTTV_BOARD_TERRATVRADIO, "Terratec TV Radio+" },
206 { 0x1127153b, BTTV_BOARD_TERRATV, "Terratec TV+ (V1.05)" },
207 /* clashes with FlyVideo
208 *{ 0x18521852, BTTV_BOARD_TERRATV, "Terratec TV+ (V1.10)" }, */
209 { 0x1134153b, BTTV_BOARD_TERRATVALUE, "Terratec TValue (LR102)" },
210 { 0x1135153b, BTTV_BOARD_TERRATVALUER, "Terratec TValue Radio" }, /* LR102 */
211 { 0x5018153b, BTTV_BOARD_TERRATVALUE, "Terratec TValue" }, /* ?? */
212 { 0xff3b153b, BTTV_BOARD_TERRATVALUER, "Terratec TValue Radio" }, /* ?? */
213
214 { 0x400015b0, BTTV_BOARD_ZOLTRIX_GENIE, "Zoltrix Genie TV" },
215 { 0x400a15b0, BTTV_BOARD_ZOLTRIX_GENIE, "Zoltrix Genie TV" },
216 { 0x400d15b0, BTTV_BOARD_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
217 { 0x401015b0, BTTV_BOARD_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
218 { 0x401615b0, BTTV_BOARD_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
219
220 { 0x1430aa00, BTTV_BOARD_PV143, "Provideo PV143A" },
221 { 0x1431aa00, BTTV_BOARD_PV143, "Provideo PV143B" },
222 { 0x1432aa00, BTTV_BOARD_PV143, "Provideo PV143C" },
223 { 0x1433aa00, BTTV_BOARD_PV143, "Provideo PV143D" },
224 { 0x1433aa03, BTTV_BOARD_PV143, "Security Eyes" },
225
226 { 0x1460aa00, BTTV_BOARD_PV150, "Provideo PV150A-1" },
227 { 0x1461aa01, BTTV_BOARD_PV150, "Provideo PV150A-2" },
228 { 0x1462aa02, BTTV_BOARD_PV150, "Provideo PV150A-3" },
229 { 0x1463aa03, BTTV_BOARD_PV150, "Provideo PV150A-4" },
230
231 { 0x1464aa04, BTTV_BOARD_PV150, "Provideo PV150B-1" },
232 { 0x1465aa05, BTTV_BOARD_PV150, "Provideo PV150B-2" },
233 { 0x1466aa06, BTTV_BOARD_PV150, "Provideo PV150B-3" },
234 { 0x1467aa07, BTTV_BOARD_PV150, "Provideo PV150B-4" },
235
236 { 0xa132ff00, BTTV_BOARD_IVC100, "IVC-100" },
237 { 0xa1550000, BTTV_BOARD_IVC200, "IVC-200" },
238 { 0xa1550001, BTTV_BOARD_IVC200, "IVC-200" },
239 { 0xa1550002, BTTV_BOARD_IVC200, "IVC-200" },
240 { 0xa1550003, BTTV_BOARD_IVC200, "IVC-200" },
241 { 0xa1550100, BTTV_BOARD_IVC200, "IVC-200G" },
242 { 0xa1550101, BTTV_BOARD_IVC200, "IVC-200G" },
243 { 0xa1550102, BTTV_BOARD_IVC200, "IVC-200G" },
244 { 0xa1550103, BTTV_BOARD_IVC200, "IVC-200G" },
245 { 0xa1550800, BTTV_BOARD_IVC200, "IVC-200" },
246 { 0xa1550801, BTTV_BOARD_IVC200, "IVC-200" },
247 { 0xa1550802, BTTV_BOARD_IVC200, "IVC-200" },
248 { 0xa1550803, BTTV_BOARD_IVC200, "IVC-200" },
249 { 0xa182ff00, BTTV_BOARD_IVC120, "IVC-120G" },
250 { 0xa182ff01, BTTV_BOARD_IVC120, "IVC-120G" },
251 { 0xa182ff02, BTTV_BOARD_IVC120, "IVC-120G" },
252 { 0xa182ff03, BTTV_BOARD_IVC120, "IVC-120G" },
253 { 0xa182ff04, BTTV_BOARD_IVC120, "IVC-120G" },
254 { 0xa182ff05, BTTV_BOARD_IVC120, "IVC-120G" },
255 { 0xa182ff06, BTTV_BOARD_IVC120, "IVC-120G" },
256 { 0xa182ff07, BTTV_BOARD_IVC120, "IVC-120G" },
257 { 0xa182ff08, BTTV_BOARD_IVC120, "IVC-120G" },
258 { 0xa182ff09, BTTV_BOARD_IVC120, "IVC-120G" },
259 { 0xa182ff0a, BTTV_BOARD_IVC120, "IVC-120G" },
260 { 0xa182ff0b, BTTV_BOARD_IVC120, "IVC-120G" },
261 { 0xa182ff0c, BTTV_BOARD_IVC120, "IVC-120G" },
262 { 0xa182ff0d, BTTV_BOARD_IVC120, "IVC-120G" },
263 { 0xa182ff0e, BTTV_BOARD_IVC120, "IVC-120G" },
264 { 0xa182ff0f, BTTV_BOARD_IVC120, "IVC-120G" },
265 { 0xf0500000, BTTV_BOARD_IVCE8784, "IVCE-8784" },
266 { 0xf0500001, BTTV_BOARD_IVCE8784, "IVCE-8784" },
267 { 0xf0500002, BTTV_BOARD_IVCE8784, "IVCE-8784" },
268 { 0xf0500003, BTTV_BOARD_IVCE8784, "IVCE-8784" },
269
270 { 0x41424344, BTTV_BOARD_GRANDTEC, "GrandTec Multi Capture" },
271 { 0x01020304, BTTV_BOARD_XGUARD, "Grandtec Grand X-Guard" },
272
273 { 0x18501851, BTTV_BOARD_CHRONOS_VS2, "FlyVideo 98 (LR50)/ Chronos Video Shuttle II" },
274 { 0xa0501851, BTTV_BOARD_CHRONOS_VS2, "FlyVideo 98 (LR50)/ Chronos Video Shuttle II" },
275 { 0x18511851, BTTV_BOARD_FLYVIDEO98EZ, "FlyVideo 98EZ (LR51)/ CyberMail AV" },
276 { 0x18521852, BTTV_BOARD_TYPHOON_TVIEW, "FlyVideo 98FM (LR50)/ Typhoon TView TV/FM Tuner" },
277 { 0x41a0a051, BTTV_BOARD_FLYVIDEO_98FM, "Lifeview FlyVideo 98 LR50 Rev Q" },
278 { 0x18501f7f, BTTV_BOARD_FLYVIDEO_98, "Lifeview Flyvideo 98" },
279
280 { 0x010115cb, BTTV_BOARD_GMV1, "AG GMV1" },
281 { 0x010114c7, BTTV_BOARD_MODTEC_205, "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV" },
282
283 { 0x10b42636, BTTV_BOARD_HAUPPAUGE878, "STB ???" },
284 { 0x217d6606, BTTV_BOARD_WINFAST2000, "Leadtek WinFast TV 2000" },
285 { 0xfff6f6ff, BTTV_BOARD_WINFAST2000, "Leadtek WinFast TV 2000" },
286 { 0x03116000, BTTV_BOARD_SENSORAY311_611, "Sensoray 311" },
287 { 0x06116000, BTTV_BOARD_SENSORAY311_611, "Sensoray 611" },
288 { 0x00790e11, BTTV_BOARD_WINDVR, "Canopus WinDVR PCI" },
289 { 0xa0fca1a0, BTTV_BOARD_ZOLTRIX, "Face to Face Tvmax" },
290 { 0x82b2aa6a, BTTV_BOARD_SIMUS_GVC1100, "SIMUS GVC1100" },
291 { 0x146caa0c, BTTV_BOARD_PV951, "ituner spectra8" },
292 { 0x200a1295, BTTV_BOARD_PXC200, "ImageNation PXC200A" },
293
294 { 0x40111554, BTTV_BOARD_PV_BT878P_9B, "Prolink Pixelview PV-BT" },
295 { 0x17de0a01, BTTV_BOARD_KWORLD, "Mecer TV/FM/Video Tuner" },
296
297 { 0x01051805, BTTV_BOARD_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #1" },
298 { 0x01061805, BTTV_BOARD_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #2" },
299 { 0x01071805, BTTV_BOARD_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #3" },
300 { 0x01081805, BTTV_BOARD_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #4" },
301
302 { 0x15409511, BTTV_BOARD_ACORP_Y878F, "Acorp Y878F" },
303
304 { 0x53534149, BTTV_BOARD_SSAI_SECURITY, "SSAI Security Video Interface" },
305 { 0x5353414a, BTTV_BOARD_SSAI_ULTRASOUND, "SSAI Ultrasound Video Interface" },
306
307 /* likely broken, vendor id doesn't match the other magic views ...
308 * { 0xa0fca04f, BTTV_BOARD_MAGICTVIEW063, "Guillemot Maxi TV Video 3" }, */
309
310 /* Duplicate PCI ID, reconfigure for this board during the eeprom read.
311 * { 0x13eb0070, BTTV_BOARD_HAUPPAUGE_IMPACTVCB, "Hauppauge ImpactVCB" }, */
312
313 { 0x109e036e, BTTV_BOARD_CONCEPTRONIC_CTVFMI2, "Conceptronic CTVFMi v2"},
314
315 /* DVB cards (using pci function .1 for mpeg data xfer) */
316 { 0x001c11bd, BTTV_BOARD_PINNACLESAT, "Pinnacle PCTV Sat" },
317 { 0x01010071, BTTV_BOARD_NEBULA_DIGITV, "Nebula Electronics DigiTV" },
318 { 0x20007063, BTTV_BOARD_PC_HDTV, "pcHDTV HD-2000 TV"},
319 { 0x002611bd, BTTV_BOARD_TWINHAN_DST, "Pinnacle PCTV SAT CI" },
320 { 0x00011822, BTTV_BOARD_TWINHAN_DST, "Twinhan VisionPlus DVB" },
321 { 0xfc00270f, BTTV_BOARD_TWINHAN_DST, "ChainTech digitop DST-1000 DVB-S" },
322 { 0x07711461, BTTV_BOARD_AVDVBT_771, "AVermedia AverTV DVB-T 771" },
323 { 0x07611461, BTTV_BOARD_AVDVBT_761, "AverMedia AverTV DVB-T 761" },
324 { 0xdb1018ac, BTTV_BOARD_DVICO_DVBT_LITE, "DViCO FusionHDTV DVB-T Lite" },
325 { 0xdb1118ac, BTTV_BOARD_DVICO_DVBT_LITE, "Ultraview DVB-T Lite" },
326 { 0xd50018ac, BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE, "DViCO FusionHDTV 5 Lite" },
327 { 0x00261822, BTTV_BOARD_TWINHAN_DST, "DNTV Live! Mini "},
328 { 0xd200dbc0, BTTV_BOARD_DVICO_FUSIONHDTV_2, "DViCO FusionHDTV 2" },
329 { 0x763c008a, BTTV_BOARD_GEOVISION_GV600, "GeoVision GV-600" },
330 { 0x18011000, BTTV_BOARD_ENLTV_FM_2, "Encore ENL TV-FM-2" },
331 { 0x763d800a, BTTV_BOARD_GEOVISION_GV800S, "GeoVision GV-800(S) (master)" },
332 { 0x763d800b, BTTV_BOARD_GEOVISION_GV800S_SL, "GeoVision GV-800(S) (slave)" },
333 { 0x763d800c, BTTV_BOARD_GEOVISION_GV800S_SL, "GeoVision GV-800(S) (slave)" },
334 { 0x763d800d, BTTV_BOARD_GEOVISION_GV800S_SL, "GeoVision GV-800(S) (slave)" },
335
336 { 0x15401830, BTTV_BOARD_PV183, "Provideo PV183-1" },
337 { 0x15401831, BTTV_BOARD_PV183, "Provideo PV183-2" },
338 { 0x15401832, BTTV_BOARD_PV183, "Provideo PV183-3" },
339 { 0x15401833, BTTV_BOARD_PV183, "Provideo PV183-4" },
340 { 0x15401834, BTTV_BOARD_PV183, "Provideo PV183-5" },
341 { 0x15401835, BTTV_BOARD_PV183, "Provideo PV183-6" },
342 { 0x15401836, BTTV_BOARD_PV183, "Provideo PV183-7" },
343 { 0x15401837, BTTV_BOARD_PV183, "Provideo PV183-8" },
344 { 0x3116f200, BTTV_BOARD_TVT_TD3116, "Tongwei Video Technology TD-3116" },
345 { 0x02280279, BTTV_BOARD_APOSONIC_WDVR, "Aposonic W-DVR" },
346 { 0, -1, NULL }
347 };
348
349 /* ----------------------------------------------------------------------- */
350 /* array with description for bt848 / bt878 tv/grabber cards */
351
352 struct tvcard bttv_tvcards[] = {
353 /* ---- card 0x00 ---------------------------------- */
354 [BTTV_BOARD_UNKNOWN] = {
355 .name = " *** UNKNOWN/GENERIC *** ",
356 .video_inputs = 4,
357 .svhs = 2,
358 .muxsel = MUXSEL(2, 3, 1, 0),
359 .tuner_type = UNSET,
360 .tuner_addr = ADDR_UNSET,
361 },
362 [BTTV_BOARD_MIRO] = {
363 .name = "MIRO PCTV",
364 .video_inputs = 4,
365 /* .audio_inputs= 1, */
366 .svhs = 2,
367 .gpiomask = 15,
368 .muxsel = MUXSEL(2, 3, 1, 1),
369 .gpiomux = { 2, 0, 0, 0 },
370 .gpiomute = 10,
371 .tuner_type = UNSET,
372 .tuner_addr = ADDR_UNSET,
373 },
374 [BTTV_BOARD_HAUPPAUGE] = {
375 .name = "Hauppauge (bt848)",
376 .video_inputs = 4,
377 /* .audio_inputs= 1, */
378 .svhs = 2,
379 .gpiomask = 7,
380 .muxsel = MUXSEL(2, 3, 1, 1),
381 .gpiomux = { 0, 1, 2, 3 },
382 .gpiomute = 4,
383 .tuner_type = UNSET,
384 .tuner_addr = ADDR_UNSET,
385 },
386 [BTTV_BOARD_STB] = {
387 .name = "STB, Gateway P/N 6000699 (bt848)",
388 .video_inputs = 3,
389 /* .audio_inputs= 1, */
390 .svhs = 2,
391 .gpiomask = 7,
392 .muxsel = MUXSEL(2, 3, 1, 1),
393 .gpiomux = { 4, 0, 2, 3 },
394 .gpiomute = 1,
395 .no_msp34xx = 1,
396 .tuner_type = TUNER_PHILIPS_NTSC,
397 .tuner_addr = ADDR_UNSET,
398 .pll = PLL_28,
399 .has_radio = 1,
400 },
401
402 /* ---- card 0x04 ---------------------------------- */
403 [BTTV_BOARD_INTEL] = {
404 .name = "Intel Create and Share PCI/ Smart Video Recorder III",
405 .video_inputs = 4,
406 /* .audio_inputs= 0, */
407 .svhs = 2,
408 .gpiomask = 0,
409 .muxsel = MUXSEL(2, 3, 1, 1),
410 .gpiomux = { 0 },
411 .tuner_type = TUNER_ABSENT,
412 .tuner_addr = ADDR_UNSET,
413 },
414 [BTTV_BOARD_DIAMOND] = {
415 .name = "Diamond DTV2000",
416 .video_inputs = 4,
417 /* .audio_inputs= 1, */
418 .svhs = 2,
419 .gpiomask = 3,
420 .muxsel = MUXSEL(2, 3, 1, 0),
421 .gpiomux = { 0, 1, 0, 1 },
422 .gpiomute = 3,
423 .tuner_type = UNSET,
424 .tuner_addr = ADDR_UNSET,
425 },
426 [BTTV_BOARD_AVERMEDIA] = {
427 .name = "AVerMedia TVPhone",
428 .video_inputs = 3,
429 /* .audio_inputs= 1, */
430 .svhs = 3,
431 .muxsel = MUXSEL(2, 3, 1, 1),
432 .gpiomask = 0x0f,
433 .gpiomux = { 0x0c, 0x04, 0x08, 0x04 },
434 /* 0x04 for some cards ?? */
435 .tuner_type = UNSET,
436 .tuner_addr = ADDR_UNSET,
437 .audio_mode_gpio= avermedia_tvphone_audio,
438 .has_remote = 1,
439 },
440 [BTTV_BOARD_MATRIX_VISION] = {
441 .name = "MATRIX-Vision MV-Delta",
442 .video_inputs = 5,
443 /* .audio_inputs= 1, */
444 .svhs = 3,
445 .gpiomask = 0,
446 .muxsel = MUXSEL(2, 3, 1, 0, 0),
447 .gpiomux = { 0 },
448 .tuner_type = TUNER_ABSENT,
449 .tuner_addr = ADDR_UNSET,
450 },
451
452 /* ---- card 0x08 ---------------------------------- */
453 [BTTV_BOARD_FLYVIDEO] = {
454 .name = "Lifeview FlyVideo II (Bt848) LR26 / MAXI TV Video PCI2 LR26",
455 .video_inputs = 4,
456 /* .audio_inputs= 1, */
457 .svhs = 2,
458 .gpiomask = 0xc00,
459 .muxsel = MUXSEL(2, 3, 1, 1),
460 .gpiomux = { 0, 0xc00, 0x800, 0x400 },
461 .gpiomute = 0xc00,
462 .pll = PLL_28,
463 .tuner_type = UNSET,
464 .tuner_addr = ADDR_UNSET,
465 },
466 [BTTV_BOARD_TURBOTV] = {
467 .name = "IMS/IXmicro TurboTV",
468 .video_inputs = 3,
469 /* .audio_inputs= 1, */
470 .svhs = 2,
471 .gpiomask = 3,
472 .muxsel = MUXSEL(2, 3, 1, 1),
473 .gpiomux = { 1, 1, 2, 3 },
474 .pll = PLL_28,
475 .tuner_type = TUNER_TEMIC_PAL,
476 .tuner_addr = ADDR_UNSET,
477 },
478 [BTTV_BOARD_HAUPPAUGE878] = {
479 .name = "Hauppauge (bt878)",
480 .video_inputs = 4,
481 /* .audio_inputs= 1, */
482 .svhs = 2,
483 .gpiomask = 0x0f, /* old: 7 */
484 .muxsel = MUXSEL(2, 0, 1, 1),
485 .gpiomux = { 0, 1, 2, 3 },
486 .gpiomute = 4,
487 .pll = PLL_28,
488 .tuner_type = UNSET,
489 .tuner_addr = ADDR_UNSET,
490 },
491 [BTTV_BOARD_MIROPRO] = {
492 .name = "MIRO PCTV pro",
493 .video_inputs = 3,
494 /* .audio_inputs= 1, */
495 .svhs = 2,
496 .gpiomask = 0x3014f,
497 .muxsel = MUXSEL(2, 3, 1, 1),
498 .gpiomux = { 0x20001,0x10001, 0, 0 },
499 .gpiomute = 10,
500 .tuner_type = UNSET,
501 .tuner_addr = ADDR_UNSET,
502 },
503
504 /* ---- card 0x0c ---------------------------------- */
505 [BTTV_BOARD_ADSTECH_TV] = {
506 .name = "ADS Technologies Channel Surfer TV (bt848)",
507 .video_inputs = 3,
508 /* .audio_inputs= 1, */
509 .svhs = 2,
510 .gpiomask = 15,
511 .muxsel = MUXSEL(2, 3, 1, 1),
512 .gpiomux = { 13, 14, 11, 7 },
513 .tuner_type = UNSET,
514 .tuner_addr = ADDR_UNSET,
515 },
516 [BTTV_BOARD_AVERMEDIA98] = {
517 .name = "AVerMedia TVCapture 98",
518 .video_inputs = 3,
519 /* .audio_inputs= 4, */
520 .svhs = 2,
521 .gpiomask = 15,
522 .muxsel = MUXSEL(2, 3, 1, 1),
523 .gpiomux = { 13, 14, 11, 7 },
524 .msp34xx_alt = 1,
525 .pll = PLL_28,
526 .tuner_type = TUNER_PHILIPS_PAL,
527 .tuner_addr = ADDR_UNSET,
528 .audio_mode_gpio= avermedia_tv_stereo_audio,
529 .no_gpioirq = 1,
530 },
531 [BTTV_BOARD_VHX] = {
532 .name = "Aimslab Video Highway Xtreme (VHX)",
533 .video_inputs = 3,
534 /* .audio_inputs= 1, */
535 .svhs = 2,
536 .gpiomask = 7,
537 .muxsel = MUXSEL(2, 3, 1, 1),
538 .gpiomux = { 0, 2, 1, 3 }, /* old: {0, 1, 2, 3, 4} */
539 .gpiomute = 4,
540 .pll = PLL_28,
541 .tuner_type = UNSET,
542 .tuner_addr = ADDR_UNSET,
543 },
544 [BTTV_BOARD_ZOLTRIX] = {
545 .name = "Zoltrix TV-Max",
546 .video_inputs = 3,
547 /* .audio_inputs= 1, */
548 .svhs = 2,
549 .gpiomask = 15,
550 .muxsel = MUXSEL(2, 3, 1, 1),
551 .gpiomux = { 0, 0, 1, 0 },
552 .gpiomute = 10,
553 .tuner_type = UNSET,
554 .tuner_addr = ADDR_UNSET,
555 },
556
557 /* ---- card 0x10 ---------------------------------- */
558 [BTTV_BOARD_PIXVIEWPLAYTV] = {
559 .name = "Prolink Pixelview PlayTV (bt878)",
560 .video_inputs = 3,
561 /* .audio_inputs= 1, */
562 .svhs = 2,
563 .gpiomask = 0x01fe00,
564 .muxsel = MUXSEL(2, 3, 1, 1),
565 /* 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru> */
566 .gpiomux = { 0x001e00, 0, 0x018000, 0x014000 },
567 .gpiomute = 0x002000,
568 .pll = PLL_28,
569 .tuner_type = UNSET,
570 .tuner_addr = ADDR_UNSET,
571 },
572 [BTTV_BOARD_WINVIEW_601] = {
573 .name = "Leadtek WinView 601",
574 .video_inputs = 3,
575 /* .audio_inputs= 1, */
576 .svhs = 2,
577 .gpiomask = 0x8300f8,
578 .muxsel = MUXSEL(2, 3, 1, 1, 0),
579 .gpiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007 },
580 .gpiomute = 0xcfa007,
581 .tuner_type = UNSET,
582 .tuner_addr = ADDR_UNSET,
583 .volume_gpio = winview_volume,
584 .has_radio = 1,
585 },
586 [BTTV_BOARD_AVEC_INTERCAP] = {
587 .name = "AVEC Intercapture",
588 .video_inputs = 3,
589 /* .audio_inputs= 2, */
590 .svhs = 2,
591 .gpiomask = 0,
592 .muxsel = MUXSEL(2, 3, 1, 1),
593 .gpiomux = { 1, 0, 0, 0 },
594 .tuner_type = UNSET,
595 .tuner_addr = ADDR_UNSET,
596 },
597 [BTTV_BOARD_LIFE_FLYKIT] = {
598 .name = "Lifeview FlyVideo II EZ /FlyKit LR38 Bt848 (capture only)",
599 .video_inputs = 4,
600 /* .audio_inputs= 1, */
601 .svhs = NO_SVHS,
602 .gpiomask = 0x8dff00,
603 .muxsel = MUXSEL(2, 3, 1, 1),
604 .gpiomux = { 0 },
605 .no_msp34xx = 1,
606 .tuner_type = TUNER_ABSENT,
607 .tuner_addr = ADDR_UNSET,
608 },
609
610 /* ---- card 0x14 ---------------------------------- */
611 [BTTV_BOARD_CEI_RAFFLES] = {
612 .name = "CEI Raffles Card",
613 .video_inputs = 3,
614 /* .audio_inputs= 3, */
615 .svhs = 2,
616 .muxsel = MUXSEL(2, 3, 1, 1),
617 .tuner_type = UNSET,
618 .tuner_addr = ADDR_UNSET,
619 },
620 [BTTV_BOARD_CONFERENCETV] = {
621 .name = "Lifeview FlyVideo 98/ Lucky Star Image World ConferenceTV LR50",
622 .video_inputs = 4,
623 /* .audio_inputs= 2, tuner, line in */
624 .svhs = 2,
625 .gpiomask = 0x1800,
626 .muxsel = MUXSEL(2, 3, 1, 1),
627 .gpiomux = { 0, 0x800, 0x1000, 0x1000 },
628 .gpiomute = 0x1800,
629 .pll = PLL_28,
630 .tuner_type = TUNER_PHILIPS_PAL_I,
631 .tuner_addr = ADDR_UNSET,
632 },
633 [BTTV_BOARD_PHOEBE_TVMAS] = {
634 .name = "Askey CPH050/ Phoebe Tv Master + FM",
635 .video_inputs = 3,
636 /* .audio_inputs= 1, */
637 .svhs = 2,
638 .gpiomask = 0xc00,
639 .muxsel = MUXSEL(2, 3, 1, 1),
640 .gpiomux = { 0, 1, 0x800, 0x400 },
641 .gpiomute = 0xc00,
642 .pll = PLL_28,
643 .tuner_type = UNSET,
644 .tuner_addr = ADDR_UNSET,
645 },
646 [BTTV_BOARD_MODTEC_205] = {
647 .name = "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV, bt878",
648 .video_inputs = 3,
649 /* .audio_inputs= 1, */
650 .svhs = NO_SVHS,
651 .has_dig_in = 1,
652 .gpiomask = 7,
653 .muxsel = MUXSEL(2, 3, 0), /* input 2 is digital */
654 /* .digital_mode= DIGITAL_MODE_CAMERA, */
655 .gpiomux = { 0, 0, 0, 0 },
656 .no_msp34xx = 1,
657 .pll = PLL_28,
658 .tuner_type = TUNER_ALPS_TSBB5_PAL_I,
659 .tuner_addr = ADDR_UNSET,
660 },
661
662 /* ---- card 0x18 ---------------------------------- */
663 [BTTV_BOARD_MAGICTVIEW061] = {
664 .name = "Askey CPH05X/06X (bt878) [many vendors]",
665 .video_inputs = 3,
666 /* .audio_inputs= 1, */
667 .svhs = 2,
668 .gpiomask = 0xe00,
669 .muxsel = MUXSEL(2, 3, 1, 1),
670 .gpiomux = {0x400, 0x400, 0x400, 0x400 },
671 .gpiomute = 0xc00,
672 .pll = PLL_28,
673 .tuner_type = UNSET,
674 .tuner_addr = ADDR_UNSET,
675 .has_remote = 1,
676 .has_radio = 1, /* not every card has radio */
677 },
678 [BTTV_BOARD_VOBIS_BOOSTAR] = {
679 .name = "Terratec TerraTV+ Version 1.0 (Bt848)/ Terra TValue Version 1.0/ Vobis TV-Boostar",
680 .video_inputs = 3,
681 /* .audio_inputs= 1, */
682 .svhs = 2,
683 .gpiomask = 0x1f0fff,
684 .muxsel = MUXSEL(2, 3, 1, 1),
685 .gpiomux = { 0x20000, 0x30000, 0x10000, 0 },
686 .gpiomute = 0x40000,
687 .tuner_type = TUNER_PHILIPS_PAL,
688 .tuner_addr = ADDR_UNSET,
689 .audio_mode_gpio= terratv_audio,
690 },
691 [BTTV_BOARD_HAUPPAUG_WCAM] = {
692 .name = "Hauppauge WinCam newer (bt878)",
693 .video_inputs = 4,
694 /* .audio_inputs= 1, */
695 .svhs = 3,
696 .gpiomask = 7,
697 .muxsel = MUXSEL(2, 0, 1, 1),
698 .gpiomux = { 0, 1, 2, 3 },
699 .gpiomute = 4,
700 .tuner_type = UNSET,
701 .tuner_addr = ADDR_UNSET,
702 },
703 [BTTV_BOARD_MAXI] = {
704 .name = "Lifeview FlyVideo 98/ MAXI TV Video PCI2 LR50",
705 .video_inputs = 4,
706 /* .audio_inputs= 2, */
707 .svhs = 2,
708 .gpiomask = 0x1800,
709 .muxsel = MUXSEL(2, 3, 1, 1),
710 .gpiomux = { 0, 0x800, 0x1000, 0x1000 },
711 .gpiomute = 0x1800,
712 .pll = PLL_28,
713 .tuner_type = TUNER_PHILIPS_SECAM,
714 .tuner_addr = ADDR_UNSET,
715 },
716
717 /* ---- card 0x1c ---------------------------------- */
718 [BTTV_BOARD_TERRATV] = {
719 .name = "Terratec TerraTV+ Version 1.1 (bt878)",
720 .video_inputs = 3,
721 /* .audio_inputs= 1, */
722 .svhs = 2,
723 .gpiomask = 0x1f0fff,
724 .muxsel = MUXSEL(2, 3, 1, 1),
725 .gpiomux = { 0x20000, 0x30000, 0x10000, 0x00000 },
726 .gpiomute = 0x40000,
727 .tuner_type = TUNER_PHILIPS_PAL,
728 .tuner_addr = ADDR_UNSET,
729 .audio_mode_gpio= terratv_audio,
730 /* GPIO wiring:
731 External 20 pin connector (for Active Radio Upgrade board)
732 gpio00: i2c-sda
733 gpio01: i2c-scl
734 gpio02: om5610-data
735 gpio03: om5610-clk
736 gpio04: om5610-wre
737 gpio05: om5610-stereo
738 gpio06: rds6588-davn
739 gpio07: Pin 7 n.c.
740 gpio08: nIOW
741 gpio09+10: nIOR, nSEL ?? (bt878)
742 gpio09: nIOR (bt848)
743 gpio10: nSEL (bt848)
744 Sound Routing:
745 gpio16: u2-A0 (1st 4052bt)
746 gpio17: u2-A1
747 gpio18: u2-nEN
748 gpio19: u4-A0 (2nd 4052)
749 gpio20: u4-A1
750 u4-nEN - GND
751 Btspy:
752 00000 : Cdrom (internal audio input)
753 10000 : ext. Video audio input
754 20000 : TV Mono
755 a0000 : TV Mono/2
756 1a0000 : TV Stereo
757 30000 : Radio
758 40000 : Mute
759 */
760
761 },
762 [BTTV_BOARD_PXC200] = {
763 /* Jannik Fritsch <jannik@techfak.uni-bielefeld.de> */
764 .name = "Imagenation PXC200",
765 .video_inputs = 5,
766 /* .audio_inputs= 1, */
767 .svhs = 1, /* was: 4 */
768 .gpiomask = 0,
769 .muxsel = MUXSEL(2, 3, 1, 0, 0),
770 .gpiomux = { 0 },
771 .tuner_type = TUNER_ABSENT,
772 .tuner_addr = ADDR_UNSET,
773 .muxsel_hook = PXC200_muxsel,
774
775 },
776 [BTTV_BOARD_FLYVIDEO_98] = {
777 .name = "Lifeview FlyVideo 98 LR50",
778 .video_inputs = 4,
779 /* .audio_inputs= 1, */
780 .svhs = 2,
781 .gpiomask = 0x1800, /* 0x8dfe00 */
782 .muxsel = MUXSEL(2, 3, 1, 1),
783 .gpiomux = { 0, 0x0800, 0x1000, 0x1000 },
784 .gpiomute = 0x1800,
785 .pll = PLL_28,
786 .tuner_type = UNSET,
787 .tuner_addr = ADDR_UNSET,
788 },
789 [BTTV_BOARD_IPROTV] = {
790 .name = "Formac iProTV, Formac ProTV I (bt848)",
791 .video_inputs = 4,
792 /* .audio_inputs= 1, */
793 .svhs = 3,
794 .gpiomask = 1,
795 .muxsel = MUXSEL(2, 3, 1, 1),
796 .gpiomux = { 1, 0, 0, 0 },
797 .pll = PLL_28,
798 .tuner_type = TUNER_PHILIPS_PAL,
799 .tuner_addr = ADDR_UNSET,
800 },
801
802 /* ---- card 0x20 ---------------------------------- */
803 [BTTV_BOARD_INTEL_C_S_PCI] = {
804 .name = "Intel Create and Share PCI/ Smart Video Recorder III",
805 .video_inputs = 4,
806 /* .audio_inputs= 0, */
807 .svhs = 2,
808 .gpiomask = 0,
809 .muxsel = MUXSEL(2, 3, 1, 1),
810 .gpiomux = { 0 },
811 .tuner_type = TUNER_ABSENT,
812 .tuner_addr = ADDR_UNSET,
813 },
814 [BTTV_BOARD_TERRATVALUE] = {
815 .name = "Terratec TerraTValue Version Bt878",
816 .video_inputs = 3,
817 /* .audio_inputs= 1, */
818 .svhs = 2,
819 .gpiomask = 0xffff00,
820 .muxsel = MUXSEL(2, 3, 1, 1),
821 .gpiomux = { 0x500, 0, 0x300, 0x900 },
822 .gpiomute = 0x900,
823 .pll = PLL_28,
824 .tuner_type = TUNER_PHILIPS_PAL,
825 .tuner_addr = ADDR_UNSET,
826 },
827 [BTTV_BOARD_WINFAST2000] = {
828 .name = "Leadtek WinFast 2000/ WinFast 2000 XP",
829 .video_inputs = 4,
830 /* .audio_inputs= 1, */
831 .svhs = 2,
832 /* TV, CVid, SVid, CVid over SVid connector */
833 .muxsel = MUXSEL(2, 3, 1, 1, 0),
834 /* Alexander Varakin <avarakin@hotmail.com> [stereo version] */
835 .gpiomask = 0xb33000,
836 .gpiomux = { 0x122000,0x1000,0x0000,0x620000 },
837 .gpiomute = 0x800000,
838 /* Audio Routing for "WinFast 2000 XP" (no tv stereo !)
839 gpio23 -- hef4052:nEnable (0x800000)
840 gpio12 -- hef4052:A1
841 gpio13 -- hef4052:A0
842 0x0000: external audio
843 0x1000: FM
844 0x2000: TV
845 0x3000: n.c.
846 Note: There exists another variant "Winfast 2000" with tv stereo !?
847 Note: eeprom only contains FF and pci subsystem id 107d:6606
848 */
849 .pll = PLL_28,
850 .has_radio = 1,
851 .tuner_type = TUNER_PHILIPS_PAL, /* default for now, gpio reads BFFF06 for Pal bg+dk */
852 .tuner_addr = ADDR_UNSET,
853 .audio_mode_gpio= winfast2000_audio,
854 .has_remote = 1,
855 },
856 [BTTV_BOARD_CHRONOS_VS2] = {
857 .name = "Lifeview FlyVideo 98 LR50 / Chronos Video Shuttle II",
858 .video_inputs = 4,
859 /* .audio_inputs= 3, */
860 .svhs = 2,
861 .gpiomask = 0x1800,
862 .muxsel = MUXSEL(2, 3, 1, 1),
863 .gpiomux = { 0, 0x800, 0x1000, 0x1000 },
864 .gpiomute = 0x1800,
865 .pll = PLL_28,
866 .tuner_type = UNSET,
867 .tuner_addr = ADDR_UNSET,
868 },
869
870 /* ---- card 0x24 ---------------------------------- */
871 [BTTV_BOARD_TYPHOON_TVIEW] = {
872 .name = "Lifeview FlyVideo 98FM LR50 / Typhoon TView TV/FM Tuner",
873 .video_inputs = 4,
874 /* .audio_inputs= 3, */
875 .svhs = 2,
876 .gpiomask = 0x1800,
877 .muxsel = MUXSEL(2, 3, 1, 1),
878 .gpiomux = { 0, 0x800, 0x1000, 0x1000 },
879 .gpiomute = 0x1800,
880 .pll = PLL_28,
881 .tuner_type = UNSET,
882 .tuner_addr = ADDR_UNSET,
883 .has_radio = 1,
884 },
885 [BTTV_BOARD_PXELVWPLTVPRO] = {
886 .name = "Prolink PixelView PlayTV pro",
887 .video_inputs = 3,
888 /* .audio_inputs= 1, */
889 .svhs = 2,
890 .gpiomask = 0xff,
891 .muxsel = MUXSEL(2, 3, 1, 1),
892 .gpiomux = { 0x21, 0x20, 0x24, 0x2c },
893 .gpiomute = 0x29,
894 .no_msp34xx = 1,
895 .pll = PLL_28,
896 .tuner_type = UNSET,
897 .tuner_addr = ADDR_UNSET,
898 },
899 [BTTV_BOARD_MAGICTVIEW063] = {
900 .name = "Askey CPH06X TView99",
901 .video_inputs = 4,
902 /* .audio_inputs= 1, */
903 .svhs = 2,
904 .gpiomask = 0x551e00,
905 .muxsel = MUXSEL(2, 3, 1, 0),
906 .gpiomux = { 0x551400, 0x551200, 0, 0 },
907 .gpiomute = 0x551c00,
908 .pll = PLL_28,
909 .tuner_type = TUNER_PHILIPS_PAL_I,
910 .tuner_addr = ADDR_UNSET,
911 .has_remote = 1,
912 },
913 [BTTV_BOARD_PINNACLE] = {
914 .name = "Pinnacle PCTV Studio/Rave",
915 .video_inputs = 3,
916 /* .audio_inputs= 1, */
917 .svhs = 2,
918 .gpiomask = 0x03000F,
919 .muxsel = MUXSEL(2, 3, 1, 1),
920 .gpiomux = { 2, 0xd0001, 0, 0 },
921 .gpiomute = 1,
922 .pll = PLL_28,
923 .tuner_type = UNSET,
924 .tuner_addr = ADDR_UNSET,
925 },
926
927 /* ---- card 0x28 ---------------------------------- */
928 [BTTV_BOARD_STB2] = {
929 .name = "STB TV PCI FM, Gateway P/N 6000704 (bt878), 3Dfx VoodooTV 100",
930 .video_inputs = 3,
931 /* .audio_inputs= 1, */
932 .svhs = 2,
933 .gpiomask = 7,
934 .muxsel = MUXSEL(2, 3, 1, 1),
935 .gpiomux = { 4, 0, 2, 3 },
936 .gpiomute = 1,
937 .no_msp34xx = 1,
938 .tuner_type = TUNER_PHILIPS_NTSC,
939 .tuner_addr = ADDR_UNSET,
940 .pll = PLL_28,
941 .has_radio = 1,
942 },
943 [BTTV_BOARD_AVPHONE98] = {
944 .name = "AVerMedia TVPhone 98",
945 .video_inputs = 3,
946 /* .audio_inputs= 4, */
947 .svhs = 2,
948 .gpiomask = 15,
949 .muxsel = MUXSEL(2, 3, 1, 1),
950 .gpiomux = { 13, 4, 11, 7 },
951 .pll = PLL_28,
952 .tuner_type = UNSET,
953 .tuner_addr = ADDR_UNSET,
954 .has_radio = 1,
955 .audio_mode_gpio= avermedia_tvphone_audio,
956 },
957 [BTTV_BOARD_PV951] = {
958 .name = "ProVideo PV951", /* pic16c54 */
959 .video_inputs = 3,
960 /* .audio_inputs= 1, */
961 .svhs = 2,
962 .gpiomask = 0,
963 .muxsel = MUXSEL(2, 3, 1, 1),
964 .gpiomux = { 0, 0, 0, 0},
965 .no_msp34xx = 1,
966 .pll = PLL_28,
967 .tuner_type = TUNER_PHILIPS_PAL_I,
968 .tuner_addr = ADDR_UNSET,
969 },
970 [BTTV_BOARD_ONAIR_TV] = {
971 .name = "Little OnAir TV",
972 .video_inputs = 3,
973 /* .audio_inputs= 1, */
974 .svhs = 2,
975 .gpiomask = 0xe00b,
976 .muxsel = MUXSEL(2, 3, 1, 1),
977 .gpiomux = { 0xff9ff6, 0xff9ff6, 0xff1ff7, 0 },
978 .gpiomute = 0xff3ffc,
979 .no_msp34xx = 1,
980 .tuner_type = UNSET,
981 .tuner_addr = ADDR_UNSET,
982 },
983
984 /* ---- card 0x2c ---------------------------------- */
985 [BTTV_BOARD_SIGMA_TVII_FM] = {
986 .name = "Sigma TVII-FM",
987 .video_inputs = 2,
988 /* .audio_inputs= 1, */
989 .svhs = NO_SVHS,
990 .gpiomask = 3,
991 .muxsel = MUXSEL(2, 3, 1, 1),
992 .gpiomux = { 1, 1, 0, 2 },
993 .gpiomute = 3,
994 .no_msp34xx = 1,
995 .pll = PLL_NONE,
996 .tuner_type = UNSET,
997 .tuner_addr = ADDR_UNSET,
998 },
999 [BTTV_BOARD_MATRIX_VISION2] = {
1000 .name = "MATRIX-Vision MV-Delta 2",
1001 .video_inputs = 5,
1002 /* .audio_inputs= 1, */
1003 .svhs = 3,
1004 .gpiomask = 0,
1005 .muxsel = MUXSEL(2, 3, 1, 0, 0),
1006 .gpiomux = { 0 },
1007 .no_msp34xx = 1,
1008 .pll = PLL_28,
1009 .tuner_type = TUNER_ABSENT,
1010 .tuner_addr = ADDR_UNSET,
1011 },
1012 [BTTV_BOARD_ZOLTRIX_GENIE] = {
1013 .name = "Zoltrix Genie TV/FM",
1014 .video_inputs = 3,
1015 /* .audio_inputs= 1, */
1016 .svhs = 2,
1017 .gpiomask = 0xbcf03f,
1018 .muxsel = MUXSEL(2, 3, 1, 1),
1019 .gpiomux = { 0xbc803f, 0xbc903f, 0xbcb03f, 0 },
1020 .gpiomute = 0xbcb03f,
1021 .no_msp34xx = 1,
1022 .pll = PLL_28,
1023 .tuner_type = TUNER_TEMIC_4039FR5_NTSC,
1024 .tuner_addr = ADDR_UNSET,
1025 },
1026 [BTTV_BOARD_TERRATVRADIO] = {
1027 .name = "Terratec TV/Radio+",
1028 .video_inputs = 3,
1029 /* .audio_inputs= 1, */
1030 .svhs = 2,
1031 .gpiomask = 0x70000,
1032 .muxsel = MUXSEL(2, 3, 1, 1),
1033 .gpiomux = { 0x20000, 0x30000, 0x10000, 0 },
1034 .gpiomute = 0x40000,
1035 .no_msp34xx = 1,
1036 .pll = PLL_35,
1037 .tuner_type = TUNER_PHILIPS_PAL_I,
1038 .tuner_addr = ADDR_UNSET,
1039 .has_radio = 1,
1040 },
1041
1042 /* ---- card 0x30 ---------------------------------- */
1043 [BTTV_BOARD_DYNALINK] = {
1044 .name = "Askey CPH03x/ Dynalink Magic TView",
1045 .video_inputs = 3,
1046 /* .audio_inputs= 1, */
1047 .svhs = 2,
1048 .gpiomask = 15,
1049 .muxsel = MUXSEL(2, 3, 1, 1),
1050 .gpiomux = {2,0,0,0 },
1051 .gpiomute = 1,
1052 .pll = PLL_28,
1053 .tuner_type = UNSET,
1054 .tuner_addr = ADDR_UNSET,
1055 },
1056 [BTTV_BOARD_GVBCTV3PCI] = {
1057 .name = "IODATA GV-BCTV3/PCI",
1058 .video_inputs = 3,
1059 /* .audio_inputs= 1, */
1060 .svhs = 2,
1061 .gpiomask = 0x010f00,
1062 .muxsel = MUXSEL(2, 3, 0, 0),
1063 .gpiomux = {0x10000, 0, 0x10000, 0 },
1064 .no_msp34xx = 1,
1065 .pll = PLL_28,
1066 .tuner_type = TUNER_ALPS_TSHC6_NTSC,
1067 .tuner_addr = ADDR_UNSET,
1068 .audio_mode_gpio= gvbctv3pci_audio,
1069 },
1070 [BTTV_BOARD_PXELVWPLTVPAK] = {
1071 .name = "Prolink PV-BT878P+4E / PixelView PlayTV PAK / Lenco MXTV-9578 CP",
1072 .video_inputs = 5,
1073 /* .audio_inputs= 1, */
1074 .svhs = 3,
1075 .has_dig_in = 1,
1076 .gpiomask = 0xAA0000,
1077 .muxsel = MUXSEL(2, 3, 1, 1, 0), /* in 4 is digital */
1078 /* .digital_mode= DIGITAL_MODE_CAMERA, */
1079 .gpiomux = { 0x20000, 0, 0x80000, 0x80000 },
1080 .gpiomute = 0xa8000,
1081 .no_msp34xx = 1,
1082 .pll = PLL_28,
1083 .tuner_type = TUNER_PHILIPS_PAL_I,
1084 .tuner_addr = ADDR_UNSET,
1085 .has_remote = 1,
1086 /* GPIO wiring: (different from Rev.4C !)
1087 GPIO17: U4.A0 (first hef4052bt)
1088 GPIO19: U4.A1
1089 GPIO20: U5.A1 (second hef4052bt)
1090 GPIO21: U4.nEN
1091 GPIO22: BT832 Reset Line
1092 GPIO23: A5,A0, U5,nEN
1093 Note: At i2c=0x8a is a Bt832 chip, which changes to 0x88 after being reset via GPIO22
1094 */
1095 },
1096 [BTTV_BOARD_EAGLE] = {
1097 .name = "Eagle Wireless Capricorn2 (bt878A)",
1098 .video_inputs = 4,
1099 /* .audio_inputs= 1, */
1100 .svhs = 2,
1101 .gpiomask = 7,
1102 .muxsel = MUXSEL(2, 0, 1, 1),
1103 .gpiomux = { 0, 1, 2, 3 },
1104 .gpiomute = 4,
1105 .pll = PLL_28,
1106 .tuner_type = UNSET /* TUNER_ALPS_TMDH2_NTSC */,
1107 .tuner_addr = ADDR_UNSET,
1108 },
1109
1110 /* ---- card 0x34 ---------------------------------- */
1111 [BTTV_BOARD_PINNACLEPRO] = {
1112 /* David Härdeman <david@2gen.com> */
1113 .name = "Pinnacle PCTV Studio Pro",
1114 .video_inputs = 4,
1115 /* .audio_inputs= 1, */
1116 .svhs = 3,
1117 .gpiomask = 0x03000F,
1118 .muxsel = MUXSEL(2, 3, 1, 1),
1119 .gpiomux = { 1, 0xd0001, 0, 0 },
1120 .gpiomute = 10,
1121 /* sound path (5 sources):
1122 MUX1 (mask 0x03), Enable Pin 0x08 (0=enable, 1=disable)
1123 0= ext. Audio IN
1124 1= from MUX2
1125 2= Mono TV sound from Tuner
1126 3= not connected
1127 MUX2 (mask 0x30000):
1128 0,2,3= from MSP34xx
1129 1= FM stereo Radio from Tuner */
1130 .pll = PLL_28,
1131 .tuner_type = UNSET,
1132 .tuner_addr = ADDR_UNSET,
1133 },
1134 [BTTV_BOARD_TVIEW_RDS_FM] = {
1135 /* Claas Langbehn <claas@bigfoot.com>,
1136 Sven Grothklags <sven@upb.de> */
1137 .name = "Typhoon TView RDS + FM Stereo / KNC1 TV Station RDS",
1138 .video_inputs = 4,
1139 /* .audio_inputs= 3, */
1140 .svhs = 2,
1141 .gpiomask = 0x1c,
1142 .muxsel = MUXSEL(2, 3, 1, 1),
1143 .gpiomux = { 0, 0, 0x10, 8 },
1144 .gpiomute = 4,
1145 .pll = PLL_28,
1146 .tuner_type = TUNER_PHILIPS_PAL,
1147 .tuner_addr = ADDR_UNSET,
1148 .has_radio = 1,
1149 },
1150 [BTTV_BOARD_LIFETEC_9415] = {
1151 /* Tim Röstermundt <rosterm@uni-muenster.de>
1152 in de.comp.os.unix.linux.hardware:
1153 options bttv card=0 pll=1 radio=1 gpiomask=0x18e0
1154 gpiomux =0x44c71f,0x44d71f,0,0x44d71f,0x44dfff
1155 options tuner type=5 */
1156 .name = "Lifeview FlyVideo 2000 /FlyVideo A2/ Lifetec LT 9415 TV [LR90]",
1157 .video_inputs = 4,
1158 /* .audio_inputs= 1, */
1159 .svhs = 2,
1160 .gpiomask = 0x18e0,
1161 .muxsel = MUXSEL(2, 3, 1, 1),
1162 .gpiomux = { 0x0000,0x0800,0x1000,0x1000 },
1163 .gpiomute = 0x18e0,
1164 /* For cards with tda9820/tda9821:
1165 0x0000: Tuner normal stereo
1166 0x0080: Tuner A2 SAP (second audio program = Zweikanalton)
1167 0x0880: Tuner A2 stereo */
1168 .pll = PLL_28,
1169 .tuner_type = UNSET,
1170 .tuner_addr = ADDR_UNSET,
1171 },
1172 [BTTV_BOARD_BESTBUY_EASYTV] = {
1173 /* Miguel Angel Alvarez <maacruz@navegalia.com>
1174 old Easy TV BT848 version (model CPH031) */
1175 .name = "Askey CPH031/ BESTBUY Easy TV",
1176 .video_inputs = 4,
1177 /* .audio_inputs= 1, */
1178 .svhs = 2,
1179 .gpiomask = 0xF,
1180 .muxsel = MUXSEL(2, 3, 1, 0),
1181 .gpiomux = { 2, 0, 0, 0 },
1182 .gpiomute = 10,
1183 .pll = PLL_28,
1184 .tuner_type = TUNER_TEMIC_PAL,
1185 .tuner_addr = ADDR_UNSET,
1186 },
1187
1188 /* ---- card 0x38 ---------------------------------- */
1189 [BTTV_BOARD_FLYVIDEO_98FM] = {
1190 /* Gordon Heydon <gjheydon@bigfoot.com ('98) */
1191 .name = "Lifeview FlyVideo 98FM LR50",
1192 .video_inputs = 4,
1193 /* .audio_inputs= 3, */
1194 .svhs = 2,
1195 .gpiomask = 0x1800,
1196 .muxsel = MUXSEL(2, 3, 1, 1),
1197 .gpiomux = { 0, 0x800, 0x1000, 0x1000 },
1198 .gpiomute = 0x1800,
1199 .pll = PLL_28,
1200 .tuner_type = TUNER_PHILIPS_PAL,
1201 .tuner_addr = ADDR_UNSET,
1202 },
1203 /* This is the ultimate cheapo capture card
1204 * just a BT848A on a small PCB!
1205 * Steve Hosgood <steve@equiinet.com> */
1206 [BTTV_BOARD_GRANDTEC] = {
1207 .name = "GrandTec 'Grand Video Capture' (Bt848)",
1208 .video_inputs = 2,
1209 /* .audio_inputs= 0, */
1210 .svhs = 1,
1211 .gpiomask = 0,
1212 .muxsel = MUXSEL(3, 1),
1213 .gpiomux = { 0 },
1214 .no_msp34xx = 1,
1215 .pll = PLL_35,
1216 .tuner_type = TUNER_ABSENT,
1217 .tuner_addr = ADDR_UNSET,
1218 },
1219 [BTTV_BOARD_ASKEY_CPH060] = {
1220 /* Daniel Herrington <daniel.herrington@home.com> */
1221 .name = "Askey CPH060/ Phoebe TV Master Only (No FM)",
1222 .video_inputs = 3,
1223 /* .audio_inputs= 1, */
1224 .svhs = 2,
1225 .gpiomask = 0xe00,
1226 .muxsel = MUXSEL(2, 3, 1, 1),
1227 .gpiomux = { 0x400, 0x400, 0x400, 0x400 },
1228 .gpiomute = 0x800,
1229 .pll = PLL_28,
1230 .tuner_type = TUNER_TEMIC_4036FY5_NTSC,
1231 .tuner_addr = ADDR_UNSET,
1232 },
1233 [BTTV_BOARD_ASKEY_CPH03X] = {
1234 /* Matti Mottus <mottus@physic.ut.ee> */
1235 .name = "Askey CPH03x TV Capturer",
1236 .video_inputs = 4,
1237 /* .audio_inputs= 1, */
1238 .svhs = 2,
1239 .gpiomask = 0x03000F,
1240 .muxsel = MUXSEL(2, 3, 1, 0),
1241 .gpiomux = { 2, 0, 0, 0 },
1242 .gpiomute = 1,
1243 .pll = PLL_28,
1244 .tuner_type = TUNER_TEMIC_PAL,
1245 .tuner_addr = ADDR_UNSET,
1246 .has_remote = 1,
1247 },
1248
1249 /* ---- card 0x3c ---------------------------------- */
1250 [BTTV_BOARD_MM100PCTV] = {
1251 /* Philip Blundell <philb@gnu.org> */
1252 .name = "Modular Technology MM100PCTV",
1253 .video_inputs = 2,
1254 /* .audio_inputs= 2, */
1255 .svhs = NO_SVHS,
1256 .gpiomask = 11,
1257 .muxsel = MUXSEL(2, 3, 1, 1),
1258 .gpiomux = { 2, 0, 0, 1 },
1259 .gpiomute = 8,
1260 .pll = PLL_35,
1261 .tuner_type = TUNER_TEMIC_PAL,
1262 .tuner_addr = ADDR_UNSET,
1263 },
1264 [BTTV_BOARD_GMV1] = {
1265 /* Adrian Cox <adrian@humboldt.co.uk */
1266 .name = "AG Electronics GMV1",
1267 .video_inputs = 2,
1268 /* .audio_inputs= 0, */
1269 .svhs = 1,
1270 .gpiomask = 0xF,
1271 .muxsel = MUXSEL(2, 2),
1272 .gpiomux = { },
1273 .no_msp34xx = 1,
1274 .pll = PLL_28,
1275 .tuner_type = TUNER_ABSENT,
1276 .tuner_addr = ADDR_UNSET,
1277 },
1278 [BTTV_BOARD_BESTBUY_EASYTV2] = {
1279 /* Miguel Angel Alvarez <maacruz@navegalia.com>
1280 new Easy TV BT878 version (model CPH061)
1281 special thanks to Informatica Mieres for providing the card */
1282 .name = "Askey CPH061/ BESTBUY Easy TV (bt878)",
1283 .video_inputs = 3,
1284 /* .audio_inputs= 2, */
1285 .svhs = 2,
1286 .gpiomask = 0xFF,
1287 .muxsel = MUXSEL(2, 3, 1, 0),
1288 .gpiomux = { 1, 0, 4, 4 },
1289 .gpiomute = 9,
1290 .pll = PLL_28,
1291 .tuner_type = TUNER_PHILIPS_PAL,
1292 .tuner_addr = ADDR_UNSET,
1293 },
1294 [BTTV_BOARD_ATI_TVWONDER] = {
1295 /* Lukas Gebauer <geby@volny.cz> */
1296 .name = "ATI TV-Wonder",
1297 .video_inputs = 3,
1298 /* .audio_inputs= 1, */
1299 .svhs = 2,
1300 .gpiomask = 0xf03f,
1301 .muxsel = MUXSEL(2, 3, 1, 0),
1302 .gpiomux = { 0xbffe, 0, 0xbfff, 0 },
1303 .gpiomute = 0xbffe,
1304 .pll = PLL_28,
1305 .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL,
1306 .tuner_addr = ADDR_UNSET,
1307 },
1308
1309 /* ---- card 0x40 ---------------------------------- */
1310 [BTTV_BOARD_ATI_TVWONDERVE] = {
1311 /* Lukas Gebauer <geby@volny.cz> */
1312 .name = "ATI TV-Wonder VE",
1313 .video_inputs = 2,
1314 /* .audio_inputs= 1, */
1315 .svhs = NO_SVHS,
1316 .gpiomask = 1,
1317 .muxsel = MUXSEL(2, 3, 0, 1),
1318 .gpiomux = { 0, 0, 1, 0 },
1319 .no_msp34xx = 1,
1320 .pll = PLL_28,
1321 .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL,
1322 .tuner_addr = ADDR_UNSET,
1323 },
1324 [BTTV_BOARD_FLYVIDEO2000] = {
1325 /* DeeJay <deejay@westel900.net (2000S) */
1326 .name = "Lifeview FlyVideo 2000S LR90",
1327 .video_inputs = 3,
1328 /* .audio_inputs= 3, */
1329 .svhs = 2,
1330 .gpiomask = 0x18e0,
1331 .muxsel = MUXSEL(2, 3, 0, 1),
1332 /* Radio changed from 1e80 to 0x800 to make
1333 FlyVideo2000S in .hu happy (gm)*/
1334 /* -dk-???: set mute=0x1800 for tda9874h daughterboard */
1335 .gpiomux = { 0x0000,0x0800,0x1000,0x1000 },
1336 .gpiomute = 0x1800,
1337 .audio_mode_gpio= fv2000s_audio,
1338 .no_msp34xx = 1,
1339 .pll = PLL_28,
1340 .tuner_type = TUNER_PHILIPS_PAL,
1341 .tuner_addr = ADDR_UNSET,
1342 },
1343 [BTTV_BOARD_TERRATVALUER] = {
1344 .name = "Terratec TValueRadio",
1345 .video_inputs = 3,
1346 /* .audio_inputs= 1, */
1347 .svhs = 2,
1348 .gpiomask = 0xffff00,
1349 .muxsel = MUXSEL(2, 3, 1, 1),
1350 .gpiomux = { 0x500, 0x500, 0x300, 0x900 },
1351 .gpiomute = 0x900,
1352 .pll = PLL_28,
1353 .tuner_type = TUNER_PHILIPS_PAL,
1354 .tuner_addr = ADDR_UNSET,
1355 .has_radio = 1,
1356 },
1357 [BTTV_BOARD_GVBCTV4PCI] = {
1358 /* TANAKA Kei <peg00625@nifty.com> */
1359 .name = "IODATA GV-BCTV4/PCI",
1360 .video_inputs = 3,
1361 /* .audio_inputs= 1, */
1362 .svhs = 2,
1363 .gpiomask = 0x010f00,
1364 .muxsel = MUXSEL(2, 3, 0, 0),
1365 .gpiomux = {0x10000, 0, 0x10000, 0 },
1366 .no_msp34xx = 1,
1367 .pll = PLL_28,
1368 .tuner_type = TUNER_SHARP_2U5JF5540_NTSC,
1369 .tuner_addr = ADDR_UNSET,
1370 .audio_mode_gpio= gvbctv3pci_audio,
1371 },
1372
1373 /* ---- card 0x44 ---------------------------------- */
1374 [BTTV_BOARD_VOODOOTV_FM] = {
1375 .name = "3Dfx VoodooTV FM (Euro)",
1376 /* try "insmod msp3400 simple=0" if you have
1377 * sound problems with this card. */
1378 .video_inputs = 4,
1379 /* .audio_inputs= 1, */
1380 .svhs = NO_SVHS,
1381 .gpiomask = 0x4f8a00,
1382 /* 0x100000: 1=MSP enabled (0=disable again)
1383 * 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC) */
1384 .gpiomux = {0x947fff, 0x987fff,0x947fff,0x947fff },
1385 .gpiomute = 0x947fff,
1386 /* tvtuner, radio, external,internal, mute, stereo
1387 * tuner, Composit, SVid, Composit-on-Svid-adapter */
1388 .muxsel = MUXSEL(2, 3, 0, 1),
1389 .tuner_type = TUNER_MT2032,
1390 .tuner_addr = ADDR_UNSET,
1391 .pll = PLL_28,
1392 .has_radio = 1,
1393 },
1394 [BTTV_BOARD_VOODOOTV_200] = {
1395 .name = "VoodooTV 200 (USA)",
1396 /* try "insmod msp3400 simple=0" if you have
1397 * sound problems with this card. */
1398 .video_inputs = 4,
1399 /* .audio_inputs= 1, */
1400 .svhs = NO_SVHS,
1401 .gpiomask = 0x4f8a00,
1402 /* 0x100000: 1=MSP enabled (0=disable again)
1403 * 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC) */
1404 .gpiomux = {0x947fff, 0x987fff,0x947fff,0x947fff },
1405 .gpiomute = 0x947fff,
1406 /* tvtuner, radio, external,internal, mute, stereo
1407 * tuner, Composit, SVid, Composit-on-Svid-adapter */
1408 .muxsel = MUXSEL(2, 3, 0, 1),
1409 .tuner_type = TUNER_MT2032,
1410 .tuner_addr = ADDR_UNSET,
1411 .pll = PLL_28,
1412 .has_radio = 1,
1413 },
1414 [BTTV_BOARD_AIMMS] = {
1415 /* Philip Blundell <pb@nexus.co.uk> */
1416 .name = "Active Imaging AIMMS",
1417 .video_inputs = 1,
1418 /* .audio_inputs= 0, */
1419 .tuner_type = TUNER_ABSENT,
1420 .tuner_addr = ADDR_UNSET,
1421 .pll = PLL_28,
1422 .muxsel = MUXSEL(2),
1423 .gpiomask = 0
1424 },
1425 [BTTV_BOARD_PV_BT878P_PLUS] = {
1426 /* Tomasz Pyra <hellfire@sedez.iq.pl> */
1427 .name = "Prolink Pixelview PV-BT878P+ (Rev.4C,8E)",
1428 .video_inputs = 3,
1429 /* .audio_inputs= 4, */
1430 .svhs = 2,
1431 .gpiomask = 15,
1432 .muxsel = MUXSEL(2, 3, 1, 1),
1433 .gpiomux = { 0, 0, 11, 7 }, /* TV and Radio with same GPIO ! */
1434 .gpiomute = 13,
1435 .pll = PLL_28,
1436 .tuner_type = TUNER_LG_PAL_I_FM,
1437 .tuner_addr = ADDR_UNSET,
1438 .has_remote = 1,
1439 /* GPIO wiring:
1440 GPIO0: U4.A0 (hef4052bt)
1441 GPIO1: U4.A1
1442 GPIO2: U4.A1 (second hef4052bt)
1443 GPIO3: U4.nEN, U5.A0, A5.nEN
1444 GPIO8-15: vrd866b ?
1445 */
1446 },
1447 [BTTV_BOARD_FLYVIDEO98EZ] = {
1448 .name = "Lifeview FlyVideo 98EZ (capture only) LR51",
1449 .video_inputs = 4,
1450 /* .audio_inputs= 0, */
1451 .svhs = 2,
1452 /* AV1, AV2, SVHS, CVid adapter on SVHS */
1453 .muxsel = MUXSEL(2, 3, 1, 1),
1454 .pll = PLL_28,
1455 .no_msp34xx = 1,
1456 .tuner_type = TUNER_ABSENT,
1457 .tuner_addr = ADDR_UNSET,
1458 },
1459
1460 /* ---- card 0x48 ---------------------------------- */
1461 [BTTV_BOARD_PV_BT878P_9B] = {
1462 /* Dariusz Kowalewski <darekk@automex.pl> */
1463 .name = "Prolink Pixelview PV-BT878P+9B (PlayTV Pro rev.9B FM+NICAM)",
1464 .video_inputs = 4,
1465 /* .audio_inputs= 1, */
1466 .svhs = 2,
1467 .gpiomask = 0x3f,
1468 .muxsel = MUXSEL(2, 3, 1, 1),
1469 .gpiomux = { 0x01, 0x00, 0x03, 0x03 },
1470 .gpiomute = 0x09,
1471 .no_msp34xx = 1,
1472 .pll = PLL_28,
1473 .tuner_type = TUNER_PHILIPS_PAL,
1474 .tuner_addr = ADDR_UNSET,
1475 .audio_mode_gpio= pvbt878p9b_audio, /* Note: not all cards have stereo */
1476 .has_radio = 1, /* Note: not all cards have radio */
1477 .has_remote = 1,
1478 /* GPIO wiring:
1479 GPIO0: A0 hef4052
1480 GPIO1: A1 hef4052
1481 GPIO3: nEN hef4052
1482 GPIO8-15: vrd866b
1483 GPIO20,22,23: R30,R29,R28
1484 */
1485 },
1486 [BTTV_BOARD_SENSORAY311_611] = {
1487 /* Clay Kunz <ckunz@mail.arc.nasa.gov> */
1488 /* you must jumper JP5 for the 311 card (PC/104+) to work */
1489 .name = "Sensoray 311/611",
1490 .video_inputs = 5,
1491 /* .audio_inputs= 0, */
1492 .svhs = 4,
1493 .gpiomask = 0,
1494 .muxsel = MUXSEL(2, 3, 1, 0, 0),
1495 .gpiomux = { 0 },
1496 .tuner_type = TUNER_ABSENT,
1497 .tuner_addr = ADDR_UNSET,
1498 },
1499 [BTTV_BOARD_RV605] = {
1500 /* Miguel Freitas <miguel@cetuc.puc-rio.br> */
1501 .name = "RemoteVision MX (RV605)",
1502 .video_inputs = 16,
1503 /* .audio_inputs= 0, */
1504 .svhs = NO_SVHS,
1505 .gpiomask = 0x00,
1506 .gpiomask2 = 0x07ff,
1507 .muxsel = MUXSEL(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3),
1508 .no_msp34xx = 1,
1509 .tuner_type = TUNER_ABSENT,
1510 .tuner_addr = ADDR_UNSET,
1511 .muxsel_hook = rv605_muxsel,
1512 },
1513 [BTTV_BOARD_POWERCLR_MTV878] = {
1514 .name = "Powercolor MTV878/ MTV878R/ MTV878F",
1515 .video_inputs = 3,
1516 /* .audio_inputs= 2, */
1517 .svhs = 2,
1518 .gpiomask = 0x1C800F, /* Bit0-2: Audio select, 8-12:remote control 14:remote valid 15:remote reset */
1519 .muxsel = MUXSEL(2, 1, 1),
1520 .gpiomux = { 0, 1, 2, 2 },
1521 .gpiomute = 4,
1522 .tuner_type = TUNER_PHILIPS_PAL,
1523 .tuner_addr = ADDR_UNSET,
1524 .pll = PLL_28,
1525 .has_radio = 1,
1526 },
1527
1528 /* ---- card 0x4c ---------------------------------- */
1529 [BTTV_BOARD_WINDVR] = {
1530 /* Masaki Suzuki <masaki@btree.org> */
1531 .name = "Canopus WinDVR PCI (COMPAQ Presario 3524JP, 5112JP)",
1532 .video_inputs = 3,
1533 /* .audio_inputs= 1, */
1534 .svhs = 2,
1535 .gpiomask = 0x140007,
1536 .muxsel = MUXSEL(2, 3, 1, 1),
1537 .gpiomux = { 0, 1, 2, 3 },
1538 .gpiomute = 4,
1539 .tuner_type = TUNER_PHILIPS_NTSC,
1540 .tuner_addr = ADDR_UNSET,
1541 .audio_mode_gpio= windvr_audio,
1542 },
1543 [BTTV_BOARD_GRANDTEC_MULTI] = {
1544 .name = "GrandTec Multi Capture Card (Bt878)",
1545 .video_inputs = 4,
1546 /* .audio_inputs= 0, */
1547 .svhs = NO_SVHS,
1548 .gpiomask = 0,
1549 .muxsel = MUXSEL(2, 3, 1, 0),
1550 .gpiomux = { 0 },
1551 .no_msp34xx = 1,
1552 .pll = PLL_28,
1553 .tuner_type = TUNER_ABSENT,
1554 .tuner_addr = ADDR_UNSET,
1555 },
1556 [BTTV_BOARD_KWORLD] = {
1557 .name = "Jetway TV/Capture JW-TV878-FBK, Kworld KW-TV878RF",
1558 .video_inputs = 4,
1559 /* .audio_inputs= 3, */
1560 .svhs = 2,
1561 .gpiomask = 7,
1562 /* Tuner, SVid, SVHS, SVid to SVHS connector */
1563 .muxsel = MUXSEL(2, 3, 1, 1),
1564 .gpiomux = { 0, 0, 4, 4 },/* Yes, this tuner uses the same audio output for TV and FM radio!
1565 * This card lacks external Audio In, so we mute it on Ext. & Int.
1566 * The PCB can take a sbx1637/sbx1673, wiring unknown.
1567 * This card lacks PCI subsystem ID, sigh.
1568 * gpiomux =1: lower volume, 2+3: mute
1569 * btwincap uses 0x80000/0x80003
1570 */
1571 .gpiomute = 4,
1572 .no_msp34xx = 1,
1573 .pll = PLL_28,
1574 .tuner_type = TUNER_PHILIPS_PAL,
1575 .tuner_addr = ADDR_UNSET,
1576 /* Samsung TCPA9095PC27A (BG+DK), philips compatible, w/FM, stereo and
1577 radio signal strength indicators work fine. */
1578 .has_radio = 1,
1579 /* GPIO Info:
1580 GPIO0,1: HEF4052 A0,A1
1581 GPIO2: HEF4052 nENABLE
1582 GPIO3-7: n.c.
1583 GPIO8-13: IRDC357 data0-5 (data6 n.c. ?) [chip not present on my card]
1584 GPIO14,15: ??
1585 GPIO16-21: n.c.
1586 GPIO22,23: ??
1587 ?? : mtu8b56ep microcontroller for IR (GPIO wiring unknown)*/
1588 },
1589 [BTTV_BOARD_DSP_TCVIDEO] = {
1590 /* Arthur Tetzlaff-Deas, DSP Design Ltd <software@dspdesign.com> */
1591 .name = "DSP Design TCVIDEO",
1592 .video_inputs = 4,
1593 .svhs = NO_SVHS,
1594 .muxsel = MUXSEL(2, 3, 1, 0),
1595 .pll = PLL_28,
1596 .tuner_type = UNSET,
1597 .tuner_addr = ADDR_UNSET,
1598 },
1599
1600 /* ---- card 0x50 ---------------------------------- */
1601 [BTTV_BOARD_HAUPPAUGEPVR] = {
1602 .name = "Hauppauge WinTV PVR",
1603 .video_inputs = 4,
1604 /* .audio_inputs= 1, */
1605 .svhs = 2,
1606 .muxsel = MUXSEL(2, 0, 1, 1),
1607 .pll = PLL_28,
1608 .tuner_type = UNSET,
1609 .tuner_addr = ADDR_UNSET,
1610
1611 .gpiomask = 7,
1612 .gpiomux = {7},
1613 },
1614 [BTTV_BOARD_GVBCTV5PCI] = {
1615 .name = "IODATA GV-BCTV5/PCI",
1616 .video_inputs = 3,
1617 /* .audio_inputs= 1, */
1618 .svhs = 2,
1619 .gpiomask = 0x0f0f80,
1620 .muxsel = MUXSEL(2, 3, 1, 0),
1621 .gpiomux = {0x030000, 0x010000, 0, 0 },
1622 .gpiomute = 0x020000,
1623 .no_msp34xx = 1,
1624 .pll = PLL_28,
1625 .tuner_type = TUNER_PHILIPS_NTSC_M,
1626 .tuner_addr = ADDR_UNSET,
1627 .audio_mode_gpio= gvbctv5pci_audio,
1628 .has_radio = 1,
1629 },
1630 [BTTV_BOARD_OSPREY1x0] = {
1631 .name = "Osprey 100/150 (878)", /* 0x1(2|3)-45C6-C1 */
1632 .video_inputs = 4, /* id-inputs-clock */
1633 /* .audio_inputs= 0, */
1634 .svhs = 3,
1635 .muxsel = MUXSEL(3, 2, 0, 1),
1636 .pll = PLL_28,
1637 .tuner_type = TUNER_ABSENT,
1638 .tuner_addr = ADDR_UNSET,
1639 .no_msp34xx = 1,
1640 .no_tda7432 = 1,
1641 },
1642 [BTTV_BOARD_OSPREY1x0_848] = {
1643 .name = "Osprey 100/150 (848)", /* 0x04-54C0-C1 & older boards */
1644 .video_inputs = 3,
1645 /* .audio_inputs= 0, */
1646 .svhs = 2,
1647 .muxsel = MUXSEL(2, 3, 1),
1648 .pll = PLL_28,
1649 .tuner_type = TUNER_ABSENT,
1650 .tuner_addr = ADDR_UNSET,
1651 .no_msp34xx = 1,
1652 .no_tda7432 = 1,
1653 },
1654
1655 /* ---- card 0x54 ---------------------------------- */
1656 [BTTV_BOARD_OSPREY101_848] = {
1657 .name = "Osprey 101 (848)", /* 0x05-40C0-C1 */
1658 .video_inputs = 2,
1659 /* .audio_inputs= 0, */
1660 .svhs = 1,
1661 .muxsel = MUXSEL(3, 1),
1662 .pll = PLL_28,
1663 .tuner_type = TUNER_ABSENT,
1664 .tuner_addr = ADDR_UNSET,
1665 .no_msp34xx = 1,
1666 .no_tda7432 = 1,
1667 },
1668 [BTTV_BOARD_OSPREY1x1] = {
1669 .name = "Osprey 101/151", /* 0x1(4|5)-0004-C4 */
1670 .video_inputs = 1,
1671 /* .audio_inputs= 0, */
1672 .svhs = NO_SVHS,
1673 .muxsel = MUXSEL(0),
1674 .pll = PLL_28,
1675 .tuner_type = TUNER_ABSENT,
1676 .tuner_addr = ADDR_UNSET,
1677 .no_msp34xx = 1,
1678 .no_tda7432 = 1,
1679 },
1680 [BTTV_BOARD_OSPREY1x1_SVID] = {
1681 .name = "Osprey 101/151 w/ svid", /* 0x(16|17|20)-00C4-C1 */
1682 .video_inputs = 2,
1683 /* .audio_inputs= 0, */
1684 .svhs = 1,
1685 .muxsel = MUXSEL(0, 1),
1686 .pll = PLL_28,
1687 .tuner_type = TUNER_ABSENT,
1688 .tuner_addr = ADDR_UNSET,
1689 .no_msp34xx = 1,
1690 .no_tda7432 = 1,
1691 },
1692 [BTTV_BOARD_OSPREY2xx] = {
1693 .name = "Osprey 200/201/250/251", /* 0x1(8|9|E|F)-0004-C4 */
1694 .video_inputs = 1,
1695 /* .audio_inputs= 1, */
1696 .svhs = NO_SVHS,
1697 .muxsel = MUXSEL(0),
1698 .pll = PLL_28,
1699 .tuner_type = TUNER_ABSENT,
1700 .tuner_addr = ADDR_UNSET,
1701 .no_msp34xx = 1,
1702 .no_tda7432 = 1,
1703 },
1704
1705 /* ---- card 0x58 ---------------------------------- */
1706 [BTTV_BOARD_OSPREY2x0_SVID] = {
1707 .name = "Osprey 200/250", /* 0x1(A|B)-00C4-C1 */
1708 .video_inputs = 2,
1709 /* .audio_inputs= 1, */
1710 .svhs = 1,
1711 .muxsel = MUXSEL(0, 1),
1712 .pll = PLL_28,
1713 .tuner_type = TUNER_ABSENT,
1714 .tuner_addr = ADDR_UNSET,
1715 .no_msp34xx = 1,
1716 .no_tda7432 = 1,
1717 },
1718 [BTTV_BOARD_OSPREY2x0] = {
1719 .name = "Osprey 210/220/230", /* 0x1(A|B)-04C0-C1 */
1720 .video_inputs = 2,
1721 /* .audio_inputs= 1, */
1722 .svhs = 1,
1723 .muxsel = MUXSEL(2, 3),
1724 .pll = PLL_28,
1725 .tuner_type = TUNER_ABSENT,
1726 .tuner_addr = ADDR_UNSET,
1727 .no_msp34xx = 1,
1728 .no_tda7432 = 1,
1729 },
1730 [BTTV_BOARD_OSPREY500] = {
1731 .name = "Osprey 500", /* 500 */
1732 .video_inputs = 2,
1733 /* .audio_inputs= 1, */
1734 .svhs = 1,
1735 .muxsel = MUXSEL(2, 3),
1736 .pll = PLL_28,
1737 .tuner_type = TUNER_ABSENT,
1738 .tuner_addr = ADDR_UNSET,
1739 .no_msp34xx = 1,
1740 .no_tda7432 = 1,
1741 },
1742 [BTTV_BOARD_OSPREY540] = {
1743 .name = "Osprey 540", /* 540 */
1744 .video_inputs = 4,
1745 /* .audio_inputs= 1, */
1746 .pll = PLL_28,
1747 .tuner_type = TUNER_ABSENT,
1748 .tuner_addr = ADDR_UNSET,
1749 .no_msp34xx = 1,
1750 .no_tda7432 = 1,
1751 },
1752
1753 /* ---- card 0x5C ---------------------------------- */
1754 [BTTV_BOARD_OSPREY2000] = {
1755 .name = "Osprey 2000", /* 2000 */
1756 .video_inputs = 2,
1757 /* .audio_inputs= 1, */
1758 .svhs = 1,
1759 .muxsel = MUXSEL(2, 3),
1760 .pll = PLL_28,
1761 .tuner_type = TUNER_ABSENT,
1762 .tuner_addr = ADDR_UNSET,
1763 .no_msp34xx = 1,
1764 .no_tda7432 = 1, /* must avoid, conflicts with the bt860 */
1765 },
1766 [BTTV_BOARD_IDS_EAGLE] = {
1767 /* M G Berberich <berberic@forwiss.uni-passau.de> */
1768 .name = "IDS Eagle",
1769 .video_inputs = 4,
1770 /* .audio_inputs= 0, */
1771 .tuner_type = TUNER_ABSENT,
1772 .tuner_addr = ADDR_UNSET,
1773 .svhs = NO_SVHS,
1774 .gpiomask = 0,
1775 .muxsel = MUXSEL(2, 2, 2, 2),
1776 .muxsel_hook = eagle_muxsel,
1777 .no_msp34xx = 1,
1778 .pll = PLL_28,
1779 },
1780 [BTTV_BOARD_PINNACLESAT] = {
1781 .name = "Pinnacle PCTV Sat",
1782 .video_inputs = 2,
1783 /* .audio_inputs= 0, */
1784 .svhs = 1,
1785 .tuner_type = TUNER_ABSENT,
1786 .tuner_addr = ADDR_UNSET,
1787 .no_msp34xx = 1,
1788 .no_tda7432 = 1,
1789 .muxsel = MUXSEL(3, 1),
1790 .pll = PLL_28,
1791 .no_gpioirq = 1,
1792 .has_dvb = 1,
1793 },
1794 [BTTV_BOARD_FORMAC_PROTV] = {
1795 .name = "Formac ProTV II (bt878)",
1796 .video_inputs = 4,
1797 /* .audio_inputs= 1, */
1798 .svhs = 3,
1799 .gpiomask = 2,
1800 /* TV, Comp1, Composite over SVID con, SVID */
1801 .muxsel = MUXSEL(2, 3, 1, 1),
1802 .gpiomux = { 2, 2, 0, 0 },
1803 .pll = PLL_28,
1804 .has_radio = 1,
1805 .tuner_type = TUNER_PHILIPS_PAL,
1806 .tuner_addr = ADDR_UNSET,
1807 /* sound routing:
1808 GPIO=0x00,0x01,0x03: mute (?)
1809 0x02: both TV and radio (tuner: FM1216/I)
1810 The card has onboard audio connectors labeled "cdrom" and "board",
1811 not soldered here, though unknown wiring.
1812 Card lacks: external audio in, pci subsystem id.
1813 */
1814 },
1815
1816 /* ---- card 0x60 ---------------------------------- */
1817 [BTTV_BOARD_MACHTV] = {
1818 .name = "MachTV",
1819 .video_inputs = 3,
1820 /* .audio_inputs= 1, */
1821 .svhs = NO_SVHS,
1822 .gpiomask = 7,
1823 .muxsel = MUXSEL(2, 3, 1, 1),
1824 .gpiomux = { 0, 1, 2, 3},
1825 .gpiomute = 4,
1826 .tuner_type = TUNER_PHILIPS_PAL,
1827 .tuner_addr = ADDR_UNSET,
1828 .pll = PLL_28,
1829 },
1830 [BTTV_BOARD_EURESYS_PICOLO] = {
1831 .name = "Euresys Picolo",
1832 .video_inputs = 3,
1833 /* .audio_inputs= 0, */
1834 .svhs = 2,
1835 .gpiomask = 0,
1836 .no_msp34xx = 1,
1837 .no_tda7432 = 1,
1838 .muxsel = MUXSEL(2, 0, 1),
1839 .pll = PLL_28,
1840 .tuner_type = TUNER_ABSENT,
1841 .tuner_addr = ADDR_UNSET,
1842 },
1843 [BTTV_BOARD_PV150] = {
1844 /* Luc Van Hoeylandt <luc@e-magic.be> */
1845 .name = "ProVideo PV150", /* 0x4f */
1846 .video_inputs = 2,
1847 /* .audio_inputs= 0, */
1848 .svhs = NO_SVHS,
1849 .gpiomask = 0,
1850 .muxsel = MUXSEL(2, 3),
1851 .gpiomux = { 0 },
1852 .no_msp34xx = 1,
1853 .pll = PLL_28,
1854 .tuner_type = TUNER_ABSENT,
1855 .tuner_addr = ADDR_UNSET,
1856 },
1857 [BTTV_BOARD_AD_TVK503] = {
1858 /* Hiroshi Takekawa <sian@big.or.jp> */
1859 /* This card lacks subsystem ID */
1860 .name = "AD-TVK503", /* 0x63 */
1861 .video_inputs = 4,
1862 /* .audio_inputs= 1, */
1863 .svhs = 2,
1864 .gpiomask = 0x001e8007,
1865 .muxsel = MUXSEL(2, 3, 1, 0),
1866 /* Tuner, Radio, external, internal, off, on */
1867 .gpiomux = { 0x08, 0x0f, 0x0a, 0x08 },
1868 .gpiomute = 0x0f,
1869 .no_msp34xx = 1,
1870 .pll = PLL_28,
1871 .tuner_type = TUNER_PHILIPS_NTSC,
1872 .tuner_addr = ADDR_UNSET,
1873 .audio_mode_gpio= adtvk503_audio,
1874 },
1875
1876 /* ---- card 0x64 ---------------------------------- */
1877 [BTTV_BOARD_HERCULES_SM_TV] = {
1878 .name = "Hercules Smart TV Stereo",
1879 .video_inputs = 4,
1880 /* .audio_inputs= 1, */
1881 .svhs = 2,
1882 .gpiomask = 0x00,
1883 .muxsel = MUXSEL(2, 3, 1, 1),
1884 .no_msp34xx = 1,
1885 .pll = PLL_28,
1886 .tuner_type = TUNER_PHILIPS_PAL,
1887 .tuner_addr = ADDR_UNSET,
1888 /* Notes:
1889 - card lacks subsystem ID
1890 - stereo variant w/ daughter board with tda9874a @0xb0
1891 - Audio Routing:
1892 always from tda9874 independent of GPIO (?)
1893 external line in: unknown
1894 - Other chips: em78p156elp @ 0x96 (probably IR remote control)
1895 hef4053 (instead 4052) for unknown function
1896 */
1897 },
1898 [BTTV_BOARD_PACETV] = {
1899 .name = "Pace TV & Radio Card",
1900 .video_inputs = 4,
1901 /* .audio_inputs= 1, */
1902 .svhs = 2,
1903 /* Tuner, CVid, SVid, CVid over SVid connector */
1904 .muxsel = MUXSEL(2, 3, 1, 1),
1905 .gpiomask = 0,
1906 .no_tda7432 = 1,
1907 .tuner_type = TUNER_PHILIPS_PAL_I,
1908 .tuner_addr = ADDR_UNSET,
1909 .has_radio = 1,
1910 .pll = PLL_28,
1911 /* Bt878, Bt832, FI1246 tuner; no pci subsystem id
1912 only internal line out: (4pin header) RGGL
1913 Radio must be decoded by msp3410d (not routed through)*/
1914 /*
1915 .digital_mode = DIGITAL_MODE_CAMERA, todo!
1916 */
1917 },
1918 [BTTV_BOARD_IVC200] = {
1919 /* Chris Willing <chris@vislab.usyd.edu.au> */
1920 .name = "IVC-200",
1921 .video_inputs = 1,
1922 /* .audio_inputs= 0, */
1923 .tuner_type = TUNER_ABSENT,
1924 .tuner_addr = ADDR_UNSET,
1925 .svhs = NO_SVHS,
1926 .gpiomask = 0xdf,
1927 .muxsel = MUXSEL(2),
1928 .pll = PLL_28,
1929 },
1930 [BTTV_BOARD_IVCE8784] = {
1931 .name = "IVCE-8784",
1932 .video_inputs = 1,
1933 /* .audio_inputs= 0, */
1934 .tuner_type = TUNER_ABSENT,
1935 .tuner_addr = ADDR_UNSET,
1936 .svhs = NO_SVHS,
1937 .gpiomask = 0xdf,
1938 .muxsel = MUXSEL(2),
1939 .pll = PLL_28,
1940 },
1941 [BTTV_BOARD_XGUARD] = {
1942 .name = "Grand X-Guard / Trust 814PCI",
1943 .video_inputs = 16,
1944 /* .audio_inputs= 0, */
1945 .svhs = NO_SVHS,
1946 .tuner_type = TUNER_ABSENT,
1947 .tuner_addr = ADDR_UNSET,
1948 .gpiomask2 = 0xff,
1949 .muxsel = MUXSEL(2,2,2,2, 3,3,3,3, 1,1,1,1, 0,0,0,0),
1950 .muxsel_hook = xguard_muxsel,
1951 .no_msp34xx = 1,
1952 .no_tda7432 = 1,
1953 .pll = PLL_28,
1954 },
1955
1956 /* ---- card 0x68 ---------------------------------- */
1957 [BTTV_BOARD_NEBULA_DIGITV] = {
1958 .name = "Nebula Electronics DigiTV",
1959 .video_inputs = 1,
1960 .svhs = NO_SVHS,
1961 .muxsel = MUXSEL(2, 3, 1, 0),
1962 .no_msp34xx = 1,
1963 .no_tda7432 = 1,
1964 .pll = PLL_28,
1965 .tuner_type = TUNER_ABSENT,
1966 .tuner_addr = ADDR_UNSET,
1967 .has_dvb = 1,
1968 .has_remote = 1,
1969 .gpiomask = 0x1b,
1970 .no_gpioirq = 1,
1971 },
1972 [BTTV_BOARD_PV143] = {
1973 /* Jorge Boncompte - DTI2 <jorge@dti2.net> */
1974 .name = "ProVideo PV143",
1975 .video_inputs = 4,
1976 /* .audio_inputs= 0, */
1977 .svhs = NO_SVHS,
1978 .gpiomask = 0,
1979 .muxsel = MUXSEL(2, 3, 1, 0),
1980 .gpiomux = { 0 },
1981 .no_msp34xx = 1,
1982 .pll = PLL_28,
1983 .tuner_type = TUNER_ABSENT,
1984 .tuner_addr = ADDR_UNSET,
1985 },
1986 [BTTV_BOARD_VD009X1_VD011_MINIDIN] = {
1987 /* M.Klahr@phytec.de */
1988 .name = "PHYTEC VD-009-X1 VD-011 MiniDIN (bt878)",
1989 .video_inputs = 4,
1990 /* .audio_inputs= 0, */
1991 .svhs = 3,
1992 .gpiomask = 0x00,
1993 .muxsel = MUXSEL(2, 3, 1, 0),
1994 .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */
1995 .pll = PLL_28,
1996 .tuner_type = TUNER_ABSENT,
1997 .tuner_addr = ADDR_UNSET,
1998 },
1999 [BTTV_BOARD_VD009X1_VD011_COMBI] = {
2000 .name = "PHYTEC VD-009-X1 VD-011 Combi (bt878)",
2001 .video_inputs = 4,
2002 /* .audio_inputs= 0, */
2003 .svhs = 3,
2004 .gpiomask = 0x00,
2005 .muxsel = MUXSEL(2, 3, 1, 1),
2006 .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */
2007 .pll = PLL_28,
2008 .tuner_type = TUNER_ABSENT,
2009 .tuner_addr = ADDR_UNSET,
2010 },
2011
2012 /* ---- card 0x6c ---------------------------------- */
2013 [BTTV_BOARD_VD009_MINIDIN] = {
2014 .name = "PHYTEC VD-009 MiniDIN (bt878)",
2015 .video_inputs = 10,
2016 /* .audio_inputs= 0, */
2017 .svhs = 9,
2018 .gpiomask = 0x00,
2019 .gpiomask2 = 0x03, /* used for external vodeo mux */
2020 .muxsel = MUXSEL(2, 2, 2, 2, 3, 3, 3, 3, 1, 0),
2021 .muxsel_hook = phytec_muxsel,
2022 .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */
2023 .pll = PLL_28,
2024 .tuner_type = TUNER_ABSENT,
2025 .tuner_addr = ADDR_UNSET,
2026 },
2027 [BTTV_BOARD_VD009_COMBI] = {
2028 .name = "PHYTEC VD-009 Combi (bt878)",
2029 .video_inputs = 10,
2030 /* .audio_inputs= 0, */
2031 .svhs = 9,
2032 .gpiomask = 0x00,
2033 .gpiomask2 = 0x03, /* used for external vodeo mux */
2034 .muxsel = MUXSEL(2, 2, 2, 2, 3, 3, 3, 3, 1, 1),
2035 .muxsel_hook = phytec_muxsel,
2036 .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */
2037 .pll = PLL_28,
2038 .tuner_type = TUNER_ABSENT,
2039 .tuner_addr = ADDR_UNSET,
2040 },
2041 [BTTV_BOARD_IVC100] = {
2042 .name = "IVC-100",
2043 .video_inputs = 4,
2044 /* .audio_inputs= 0, */
2045 .tuner_type = TUNER_ABSENT,
2046 .tuner_addr = ADDR_UNSET,
2047 .svhs = NO_SVHS,
2048 .gpiomask = 0xdf,
2049 .muxsel = MUXSEL(2, 3, 1, 0),
2050 .pll = PLL_28,
2051 },
2052 [BTTV_BOARD_IVC120] = {
2053 /* IVC-120G - Alan Garfield <alan@fromorbit.com> */
2054 .name = "IVC-120G",
2055 .video_inputs = 16,
2056 /* .audio_inputs= 0, */
2057 .tuner_type = TUNER_ABSENT,
2058 .tuner_addr = ADDR_UNSET,
2059 .svhs = NO_SVHS, /* card has no svhs */
2060 .no_msp34xx = 1,
2061 .no_tda7432 = 1,
2062 .gpiomask = 0x00,
2063 .muxsel = MUXSEL(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
2064 .muxsel_hook = ivc120_muxsel,
2065 .pll = PLL_28,
2066 },
2067
2068 /* ---- card 0x70 ---------------------------------- */
2069 [BTTV_BOARD_PC_HDTV] = {
2070 .name = "pcHDTV HD-2000 TV",
2071 .video_inputs = 4,
2072 /* .audio_inputs= 1, */
2073 .svhs = 2,
2074 .muxsel = MUXSEL(2, 3, 1, 0),
2075 .tuner_type = TUNER_PHILIPS_FCV1236D,
2076 .tuner_addr = ADDR_UNSET,
2077 .has_dvb = 1,
2078 },
2079 [BTTV_BOARD_TWINHAN_DST] = {
2080 .name = "Twinhan DST + clones",
2081 .no_msp34xx = 1,
2082 .no_tda7432 = 1,
2083 .tuner_type = TUNER_ABSENT,
2084 .tuner_addr = ADDR_UNSET,
2085 .no_video = 1,
2086 .has_dvb = 1,
2087 },
2088 [BTTV_BOARD_WINFASTVC100] = {
2089 .name = "Winfast VC100",
2090 .video_inputs = 3,
2091 /* .audio_inputs= 0, */
2092 .svhs = 1,
2093 /* Vid In, SVid In, Vid over SVid in connector */
2094 .muxsel = MUXSEL(3, 1, 1, 3),
2095 .no_msp34xx = 1,
2096 .no_tda7432 = 1,
2097 .tuner_type = TUNER_ABSENT,
2098 .tuner_addr = ADDR_UNSET,
2099 .pll = PLL_28,
2100 },
2101 [BTTV_BOARD_TEV560] = {
2102 .name = "Teppro TEV-560/InterVision IV-560",
2103 .video_inputs = 3,
2104 /* .audio_inputs= 1, */
2105 .svhs = 2,
2106 .gpiomask = 3,
2107 .muxsel = MUXSEL(2, 3, 1, 1),
2108 .gpiomux = { 1, 1, 1, 1 },
2109 .tuner_type = TUNER_PHILIPS_PAL,
2110 .tuner_addr = ADDR_UNSET,
2111 .pll = PLL_35,
2112 },
2113
2114 /* ---- card 0x74 ---------------------------------- */
2115 [BTTV_BOARD_SIMUS_GVC1100] = {
2116 .name = "SIMUS GVC1100",
2117 .video_inputs = 4,
2118 /* .audio_inputs= 0, */
2119 .svhs = NO_SVHS,
2120 .tuner_type = TUNER_ABSENT,
2121 .tuner_addr = ADDR_UNSET,
2122 .pll = PLL_28,
2123 .muxsel = MUXSEL(2, 2, 2, 2),
2124 .gpiomask = 0x3F,
2125 .muxsel_hook = gvc1100_muxsel,
2126 },
2127 [BTTV_BOARD_NGSTV_PLUS] = {
2128 /* Carlos Silva r3pek@r3pek.homelinux.org || card 0x75 */
2129 .name = "NGS NGSTV+",
2130 .video_inputs = 3,
2131 .svhs = 2,
2132 .gpiomask = 0x008007,
2133 .muxsel = MUXSEL(2, 3, 0, 0),
2134 .gpiomux = { 0, 0, 0, 0 },
2135 .gpiomute = 0x000003,
2136 .pll = PLL_28,
2137 .tuner_type = TUNER_PHILIPS_PAL,
2138 .tuner_addr = ADDR_UNSET,
2139 .has_remote = 1,
2140 },
2141 [BTTV_BOARD_LMLBT4] = {
2142 /* http://linuxmedialabs.com */
2143 .name = "LMLBT4",
2144 .video_inputs = 4, /* IN1,IN2,IN3,IN4 */
2145 /* .audio_inputs= 0, */
2146 .svhs = NO_SVHS,
2147 .muxsel = MUXSEL(2, 3, 1, 0),
2148 .no_msp34xx = 1,
2149 .no_tda7432 = 1,
2150 .tuner_type = TUNER_ABSENT,
2151 .tuner_addr = ADDR_UNSET,
2152 },
2153 [BTTV_BOARD_TEKRAM_M205] = {
2154 /* Helmroos Harri <harri.helmroos@pp.inet.fi> */
2155 .name = "Tekram M205 PRO",
2156 .video_inputs = 3,
2157 /* .audio_inputs= 1, */
2158 .tuner_type = TUNER_PHILIPS_PAL,
2159 .tuner_addr = ADDR_UNSET,
2160 .svhs = 2,
2161 .gpiomask = 0x68,
2162 .muxsel = MUXSEL(2, 3, 1),
2163 .gpiomux = { 0x68, 0x68, 0x61, 0x61 },
2164 .pll = PLL_28,
2165 },
2166
2167 /* ---- card 0x78 ---------------------------------- */
2168 [BTTV_BOARD_CONTVFMI] = {
2169 /* Javier Cendan Ares <jcendan@lycos.es> */
2170 /* bt878 TV + FM without subsystem ID */
2171 .name = "Conceptronic CONTVFMi",
2172 .video_inputs = 3,
2173 /* .audio_inputs= 1, */
2174 .svhs = 2,
2175 .gpiomask = 0x008007,
2176 .muxsel = MUXSEL(2, 3, 1, 1),
2177 .gpiomux = { 0, 1, 2, 2 },
2178 .gpiomute = 3,
2179 .pll = PLL_28,
2180 .tuner_type = TUNER_PHILIPS_PAL,
2181 .tuner_addr = ADDR_UNSET,
2182 .has_remote = 1,
2183 .has_radio = 1,
2184 },
2185 [BTTV_BOARD_PICOLO_TETRA_CHIP] = {
2186 /*Eric DEBIEF <debief@telemsa.com>*/
2187 /*EURESYS Picolo Tetra : 4 Conexant Fusion 878A, no audio, video input set with analog multiplexers GPIO controlled*/
2188 /* adds picolo_tetra_muxsel(), picolo_tetra_init(), the following declaration strucure, and #define BTTV_BOARD_PICOLO_TETRA_CHIP*/
2189 /*0x79 in bttv.h*/
2190 .name = "Euresys Picolo Tetra",
2191 .video_inputs = 4,
2192 /* .audio_inputs= 0, */
2193 .svhs = NO_SVHS,
2194 .gpiomask = 0,
2195 .gpiomask2 = 0x3C<<16,/*Set the GPIO[18]->GPIO[21] as output pin.==> drive the video inputs through analog multiplexers*/
2196 .no_msp34xx = 1,
2197 .no_tda7432 = 1,
2198 /*878A input is always MUX0, see above.*/
2199 .muxsel = MUXSEL(2, 2, 2, 2),
2200 .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */
2201 .pll = PLL_28,
2202 .muxsel_hook = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/
2203 .tuner_type = TUNER_ABSENT,
2204 .tuner_addr = ADDR_UNSET,
2205 },
2206 [BTTV_BOARD_SPIRIT_TV] = {
2207 /* Spirit TV Tuner from http://spiritmodems.com.au */
2208 /* Stafford Goodsell <surge@goliath.homeunix.org> */
2209 .name = "Spirit TV Tuner",
2210 .video_inputs = 3,
2211 /* .audio_inputs= 1, */
2212 .svhs = 2,
2213 .gpiomask = 0x0000000f,
2214 .muxsel = MUXSEL(2, 1, 1),
2215 .gpiomux = { 0x02, 0x00, 0x00, 0x00 },
2216 .tuner_type = TUNER_TEMIC_PAL,
2217 .tuner_addr = ADDR_UNSET,
2218 .no_msp34xx = 1,
2219 },
2220 [BTTV_BOARD_AVDVBT_771] = {
2221 /* Wolfram Joost <wojo@frokaschwei.de> */
2222 .name = "AVerMedia AVerTV DVB-T 771",
2223 .video_inputs = 2,
2224 .svhs = 1,
2225 .tuner_type = TUNER_ABSENT,
2226 .tuner_addr = ADDR_UNSET,
2227 .muxsel = MUXSEL(3, 3),
2228 .no_msp34xx = 1,
2229 .no_tda7432 = 1,
2230 .pll = PLL_28,
2231 .has_dvb = 1,
2232 .no_gpioirq = 1,
2233 .has_remote = 1,
2234 },
2235 /* ---- card 0x7c ---------------------------------- */
2236 [BTTV_BOARD_AVDVBT_761] = {
2237 /* Matt Jesson <dvb@jesson.eclipse.co.uk> */
2238 /* Based on the Nebula card data - added remote and new card number - BTTV_BOARD_AVDVBT_761, see also ir-kbd-gpio.c */
2239 .name = "AverMedia AverTV DVB-T 761",
2240 .video_inputs = 2,
2241 .svhs = 1,
2242 .muxsel = MUXSEL(3, 1, 2, 0), /* Comp0, S-Video, ?, ? */
2243 .no_msp34xx = 1,
2244 .no_tda7432 = 1,
2245 .pll = PLL_28,
2246 .tuner_type = TUNER_ABSENT,
2247 .tuner_addr = ADDR_UNSET,
2248 .has_dvb = 1,
2249 .no_gpioirq = 1,
2250 .has_remote = 1,
2251 },
2252 [BTTV_BOARD_MATRIX_VISIONSQ] = {
2253 /* andre.schwarz@matrix-vision.de */
2254 .name = "MATRIX Vision Sigma-SQ",
2255 .video_inputs = 16,
2256 /* .audio_inputs= 0, */
2257 .svhs = NO_SVHS,
2258 .gpiomask = 0x0,
2259 .muxsel = MUXSEL(2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3),
2260 .muxsel_hook = sigmaSQ_muxsel,
2261 .gpiomux = { 0 },
2262 .no_msp34xx = 1,
2263 .pll = PLL_28,
2264 .tuner_type = TUNER_ABSENT,
2265 .tuner_addr = ADDR_UNSET,
2266 },
2267 [BTTV_BOARD_MATRIX_VISIONSLC] = {
2268 /* andre.schwarz@matrix-vision.de */
2269 .name = "MATRIX Vision Sigma-SLC",
2270 .video_inputs = 4,
2271 /* .audio_inputs= 0, */
2272 .svhs = NO_SVHS,
2273 .gpiomask = 0x0,
2274 .muxsel = MUXSEL(2, 2, 2, 2),
2275 .muxsel_hook = sigmaSLC_muxsel,
2276 .gpiomux = { 0 },
2277 .no_msp34xx = 1,
2278 .pll = PLL_28,
2279 .tuner_type = TUNER_ABSENT,
2280 .tuner_addr = ADDR_UNSET,
2281 },
2282 /* BTTV_BOARD_APAC_VIEWCOMP */
2283 [BTTV_BOARD_APAC_VIEWCOMP] = {
2284 /* Attila Kondoros <attila.kondoros@chello.hu> */
2285 /* bt878 TV + FM 0x00000000 subsystem ID */
2286 .name = "APAC Viewcomp 878(AMAX)",
2287 .video_inputs = 2,
2288 /* .audio_inputs= 1, */
2289 .svhs = NO_SVHS,
2290 .gpiomask = 0xFF,
2291 .muxsel = MUXSEL(2, 3, 1, 1),
2292 .gpiomux = { 2, 0, 0, 0 },
2293 .gpiomute = 10,
2294 .pll = PLL_28,
2295 .tuner_type = TUNER_PHILIPS_PAL,
2296 .tuner_addr = ADDR_UNSET,
2297 .has_remote = 1, /* miniremote works, see ir-kbd-gpio.c */
2298 .has_radio = 1, /* not every card has radio */
2299 },
2300
2301 /* ---- card 0x80 ---------------------------------- */
2302 [BTTV_BOARD_DVICO_DVBT_LITE] = {
2303 /* Chris Pascoe <c.pascoe@itee.uq.edu.au> */
2304 .name = "DViCO FusionHDTV DVB-T Lite",
2305 .no_msp34xx = 1,
2306 .no_tda7432 = 1,
2307 .pll = PLL_28,
2308 .no_video = 1,
2309 .has_dvb = 1,
2310 .tuner_type = TUNER_ABSENT,
2311 .tuner_addr = ADDR_UNSET,
2312 },
2313 [BTTV_BOARD_VGEAR_MYVCD] = {
2314 /* Steven <photon38@pchome.com.tw> */
2315 .name = "V-Gear MyVCD",
2316 .video_inputs = 3,
2317 /* .audio_inputs= 1, */
2318 .svhs = 2,
2319 .gpiomask = 0x3f,
2320 .muxsel = MUXSEL(2, 3, 1, 0),
2321 .gpiomux = {0x31, 0x31, 0x31, 0x31 },
2322 .gpiomute = 0x31,
2323 .no_msp34xx = 1,
2324 .pll = PLL_28,
2325 .tuner_type = TUNER_PHILIPS_NTSC_M,
2326 .tuner_addr = ADDR_UNSET,
2327 .has_radio = 0,
2328 },
2329 [BTTV_BOARD_SUPER_TV] = {
2330 /* Rick C <cryptdragoon@gmail.com> */
2331 .name = "Super TV Tuner",
2332 .video_inputs = 4,
2333 /* .audio_inputs= 1, */
2334 .svhs = 2,
2335 .muxsel = MUXSEL(2, 3, 1, 0),
2336 .tuner_type = TUNER_PHILIPS_NTSC,
2337 .tuner_addr = ADDR_UNSET,
2338 .gpiomask = 0x008007,
2339 .gpiomux = { 0, 0x000001,0,0 },
2340 .has_radio = 1,
2341 },
2342 [BTTV_BOARD_TIBET_CS16] = {
2343 /* Chris Fanning <video4linux@haydon.net> */
2344 .name = "Tibet Systems 'Progress DVR' CS16",
2345 .video_inputs = 16,
2346 /* .audio_inputs= 0, */
2347 .svhs = NO_SVHS,
2348 .muxsel = MUXSEL(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
2349 .pll = PLL_28,
2350 .no_msp34xx = 1,
2351 .no_tda7432 = 1,
2352 .tuner_type = TUNER_ABSENT,
2353 .tuner_addr = ADDR_UNSET,
2354 .muxsel_hook = tibetCS16_muxsel,
2355 },
2356 [BTTV_BOARD_KODICOM_4400R] = {
2357 /* Bill Brack <wbrack@mmm.com.hk> */
2358 /*
2359 * Note that, because of the card's wiring, the "master"
2360 * BT878A chip (i.e. the one which controls the analog switch
2361 * and must use this card type) is the 2nd one detected. The
2362 * other 3 chips should use card type 0x85, whose description
2363 * follows this one. There is a EEPROM on the card (which is
2364 * connected to the I2C of one of those other chips), but is
2365 * not currently handled. There is also a facility for a
2366 * "monitor", which is also not currently implemented.
2367 */
2368 .name = "Kodicom 4400R (master)",
2369 .video_inputs = 16,
2370 /* .audio_inputs= 0, */
2371 .tuner_type = TUNER_ABSENT,
2372 .tuner_addr = ADDR_UNSET,
2373 .svhs = NO_SVHS,
2374 /* GPIO bits 0-9 used for analog switch:
2375 * 00 - 03: camera selector
2376 * 04 - 06: channel (controller) selector
2377 * 07: data (1->on, 0->off)
2378 * 08: strobe
2379 * 09: reset
2380 * bit 16 is input from sync separator for the channel
2381 */
2382 .gpiomask = 0x0003ff,
2383 .no_gpioirq = 1,
2384 .muxsel = MUXSEL(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3),
2385 .pll = PLL_28,
2386 .no_msp34xx = 1,
2387 .no_tda7432 = 1,
2388 .muxsel_hook = kodicom4400r_muxsel,
2389 },
2390 [BTTV_BOARD_KODICOM_4400R_SL] = {
2391 /* Bill Brack <wbrack@mmm.com.hk> */
2392 /* Note that, for reasons unknown, the "master" BT878A chip (i.e. the
2393 * one which controls the analog switch, and must use the card type)
2394 * is the 2nd one detected. The other 3 chips should use this card
2395 * type
2396 */
2397 .name = "Kodicom 4400R (slave)",
2398 .video_inputs = 16,
2399 /* .audio_inputs= 0, */
2400 .tuner_type = TUNER_ABSENT,
2401 .tuner_addr = ADDR_UNSET,
2402 .svhs = NO_SVHS,
2403 .gpiomask = 0x010000,
2404 .no_gpioirq = 1,
2405 .muxsel = MUXSEL(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3),
2406 .pll = PLL_28,
2407 .no_msp34xx = 1,
2408 .no_tda7432 = 1,
2409 .muxsel_hook = kodicom4400r_muxsel,
2410 },
2411 /* ---- card 0x86---------------------------------- */
2412 [BTTV_BOARD_ADLINK_RTV24] = {
2413 /* Michael Henson <mhenson@clarityvi.com> */
2414 /* Adlink RTV24 with special unlock codes */
2415 .name = "Adlink RTV24",
2416 .video_inputs = 4,
2417 /* .audio_inputs= 1, */
2418 .svhs = 2,
2419 .muxsel = MUXSEL(2, 3, 1, 0),
2420 .tuner_type = UNSET,
2421 .tuner_addr = ADDR_UNSET,
2422 .pll = PLL_28,
2423 },
2424 /* ---- card 0x87---------------------------------- */
2425 [BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE] = {
2426 /* Michael Krufky <mkrufky@linuxtv.org> */
2427 .name = "DViCO FusionHDTV 5 Lite",
2428 .tuner_type = TUNER_LG_TDVS_H06XF, /* TDVS-H064F */
2429 .tuner_addr = ADDR_UNSET,
2430 .video_inputs = 3,
2431 /* .audio_inputs= 1, */
2432 .svhs = 2,
2433 .muxsel = MUXSEL(2, 3, 1),
2434 .gpiomask = 0x00e00007,
2435 .gpiomux = { 0x00400005, 0, 0x00000001, 0 },
2436 .gpiomute = 0x00c00007,
2437 .no_msp34xx = 1,
2438 .no_tda7432 = 1,
2439 .has_dvb = 1,
2440 },
2441 /* ---- card 0x88---------------------------------- */
2442 [BTTV_BOARD_ACORP_Y878F] = {
2443 /* Mauro Carvalho Chehab <mchehab@infradead.org> */
2444 .name = "Acorp Y878F",
2445 .video_inputs = 3,
2446 /* .audio_inputs= 1, */
2447 .svhs = 2,
2448 .gpiomask = 0x01fe00,
2449 .muxsel = MUXSEL(2, 3, 1, 1),
2450 .gpiomux = { 0x001e00, 0, 0x018000, 0x014000 },
2451 .gpiomute = 0x002000,
2452 .pll = PLL_28,
2453 .tuner_type = TUNER_YMEC_TVF66T5_B_DFF,
2454 .tuner_addr = 0xc1 >>1,
2455 .has_radio = 1,
2456 },
2457 /* ---- card 0x89 ---------------------------------- */
2458 [BTTV_BOARD_CONCEPTRONIC_CTVFMI2] = {
2459 .name = "Conceptronic CTVFMi v2",
2460 .video_inputs = 3,
2461 /* .audio_inputs= 1, */
2462 .svhs = 2,
2463 .gpiomask = 0x001c0007,
2464 .muxsel = MUXSEL(2, 3, 1, 1),
2465 .gpiomux = { 0, 1, 2, 2 },
2466 .gpiomute = 3,
2467 .pll = PLL_28,
2468 .tuner_type = TUNER_TENA_9533_DI,
2469 .tuner_addr = ADDR_UNSET,
2470 .has_remote = 1,
2471 .has_radio = 1,
2472 },
2473 /* ---- card 0x8a ---------------------------------- */
2474 [BTTV_BOARD_PV_BT878P_2E] = {
2475 .name = "Prolink Pixelview PV-BT878P+ (Rev.2E)",
2476 .video_inputs = 5,
2477 /* .audio_inputs= 1, */
2478 .svhs = 3,
2479 .has_dig_in = 1,
2480 .gpiomask = 0x01fe00,
2481 .muxsel = MUXSEL(2, 3, 1, 1, 0), /* in 4 is digital */
2482 /* .digital_mode= DIGITAL_MODE_CAMERA, */
2483 .gpiomux = { 0x00400, 0x10400, 0x04400, 0x80000 },
2484 .gpiomute = 0x12400,
2485 .no_msp34xx = 1,
2486 .pll = PLL_28,
2487 .tuner_type = TUNER_LG_PAL_FM,
2488 .tuner_addr = ADDR_UNSET,
2489 .has_remote = 1,
2490 },
2491 /* ---- card 0x8b ---------------------------------- */
2492 [BTTV_BOARD_PV_M4900] = {
2493 /* Sérgio Fortier <sergiofortier@yahoo.com.br> */
2494 .name = "Prolink PixelView PlayTV MPEG2 PV-M4900",
2495 .video_inputs = 3,
2496 /* .audio_inputs= 1, */
2497 .svhs = 2,
2498 .gpiomask = 0x3f,
2499 .muxsel = MUXSEL(2, 3, 1, 1),
2500 .gpiomux = { 0x21, 0x20, 0x24, 0x2c },
2501 .gpiomute = 0x29,
2502 .no_msp34xx = 1,
2503 .pll = PLL_28,
2504 .tuner_type = TUNER_YMEC_TVF_5533MF,
2505 .tuner_addr = ADDR_UNSET,
2506 .has_radio = 1,
2507 .has_remote = 1,
2508 },
2509 /* ---- card 0x8c ---------------------------------- */
2510 /* Has four Bt878 chips behind a PCI bridge, each chip has:
2511 one external BNC composite input (mux 2)
2512 three internal composite inputs (unknown muxes)
2513 an 18-bit stereo A/D (CS5331A), which has:
2514 one external stereo unblanced (RCA) audio connection
2515 one (or 3?) internal stereo balanced (XLR) audio connection
2516 input is selected via gpio to a 14052B mux
2517 (mask=0x300, unbal=0x000, bal=0x100, ??=0x200,0x300)
2518 gain is controlled via an X9221A chip on the I2C bus @0x28
2519 sample rate is controlled via gpio to an MK1413S
2520 (mask=0x3, 32kHz=0x0, 44.1kHz=0x1, 48kHz=0x2, ??=0x3)
2521 There is neither a tuner nor an svideo input. */
2522 [BTTV_BOARD_OSPREY440] = {
2523 .name = "Osprey 440",
2524 .video_inputs = 4,
2525 /* .audio_inputs= 2, */
2526 .svhs = NO_SVHS,
2527 .muxsel = MUXSEL(2, 3, 0, 1), /* 3,0,1 are guesses */
2528 .gpiomask = 0x303,
2529 .gpiomute = 0x000, /* int + 32kHz */
2530 .gpiomux = { 0, 0, 0x000, 0x100},
2531 .pll = PLL_28,
2532 .tuner_type = TUNER_ABSENT,
2533 .tuner_addr = ADDR_UNSET,
2534 .no_msp34xx = 1,
2535 .no_tda7432 = 1,
2536 },
2537 /* ---- card 0x8d ---------------------------------- */
2538 [BTTV_BOARD_ASOUND_SKYEYE] = {
2539 .name = "Asound Skyeye PCTV",
2540 .video_inputs = 3,
2541 /* .audio_inputs= 1, */
2542 .svhs = 2,
2543 .gpiomask = 15,
2544 .muxsel = MUXSEL(2, 3, 1, 1),
2545 .gpiomux = { 2, 0, 0, 0 },
2546 .gpiomute = 1,
2547 .pll = PLL_28,
2548 .tuner_type = TUNER_PHILIPS_NTSC,
2549 .tuner_addr = ADDR_UNSET,
2550 },
2551 /* ---- card 0x8e ---------------------------------- */
2552 [BTTV_BOARD_SABRENT_TVFM] = {
2553 .name = "Sabrent TV-FM (bttv version)",
2554 .video_inputs = 3,
2555 /* .audio_inputs= 1, */
2556 .svhs = 2,
2557 .gpiomask = 0x108007,
2558 .muxsel = MUXSEL(2, 3, 1, 1),
2559 .gpiomux = { 100000, 100002, 100002, 100000 },
2560 .no_msp34xx = 1,
2561 .no_tda7432 = 1,
2562 .pll = PLL_28,
2563 .tuner_type = TUNER_TNF_5335MF,
2564 .tuner_addr = ADDR_UNSET,
2565 .has_radio = 1,
2566 },
2567 /* ---- card 0x8f ---------------------------------- */
2568 [BTTV_BOARD_HAUPPAUGE_IMPACTVCB] = {
2569 .name = "Hauppauge ImpactVCB (bt878)",
2570 .video_inputs = 4,
2571 /* .audio_inputs= 0, */
2572 .svhs = NO_SVHS,
2573 .gpiomask = 0x0f, /* old: 7 */
2574 .muxsel = MUXSEL(0, 1, 3, 2), /* Composite 0-3 */
2575 .no_msp34xx = 1,
2576 .no_tda7432 = 1,
2577 .tuner_type = TUNER_ABSENT,
2578 .tuner_addr = ADDR_UNSET,
2579 },
2580 [BTTV_BOARD_MACHTV_MAGICTV] = {
2581 /* Julian Calaby <julian.calaby@gmail.com>
2582 * Slightly different from original MachTV definition (0x60)
2583
2584 * FIXME: RegSpy says gpiomask should be "0x001c800f", but it
2585 * stuffs up remote chip. Bug is a pin on the jaecs is not set
2586 * properly (methinks) causing no keyup bits being set */
2587
2588 .name = "MagicTV", /* rebranded MachTV */
2589 .video_inputs = 3,
2590 /* .audio_inputs= 1, */
2591 .svhs = 2,
2592 .gpiomask = 7,
2593 .muxsel = MUXSEL(2, 3, 1, 1),
2594 .gpiomux = { 0, 1, 2, 3 },
2595 .gpiomute = 4,
2596 .tuner_type = TUNER_TEMIC_4009FR5_PAL,
2597 .tuner_addr = ADDR_UNSET,
2598 .pll = PLL_28,
2599 .has_radio = 1,
2600 .has_remote = 1,
2601 },
2602 [BTTV_BOARD_SSAI_SECURITY] = {
2603 .name = "SSAI Security Video Interface",
2604 .video_inputs = 4,
2605 /* .audio_inputs= 0, */
2606 .svhs = NO_SVHS,
2607 .muxsel = MUXSEL(0, 1, 2, 3),
2608 .tuner_type = TUNER_ABSENT,
2609 .tuner_addr = ADDR_UNSET,
2610 },
2611 [BTTV_BOARD_SSAI_ULTRASOUND] = {
2612 .name = "SSAI Ultrasound Video Interface",
2613 .video_inputs = 2,
2614 /* .audio_inputs= 0, */
2615 .svhs = 1,
2616 .muxsel = MUXSEL(2, 0, 1, 3),
2617 .tuner_type = TUNER_ABSENT,
2618 .tuner_addr = ADDR_UNSET,
2619 },
2620 /* ---- card 0x94---------------------------------- */
2621 [BTTV_BOARD_DVICO_FUSIONHDTV_2] = {
2622 .name = "DViCO FusionHDTV 2",
2623 .tuner_type = TUNER_PHILIPS_FCV1236D,
2624 .tuner_addr = ADDR_UNSET,
2625 .video_inputs = 3,
2626 /* .audio_inputs= 1, */
2627 .svhs = 2,
2628 .muxsel = MUXSEL(2, 3, 1),
2629 .gpiomask = 0x00e00007,
2630 .gpiomux = { 0x00400005, 0, 0x00000001, 0 },
2631 .gpiomute = 0x00c00007,
2632 .no_msp34xx = 1,
2633 .no_tda7432 = 1,
2634 },
2635 /* ---- card 0x95---------------------------------- */
2636 [BTTV_BOARD_TYPHOON_TVTUNERPCI] = {
2637 .name = "Typhoon TV-Tuner PCI (50684)",
2638 .video_inputs = 3,
2639 /* .audio_inputs= 1, */
2640 .svhs = 2,
2641 .gpiomask = 0x3014f,
2642 .muxsel = MUXSEL(2, 3, 1, 1),
2643 .gpiomux = { 0x20001,0x10001, 0, 0 },
2644 .gpiomute = 10,
2645 .pll = PLL_28,
2646 .tuner_type = TUNER_PHILIPS_PAL_I,
2647 .tuner_addr = ADDR_UNSET,
2648 },
2649 [BTTV_BOARD_GEOVISION_GV600] = {
2650 /* emhn@usb.ve */
2651 .name = "Geovision GV-600",
2652 .video_inputs = 16,
2653 /* .audio_inputs= 0, */
2654 .svhs = NO_SVHS,
2655 .gpiomask = 0x0,
2656 .muxsel = MUXSEL(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
2657 .muxsel_hook = geovision_muxsel,
2658 .gpiomux = { 0 },
2659 .no_msp34xx = 1,
2660 .pll = PLL_28,
2661 .tuner_type = TUNER_ABSENT,
2662 .tuner_addr = ADDR_UNSET,
2663 },
2664 [BTTV_BOARD_KOZUMI_KTV_01C] = {
2665 /* Mauro Lacy <mauro@lacy.com.ar>
2666 * Based on MagicTV and Conceptronic CONTVFMi */
2667
2668 .name = "Kozumi KTV-01C",
2669 .video_inputs = 3,
2670 /* .audio_inputs= 1, */
2671 .svhs = 2,
2672 .gpiomask = 0x008007,
2673 .muxsel = MUXSEL(2, 3, 1, 1),
2674 .gpiomux = { 0, 1, 2, 2 }, /* CONTVFMi */
2675 .gpiomute = 3, /* CONTVFMi */
2676 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, /* TCL MK3 */
2677 .tuner_addr = ADDR_UNSET,
2678 .pll = PLL_28,
2679 .has_radio = 1,
2680 .has_remote = 1,
2681 },
2682 [BTTV_BOARD_ENLTV_FM_2] = {
2683 /* Encore TV Tuner Pro ENL TV-FM-2
2684 Mauro Carvalho Chehab <mchehab@infradead.org */
2685 .name = "Encore ENL TV-FM-2",
2686 .video_inputs = 3,
2687 /* .audio_inputs= 1, */
2688 .svhs = 2,
2689 /* bit 6 -> IR disabled
2690 bit 18/17 = 00 -> mute
2691 01 -> enable external audio input
2692 10 -> internal audio input (mono?)
2693 11 -> internal audio input
2694 */
2695 .gpiomask = 0x060040,
2696 .muxsel = MUXSEL(2, 3, 3),
2697 .gpiomux = { 0x60000, 0x60000, 0x20000, 0x20000 },
2698 .gpiomute = 0,
2699 .tuner_type = TUNER_TCL_MF02GIP_5N,
2700 .tuner_addr = ADDR_UNSET,
2701 .pll = PLL_28,
2702 .has_radio = 1,
2703 .has_remote = 1,
2704 },
2705 [BTTV_BOARD_VD012] = {
2706 /* D.Heer@Phytec.de */
2707 .name = "PHYTEC VD-012 (bt878)",
2708 .video_inputs = 4,
2709 /* .audio_inputs= 0, */
2710 .svhs = NO_SVHS,
2711 .gpiomask = 0x00,
2712 .muxsel = MUXSEL(0, 2, 3, 1),
2713 .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */
2714 .pll = PLL_28,
2715 .tuner_type = TUNER_ABSENT,
2716 .tuner_addr = ADDR_UNSET,
2717 },
2718 [BTTV_BOARD_VD012_X1] = {
2719 /* D.Heer@Phytec.de */
2720 .name = "PHYTEC VD-012-X1 (bt878)",
2721 .video_inputs = 4,
2722 /* .audio_inputs= 0, */
2723 .svhs = 3,
2724 .gpiomask = 0x00,
2725 .muxsel = MUXSEL(2, 3, 1),
2726 .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */
2727 .pll = PLL_28,
2728 .tuner_type = TUNER_ABSENT,
2729 .tuner_addr = ADDR_UNSET,
2730 },
2731 [BTTV_BOARD_VD012_X2] = {
2732 /* D.Heer@Phytec.de */
2733 .name = "PHYTEC VD-012-X2 (bt878)",
2734 .video_inputs = 4,
2735 /* .audio_inputs= 0, */
2736 .svhs = 3,
2737 .gpiomask = 0x00,
2738 .muxsel = MUXSEL(3, 2, 1),
2739 .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */
2740 .pll = PLL_28,
2741 .tuner_type = TUNER_ABSENT,
2742 .tuner_addr = ADDR_UNSET,
2743 },
2744 [BTTV_BOARD_GEOVISION_GV800S] = {
2745 /* Bruno Christo <bchristo@inf.ufsm.br>
2746 *
2747 * GeoVision GV-800(S) has 4 Conexant Fusion 878A:
2748 * 1 audio input per BT878A = 4 audio inputs
2749 * 4 video inputs per BT878A = 16 video inputs
2750 * This is the first BT878A chip of the GV-800(S). It's the
2751 * "master" chip and it controls the video inputs through an
2752 * analog multiplexer (a CD22M3494) via some GPIO pins. The
2753 * slaves should use card type 0x9e (following this one).
2754 * There is a EEPROM on the card which is currently not handled.
2755 * The audio input is not working yet.
2756 */
2757 .name = "Geovision GV-800(S) (master)",
2758 .video_inputs = 4,
2759 /* .audio_inputs= 1, */
2760 .tuner_type = TUNER_ABSENT,
2761 .tuner_addr = ADDR_UNSET,
2762 .svhs = NO_SVHS,
2763 .gpiomask = 0xf107f,
2764 .no_gpioirq = 1,
2765 .muxsel = MUXSEL(2, 2, 2, 2),
2766 .pll = PLL_28,
2767 .no_msp34xx = 1,
2768 .no_tda7432 = 1,
2769 .muxsel_hook = gv800s_muxsel,
2770 },
2771 [BTTV_BOARD_GEOVISION_GV800S_SL] = {
2772 /* Bruno Christo <bchristo@inf.ufsm.br>
2773 *
2774 * GeoVision GV-800(S) has 4 Conexant Fusion 878A:
2775 * 1 audio input per BT878A = 4 audio inputs
2776 * 4 video inputs per BT878A = 16 video inputs
2777 * The 3 other BT878A chips are "slave" chips of the GV-800(S)
2778 * and should use this card type.
2779 * The audio input is not working yet.
2780 */
2781 .name = "Geovision GV-800(S) (slave)",
2782 .video_inputs = 4,
2783 /* .audio_inputs= 1, */
2784 .tuner_type = TUNER_ABSENT,
2785 .tuner_addr = ADDR_UNSET,
2786 .svhs = NO_SVHS,
2787 .gpiomask = 0x00,
2788 .no_gpioirq = 1,
2789 .muxsel = MUXSEL(2, 2, 2, 2),
2790 .pll = PLL_28,
2791 .no_msp34xx = 1,
2792 .no_tda7432 = 1,
2793 .muxsel_hook = gv800s_muxsel,
2794 },
2795 [BTTV_BOARD_PV183] = {
2796 .name = "ProVideo PV183", /* 0x9f */
2797 .video_inputs = 2,
2798 /* .audio_inputs= 0, */
2799 .svhs = NO_SVHS,
2800 .gpiomask = 0,
2801 .muxsel = MUXSEL(2, 3),
2802 .gpiomux = { 0 },
2803 .no_msp34xx = 1,
2804 .pll = PLL_28,
2805 .tuner_type = TUNER_ABSENT,
2806 .tuner_addr = ADDR_UNSET,
2807 },
2808 /* ---- card 0xa0---------------------------------- */
2809 [BTTV_BOARD_TVT_TD3116] = {
2810 .name = "Tongwei Video Technology TD-3116",
2811 .video_inputs = 16,
2812 .gpiomask = 0xc00ff,
2813 .muxsel = MUXSEL(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
2814 .muxsel_hook = td3116_muxsel,
2815 .svhs = NO_SVHS,
2816 .pll = PLL_28,
2817 .tuner_type = TUNER_ABSENT,
2818 },
2819 [BTTV_BOARD_APOSONIC_WDVR] = {
2820 .name = "Aposonic W-DVR",
2821 .video_inputs = 4,
2822 .svhs = NO_SVHS,
2823 .muxsel = MUXSEL(2, 3, 1, 0),
2824 .tuner_type = TUNER_ABSENT,
2825 },
2826 [BTTV_BOARD_ADLINK_MPG24] = {
2827 /* Adlink MPG24 */
2828 .name = "Adlink MPG24",
2829 .video_inputs = 1,
2830 /* .audio_inputs= 1, */
2831 .svhs = NO_SVHS,
2832 .muxsel = MUXSEL(2, 2, 2, 2),
2833 .tuner_type = UNSET,
2834 .tuner_addr = ADDR_UNSET,
2835 .pll = PLL_28,
2836 },
2837 [BTTV_BOARD_BT848_CAP_14] = {
2838 .name = "Bt848 Capture 14MHz",
2839 .video_inputs = 4,
2840 .svhs = 2,
2841 .muxsel = MUXSEL(2, 3, 1, 0),
2842 .pll = PLL_14,
2843 .tuner_type = TUNER_ABSENT,
2844 },
2845 [BTTV_BOARD_CYBERVISION_CV06] = {
2846 .name = "CyberVision CV06 (SV)",
2847 .video_inputs = 4,
2848 /* .audio_inputs= 0, */
2849 .svhs = NO_SVHS,
2850 .muxsel = MUXSEL(2, 3, 1, 0),
2851 .pll = PLL_28,
2852 .tuner_type = TUNER_ABSENT,
2853 .tuner_addr = ADDR_UNSET,
2854 },
2855 [BTTV_BOARD_KWORLD_VSTREAM_XPERT] = {
2856 /* Pojar George <geoubuntu@gmail.com> */
2857 .name = "Kworld V-Stream Xpert TV PVR878",
2858 .video_inputs = 3,
2859 /* .audio_inputs= 1, */
2860 .svhs = 2,
2861 .gpiomask = 0x001c0007,
2862 .muxsel = MUXSEL(2, 3, 1, 1),
2863 .gpiomux = { 0, 1, 2, 2 },
2864 .gpiomute = 3,
2865 .pll = PLL_28,
2866 .tuner_type = TUNER_TENA_9533_DI,
2867 .tuner_addr = ADDR_UNSET,
2868 .has_remote = 1,
2869 .has_radio = 1,
2870 },
2871 /* ---- card 0xa6---------------------------------- */
2872 [BTTV_BOARD_PCI_8604PW] = {
2873 /* PCI-8604PW with special unlock sequence */
2874 .name = "PCI-8604PW",
2875 .video_inputs = 2,
2876 /* .audio_inputs= 0, */
2877 .svhs = NO_SVHS,
2878 /* The second input is available on CN4, if populated.
2879 * The other 5x2 header (CN2?) connects to the same inputs
2880 * as the on-board BNCs */
2881 .muxsel = MUXSEL(2, 3),
2882 .tuner_type = TUNER_ABSENT,
2883 .no_msp34xx = 1,
2884 .no_tda7432 = 1,
2885 .pll = PLL_35,
2886 },
2887 };
2888
2889 static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards);
2890
2891 /* ----------------------------------------------------------------------- */
2892
2893 static unsigned char eeprom_data[256];
2894
2895 /*
2896 * identify card
2897 */
2898 void bttv_idcard(struct bttv *btv)
2899 {
2900 unsigned int gpiobits;
2901 int i,type;
2902
2903 /* read PCI subsystem ID */
2904 btv->cardid = btv->c.pci->subsystem_device << 16;
2905 btv->cardid |= btv->c.pci->subsystem_vendor;
2906
2907 if (0 != btv->cardid && 0xffffffff != btv->cardid) {
2908 /* look for the card */
2909 for (type = -1, i = 0; cards[i].id != 0; i++)
2910 if (cards[i].id == btv->cardid)
2911 type = i;
2912
2913 if (type != -1) {
2914 /* found it */
2915 pr_info("%d: detected: %s [card=%d], PCI subsystem ID is %04x:%04x\n",
2916 btv->c.nr, cards[type].name, cards[type].cardnr,
2917 btv->cardid & 0xffff,
2918 (btv->cardid >> 16) & 0xffff);
2919 btv->c.type = cards[type].cardnr;
2920 } else {
2921 /* 404 */
2922 pr_info("%d: subsystem: %04x:%04x (UNKNOWN)\n",
2923 btv->c.nr, btv->cardid & 0xffff,
2924 (btv->cardid >> 16) & 0xffff);
2925 pr_debug("please mail id, board name and the correct card= insmod option to linux-media@vger.kernel.org\n");
2926 }
2927 }
2928
2929 /* let the user override the autodetected type */
2930 if (card[btv->c.nr] < bttv_num_tvcards)
2931 btv->c.type=card[btv->c.nr];
2932
2933 /* print which card config we are using */
2934 pr_info("%d: using: %s [card=%d,%s]\n",
2935 btv->c.nr, bttv_tvcards[btv->c.type].name, btv->c.type,
2936 card[btv->c.nr] < bttv_num_tvcards
2937 ? "insmod option" : "autodetected");
2938
2939 /* overwrite gpio stuff ?? */
2940 if (UNSET == audioall && UNSET == audiomux[0])
2941 return;
2942
2943 if (UNSET != audiomux[0]) {
2944 gpiobits = 0;
2945 for (i = 0; i < ARRAY_SIZE(bttv_tvcards->gpiomux); i++) {
2946 bttv_tvcards[btv->c.type].gpiomux[i] = audiomux[i];
2947 gpiobits |= audiomux[i];
2948 }
2949 } else {
2950 gpiobits = audioall;
2951 for (i = 0; i < ARRAY_SIZE(bttv_tvcards->gpiomux); i++) {
2952 bttv_tvcards[btv->c.type].gpiomux[i] = audioall;
2953 }
2954 }
2955 bttv_tvcards[btv->c.type].gpiomask = (UNSET != gpiomask) ? gpiomask : gpiobits;
2956 pr_info("%d: gpio config override: mask=0x%x, mux=",
2957 btv->c.nr, bttv_tvcards[btv->c.type].gpiomask);
2958 for (i = 0; i < ARRAY_SIZE(bttv_tvcards->gpiomux); i++) {
2959 pr_cont("%s0x%x",
2960 i ? "," : "", bttv_tvcards[btv->c.type].gpiomux[i]);
2961 }
2962 pr_cont("\n");
2963 }
2964
2965 /*
2966 * (most) board specific initialisations goes here
2967 */
2968
2969 /* Some Modular Technology cards have an eeprom, but no subsystem ID */
2970 static void identify_by_eeprom(struct bttv *btv, unsigned char eeprom_data[256])
2971 {
2972 int type = -1;
2973
2974 if (0 == strncmp(eeprom_data,"GET MM20xPCTV",13))
2975 type = BTTV_BOARD_MODTEC_205;
2976 else if (0 == strncmp(eeprom_data+20,"Picolo",7))
2977 type = BTTV_BOARD_EURESYS_PICOLO;
2978 else if (eeprom_data[0] == 0x84 && eeprom_data[2]== 0)
2979 type = BTTV_BOARD_HAUPPAUGE; /* old bt848 */
2980
2981 if (-1 != type) {
2982 btv->c.type = type;
2983 pr_info("%d: detected by eeprom: %s [card=%d]\n",
2984 btv->c.nr, bttv_tvcards[btv->c.type].name, btv->c.type);
2985 }
2986 }
2987
2988 static void flyvideo_gpio(struct bttv *btv)
2989 {
2990 int gpio, has_remote, has_radio, is_capture_only;
2991 int is_lr90, has_tda9820_tda9821;
2992 int tuner_type = UNSET, ttype;
2993
2994 gpio_inout(0xffffff, 0);
2995 udelay(8); /* without this we would see the 0x1800 mask */
2996 gpio = gpio_read();
2997 /* FIXME: must restore OUR_EN ??? */
2998
2999 /* all cards provide GPIO info, some have an additional eeprom
3000 * LR50: GPIO coding can be found lower right CP1 .. CP9
3001 * CP9=GPIO23 .. CP1=GPIO15; when OPEN, the corresponding GPIO reads 1.
3002 * GPIO14-12: n.c.
3003 * LR90: GP9=GPIO23 .. GP1=GPIO15 (right above the bt878)
3004
3005 * lowest 3 bytes are remote control codes (no handshake needed)
3006 * xxxFFF: No remote control chip soldered
3007 * xxxF00(LR26/LR50), xxxFE0(LR90): Remote control chip (LVA001 or CF45) soldered
3008 * Note: Some bits are Audio_Mask !
3009 */
3010 ttype = (gpio & 0x0f0000) >> 16;
3011 switch (ttype) {
3012 case 0x0:
3013 tuner_type = 2; /* NTSC, e.g. TPI8NSR11P */
3014 break;
3015 case 0x2:
3016 tuner_type = 39; /* LG NTSC (newer TAPC series) TAPC-H701P */
3017 break;
3018 case 0x4:
3019 tuner_type = 5; /* Philips PAL TPI8PSB02P, TPI8PSB12P, TPI8PSB12D or FI1216, FM1216 */
3020 break;
3021 case 0x6:
3022 tuner_type = 37; /* LG PAL (newer TAPC series) TAPC-G702P */
3023 break;
3024 case 0xC:
3025 tuner_type = 3; /* Philips SECAM(+PAL) FQ1216ME or FI1216MF */
3026 break;
3027 default:
3028 pr_info("%d: FlyVideo_gpio: unknown tuner type\n", btv->c.nr);
3029 break;
3030 }
3031
3032 has_remote = gpio & 0x800000;
3033 has_radio = gpio & 0x400000;
3034 /* unknown 0x200000;
3035 * unknown2 0x100000; */
3036 is_capture_only = !(gpio & 0x008000); /* GPIO15 */
3037 has_tda9820_tda9821 = !(gpio & 0x004000);
3038 is_lr90 = !(gpio & 0x002000); /* else LR26/LR50 (LR38/LR51 f. capture only) */
3039 /*
3040 * gpio & 0x001000 output bit for audio routing */
3041
3042 if (is_capture_only)
3043 tuner_type = TUNER_ABSENT; /* No tuner present */
3044
3045 pr_info("%d: FlyVideo Radio=%s RemoteControl=%s Tuner=%d gpio=0x%06x\n",
3046 btv->c.nr, has_radio ? "yes" : "no",
3047 has_remote ? "yes" : "no", tuner_type, gpio);
3048 pr_info("%d: FlyVideo LR90=%s tda9821/tda9820=%s capture_only=%s\n",
3049 btv->c.nr, is_lr90 ? "yes" : "no",
3050 has_tda9820_tda9821 ? "yes" : "no",
3051 is_capture_only ? "yes" : "no");
3052
3053 if (tuner_type != UNSET) /* only set if known tuner autodetected, else let insmod option through */
3054 btv->tuner_type = tuner_type;
3055 btv->has_radio = has_radio;
3056
3057 /* LR90 Audio Routing is done by 2 hef4052, so Audio_Mask has 4 bits: 0x001c80
3058 * LR26/LR50 only has 1 hef4052, Audio_Mask 0x000c00
3059 * Audio options: from tuner, from tda9821/tda9821(mono,stereo,sap), from tda9874, ext., mute */
3060 if (has_tda9820_tda9821)
3061 btv->audio_mode_gpio = lt9415_audio;
3062 /* todo: if(has_tda9874) btv->audio_mode_gpio = fv2000s_audio; */
3063 }
3064
3065 static int miro_tunermap[] = { 0,6,2,3, 4,5,6,0, 3,0,4,5, 5,2,16,1,
3066 14,2,17,1, 4,1,4,3, 1,2,16,1, 4,4,4,4 };
3067 static int miro_fmtuner[] = { 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1,
3068 1,1,1,1, 1,1,1,0, 0,0,0,0, 0,1,0,0 };
3069
3070 static void miro_pinnacle_gpio(struct bttv *btv)
3071 {
3072 int id,msp,gpio;
3073 char *info;
3074
3075 gpio_inout(0xffffff, 0);
3076 gpio = gpio_read();
3077 id = ((gpio>>10) & 63) -1;
3078 msp = bttv_I2CRead(btv, I2C_ADDR_MSP3400, "MSP34xx");
3079 if (id < 32) {
3080 btv->tuner_type = miro_tunermap[id];
3081 if (0 == (gpio & 0x20)) {
3082 btv->has_radio = 1;
3083 if (!miro_fmtuner[id]) {
3084 btv->has_tea575x = 1;
3085 btv->tea_gpio.wren = 6;
3086 btv->tea_gpio.most = 7;
3087 btv->tea_gpio.clk = 8;
3088 btv->tea_gpio.data = 9;
3089 tea575x_init(btv);
3090 }
3091 } else {
3092 btv->has_radio = 0;
3093 }
3094 if (-1 != msp) {
3095 if (btv->c.type == BTTV_BOARD_MIRO)
3096 btv->c.type = BTTV_BOARD_MIROPRO;
3097 if (btv->c.type == BTTV_BOARD_PINNACLE)
3098 btv->c.type = BTTV_BOARD_PINNACLEPRO;
3099 }
3100 pr_info("%d: miro: id=%d tuner=%d radio=%s stereo=%s\n",
3101 btv->c.nr, id+1, btv->tuner_type,
3102 !btv->has_radio ? "no" :
3103 (btv->has_tea575x ? "tea575x" : "fmtuner"),
3104 (-1 == msp) ? "no" : "yes");
3105 } else {
3106 /* new cards with microtune tuner */
3107 id = 63 - id;
3108 btv->has_radio = 0;
3109 switch (id) {
3110 case 1:
3111 info = "PAL / mono";
3112 btv->tda9887_conf = TDA9887_INTERCARRIER;
3113 break;
3114 case 2:
3115 info = "PAL+SECAM / stereo";
3116 btv->has_radio = 1;
3117 btv->tda9887_conf = TDA9887_QSS;
3118 break;
3119 case 3:
3120 info = "NTSC / stereo";
3121 btv->has_radio = 1;
3122 btv->tda9887_conf = TDA9887_QSS;
3123 break;
3124 case 4:
3125 info = "PAL+SECAM / mono";
3126 btv->tda9887_conf = TDA9887_QSS;
3127 break;
3128 case 5:
3129 info = "NTSC / mono";
3130 btv->tda9887_conf = TDA9887_INTERCARRIER;
3131 break;
3132 case 6:
3133 info = "NTSC / stereo";
3134 btv->tda9887_conf = TDA9887_INTERCARRIER;
3135 break;
3136 case 7:
3137 info = "PAL / stereo";
3138 btv->tda9887_conf = TDA9887_INTERCARRIER;
3139 break;
3140 default:
3141 info = "oops: unknown card";
3142 break;
3143 }
3144 if (-1 != msp)
3145 btv->c.type = BTTV_BOARD_PINNACLEPRO;
3146 pr_info("%d: pinnacle/mt: id=%d info=\"%s\" radio=%s\n",
3147 btv->c.nr, id, info, btv->has_radio ? "yes" : "no");
3148 btv->tuner_type = TUNER_MT2032;
3149 }
3150 }
3151
3152 /* GPIO21 L: Buffer aktiv, H: Buffer inaktiv */
3153 #define LM1882_SYNC_DRIVE 0x200000L
3154
3155 static void init_ids_eagle(struct bttv *btv)
3156 {
3157 gpio_inout(0xffffff,0xFFFF37);
3158 gpio_write(0x200020);
3159
3160 /* flash strobe inverter ?! */
3161 gpio_write(0x200024);
3162
3163 /* switch sync drive off */
3164 gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE);
3165
3166 /* set BT848 muxel to 2 */
3167 btaor((2)<<5, ~(2<<5), BT848_IFORM);
3168 }
3169
3170 /* Muxsel helper for the IDS Eagle.
3171 * the eagles does not use the standard muxsel-bits but
3172 * has its own multiplexer */
3173 static void eagle_muxsel(struct bttv *btv, unsigned int input)
3174 {
3175 gpio_bits(3, input & 3);
3176
3177 /* composite */
3178 /* set chroma ADC to sleep */
3179 btor(BT848_ADC_C_SLEEP, BT848_ADC);
3180 /* set to composite video */
3181 btand(~BT848_CONTROL_COMP, BT848_E_CONTROL);
3182 btand(~BT848_CONTROL_COMP, BT848_O_CONTROL);
3183
3184 /* switch sync drive off */
3185 gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE);
3186 }
3187
3188 static void gvc1100_muxsel(struct bttv *btv, unsigned int input)
3189 {
3190 static const int masks[] = {0x30, 0x01, 0x12, 0x23};
3191 gpio_write(masks[input%4]);
3192 }
3193
3194 /* LMLBT4x initialization - to allow access to GPIO bits for sensors input and
3195 alarms output
3196
3197 GPIObit | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
3198 assignment | TI | O3|INx| O2| O1|IN4|IN3|IN2|IN1| | |
3199
3200 IN - sensor inputs, INx - sensor inputs and TI XORed together
3201 O1,O2,O3 - alarm outputs (relays)
3202
3203 OUT ENABLE 1 1 0 . 1 1 0 0 . 0 0 0 0 = 0x6C0
3204
3205 */
3206
3207 static void init_lmlbt4x(struct bttv *btv)
3208 {
3209 pr_debug("LMLBT4x init\n");
3210 btwrite(0x000000, BT848_GPIO_REG_INP);
3211 gpio_inout(0xffffff, 0x0006C0);
3212 gpio_write(0x000000);
3213 }
3214
3215 static void sigmaSQ_muxsel(struct bttv *btv, unsigned int input)
3216 {
3217 unsigned int inmux = input % 8;
3218 gpio_inout( 0xf, 0xf );
3219 gpio_bits( 0xf, inmux );
3220 }
3221
3222 static void sigmaSLC_muxsel(struct bttv *btv, unsigned int input)
3223 {
3224 unsigned int inmux = input % 4;
3225 gpio_inout( 3<<9, 3<<9 );
3226 gpio_bits( 3<<9, inmux<<9 );
3227 }
3228
3229 static void geovision_muxsel(struct bttv *btv, unsigned int input)
3230 {
3231 unsigned int inmux = input % 16;
3232 gpio_inout(0xf, 0xf);
3233 gpio_bits(0xf, inmux);
3234 }
3235
3236 /*
3237 * The TD3116 has 2 74HC4051 muxes wired to the MUX0 input of a bt878.
3238 * The first 74HC4051 has the lower 8 inputs, the second one the higher 8.
3239 * The muxes are controlled via a 74HC373 latch which is connected to
3240 * GPIOs 0-7. GPIO 18 is connected to the LE signal of the latch.
3241 * Q0 of the latch is connected to the Enable (~E) input of the first
3242 * 74HC4051. Q1 - Q3 are connected to S0 - S2 of the same 74HC4051.
3243 * Q4 - Q7 are connected to the second 74HC4051 in the same way.
3244 */
3245
3246 static void td3116_latch_value(struct bttv *btv, u32 value)
3247 {
3248 gpio_bits((1<<18) | 0xff, value);
3249 gpio_bits((1<<18) | 0xff, (1<<18) | value);
3250 udelay(1);
3251 gpio_bits((1<<18) | 0xff, value);
3252 }
3253
3254 static void td3116_muxsel(struct bttv *btv, unsigned int input)
3255 {
3256 u32 value;
3257 u32 highbit;
3258
3259 highbit = (input & 0x8) >> 3 ;
3260
3261 /* Disable outputs and set value in the mux */
3262 value = 0x11; /* Disable outputs */
3263 value |= ((input & 0x7) << 1) << (4 * highbit);
3264 td3116_latch_value(btv, value);
3265
3266 /* Enable the correct output */
3267 value &= ~0x11;
3268 value |= ((highbit ^ 0x1) << 4) | highbit;
3269 td3116_latch_value(btv, value);
3270 }
3271
3272 /* ----------------------------------------------------------------------- */
3273
3274 static void bttv_reset_audio(struct bttv *btv)
3275 {
3276 /*
3277 * BT878A has a audio-reset register.
3278 * 1. This register is an audio reset function but it is in
3279 * function-0 (video capture) address space.
3280 * 2. It is enough to do this once per power-up of the card.
3281 * 3. There is a typo in the Conexant doc -- it is not at
3282 * 0x5B, but at 0x058. (B is an odd-number, obviously a typo!).
3283 * --//Shrikumar 030609
3284 */
3285 if (btv->id != 878)
3286 return;
3287
3288 if (bttv_debug)
3289 pr_debug("%d: BT878A ARESET\n", btv->c.nr);
3290 btwrite((1<<7), 0x058);
3291 udelay(10);
3292 btwrite( 0, 0x058);
3293 }
3294
3295 /* initialization part one -- before registering i2c bus */
3296 void bttv_init_card1(struct bttv *btv)
3297 {
3298 switch (btv->c.type) {
3299 case BTTV_BOARD_HAUPPAUGE:
3300 case BTTV_BOARD_HAUPPAUGE878:
3301 boot_msp34xx(btv,5);
3302 break;
3303 case BTTV_BOARD_VOODOOTV_200:
3304 case BTTV_BOARD_VOODOOTV_FM:
3305 boot_msp34xx(btv,20);
3306 break;
3307 case BTTV_BOARD_AVERMEDIA98:
3308 boot_msp34xx(btv,11);
3309 break;
3310 case BTTV_BOARD_HAUPPAUGEPVR:
3311 pvr_boot(btv);
3312 break;
3313 case BTTV_BOARD_TWINHAN_DST:
3314 case BTTV_BOARD_AVDVBT_771:
3315 case BTTV_BOARD_PINNACLESAT:
3316 btv->use_i2c_hw = 1;
3317 break;
3318 case BTTV_BOARD_ADLINK_RTV24:
3319 init_RTV24( btv );
3320 break;
3321 case BTTV_BOARD_PCI_8604PW:
3322 init_PCI8604PW(btv);
3323 break;
3324
3325 }
3326 if (!bttv_tvcards[btv->c.type].has_dvb)
3327 bttv_reset_audio(btv);
3328 }
3329
3330 /* initialization part two -- after registering i2c bus */
3331 void bttv_init_card2(struct bttv *btv)
3332 {
3333 btv->tuner_type = UNSET;
3334
3335 if (BTTV_BOARD_UNKNOWN == btv->c.type) {
3336 bttv_readee(btv,eeprom_data,0xa0);
3337 identify_by_eeprom(btv,eeprom_data);
3338 }
3339
3340 switch (btv->c.type) {
3341 case BTTV_BOARD_MIRO:
3342 case BTTV_BOARD_MIROPRO:
3343 case BTTV_BOARD_PINNACLE:
3344 case BTTV_BOARD_PINNACLEPRO:
3345 /* miro/pinnacle */
3346 miro_pinnacle_gpio(btv);
3347 break;
3348 case BTTV_BOARD_FLYVIDEO_98:
3349 case BTTV_BOARD_MAXI:
3350 case BTTV_BOARD_LIFE_FLYKIT:
3351 case BTTV_BOARD_FLYVIDEO:
3352 case BTTV_BOARD_TYPHOON_TVIEW:
3353 case BTTV_BOARD_CHRONOS_VS2:
3354 case BTTV_BOARD_FLYVIDEO_98FM:
3355 case BTTV_BOARD_FLYVIDEO2000:
3356 case BTTV_BOARD_FLYVIDEO98EZ:
3357 case BTTV_BOARD_CONFERENCETV:
3358 case BTTV_BOARD_LIFETEC_9415:
3359 flyvideo_gpio(btv);
3360 break;
3361 case BTTV_BOARD_HAUPPAUGE:
3362 case BTTV_BOARD_HAUPPAUGE878:
3363 case BTTV_BOARD_HAUPPAUGEPVR:
3364 /* pick up some config infos from the eeprom */
3365 bttv_readee(btv,eeprom_data,0xa0);
3366 hauppauge_eeprom(btv);
3367 break;
3368 case BTTV_BOARD_AVERMEDIA98:
3369 case BTTV_BOARD_AVPHONE98:
3370 bttv_readee(btv,eeprom_data,0xa0);
3371 avermedia_eeprom(btv);
3372 break;
3373 case BTTV_BOARD_PXC200:
3374 init_PXC200(btv);
3375 break;
3376 case BTTV_BOARD_PICOLO_TETRA_CHIP:
3377 picolo_tetra_init(btv);
3378 break;
3379 case BTTV_BOARD_VHX:
3380 btv->has_radio = 1;
3381 btv->has_tea575x = 1;
3382 btv->tea_gpio.wren = 5;
3383 btv->tea_gpio.most = 6;
3384 btv->tea_gpio.clk = 3;
3385 btv->tea_gpio.data = 4;
3386 tea575x_init(btv);
3387 break;
3388 case BTTV_BOARD_VOBIS_BOOSTAR:
3389 case BTTV_BOARD_TERRATV:
3390 terratec_active_radio_upgrade(btv);
3391 break;
3392 case BTTV_BOARD_MAGICTVIEW061:
3393 if (btv->cardid == 0x3002144f) {
3394 btv->has_radio=1;
3395 pr_info("%d: radio detected by subsystem id (CPH05x)\n",
3396 btv->c.nr);
3397 }
3398 break;
3399 case BTTV_BOARD_STB2:
3400 if (btv->cardid == 0x3060121a) {
3401 /* Fix up entry for 3DFX VoodooTV 100,
3402 which is an OEM STB card variant. */
3403 btv->has_radio=0;
3404 btv->tuner_type=TUNER_TEMIC_NTSC;
3405 }
3406 break;
3407 case BTTV_BOARD_OSPREY1x0:
3408 case BTTV_BOARD_OSPREY1x0_848:
3409 case BTTV_BOARD_OSPREY101_848:
3410 case BTTV_BOARD_OSPREY1x1:
3411 case BTTV_BOARD_OSPREY1x1_SVID:
3412 case BTTV_BOARD_OSPREY2xx:
3413 case BTTV_BOARD_OSPREY2x0_SVID:
3414 case BTTV_BOARD_OSPREY2x0:
3415 case BTTV_BOARD_OSPREY440:
3416 case BTTV_BOARD_OSPREY500:
3417 case BTTV_BOARD_OSPREY540:
3418 case BTTV_BOARD_OSPREY2000:
3419 bttv_readee(btv,eeprom_data,0xa0);
3420 osprey_eeprom(btv, eeprom_data);
3421 break;
3422 case BTTV_BOARD_IDS_EAGLE:
3423 init_ids_eagle(btv);
3424 break;
3425 case BTTV_BOARD_MODTEC_205:
3426 bttv_readee(btv,eeprom_data,0xa0);
3427 modtec_eeprom(btv);
3428 break;
3429 case BTTV_BOARD_LMLBT4:
3430 init_lmlbt4x(btv);
3431 break;
3432 case BTTV_BOARD_TIBET_CS16:
3433 tibetCS16_init(btv);
3434 break;
3435 case BTTV_BOARD_KODICOM_4400R:
3436 kodicom4400r_init(btv);
3437 break;
3438 case BTTV_BOARD_GEOVISION_GV800S:
3439 gv800s_init(btv);
3440 break;
3441 }
3442
3443 /* pll configuration */
3444 if (!(btv->id==848 && btv->revision==0x11)) {
3445 /* defaults from card list */
3446 if (PLL_28 == bttv_tvcards[btv->c.type].pll) {
3447 btv->pll.pll_ifreq=28636363;
3448 btv->pll.pll_crystal=BT848_IFORM_XT0;
3449 }
3450 if (PLL_35 == bttv_tvcards[btv->c.type].pll) {
3451 btv->pll.pll_ifreq=35468950;
3452 btv->pll.pll_crystal=BT848_IFORM_XT1;
3453 }
3454 if (PLL_14 == bttv_tvcards[btv->c.type].pll) {
3455 btv->pll.pll_ifreq = 14318181;
3456 btv->pll.pll_crystal = BT848_IFORM_XT0;
3457 }
3458 /* insmod options can override */
3459 switch (pll[btv->c.nr]) {
3460 case 0: /* none */
3461 btv->pll.pll_crystal = 0;
3462 btv->pll.pll_ifreq = 0;
3463 btv->pll.pll_ofreq = 0;
3464 break;
3465 case 1: /* 28 MHz */
3466 case 28:
3467 btv->pll.pll_ifreq = 28636363;
3468 btv->pll.pll_ofreq = 0;
3469 btv->pll.pll_crystal = BT848_IFORM_XT0;
3470 break;
3471 case 2: /* 35 MHz */
3472 case 35:
3473 btv->pll.pll_ifreq = 35468950;
3474 btv->pll.pll_ofreq = 0;
3475 btv->pll.pll_crystal = BT848_IFORM_XT1;
3476 break;
3477 case 3: /* 14 MHz */
3478 case 14:
3479 btv->pll.pll_ifreq = 14318181;
3480 btv->pll.pll_ofreq = 0;
3481 btv->pll.pll_crystal = BT848_IFORM_XT0;
3482 break;
3483 }
3484 }
3485 btv->pll.pll_current = -1;
3486
3487 /* tuner configuration (from card list / autodetect / insmod option) */
3488 if (UNSET != bttv_tvcards[btv->c.type].tuner_type)
3489 if (UNSET == btv->tuner_type)
3490 btv->tuner_type = bttv_tvcards[btv->c.type].tuner_type;
3491 if (UNSET != tuner[btv->c.nr])
3492 btv->tuner_type = tuner[btv->c.nr];
3493
3494 if (btv->tuner_type == TUNER_ABSENT)
3495 pr_info("%d: tuner absent\n", btv->c.nr);
3496 else if (btv->tuner_type == UNSET)
3497 pr_warn("%d: tuner type unset\n", btv->c.nr);
3498 else
3499 pr_info("%d: tuner type=%d\n", btv->c.nr, btv->tuner_type);
3500
3501 if (autoload != UNSET) {
3502 pr_warn("%d: the autoload option is obsolete\n", btv->c.nr);
3503 pr_warn("%d: use option msp3400, tda7432 or tvaudio to override which audio module should be used\n",
3504 btv->c.nr);
3505 }
3506
3507 if (UNSET == btv->tuner_type)
3508 btv->tuner_type = TUNER_ABSENT;
3509
3510 btv->dig = bttv_tvcards[btv->c.type].has_dig_in ?
3511 bttv_tvcards[btv->c.type].video_inputs - 1 : UNSET;
3512 btv->svhs = bttv_tvcards[btv->c.type].svhs == NO_SVHS ?
3513 UNSET : bttv_tvcards[btv->c.type].svhs;
3514 if (svhs[btv->c.nr] != UNSET)
3515 btv->svhs = svhs[btv->c.nr];
3516 if (remote[btv->c.nr] != UNSET)
3517 btv->has_remote = remote[btv->c.nr];
3518
3519 if (bttv_tvcards[btv->c.type].has_radio)
3520 btv->has_radio = 1;
3521 if (bttv_tvcards[btv->c.type].has_remote)
3522 btv->has_remote = 1;
3523 if (!bttv_tvcards[btv->c.type].no_gpioirq)
3524 btv->gpioirq = 1;
3525 if (bttv_tvcards[btv->c.type].volume_gpio)
3526 btv->volume_gpio = bttv_tvcards[btv->c.type].volume_gpio;
3527 if (bttv_tvcards[btv->c.type].audio_mode_gpio)
3528 btv->audio_mode_gpio = bttv_tvcards[btv->c.type].audio_mode_gpio;
3529
3530 if (btv->tuner_type == TUNER_ABSENT)
3531 return; /* no tuner or related drivers to load */
3532
3533 if (btv->has_saa6588 || saa6588[btv->c.nr]) {
3534 /* Probe for RDS receiver chip */
3535 static const unsigned short addrs[] = {
3536 0x20 >> 1,
3537 0x22 >> 1,
3538 I2C_CLIENT_END
3539 };
3540 struct v4l2_subdev *sd;
3541
3542 sd = v4l2_i2c_new_subdev(&btv->c.v4l2_dev,
3543 &btv->c.i2c_adap, "saa6588", 0, addrs);
3544 btv->has_saa6588 = (sd != NULL);
3545 }
3546
3547 /* try to detect audio/fader chips */
3548
3549 /* First check if the user specified the audio chip via a module
3550 option. */
3551
3552 switch (audiodev[btv->c.nr]) {
3553 case -1:
3554 return; /* do not load any audio module */
3555
3556 case 0: /* autodetect */
3557 break;
3558
3559 case 1: {
3560 /* The user specified that we should probe for msp3400 */
3561 static const unsigned short addrs[] = {
3562 I2C_ADDR_MSP3400 >> 1,
3563 I2C_ADDR_MSP3400_ALT >> 1,
3564 I2C_CLIENT_END
3565 };
3566
3567 btv->sd_msp34xx = v4l2_i2c_new_subdev(&btv->c.v4l2_dev,
3568 &btv->c.i2c_adap, "msp3400", 0, addrs);
3569 if (btv->sd_msp34xx)
3570 return;
3571 goto no_audio;
3572 }
3573
3574 case 2: {
3575 /* The user specified that we should probe for tda7432 */
3576 static const unsigned short addrs[] = {
3577 I2C_ADDR_TDA7432 >> 1,
3578 I2C_CLIENT_END
3579 };
3580
3581 if (v4l2_i2c_new_subdev(&btv->c.v4l2_dev,
3582 &btv->c.i2c_adap, "tda7432", 0, addrs))
3583 return;
3584 goto no_audio;
3585 }
3586
3587 case 3: {
3588 /* The user specified that we should probe for tvaudio */
3589 btv->sd_tvaudio = v4l2_i2c_new_subdev(&btv->c.v4l2_dev,
3590 &btv->c.i2c_adap, "tvaudio", 0, tvaudio_addrs());
3591 if (btv->sd_tvaudio)
3592 return;
3593 goto no_audio;
3594 }
3595
3596 default:
3597 pr_warn("%d: unknown audiodev value!\n", btv->c.nr);
3598 return;
3599 }
3600
3601 /* There were no overrides, so now we try to discover this through the
3602 card definition */
3603
3604 /* probe for msp3400 first: this driver can detect whether or not
3605 it really is a msp3400, so it will return NULL when the device
3606 found is really something else (e.g. a tea6300). */
3607 if (!bttv_tvcards[btv->c.type].no_msp34xx) {
3608 btv->sd_msp34xx = v4l2_i2c_new_subdev(&btv->c.v4l2_dev,
3609 &btv->c.i2c_adap, "msp3400",
3610 0, I2C_ADDRS(I2C_ADDR_MSP3400 >> 1));
3611 } else if (bttv_tvcards[btv->c.type].msp34xx_alt) {
3612 btv->sd_msp34xx = v4l2_i2c_new_subdev(&btv->c.v4l2_dev,
3613 &btv->c.i2c_adap, "msp3400",
3614 0, I2C_ADDRS(I2C_ADDR_MSP3400_ALT >> 1));
3615 }
3616
3617 /* If we found a msp34xx, then we're done. */
3618 if (btv->sd_msp34xx)
3619 return;
3620
3621 /* Now see if we can find one of the tvaudio devices. */
3622 btv->sd_tvaudio = v4l2_i2c_new_subdev(&btv->c.v4l2_dev,
3623 &btv->c.i2c_adap, "tvaudio", 0, tvaudio_addrs());
3624 if (btv->sd_tvaudio) {
3625 /* There may be two tvaudio chips on the card, so try to
3626 find another. */
3627 v4l2_i2c_new_subdev(&btv->c.v4l2_dev,
3628 &btv->c.i2c_adap, "tvaudio", 0, tvaudio_addrs());
3629 }
3630
3631 /* it might also be a tda7432. */
3632 if (!bttv_tvcards[btv->c.type].no_tda7432) {
3633 static const unsigned short addrs[] = {
3634 I2C_ADDR_TDA7432 >> 1,
3635 I2C_CLIENT_END
3636 };
3637
3638 btv->sd_tda7432 = v4l2_i2c_new_subdev(&btv->c.v4l2_dev,
3639 &btv->c.i2c_adap, "tda7432", 0, addrs);
3640 if (btv->sd_tda7432)
3641 return;
3642 }
3643 if (btv->sd_tvaudio)
3644 return;
3645
3646 no_audio:
3647 pr_warn("%d: audio absent, no audio device found!\n", btv->c.nr);
3648 }
3649
3650
3651 /* initialize the tuner */
3652 void bttv_init_tuner(struct bttv *btv)
3653 {
3654 int addr = ADDR_UNSET;
3655
3656 if (ADDR_UNSET != bttv_tvcards[btv->c.type].tuner_addr)
3657 addr = bttv_tvcards[btv->c.type].tuner_addr;
3658
3659 if (btv->tuner_type != TUNER_ABSENT) {
3660 struct tuner_setup tun_setup;
3661
3662 /* Load tuner module before issuing tuner config call! */
3663 if (btv->has_radio)
3664 v4l2_i2c_new_subdev(&btv->c.v4l2_dev,
3665 &btv->c.i2c_adap, "tuner",
3666 0, v4l2_i2c_tuner_addrs(ADDRS_RADIO));
3667 v4l2_i2c_new_subdev(&btv->c.v4l2_dev,
3668 &btv->c.i2c_adap, "tuner",
3669 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD));
3670 v4l2_i2c_new_subdev(&btv->c.v4l2_dev,
3671 &btv->c.i2c_adap, "tuner",
3672 0, v4l2_i2c_tuner_addrs(ADDRS_TV_WITH_DEMOD));
3673
3674 tun_setup.mode_mask = T_ANALOG_TV;
3675 tun_setup.type = btv->tuner_type;
3676 tun_setup.addr = addr;
3677
3678 if (btv->has_radio)
3679 tun_setup.mode_mask |= T_RADIO;
3680
3681 bttv_call_all(btv, tuner, s_type_addr, &tun_setup);
3682 }
3683
3684 if (btv->tda9887_conf) {
3685 struct v4l2_priv_tun_config tda9887_cfg;
3686
3687 tda9887_cfg.tuner = TUNER_TDA9887;
3688 tda9887_cfg.priv = &btv->tda9887_conf;
3689
3690 bttv_call_all(btv, tuner, s_config, &tda9887_cfg);
3691 }
3692 }
3693
3694 /* ----------------------------------------------------------------------- */
3695
3696 static void modtec_eeprom(struct bttv *btv)
3697 {
3698 if( strncmp(&(eeprom_data[0x1e]),"Temic 4066 FY5",14) ==0) {
3699 btv->tuner_type=TUNER_TEMIC_4066FY5_PAL_I;
3700 pr_info("%d: Modtec: Tuner autodetected by eeprom: %s\n",
3701 btv->c.nr, &eeprom_data[0x1e]);
3702 } else if (strncmp(&(eeprom_data[0x1e]),"Alps TSBB5",10) ==0) {
3703 btv->tuner_type=TUNER_ALPS_TSBB5_PAL_I;
3704 pr_info("%d: Modtec: Tuner autodetected by eeprom: %s\n",
3705 btv->c.nr, &eeprom_data[0x1e]);
3706 } else if (strncmp(&(eeprom_data[0x1e]),"Philips FM1246",14) ==0) {
3707 btv->tuner_type=TUNER_PHILIPS_NTSC;
3708 pr_info("%d: Modtec: Tuner autodetected by eeprom: %s\n",
3709 btv->c.nr, &eeprom_data[0x1e]);
3710 } else {
3711 pr_info("%d: Modtec: Unknown TunerString: %s\n",
3712 btv->c.nr, &eeprom_data[0x1e]);
3713 }
3714 }
3715
3716 static void hauppauge_eeprom(struct bttv *btv)
3717 {
3718 struct tveeprom tv;
3719
3720 tveeprom_hauppauge_analog(&btv->i2c_client, &tv, eeprom_data);
3721 btv->tuner_type = tv.tuner_type;
3722 btv->has_radio = tv.has_radio;
3723
3724 pr_info("%d: Hauppauge eeprom indicates model#%d\n",
3725 btv->c.nr, tv.model);
3726
3727 /*
3728 * Some of the 878 boards have duplicate PCI IDs. Switch the board
3729 * type based on model #.
3730 */
3731 if(tv.model == 64900) {
3732 pr_info("%d: Switching board type from %s to %s\n",
3733 btv->c.nr,
3734 bttv_tvcards[btv->c.type].name,
3735 bttv_tvcards[BTTV_BOARD_HAUPPAUGE_IMPACTVCB].name);
3736 btv->c.type = BTTV_BOARD_HAUPPAUGE_IMPACTVCB;
3737 }
3738
3739 /* The 61334 needs the msp3410 to do the radio demod to get sound */
3740 if (tv.model == 61334)
3741 btv->radio_uses_msp_demodulator = 1;
3742 }
3743
3744 /* ----------------------------------------------------------------------- */
3745
3746 static void bttv_tea575x_set_pins(struct snd_tea575x *tea, u8 pins)
3747 {
3748 struct bttv *btv = tea->private_data;
3749 struct bttv_tea575x_gpio gpio = btv->tea_gpio;
3750 u16 val = 0;
3751
3752 val |= (pins & TEA575X_DATA) ? (1 << gpio.data) : 0;
3753 val |= (pins & TEA575X_CLK) ? (1 << gpio.clk) : 0;
3754 val |= (pins & TEA575X_WREN) ? (1 << gpio.wren) : 0;
3755
3756 gpio_bits((1 << gpio.data) | (1 << gpio.clk) | (1 << gpio.wren), val);
3757 if (btv->mbox_ior) {
3758 /* IOW and CSEL active */
3759 gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
3760 udelay(5);
3761 /* all inactive */
3762 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3763 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3764 }
3765 }
3766
3767 static u8 bttv_tea575x_get_pins(struct snd_tea575x *tea)
3768 {
3769 struct bttv *btv = tea->private_data;
3770 struct bttv_tea575x_gpio gpio = btv->tea_gpio;
3771 u8 ret = 0;
3772 u16 val;
3773
3774 if (btv->mbox_ior) {
3775 /* IOR and CSEL active */
3776 gpio_bits(btv->mbox_ior | btv->mbox_csel, 0);
3777 udelay(5);
3778 }
3779 val = gpio_read();
3780 if (btv->mbox_ior) {
3781 /* all inactive */
3782 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3783 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3784 }
3785
3786 if (val & (1 << gpio.data))
3787 ret |= TEA575X_DATA;
3788 if (val & (1 << gpio.most))
3789 ret |= TEA575X_MOST;
3790
3791 return ret;
3792 }
3793
3794 static void bttv_tea575x_set_direction(struct snd_tea575x *tea, bool output)
3795 {
3796 struct bttv *btv = tea->private_data;
3797 struct bttv_tea575x_gpio gpio = btv->tea_gpio;
3798 u32 mask = (1 << gpio.clk) | (1 << gpio.wren) | (1 << gpio.data) |
3799 (1 << gpio.most);
3800
3801 if (output)
3802 gpio_inout(mask, (1 << gpio.data) | (1 << gpio.clk) |
3803 (1 << gpio.wren));
3804 else
3805 gpio_inout(mask, (1 << gpio.clk) | (1 << gpio.wren));
3806 }
3807
3808 static const struct snd_tea575x_ops bttv_tea_ops = {
3809 .set_pins = bttv_tea575x_set_pins,
3810 .get_pins = bttv_tea575x_get_pins,
3811 .set_direction = bttv_tea575x_set_direction,
3812 };
3813
3814 static int tea575x_init(struct bttv *btv)
3815 {
3816 btv->tea.private_data = btv;
3817 btv->tea.ops = &bttv_tea_ops;
3818 if (!snd_tea575x_hw_init(&btv->tea)) {
3819 pr_info("%d: detected TEA575x radio\n", btv->c.nr);
3820 btv->tea.mute = false;
3821 return 0;
3822 }
3823
3824 btv->has_tea575x = 0;
3825 btv->has_radio = 0;
3826
3827 return -ENODEV;
3828 }
3829
3830 /* ----------------------------------------------------------------------- */
3831
3832 static int terratec_active_radio_upgrade(struct bttv *btv)
3833 {
3834 btv->has_radio = 1;
3835 btv->has_tea575x = 1;
3836 btv->tea_gpio.wren = 4;
3837 btv->tea_gpio.most = 5;
3838 btv->tea_gpio.clk = 3;
3839 btv->tea_gpio.data = 2;
3840
3841 btv->mbox_iow = 1 << 8;
3842 btv->mbox_ior = 1 << 9;
3843 btv->mbox_csel = 1 << 10;
3844
3845 if (!tea575x_init(btv)) {
3846 pr_info("%d: Terratec Active Radio Upgrade found\n", btv->c.nr);
3847 btv->has_saa6588 = 1;
3848 }
3849
3850 return 0;
3851 }
3852
3853
3854 /* ----------------------------------------------------------------------- */
3855
3856 /*
3857 * minimal bootstrap for the WinTV/PVR -- upload altera firmware.
3858 *
3859 * The hcwamc.rbf firmware file is on the Hauppauge driver CD. Have
3860 * a look at Pvr/pvr45xxx.EXE (self-extracting zip archive, can be
3861 * unpacked with unzip).
3862 */
3863 #define PVR_GPIO_DELAY 10
3864
3865 #define BTTV_ALT_DATA 0x000001
3866 #define BTTV_ALT_DCLK 0x100000
3867 #define BTTV_ALT_NCONFIG 0x800000
3868
3869 static int pvr_altera_load(struct bttv *btv, const u8 *micro, u32 microlen)
3870 {
3871 u32 n;
3872 u8 bits;
3873 int i;
3874
3875 gpio_inout(0xffffff,BTTV_ALT_DATA|BTTV_ALT_DCLK|BTTV_ALT_NCONFIG);
3876 gpio_write(0);
3877 udelay(PVR_GPIO_DELAY);
3878
3879 gpio_write(BTTV_ALT_NCONFIG);
3880 udelay(PVR_GPIO_DELAY);
3881
3882 for (n = 0; n < microlen; n++) {
3883 bits = micro[n];
3884 for (i = 0 ; i < 8 ; i++) {
3885 gpio_bits(BTTV_ALT_DCLK,0);
3886 if (bits & 0x01)
3887 gpio_bits(BTTV_ALT_DATA,BTTV_ALT_DATA);
3888 else
3889 gpio_bits(BTTV_ALT_DATA,0);
3890 gpio_bits(BTTV_ALT_DCLK,BTTV_ALT_DCLK);
3891 bits >>= 1;
3892 }
3893 }
3894 gpio_bits(BTTV_ALT_DCLK,0);
3895 udelay(PVR_GPIO_DELAY);
3896
3897 /* begin Altera init loop (Not necessary,but doesn't hurt) */
3898 for (i = 0 ; i < 30 ; i++) {
3899 gpio_bits(BTTV_ALT_DCLK,0);
3900 gpio_bits(BTTV_ALT_DCLK,BTTV_ALT_DCLK);
3901 }
3902 gpio_bits(BTTV_ALT_DCLK,0);
3903 return 0;
3904 }
3905
3906 static int pvr_boot(struct bttv *btv)
3907 {
3908 const struct firmware *fw_entry;
3909 int rc;
3910
3911 rc = request_firmware(&fw_entry, "hcwamc.rbf", &btv->c.pci->dev);
3912 if (rc != 0) {
3913 pr_warn("%d: no altera firmware [via hotplug]\n", btv->c.nr);
3914 return rc;
3915 }
3916 rc = pvr_altera_load(btv, fw_entry->data, fw_entry->size);
3917 pr_info("%d: altera firmware upload %s\n",
3918 btv->c.nr, (rc < 0) ? "failed" : "ok");
3919 release_firmware(fw_entry);
3920 return rc;
3921 }
3922
3923 /* ----------------------------------------------------------------------- */
3924 /* some osprey specific stuff */
3925
3926 static void osprey_eeprom(struct bttv *btv, const u8 ee[256])
3927 {
3928 int i;
3929 u32 serial = 0;
3930 int cardid = -1;
3931
3932 /* This code will nevery actually get called in this case.... */
3933 if (btv->c.type == BTTV_BOARD_UNKNOWN) {
3934 /* this might be an antique... check for MMAC label in eeprom */
3935 if (!strncmp(ee, "MMAC", 4)) {
3936 u8 checksum = 0;
3937 for (i = 0; i < 21; i++)
3938 checksum += ee[i];
3939 if (checksum != ee[21])
3940 return;
3941 cardid = BTTV_BOARD_OSPREY1x0_848;
3942 for (i = 12; i < 21; i++)
3943 serial *= 10, serial += ee[i] - '0';
3944 }
3945 } else {
3946 unsigned short type;
3947
3948 for (i = 4 * 16; i < 8 * 16; i += 16) {
3949 u16 checksum = (__force u16)ip_compute_csum(ee + i, 16);
3950
3951 if ((checksum & 0xff) + (checksum >> 8) == 0xff)
3952 break;
3953 }
3954 if (i >= 8*16)
3955 return;
3956 ee += i;
3957
3958 /* found a valid descriptor */
3959 type = get_unaligned_be16((__be16 *)(ee+4));
3960
3961 switch(type) {
3962 /* 848 based */
3963 case 0x0004:
3964 cardid = BTTV_BOARD_OSPREY1x0_848;
3965 break;
3966 case 0x0005:
3967 cardid = BTTV_BOARD_OSPREY101_848;
3968 break;
3969
3970 /* 878 based */
3971 case 0x0012:
3972 case 0x0013:
3973 cardid = BTTV_BOARD_OSPREY1x0;
3974 break;
3975 case 0x0014:
3976 case 0x0015:
3977 cardid = BTTV_BOARD_OSPREY1x1;
3978 break;
3979 case 0x0016:
3980 case 0x0017:
3981 case 0x0020:
3982 cardid = BTTV_BOARD_OSPREY1x1_SVID;
3983 break;
3984 case 0x0018:
3985 case 0x0019:
3986 case 0x001E:
3987 case 0x001F:
3988 cardid = BTTV_BOARD_OSPREY2xx;
3989 break;
3990 case 0x001A:
3991 case 0x001B:
3992 cardid = BTTV_BOARD_OSPREY2x0_SVID;
3993 break;
3994 case 0x0040:
3995 cardid = BTTV_BOARD_OSPREY500;
3996 break;
3997 case 0x0050:
3998 case 0x0056:
3999 cardid = BTTV_BOARD_OSPREY540;
4000 /* bttv_osprey_540_init(btv); */
4001 break;
4002 case 0x0060:
4003 case 0x0070:
4004 case 0x00A0:
4005 cardid = BTTV_BOARD_OSPREY2x0;
4006 /* enable output on select control lines */
4007 gpio_inout(0xffffff,0x000303);
4008 break;
4009 case 0x00D8:
4010 cardid = BTTV_BOARD_OSPREY440;
4011 break;
4012 default:
4013 /* unknown...leave generic, but get serial # */
4014 pr_info("%d: osprey eeprom: unknown card type 0x%04x\n",
4015 btv->c.nr, type);
4016 break;
4017 }
4018 serial = get_unaligned_be32((__be32 *)(ee+6));
4019 }
4020
4021 pr_info("%d: osprey eeprom: card=%d '%s' serial=%u\n",
4022 btv->c.nr, cardid,
4023 cardid > 0 ? bttv_tvcards[cardid].name : "Unknown", serial);
4024
4025 if (cardid<0 || btv->c.type == cardid)
4026 return;
4027
4028 /* card type isn't set correctly */
4029 if (card[btv->c.nr] < bttv_num_tvcards) {
4030 pr_warn("%d: osprey eeprom: Not overriding user specified card type\n",
4031 btv->c.nr);
4032 } else {
4033 pr_info("%d: osprey eeprom: Changing card type from %d to %d\n",
4034 btv->c.nr, btv->c.type, cardid);
4035 btv->c.type = cardid;
4036 }
4037 }
4038
4039 /* ----------------------------------------------------------------------- */
4040 /* AVermedia specific stuff, from bktr_card.c */
4041
4042 static int tuner_0_table[] = {
4043 TUNER_PHILIPS_NTSC, TUNER_PHILIPS_PAL /* PAL-BG*/,
4044 TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL /* PAL-I*/,
4045 TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL,
4046 TUNER_PHILIPS_SECAM, TUNER_PHILIPS_SECAM,
4047 TUNER_PHILIPS_SECAM, TUNER_PHILIPS_PAL,
4048 TUNER_PHILIPS_FM1216ME_MK3 };
4049
4050 static int tuner_1_table[] = {
4051 TUNER_TEMIC_NTSC, TUNER_TEMIC_PAL,
4052 TUNER_TEMIC_PAL, TUNER_TEMIC_PAL,
4053 TUNER_TEMIC_PAL, TUNER_TEMIC_PAL,
4054 TUNER_TEMIC_4012FY5, TUNER_TEMIC_4012FY5, /* TUNER_TEMIC_SECAM */
4055 TUNER_TEMIC_4012FY5, TUNER_TEMIC_PAL};
4056
4057 static void avermedia_eeprom(struct bttv *btv)
4058 {
4059 int tuner_make, tuner_tv_fm, tuner_format, tuner_type = 0;
4060
4061 tuner_make = (eeprom_data[0x41] & 0x7);
4062 tuner_tv_fm = (eeprom_data[0x41] & 0x18) >> 3;
4063 tuner_format = (eeprom_data[0x42] & 0xf0) >> 4;
4064 btv->has_remote = (eeprom_data[0x42] & 0x01);
4065
4066 if (tuner_make == 0 || tuner_make == 2)
4067 if (tuner_format <= 0x0a)
4068 tuner_type = tuner_0_table[tuner_format];
4069 if (tuner_make == 1)
4070 if (tuner_format <= 9)
4071 tuner_type = tuner_1_table[tuner_format];
4072
4073 if (tuner_make == 4)
4074 if (tuner_format == 0x09)
4075 tuner_type = TUNER_LG_NTSC_NEW_TAPC; /* TAPC-G702P */
4076
4077 pr_info("%d: Avermedia eeprom[0x%02x%02x]: tuner=",
4078 btv->c.nr, eeprom_data[0x41], eeprom_data[0x42]);
4079 if (tuner_type) {
4080 btv->tuner_type = tuner_type;
4081 pr_cont("%d", tuner_type);
4082 } else
4083 pr_cont("Unknown type");
4084 pr_cont(" radio:%s remote control:%s\n",
4085 tuner_tv_fm ? "yes" : "no",
4086 btv->has_remote ? "yes" : "no");
4087 }
4088
4089 /*
4090 * For Voodoo TV/FM and Voodoo 200. These cards' tuners use a TDA9880
4091 * analog demod, which is not I2C controlled like the newer and more common
4092 * TDA9887 series. Instead is has two tri-state input pins, S0 and S1,
4093 * that control the IF for the video and audio. Apparently, bttv GPIO
4094 * 0x10000 is connected to S0. S0 low selects a 38.9 MHz VIF for B/G/D/K/I
4095 * (i.e., PAL) while high selects 45.75 MHz for M/N (i.e., NTSC).
4096 */
4097 u32 bttv_tda9880_setnorm(struct bttv *btv, u32 gpiobits)
4098 {
4099
4100 if (btv->audio_input == TVAUDIO_INPUT_TUNER) {
4101 if (bttv_tvnorms[btv->tvnorm].v4l2_id & V4L2_STD_MN)
4102 gpiobits |= 0x10000;
4103 else
4104 gpiobits &= ~0x10000;
4105 }
4106
4107 gpio_bits(bttv_tvcards[btv->c.type].gpiomask, gpiobits);
4108 return gpiobits;
4109 }
4110
4111
4112 /*
4113 * reset/enable the MSP on some Hauppauge cards
4114 * Thanks to Kyösti Mälkki (kmalkki@cc.hut.fi)!
4115 *
4116 * Hauppauge: pin 5
4117 * Voodoo: pin 20
4118 */
4119 static void boot_msp34xx(struct bttv *btv, int pin)
4120 {
4121 int mask = (1 << pin);
4122
4123 gpio_inout(mask,mask);
4124 gpio_bits(mask,0);
4125 mdelay(2);
4126 udelay(500);
4127 gpio_bits(mask,mask);
4128
4129 if (bttv_gpio)
4130 bttv_gpio_tracking(btv,"msp34xx");
4131 if (bttv_verbose)
4132 pr_info("%d: Hauppauge/Voodoo msp34xx: reset line init [%d]\n",
4133 btv->c.nr, pin);
4134 }
4135
4136 /* ----------------------------------------------------------------------- */
4137 /* Imagenation L-Model PXC200 Framegrabber */
4138 /* This is basically the same procedure as
4139 * used by Alessandro Rubini in his pxc200
4140 * driver, but using BTTV functions */
4141
4142 static void init_PXC200(struct bttv *btv)
4143 {
4144 static int vals[] = { 0x08, 0x09, 0x0a, 0x0b, 0x0d, 0x0d, 0x01, 0x02,
4145 0x03, 0x04, 0x05, 0x06, 0x00 };
4146 unsigned int i;
4147 int tmp;
4148 u32 val;
4149
4150 /* Initialise GPIO-connevted stuff */
4151 gpio_inout(0xffffff, (1<<13));
4152 gpio_write(0);
4153 udelay(3);
4154 gpio_write(1<<13);
4155 /* GPIO inputs are pulled up, so no need to drive
4156 * reset pin any longer */
4157 gpio_bits(0xffffff, 0);
4158 if (bttv_gpio)
4159 bttv_gpio_tracking(btv,"pxc200");
4160
4161 /* we could/should try and reset/control the AD pots? but
4162 right now we simply turned off the crushing. Without
4163 this the AGC drifts drifts
4164 remember the EN is reverse logic -->
4165 setting BT848_ADC_AGC_EN disable the AGC
4166 tboult@eecs.lehigh.edu
4167 */
4168
4169 btwrite(BT848_ADC_RESERVED|BT848_ADC_AGC_EN, BT848_ADC);
4170
4171 /* Initialise MAX517 DAC */
4172 pr_info("Setting DAC reference voltage level ...\n");
4173 bttv_I2CWrite(btv,0x5E,0,0x80,1);
4174
4175 /* Initialise 12C508 PIC */
4176 /* The I2CWrite and I2CRead commmands are actually to the
4177 * same chips - but the R/W bit is included in the address
4178 * argument so the numbers are different */
4179
4180
4181 pr_info("Initialising 12C508 PIC chip ...\n");
4182
4183 /* First of all, enable the clock line. This is used in the PXC200-F */
4184 val = btread(BT848_GPIO_DMA_CTL);
4185 val |= BT848_GPIO_DMA_CTL_GPCLKMODE;
4186 btwrite(val, BT848_GPIO_DMA_CTL);
4187
4188 /* Then, push to 0 the reset pin long enough to reset the *
4189 * device same as above for the reset line, but not the same
4190 * value sent to the GPIO-connected stuff
4191 * which one is the good one? */
4192 gpio_inout(0xffffff,(1<<2));
4193 gpio_write(0);
4194 udelay(10);
4195 gpio_write(1<<2);
4196
4197 for (i = 0; i < ARRAY_SIZE(vals); i++) {
4198 tmp=bttv_I2CWrite(btv,0x1E,0,vals[i],1);
4199 if (tmp != -1) {
4200 pr_info("I2C Write(%2.2x) = %i\nI2C Read () = %2.2x\n\n",
4201 vals[i],tmp,bttv_I2CRead(btv,0x1F,NULL));
4202 }
4203 }
4204
4205 pr_info("PXC200 Initialised\n");
4206 }
4207
4208
4209
4210 /* ----------------------------------------------------------------------- */
4211 /*
4212 * The Adlink RTV-24 (aka Angelo) has some special initialisation to unlock
4213 * it. This apparently involves the following procedure for each 878 chip:
4214 *
4215 * 1) write 0x00C3FEFF to the GPIO_OUT_EN register
4216 *
4217 * 2) write to GPIO_DATA
4218 * - 0x0E
4219 * - sleep 1ms
4220 * - 0x10 + 0x0E
4221 * - sleep 10ms
4222 * - 0x0E
4223 * read from GPIO_DATA into buf (uint_32)
4224 * - if ( data>>18 & 0x01 != 0) || ( buf>>19 & 0x01 != 1 )
4225 * error. ERROR_CPLD_Check_Failed stop.
4226 *
4227 * 3) write to GPIO_DATA
4228 * - write 0x4400 + 0x0E
4229 * - sleep 10ms
4230 * - write 0x4410 + 0x0E
4231 * - sleep 1ms
4232 * - write 0x0E
4233 * read from GPIO_DATA into buf (uint_32)
4234 * - if ( buf>>18 & 0x01 ) || ( buf>>19 & 0x01 != 0 )
4235 * error. ERROR_CPLD_Check_Failed.
4236 */
4237 /* ----------------------------------------------------------------------- */
4238 static void
4239 init_RTV24 (struct bttv *btv)
4240 {
4241 uint32_t dataRead = 0;
4242 long watchdog_value = 0x0E;
4243
4244 pr_info("%d: Adlink RTV-24 initialisation in progress ...\n",
4245 btv->c.nr);
4246
4247 btwrite (0x00c3feff, BT848_GPIO_OUT_EN);
4248
4249 btwrite (0 + watchdog_value, BT848_GPIO_DATA);
4250 msleep (1);
4251 btwrite (0x10 + watchdog_value, BT848_GPIO_DATA);
4252 msleep (10);
4253 btwrite (0 + watchdog_value, BT848_GPIO_DATA);
4254
4255 dataRead = btread (BT848_GPIO_DATA);
4256
4257 if ((((dataRead >> 18) & 0x01) != 0) || (((dataRead >> 19) & 0x01) != 1)) {
4258 pr_info("%d: Adlink RTV-24 initialisation(1) ERROR_CPLD_Check_Failed (read %d)\n",
4259 btv->c.nr, dataRead);
4260 }
4261
4262 btwrite (0x4400 + watchdog_value, BT848_GPIO_DATA);
4263 msleep (10);
4264 btwrite (0x4410 + watchdog_value, BT848_GPIO_DATA);
4265 msleep (1);
4266 btwrite (watchdog_value, BT848_GPIO_DATA);
4267 msleep (1);
4268 dataRead = btread (BT848_GPIO_DATA);
4269
4270 if ((((dataRead >> 18) & 0x01) != 0) || (((dataRead >> 19) & 0x01) != 0)) {
4271 pr_info("%d: Adlink RTV-24 initialisation(2) ERROR_CPLD_Check_Failed (read %d)\n",
4272 btv->c.nr, dataRead);
4273
4274 return;
4275 }
4276
4277 pr_info("%d: Adlink RTV-24 initialisation complete\n", btv->c.nr);
4278 }
4279
4280
4281
4282 /* ----------------------------------------------------------------------- */
4283 /*
4284 * The PCI-8604PW contains a CPLD, probably an ispMACH 4A, that filters
4285 * the PCI REQ signals comming from the four BT878 chips. After power
4286 * up, the CPLD does not forward requests to the bus, which prevents
4287 * the BT878 from fetching RISC instructions from memory. While the
4288 * CPLD is connected to most of the GPIOs of PCI device 0xD, only
4289 * five appear to play a role in unlocking the REQ signal. The following
4290 * sequence has been determined by trial and error without access to the
4291 * original driver.
4292 *
4293 * Eight GPIOs of device 0xC are provided on connector CN4 (4 in, 4 out).
4294 * Devices 0xE and 0xF do not appear to have anything connected to their
4295 * GPIOs.
4296 *
4297 * The correct GPIO_OUT_EN value might have some more bits set. It should
4298 * be possible to derive it from a boundary scan of the CPLD. Its JTAG
4299 * pins are routed to test points.
4300 *
4301 */
4302 /* ----------------------------------------------------------------------- */
4303 static void
4304 init_PCI8604PW(struct bttv *btv)
4305 {
4306 int state;
4307
4308 if ((PCI_SLOT(btv->c.pci->devfn) & ~3) != 0xC) {
4309 pr_warn("This is not a PCI-8604PW\n");
4310 return;
4311 }
4312
4313 if (PCI_SLOT(btv->c.pci->devfn) != 0xD)
4314 return;
4315
4316 btwrite(0x080002, BT848_GPIO_OUT_EN);
4317
4318 state = (btread(BT848_GPIO_DATA) >> 21) & 7;
4319
4320 for (;;) {
4321 switch (state) {
4322 case 1:
4323 case 5:
4324 case 6:
4325 case 4:
4326 pr_debug("PCI-8604PW in state %i, toggling pin\n",
4327 state);
4328 btwrite(0x080000, BT848_GPIO_DATA);
4329 msleep(1);
4330 btwrite(0x000000, BT848_GPIO_DATA);
4331 msleep(1);
4332 break;
4333 case 7:
4334 pr_info("PCI-8604PW unlocked\n");
4335 return;
4336 case 0:
4337 /* FIXME: If we are in state 7 and toggle GPIO[19] one
4338 more time, the CPLD goes into state 0, where PCI bus
4339 mastering is inhibited again. We have not managed to
4340 get out of that state. */
4341
4342 pr_err("PCI-8604PW locked until reset\n");
4343 return;
4344 default:
4345 pr_err("PCI-8604PW in unknown state %i\n", state);
4346 return;
4347 }
4348
4349 state = (state << 4) | ((btread(BT848_GPIO_DATA) >> 21) & 7);
4350
4351 switch (state) {
4352 case 0x15:
4353 case 0x56:
4354 case 0x64:
4355 case 0x47:
4356 /* The transition from state 7 to state 0 is, as explained
4357 above, valid but undesired and with this code impossible
4358 as we exit as soon as we are in state 7.
4359 case 0x70: */
4360 break;
4361 default:
4362 pr_err("PCI-8604PW invalid transition %i -> %i\n",
4363 state >> 4, state & 7);
4364 return;
4365 }
4366 state &= 7;
4367 }
4368 }
4369
4370 /* RemoteVision MX (rv605) muxsel helper [Miguel Freitas]
4371 *
4372 * This is needed because rv605 don't use a normal multiplex, but a crosspoint
4373 * switch instead (CD22M3494E). This IC can have multiple active connections
4374 * between Xn (input) and Yn (output) pins. We need to clear any existing
4375 * connection prior to establish a new one, pulsing the STROBE pin.
4376 *
4377 * The board hardwire Y0 (xpoint) to MUX1 and MUXOUT to Yin.
4378 * GPIO pins are wired as:
4379 * GPIO[0:3] - AX[0:3] (xpoint) - P1[0:3] (microcontroller)
4380 * GPIO[4:6] - AY[0:2] (xpoint) - P1[4:6] (microcontroller)
4381 * GPIO[7] - DATA (xpoint) - P1[7] (microcontroller)
4382 * GPIO[8] - - P3[5] (microcontroller)
4383 * GPIO[9] - RESET (xpoint) - P3[6] (microcontroller)
4384 * GPIO[10] - STROBE (xpoint) - P3[7] (microcontroller)
4385 * GPINTR - - P3[4] (microcontroller)
4386 *
4387 * The microcontroller is a 80C32 like. It should be possible to change xpoint
4388 * configuration either directly (as we are doing) or using the microcontroller
4389 * which is also wired to I2C interface. I have no further info on the
4390 * microcontroller features, one would need to disassembly the firmware.
4391 * note: the vendor refused to give any information on this product, all
4392 * that stuff was found using a multimeter! :)
4393 */
4394 static void rv605_muxsel(struct bttv *btv, unsigned int input)
4395 {
4396 static const u8 muxgpio[] = { 0x3, 0x1, 0x2, 0x4, 0xf, 0x7, 0xe, 0x0,
4397 0xd, 0xb, 0xc, 0x6, 0x9, 0x5, 0x8, 0xa };
4398
4399 gpio_bits(0x07f, muxgpio[input]);
4400
4401 /* reset all conections */
4402 gpio_bits(0x200,0x200);
4403 mdelay(1);
4404 gpio_bits(0x200,0x000);
4405 mdelay(1);
4406
4407 /* create a new connection */
4408 gpio_bits(0x480,0x480);
4409 mdelay(1);
4410 gpio_bits(0x480,0x080);
4411 mdelay(1);
4412 }
4413
4414 /* Tibet Systems 'Progress DVR' CS16 muxsel helper [Chris Fanning]
4415 *
4416 * The CS16 (available on eBay cheap) is a PCI board with four Fusion
4417 * 878A chips, a PCI bridge, an Atmel microcontroller, four sync separator
4418 * chips, ten eight input analog multiplexors, a not chip and a few
4419 * other components.
4420 *
4421 * 16 inputs on a secondary bracket are provided and can be selected
4422 * from each of the four capture chips. Two of the eight input
4423 * multiplexors are used to select from any of the 16 input signals.
4424 *
4425 * Unsupported hardware capabilities:
4426 * . A video output monitor on the secondary bracket can be selected from
4427 * one of the 878A chips.
4428 * . Another passthrough but I haven't spent any time investigating it.
4429 * . Digital I/O (logic level connected to GPIO) is available from an
4430 * onboard header.
4431 *
4432 * The on chip input mux should always be set to 2.
4433 * GPIO[16:19] - Video input selection
4434 * GPIO[0:3] - Video output monitor select (only available from one 878A)
4435 * GPIO[?:?] - Digital I/O.
4436 *
4437 * There is an ATMEL microcontroller with an 8031 core on board. I have not
4438 * determined what function (if any) it provides. With the microcontroller
4439 * and sync separator chips a guess is that it might have to do with video
4440 * switching and maybe some digital I/O.
4441 */
4442 static void tibetCS16_muxsel(struct bttv *btv, unsigned int input)
4443 {
4444 /* video mux */
4445 gpio_bits(0x0f0000, input << 16);
4446 }
4447
4448 static void tibetCS16_init(struct bttv *btv)
4449 {
4450 /* enable gpio bits, mask obtained via btSpy */
4451 gpio_inout(0xffffff, 0x0f7fff);
4452 gpio_write(0x0f7fff);
4453 }
4454
4455 /*
4456 * The following routines for the Kodicom-4400r get a little mind-twisting.
4457 * There is a "master" controller and three "slave" controllers, together
4458 * an analog switch which connects any of 16 cameras to any of the BT87A's.
4459 * The analog switch is controlled by the "master", but the detection order
4460 * of the four BT878A chips is in an order which I just don't understand.
4461 * The "master" is actually the second controller to be detected. The
4462 * logic on the board uses logical numbers for the 4 controllers, but
4463 * those numbers are different from the detection sequence. When working
4464 * with the analog switch, we need to "map" from the detection sequence
4465 * over to the board's logical controller number. This mapping sequence
4466 * is {3, 0, 2, 1}, i.e. the first controller to be detected is logical
4467 * unit 3, the second (which is the master) is logical unit 0, etc.
4468 * We need to maintain the status of the analog switch (which of the 16
4469 * cameras is connected to which of the 4 controllers) in sw_status array.
4470 */
4471
4472 /*
4473 * First a routine to set the analog switch, which controls which camera
4474 * is routed to which controller. The switch comprises an X-address
4475 * (gpio bits 0-3, representing the camera, ranging from 0-15), and a
4476 * Y-address (gpio bits 4-6, representing the controller, ranging from 0-3).
4477 * A data value (gpio bit 7) of '1' enables the switch, and '0' disables
4478 * the switch. A STROBE bit (gpio bit 8) latches the data value into the
4479 * specified address. The idea is to set the address and data, then bring
4480 * STROBE high, and finally bring STROBE back to low.
4481 */
4482 static void kodicom4400r_write(struct bttv *btv,
4483 unsigned char xaddr,
4484 unsigned char yaddr,
4485 unsigned char data) {
4486 unsigned int udata;
4487
4488 udata = (data << 7) | ((yaddr&3) << 4) | (xaddr&0xf);
4489 gpio_bits(0x1ff, udata); /* write ADDR and DAT */
4490 gpio_bits(0x1ff, udata | (1 << 8)); /* strobe high */
4491 gpio_bits(0x1ff, udata); /* strobe low */
4492 }
4493
4494 /*
4495 * Next the mux select. Both the "master" and "slave" 'cards' (controllers)
4496 * use this routine. The routine finds the "master" for the card, maps
4497 * the controller number from the detected position over to the logical
4498 * number, writes the appropriate data to the analog switch, and housekeeps
4499 * the local copy of the switch information. The parameter 'input' is the
4500 * requested camera number (0 - 15).
4501 */
4502 static void kodicom4400r_muxsel(struct bttv *btv, unsigned int input)
4503 {
4504 int xaddr, yaddr;
4505 struct bttv *mctlr;
4506 static unsigned char map[4] = {3, 0, 2, 1};
4507
4508 mctlr = master[btv->c.nr];
4509 if (mctlr == NULL) { /* ignore if master not yet detected */
4510 return;
4511 }
4512 yaddr = (btv->c.nr - mctlr->c.nr + 1) & 3; /* the '&' is for safety */
4513 yaddr = map[yaddr];
4514 xaddr = input & 0xf;
4515 /* Check if the controller/camera pair has changed, else ignore */
4516 if (mctlr->sw_status[yaddr] != xaddr)
4517 {
4518 /* "open" the old switch, "close" the new one, save the new */
4519 kodicom4400r_write(mctlr, mctlr->sw_status[yaddr], yaddr, 0);
4520 mctlr->sw_status[yaddr] = xaddr;
4521 kodicom4400r_write(mctlr, xaddr, yaddr, 1);
4522 }
4523 }
4524
4525 /*
4526 * During initialisation, we need to reset the analog switch. We
4527 * also preset the switch to map the 4 connectors on the card to the
4528 * *user's* (see above description of kodicom4400r_muxsel) channels
4529 * 0 through 3
4530 */
4531 static void kodicom4400r_init(struct bttv *btv)
4532 {
4533 int ix;
4534
4535 gpio_inout(0x0003ff, 0x0003ff);
4536 gpio_write(1 << 9); /* reset MUX */
4537 gpio_write(0);
4538 /* Preset camera 0 to the 4 controllers */
4539 for (ix = 0; ix < 4; ix++) {
4540 btv->sw_status[ix] = ix;
4541 kodicom4400r_write(btv, ix, ix, 1);
4542 }
4543 /*
4544 * Since this is the "master", we need to set up the
4545 * other three controller chips' pointers to this structure
4546 * for later use in the muxsel routine.
4547 */
4548 if ((btv->c.nr<1) || (btv->c.nr>BTTV_MAX-3))
4549 return;
4550 master[btv->c.nr-1] = btv;
4551 master[btv->c.nr] = btv;
4552 master[btv->c.nr+1] = btv;
4553 master[btv->c.nr+2] = btv;
4554 }
4555
4556 /* The Grandtec X-Guard framegrabber card uses two Dual 4-channel
4557 * video multiplexers to provide up to 16 video inputs. These
4558 * multiplexers are controlled by the lower 8 GPIO pins of the
4559 * bt878. The multiplexers probably Pericom PI5V331Q or similar.
4560
4561 * xxx0 is pin xxx of multiplexer U5,
4562 * yyy1 is pin yyy of multiplexer U2
4563 */
4564 #define ENA0 0x01
4565 #define ENB0 0x02
4566 #define ENA1 0x04
4567 #define ENB1 0x08
4568
4569 #define IN10 0x10
4570 #define IN00 0x20
4571 #define IN11 0x40
4572 #define IN01 0x80
4573
4574 static void xguard_muxsel(struct bttv *btv, unsigned int input)
4575 {
4576 static const int masks[] = {
4577 ENB0, ENB0|IN00, ENB0|IN10, ENB0|IN00|IN10,
4578 ENA0, ENA0|IN00, ENA0|IN10, ENA0|IN00|IN10,
4579 ENB1, ENB1|IN01, ENB1|IN11, ENB1|IN01|IN11,
4580 ENA1, ENA1|IN01, ENA1|IN11, ENA1|IN01|IN11,
4581 };
4582 gpio_write(masks[input%16]);
4583 }
4584 static void picolo_tetra_init(struct bttv *btv)
4585 {
4586 /*This is the video input redirection fonctionality : I DID NOT USED IT. */
4587 btwrite (0x08<<16,BT848_GPIO_DATA);/*GPIO[19] [==> 4053 B+C] set to 1 */
4588 btwrite (0x04<<16,BT848_GPIO_DATA);/*GPIO[18] [==> 4053 A] set to 1*/
4589 }
4590 static void picolo_tetra_muxsel (struct bttv* btv, unsigned int input)
4591 {
4592
4593 dprintk("%d : picolo_tetra_muxsel => input = %d\n", btv->c.nr, input);
4594 /*Just set the right path in the analog multiplexers : channel 1 -> 4 ==> Analog Mux ==> MUX0*/
4595 /*GPIO[20]&GPIO[21] used to choose the right input*/
4596 btwrite (input<<20,BT848_GPIO_DATA);
4597
4598 }
4599
4600 /*
4601 * ivc120_muxsel [Added by Alan Garfield <alan@fromorbit.com>]
4602 *
4603 * The IVC120G security card has 4 i2c controlled TDA8540 matrix
4604 * swichers to provide 16 channels to MUX0. The TDA8540's have
4605 * 4 independent outputs and as such the IVC120G also has the
4606 * optional "Monitor Out" bus. This allows the card to be looking
4607 * at one input while the monitor is looking at another.
4608 *
4609 * Since I've couldn't be bothered figuring out how to add an
4610 * independent muxsel for the monitor bus, I've just set it to
4611 * whatever the card is looking at.
4612 *
4613 * OUT0 of the TDA8540's is connected to MUX0 (0x03)
4614 * OUT1 of the TDA8540's is connected to "Monitor Out" (0x0C)
4615 *
4616 * TDA8540_ALT3 IN0-3 = Channel 13 - 16 (0x03)
4617 * TDA8540_ALT4 IN0-3 = Channel 1 - 4 (0x03)
4618 * TDA8540_ALT5 IN0-3 = Channel 5 - 8 (0x03)
4619 * TDA8540_ALT6 IN0-3 = Channel 9 - 12 (0x03)
4620 *
4621 */
4622
4623 /* All 7 possible sub-ids for the TDA8540 Matrix Switcher */
4624 #define I2C_TDA8540 0x90
4625 #define I2C_TDA8540_ALT1 0x92
4626 #define I2C_TDA8540_ALT2 0x94
4627 #define I2C_TDA8540_ALT3 0x96
4628 #define I2C_TDA8540_ALT4 0x98
4629 #define I2C_TDA8540_ALT5 0x9a
4630 #define I2C_TDA8540_ALT6 0x9c
4631
4632 static void ivc120_muxsel(struct bttv *btv, unsigned int input)
4633 {
4634 /* Simple maths */
4635 int key = input % 4;
4636 int matrix = input / 4;
4637
4638 dprintk("%d: ivc120_muxsel: Input - %02d | TDA - %02d | In - %02d\n",
4639 btv->c.nr, input, matrix, key);
4640
4641 /* Handles the input selection on the TDA8540's */
4642 bttv_I2CWrite(btv, I2C_TDA8540_ALT3, 0x00,
4643 ((matrix == 3) ? (key | key << 2) : 0x00), 1);
4644 bttv_I2CWrite(btv, I2C_TDA8540_ALT4, 0x00,
4645 ((matrix == 0) ? (key | key << 2) : 0x00), 1);
4646 bttv_I2CWrite(btv, I2C_TDA8540_ALT5, 0x00,
4647 ((matrix == 1) ? (key | key << 2) : 0x00), 1);
4648 bttv_I2CWrite(btv, I2C_TDA8540_ALT6, 0x00,
4649 ((matrix == 2) ? (key | key << 2) : 0x00), 1);
4650
4651 /* Handles the output enables on the TDA8540's */
4652 bttv_I2CWrite(btv, I2C_TDA8540_ALT3, 0x02,
4653 ((matrix == 3) ? 0x03 : 0x00), 1); /* 13 - 16 */
4654 bttv_I2CWrite(btv, I2C_TDA8540_ALT4, 0x02,
4655 ((matrix == 0) ? 0x03 : 0x00), 1); /* 1-4 */
4656 bttv_I2CWrite(btv, I2C_TDA8540_ALT5, 0x02,
4657 ((matrix == 1) ? 0x03 : 0x00), 1); /* 5-8 */
4658 bttv_I2CWrite(btv, I2C_TDA8540_ALT6, 0x02,
4659 ((matrix == 2) ? 0x03 : 0x00), 1); /* 9-12 */
4660
4661 /* 878's MUX0 is already selected for input via muxsel values */
4662 }
4663
4664
4665 /* PXC200 muxsel helper
4666 * luke@syseng.anu.edu.au
4667 * another transplant
4668 * from Alessandro Rubini (rubini@linux.it)
4669 *
4670 * There are 4 kinds of cards:
4671 * PXC200L which is bt848
4672 * PXC200F which is bt848 with PIC controlling mux
4673 * PXC200AL which is bt878
4674 * PXC200AF which is bt878 with PIC controlling mux
4675 */
4676 #define PX_CFG_PXC200F 0x01
4677 #define PX_FLAG_PXC200A 0x00001000 /* a pxc200A is bt-878 based */
4678 #define PX_I2C_PIC 0x0f
4679 #define PX_PXC200A_CARDID 0x200a1295
4680 #define PX_I2C_CMD_CFG 0x00
4681
4682 static void PXC200_muxsel(struct bttv *btv, unsigned int input)
4683 {
4684 int rc;
4685 long mux;
4686 int bitmask;
4687 unsigned char buf[2];
4688
4689 /* Read PIC config to determine if this is a PXC200F */
4690 /* PX_I2C_CMD_CFG*/
4691 buf[0]=0;
4692 buf[1]=0;
4693 rc=bttv_I2CWrite(btv,(PX_I2C_PIC<<1),buf[0],buf[1],1);
4694 if (rc) {
4695 pr_debug("%d: PXC200_muxsel: pic cfg write failed:%d\n",
4696 btv->c.nr, rc);
4697 /* not PXC ? do nothing */
4698 return;
4699 }
4700
4701 rc=bttv_I2CRead(btv,(PX_I2C_PIC<<1),NULL);
4702 if (!(rc & PX_CFG_PXC200F)) {
4703 pr_debug("%d: PXC200_muxsel: not PXC200F rc:%d\n",
4704 btv->c.nr, rc);
4705 return;
4706 }
4707
4708
4709 /* The multiplexer in the 200F is handled by the GPIO port */
4710 /* get correct mapping between inputs */
4711 /* mux = bttv_tvcards[btv->type].muxsel[input] & 3; */
4712 /* ** not needed!? */
4713 mux = input;
4714
4715 /* make sure output pins are enabled */
4716 /* bitmask=0x30f; */
4717 bitmask=0x302;
4718 /* check whether we have a PXC200A */
4719 if (btv->cardid == PX_PXC200A_CARDID) {
4720 bitmask ^= 0x180; /* use 7 and 9, not 8 and 9 */
4721 bitmask |= 7<<4; /* the DAC */
4722 }
4723 btwrite(bitmask, BT848_GPIO_OUT_EN);
4724
4725 bitmask = btread(BT848_GPIO_DATA);
4726 if (btv->cardid == PX_PXC200A_CARDID)
4727 bitmask = (bitmask & ~0x280) | ((mux & 2) << 8) | ((mux & 1) << 7);
4728 else /* older device */
4729 bitmask = (bitmask & ~0x300) | ((mux & 3) << 8);
4730 btwrite(bitmask,BT848_GPIO_DATA);
4731
4732 /*
4733 * Was "to be safe, set the bt848 to input 0"
4734 * Actually, since it's ok at load time, better not messing
4735 * with these bits (on PXC200AF you need to set mux 2 here)
4736 *
4737 * needed because bttv-driver sets mux before calling this function
4738 */
4739 if (btv->cardid == PX_PXC200A_CARDID)
4740 btaor(2<<5, ~BT848_IFORM_MUXSEL, BT848_IFORM);
4741 else /* older device */
4742 btand(~BT848_IFORM_MUXSEL,BT848_IFORM);
4743
4744 pr_debug("%d: setting input channel to:%d\n", btv->c.nr, (int)mux);
4745 }
4746
4747 static void phytec_muxsel(struct bttv *btv, unsigned int input)
4748 {
4749 unsigned int mux = input % 4;
4750
4751 if (input == btv->svhs)
4752 mux = 0;
4753
4754 gpio_bits(0x3, mux);
4755 }
4756
4757 /*
4758 * GeoVision GV-800(S) functions
4759 * Bruno Christo <bchristo@inf.ufsm.br>
4760 */
4761
4762 /* This is a function to control the analog switch, which determines which
4763 * camera is routed to which controller. The switch comprises an X-address
4764 * (gpio bits 0-3, representing the camera, ranging from 0-15), and a
4765 * Y-address (gpio bits 4-6, representing the controller, ranging from 0-3).
4766 * A data value (gpio bit 18) of '1' enables the switch, and '0' disables
4767 * the switch. A STROBE bit (gpio bit 17) latches the data value into the
4768 * specified address. There is also a chip select (gpio bit 16).
4769 * The idea is to set the address and chip select together, bring
4770 * STROBE high, write the data, and finally bring STROBE back to low.
4771 */
4772 static void gv800s_write(struct bttv *btv,
4773 unsigned char xaddr,
4774 unsigned char yaddr,
4775 unsigned char data) {
4776 /* On the "master" 878A:
4777 * GPIO bits 0-9 are used for the analog switch:
4778 * 00 - 03: camera selector
4779 * 04 - 06: 878A (controller) selector
4780 * 16: cselect
4781 * 17: strobe
4782 * 18: data (1->on, 0->off)
4783 * 19: reset
4784 */
4785 const u32 ADDRESS = ((xaddr&0xf) | (yaddr&3)<<4);
4786 const u32 CSELECT = 1<<16;
4787 const u32 STROBE = 1<<17;
4788 const u32 DATA = data<<18;
4789
4790 gpio_bits(0x1007f, ADDRESS | CSELECT); /* write ADDRESS and CSELECT */
4791 gpio_bits(0x20000, STROBE); /* STROBE high */
4792 gpio_bits(0x40000, DATA); /* write DATA */
4793 gpio_bits(0x20000, ~STROBE); /* STROBE low */
4794 }
4795
4796 /*
4797 * GeoVision GV-800(S) muxsel
4798 *
4799 * Each of the 4 cards (controllers) use this function.
4800 * The controller using this function selects the input through the GPIO pins
4801 * of the "master" card. A pointer to this card is stored in master[btv->c.nr].
4802 *
4803 * The parameter 'input' is the requested camera number (0-4) on the controller.
4804 * The map array has the address of each input. Note that the addresses in the
4805 * array are in the sequence the original GeoVision driver uses, that is, set
4806 * every controller to input 0, then to input 1, 2, 3, repeat. This means that
4807 * the physical "camera 1" connector corresponds to controller 0 input 0,
4808 * "camera 2" corresponds to controller 1 input 0, and so on.
4809 *
4810 * After getting the input address, the function then writes the appropriate
4811 * data to the analog switch, and housekeeps the local copy of the switch
4812 * information.
4813 */
4814 static void gv800s_muxsel(struct bttv *btv, unsigned int input)
4815 {
4816 struct bttv *mctlr;
4817 int xaddr, yaddr;
4818 static unsigned int map[4][4] = { { 0x0, 0x4, 0xa, 0x6 },
4819 { 0x1, 0x5, 0xb, 0x7 },
4820 { 0x2, 0x8, 0xc, 0xe },
4821 { 0x3, 0x9, 0xd, 0xf } };
4822 input = input%4;
4823 mctlr = master[btv->c.nr];
4824 if (mctlr == NULL) {
4825 /* do nothing until the "master" is detected */
4826 return;
4827 }
4828 yaddr = (btv->c.nr - mctlr->c.nr) & 3;
4829 xaddr = map[yaddr][input] & 0xf;
4830
4831 /* Check if the controller/camera pair has changed, ignore otherwise */
4832 if (mctlr->sw_status[yaddr] != xaddr) {
4833 /* disable the old switch, enable the new one and save status */
4834 gv800s_write(mctlr, mctlr->sw_status[yaddr], yaddr, 0);
4835 mctlr->sw_status[yaddr] = xaddr;
4836 gv800s_write(mctlr, xaddr, yaddr, 1);
4837 }
4838 }
4839
4840 /* GeoVision GV-800(S) "master" chip init */
4841 static void gv800s_init(struct bttv *btv)
4842 {
4843 int ix;
4844
4845 gpio_inout(0xf107f, 0xf107f);
4846 gpio_write(1<<19); /* reset the analog MUX */
4847 gpio_write(0);
4848
4849 /* Preset camera 0 to the 4 controllers */
4850 for (ix = 0; ix < 4; ix++) {
4851 btv->sw_status[ix] = ix;
4852 gv800s_write(btv, ix, ix, 1);
4853 }
4854
4855 /* Inputs on the "master" controller need this brightness fix */
4856 bttv_I2CWrite(btv, 0x18, 0x5, 0x90, 1);
4857
4858 if (btv->c.nr > BTTV_MAX-4)
4859 return;
4860 /*
4861 * Store the "master" controller pointer in the master
4862 * array for later use in the muxsel function.
4863 */
4864 master[btv->c.nr] = btv;
4865 master[btv->c.nr+1] = btv;
4866 master[btv->c.nr+2] = btv;
4867 master[btv->c.nr+3] = btv;
4868 }
4869
4870 /* ----------------------------------------------------------------------- */
4871 /* motherboard chipset specific stuff */
4872
4873 void __init bttv_check_chipset(void)
4874 {
4875 int pcipci_fail = 0;
4876 struct pci_dev *dev = NULL;
4877
4878 if (pci_pci_problems & (PCIPCI_FAIL|PCIAGP_FAIL)) /* should check if target is AGP */
4879 pcipci_fail = 1;
4880 if (pci_pci_problems & (PCIPCI_TRITON|PCIPCI_NATOMA|PCIPCI_VIAETBF))
4881 triton1 = 1;
4882 if (pci_pci_problems & PCIPCI_VSFX)
4883 vsfx = 1;
4884 #ifdef PCIPCI_ALIMAGIK
4885 if (pci_pci_problems & PCIPCI_ALIMAGIK)
4886 latency = 0x0A;
4887 #endif
4888
4889
4890 /* print warnings about any quirks found */
4891 if (triton1)
4892 pr_info("Host bridge needs ETBF enabled\n");
4893 if (vsfx)
4894 pr_info("Host bridge needs VSFX enabled\n");
4895 if (pcipci_fail) {
4896 pr_info("bttv and your chipset may not work together\n");
4897 if (!no_overlay) {
4898 pr_info("overlay will be disabled\n");
4899 no_overlay = 1;
4900 } else {
4901 pr_info("overlay forced. Use this option at your own risk.\n");
4902 }
4903 }
4904 if (UNSET != latency)
4905 pr_info("pci latency fixup [%d]\n", latency);
4906 while ((dev = pci_get_device(PCI_VENDOR_ID_INTEL,
4907 PCI_DEVICE_ID_INTEL_82441, dev))) {
4908 unsigned char b;
4909 pci_read_config_byte(dev, 0x53, &b);
4910 if (bttv_debug)
4911 pr_info("Host bridge: 82441FX Natoma, bufcon=0x%02x\n",
4912 b);
4913 }
4914 }
4915
4916 int bttv_handle_chipset(struct bttv *btv)
4917 {
4918 unsigned char command;
4919
4920 if (!triton1 && !vsfx && UNSET == latency)
4921 return 0;
4922
4923 if (bttv_verbose) {
4924 if (triton1)
4925 pr_info("%d: enabling ETBF (430FX/VP3 compatibility)\n",
4926 btv->c.nr);
4927 if (vsfx && btv->id >= 878)
4928 pr_info("%d: enabling VSFX\n", btv->c.nr);
4929 if (UNSET != latency)
4930 pr_info("%d: setting pci timer to %d\n",
4931 btv->c.nr, latency);
4932 }
4933
4934 if (btv->id < 878) {
4935 /* bt848 (mis)uses a bit in the irq mask for etbf */
4936 if (triton1)
4937 btv->triton1 = BT848_INT_ETBF;
4938 } else {
4939 /* bt878 has a bit in the pci config space for it */
4940 pci_read_config_byte(btv->c.pci, BT878_DEVCTRL, &command);
4941 if (triton1)
4942 command |= BT878_EN_TBFX;
4943 if (vsfx)
4944 command |= BT878_EN_VSFX;
4945 pci_write_config_byte(btv->c.pci, BT878_DEVCTRL, command);
4946 }
4947 if (UNSET != latency)
4948 pci_write_config_byte(btv->c.pci, PCI_LATENCY_TIMER, latency);
4949 return 0;
4950 }