[PATCH] m32r: trap handler code for illegal traps
[linux-3.10.git] / drivers / media / video / 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/config.h>
29 #include <linux/delay.h>
30 #include <linux/module.h>
31 #include <linux/moduleparam.h>
32 #include <linux/kmod.h>
33 #include <linux/init.h>
34 #include <linux/pci.h>
35 #include <linux/vmalloc.h>
36 #include <linux/firmware.h>
37
38 #include <asm/io.h>
39
40 #include "bttvp.h"
41
42 /* fwd decl */
43 static void boot_msp34xx(struct bttv *btv, int pin);
44 static void boot_bt832(struct bttv *btv);
45 static void hauppauge_eeprom(struct bttv *btv);
46 static void avermedia_eeprom(struct bttv *btv);
47 static void osprey_eeprom(struct bttv *btv);
48 static void modtec_eeprom(struct bttv *btv);
49 static void init_PXC200(struct bttv *btv);
50 static void init_RTV24(struct bttv *btv);
51
52 static void winview_audio(struct bttv *btv, struct video_audio *v, int set);
53 static void lt9415_audio(struct bttv *btv, struct video_audio *v, int set);
54 static void avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v,
55                                     int set);
56 static void avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v,
57                                       int set);
58 static void terratv_audio(struct bttv *btv, struct video_audio *v, int set);
59 static void gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set);
60 static void gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set);
61 static void winfast2000_audio(struct bttv *btv, struct video_audio *v, int set);
62 static void pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set);
63 static void fv2000s_audio(struct bttv *btv, struct video_audio *v, int set);
64 static void windvr_audio(struct bttv *btv, struct video_audio *v, int set);
65 static void adtvk503_audio(struct bttv *btv, struct video_audio *v, int set);
66 static void rv605_muxsel(struct bttv *btv, unsigned int input);
67 static void eagle_muxsel(struct bttv *btv, unsigned int input);
68 static void xguard_muxsel(struct bttv *btv, unsigned int input);
69 static void ivc120_muxsel(struct bttv *btv, unsigned int input);
70 static void gvc1100_muxsel(struct bttv *btv, unsigned int input);
71
72 static void PXC200_muxsel(struct bttv *btv, unsigned int input);
73
74 static void picolo_tetra_muxsel(struct bttv *btv, unsigned int input);
75 static void picolo_tetra_init(struct bttv *btv);
76
77 static void tibetCS16_muxsel(struct bttv *btv, unsigned int input);
78 static void tibetCS16_init(struct bttv *btv);
79
80 static void kodicom4400r_muxsel(struct bttv *btv, unsigned int input);
81 static void kodicom4400r_init(struct bttv *btv);
82
83 static void sigmaSLC_muxsel(struct bttv *btv, unsigned int input);
84 static void sigmaSQ_muxsel(struct bttv *btv, unsigned int input);
85
86 static int terratec_active_radio_upgrade(struct bttv *btv);
87 static int tea5757_read(struct bttv *btv);
88 static int tea5757_write(struct bttv *btv, int value);
89 static void identify_by_eeprom(struct bttv *btv,
90                                unsigned char eeprom_data[256]);
91 static int __devinit pvr_boot(struct bttv *btv);
92
93 /* config variables */
94 static unsigned int triton1=0;
95 static unsigned int vsfx=0;
96 static unsigned int latency = UNSET;
97 int no_overlay=-1;
98
99 static unsigned int card[BTTV_MAX]   = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
100 static unsigned int pll[BTTV_MAX]    = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
101 static unsigned int tuner[BTTV_MAX]  = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
102 static unsigned int svhs[BTTV_MAX]   = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
103 static unsigned int remote[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
104 static struct bttv  *master[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = NULL };
105 #ifdef MODULE
106 static unsigned int autoload = 1;
107 #else
108 static unsigned int autoload = 0;
109 #endif
110 static unsigned int gpiomask = UNSET;
111 static unsigned int audioall = UNSET;
112 static unsigned int audiomux[5] = { [ 0 ... 4 ] = UNSET };
113
114 /* insmod options */
115 module_param(triton1,    int, 0444);
116 module_param(vsfx,       int, 0444);
117 module_param(no_overlay, int, 0444);
118 module_param(latency,    int, 0444);
119 module_param(gpiomask,   int, 0444);
120 module_param(audioall,   int, 0444);
121 module_param(autoload,   int, 0444);
122
123 module_param_array(card,     int, NULL, 0444);
124 module_param_array(pll,      int, NULL, 0444);
125 module_param_array(tuner,    int, NULL, 0444);
126 module_param_array(svhs,     int, NULL, 0444);
127 module_param_array(remote,   int, NULL, 0444);
128 module_param_array(audiomux, int, NULL, 0444);
129
130 MODULE_PARM_DESC(triton1,"set ETBF pci config bit "
131                  "[enable bug compatibility for triton1 + others]");
132 MODULE_PARM_DESC(vsfx,"set VSFX pci config bit "
133                  "[yet another chipset flaw workaround]");
134 MODULE_PARM_DESC(latency,"pci latency timer");
135 MODULE_PARM_DESC(card,"specify TV/grabber card model, see CARDLIST file for a list");
136 MODULE_PARM_DESC(pll,"specify installed crystal (0=none, 28=28 MHz, 35=35 MHz)");
137 MODULE_PARM_DESC(tuner,"specify installed tuner type");
138 MODULE_PARM_DESC(autoload,"automatically load i2c modules like tuner.o, default is 1 (yes)");
139
140 /* ----------------------------------------------------------------------- */
141 /* list of card IDs for bt878+ cards                                       */
142
143 static struct CARD {
144         unsigned id;
145         int cardnr;
146         char *name;
147 } cards[] __devinitdata = {
148         { 0x13eb0070, BTTV_HAUPPAUGE878,  "Hauppauge WinTV" },
149         { 0x39000070, BTTV_HAUPPAUGE878,  "Hauppauge WinTV-D" },
150         { 0x45000070, BTTV_HAUPPAUGEPVR,  "Hauppauge WinTV/PVR" },
151         { 0xff000070, BTTV_OSPREY1x0,     "Osprey-100" },
152         { 0xff010070, BTTV_OSPREY2x0_SVID,"Osprey-200" },
153         { 0xff020070, BTTV_OSPREY500,     "Osprey-500" },
154         { 0xff030070, BTTV_OSPREY2000,    "Osprey-2000" },
155         { 0xff040070, BTTV_OSPREY540,     "Osprey-540" },
156
157         { 0x00011002, BTTV_ATI_TVWONDER,  "ATI TV Wonder" },
158         { 0x00031002, BTTV_ATI_TVWONDERVE,"ATI TV Wonder/VE" },
159
160         { 0x6606107d, BTTV_WINFAST2000,   "Leadtek WinFast TV 2000" },
161         { 0x6607107d, BTTV_WINFASTVC100,  "Leadtek WinFast VC 100" },
162         { 0x6609107d, BTTV_WINFAST2000,   "Leadtek TV 2000 XP" },
163         { 0x263610b4, BTTV_STB2,          "STB TV PCI FM, Gateway P/N 6000704" },
164         { 0x264510b4, BTTV_STB2,          "STB TV PCI FM, Gateway P/N 6000704" },
165         { 0x402010fc, BTTV_GVBCTV3PCI,    "I-O Data Co. GV-BCTV3/PCI" },
166         { 0x405010fc, BTTV_GVBCTV4PCI,    "I-O Data Co. GV-BCTV4/PCI" },
167         { 0x407010fc, BTTV_GVBCTV5PCI,    "I-O Data Co. GV-BCTV5/PCI" },
168         { 0xd01810fc, BTTV_GVBCTV5PCI,    "I-O Data Co. GV-BCTV5/PCI" },
169
170         { 0x001211bd, BTTV_PINNACLE,      "Pinnacle PCTV" },
171         /* some cards ship with byteswapped IDs ... */
172         { 0x1200bd11, BTTV_PINNACLE,      "Pinnacle PCTV [bswap]" },
173         { 0xff00bd11, BTTV_PINNACLE,      "Pinnacle PCTV [bswap]" },
174         /* this seems to happen as well ... */
175         { 0xff1211bd, BTTV_PINNACLE,      "Pinnacle PCTV" },
176
177         { 0x3000121a, BTTV_VOODOOTV_FM,   "3Dfx VoodooTV FM/ VoodooTV 200" },
178         { 0x263710b4, BTTV_VOODOOTV_FM,   "3Dfx VoodooTV FM/ VoodooTV 200" },
179         { 0x3060121a, BTTV_STB2,          "3Dfx VoodooTV 100/ STB OEM" },
180
181         { 0x3000144f, BTTV_MAGICTVIEW063, "(Askey Magic/others) TView99 CPH06x" },
182         { 0xa005144f, BTTV_MAGICTVIEW063, "CPH06X TView99-Card" },
183         { 0x3002144f, BTTV_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH05x" },
184         { 0x3005144f, BTTV_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH061/06L (T1/LC)" },
185         { 0x5000144f, BTTV_MAGICTVIEW061, "Askey CPH050" },
186         { 0x300014ff, BTTV_MAGICTVIEW061, "TView 99 (CPH061)" },
187         { 0x300214ff, BTTV_PHOEBE_TVMAS,  "Phoebe TV Master (CPH060)" },
188
189         { 0x00011461, BTTV_AVPHONE98,     "AVerMedia TVPhone98" },
190         { 0x00021461, BTTV_AVERMEDIA98,   "AVermedia TVCapture 98" },
191         { 0x00031461, BTTV_AVPHONE98,     "AVerMedia TVPhone98" },
192         { 0x00041461, BTTV_AVERMEDIA98,   "AVerMedia TVCapture 98" },
193         { 0x03001461, BTTV_AVERMEDIA98,   "VDOMATE TV TUNER CARD" },
194
195         { 0x1117153b, BTTV_TERRATVALUE,   "Terratec TValue (Philips PAL B/G)" },
196         { 0x1118153b, BTTV_TERRATVALUE,   "Terratec TValue (Temic PAL B/G)" },
197         { 0x1119153b, BTTV_TERRATVALUE,   "Terratec TValue (Philips PAL I)" },
198         { 0x111a153b, BTTV_TERRATVALUE,   "Terratec TValue (Temic PAL I)" },
199
200         { 0x1123153b, BTTV_TERRATVRADIO,  "Terratec TV Radio+" },
201         { 0x1127153b, BTTV_TERRATV,       "Terratec TV+ (V1.05)"    },
202         /* clashes with FlyVideo
203          *{ 0x18521852, BTTV_TERRATV,     "Terratec TV+ (V1.10)"    }, */
204         { 0x1134153b, BTTV_TERRATVALUE,   "Terratec TValue (LR102)" },
205         { 0x1135153b, BTTV_TERRATVALUER,  "Terratec TValue Radio" }, /* LR102 */
206         { 0x5018153b, BTTV_TERRATVALUE,   "Terratec TValue" },       /* ?? */
207         { 0xff3b153b, BTTV_TERRATVALUER,  "Terratec TValue Radio" }, /* ?? */
208
209         { 0x400015b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV" },
210         { 0x400a15b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV" },
211         { 0x400d15b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
212         { 0x401015b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
213         { 0x401615b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
214
215         { 0x1430aa00, BTTV_PV143,         "Provideo PV143A" },
216         { 0x1431aa00, BTTV_PV143,         "Provideo PV143B" },
217         { 0x1432aa00, BTTV_PV143,         "Provideo PV143C" },
218         { 0x1433aa00, BTTV_PV143,         "Provideo PV143D" },
219         { 0x1433aa03, BTTV_PV143,         "Security Eyes" },
220
221         { 0x1460aa00, BTTV_PV150,         "Provideo PV150A-1" },
222         { 0x1461aa01, BTTV_PV150,         "Provideo PV150A-2" },
223         { 0x1462aa02, BTTV_PV150,         "Provideo PV150A-3" },
224         { 0x1463aa03, BTTV_PV150,         "Provideo PV150A-4" },
225
226         { 0x1464aa04, BTTV_PV150,         "Provideo PV150B-1" },
227         { 0x1465aa05, BTTV_PV150,         "Provideo PV150B-2" },
228         { 0x1466aa06, BTTV_PV150,         "Provideo PV150B-3" },
229         { 0x1467aa07, BTTV_PV150,         "Provideo PV150B-4" },
230
231         { 0xa132ff00, BTTV_IVC100,        "IVC-100"  },
232         { 0xa1550000, BTTV_IVC200,        "IVC-200"  },
233         { 0xa1550001, BTTV_IVC200,        "IVC-200"  },
234         { 0xa1550002, BTTV_IVC200,        "IVC-200"  },
235         { 0xa1550003, BTTV_IVC200,        "IVC-200"  },
236         { 0xa1550100, BTTV_IVC200,        "IVC-200G" },
237         { 0xa1550101, BTTV_IVC200,        "IVC-200G" },
238         { 0xa1550102, BTTV_IVC200,        "IVC-200G" },
239         { 0xa1550103, BTTV_IVC200,        "IVC-200G" },
240         { 0xa182ff00, BTTV_IVC120,        "IVC-120G" },
241         { 0xa182ff01, BTTV_IVC120,        "IVC-120G" },
242         { 0xa182ff02, BTTV_IVC120,        "IVC-120G" },
243         { 0xa182ff03, BTTV_IVC120,        "IVC-120G" },
244         { 0xa182ff04, BTTV_IVC120,        "IVC-120G" },
245         { 0xa182ff05, BTTV_IVC120,        "IVC-120G" },
246         { 0xa182ff06, BTTV_IVC120,        "IVC-120G" },
247         { 0xa182ff07, BTTV_IVC120,        "IVC-120G" },
248         { 0xa182ff08, BTTV_IVC120,        "IVC-120G" },
249         { 0xa182ff09, BTTV_IVC120,        "IVC-120G" },
250         { 0xa182ff0a, BTTV_IVC120,        "IVC-120G" },
251         { 0xa182ff0b, BTTV_IVC120,        "IVC-120G" },
252         { 0xa182ff0c, BTTV_IVC120,        "IVC-120G" },
253         { 0xa182ff0d, BTTV_IVC120,        "IVC-120G" },
254         { 0xa182ff0e, BTTV_IVC120,        "IVC-120G" },
255         { 0xa182ff0f, BTTV_IVC120,        "IVC-120G" },
256
257         { 0x41424344, BTTV_GRANDTEC,      "GrandTec Multi Capture" },
258         { 0x01020304, BTTV_XGUARD,        "Grandtec Grand X-Guard" },
259
260         { 0x18501851, BTTV_CHRONOS_VS2,   "FlyVideo 98 (LR50)/ Chronos Video Shuttle II" },
261         { 0xa0501851, BTTV_CHRONOS_VS2,   "FlyVideo 98 (LR50)/ Chronos Video Shuttle II" },
262         { 0x18511851, BTTV_FLYVIDEO98EZ,  "FlyVideo 98EZ (LR51)/ CyberMail AV" },
263         { 0x18521852, BTTV_TYPHOON_TVIEW, "FlyVideo 98FM (LR50)/ Typhoon TView TV/FM Tuner" },
264         { 0x41a0a051, BTTV_FLYVIDEO_98FM, "Lifeview FlyVideo 98 LR50 Rev Q" },
265         { 0x18501f7f, BTTV_FLYVIDEO_98,   "Lifeview Flyvideo 98" },
266
267         { 0x010115cb, BTTV_GMV1,          "AG GMV1" },
268         { 0x010114c7, BTTV_MODTEC_205,    "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV" },
269
270         { 0x10b42636, BTTV_HAUPPAUGE878,  "STB ???" },
271         { 0x217d6606, BTTV_WINFAST2000,   "Leadtek WinFast TV 2000" },
272         { 0xfff6f6ff, BTTV_WINFAST2000,   "Leadtek WinFast TV 2000" },
273         { 0x03116000, BTTV_SENSORAY311,   "Sensoray 311" },
274         { 0x00790e11, BTTV_WINDVR,        "Canopus WinDVR PCI" },
275         { 0xa0fca1a0, BTTV_ZOLTRIX,       "Face to Face Tvmax" },
276         { 0x20007063, BTTV_PC_HDTV,       "pcHDTV HD-2000 TV"},
277         { 0x82b2aa6a, BTTV_SIMUS_GVC1100, "SIMUS GVC1100" },
278         { 0x146caa0c, BTTV_PV951,         "ituner spectra8" },
279         { 0x200a1295, BTTV_PXC200,        "ImageNation PXC200A" },
280
281         { 0x40111554, BTTV_PV_BT878P_9B,  "Prolink Pixelview PV-BT" },
282         { 0x17de0a01, BTTV_KWORLD,        "Mecer TV/FM/Video Tuner" },
283
284         { 0x01051805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #1" },
285         { 0x01061805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #2" },
286         { 0x01071805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #3" },
287         { 0x01081805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #4" },
288
289         { 0x15409511, BTTV_ACORP_Y878F, "Acorp Y878F" },
290
291         /* likely broken, vendor id doesn't match the other magic views ...
292          * { 0xa0fca04f, BTTV_MAGICTVIEW063, "Guillemot Maxi TV Video 3" }, */
293
294         /* DVB cards (using pci function .1 for mpeg data xfer) */
295         { 0x01010071, BTTV_NEBULA_DIGITV, "Nebula Electronics DigiTV" },
296         { 0x07611461, BTTV_AVDVBT_761,    "AverMedia AverTV DVB-T 761" },
297         { 0x001c11bd, BTTV_PINNACLESAT,   "Pinnacle PCTV Sat" },
298         { 0x002611bd, BTTV_TWINHAN_DST,   "Pinnacle PCTV SAT CI" },
299         { 0x00011822, BTTV_TWINHAN_DST,   "Twinhan VisionPlus DVB" },
300         { 0xfc00270f, BTTV_TWINHAN_DST,   "ChainTech digitop DST-1000 DVB-S" },
301         { 0x07711461, BTTV_AVDVBT_771,    "AVermedia AverTV DVB-T 771" },
302         { 0xdb1018ac, BTTV_DVICO_DVBT_LITE,    "DViCO FusionHDTV DVB-T Lite" },
303         { 0xd50018ac, BTTV_DVICO_FUSIONHDTV_5_LITE,    "DViCO FusionHDTV 5 Lite" },
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 {
313 /* ---- card 0x00 ---------------------------------- */
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     = -1,
321         .tuner_addr     = ADDR_UNSET,
322 },{
323         .name           = "MIRO PCTV",
324         .video_inputs   = 4,
325         .audio_inputs   = 1,
326         .tuner          = 0,
327         .svhs           = 2,
328         .gpiomask       = 15,
329         .muxsel         = { 2, 3, 1, 1},
330         .audiomux       = { 2, 0, 0, 0, 10},
331         .needs_tvaudio  = 1,
332         .tuner_type     = -1,
333         .tuner_addr     = ADDR_UNSET,
334 },{
335         .name           = "Hauppauge (bt848)",
336         .video_inputs   = 4,
337         .audio_inputs   = 1,
338         .tuner          = 0,
339         .svhs           = 2,
340         .gpiomask       = 7,
341         .muxsel         = { 2, 3, 1, 1},
342         .audiomux       = { 0, 1, 2, 3, 4},
343         .needs_tvaudio  = 1,
344         .tuner_type     = -1,
345         .tuner_addr     = ADDR_UNSET,
346 },{
347         .name           = "STB, Gateway P/N 6000699 (bt848)",
348         .video_inputs   = 3,
349         .audio_inputs   = 1,
350         .tuner          = 0,
351         .svhs           = 2,
352         .gpiomask       = 7,
353         .muxsel         = { 2, 3, 1, 1},
354         .audiomux       = { 4, 0, 2, 3, 1},
355         .no_msp34xx     = 1,
356         .needs_tvaudio  = 1,
357         .tuner_type     = TUNER_PHILIPS_NTSC,
358         .tuner_addr     = ADDR_UNSET,
359         .pll            = PLL_28,
360         .has_radio      = 1,
361 },{
362
363 /* ---- card 0x04 ---------------------------------- */
364         .name           = "Intel Create and Share PCI/ Smart Video Recorder III",
365         .video_inputs   = 4,
366         .audio_inputs   = 0,
367         .tuner          = -1,
368         .svhs           = 2,
369         .gpiomask       = 0,
370         .muxsel         = { 2, 3, 1, 1},
371         .audiomux       = { 0 },
372         .needs_tvaudio  = 0,
373         .tuner_type     = 4,
374         .tuner_addr     = ADDR_UNSET,
375 },{
376         .name           = "Diamond DTV2000",
377         .video_inputs   = 4,
378         .audio_inputs   = 1,
379         .tuner          = 0,
380         .svhs           = 2,
381         .gpiomask       = 3,
382         .muxsel         = { 2, 3, 1, 0},
383         .audiomux       = { 0, 1, 0, 1, 3},
384         .needs_tvaudio  = 1,
385         .tuner_type     = -1,
386         .tuner_addr     = ADDR_UNSET,
387 },{
388         .name           = "AVerMedia TVPhone",
389         .video_inputs   = 3,
390         .audio_inputs   = 1,
391         .tuner          = 0,
392         .svhs           = 3,
393         .muxsel         = { 2, 3, 1, 1},
394         .gpiomask       = 0x0f,
395         .audiomux       = { 0x0c, 0x04, 0x08, 0x04, 0},
396         /*                0x04 for some cards ?? */
397         .needs_tvaudio  = 1,
398         .tuner_type     = -1,
399         .tuner_addr     = ADDR_UNSET,
400         .audio_hook     = avermedia_tvphone_audio,
401         .has_remote     = 1,
402 },{
403         .name           = "MATRIX-Vision MV-Delta",
404         .video_inputs   = 5,
405         .audio_inputs   = 1,
406         .tuner          = -1,
407         .svhs           = 3,
408         .gpiomask       = 0,
409         .muxsel         = { 2, 3, 1, 0, 0},
410         .audiomux       = {0 },
411         .needs_tvaudio  = 1,
412         .tuner_type     = -1,
413         .tuner_addr     = ADDR_UNSET,
414 },{
415
416 /* ---- card 0x08 ---------------------------------- */
417         .name           = "Lifeview FlyVideo II (Bt848) LR26 / MAXI TV Video PCI2 LR26",
418         .video_inputs   = 4,
419         .audio_inputs   = 1,
420         .tuner          = 0,
421         .svhs           = 2,
422         .gpiomask       = 0xc00,
423         .muxsel         = { 2, 3, 1, 1},
424         .audiomux       = { 0, 0xc00, 0x800, 0x400, 0xc00, 0},
425         .needs_tvaudio  = 1,
426         .pll            = PLL_28,
427         .tuner_type     = -1,
428         .tuner_addr     = ADDR_UNSET,
429 },{
430         .name           = "IMS/IXmicro TurboTV",
431         .video_inputs   = 3,
432         .audio_inputs   = 1,
433         .tuner          = 0,
434         .svhs           = 2,
435         .gpiomask       = 3,
436         .muxsel         = { 2, 3, 1, 1},
437         .audiomux       = { 1, 1, 2, 3, 0},
438         .needs_tvaudio  = 0,
439         .pll            = PLL_28,
440         .tuner_type     = TUNER_TEMIC_PAL,
441         .tuner_addr     = ADDR_UNSET,
442 },{
443         .name           = "Hauppauge (bt878)",
444         .video_inputs   = 4,
445         .audio_inputs   = 1,
446         .tuner          = 0,
447         .svhs           = 2,
448         .gpiomask       = 0x0f, /* old: 7 */
449         .muxsel         = { 2, 0, 1, 1},
450         .audiomux       = { 0, 1, 2, 3, 4},
451         .needs_tvaudio  = 1,
452         .pll            = PLL_28,
453         .tuner_type     = -1,
454         .tuner_addr     = ADDR_UNSET,
455 },{
456         .name           = "MIRO PCTV pro",
457         .video_inputs   = 3,
458         .audio_inputs   = 1,
459         .tuner          = 0,
460         .svhs           = 2,
461         .gpiomask       = 0x3014f,
462         .muxsel         = { 2, 3, 1, 1},
463         .audiomux       = { 0x20001,0x10001, 0, 0,10},
464         .needs_tvaudio  = 1,
465         .tuner_type     = -1,
466         .tuner_addr     = ADDR_UNSET,
467 },{
468
469 /* ---- card 0x0c ---------------------------------- */
470         .name           = "ADS Technologies Channel Surfer TV (bt848)",
471         .video_inputs   = 3,
472         .audio_inputs   = 1,
473         .tuner          = 0,
474         .svhs           = 2,
475         .gpiomask       = 15,
476         .muxsel         = { 2, 3, 1, 1},
477         .audiomux       = { 13, 14, 11, 7, 0, 0},
478         .needs_tvaudio  = 1,
479         .tuner_type     = -1,
480         .tuner_addr     = ADDR_UNSET,
481 },{
482         .name           = "AVerMedia TVCapture 98",
483         .video_inputs   = 3,
484         .audio_inputs   = 4,
485         .tuner          = 0,
486         .svhs           = 2,
487         .gpiomask       = 15,
488         .muxsel         = { 2, 3, 1, 1},
489         .audiomux       = { 13, 14, 11, 7, 0, 0},
490         .needs_tvaudio  = 1,
491         .msp34xx_alt    = 1,
492         .pll            = PLL_28,
493         .tuner_type     = TUNER_PHILIPS_PAL,
494         .tuner_addr     = ADDR_UNSET,
495         .audio_hook     = avermedia_tv_stereo_audio,
496 },{
497         .name           = "Aimslab Video Highway Xtreme (VHX)",
498         .video_inputs   = 3,
499         .audio_inputs   = 1,
500         .tuner          = 0,
501         .svhs           = 2,
502         .gpiomask       = 7,
503         .muxsel         = { 2, 3, 1, 1},
504         .audiomux       = { 0, 2, 1, 3, 4}, /* old: { 0, 1, 2, 3, 4} */
505         .needs_tvaudio  = 1,
506         .pll            = PLL_28,
507         .tuner_type     = -1,
508         .tuner_addr     = ADDR_UNSET,
509 },{
510         .name           = "Zoltrix TV-Max",
511         .video_inputs   = 3,
512         .audio_inputs   = 1,
513         .tuner          = 0,
514         .svhs           = 2,
515         .gpiomask       = 15,
516         .muxsel         = { 2, 3, 1, 1},
517         .audiomux       = {0 , 0, 1 , 0, 10},
518         .needs_tvaudio  = 1,
519         .tuner_type     = -1,
520         .tuner_addr     = ADDR_UNSET,
521 },{
522
523 /* ---- card 0x10 ---------------------------------- */
524         .name           = "Prolink Pixelview PlayTV (bt878)",
525         .video_inputs   = 3,
526         .audio_inputs   = 1,
527         .tuner          = 0,
528         .svhs           = 2,
529         .gpiomask       = 0x01fe00,
530         .muxsel         = { 2, 3, 1, 1},
531         /* 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru> */
532         .audiomux       = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 },
533         .needs_tvaudio  = 1,
534         .pll            = PLL_28,
535         .tuner_type     = -1,
536 },{
537         .name           = "Leadtek WinView 601",
538         .video_inputs   = 3,
539         .audio_inputs   = 1,
540         .tuner          = 0,
541         .svhs           = 2,
542         .gpiomask       = 0x8300f8,
543         .muxsel         = { 2, 3, 1, 1,0},
544         .audiomux       = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007},
545         .needs_tvaudio  = 1,
546         .tuner_type     = -1,
547         .tuner_addr     = ADDR_UNSET,
548         .audio_hook     = winview_audio,
549         .has_radio      = 1,
550 },{
551         .name           = "AVEC Intercapture",
552         .video_inputs   = 3,
553         .audio_inputs   = 2,
554         .tuner          = 0,
555         .svhs           = 2,
556         .gpiomask       = 0,
557         .muxsel         = {2, 3, 1, 1},
558         .audiomux       = {1, 0, 0, 0, 0},
559         .needs_tvaudio  = 1,
560         .tuner_type     = -1,
561         .tuner_addr     = ADDR_UNSET,
562 },{
563         .name           = "Lifeview FlyVideo II EZ /FlyKit LR38 Bt848 (capture only)",
564         .video_inputs   = 4,
565         .audio_inputs   = 1,
566         .tuner          = -1,
567         .svhs           = -1,
568         .gpiomask       = 0x8dff00,
569         .muxsel         = { 2, 3, 1, 1},
570         .audiomux       = { 0 },
571         .no_msp34xx     = 1,
572         .tuner_type     = -1,
573         .tuner_addr     = ADDR_UNSET,
574 },{
575
576 /* ---- card 0x14 ---------------------------------- */
577         .name           = "CEI Raffles Card",
578         .video_inputs   = 3,
579         .audio_inputs   = 3,
580         .tuner          = 0,
581         .svhs           = 2,
582         .muxsel         = {2, 3, 1, 1},
583         .tuner_type     = -1,
584         .tuner_addr     = ADDR_UNSET,
585 },{
586         .name           = "Lifeview FlyVideo 98/ Lucky Star Image World ConferenceTV LR50",
587         .video_inputs   = 4,
588         .audio_inputs   = 2,  /* tuner, line in */
589         .tuner          = 0,
590         .svhs           = 2,
591         .gpiomask       = 0x1800,
592         .muxsel         = { 2, 3, 1, 1},
593         .audiomux       = { 0, 0x800, 0x1000, 0x1000, 0x1800},
594         .pll            = PLL_28,
595         .tuner_type     = TUNER_PHILIPS_PAL_I,
596         .tuner_addr     = ADDR_UNSET,
597 },{
598         .name           = "Askey CPH050/ Phoebe Tv Master + FM",
599         .video_inputs   = 3,
600         .audio_inputs   = 1,
601         .tuner          = 0,
602         .svhs           = 2,
603         .gpiomask       = 0xc00,
604         .muxsel         = { 2, 3, 1, 1},
605         .audiomux       = {0, 1, 0x800, 0x400, 0xc00, 0},
606         .needs_tvaudio  = 1,
607         .pll            = PLL_28,
608         .tuner_type     = -1,
609         .tuner_addr     = ADDR_UNSET,
610 },{
611         .name           = "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV, bt878",
612         .video_inputs   = 3,
613         .audio_inputs   = 1,
614         .tuner          = 0,
615         .svhs           = -1,
616         .gpiomask       = 7,
617         .muxsel         = { 2, 3, -1 },
618         .digital_mode   = DIGITAL_MODE_CAMERA,
619         .audiomux       = { 0, 0, 0, 0, 0 },
620         .no_msp34xx     = 1,
621         .pll            = PLL_28,
622         .tuner_type     = TUNER_ALPS_TSBB5_PAL_I,
623         .tuner_addr     = ADDR_UNSET,
624 },{
625
626 /* ---- card 0x18 ---------------------------------- */
627         .name           = "Askey CPH05X/06X (bt878) [many vendors]",
628         .video_inputs   = 3,
629         .audio_inputs   = 1,
630         .tuner          = 0,
631         .svhs           = 2,
632         .gpiomask       = 0xe00,
633         .muxsel         = { 2, 3, 1, 1},
634         .audiomux       = {0x400, 0x400, 0x400, 0x400, 0xc00},
635         .needs_tvaudio  = 1,
636         .pll            = PLL_28,
637         .tuner_type     = -1,
638         .tuner_addr     = ADDR_UNSET,
639         .has_remote     = 1,
640 },{
641         .name           = "Terratec TerraTV+ Version 1.0 (Bt848)/ Terra TValue Version 1.0/ Vobis TV-Boostar",
642         .video_inputs   = 3,
643         .audio_inputs   = 1,
644         .tuner          = 0,
645         .svhs           = 2,
646         .gpiomask       = 0x1f0fff,
647         .muxsel         = { 2, 3, 1, 1},
648         .audiomux       = { 0x20000, 0x30000, 0x10000, 0, 0x40000},
649         .needs_tvaudio  = 0,
650         .tuner_type     = TUNER_PHILIPS_PAL,
651         .tuner_addr     = ADDR_UNSET,
652         .audio_hook     = terratv_audio,
653 },{
654         .name           = "Hauppauge WinCam newer (bt878)",
655         .video_inputs   = 4,
656         .audio_inputs   = 1,
657         .tuner          = 0,
658         .svhs           = 3,
659         .gpiomask       = 7,
660         .muxsel         = { 2, 0, 1, 1},
661         .audiomux       = { 0, 1, 2, 3, 4},
662         .needs_tvaudio  = 1,
663         .tuner_type     = -1,
664         .tuner_addr     = ADDR_UNSET,
665 },{
666         .name           = "Lifeview FlyVideo 98/ MAXI TV Video PCI2 LR50",
667         .video_inputs   = 4,
668         .audio_inputs   = 2,
669         .tuner          = 0,
670         .svhs           = 2,
671         .gpiomask       = 0x1800,
672         .muxsel         = { 2, 3, 1, 1},
673         .audiomux       = { 0, 0x800, 0x1000, 0x1000, 0x1800},
674         .pll            = PLL_28,
675         .tuner_type     = TUNER_PHILIPS_SECAM,
676         .tuner_addr     = ADDR_UNSET,
677 },{
678
679 /* ---- card 0x1c ---------------------------------- */
680         .name           = "Terratec TerraTV+ Version 1.1 (bt878)",
681         .video_inputs   = 3,
682         .audio_inputs   = 1,
683         .tuner          = 0,
684         .svhs           = 2,
685         .gpiomask       = 0x1f0fff,
686         .muxsel         = { 2, 3, 1, 1},
687         .audiomux       = { 0x20000, 0x30000, 0x10000, 0x00000, 0x40000},
688         .needs_tvaudio  = 0,
689         .tuner_type     = TUNER_PHILIPS_PAL,
690         .tuner_addr     = ADDR_UNSET,
691         .audio_hook     = terratv_audio,
692         /* GPIO wiring:
693         External 20 pin connector (for Active Radio Upgrade board)
694         gpio00: i2c-sda
695         gpio01: i2c-scl
696         gpio02: om5610-data
697         gpio03: om5610-clk
698         gpio04: om5610-wre
699         gpio05: om5610-stereo
700         gpio06: rds6588-davn
701         gpio07: Pin 7 n.c.
702         gpio08: nIOW
703         gpio09+10: nIOR, nSEL ?? (bt878)
704                 gpio09: nIOR (bt848)
705                 gpio10: nSEL (bt848)
706         Sound Routing:
707         gpio16: u2-A0 (1st 4052bt)
708         gpio17: u2-A1
709         gpio18: u2-nEN
710         gpio19: u4-A0 (2nd 4052)
711         gpio20: u4-A1
712                 u4-nEN - GND
713         Btspy:
714                 00000 : Cdrom (internal audio input)
715                 10000 : ext. Video audio input
716                 20000 : TV Mono
717                 a0000 : TV Mono/2
718         1a0000 : TV Stereo
719                 30000 : Radio
720                 40000 : Mute
721 */
722
723 },{
724         /* Jannik Fritsch <jannik@techfak.uni-bielefeld.de> */
725         .name           = "Imagenation PXC200",
726         .video_inputs   = 5,
727         .audio_inputs   = 1,
728         .tuner          = -1,
729         .svhs           = 1, /* was: 4 */
730         .gpiomask       = 0,
731         .muxsel         = { 2, 3, 1, 0, 0},
732         .audiomux       = { 0 },
733         .needs_tvaudio  = 1,
734         .tuner_type     = -1,
735         .tuner_addr     = ADDR_UNSET,
736         .muxsel_hook    = PXC200_muxsel,
737
738 },{
739         .name           = "Lifeview FlyVideo 98 LR50",
740         .video_inputs   = 4,
741         .audio_inputs   = 1,
742         .tuner          = 0,
743         .svhs           = 2,
744         .gpiomask       = 0x1800,  /* 0x8dfe00 */
745         .muxsel         = { 2, 3, 1, 1},
746         .audiomux       = { 0, 0x0800, 0x1000, 0x1000, 0x1800, 0 },
747         .pll            = PLL_28,
748         .tuner_type     = -1,
749         .tuner_addr     = ADDR_UNSET,
750 },{
751         .name           = "Formac iProTV, Formac ProTV I (bt848)",
752         .video_inputs   = 4,
753         .audio_inputs   = 1,
754         .tuner          = 0,
755         .svhs           = 3,
756         .gpiomask       = 1,
757         .muxsel         = { 2, 3, 1, 1},
758         .audiomux       = { 1, 0, 0, 0, 0 },
759         .pll            = PLL_28,
760         .tuner_type     = TUNER_PHILIPS_PAL,
761         .tuner_addr     = ADDR_UNSET,
762 },{
763
764 /* ---- card 0x20 ---------------------------------- */
765         .name           = "Intel Create and Share PCI/ Smart Video Recorder III",
766         .video_inputs   = 4,
767         .audio_inputs   = 0,
768         .tuner          = -1,
769         .svhs           = 2,
770         .gpiomask       = 0,
771         .muxsel         = { 2, 3, 1, 1},
772         .audiomux       = { 0 },
773         .needs_tvaudio  = 0,
774         .tuner_type     = 4,
775         .tuner_addr     = ADDR_UNSET,
776 },{
777         .name           = "Terratec TerraTValue Version Bt878",
778         .video_inputs   = 3,
779         .audio_inputs   = 1,
780         .tuner          = 0,
781         .svhs           = 2,
782         .gpiomask       = 0xffff00,
783         .muxsel         = { 2, 3, 1, 1},
784         .audiomux       = { 0x500, 0, 0x300, 0x900, 0x900},
785         .needs_tvaudio  = 1,
786         .pll            = PLL_28,
787         .tuner_type     = TUNER_PHILIPS_PAL,
788         .tuner_addr     = ADDR_UNSET,
789 },{
790         .name           = "Leadtek WinFast 2000/ WinFast 2000 XP",
791         .video_inputs   = 4,
792         .audio_inputs   = 1,
793         .tuner          = 0,
794         .svhs           = 2,
795         .muxsel         = { 2, 3, 1, 1, 0}, /* TV, CVid, SVid, CVid over SVid connector */
796         /* Alexander Varakin <avarakin@hotmail.com> [stereo version] */
797         .gpiomask       = 0xb33000,
798         .audiomux       = { 0x122000,0x1000,0x0000,0x620000,0x800000 },
799         /* Audio Routing for "WinFast 2000 XP" (no tv stereo !)
800                 gpio23 -- hef4052:nEnable (0x800000)
801                 gpio12 -- hef4052:A1
802                 gpio13 -- hef4052:A0
803         0x0000: external audio
804         0x1000: FM
805         0x2000: TV
806         0x3000: n.c.
807         Note: There exists another variant "Winfast 2000" with tv stereo !?
808         Note: eeprom only contains FF and pci subsystem id 107d:6606
809         */
810         .needs_tvaudio  = 0,
811         .pll            = PLL_28,
812         .has_radio      = 1,
813         .tuner_type     = 5, /* default for now, gpio reads BFFF06 for Pal bg+dk */
814         .tuner_addr     = ADDR_UNSET,
815         .audio_hook     = winfast2000_audio,
816         .has_remote     = 1,
817 },{
818         .name           = "Lifeview FlyVideo 98 LR50 / Chronos Video Shuttle II",
819         .video_inputs   = 4,
820         .audio_inputs   = 3,
821         .tuner          = 0,
822         .svhs           = 2,
823         .gpiomask       = 0x1800,
824         .muxsel         = { 2, 3, 1, 1},
825         .audiomux       = { 0, 0x800, 0x1000, 0x1000, 0x1800},
826         .pll            = PLL_28,
827         .tuner_type     = -1,
828         .tuner_addr     = ADDR_UNSET,
829 },{
830
831 /* ---- card 0x24 ---------------------------------- */
832         .name           = "Lifeview FlyVideo 98FM LR50 / Typhoon TView TV/FM Tuner",
833         .video_inputs   = 4,
834         .audio_inputs   = 3,
835         .tuner          = 0,
836         .svhs           = 2,
837         .gpiomask       = 0x1800,
838         .muxsel         = { 2, 3, 1, 1},
839         .audiomux       = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 },
840         .pll            = PLL_28,
841         .tuner_type     = -1,
842         .tuner_addr     = ADDR_UNSET,
843         .has_radio      = 1,
844 },{
845         .name           = "Prolink PixelView PlayTV pro",
846         .video_inputs   = 3,
847         .audio_inputs   = 1,
848         .tuner          = 0,
849         .svhs           = 2,
850         .gpiomask       = 0xff,
851         .muxsel         = { 2, 3, 1, 1 },
852         .audiomux       = { 0x21, 0x20, 0x24, 0x2c, 0x29, 0x29 },
853         .no_msp34xx     = 1,
854         .pll            = PLL_28,
855         .tuner_type     = -1,
856         .tuner_addr     = ADDR_UNSET,
857 },{
858         .name           = "Askey CPH06X TView99",
859         .video_inputs   = 4,
860         .audio_inputs   = 1,
861         .tuner          = 0,
862         .svhs           = 2,
863         .gpiomask       = 0x551e00,
864         .muxsel         = { 2, 3, 1, 0},
865         .audiomux       = { 0x551400, 0x551200, 0, 0, 0x551c00, 0x551200 },
866         .needs_tvaudio  = 1,
867         .pll            = PLL_28,
868         .tuner_type     = 1,
869         .tuner_addr     = ADDR_UNSET,
870         .has_remote     = 1,
871 },{
872         .name           = "Pinnacle PCTV Studio/Rave",
873         .video_inputs   = 3,
874         .audio_inputs   = 1,
875         .tuner          = 0,
876         .svhs           = 2,
877         .gpiomask       = 0x03000F,
878         .muxsel         = { 2, 3, 1, 1},
879         .audiomux       = { 2, 0xd0001, 0, 0, 1},
880         .needs_tvaudio  = 0,
881         .pll            = PLL_28,
882         .tuner_type     = -1,
883         .tuner_addr     = ADDR_UNSET,
884 },{
885
886 /* ---- card 0x28 ---------------------------------- */
887         .name           = "STB TV PCI FM, Gateway P/N 6000704 (bt878), 3Dfx VoodooTV 100",
888         .video_inputs   = 3,
889         .audio_inputs   = 1,
890         .tuner          = 0,
891         .svhs           = 2,
892         .gpiomask       = 7,
893         .muxsel         = { 2, 3, 1, 1},
894         .audiomux       = { 4, 0, 2, 3, 1},
895         .no_msp34xx     = 1,
896         .needs_tvaudio  = 1,
897         .tuner_type     = TUNER_PHILIPS_NTSC,
898         .tuner_addr     = ADDR_UNSET,
899         .pll            = PLL_28,
900         .has_radio      = 1,
901 },{
902         .name           = "AVerMedia TVPhone 98",
903         .video_inputs   = 3,
904         .audio_inputs   = 4,
905         .tuner          = 0,
906         .svhs           = 2,
907         .gpiomask       = 15,
908         .muxsel         = { 2, 3, 1, 1},
909         .audiomux       = { 13, 4, 11, 7, 0, 0},
910         .needs_tvaudio  = 1,
911         .pll            = PLL_28,
912         .tuner_type     = -1,
913         .tuner_addr     = ADDR_UNSET,
914         .has_radio      = 1,
915         .audio_hook     = avermedia_tvphone_audio,
916 },{
917         .name           = "ProVideo PV951", /* pic16c54 */
918         .video_inputs   = 3,
919         .audio_inputs   = 1,
920         .tuner          = 0,
921         .svhs           = 2,
922         .gpiomask       = 0,
923         .muxsel         = { 2, 3, 1, 1},
924         .audiomux       = { 0, 0, 0, 0, 0},
925         .needs_tvaudio  = 1,
926         .no_msp34xx     = 1,
927         .pll            = PLL_28,
928         .tuner_type     = 1,
929         .tuner_addr     = ADDR_UNSET,
930 },{
931         .name           = "Little OnAir TV",
932         .video_inputs   = 3,
933         .audio_inputs   = 1,
934         .tuner          = 0,
935         .svhs           = 2,
936         .gpiomask       = 0xe00b,
937         .muxsel         = {2, 3, 1, 1},
938         .audiomux       = {0xff9ff6, 0xff9ff6, 0xff1ff7, 0, 0xff3ffc},
939         .no_msp34xx     = 1,
940         .tuner_type     = -1,
941         .tuner_addr     = ADDR_UNSET,
942 },{
943
944 /* ---- card 0x2c ---------------------------------- */
945         .name           = "Sigma TVII-FM",
946         .video_inputs   = 2,
947         .audio_inputs   = 1,
948         .tuner          = 0,
949         .svhs           = -1,
950         .gpiomask       = 3,
951         .muxsel         = {2, 3, 1, 1},
952         .audiomux       = {1, 1, 0, 2, 3},
953         .no_msp34xx     = 1,
954         .pll            = PLL_NONE,
955         .tuner_type     = -1,
956         .tuner_addr     = ADDR_UNSET,
957 },{
958         .name           = "MATRIX-Vision MV-Delta 2",
959         .video_inputs   = 5,
960         .audio_inputs   = 1,
961         .tuner          = -1,
962         .svhs           = 3,
963         .gpiomask       = 0,
964         .muxsel         = { 2, 3, 1, 0, 0},
965         .audiomux       = {0 },
966         .no_msp34xx     = 1,
967         .pll            = PLL_28,
968         .tuner_type     = -1,
969         .tuner_addr     = ADDR_UNSET,
970 },{
971         .name           = "Zoltrix Genie TV/FM",
972         .video_inputs   = 3,
973         .audio_inputs   = 1,
974         .tuner          = 0,
975         .svhs           = 2,
976         .gpiomask       = 0xbcf03f,
977         .muxsel         = { 2, 3, 1, 1},
978         .audiomux       = { 0xbc803f, 0xbc903f, 0xbcb03f, 0, 0xbcb03f},
979         .no_msp34xx     = 1,
980         .pll            = PLL_28,
981         .tuner_type     = 21,
982         .tuner_addr     = ADDR_UNSET,
983 },{
984         .name           = "Terratec TV/Radio+",
985         .video_inputs   = 3,
986         .audio_inputs   = 1,
987         .tuner          = 0,
988         .svhs           = 2,
989         .gpiomask       = 0x70000,
990         .muxsel         = { 2, 3, 1, 1},
991         .audiomux       = { 0x20000, 0x30000, 0x10000, 0, 0x40000, 0x20000 },
992         .needs_tvaudio  = 1,
993         .no_msp34xx     = 1,
994         .pll            = PLL_35,
995         .tuner_type     = 1,
996         .tuner_addr     = ADDR_UNSET,
997         .has_radio      = 1,
998 },{
999
1000 /* ---- card 0x30 ---------------------------------- */
1001         .name           = "Askey CPH03x/ Dynalink Magic TView",
1002         .video_inputs   = 3,
1003         .audio_inputs   = 1,
1004         .tuner          = 0,
1005         .svhs           = 2,
1006         .gpiomask       = 15,
1007         .muxsel         = { 2, 3, 1, 1},
1008         .audiomux       = {2,0,0,0,1},
1009         .needs_tvaudio  = 1,
1010         .pll            = PLL_28,
1011         .tuner_type     = -1,
1012         .tuner_addr     = ADDR_UNSET,
1013 },{
1014         .name           = "IODATA GV-BCTV3/PCI",
1015         .video_inputs   = 3,
1016         .audio_inputs   = 1,
1017         .tuner          = 0,
1018         .svhs           = 2,
1019         .gpiomask       = 0x010f00,
1020         .muxsel         = {2, 3, 0, 0},
1021         .audiomux       = {0x10000, 0, 0x10000, 0, 0, 0},
1022         .no_msp34xx     = 1,
1023         .pll            = PLL_28,
1024         .tuner_type     = TUNER_ALPS_TSHC6_NTSC,
1025         .tuner_addr     = ADDR_UNSET,
1026         .audio_hook     = gvbctv3pci_audio,
1027 },{
1028         .name           = "Prolink PV-BT878P+4E / PixelView PlayTV PAK / Lenco MXTV-9578 CP",
1029         .video_inputs   = 5,
1030         .audio_inputs   = 1,
1031         .tuner          = 0,
1032         .svhs           = 3,
1033         .gpiomask       = 0xAA0000,
1034         .muxsel         = { 2,3,1,1,-1 },
1035         .digital_mode   = DIGITAL_MODE_CAMERA,
1036         .audiomux       = { 0x20000, 0, 0x80000, 0x80000, 0xa8000, 0x46000  },
1037         .no_msp34xx     = 1,
1038         .pll            = PLL_28,
1039         .tuner_type     = TUNER_PHILIPS_PAL_I,
1040         .tuner_addr     = ADDR_UNSET,
1041         .has_remote     = 1,
1042         /* GPIO wiring: (different from Rev.4C !)
1043                 GPIO17: U4.A0 (first hef4052bt)
1044                 GPIO19: U4.A1
1045                 GPIO20: U5.A1 (second hef4052bt)
1046                 GPIO21: U4.nEN
1047                 GPIO22: BT832 Reset Line
1048                 GPIO23: A5,A0, U5,nEN
1049         Note: At i2c=0x8a is a Bt832 chip, which changes to 0x88 after being reset via GPIO22
1050         */
1051 },{
1052         .name           = "Eagle Wireless Capricorn2 (bt878A)",
1053         .video_inputs   = 4,
1054         .audio_inputs   = 1,
1055         .tuner          = 0,
1056         .svhs           = 2,
1057         .gpiomask       = 7,
1058         .muxsel         = { 2, 0, 1, 1},
1059         .audiomux       = { 0, 1, 2, 3, 4},
1060         .pll            = PLL_28,
1061         .tuner_type     = -1 /* TUNER_ALPS_TMDH2_NTSC */,
1062         .tuner_addr     = ADDR_UNSET,
1063 },{
1064
1065 /* ---- card 0x34 ---------------------------------- */
1066         /* David H√§rdeman <david@2gen.com> */
1067         .name           = "Pinnacle PCTV Studio Pro",
1068         .video_inputs   = 4,
1069         .audio_inputs   = 1,
1070         .tuner          = 0,
1071         .svhs           = 3,
1072         .gpiomask       = 0x03000F,
1073         .muxsel         = { 2, 3, 1, 1},
1074         .audiomux       = { 1, 0xd0001, 0, 0, 10},
1075                         /* sound path (5 sources):
1076                         MUX1 (mask 0x03), Enable Pin 0x08 (0=enable, 1=disable)
1077                                 0= ext. Audio IN
1078                                 1= from MUX2
1079                                 2= Mono TV sound from Tuner
1080                                 3= not connected
1081                         MUX2 (mask 0x30000):
1082                                 0,2,3= from MSP34xx
1083                                 1= FM stereo Radio from Tuner */
1084         .needs_tvaudio  = 0,
1085         .pll            = PLL_28,
1086         .tuner_type     = -1,
1087         .tuner_addr     = ADDR_UNSET,
1088 },{
1089         /* Claas Langbehn <claas@bigfoot.com>,
1090         Sven Grothklags <sven@upb.de> */
1091         .name           = "Typhoon TView RDS + FM Stereo / KNC1 TV Station RDS",
1092         .video_inputs   = 4,
1093         .audio_inputs   = 3,
1094         .tuner          = 0,
1095         .svhs           = 2,
1096         .gpiomask       = 0x1c,
1097         .muxsel         = { 2, 3, 1, 1},
1098         .audiomux       = { 0, 0, 0x10, 8, 4 },
1099         .needs_tvaudio  = 1,
1100         .pll            = PLL_28,
1101         .tuner_type     = TUNER_PHILIPS_PAL,
1102         .tuner_addr     = ADDR_UNSET,
1103         .has_radio      = 1,
1104 },{
1105         /* Tim R√∂stermundt <rosterm@uni-muenster.de>
1106         in de.comp.os.unix.linux.hardware:
1107                 options bttv card=0 pll=1 radio=1 gpiomask=0x18e0
1108                 audiomux=0x44c71f,0x44d71f,0,0x44d71f,0x44dfff
1109                 options tuner type=5 */
1110         .name           = "Lifeview FlyVideo 2000 /FlyVideo A2/ Lifetec LT 9415 TV [LR90]",
1111         .video_inputs   = 4,
1112         .audio_inputs   = 1,
1113         .tuner          = 0,
1114         .svhs           = 2,
1115         .gpiomask       = 0x18e0,
1116         .muxsel         = { 2, 3, 1, 1},
1117         .audiomux       = { 0x0000,0x0800,0x1000,0x1000,0x18e0 },
1118                 /* For cards with tda9820/tda9821:
1119                         0x0000: Tuner normal stereo
1120                         0x0080: Tuner A2 SAP (second audio program = Zweikanalton)
1121                         0x0880: Tuner A2 stereo */
1122         .pll            = PLL_28,
1123         .tuner_type     = -1,
1124         .tuner_addr     = ADDR_UNSET,
1125 },{
1126         /* Miguel Angel Alvarez <maacruz@navegalia.com>
1127         old Easy TV BT848 version (model CPH031) */
1128         .name           = "Askey CPH031/ BESTBUY Easy TV",
1129         .video_inputs   = 4,
1130         .audio_inputs   = 1,
1131         .tuner          = 0,
1132         .svhs           = 2,
1133         .gpiomask       = 0xF,
1134         .muxsel         = { 2, 3, 1, 0},
1135         .audiomux       = { 2, 0, 0, 0, 10},
1136         .needs_tvaudio  = 0,
1137         .pll            = PLL_28,
1138         .tuner_type     = TUNER_TEMIC_PAL,
1139         .tuner_addr     = ADDR_UNSET,
1140 },{
1141
1142 /* ---- card 0x38 ---------------------------------- */
1143         /* Gordon Heydon <gjheydon@bigfoot.com ('98) */
1144         .name           = "Lifeview FlyVideo 98FM LR50",
1145         .video_inputs   = 4,
1146         .audio_inputs   = 3,
1147         .tuner          = 0,
1148         .svhs           = 2,
1149         .gpiomask       = 0x1800,
1150         .muxsel         = { 2, 3, 1, 1},
1151         .audiomux       = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 },
1152         .pll            = PLL_28,
1153         .tuner_type     = 5,
1154         .tuner_addr     = ADDR_UNSET,
1155 },{
1156         /* This is the ultimate cheapo capture card
1157         * just a BT848A on a small PCB!
1158         * Steve Hosgood <steve@equiinet.com> */
1159         .name           = "GrandTec 'Grand Video Capture' (Bt848)",
1160         .video_inputs   = 2,
1161         .audio_inputs   = 0,
1162         .tuner          = -1,
1163         .svhs           = 1,
1164         .gpiomask       = 0,
1165         .muxsel         = { 3, 1 },
1166         .audiomux       = { 0 },
1167         .needs_tvaudio  = 0,
1168         .no_msp34xx     = 1,
1169         .pll            = PLL_35,
1170         .tuner_type     = -1,
1171         .tuner_addr     = ADDR_UNSET,
1172 },{
1173         /* Daniel Herrington <daniel.herrington@home.com> */
1174         .name           = "Askey CPH060/ Phoebe TV Master Only (No FM)",
1175         .video_inputs   = 3,
1176         .audio_inputs   = 1,
1177         .tuner          = 0,
1178         .svhs           = 2,
1179         .gpiomask       = 0xe00,
1180         .muxsel         = { 2, 3, 1, 1},
1181         .audiomux       = { 0x400, 0x400, 0x400, 0x400, 0x800, 0x400 },
1182         .needs_tvaudio  = 1,
1183         .pll            = PLL_28,
1184         .tuner_type     = TUNER_TEMIC_4036FY5_NTSC,
1185         .tuner_addr     = ADDR_UNSET,
1186 },{
1187         /* Matti Mottus <mottus@physic.ut.ee> */
1188         .name           = "Askey CPH03x TV Capturer",
1189         .video_inputs   = 4,
1190         .audio_inputs   = 1,
1191         .tuner          = 0,
1192         .svhs           = 2,
1193         .gpiomask       = 0x03000F,
1194         .muxsel         = { 2, 3, 1, 0},
1195         .audiomux       = { 2,0,0,0,1 },
1196         .pll            = PLL_28,
1197         .tuner_type     = 0,
1198         .tuner_addr     = ADDR_UNSET,
1199 },{
1200
1201 /* ---- card 0x3c ---------------------------------- */
1202         /* Philip Blundell <philb@gnu.org> */
1203         .name           = "Modular Technology MM100PCTV",
1204         .video_inputs   = 2,
1205         .audio_inputs   = 2,
1206         .tuner          = 0,
1207         .svhs           = -1,
1208         .gpiomask       = 11,
1209         .muxsel         = { 2, 3, 1, 1},
1210         .audiomux       = { 2, 0, 0, 1, 8},
1211         .pll            = PLL_35,
1212         .tuner_type     = TUNER_TEMIC_PAL,
1213         .tuner_addr     = ADDR_UNSET,
1214 },{
1215         /* Adrian Cox <adrian@humboldt.co.uk */
1216         .name           = "AG Electronics GMV1",
1217         .video_inputs   = 2,
1218         .audio_inputs   = 0,
1219         .tuner          = -1,
1220         .svhs           = 1,
1221         .gpiomask       = 0xF,
1222         .muxsel         = { 2, 2},
1223         .audiomux       = { },
1224         .no_msp34xx     = 1,
1225         .needs_tvaudio  = 0,
1226         .pll            = PLL_28,
1227         .tuner_type     = -1,
1228         .tuner_addr     = ADDR_UNSET,
1229 },{
1230         /* Miguel Angel Alvarez <maacruz@navegalia.com>
1231         new Easy TV BT878 version (model CPH061)
1232         special thanks to Informatica Mieres for providing the card */
1233         .name           = "Askey CPH061/ BESTBUY Easy TV (bt878)",
1234         .video_inputs   = 3,
1235         .audio_inputs   = 2,
1236         .tuner          = 0,
1237         .svhs           = 2,
1238         .gpiomask       = 0xFF,
1239         .muxsel         = { 2, 3, 1, 0},
1240         .audiomux       = { 1, 0, 4, 4, 9},
1241         .needs_tvaudio  = 0,
1242         .pll            = PLL_28,
1243         .tuner_type     = TUNER_PHILIPS_PAL,
1244         .tuner_addr     = ADDR_UNSET,
1245 },{
1246         /* Lukas Gebauer <geby@volny.cz> */
1247         .name           = "ATI TV-Wonder",
1248         .video_inputs   = 3,
1249         .audio_inputs   = 1,
1250         .tuner          = 0,
1251         .svhs           = 2,
1252         .gpiomask       = 0xf03f,
1253         .muxsel         = { 2, 3, 1, 0 },
1254         .audiomux       = { 0xbffe, 0, 0xbfff, 0, 0xbffe},
1255         .pll            = PLL_28,
1256         .tuner_type     = TUNER_TEMIC_4006FN5_MULTI_PAL,
1257         .tuner_addr     = ADDR_UNSET,
1258 },{
1259
1260 /* ---- card 0x40 ---------------------------------- */
1261         /* Lukas Gebauer <geby@volny.cz> */
1262         .name           = "ATI TV-Wonder VE",
1263         .video_inputs   = 2,
1264         .audio_inputs   = 1,
1265         .tuner          = 0,
1266         .svhs           = -1,
1267         .gpiomask       = 1,
1268         .muxsel         = { 2, 3, 0, 1},
1269         .audiomux       = { 0, 0, 1, 0, 0},
1270         .no_msp34xx     = 1,
1271         .pll            = PLL_28,
1272         .tuner_type     = TUNER_TEMIC_4006FN5_MULTI_PAL,
1273         .tuner_addr     = ADDR_UNSET,
1274 },{
1275         /* DeeJay <deejay@westel900.net (2000S) */
1276         .name           = "Lifeview FlyVideo 2000S LR90",
1277         .video_inputs   = 3,
1278         .audio_inputs   = 3,
1279         .tuner          = 0,
1280         .svhs           = 2,
1281         .gpiomask       = 0x18e0,
1282         .muxsel         = { 2, 3, 0, 1},
1283                         /* Radio changed from 1e80 to 0x800 to make
1284                         FlyVideo2000S in .hu happy (gm)*/
1285                         /* -dk-???: set mute=0x1800 for tda9874h daughterboard */
1286         .audiomux       = { 0x0000,0x0800,0x1000,0x1000,0x1800, 0x1080 },
1287         .audio_hook     = fv2000s_audio,
1288         .no_msp34xx     = 1,
1289         .no_tda9875     = 1,
1290         .needs_tvaudio  = 1,
1291         .pll            = PLL_28,
1292         .tuner_type     = 5,
1293         .tuner_addr     = ADDR_UNSET,
1294 },{
1295         .name           = "Terratec TValueRadio",
1296         .video_inputs   = 3,
1297         .audio_inputs   = 1,
1298         .tuner          = 0,
1299         .svhs           = 2,
1300         .gpiomask       = 0xffff00,
1301         .muxsel         = { 2, 3, 1, 1},
1302         .audiomux       = { 0x500, 0x500, 0x300, 0x900, 0x900},
1303         .needs_tvaudio  = 1,
1304         .pll            = PLL_28,
1305         .tuner_type     = TUNER_PHILIPS_PAL,
1306         .tuner_addr     = ADDR_UNSET,
1307         .has_radio      = 1,
1308 },{
1309         /* TANAKA Kei <peg00625@nifty.com> */
1310         .name           = "IODATA GV-BCTV4/PCI",
1311         .video_inputs   = 3,
1312         .audio_inputs   = 1,
1313         .tuner          = 0,
1314         .svhs           = 2,
1315         .gpiomask       = 0x010f00,
1316         .muxsel         = {2, 3, 0, 0},
1317         .audiomux       = {0x10000, 0, 0x10000, 0, 0, 0},
1318         .no_msp34xx     = 1,
1319         .pll            = PLL_28,
1320         .tuner_type     = TUNER_SHARP_2U5JF5540_NTSC,
1321         .tuner_addr     = ADDR_UNSET,
1322         .audio_hook     = gvbctv3pci_audio,
1323 },{
1324
1325 /* ---- card 0x44 ---------------------------------- */
1326         .name           = "3Dfx VoodooTV FM (Euro), VoodooTV 200 (USA)",
1327         /* try "insmod msp3400 simple=0" if you have
1328         * sound problems with this card. */
1329         .video_inputs   = 4,
1330         .audio_inputs   = 1,
1331         .tuner          = 0,
1332         .svhs           = -1,
1333         .gpiomask       = 0x4f8a00,
1334         /* 0x100000: 1=MSP enabled (0=disable again)
1335         * 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC) */
1336         .audiomux       = {0x947fff, 0x987fff,0x947fff,0x947fff, 0x947fff},
1337         /* tvtuner, radio,   external,internal, mute,  stereo
1338         * tuner, Composit, SVid, Composit-on-Svid-adapter */
1339         .muxsel         = { 2, 3 ,0 ,1},
1340         .tuner_type     = TUNER_MT2032,
1341         .tuner_addr     = ADDR_UNSET,
1342         .pll            = PLL_28,
1343         .has_radio      = 1,
1344 },{
1345         /* Philip Blundell <pb@nexus.co.uk> */
1346         .name           = "Active Imaging AIMMS",
1347         .video_inputs   = 1,
1348         .audio_inputs   = 0,
1349         .tuner          = -1,
1350         .tuner_type     = -1,
1351         .tuner_addr     = ADDR_UNSET,
1352         .pll            = PLL_28,
1353         .muxsel         = { 2 },
1354         .gpiomask       = 0
1355 },{
1356         /* Tomasz Pyra <hellfire@sedez.iq.pl> */
1357         .name           = "Prolink Pixelview PV-BT878P+ (Rev.4C,8E)",
1358         .video_inputs   = 3,
1359         .audio_inputs   = 4,
1360         .tuner          = 0,
1361         .svhs           = 2,
1362         .gpiomask       = 15,
1363         .muxsel         = { 2, 3, 1, 1},
1364         .audiomux       = { 0, 0, 11, 7, 13, 0}, /* TV and Radio with same GPIO ! */
1365         .needs_tvaudio  = 1,
1366         .pll            = PLL_28,
1367         .tuner_type     = 25,
1368         .tuner_addr     = ADDR_UNSET,
1369         .has_remote     = 1,
1370         /* GPIO wiring:
1371                 GPIO0: U4.A0 (hef4052bt)
1372                 GPIO1: U4.A1
1373                 GPIO2: U4.A1 (second hef4052bt)
1374                 GPIO3: U4.nEN, U5.A0, A5.nEN
1375                 GPIO8-15: vrd866b ?
1376         */
1377 },{
1378         .name           = "Lifeview FlyVideo 98EZ (capture only) LR51",
1379         .video_inputs   = 4,
1380         .audio_inputs   = 0,
1381         .tuner          = -1,
1382         .svhs           = 2,
1383         .muxsel         = { 2, 3, 1, 1}, /* AV1, AV2, SVHS, CVid adapter on SVHS */
1384         .pll            = PLL_28,
1385         .no_msp34xx     = 1,
1386         .tuner_type     = UNSET,
1387         .tuner_addr     = ADDR_UNSET,
1388 },{
1389
1390 /* ---- card 0x48 ---------------------------------- */
1391         /* Dariusz Kowalewski <darekk@automex.pl> */
1392         .name           = "Prolink Pixelview PV-BT878P+9B (PlayTV Pro rev.9B FM+NICAM)",
1393         .video_inputs   = 4,
1394         .audio_inputs   = 1,
1395         .tuner          = 0,
1396         .svhs           = 2,
1397         .gpiomask       = 0x3f,
1398         .muxsel         = { 2, 3, 1, 1 },
1399         .audiomux       = { 0x01, 0x00, 0x03, 0x03, 0x09, 0x02 },
1400         .needs_tvaudio  = 1,
1401         .no_msp34xx     = 1,
1402         .no_tda9875     = 1,
1403         .pll            = PLL_28,
1404         .tuner_type     = 5,
1405         .tuner_addr     = ADDR_UNSET,
1406         .audio_hook     = pvbt878p9b_audio, /* Note: not all cards have stereo */
1407         .has_radio      = 1,  /* Note: not all cards have radio */
1408         .has_remote     = 1,
1409         /* GPIO wiring:
1410                 GPIO0: A0 hef4052
1411                 GPIO1: A1 hef4052
1412                 GPIO3: nEN hef4052
1413                 GPIO8-15: vrd866b
1414                 GPIO20,22,23: R30,R29,R28
1415         */
1416 },{
1417         /* Clay Kunz <ckunz@mail.arc.nasa.gov> */
1418         /* you must jumper JP5 for the card to work */
1419         .name           = "Sensoray 311",
1420         .video_inputs   = 5,
1421         .audio_inputs   = 0,
1422         .tuner          = -1,
1423         .svhs           = 4,
1424         .gpiomask       = 0,
1425         .muxsel         = { 2, 3, 1, 0, 0},
1426         .audiomux       = { 0 },
1427         .needs_tvaudio  = 0,
1428         .tuner_type     = -1,
1429         .tuner_addr     = ADDR_UNSET,
1430 },{
1431         /* Miguel Freitas <miguel@cetuc.puc-rio.br> */
1432         .name           = "RemoteVision MX (RV605)",
1433         .video_inputs   = 16,
1434         .audio_inputs   = 0,
1435         .tuner          = -1,
1436         .svhs           = -1,
1437         .gpiomask       = 0x00,
1438         .gpiomask2      = 0x07ff,
1439         .muxsel         = { 0x33, 0x13, 0x23, 0x43, 0xf3, 0x73, 0xe3, 0x03,
1440                         0xd3, 0xb3, 0xc3, 0x63, 0x93, 0x53, 0x83, 0xa3 },
1441         .no_msp34xx     = 1,
1442         .no_tda9875     = 1,
1443         .tuner_type     = -1,
1444         .tuner_addr     = ADDR_UNSET,
1445         .muxsel_hook    = rv605_muxsel,
1446 },{
1447         .name           = "Powercolor MTV878/ MTV878R/ MTV878F",
1448         .video_inputs   = 3,
1449         .audio_inputs   = 2,
1450         .tuner          = 0,
1451         .svhs           = 2,
1452         .gpiomask       = 0x1C800F,  /* Bit0-2: Audio select, 8-12:remote control 14:remote valid 15:remote reset */
1453         .muxsel         = { 2, 1, 1, },
1454         .audiomux       = { 0, 1, 2, 2, 4 },
1455         .needs_tvaudio  = 0,
1456         .tuner_type     = TUNER_PHILIPS_PAL,
1457         .tuner_addr     = ADDR_UNSET,
1458         .pll            = PLL_28,
1459         .has_radio      = 1,
1460 },{
1461
1462 /* ---- card 0x4c ---------------------------------- */
1463         /* Masaki Suzuki <masaki@btree.org> */
1464         .name           = "Canopus WinDVR PCI (COMPAQ Presario 3524JP, 5112JP)",
1465         .video_inputs   = 3,
1466         .audio_inputs   = 1,
1467         .tuner          = 0,
1468         .svhs           = 2,
1469         .gpiomask       = 0x140007,
1470         .muxsel         = { 2, 3, 1, 1 },
1471         .audiomux       = { 0, 1, 2, 3, 4, 0 },
1472         .tuner_type     = TUNER_PHILIPS_NTSC,
1473         .tuner_addr     = ADDR_UNSET,
1474         .audio_hook     = windvr_audio,
1475 },{
1476         .name           = "GrandTec Multi Capture Card (Bt878)",
1477         .video_inputs   = 4,
1478         .audio_inputs   = 0,
1479         .tuner          = -1,
1480         .svhs           = -1,
1481         .gpiomask       = 0,
1482         .muxsel         = { 2, 3, 1, 0 },
1483         .audiomux       = { 0 },
1484         .needs_tvaudio  = 0,
1485         .no_msp34xx     = 1,
1486         .pll            = PLL_28,
1487         .tuner_type     = -1,
1488         .tuner_addr     = ADDR_UNSET,
1489 },{
1490         .name           = "Jetway TV/Capture JW-TV878-FBK, Kworld KW-TV878RF",
1491         .video_inputs   = 4,
1492         .audio_inputs   = 3,
1493         .tuner          = 0,
1494         .svhs           = 2,
1495         .gpiomask       = 7,
1496         .muxsel         = { 2, 3, 1, 1 },   /* Tuner, SVid, SVHS, SVid to SVHS connector */
1497         .audiomux       = { 0 ,0 ,4, 4,4,4},/* Yes, this tuner uses the same audio output for TV and FM radio!
1498                                         * This card lacks external Audio In, so we mute it on Ext. & Int.
1499                                         * The PCB can take a sbx1637/sbx1673, wiring unknown.
1500                                         * This card lacks PCI subsystem ID, sigh.
1501                                         * audiomux=1: lower volume, 2+3: mute
1502                                         * btwincap uses 0x80000/0x80003
1503                                         */
1504         .needs_tvaudio  = 0,
1505         .no_msp34xx     = 1,
1506         .pll            = PLL_28,
1507         .tuner_type     = 5,
1508         .tuner_addr     = ADDR_UNSET,
1509         /* Samsung TCPA9095PC27A (BG+DK), philips compatible, w/FM, stereo and
1510         radio signal strength indicators work fine. */
1511         .has_radio      = 1,
1512         /* GPIO Info:
1513                 GPIO0,1:   HEF4052 A0,A1
1514                 GPIO2:     HEF4052 nENABLE
1515                 GPIO3-7:   n.c.
1516                 GPIO8-13:  IRDC357 data0-5 (data6 n.c. ?) [chip not present on my card]
1517                 GPIO14,15: ??
1518                 GPIO16-21: n.c.
1519                 GPIO22,23: ??
1520                 ??       : mtu8b56ep microcontroller for IR (GPIO wiring unknown)*/
1521 },{
1522         /* Arthur Tetzlaff-Deas, DSP Design Ltd <software@dspdesign.com> */
1523         .name           = "DSP Design TCVIDEO",
1524         .video_inputs   = 4,
1525         .svhs           = -1,
1526         .muxsel         = { 2, 3, 1, 0},
1527         .pll            = PLL_28,
1528         .tuner_type     = -1,
1529         .tuner_addr     = ADDR_UNSET,
1530 },{
1531
1532         /* ---- card 0x50 ---------------------------------- */
1533         .name           = "Hauppauge WinTV PVR",
1534         .video_inputs   = 4,
1535         .audio_inputs   = 1,
1536         .tuner          = 0,
1537         .svhs           = 2,
1538         .muxsel         = { 2, 0, 1, 1},
1539         .needs_tvaudio  = 1,
1540         .pll            = PLL_28,
1541         .tuner_type     = -1,
1542         .tuner_addr     = ADDR_UNSET,
1543
1544         .gpiomask       = 7,
1545         .audiomux       = {7},
1546 },{
1547         .name           = "IODATA GV-BCTV5/PCI",
1548         .video_inputs   = 3,
1549         .audio_inputs   = 1,
1550         .tuner          = 0,
1551         .svhs           = 2,
1552         .gpiomask       = 0x0f0f80,
1553         .muxsel         = {2, 3, 1, 0},
1554         .audiomux       = {0x030000, 0x010000, 0, 0, 0x020000, 0},
1555         .no_msp34xx     = 1,
1556         .pll            = PLL_28,
1557         .tuner_type     = TUNER_PHILIPS_NTSC_M,
1558         .tuner_addr     = ADDR_UNSET,
1559         .audio_hook     = gvbctv5pci_audio,
1560         .has_radio      = 1,
1561 },{
1562         .name           = "Osprey 100/150 (878)", /* 0x1(2|3)-45C6-C1 */
1563         .video_inputs   = 4,                  /* id-inputs-clock */
1564         .audio_inputs   = 0,
1565         .tuner          = -1,
1566         .svhs           = 3,
1567         .muxsel         = { 3, 2, 0, 1 },
1568         .pll            = PLL_28,
1569         .tuner_type     = -1,
1570         .tuner_addr     = ADDR_UNSET,
1571         .no_msp34xx     = 1,
1572         .no_tda9875     = 1,
1573         .no_tda7432     = 1,
1574 },{
1575         .name           = "Osprey 100/150 (848)", /* 0x04-54C0-C1 & older boards */
1576         .video_inputs   = 3,
1577         .audio_inputs   = 0,
1578         .tuner          = -1,
1579         .svhs           = 2,
1580         .muxsel         = { 2, 3, 1 },
1581         .pll            = PLL_28,
1582         .tuner_type     = -1,
1583         .tuner_addr     = ADDR_UNSET,
1584         .no_msp34xx     = 1,
1585         .no_tda9875     = 1,
1586         .no_tda7432     = 1,
1587 },{
1588
1589         /* ---- card 0x54 ---------------------------------- */
1590         .name           = "Osprey 101 (848)", /* 0x05-40C0-C1 */
1591         .video_inputs   = 2,
1592         .audio_inputs   = 0,
1593         .tuner          = -1,
1594         .svhs           = 1,
1595         .muxsel         = { 3, 1 },
1596         .pll            = PLL_28,
1597         .tuner_type     = -1,
1598         .tuner_addr     = ADDR_UNSET,
1599         .no_msp34xx     = 1,
1600         .no_tda9875     = 1,
1601         .no_tda7432     = 1,
1602 },{
1603         .name           = "Osprey 101/151",       /* 0x1(4|5)-0004-C4 */
1604         .video_inputs   = 1,
1605         .audio_inputs   = 0,
1606         .tuner          = -1,
1607         .svhs           = -1,
1608         .muxsel         = { 0 },
1609         .pll            = PLL_28,
1610         .tuner_type     = -1,
1611         .tuner_addr     = ADDR_UNSET,
1612         .no_msp34xx     = 1,
1613         .no_tda9875     = 1,
1614         .no_tda7432     = 1,
1615 },{
1616         .name           = "Osprey 101/151 w/ svid",  /* 0x(16|17|20)-00C4-C1 */
1617         .video_inputs   = 2,
1618         .audio_inputs   = 0,
1619         .tuner          = -1,
1620         .svhs           = 1,
1621         .muxsel         = { 0, 1 },
1622         .pll            = PLL_28,
1623         .tuner_type     = -1,
1624         .tuner_addr     = ADDR_UNSET,
1625         .no_msp34xx     = 1,
1626         .no_tda9875     = 1,
1627         .no_tda7432     = 1,
1628 },{
1629         .name           = "Osprey 200/201/250/251",  /* 0x1(8|9|E|F)-0004-C4 */
1630         .video_inputs   = 1,
1631         .audio_inputs   = 1,
1632         .tuner          = -1,
1633         .svhs           = -1,
1634         .muxsel         = { 0 },
1635         .pll            = PLL_28,
1636         .tuner_type     = UNSET,
1637         .tuner_addr     = ADDR_UNSET,
1638         .no_msp34xx     = 1,
1639         .no_tda9875     = 1,
1640         .no_tda7432     = 1,
1641 },{
1642
1643         /* ---- card 0x58 ---------------------------------- */
1644         .name           = "Osprey 200/250",   /* 0x1(A|B)-00C4-C1 */
1645         .video_inputs   = 2,
1646         .audio_inputs   = 1,
1647         .tuner          = -1,
1648         .svhs           = 1,
1649         .muxsel         = { 0, 1 },
1650         .pll            = PLL_28,
1651         .tuner_type     = UNSET,
1652         .tuner_addr     = ADDR_UNSET,
1653         .no_msp34xx     = 1,
1654         .no_tda9875     = 1,
1655         .no_tda7432     = 1,
1656 },{
1657         .name           = "Osprey 210/220",   /* 0x1(A|B)-04C0-C1 */
1658         .video_inputs   = 2,
1659         .audio_inputs   = 1,
1660         .tuner          = -1,
1661         .svhs           = 1,
1662         .muxsel         = { 2, 3 },
1663         .pll            = PLL_28,
1664         .tuner_type     = UNSET,
1665         .tuner_addr     = ADDR_UNSET,
1666         .no_msp34xx     = 1,
1667         .no_tda9875     = 1,
1668         .no_tda7432     = 1,
1669 },{
1670         .name           = "Osprey 500",   /* 500 */
1671         .video_inputs   = 2,
1672         .audio_inputs   = 1,
1673         .tuner          = -1,
1674         .svhs           = 1,
1675         .muxsel         = { 2, 3 },
1676         .pll            = PLL_28,
1677         .tuner_type     = -1,
1678         .tuner_addr     = ADDR_UNSET,
1679         .no_msp34xx     = 1,
1680         .no_tda9875     = 1,
1681         .no_tda7432     = 1,
1682 },{
1683         .name           = "Osprey 540",   /* 540 */
1684         .video_inputs   = 4,
1685         .audio_inputs   = 1,
1686         .tuner          = -1,
1687         .pll            = PLL_28,
1688         .tuner_type     = -1,
1689         .tuner_addr     = ADDR_UNSET,
1690         .no_msp34xx     = 1,
1691         .no_tda9875     = 1,
1692         .no_tda7432     = 1,
1693 },{
1694
1695         /* ---- card 0x5C ---------------------------------- */
1696         .name           = "Osprey 2000",  /* 2000 */
1697         .video_inputs   = 2,
1698         .audio_inputs   = 1,
1699         .tuner          = -1,
1700         .svhs           = 1,
1701         .muxsel         = { 2, 3 },
1702         .pll            = PLL_28,
1703         .tuner_type     = UNSET,
1704         .tuner_addr     = ADDR_UNSET,
1705         .no_msp34xx     = 1,
1706         .no_tda9875     = 1,
1707         .no_tda7432     = 1,      /* must avoid, conflicts with the bt860 */
1708 },{
1709         /* M G Berberich <berberic@forwiss.uni-passau.de> */
1710         .name           = "IDS Eagle",
1711         .video_inputs   = 4,
1712         .audio_inputs   = 0,
1713         .tuner          = -1,
1714         .tuner_type     = -1,
1715         .tuner_addr     = ADDR_UNSET,
1716         .svhs           = -1,
1717         .gpiomask       = 0,
1718         .muxsel         = { 0, 1, 2, 3 },
1719         .muxsel_hook    = eagle_muxsel,
1720         .no_msp34xx     = 1,
1721         .no_tda9875     = 1,
1722         .pll            = PLL_28,
1723 },{
1724         .name           = "Pinnacle PCTV Sat",
1725         .video_inputs   = 2,
1726         .audio_inputs   = 0,
1727         .svhs           = 1,
1728         .tuner          = -1,
1729         .tuner_type     = -1,
1730         .tuner_addr     = ADDR_UNSET,
1731         .no_msp34xx     = 1,
1732         .no_tda9875     = 1,
1733         .no_tda7432     = 1,
1734         .gpiomask       = 0x01,
1735         .audiomux       = { 0, 0, 0, 0, 1 },
1736         .muxsel         = { 3, 0, 1, 2},
1737         .needs_tvaudio  = 0,
1738         .pll            = PLL_28,
1739         .no_gpioirq     = 1,
1740         .has_dvb        = 1,
1741 },{
1742         .name           = "Formac ProTV II (bt878)",
1743         .video_inputs   = 4,
1744         .audio_inputs   = 1,
1745         .tuner          = 0,
1746         .svhs           = 3,
1747         .gpiomask       = 2,
1748         /* TV, Comp1, Composite over SVID con, SVID */
1749         .muxsel         = { 2, 3, 1, 1},
1750         .audiomux       = { 2, 2, 0, 0, 0 },
1751         .pll            = PLL_28,
1752         .has_radio      = 1,
1753         .tuner_type     = TUNER_PHILIPS_PAL,
1754         .tuner_addr     = ADDR_UNSET,
1755 /* sound routing:
1756         GPIO=0x00,0x01,0x03: mute (?)
1757         0x02: both TV and radio (tuner: FM1216/I)
1758         The card has onboard audio connectors labeled "cdrom" and "board",
1759         not soldered here, though unknown wiring.
1760         Card lacks: external audio in, pci subsystem id.
1761 */
1762 },{
1763
1764         /* ---- card 0x60 ---------------------------------- */
1765         .name           = "MachTV",
1766         .video_inputs   = 3,
1767         .audio_inputs   = 1,
1768         .tuner          = 0,
1769         .svhs           = -1,
1770         .gpiomask       = 7,
1771         .muxsel         = { 2, 3, 1, 1},
1772         .audiomux       = { 0, 1, 2, 3, 4},
1773         .needs_tvaudio  = 1,
1774         .tuner_type     = 5,
1775         .tuner_addr     = ADDR_UNSET,
1776         .pll            = 1,
1777 },{
1778         .name           = "Euresys Picolo",
1779         .video_inputs   = 3,
1780         .audio_inputs   = 0,
1781         .tuner          = -1,
1782         .svhs           = 2,
1783         .gpiomask       = 0,
1784         .no_msp34xx     = 1,
1785         .no_tda9875     = 1,
1786         .no_tda7432     = 1,
1787         .muxsel         = { 2, 0, 1},
1788         .pll            = PLL_28,
1789         .tuner_type     = UNSET,
1790         .tuner_addr     = ADDR_UNSET,
1791 },{
1792         /* Luc Van Hoeylandt <luc@e-magic.be> */
1793         .name           = "ProVideo PV150", /* 0x4f */
1794         .video_inputs   = 2,
1795         .audio_inputs   = 0,
1796         .tuner          = -1,
1797         .svhs           = -1,
1798         .gpiomask       = 0,
1799         .muxsel         = { 2, 3 },
1800         .audiomux       = { 0 },
1801         .needs_tvaudio  = 0,
1802         .no_msp34xx     = 1,
1803         .pll            = PLL_28,
1804         .tuner_type     = UNSET,
1805         .tuner_addr     = ADDR_UNSET,
1806 },{
1807         /* Hiroshi Takekawa <sian@big.or.jp> */
1808         /* This card lacks subsystem ID */
1809         .name           = "AD-TVK503", /* 0x63 */
1810         .video_inputs   = 4,
1811         .audio_inputs   = 1,
1812         .tuner          = 0,
1813         .svhs           = 2,
1814         .gpiomask       = 0x001e8007,
1815         .muxsel         = { 2, 3, 1, 0 },
1816         /*                  Tuner, Radio, external, internal, off,  on */
1817         .audiomux       = { 0x08,  0x0f,  0x0a,     0x08,     0x0f, 0x08 },
1818         .needs_tvaudio  = 0,
1819         .no_msp34xx     = 1,
1820         .pll            = PLL_28,
1821         .tuner_type     = 2,
1822         .tuner_addr     = ADDR_UNSET,
1823         .audio_hook     = adtvk503_audio,
1824 },{
1825
1826         /* ---- card 0x64 ---------------------------------- */
1827         .name           = "Hercules Smart TV Stereo",
1828         .video_inputs   = 4,
1829         .audio_inputs   = 1,
1830         .tuner          = 0,
1831         .svhs           = 2,
1832         .gpiomask       = 0x00,
1833         .muxsel         = { 2, 3, 1, 1 },
1834         .needs_tvaudio  = 1,
1835         .no_msp34xx     = 1,
1836         .pll            = PLL_28,
1837         .tuner_type     = 5,
1838         .tuner_addr     = ADDR_UNSET,
1839         /* Notes:
1840         - card lacks subsystem ID
1841         - stereo variant w/ daughter board with tda9874a @0xb0
1842         - Audio Routing:
1843                 always from tda9874 independent of GPIO (?)
1844                 external line in: unknown
1845         - Other chips: em78p156elp @ 0x96 (probably IR remote control)
1846                 hef4053 (instead 4052) for unknown function
1847         */
1848 },{
1849         .name           = "Pace TV & Radio Card",
1850         .video_inputs   = 4,
1851         .audio_inputs   = 1,
1852         .tuner          = 0,
1853         .svhs           = 2,
1854         .muxsel         = { 2, 3, 1, 1}, /* Tuner, CVid, SVid, CVid over SVid connector */
1855         .gpiomask       = 0,
1856         .no_tda9875     = 1,
1857         .no_tda7432     = 1,
1858         .tuner_type     = 1,
1859         .tuner_addr     = ADDR_UNSET,
1860         .has_radio      = 1,
1861         .pll            = PLL_28,
1862         /* Bt878, Bt832, FI1246 tuner; no pci subsystem id
1863         only internal line out: (4pin header) RGGL
1864         Radio must be decoded by msp3410d (not routed through)*/
1865         /*
1866         .digital_mode   = DIGITAL_MODE_CAMERA,  todo!
1867         */
1868 },{
1869         /* Chris Willing <chris@vislab.usyd.edu.au> */
1870         .name           = "IVC-200",
1871         .video_inputs   = 1,
1872         .audio_inputs   = 0,
1873         .tuner          = -1,
1874         .tuner_type     = -1,
1875         .tuner_addr     = ADDR_UNSET,
1876         .svhs           = -1,
1877         .gpiomask       = 0xdf,
1878         .muxsel         = { 2 },
1879         .pll            = PLL_28,
1880 },{
1881         .name           = "Grand X-Guard / Trust 814PCI",
1882         .video_inputs   = 16,
1883         .audio_inputs   = 0,
1884         .tuner          = -1,
1885         .svhs           = -1,
1886         .tuner_type     = 4,
1887         .tuner_addr     = ADDR_UNSET,
1888         .gpiomask2      = 0xff,
1889         .muxsel         = { 2,2,2,2, 3,3,3,3, 1,1,1,1, 0,0,0,0 },
1890         .muxsel_hook    = xguard_muxsel,
1891         .no_msp34xx     = 1,
1892         .no_tda9875     = 1,
1893         .no_tda7432     = 1,
1894         .pll            = PLL_28,
1895 },{
1896
1897         /* ---- card 0x68 ---------------------------------- */
1898         .name           = "Nebula Electronics DigiTV",
1899         .video_inputs   = 1,
1900         .tuner          = -1,
1901         .svhs           = -1,
1902         .muxsel         = { 2, 3, 1, 0},
1903         .no_msp34xx     = 1,
1904         .no_tda9875     = 1,
1905         .no_tda7432     = 1,
1906         .pll            = PLL_28,
1907         .tuner_type     = -1,
1908         .tuner_addr     = ADDR_UNSET,
1909         .has_dvb        = 1,
1910         .no_gpioirq     = 1,
1911 },{
1912         /* Jorge Boncompte - DTI2 <jorge@dti2.net> */
1913         .name           = "ProVideo PV143",
1914         .video_inputs   = 4,
1915         .audio_inputs   = 0,
1916         .tuner          = -1,
1917         .svhs           = -1,
1918         .gpiomask       = 0,
1919         .muxsel         = { 2, 3, 1, 0 },
1920         .audiomux       = { 0 },
1921         .needs_tvaudio  = 0,
1922         .no_msp34xx     = 1,
1923         .pll            = PLL_28,
1924         .tuner_type     = -1,
1925         .tuner_addr     = ADDR_UNSET,
1926 },{
1927         /* M.Klahr@phytec.de */
1928         .name           = "PHYTEC VD-009-X1 MiniDIN (bt878)",
1929         .video_inputs   = 4,
1930         .audio_inputs   = 0,
1931         .tuner          = -1, /* card has no tuner */
1932         .svhs           = 3,
1933         .gpiomask       = 0x00,
1934         .muxsel         = { 2, 3, 1, 0},
1935         .audiomux       = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1936         .needs_tvaudio  = 1,
1937         .pll            = PLL_28,
1938         .tuner_type     = -1,
1939         .tuner_addr     = ADDR_UNSET,
1940 },{
1941         .name           = "PHYTEC VD-009-X1 Combi (bt878)",
1942         .video_inputs   = 4,
1943         .audio_inputs   = 0,
1944         .tuner          = -1, /* card has no tuner */
1945         .svhs           = 3,
1946         .gpiomask       = 0x00,
1947         .muxsel         = { 2, 3, 1, 1},
1948         .audiomux       = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1949         .needs_tvaudio  = 1,
1950         .pll            = PLL_28,
1951         .tuner_type     = -1,
1952         .tuner_addr     = ADDR_UNSET,
1953 },{
1954
1955         /* ---- card 0x6c ---------------------------------- */
1956         .name           = "PHYTEC VD-009 MiniDIN (bt878)",
1957         .video_inputs   = 10,
1958         .audio_inputs   = 0,
1959         .tuner          = -1, /* card has no tuner */
1960         .svhs           = 9,
1961         .gpiomask       = 0x00,
1962         .gpiomask2      = 0x03, /* gpiomask2 defines the bits used to switch audio
1963                                 via the upper nibble of muxsel. here: used for
1964                                 xternal video-mux */
1965         .muxsel         = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x00 },
1966         .audiomux       = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1967         .needs_tvaudio  = 1,
1968         .pll            = PLL_28,
1969         .tuner_type     = -1,
1970         .tuner_addr     = ADDR_UNSET,
1971 },{
1972         .name           = "PHYTEC VD-009 Combi (bt878)",
1973         .video_inputs   = 10,
1974         .audio_inputs   = 0,
1975         .tuner          = -1, /* card has no tuner */
1976         .svhs           = 9,
1977         .gpiomask       = 0x00,
1978         .gpiomask2      = 0x03, /* gpiomask2 defines the bits used to switch audio
1979                                 via the upper nibble of muxsel. here: used for
1980                                 xternal video-mux */
1981         .muxsel         = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x01 },
1982         .audiomux       = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1983         .needs_tvaudio  = 1,
1984         .pll            = PLL_28,
1985         .tuner_type     = -1,
1986         .tuner_addr     = ADDR_UNSET,
1987 },{
1988         .name           = "IVC-100",
1989         .video_inputs   = 4,
1990         .audio_inputs   = 0,
1991         .tuner          = -1,
1992         .tuner_type     = -1,
1993         .tuner_addr     = ADDR_UNSET,
1994         .svhs           = -1,
1995         .gpiomask       = 0xdf,
1996         .muxsel         = { 2, 3, 1, 0 },
1997         .pll            = PLL_28,
1998 },{
1999         /* IVC-120G - Alan Garfield <alan@fromorbit.com> */
2000         .name           = "IVC-120G",
2001         .video_inputs   = 16,
2002         .audio_inputs   = 0,    /* card has no audio */
2003         .tuner          = -1,   /* card has no tuner */
2004         .tuner_type     = -1,
2005         .tuner_addr     = ADDR_UNSET,
2006         .svhs           = -1,   /* card has no svhs */
2007         .needs_tvaudio  = 0,
2008         .no_msp34xx     = 1,
2009         .no_tda9875     = 1,
2010         .no_tda7432     = 1,
2011         .gpiomask       = 0x00,
2012         .muxsel         = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
2013                         0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10 },
2014         .muxsel_hook    = ivc120_muxsel,
2015         .pll            = PLL_28,
2016 },{
2017
2018         /* ---- card 0x70 ---------------------------------- */
2019         .name           = "pcHDTV HD-2000 TV",
2020         .video_inputs   = 4,
2021         .audio_inputs   = 1,
2022         .tuner          = 0,
2023         .svhs           = 2,
2024         .muxsel         = { 2, 3, 1, 0},
2025         .tuner_type     = TUNER_PHILIPS_ATSC,
2026         .tuner_addr     = ADDR_UNSET,
2027         .has_dvb        = 1,
2028 },{
2029         .name           = "Twinhan DST + clones",
2030         .no_msp34xx     = 1,
2031         .no_tda9875     = 1,
2032         .no_tda7432     = 1,
2033         .tuner_type     = TUNER_ABSENT,
2034         .tuner_addr     = ADDR_UNSET,
2035         .no_video       = 1,
2036         .has_dvb        = 1,
2037 },{
2038         .name           = "Winfast VC100",
2039         .video_inputs   = 3,
2040         .audio_inputs   = 0,
2041         .svhs           = 1,
2042         .tuner          = -1,
2043         .muxsel         = { 3, 1, 1, 3}, /* Vid In, SVid In, Vid over SVid in connector */
2044         .no_msp34xx     = 1,
2045         .no_tda9875     = 1,
2046         .no_tda7432     = 1,
2047         .tuner_type     = TUNER_ABSENT,
2048         .tuner_addr     = ADDR_UNSET,
2049         .pll            = PLL_28,
2050 },{
2051         .name           = "Teppro TEV-560/InterVision IV-560",
2052         .video_inputs   = 3,
2053         .audio_inputs   = 1,
2054         .tuner          = 0,
2055         .svhs           = 2,
2056         .gpiomask       = 3,
2057         .muxsel         = { 2, 3, 1, 1},
2058         .audiomux       = { 1, 1, 1, 1, 0},
2059         .needs_tvaudio  = 1,
2060         .tuner_type     = TUNER_PHILIPS_PAL,
2061         .tuner_addr     = ADDR_UNSET,
2062         .pll            = PLL_35,
2063 },{
2064
2065         /* ---- card 0x74 ---------------------------------- */
2066         .name           = "SIMUS GVC1100",
2067         .video_inputs   = 4,
2068         .audio_inputs   = 0,
2069         .tuner          = -1,
2070         .svhs           = -1,
2071         .tuner_type     = -1,
2072         .tuner_addr     = ADDR_UNSET,
2073         .pll            = PLL_28,
2074         .muxsel         = { 2, 2, 2, 2},
2075         .gpiomask       = 0x3F,
2076         .muxsel_hook    = gvc1100_muxsel,
2077 },{
2078         /* Carlos Silva r3pek@r3pek.homelinux.org || card 0x75 */
2079         .name           = "NGS NGSTV+",
2080         .video_inputs   = 3,
2081         .tuner          = 0,
2082         .svhs           = 2,
2083         .gpiomask       = 0x008007,
2084         .muxsel         = {2, 3, 0, 0},
2085         .audiomux       = {0, 0, 0, 0, 0x000003, 0},
2086         .pll            = PLL_28,
2087         .tuner_type     = TUNER_PHILIPS_PAL,
2088         .tuner_addr     = ADDR_UNSET,
2089         .has_remote     = 1,
2090 },{
2091         /* http://linuxmedialabs.com */
2092         .name           = "LMLBT4",
2093         .video_inputs   = 4, /* IN1,IN2,IN3,IN4 */
2094         .audio_inputs   = 0,
2095         .tuner          = -1,
2096         .svhs           = -1,
2097         .muxsel         = { 2, 3, 1, 0 },
2098         .no_msp34xx     = 1,
2099         .no_tda9875     = 1,
2100         .no_tda7432     = 1,
2101         .needs_tvaudio  = 0,
2102         .tuner_type     = -1,
2103         .tuner_addr     = ADDR_UNSET,
2104 },{
2105         /* Helmroos Harri <harri.helmroos@pp.inet.fi> */
2106         .name           = "Tekram M205 PRO",
2107         .video_inputs   = 3,
2108         .audio_inputs   = 1,
2109         .tuner          = 0,
2110         .tuner_type     = TUNER_PHILIPS_PAL,
2111         .tuner_addr     = ADDR_UNSET,
2112         .svhs           = 2,
2113         .needs_tvaudio  = 0,
2114         .gpiomask       = 0x68,
2115         .muxsel         = { 2, 3, 1},
2116         .audiomux       = { 0x68, 0x68, 0x61, 0x61, 0x00 },
2117         .pll            = PLL_28,
2118 },{
2119
2120         /* ---- card 0x78 ---------------------------------- */
2121         /* Javier Cendan Ares <jcendan@lycos.es> */
2122         /* bt878 TV + FM without subsystem ID */
2123         .name           = "Conceptronic CONTVFMi",
2124         .video_inputs   = 3,
2125         .audio_inputs   = 1,
2126         .tuner          = 0,
2127         .svhs           = 2,
2128         .gpiomask       = 0x008007,
2129         .muxsel         = { 2, 3, 1, 1 },
2130         .audiomux       = { 0, 1, 2, 2, 3 },
2131         .needs_tvaudio  = 0,
2132         .pll            = PLL_28,
2133         .tuner_type     = TUNER_PHILIPS_PAL,
2134         .tuner_addr     = ADDR_UNSET,
2135         .has_remote     = 1,
2136         .has_radio      = 1,
2137 },{
2138         /*Eric DEBIEF <debief@telemsa.com>*/
2139         /*EURESYS Picolo Tetra : 4 Conexant Fusion 878A, no audio, video input set with analog multiplexers GPIO controled*/
2140         /* adds picolo_tetra_muxsel(), picolo_tetra_init(), the folowing declaration strucure, and #define BTTV_PICOLO_TETRA_CHIP*/
2141         /*0x79 in bttv.h*/
2142         .name           = "Euresys Picolo Tetra",
2143         .video_inputs   = 4,
2144         .audio_inputs   = 0,
2145         .tuner          = -1,
2146         .svhs           = -1,
2147         .gpiomask       = 0,
2148         .gpiomask2      = 0x3C<<16,/*Set the GPIO[18]->GPIO[21] as output pin.==> drive the video inputs through analog multiplexers*/
2149         .no_msp34xx     = 1,
2150         .no_tda9875     = 1,
2151         .no_tda7432     = 1,
2152         .muxsel         = {2,2,2,2},/*878A input is always MUX0, see above.*/
2153         .audiomux       = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
2154         .pll            = PLL_28,
2155         .needs_tvaudio  = 0,
2156         .muxsel_hook    = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/
2157         .tuner_type     = -1,
2158         .tuner_addr     = ADDR_UNSET,
2159 },{
2160         /* Spirit TV Tuner from http://spiritmodems.com.au */
2161         /* Stafford Goodsell <surge@goliath.homeunix.org> */
2162         .name           = "Spirit TV Tuner",
2163         .video_inputs   = 3,
2164         .audio_inputs   = 1,
2165         .tuner          = 0,
2166         .svhs           = 2,
2167         .gpiomask       = 0x0000000f,
2168         .muxsel         = { 2, 1, 1 },
2169         .audiomux       = { 0x02, 0x00, 0x00, 0x00, 0x00},
2170         .tuner_type     = TUNER_TEMIC_PAL,
2171         .tuner_addr     = ADDR_UNSET,
2172         .no_msp34xx     = 1,
2173         .no_tda9875     = 1,
2174 },{
2175         /* Wolfram Joost <wojo@frokaschwei.de> */
2176         .name           = "AVerMedia AVerTV DVB-T 771",
2177         .video_inputs   = 2,
2178         .svhs           = 1,
2179         .tuner          = -1,
2180         .tuner_type     = TUNER_ABSENT,
2181         .tuner_addr     = ADDR_UNSET,
2182         .muxsel         = { 3 , 3 },
2183         .no_msp34xx     = 1,
2184         .no_tda9875     = 1,
2185         .no_tda7432     = 1,
2186         .pll            = PLL_28,
2187         .has_dvb        = 1,
2188         .no_gpioirq     = 1,
2189         .has_remote     = 1,
2190 },{
2191         /* ---- card 0x7c ---------------------------------- */
2192         /* Matt Jesson <dvb@jesson.eclipse.co.uk> */
2193         /* Based on the Nebula card data - added remote and new card number - BTTV_AVDVBT_761, see also ir-kbd-gpio.c */
2194         .name           = "AverMedia AverTV DVB-T 761",
2195         .video_inputs   = 2,
2196         .tuner          = -1,
2197         .svhs           = 1,
2198         .muxsel         = { 3, 1, 2, 0}, /* Comp0, S-Video, ?, ? */
2199         .no_msp34xx     = 1,
2200         .no_tda9875     = 1,
2201         .no_tda7432     = 1,
2202         .pll            = PLL_28,
2203         .tuner_type     = -1,
2204         .tuner_addr     = ADDR_UNSET,
2205         .has_dvb        = 1,
2206         .no_gpioirq     = 1,
2207         .has_remote     = 1,
2208 },{
2209         /* andre.schwarz@matrix-vision.de */
2210         .name             = "MATRIX Vision Sigma-SQ",
2211         .video_inputs     = 16,
2212         .audio_inputs     = 0,
2213         .tuner            = -1,
2214         .svhs             = -1,
2215         .gpiomask         = 0x0,
2216         .muxsel           = { 2, 2, 2, 2, 2, 2, 2, 2,
2217                         3, 3, 3, 3, 3, 3, 3, 3 },
2218         .muxsel_hook      = sigmaSQ_muxsel,
2219         .audiomux         = { 0 },
2220         .no_msp34xx       = 1,
2221         .pll              = PLL_28,
2222         .tuner_type       = -1,
2223         .tuner_addr       = ADDR_UNSET,
2224 },{
2225         /* andre.schwarz@matrix-vision.de */
2226         .name             = "MATRIX Vision Sigma-SLC",
2227         .video_inputs     = 4,
2228         .audio_inputs     = 0,
2229         .tuner            = -1,
2230         .svhs             = -1,
2231         .gpiomask         = 0x0,
2232         .muxsel           = { 2, 2, 2, 2 },
2233         .muxsel_hook      = sigmaSLC_muxsel,
2234         .audiomux         = { 0 },
2235         .no_msp34xx       = 1,
2236         .pll              = PLL_28,
2237         .tuner_type       = -1,
2238         .tuner_addr       = ADDR_UNSET,
2239 },{
2240         /* BTTV_APAC_VIEWCOMP */
2241         /* Attila Kondoros <attila.kondoros@chello.hu> */
2242         /* bt878 TV + FM 0x00000000 subsystem ID */
2243         .name           = "APAC Viewcomp 878(AMAX)",
2244         .video_inputs   = 2,
2245         .audio_inputs   = 1,
2246         .tuner          = 0,
2247         .svhs           = -1,
2248         .gpiomask       = 0xFF,
2249         .muxsel         = { 2, 3, 1, 1},
2250         .audiomux       = { 2, 0, 0, 0, 10},
2251         .needs_tvaudio  = 0,
2252         .pll            = PLL_28,
2253         .tuner_type     = TUNER_PHILIPS_PAL,
2254         .tuner_addr     = ADDR_UNSET,
2255         .has_remote     = 1,   /* miniremote works, see ir-kbd-gpio.c */
2256         .has_radio      = 1,   /* not every card has radio */
2257 },{
2258
2259         /* ---- card 0x80 ---------------------------------- */
2260         /* Chris Pascoe <c.pascoe@itee.uq.edu.au> */
2261         .name           = "DViCO FusionHDTV DVB-T Lite",
2262         .tuner          = -1,
2263         .no_msp34xx     = 1,
2264         .no_tda9875     = 1,
2265         .no_tda7432     = 1,
2266         .pll            = PLL_28,
2267         .no_video       = 1,
2268         .has_dvb        = 1,
2269         .tuner_type     = -1,
2270         .tuner_addr     = ADDR_UNSET,
2271 },{
2272         /* Steven <photon38@pchome.com.tw> */
2273         .name           = "V-Gear MyVCD",
2274         .video_inputs   = 3,
2275         .audio_inputs   = 1,
2276         .tuner          = 0,
2277         .svhs           = 2,
2278         .gpiomask       = 0x3f,
2279         .muxsel         = {2, 3, 1, 0},
2280         .audiomux       = {0x31, 0x31, 0x31, 0x31, 0x31, 0x31},
2281         .no_msp34xx     = 1,
2282         .pll            = PLL_28,
2283         .tuner_type     = TUNER_PHILIPS_NTSC_M,
2284         .tuner_addr     = ADDR_UNSET,
2285         .has_radio      = 0,
2286 },{
2287         /* Rick C <cryptdragoon@gmail.com> */
2288         .name           = "Super TV Tuner",
2289         .video_inputs   = 4,
2290         .audio_inputs   = 1,
2291         .tuner          = 0,
2292         .svhs           = 2,
2293         .muxsel         = { 2, 3, 1, 0},
2294         .tuner_type     = TUNER_PHILIPS_NTSC,
2295         .tuner_addr     = ADDR_UNSET,
2296         .gpiomask       = 0x008007,
2297         .audiomux       = { 0, 0x000001,0,0, 0},
2298         .needs_tvaudio  = 1,
2299         .has_radio      = 1,
2300 },{
2301         /* Chris Fanning <video4linux@haydon.net> */
2302         .name           = "Tibet Systems 'Progress DVR' CS16",
2303         .video_inputs   = 16,
2304         .audio_inputs   = 0,
2305         .tuner          = -1,
2306         .svhs           = -1,
2307         .muxsel         = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 },
2308         .pll            = PLL_28,
2309         .no_msp34xx     = 1,
2310         .no_tda9875     = 1,
2311         .no_tda7432     = 1,
2312         .tuner_type     = -1,
2313         .tuner_addr     = ADDR_UNSET,
2314         .muxsel_hook    = tibetCS16_muxsel,
2315 },
2316 {
2317         /* Bill Brack <wbrack@mmm.com.hk> */
2318         /*
2319         * Note that, because of the card's wiring, the "master"
2320         * BT878A chip (i.e. the one which controls the analog switch
2321         * and must use this card type) is the 2nd one detected.  The
2322         * other 3 chips should use card type 0x85, whose description
2323         * follows this one.  There is a EEPROM on the card (which is
2324         * connected to the I2C of one of those other chips), but is
2325         * not currently handled.  There is also a facility for a
2326         * "monitor", which is also not currently implemented.
2327         */
2328         .name           = "Kodicom 4400R (master)",
2329         .video_inputs   = 16,
2330         .audio_inputs   = 0,
2331         .tuner          = -1,
2332         .tuner_type     = -1,
2333         .tuner_addr     = ADDR_UNSET,
2334         .svhs           = -1,
2335         /* GPIO bits 0-9 used for analog switch:
2336         *   00 - 03:    camera selector
2337         *   04 - 06:    channel (controller) selector
2338         *   07: data (1->on, 0->off)
2339         *   08: strobe
2340         *   09: reset
2341         * bit 16 is input from sync separator for the channel
2342         */
2343         .gpiomask       = 0x0003ff,
2344         .no_gpioirq     = 1,
2345         .muxsel         = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
2346         .pll            = PLL_28,
2347         .no_msp34xx     = 1,
2348         .no_tda7432     = 1,
2349         .no_tda9875     = 1,
2350         .muxsel_hook    = kodicom4400r_muxsel,
2351 },
2352 {
2353         /* Bill Brack <wbrack@mmm.com.hk> */
2354         /* Note that, for reasons unknown, the "master" BT878A chip (i.e. the
2355         * one which controls the analog switch, and must use the card type)
2356         * is the 2nd one detected.  The other 3 chips should use this card
2357         * type
2358         */
2359         .name           = "Kodicom 4400R (slave)",
2360         .video_inputs   = 16,
2361         .audio_inputs   = 0,
2362         .tuner          = -1,
2363         .tuner_type     = -1,
2364         .tuner_addr     = ADDR_UNSET,
2365         .svhs           = -1,
2366         .gpiomask       = 0x010000,
2367         .no_gpioirq     = 1,
2368         .muxsel         = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
2369         .pll            = PLL_28,
2370         .no_msp34xx     = 1,
2371         .no_tda7432     = 1,
2372         .no_tda9875     = 1,
2373         .muxsel_hook    = kodicom4400r_muxsel,
2374 },
2375 {
2376         /* ---- card 0x86---------------------------------- */
2377         /* Michael Henson <mhenson@clarityvi.com> */
2378         /* Adlink RTV24 with special unlock codes */
2379         .name           = "Adlink RTV24",
2380         .video_inputs   = 4,
2381         .audio_inputs   = 1,
2382         .tuner          = 0,
2383         .svhs           = 2,
2384         .muxsel         = { 2, 3, 1, 0},
2385         .tuner_type     = -1,
2386         .tuner_addr     = ADDR_UNSET,
2387         .pll            = PLL_28,
2388 },
2389 {
2390         /* ---- card 0x87---------------------------------- */
2391         /* Michael Krufky <mkrufky@m1k.net> */
2392         .name           = "DViCO FusionHDTV 5 Lite",
2393         .tuner          = 0,
2394         .tuner_type     = TUNER_LG_TDVS_H062F,
2395         .tuner_addr     = ADDR_UNSET,
2396         .video_inputs   = 2,
2397         .audio_inputs   = 1,
2398         .svhs           = 2,
2399         .muxsel         = { 2, 3 },
2400         .gpiomask       = 0x00e00007,
2401         .audiomux       = { 0x00400005, 0, 0x00000001, 0, 0x00c00007, 0 },
2402         .no_msp34xx     = 1,
2403         .no_tda9875     = 1,
2404         .no_tda7432     = 1,
2405 },{
2406         /* ---- card 0x88---------------------------------- */
2407         /* Mauro Carvalho Chehab <mchehab@brturbo.com.br> */
2408         .name           = "Acorp Y878F",
2409         .video_inputs   = 3,
2410         .audio_inputs   = 1,
2411         .tuner          = 0,
2412         .svhs           = 2,
2413         .gpiomask       = 0x01fe00,
2414         .muxsel         = { 2, 3, 1, 1},
2415         .audiomux       = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 },
2416         .needs_tvaudio  = 1,
2417         .pll            = PLL_28,
2418         .tuner_type     = TUNER_YMEC_TVF66T5_B_DFF,
2419         .tuner_addr     = 0xc1 >>1,
2420         .has_radio      = 1,
2421 }};
2422
2423 static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards);
2424
2425 /* ----------------------------------------------------------------------- */
2426
2427 static unsigned char eeprom_data[256];
2428
2429 /*
2430  * identify card
2431  */
2432 void __devinit bttv_idcard(struct bttv *btv)
2433 {
2434         unsigned int gpiobits;
2435         int i,type;
2436         unsigned short tmp;
2437
2438         /* read PCI subsystem ID */
2439         pci_read_config_word(btv->c.pci, PCI_SUBSYSTEM_ID, &tmp);
2440         btv->cardid = tmp << 16;
2441         pci_read_config_word(btv->c.pci, PCI_SUBSYSTEM_VENDOR_ID, &tmp);
2442         btv->cardid |= tmp;
2443
2444         if (0 != btv->cardid && 0xffffffff != btv->cardid) {
2445                 /* look for the card */
2446                 for (type = -1, i = 0; cards[i].id != 0; i++)
2447                         if (cards[i].id  == btv->cardid)
2448                                 type = i;
2449
2450                 if (type != -1) {
2451                         /* found it */
2452                         printk(KERN_INFO "bttv%d: detected: %s [card=%d], "
2453                                "PCI subsystem ID is %04x:%04x\n",
2454                                btv->c.nr,cards[type].name,cards[type].cardnr,
2455                                btv->cardid & 0xffff,
2456                                (btv->cardid >> 16) & 0xffff);
2457                         btv->c.type = cards[type].cardnr;
2458                 } else {
2459                         /* 404 */
2460                         printk(KERN_INFO "bttv%d: subsystem: %04x:%04x (UNKNOWN)\n",
2461                                btv->c.nr, btv->cardid & 0xffff,
2462                                (btv->cardid >> 16) & 0xffff);
2463                         printk(KERN_DEBUG "please mail id, board name and "
2464                                "the correct card= insmod option to kraxel@bytesex.org\n");
2465                 }
2466         }
2467
2468         /* let the user override the autodetected type */
2469         if (card[btv->c.nr] < bttv_num_tvcards)
2470                 btv->c.type=card[btv->c.nr];
2471
2472         /* print which card config we are using */
2473         printk(KERN_INFO "bttv%d: using: %s [card=%d,%s]\n",btv->c.nr,
2474                bttv_tvcards[btv->c.type].name, btv->c.type,
2475                card[btv->c.nr] < bttv_num_tvcards
2476                ? "insmod option" : "autodetected");
2477
2478         /* overwrite gpio stuff ?? */
2479         if (UNSET == audioall && UNSET == audiomux[0])
2480                 return;
2481
2482         if (UNSET != audiomux[0]) {
2483                 gpiobits = 0;
2484                 for (i = 0; i < 5; i++) {
2485                         bttv_tvcards[btv->c.type].audiomux[i] = audiomux[i];
2486                         gpiobits |= audiomux[i];
2487                 }
2488         } else {
2489                 gpiobits = audioall;
2490                 for (i = 0; i < 5; i++) {
2491                         bttv_tvcards[btv->c.type].audiomux[i] = audioall;
2492                 }
2493         }
2494         bttv_tvcards[btv->c.type].gpiomask = (UNSET != gpiomask) ? gpiomask : gpiobits;
2495         printk(KERN_INFO "bttv%d: gpio config override: mask=0x%x, mux=",
2496                btv->c.nr,bttv_tvcards[btv->c.type].gpiomask);
2497         for (i = 0; i < 5; i++) {
2498                 printk("%s0x%x", i ? "," : "", bttv_tvcards[btv->c.type].audiomux[i]);
2499         }
2500         printk("\n");
2501 }
2502
2503 /*
2504  * (most) board specific initialisations goes here
2505  */
2506
2507 /* Some Modular Technology cards have an eeprom, but no subsystem ID */
2508 void identify_by_eeprom(struct bttv *btv, unsigned char eeprom_data[256])
2509 {
2510         int type = -1;
2511
2512         if (0 == strncmp(eeprom_data,"GET MM20xPCTV",13))
2513                 type = BTTV_MODTEC_205;
2514         else if (0 == strncmp(eeprom_data+20,"Picolo",7))
2515                 type = BTTV_EURESYS_PICOLO;
2516         else if (eeprom_data[0] == 0x84 && eeprom_data[2]== 0)
2517                 type = BTTV_HAUPPAUGE; /* old bt848 */
2518
2519         if (-1 != type) {
2520                 btv->c.type = type;
2521                 printk("bttv%d: detected by eeprom: %s [card=%d]\n",
2522                        btv->c.nr, bttv_tvcards[btv->c.type].name, btv->c.type);
2523         }
2524 }
2525
2526 static void flyvideo_gpio(struct bttv *btv)
2527 {
2528         int gpio,has_remote,has_radio,is_capture_only,is_lr90,has_tda9820_tda9821;
2529         int tuner=-1,ttype;
2530
2531         gpio_inout(0xffffff, 0);
2532         udelay(8);  /* without this we would see the 0x1800 mask */
2533         gpio = gpio_read();
2534         /* FIXME: must restore OUR_EN ??? */
2535
2536         /* all cards provide GPIO info, some have an additional eeprom
2537          * LR50: GPIO coding can be found lower right CP1 .. CP9
2538          *       CP9=GPIO23 .. CP1=GPIO15; when OPEN, the corresponding GPIO reads 1.
2539          *       GPIO14-12: n.c.
2540          * LR90: GP9=GPIO23 .. GP1=GPIO15 (right above the bt878)
2541
2542          * lowest 3 bytes are remote control codes (no handshake needed)
2543          * xxxFFF: No remote control chip soldered
2544          * xxxF00(LR26/LR50), xxxFE0(LR90): Remote control chip (LVA001 or CF45) soldered
2545          * Note: Some bits are Audio_Mask !
2546          */
2547         ttype=(gpio&0x0f0000)>>16;
2548         switch(ttype) {
2549         case 0x0: tuner=2; /* NTSC, e.g. TPI8NSR11P */
2550                 break;
2551         case 0x2: tuner=39;/* LG NTSC (newer TAPC series) TAPC-H701P */
2552                 break;
2553         case 0x4: tuner=5; /* Philips PAL TPI8PSB02P, TPI8PSB12P, TPI8PSB12D or FI1216, FM1216 */
2554                 break;
2555         case 0x6: tuner=37;/* LG PAL (newer TAPC series) TAPC-G702P */
2556                 break;
2557                 case 0xC: tuner=3; /* Philips SECAM(+PAL) FQ1216ME or FI1216MF */
2558                 break;
2559         default:
2560                 printk(KERN_INFO "bttv%d: FlyVideo_gpio: unknown tuner type.\n", btv->c.nr);
2561         }
2562
2563         has_remote          =   gpio & 0x800000;
2564         has_radio           =   gpio & 0x400000;
2565         /*   unknown                   0x200000;
2566          *   unknown2                  0x100000; */
2567         is_capture_only     = !(gpio & 0x008000); /* GPIO15 */
2568         has_tda9820_tda9821 = !(gpio & 0x004000);
2569         is_lr90             = !(gpio & 0x002000); /* else LR26/LR50 (LR38/LR51 f. capture only) */
2570         /*
2571          * gpio & 0x001000    output bit for audio routing */
2572
2573         if(is_capture_only)
2574                 tuner=4; /* No tuner present */
2575
2576         printk(KERN_INFO "bttv%d: FlyVideo Radio=%s RemoteControl=%s Tuner=%d gpio=0x%06x\n",
2577                btv->c.nr, has_radio? "yes":"no ", has_remote? "yes":"no ", tuner, gpio);
2578         printk(KERN_INFO "bttv%d: FlyVideo  LR90=%s tda9821/tda9820=%s capture_only=%s\n",
2579                 btv->c.nr, is_lr90?"yes":"no ", has_tda9820_tda9821?"yes":"no ",
2580                 is_capture_only?"yes":"no ");
2581
2582         if(tuner!= -1) /* only set if known tuner autodetected, else let insmod option through */
2583                 btv->tuner_type = tuner;
2584         btv->has_radio = has_radio;
2585
2586         /* LR90 Audio Routing is done by 2 hef4052, so Audio_Mask has 4 bits: 0x001c80
2587          * LR26/LR50 only has 1 hef4052, Audio_Mask 0x000c00
2588          * Audio options: from tuner, from tda9821/tda9821(mono,stereo,sap), from tda9874, ext., mute */
2589         if(has_tda9820_tda9821) btv->audio_hook = lt9415_audio;
2590         /* todo: if(has_tda9874) btv->audio_hook = fv2000s_audio; */
2591 }
2592
2593 static int miro_tunermap[] = { 0,6,2,3,   4,5,6,0,  3,0,4,5,  5,2,16,1,
2594                                14,2,17,1, 4,1,4,3,  1,2,16,1, 4,4,4,4 };
2595 static int miro_fmtuner[]  = { 0,0,0,0,   0,0,0,0,  0,0,0,0,  0,0,0,1,
2596                                1,1,1,1,   1,1,1,0,  0,0,0,0,  0,1,0,0 };
2597
2598 static void miro_pinnacle_gpio(struct bttv *btv)
2599 {
2600         int id,msp,gpio;
2601         char *info;
2602
2603         gpio_inout(0xffffff, 0);
2604         gpio = gpio_read();
2605         id   = ((gpio>>10) & 63) -1;
2606         msp  = bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx");
2607         if (id < 32) {
2608                 btv->tuner_type = miro_tunermap[id];
2609                 if (0 == (gpio & 0x20)) {
2610                         btv->has_radio = 1;
2611                         if (!miro_fmtuner[id]) {
2612                                 btv->has_matchbox = 1;
2613                                 btv->mbox_we    = (1<<6);
2614                                 btv->mbox_most  = (1<<7);
2615                                 btv->mbox_clk   = (1<<8);
2616                                 btv->mbox_data  = (1<<9);
2617                                 btv->mbox_mask  = (1<<6)|(1<<7)|(1<<8)|(1<<9);
2618                         }
2619                 } else {
2620                         btv->has_radio = 0;
2621                 }
2622                 if (-1 != msp) {
2623                         if (btv->c.type == BTTV_MIRO)
2624                                 btv->c.type = BTTV_MIROPRO;
2625                         if (btv->c.type == BTTV_PINNACLE)
2626                                 btv->c.type = BTTV_PINNACLEPRO;
2627                 }
2628                 printk(KERN_INFO
2629                        "bttv%d: miro: id=%d tuner=%d radio=%s stereo=%s\n",
2630                        btv->c.nr, id+1, btv->tuner_type,
2631                        !btv->has_radio ? "no" :
2632                        (btv->has_matchbox ? "matchbox" : "fmtuner"),
2633                        (-1 == msp) ? "no" : "yes");
2634         } else {
2635                 /* new cards with microtune tuner */
2636                 id = 63 - id;
2637                 btv->has_radio = 0;
2638                 switch (id) {
2639                 case 1:
2640                         info = "PAL / mono";
2641                         break;
2642                 case 2:
2643                         info = "PAL+SECAM / stereo";
2644                         btv->has_radio = 1;
2645                         break;
2646                 case 3:
2647                         info = "NTSC / stereo";
2648                         btv->has_radio = 1;
2649                         break;
2650                 case 4:
2651                         info = "PAL+SECAM / mono";
2652                         break;
2653                 case 5:
2654                         info = "NTSC / mono";
2655                         break;
2656                 case 6:
2657                         info = "NTSC / stereo";
2658                         break;
2659                 case 7:
2660                         info = "PAL / stereo";
2661                         break;
2662                 default:
2663                         info = "oops: unknown card";
2664                         break;
2665                 }
2666                 if (-1 != msp)
2667                         btv->c.type = BTTV_PINNACLEPRO;
2668                 printk(KERN_INFO
2669                        "bttv%d: pinnacle/mt: id=%d info=\"%s\" radio=%s\n",
2670                        btv->c.nr, id, info, btv->has_radio ? "yes" : "no");
2671                 btv->tuner_type  = 33;
2672                 btv->pinnacle_id = id;
2673         }
2674 }
2675
2676 /* GPIO21   L: Buffer aktiv, H: Buffer inaktiv */
2677 #define LM1882_SYNC_DRIVE     0x200000L
2678
2679 static void init_ids_eagle(struct bttv *btv)
2680 {
2681         gpio_inout(0xffffff,0xFFFF37);
2682         gpio_write(0x200020);
2683
2684         /* flash strobe inverter ?! */
2685         gpio_write(0x200024);
2686
2687         /* switch sync drive off */
2688         gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE);
2689
2690         /* set BT848 muxel to 2 */
2691         btaor((2)<<5, ~(2<<5), BT848_IFORM);
2692 }
2693
2694 /* Muxsel helper for the IDS Eagle.
2695  * the eagles does not use the standard muxsel-bits but
2696  * has its own multiplexer */
2697 static void eagle_muxsel(struct bttv *btv, unsigned int input)
2698 {
2699         btaor((2)<<5, ~(3<<5), BT848_IFORM);
2700         gpio_bits(3,bttv_tvcards[btv->c.type].muxsel[input&7]);
2701
2702        /* composite */
2703        /* set chroma ADC to sleep */
2704        btor(BT848_ADC_C_SLEEP, BT848_ADC);
2705        /* set to composite video */
2706        btand(~BT848_CONTROL_COMP, BT848_E_CONTROL);
2707        btand(~BT848_CONTROL_COMP, BT848_O_CONTROL);
2708
2709        /* switch sync drive off */
2710        gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE);
2711 }
2712
2713 static void gvc1100_muxsel(struct bttv *btv, unsigned int input)
2714 {
2715         static const int masks[] = {0x30, 0x01, 0x12, 0x23};
2716         gpio_write(masks[input%4]);
2717 }
2718
2719 /* LMLBT4x initialization - to allow access to GPIO bits for sensors input and
2720    alarms output
2721
2722    GPIObit    | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
2723    assignment | TI | O3|INx| O2| O1|IN4|IN3|IN2|IN1|   |   |
2724
2725    IN - sensor inputs, INx - sensor inputs and TI XORed together
2726    O1,O2,O3 - alarm outputs (relays)
2727
2728    OUT ENABLE   1    1   0  . 1  1   0   0 . 0   0   0    0   = 0x6C0
2729
2730 */
2731
2732 static void init_lmlbt4x(struct bttv *btv)
2733 {
2734         printk(KERN_DEBUG "LMLBT4x init\n");
2735         btwrite(0x000000, BT848_GPIO_REG_INP);
2736         gpio_inout(0xffffff, 0x0006C0);
2737         gpio_write(0x000000);
2738 }
2739
2740 static void sigmaSQ_muxsel(struct bttv *btv, unsigned int input)
2741 {
2742         unsigned int inmux = input % 8;
2743         gpio_inout( 0xf, 0xf );
2744         gpio_bits( 0xf, inmux );
2745 }
2746
2747 static void sigmaSLC_muxsel(struct bttv *btv, unsigned int input)
2748 {
2749         unsigned int inmux = input % 4;
2750         gpio_inout( 3<<9, 3<<9 );
2751         gpio_bits( 3<<9, inmux<<9 );
2752 }
2753
2754 /* ----------------------------------------------------------------------- */
2755
2756 static void bttv_reset_audio(struct bttv *btv)
2757 {
2758         /*
2759          * BT878A has a audio-reset register.
2760          * 1. This register is an audio reset function but it is in
2761          *    function-0 (video capture) address space.
2762          * 2. It is enough to do this once per power-up of the card.
2763          * 3. There is a typo in the Conexant doc -- it is not at
2764          *    0x5B, but at 0x058. (B is an odd-number, obviously a typo!).
2765          * --//Shrikumar 030609
2766          */
2767         if (btv->id != 878)
2768                 return;
2769
2770         if (bttv_debug)
2771                 printk("bttv%d: BT878A ARESET\n",btv->c.nr);
2772         btwrite((1<<7), 0x058);
2773         udelay(10);
2774         btwrite(     0, 0x058);
2775 }
2776
2777 /* initialization part one -- before registering i2c bus */
2778 void __devinit bttv_init_card1(struct bttv *btv)
2779 {
2780         switch (btv->c.type) {
2781         case BTTV_HAUPPAUGE:
2782         case BTTV_HAUPPAUGE878:
2783                 boot_msp34xx(btv,5);
2784                 break;
2785         case BTTV_VOODOOTV_FM:
2786                 boot_msp34xx(btv,20);
2787                 break;
2788         case BTTV_AVERMEDIA98:
2789                 boot_msp34xx(btv,11);
2790                 break;
2791         case BTTV_HAUPPAUGEPVR:
2792                 pvr_boot(btv);
2793                 break;
2794         case BTTV_TWINHAN_DST:
2795         case BTTV_AVDVBT_771:
2796                 btv->use_i2c_hw = 1;
2797                 break;
2798         case BTTV_ADLINK_RTV24:
2799                 init_RTV24( btv );
2800                 break;
2801
2802         }
2803         if (!bttv_tvcards[btv->c.type].has_dvb)
2804                 bttv_reset_audio(btv);
2805 }
2806
2807 /* initialization part two -- after registering i2c bus */
2808 void __devinit bttv_init_card2(struct bttv *btv)
2809 {
2810         int tda9887;
2811         int addr=ADDR_UNSET;
2812
2813         btv->tuner_type = -1;
2814
2815         if (BTTV_UNKNOWN == btv->c.type) {
2816                 bttv_readee(btv,eeprom_data,0xa0);
2817                 identify_by_eeprom(btv,eeprom_data);
2818         }
2819
2820         switch (btv->c.type) {
2821         case BTTV_MIRO:
2822         case BTTV_MIROPRO:
2823         case BTTV_PINNACLE:
2824         case BTTV_PINNACLEPRO:
2825                 /* miro/pinnacle */
2826                 miro_pinnacle_gpio(btv);
2827                 break;
2828         case BTTV_FLYVIDEO_98:
2829         case BTTV_MAXI:
2830         case BTTV_LIFE_FLYKIT:
2831         case BTTV_FLYVIDEO:
2832         case BTTV_TYPHOON_TVIEW:
2833         case BTTV_CHRONOS_VS2:
2834         case BTTV_FLYVIDEO_98FM:
2835         case BTTV_FLYVIDEO2000:
2836         case BTTV_FLYVIDEO98EZ:
2837         case BTTV_CONFERENCETV:
2838         case BTTV_LIFETEC_9415:
2839                 flyvideo_gpio(btv);
2840                 break;
2841         case BTTV_HAUPPAUGE:
2842         case BTTV_HAUPPAUGE878:
2843         case BTTV_HAUPPAUGEPVR:
2844                 /* pick up some config infos from the eeprom */
2845                 bttv_readee(btv,eeprom_data,0xa0);
2846                 hauppauge_eeprom(btv);
2847                 break;
2848         case BTTV_AVERMEDIA98:
2849         case BTTV_AVPHONE98:
2850                 bttv_readee(btv,eeprom_data,0xa0);
2851                 avermedia_eeprom(btv);
2852                 break;
2853         case BTTV_PXC200:
2854                 init_PXC200(btv);
2855                 break;
2856         case BTTV_PICOLO_TETRA_CHIP:
2857                 picolo_tetra_init(btv);
2858                 break;
2859         case BTTV_VHX:
2860                 btv->has_radio    = 1;
2861                 btv->has_matchbox = 1;
2862                 btv->mbox_we      = 0x20;
2863                 btv->mbox_most    = 0;
2864                 btv->mbox_clk     = 0x08;
2865                 btv->mbox_data    = 0x10;
2866                 btv->mbox_mask    = 0x38;
2867                 break;
2868         case BTTV_VOBIS_BOOSTAR:
2869         case BTTV_TERRATV:
2870                 terratec_active_radio_upgrade(btv);
2871                 break;
2872         case BTTV_MAGICTVIEW061:
2873                 if (btv->cardid == 0x3002144f) {
2874                         btv->has_radio=1;
2875                         printk("bttv%d: radio detected by subsystem id (CPH05x)\n",btv->c.nr);
2876                 }
2877                 break;
2878        case BTTV_STB2:
2879                 if (btv->cardid == 0x3060121a) {
2880                         /* Fix up entry for 3DFX VoodooTV 100,
2881                            which is an OEM STB card variant. */
2882                         btv->has_radio=0;
2883                         btv->tuner_type=TUNER_TEMIC_NTSC;
2884                 }
2885                 break;
2886         case BTTV_OSPREY1x0:
2887         case BTTV_OSPREY1x0_848:
2888         case BTTV_OSPREY101_848:
2889         case BTTV_OSPREY1x1:
2890         case BTTV_OSPREY1x1_SVID:
2891         case BTTV_OSPREY2xx:
2892         case BTTV_OSPREY2x0_SVID:
2893         case BTTV_OSPREY2x0:
2894         case BTTV_OSPREY500:
2895         case BTTV_OSPREY540:
2896         case BTTV_OSPREY2000:
2897                 bttv_readee(btv,eeprom_data,0xa0);
2898                 osprey_eeprom(btv);
2899                 break;
2900         case BTTV_IDS_EAGLE:
2901                 init_ids_eagle(btv);
2902                 break;
2903         case BTTV_MODTEC_205:
2904                 bttv_readee(btv,eeprom_data,0xa0);
2905                 modtec_eeprom(btv);
2906                 break;
2907         case BTTV_LMLBT4:
2908                 init_lmlbt4x(btv);
2909                 break;
2910         case BTTV_TIBET_CS16:
2911                 tibetCS16_init(btv);
2912                 break;
2913         case BTTV_KODICOM_4400R:
2914                 kodicom4400r_init(btv);
2915                 break;
2916         }
2917
2918         /* pll configuration */
2919         if (!(btv->id==848 && btv->revision==0x11)) {
2920                 /* defaults from card list */
2921                 if (PLL_28 == bttv_tvcards[btv->c.type].pll) {
2922                         btv->pll.pll_ifreq=28636363;
2923                         btv->pll.pll_crystal=BT848_IFORM_XT0;
2924                 }
2925                 if (PLL_35 == bttv_tvcards[btv->c.type].pll) {
2926                         btv->pll.pll_ifreq=35468950;
2927                         btv->pll.pll_crystal=BT848_IFORM_XT1;
2928                 }
2929                 /* insmod options can override */
2930                 switch (pll[btv->c.nr]) {
2931                 case 0: /* none */
2932                         btv->pll.pll_crystal = 0;
2933                         btv->pll.pll_ifreq   = 0;
2934                         btv->pll.pll_ofreq   = 0;
2935                         break;
2936                 case 1: /* 28 MHz */
2937                 case 28:
2938                         btv->pll.pll_ifreq   = 28636363;
2939                         btv->pll.pll_ofreq   = 0;
2940                         btv->pll.pll_crystal = BT848_IFORM_XT0;
2941                         break;
2942                 case 2: /* 35 MHz */
2943                 case 35:
2944                         btv->pll.pll_ifreq   = 35468950;
2945                         btv->pll.pll_ofreq   = 0;
2946                         btv->pll.pll_crystal = BT848_IFORM_XT1;
2947                         break;
2948                 }
2949         }
2950         btv->pll.pll_current = -1;
2951
2952         /* tuner configuration (from card list / autodetect / insmod option) */
2953         if (ADDR_UNSET != bttv_tvcards[btv->c.type].tuner_addr)
2954                 addr = bttv_tvcards[btv->c.type].tuner_addr;
2955
2956         if (UNSET != bttv_tvcards[btv->c.type].tuner_type)
2957                 if(UNSET == btv->tuner_type)
2958                         btv->tuner_type = bttv_tvcards[btv->c.type].tuner_type;
2959         if (UNSET != tuner[btv->c.nr])
2960                 btv->tuner_type = tuner[btv->c.nr];
2961         printk("bttv%d: using tuner=%d\n",btv->c.nr,btv->tuner_type);
2962         if (btv->pinnacle_id != UNSET)
2963                 bttv_call_i2c_clients(btv, AUDC_CONFIG_PINNACLE,
2964                                       &btv->pinnacle_id);
2965         if (btv->tuner_type != UNSET) {
2966                 struct tuner_setup tun_setup;
2967
2968                 tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
2969                 tun_setup.type = btv->tuner_type;
2970                 tun_setup.addr = addr;
2971
2972                 bttv_call_i2c_clients(btv, TUNER_SET_TYPE_ADDR, &tun_setup);
2973         }
2974
2975         btv->svhs = bttv_tvcards[btv->c.type].svhs;
2976         if (svhs[btv->c.nr] != UNSET)
2977                 btv->svhs = svhs[btv->c.nr];
2978         if (remote[btv->c.nr] != UNSET)
2979                 btv->has_remote = remote[btv->c.nr];
2980
2981         if (bttv_tvcards[btv->c.type].has_radio)
2982                 btv->has_radio=1;
2983         if (bttv_tvcards[btv->c.type].has_remote)
2984                 btv->has_remote=1;
2985         if (bttv_tvcards[btv->c.type].no_gpioirq)
2986                 btv->gpioirq=0;
2987         if (bttv_tvcards[btv->c.type].audio_hook)
2988                 btv->audio_hook=bttv_tvcards[btv->c.type].audio_hook;
2989
2990         if (bttv_tvcards[btv->c.type].digital_mode == DIGITAL_MODE_CAMERA) {
2991                 /* detect Bt832 chip for quartzsight digital camera */
2992                 if ((bttv_I2CRead(btv, I2C_BT832_ALT1, "Bt832") >=0) ||
2993                     (bttv_I2CRead(btv, I2C_BT832_ALT2, "Bt832") >=0))
2994                         boot_bt832(btv);
2995         }
2996
2997         if (!autoload)
2998                 return;
2999
3000         /* try to detect audio/fader chips */
3001         if (!bttv_tvcards[btv->c.type].no_msp34xx &&
3002             bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx") >=0)
3003                 request_module("msp3400");
3004
3005         if (bttv_tvcards[btv->c.type].msp34xx_alt &&
3006             bttv_I2CRead(btv, I2C_MSP3400_ALT, "MSP34xx (alternate address)") >=0)
3007                 request_module("msp3400");
3008
3009         if (!bttv_tvcards[btv->c.type].no_tda9875 &&
3010             bttv_I2CRead(btv, I2C_TDA9875, "TDA9875") >=0)
3011                 request_module("tda9875");
3012
3013         if (!bttv_tvcards[btv->c.type].no_tda7432 &&
3014             bttv_I2CRead(btv, I2C_TDA7432, "TDA7432") >=0)
3015                 request_module("tda7432");
3016
3017         if (bttv_tvcards[btv->c.type].needs_tvaudio)
3018                 request_module("tvaudio");
3019
3020         /* tuner modules */
3021         tda9887 = 0;
3022         if (btv->pinnacle_id != UNSET)
3023                 tda9887 = 1;
3024         if (0 == tda9887 && 0 == bttv_tvcards[btv->c.type].has_dvb &&
3025             bttv_I2CRead(btv, I2C_TDA9887, "TDA9887") >=0)
3026                 tda9887 = 1;
3027         if((btv->tuner_type == TUNER_PHILIPS_FM1216ME_MK3) ||
3028            (btv->tuner_type == TUNER_PHILIPS_FM1236_MK3) ||
3029            (btv->tuner_type == TUNER_PHILIPS_FM1256_IH3) ||
3030             tda9887)
3031                 request_module("tda9887");
3032         if (btv->tuner_type != UNSET)
3033                 request_module("tuner");
3034 }
3035
3036
3037 /* ----------------------------------------------------------------------- */
3038
3039 static void modtec_eeprom(struct bttv *btv)
3040 {
3041         if( strncmp(&(eeprom_data[0x1e]),"Temic 4066 FY5",14) ==0) {
3042                 btv->tuner_type=TUNER_TEMIC_4066FY5_PAL_I;
3043                 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
3044                        btv->c.nr,&eeprom_data[0x1e]);
3045         } else if (strncmp(&(eeprom_data[0x1e]),"Alps TSBB5",10) ==0) {
3046                 btv->tuner_type=TUNER_ALPS_TSBB5_PAL_I;
3047                 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
3048                        btv->c.nr,&eeprom_data[0x1e]);
3049         } else if (strncmp(&(eeprom_data[0x1e]),"Philips FM1246",14) ==0) {
3050                 btv->tuner_type=TUNER_PHILIPS_NTSC;
3051                 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
3052                        btv->c.nr,&eeprom_data[0x1e]);
3053         } else {
3054                 printk("bttv%d: Modtec: Unknown TunerString: %s\n",
3055                        btv->c.nr,&eeprom_data[0x1e]);