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