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