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