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