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