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