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