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