5 this file has configuration informations - card-specific stuff
6 like the big tvcards array for the most part
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>
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.
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.
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.
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>
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);
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,
56 static void avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v,
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);
72 static void PXC200_muxsel(struct bttv *btv, unsigned int input);
74 static void picolo_tetra_muxsel(struct bttv *btv, unsigned int input);
75 static void picolo_tetra_init(struct bttv *btv);
77 static void tibetCS16_muxsel(struct bttv *btv, unsigned int input);
78 static void tibetCS16_init(struct bttv *btv);
80 static void kodicom4400r_muxsel(struct bttv *btv, unsigned int input);
81 static void kodicom4400r_init(struct bttv *btv);
83 static void sigmaSLC_muxsel(struct bttv *btv, unsigned int input);
84 static void sigmaSQ_muxsel(struct bttv *btv, unsigned int input);
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);
93 /* config variables */
94 static unsigned int triton1=0;
95 static unsigned int vsfx=0;
96 static unsigned int latency = UNSET;
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 };
106 static unsigned int autoload = 1;
108 static unsigned int autoload = 0;
110 static unsigned int gpiomask = UNSET;
111 static unsigned int audioall = UNSET;
112 static unsigned int audiomux[5] = { [ 0 ... 4 ] = UNSET };
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);
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);
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)");
140 /* ----------------------------------------------------------------------- */
141 /* list of card IDs for bt878+ cards */
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" },
157 { 0x00011002, BTTV_ATI_TVWONDER, "ATI TV Wonder" },
158 { 0x00031002, BTTV_ATI_TVWONDERVE,"ATI TV Wonder/VE" },
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" },
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" },
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" },
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)" },
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" },
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)" },
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" }, /* ?? */
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" },
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" },
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" },
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" },
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" },
257 { 0x41424344, BTTV_GRANDTEC, "GrandTec Multi Capture" },
258 { 0x01020304, BTTV_XGUARD, "Grandtec Grand X-Guard" },
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" },
267 { 0x010115cb, BTTV_GMV1, "AG GMV1" },
268 { 0x010114c7, BTTV_MODTEC_205, "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV" },
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" },
281 { 0x40111554, BTTV_PV_BT878P_9B, "Prolink Pixelview PV-BT" },
282 { 0x17de0a01, BTTV_KWORLD, "Mecer TV/FM/Video Tuner" },
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" },
289 { 0x15409511, BTTV_ACORP_Y878F, "Acorp Y878F" },
291 /* likely broken, vendor id doesn't match the other magic views ...
292 * { 0xa0fca04f, BTTV_MAGICTVIEW063, "Guillemot Maxi TV Video 3" }, */
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" },
308 /* ----------------------------------------------------------------------- */
309 /* array with description for bt848 / bt878 tv/grabber cards */
311 struct tvcard bttv_tvcards[] = {
313 /* ---- card 0x00 ---------------------------------- */
314 .name = " *** UNKNOWN/GENERIC *** ",
319 .muxsel = { 2, 3, 1, 0},
321 .tuner_addr = ADDR_UNSET,
329 .muxsel = { 2, 3, 1, 1},
330 .audiomux = { 2, 0, 0, 0, 10},
333 .tuner_addr = ADDR_UNSET,
335 .name = "Hauppauge (bt848)",
341 .muxsel = { 2, 3, 1, 1},
342 .audiomux = { 0, 1, 2, 3, 4},
345 .tuner_addr = ADDR_UNSET,
347 .name = "STB, Gateway P/N 6000699 (bt848)",
353 .muxsel = { 2, 3, 1, 1},
354 .audiomux = { 4, 0, 2, 3, 1},
357 .tuner_type = TUNER_PHILIPS_NTSC,
358 .tuner_addr = ADDR_UNSET,
363 /* ---- card 0x04 ---------------------------------- */
364 .name = "Intel Create and Share PCI/ Smart Video Recorder III",
370 .muxsel = { 2, 3, 1, 1},
374 .tuner_addr = ADDR_UNSET,
376 .name = "Diamond DTV2000",
382 .muxsel = { 2, 3, 1, 0},
383 .audiomux = { 0, 1, 0, 1, 3},
386 .tuner_addr = ADDR_UNSET,
388 .name = "AVerMedia TVPhone",
393 .muxsel = { 2, 3, 1, 1},
395 .audiomux = { 0x0c, 0x04, 0x08, 0x04, 0},
396 /* 0x04 for some cards ?? */
399 .tuner_addr = ADDR_UNSET,
400 .audio_hook = avermedia_tvphone_audio,
403 .name = "MATRIX-Vision MV-Delta",
409 .muxsel = { 2, 3, 1, 0, 0},
413 .tuner_addr = ADDR_UNSET,
416 /* ---- card 0x08 ---------------------------------- */
417 .name = "Lifeview FlyVideo II (Bt848) LR26 / MAXI TV Video PCI2 LR26",
423 .muxsel = { 2, 3, 1, 1},
424 .audiomux = { 0, 0xc00, 0x800, 0x400, 0xc00, 0},
428 .tuner_addr = ADDR_UNSET,
430 .name = "IMS/IXmicro TurboTV",
436 .muxsel = { 2, 3, 1, 1},
437 .audiomux = { 1, 1, 2, 3, 0},
440 .tuner_type = TUNER_TEMIC_PAL,
441 .tuner_addr = ADDR_UNSET,
443 .name = "Hauppauge (bt878)",
448 .gpiomask = 0x0f, /* old: 7 */
449 .muxsel = { 2, 0, 1, 1},
450 .audiomux = { 0, 1, 2, 3, 4},
454 .tuner_addr = ADDR_UNSET,
456 .name = "MIRO PCTV pro",
462 .muxsel = { 2, 3, 1, 1},
463 .audiomux = { 0x20001,0x10001, 0, 0,10},
466 .tuner_addr = ADDR_UNSET,
469 /* ---- card 0x0c ---------------------------------- */
470 .name = "ADS Technologies Channel Surfer TV (bt848)",
476 .muxsel = { 2, 3, 1, 1},
477 .audiomux = { 13, 14, 11, 7, 0, 0},
480 .tuner_addr = ADDR_UNSET,
482 .name = "AVerMedia TVCapture 98",
488 .muxsel = { 2, 3, 1, 1},
489 .audiomux = { 13, 14, 11, 7, 0, 0},
493 .tuner_type = TUNER_PHILIPS_PAL,
494 .tuner_addr = ADDR_UNSET,
495 .audio_hook = avermedia_tv_stereo_audio,
497 .name = "Aimslab Video Highway Xtreme (VHX)",
503 .muxsel = { 2, 3, 1, 1},
504 .audiomux = { 0, 2, 1, 3, 4}, /* old: { 0, 1, 2, 3, 4} */
508 .tuner_addr = ADDR_UNSET,
510 .name = "Zoltrix TV-Max",
516 .muxsel = { 2, 3, 1, 1},
517 .audiomux = {0 , 0, 1 , 0, 10},
520 .tuner_addr = ADDR_UNSET,
523 /* ---- card 0x10 ---------------------------------- */
524 .name = "Prolink Pixelview PlayTV (bt878)",
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 },
537 .name = "Leadtek WinView 601",
542 .gpiomask = 0x8300f8,
543 .muxsel = { 2, 3, 1, 1,0},
544 .audiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007},
547 .tuner_addr = ADDR_UNSET,
548 .audio_hook = winview_audio,
551 .name = "AVEC Intercapture",
557 .muxsel = {2, 3, 1, 1},
558 .audiomux = {1, 0, 0, 0, 0},
561 .tuner_addr = ADDR_UNSET,
563 .name = "Lifeview FlyVideo II EZ /FlyKit LR38 Bt848 (capture only)",
568 .gpiomask = 0x8dff00,
569 .muxsel = { 2, 3, 1, 1},
573 .tuner_addr = ADDR_UNSET,
576 /* ---- card 0x14 ---------------------------------- */
577 .name = "CEI Raffles Card",
582 .muxsel = {2, 3, 1, 1},
584 .tuner_addr = ADDR_UNSET,
586 .name = "Lifeview FlyVideo 98/ Lucky Star Image World ConferenceTV LR50",
588 .audio_inputs = 2, /* tuner, line in */
592 .muxsel = { 2, 3, 1, 1},
593 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800},
595 .tuner_type = TUNER_PHILIPS_PAL_I,
596 .tuner_addr = ADDR_UNSET,
598 .name = "Askey CPH050/ Phoebe Tv Master + FM",
604 .muxsel = { 2, 3, 1, 1},
605 .audiomux = {0, 1, 0x800, 0x400, 0xc00, 0},
609 .tuner_addr = ADDR_UNSET,
611 .name = "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV, bt878",
617 .muxsel = { 2, 3, -1 },
618 .digital_mode = DIGITAL_MODE_CAMERA,
619 .audiomux = { 0, 0, 0, 0, 0 },
622 .tuner_type = TUNER_ALPS_TSBB5_PAL_I,
623 .tuner_addr = ADDR_UNSET,
626 /* ---- card 0x18 ---------------------------------- */
627 .name = "Askey CPH05X/06X (bt878) [many vendors]",
633 .muxsel = { 2, 3, 1, 1},
634 .audiomux = {0x400, 0x400, 0x400, 0x400, 0xc00},
638 .tuner_addr = ADDR_UNSET,
641 .name = "Terratec TerraTV+ Version 1.0 (Bt848)/ Terra TValue Version 1.0/ Vobis TV-Boostar",
646 .gpiomask = 0x1f0fff,
647 .muxsel = { 2, 3, 1, 1},
648 .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000},
650 .tuner_type = TUNER_PHILIPS_PAL,
651 .tuner_addr = ADDR_UNSET,
652 .audio_hook = terratv_audio,
654 .name = "Hauppauge WinCam newer (bt878)",
660 .muxsel = { 2, 0, 1, 1},
661 .audiomux = { 0, 1, 2, 3, 4},
664 .tuner_addr = ADDR_UNSET,
666 .name = "Lifeview FlyVideo 98/ MAXI TV Video PCI2 LR50",
672 .muxsel = { 2, 3, 1, 1},
673 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800},
675 .tuner_type = TUNER_PHILIPS_SECAM,
676 .tuner_addr = ADDR_UNSET,
679 /* ---- card 0x1c ---------------------------------- */
680 .name = "Terratec TerraTV+ Version 1.1 (bt878)",
685 .gpiomask = 0x1f0fff,
686 .muxsel = { 2, 3, 1, 1},
687 .audiomux = { 0x20000, 0x30000, 0x10000, 0x00000, 0x40000},
689 .tuner_type = TUNER_PHILIPS_PAL,
690 .tuner_addr = ADDR_UNSET,
691 .audio_hook = terratv_audio,
693 External 20 pin connector (for Active Radio Upgrade board)
699 gpio05: om5610-stereo
703 gpio09+10: nIOR, nSEL ?? (bt878)
707 gpio16: u2-A0 (1st 4052bt)
710 gpio19: u4-A0 (2nd 4052)
714 00000 : Cdrom (internal audio input)
715 10000 : ext. Video audio input
724 /* Jannik Fritsch <jannik@techfak.uni-bielefeld.de> */
725 .name = "Imagenation PXC200",
729 .svhs = 1, /* was: 4 */
731 .muxsel = { 2, 3, 1, 0, 0},
735 .tuner_addr = ADDR_UNSET,
736 .muxsel_hook = PXC200_muxsel,
739 .name = "Lifeview FlyVideo 98 LR50",
744 .gpiomask = 0x1800, /* 0x8dfe00 */
745 .muxsel = { 2, 3, 1, 1},
746 .audiomux = { 0, 0x0800, 0x1000, 0x1000, 0x1800, 0 },
749 .tuner_addr = ADDR_UNSET,
751 .name = "Formac iProTV, Formac ProTV I (bt848)",
757 .muxsel = { 2, 3, 1, 1},
758 .audiomux = { 1, 0, 0, 0, 0 },
760 .tuner_type = TUNER_PHILIPS_PAL,
761 .tuner_addr = ADDR_UNSET,
764 /* ---- card 0x20 ---------------------------------- */
765 .name = "Intel Create and Share PCI/ Smart Video Recorder III",
771 .muxsel = { 2, 3, 1, 1},
775 .tuner_addr = ADDR_UNSET,
777 .name = "Terratec TerraTValue Version Bt878",
782 .gpiomask = 0xffff00,
783 .muxsel = { 2, 3, 1, 1},
784 .audiomux = { 0x500, 0, 0x300, 0x900, 0x900},
787 .tuner_type = TUNER_PHILIPS_PAL,
788 .tuner_addr = ADDR_UNSET,
790 .name = "Leadtek WinFast 2000/ WinFast 2000 XP",
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)
803 0x0000: external audio
807 Note: There exists another variant "Winfast 2000" with tv stereo !?
808 Note: eeprom only contains FF and pci subsystem id 107d:6606
813 .tuner_type = 5, /* default for now, gpio reads BFFF06 for Pal bg+dk */
814 .tuner_addr = ADDR_UNSET,
815 .audio_hook = winfast2000_audio,
818 .name = "Lifeview FlyVideo 98 LR50 / Chronos Video Shuttle II",
824 .muxsel = { 2, 3, 1, 1},
825 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800},
828 .tuner_addr = ADDR_UNSET,
831 /* ---- card 0x24 ---------------------------------- */
832 .name = "Lifeview FlyVideo 98FM LR50 / Typhoon TView TV/FM Tuner",
838 .muxsel = { 2, 3, 1, 1},
839 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 },
842 .tuner_addr = ADDR_UNSET,
845 .name = "Prolink PixelView PlayTV pro",
851 .muxsel = { 2, 3, 1, 1 },
852 .audiomux = { 0x21, 0x20, 0x24, 0x2c, 0x29, 0x29 },
856 .tuner_addr = ADDR_UNSET,
858 .name = "Askey CPH06X TView99",
863 .gpiomask = 0x551e00,
864 .muxsel = { 2, 3, 1, 0},
865 .audiomux = { 0x551400, 0x551200, 0, 0, 0x551c00, 0x551200 },
869 .tuner_addr = ADDR_UNSET,
872 .name = "Pinnacle PCTV Studio/Rave",
877 .gpiomask = 0x03000F,
878 .muxsel = { 2, 3, 1, 1},
879 .audiomux = { 2, 0xd0001, 0, 0, 1},
883 .tuner_addr = ADDR_UNSET,
886 /* ---- card 0x28 ---------------------------------- */
887 .name = "STB TV PCI FM, Gateway P/N 6000704 (bt878), 3Dfx VoodooTV 100",
893 .muxsel = { 2, 3, 1, 1},
894 .audiomux = { 4, 0, 2, 3, 1},
897 .tuner_type = TUNER_PHILIPS_NTSC,
898 .tuner_addr = ADDR_UNSET,
902 .name = "AVerMedia TVPhone 98",
908 .muxsel = { 2, 3, 1, 1},
909 .audiomux = { 13, 4, 11, 7, 0, 0},
913 .tuner_addr = ADDR_UNSET,
915 .audio_hook = avermedia_tvphone_audio,
917 .name = "ProVideo PV951", /* pic16c54 */
923 .muxsel = { 2, 3, 1, 1},
924 .audiomux = { 0, 0, 0, 0, 0},
929 .tuner_addr = ADDR_UNSET,
931 .name = "Little OnAir TV",
937 .muxsel = {2, 3, 1, 1},
938 .audiomux = {0xff9ff6, 0xff9ff6, 0xff1ff7, 0, 0xff3ffc},
941 .tuner_addr = ADDR_UNSET,
944 /* ---- card 0x2c ---------------------------------- */
945 .name = "Sigma TVII-FM",
951 .muxsel = {2, 3, 1, 1},
952 .audiomux = {1, 1, 0, 2, 3},
956 .tuner_addr = ADDR_UNSET,
958 .name = "MATRIX-Vision MV-Delta 2",
964 .muxsel = { 2, 3, 1, 0, 0},
969 .tuner_addr = ADDR_UNSET,
971 .name = "Zoltrix Genie TV/FM",
976 .gpiomask = 0xbcf03f,
977 .muxsel = { 2, 3, 1, 1},
978 .audiomux = { 0xbc803f, 0xbc903f, 0xbcb03f, 0, 0xbcb03f},
982 .tuner_addr = ADDR_UNSET,
984 .name = "Terratec TV/Radio+",
990 .muxsel = { 2, 3, 1, 1},
991 .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000, 0x20000 },
996 .tuner_addr = ADDR_UNSET,
1000 /* ---- card 0x30 ---------------------------------- */
1001 .name = "Askey CPH03x/ Dynalink Magic TView",
1007 .muxsel = { 2, 3, 1, 1},
1008 .audiomux = {2,0,0,0,1},
1012 .tuner_addr = ADDR_UNSET,
1014 .name = "IODATA GV-BCTV3/PCI",
1019 .gpiomask = 0x010f00,
1020 .muxsel = {2, 3, 0, 0},
1021 .audiomux = {0x10000, 0, 0x10000, 0, 0, 0},
1024 .tuner_type = TUNER_ALPS_TSHC6_NTSC,
1025 .tuner_addr = ADDR_UNSET,
1026 .audio_hook = gvbctv3pci_audio,
1028 .name = "Prolink PV-BT878P+4E / PixelView PlayTV PAK / Lenco MXTV-9578 CP",
1033 .gpiomask = 0xAA0000,
1034 .muxsel = { 2,3,1,1,-1 },
1035 .digital_mode = DIGITAL_MODE_CAMERA,
1036 .audiomux = { 0x20000, 0, 0x80000, 0x80000, 0xa8000, 0x46000 },
1039 .tuner_type = TUNER_PHILIPS_PAL_I,
1040 .tuner_addr = ADDR_UNSET,
1042 /* GPIO wiring: (different from Rev.4C !)
1043 GPIO17: U4.A0 (first hef4052bt)
1045 GPIO20: U5.A1 (second hef4052bt)
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
1052 .name = "Eagle Wireless Capricorn2 (bt878A)",
1058 .muxsel = { 2, 0, 1, 1},
1059 .audiomux = { 0, 1, 2, 3, 4},
1061 .tuner_type = -1 /* TUNER_ALPS_TMDH2_NTSC */,
1062 .tuner_addr = ADDR_UNSET,
1065 /* ---- card 0x34 ---------------------------------- */
1066 /* David Härdeman <david@2gen.com> */
1067 .name = "Pinnacle PCTV Studio Pro",
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)
1079 2= Mono TV sound from Tuner
1081 MUX2 (mask 0x30000):
1083 1= FM stereo Radio from Tuner */
1087 .tuner_addr = ADDR_UNSET,
1089 /* Claas Langbehn <claas@bigfoot.com>,
1090 Sven Grothklags <sven@upb.de> */
1091 .name = "Typhoon TView RDS + FM Stereo / KNC1 TV Station RDS",
1097 .muxsel = { 2, 3, 1, 1},
1098 .audiomux = { 0, 0, 0x10, 8, 4 },
1101 .tuner_type = TUNER_PHILIPS_PAL,
1102 .tuner_addr = ADDR_UNSET,
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]",
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 */
1124 .tuner_addr = ADDR_UNSET,
1126 /* Miguel Angel Alvarez <maacruz@navegalia.com>
1127 old Easy TV BT848 version (model CPH031) */
1128 .name = "Askey CPH031/ BESTBUY Easy TV",
1134 .muxsel = { 2, 3, 1, 0},
1135 .audiomux = { 2, 0, 0, 0, 10},
1138 .tuner_type = TUNER_TEMIC_PAL,
1139 .tuner_addr = ADDR_UNSET,
1142 /* ---- card 0x38 ---------------------------------- */
1143 /* Gordon Heydon <gjheydon@bigfoot.com ('98) */
1144 .name = "Lifeview FlyVideo 98FM LR50",
1150 .muxsel = { 2, 3, 1, 1},
1151 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 },
1154 .tuner_addr = ADDR_UNSET,
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)",
1171 .tuner_addr = ADDR_UNSET,
1173 /* Daniel Herrington <daniel.herrington@home.com> */
1174 .name = "Askey CPH060/ Phoebe TV Master Only (No FM)",
1180 .muxsel = { 2, 3, 1, 1},
1181 .audiomux = { 0x400, 0x400, 0x400, 0x400, 0x800, 0x400 },
1184 .tuner_type = TUNER_TEMIC_4036FY5_NTSC,
1185 .tuner_addr = ADDR_UNSET,
1187 /* Matti Mottus <mottus@physic.ut.ee> */
1188 .name = "Askey CPH03x TV Capturer",
1193 .gpiomask = 0x03000F,
1194 .muxsel = { 2, 3, 1, 0},
1195 .audiomux = { 2,0,0,0,1 },
1198 .tuner_addr = ADDR_UNSET,
1201 /* ---- card 0x3c ---------------------------------- */
1202 /* Philip Blundell <philb@gnu.org> */
1203 .name = "Modular Technology MM100PCTV",
1209 .muxsel = { 2, 3, 1, 1},
1210 .audiomux = { 2, 0, 0, 1, 8},
1212 .tuner_type = TUNER_TEMIC_PAL,
1213 .tuner_addr = ADDR_UNSET,
1215 /* Adrian Cox <adrian@humboldt.co.uk */
1216 .name = "AG Electronics GMV1",
1228 .tuner_addr = ADDR_UNSET,
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)",
1239 .muxsel = { 2, 3, 1, 0},
1240 .audiomux = { 1, 0, 4, 4, 9},
1243 .tuner_type = TUNER_PHILIPS_PAL,
1244 .tuner_addr = ADDR_UNSET,
1246 /* Lukas Gebauer <geby@volny.cz> */
1247 .name = "ATI TV-Wonder",
1253 .muxsel = { 2, 3, 1, 0 },
1254 .audiomux = { 0xbffe, 0, 0xbfff, 0, 0xbffe},
1256 .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL,
1257 .tuner_addr = ADDR_UNSET,
1260 /* ---- card 0x40 ---------------------------------- */
1261 /* Lukas Gebauer <geby@volny.cz> */
1262 .name = "ATI TV-Wonder VE",
1268 .muxsel = { 2, 3, 0, 1},
1269 .audiomux = { 0, 0, 1, 0, 0},
1272 .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL,
1273 .tuner_addr = ADDR_UNSET,
1275 /* DeeJay <deejay@westel900.net (2000S) */
1276 .name = "Lifeview FlyVideo 2000S LR90",
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,
1293 .tuner_addr = ADDR_UNSET,
1295 .name = "Terratec TValueRadio",
1300 .gpiomask = 0xffff00,
1301 .muxsel = { 2, 3, 1, 1},
1302 .audiomux = { 0x500, 0x500, 0x300, 0x900, 0x900},
1305 .tuner_type = TUNER_PHILIPS_PAL,
1306 .tuner_addr = ADDR_UNSET,
1309 /* TANAKA Kei <peg00625@nifty.com> */
1310 .name = "IODATA GV-BCTV4/PCI",
1315 .gpiomask = 0x010f00,
1316 .muxsel = {2, 3, 0, 0},
1317 .audiomux = {0x10000, 0, 0x10000, 0, 0, 0},
1320 .tuner_type = TUNER_SHARP_2U5JF5540_NTSC,
1321 .tuner_addr = ADDR_UNSET,
1322 .audio_hook = gvbctv3pci_audio,
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. */
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,
1345 /* Philip Blundell <pb@nexus.co.uk> */
1346 .name = "Active Imaging AIMMS",
1351 .tuner_addr = ADDR_UNSET,
1356 /* Tomasz Pyra <hellfire@sedez.iq.pl> */
1357 .name = "Prolink Pixelview PV-BT878P+ (Rev.4C,8E)",
1363 .muxsel = { 2, 3, 1, 1},
1364 .audiomux = { 0, 0, 11, 7, 13, 0}, /* TV and Radio with same GPIO ! */
1368 .tuner_addr = ADDR_UNSET,
1371 GPIO0: U4.A0 (hef4052bt)
1373 GPIO2: U4.A1 (second hef4052bt)
1374 GPIO3: U4.nEN, U5.A0, A5.nEN
1378 .name = "Lifeview FlyVideo 98EZ (capture only) LR51",
1383 .muxsel = { 2, 3, 1, 1}, /* AV1, AV2, SVHS, CVid adapter on SVHS */
1386 .tuner_type = UNSET,
1387 .tuner_addr = ADDR_UNSET,
1390 /* ---- card 0x48 ---------------------------------- */
1391 /* Dariusz Kowalewski <darekk@automex.pl> */
1392 .name = "Prolink Pixelview PV-BT878P+9B (PlayTV Pro rev.9B FM+NICAM)",
1398 .muxsel = { 2, 3, 1, 1 },
1399 .audiomux = { 0x01, 0x00, 0x03, 0x03, 0x09, 0x02 },
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 */
1414 GPIO20,22,23: R30,R29,R28
1417 /* Clay Kunz <ckunz@mail.arc.nasa.gov> */
1418 /* you must jumper JP5 for the card to work */
1419 .name = "Sensoray 311",
1425 .muxsel = { 2, 3, 1, 0, 0},
1429 .tuner_addr = ADDR_UNSET,
1431 /* Miguel Freitas <miguel@cetuc.puc-rio.br> */
1432 .name = "RemoteVision MX (RV605)",
1438 .gpiomask2 = 0x07ff,
1439 .muxsel = { 0x33, 0x13, 0x23, 0x43, 0xf3, 0x73, 0xe3, 0x03,
1440 0xd3, 0xb3, 0xc3, 0x63, 0x93, 0x53, 0x83, 0xa3 },
1444 .tuner_addr = ADDR_UNSET,
1445 .muxsel_hook = rv605_muxsel,
1447 .name = "Powercolor MTV878/ MTV878R/ MTV878F",
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 },
1456 .tuner_type = TUNER_PHILIPS_PAL,
1457 .tuner_addr = ADDR_UNSET,
1462 /* ---- card 0x4c ---------------------------------- */
1463 /* Masaki Suzuki <masaki@btree.org> */
1464 .name = "Canopus WinDVR PCI (COMPAQ Presario 3524JP, 5112JP)",
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,
1476 .name = "GrandTec Multi Capture Card (Bt878)",
1482 .muxsel = { 2, 3, 1, 0 },
1488 .tuner_addr = ADDR_UNSET,
1490 .name = "Jetway TV/Capture JW-TV878-FBK, Kworld KW-TV878RF",
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
1508 .tuner_addr = ADDR_UNSET,
1509 /* Samsung TCPA9095PC27A (BG+DK), philips compatible, w/FM, stereo and
1510 radio signal strength indicators work fine. */
1513 GPIO0,1: HEF4052 A0,A1
1514 GPIO2: HEF4052 nENABLE
1516 GPIO8-13: IRDC357 data0-5 (data6 n.c. ?) [chip not present on my card]
1520 ?? : mtu8b56ep microcontroller for IR (GPIO wiring unknown)*/
1522 /* Arthur Tetzlaff-Deas, DSP Design Ltd <software@dspdesign.com> */
1523 .name = "DSP Design TCVIDEO",
1526 .muxsel = { 2, 3, 1, 0},
1529 .tuner_addr = ADDR_UNSET,
1532 /* ---- card 0x50 ---------------------------------- */
1533 .name = "Hauppauge WinTV PVR",
1538 .muxsel = { 2, 0, 1, 1},
1542 .tuner_addr = ADDR_UNSET,
1547 .name = "IODATA GV-BCTV5/PCI",
1552 .gpiomask = 0x0f0f80,
1553 .muxsel = {2, 3, 1, 0},
1554 .audiomux = {0x030000, 0x010000, 0, 0, 0x020000, 0},
1557 .tuner_type = TUNER_PHILIPS_NTSC_M,
1558 .tuner_addr = ADDR_UNSET,
1559 .audio_hook = gvbctv5pci_audio,
1562 .name = "Osprey 100/150 (878)", /* 0x1(2|3)-45C6-C1 */
1563 .video_inputs = 4, /* id-inputs-clock */
1567 .muxsel = { 3, 2, 0, 1 },
1570 .tuner_addr = ADDR_UNSET,
1575 .name = "Osprey 100/150 (848)", /* 0x04-54C0-C1 & older boards */
1580 .muxsel = { 2, 3, 1 },
1583 .tuner_addr = ADDR_UNSET,
1589 /* ---- card 0x54 ---------------------------------- */
1590 .name = "Osprey 101 (848)", /* 0x05-40C0-C1 */
1598 .tuner_addr = ADDR_UNSET,
1603 .name = "Osprey 101/151", /* 0x1(4|5)-0004-C4 */
1611 .tuner_addr = ADDR_UNSET,
1616 .name = "Osprey 101/151 w/ svid", /* 0x(16|17|20)-00C4-C1 */
1624 .tuner_addr = ADDR_UNSET,
1629 .name = "Osprey 200/201/250/251", /* 0x1(8|9|E|F)-0004-C4 */
1636 .tuner_type = UNSET,
1637 .tuner_addr = ADDR_UNSET,
1643 /* ---- card 0x58 ---------------------------------- */
1644 .name = "Osprey 200/250", /* 0x1(A|B)-00C4-C1 */
1651 .tuner_type = UNSET,
1652 .tuner_addr = ADDR_UNSET,
1657 .name = "Osprey 210/220", /* 0x1(A|B)-04C0-C1 */
1664 .tuner_type = UNSET,
1665 .tuner_addr = ADDR_UNSET,
1670 .name = "Osprey 500", /* 500 */
1678 .tuner_addr = ADDR_UNSET,
1683 .name = "Osprey 540", /* 540 */
1689 .tuner_addr = ADDR_UNSET,
1695 /* ---- card 0x5C ---------------------------------- */
1696 .name = "Osprey 2000", /* 2000 */
1703 .tuner_type = UNSET,
1704 .tuner_addr = ADDR_UNSET,
1707 .no_tda7432 = 1, /* must avoid, conflicts with the bt860 */
1709 /* M G Berberich <berberic@forwiss.uni-passau.de> */
1710 .name = "IDS Eagle",
1715 .tuner_addr = ADDR_UNSET,
1718 .muxsel = { 0, 1, 2, 3 },
1719 .muxsel_hook = eagle_muxsel,
1724 .name = "Pinnacle PCTV Sat",
1730 .tuner_addr = ADDR_UNSET,
1734 .muxsel = { 3, 0, 1, 2},
1739 .name = "Formac ProTV II (bt878)",
1745 /* TV, Comp1, Composite over SVID con, SVID */
1746 .muxsel = { 2, 3, 1, 1},
1747 .audiomux = { 2, 2, 0, 0, 0 },
1750 .tuner_type = TUNER_PHILIPS_PAL,
1751 .tuner_addr = ADDR_UNSET,
1753 GPIO=0x00,0x01,0x03: mute (?)
1754 0x02: both TV and radio (tuner: FM1216/I)
1755 The card has onboard audio connectors labeled "cdrom" and "board",
1756 not soldered here, though unknown wiring.
1757 Card lacks: external audio in, pci subsystem id.
1761 /* ---- card 0x60 ---------------------------------- */
1768 .muxsel = { 2, 3, 1, 1},
1769 .audiomux = { 0, 1, 2, 3, 4},
1772 .tuner_addr = ADDR_UNSET,
1775 .name = "Euresys Picolo",
1784 .muxsel = { 2, 0, 1},
1786 .tuner_type = UNSET,
1787 .tuner_addr = ADDR_UNSET,
1789 /* Luc Van Hoeylandt <luc@e-magic.be> */
1790 .name = "ProVideo PV150", /* 0x4f */
1801 .tuner_type = UNSET,
1802 .tuner_addr = ADDR_UNSET,
1804 /* Hiroshi Takekawa <sian@big.or.jp> */
1805 /* This card lacks subsystem ID */
1806 .name = "AD-TVK503", /* 0x63 */
1811 .gpiomask = 0x001e8007,
1812 .muxsel = { 2, 3, 1, 0 },
1813 /* Tuner, Radio, external, internal, off, on */
1814 .audiomux = { 0x08, 0x0f, 0x0a, 0x08, 0x0f, 0x08 },
1819 .tuner_addr = ADDR_UNSET,
1820 .audio_hook = adtvk503_audio,
1823 /* ---- card 0x64 ---------------------------------- */
1824 .name = "Hercules Smart TV Stereo",
1830 .muxsel = { 2, 3, 1, 1 },
1835 .tuner_addr = ADDR_UNSET,
1837 - card lacks subsystem ID
1838 - stereo variant w/ daughter board with tda9874a @0xb0
1840 always from tda9874 independent of GPIO (?)
1841 external line in: unknown
1842 - Other chips: em78p156elp @ 0x96 (probably IR remote control)
1843 hef4053 (instead 4052) for unknown function
1846 .name = "Pace TV & Radio Card",
1851 .muxsel = { 2, 3, 1, 1}, /* Tuner, CVid, SVid, CVid over SVid connector */
1856 .tuner_addr = ADDR_UNSET,
1859 /* Bt878, Bt832, FI1246 tuner; no pci subsystem id
1860 only internal line out: (4pin header) RGGL
1861 Radio must be decoded by msp3410d (not routed through)*/
1863 .digital_mode = DIGITAL_MODE_CAMERA, todo!
1866 /* Chris Willing <chris@vislab.usyd.edu.au> */
1872 .tuner_addr = ADDR_UNSET,
1878 .name = "Grand X-Guard / Trust 814PCI",
1884 .tuner_addr = ADDR_UNSET,
1886 .muxsel = { 2,2,2,2, 3,3,3,3, 1,1,1,1, 0,0,0,0 },
1887 .muxsel_hook = xguard_muxsel,
1894 /* ---- card 0x68 ---------------------------------- */
1895 .name = "Nebula Electronics DigiTV",
1899 .muxsel = { 2, 3, 1, 0},
1905 .tuner_addr = ADDR_UNSET,
1909 /* Jorge Boncompte - DTI2 <jorge@dti2.net> */
1910 .name = "ProVideo PV143",
1916 .muxsel = { 2, 3, 1, 0 },
1922 .tuner_addr = ADDR_UNSET,
1924 /* M.Klahr@phytec.de */
1925 .name = "PHYTEC VD-009-X1 MiniDIN (bt878)",
1928 .tuner = -1, /* card has no tuner */
1931 .muxsel = { 2, 3, 1, 0},
1932 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1936 .tuner_addr = ADDR_UNSET,
1938 .name = "PHYTEC VD-009-X1 Combi (bt878)",
1941 .tuner = -1, /* card has no tuner */
1944 .muxsel = { 2, 3, 1, 1},
1945 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1949 .tuner_addr = ADDR_UNSET,
1952 /* ---- card 0x6c ---------------------------------- */
1953 .name = "PHYTEC VD-009 MiniDIN (bt878)",
1956 .tuner = -1, /* card has no tuner */
1959 .gpiomask2 = 0x03, /* gpiomask2 defines the bits used to switch audio
1960 via the upper nibble of muxsel. here: used for
1961 xternal video-mux */
1962 .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x00 },
1963 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1967 .tuner_addr = ADDR_UNSET,
1969 .name = "PHYTEC VD-009 Combi (bt878)",
1972 .tuner = -1, /* card has no tuner */
1975 .gpiomask2 = 0x03, /* gpiomask2 defines the bits used to switch audio
1976 via the upper nibble of muxsel. here: used for
1977 xternal video-mux */
1978 .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x01 },
1979 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1983 .tuner_addr = ADDR_UNSET,
1990 .tuner_addr = ADDR_UNSET,
1993 .muxsel = { 2, 3, 1, 0 },
1996 /* IVC-120G - Alan Garfield <alan@fromorbit.com> */
1999 .audio_inputs = 0, /* card has no audio */
2000 .tuner = -1, /* card has no tuner */
2002 .tuner_addr = ADDR_UNSET,
2003 .svhs = -1, /* card has no svhs */
2009 .muxsel = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
2010 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10 },
2011 .muxsel_hook = ivc120_muxsel,
2015 /* ---- card 0x70 ---------------------------------- */
2016 .name = "pcHDTV HD-2000 TV",
2021 .muxsel = { 2, 3, 1, 0},
2022 .tuner_type = TUNER_PHILIPS_ATSC,
2023 .tuner_addr = ADDR_UNSET,
2026 .name = "Twinhan DST + clones",
2030 .tuner_type = TUNER_ABSENT,
2031 .tuner_addr = ADDR_UNSET,
2035 .name = "Winfast VC100",
2040 .muxsel = { 3, 1, 1, 3}, /* Vid In, SVid In, Vid over SVid in connector */
2044 .tuner_type = TUNER_ABSENT,
2045 .tuner_addr = ADDR_UNSET,
2048 .name = "Teppro TEV-560/InterVision IV-560",
2054 .muxsel = { 2, 3, 1, 1},
2055 .audiomux = { 1, 1, 1, 1, 0},
2057 .tuner_type = TUNER_PHILIPS_PAL,
2058 .tuner_addr = ADDR_UNSET,
2062 /* ---- card 0x74 ---------------------------------- */
2063 .name = "SIMUS GVC1100",
2069 .tuner_addr = ADDR_UNSET,
2071 .muxsel = { 2, 2, 2, 2},
2073 .muxsel_hook = gvc1100_muxsel,
2075 /* Carlos Silva r3pek@r3pek.homelinux.org || card 0x75 */
2076 .name = "NGS NGSTV+",
2080 .gpiomask = 0x008007,
2081 .muxsel = {2, 3, 0, 0},
2082 .audiomux = {0, 0, 0, 0, 0x000003, 0},
2084 .tuner_type = TUNER_PHILIPS_PAL,
2085 .tuner_addr = ADDR_UNSET,
2088 /* http://linuxmedialabs.com */
2090 .video_inputs = 4, /* IN1,IN2,IN3,IN4 */
2094 .muxsel = { 2, 3, 1, 0 },
2100 .tuner_addr = ADDR_UNSET,
2102 /* Helmroos Harri <harri.helmroos@pp.inet.fi> */
2103 .name = "Tekram M205 PRO",
2107 .tuner_type = TUNER_PHILIPS_PAL,
2108 .tuner_addr = ADDR_UNSET,
2112 .muxsel = { 2, 3, 1},
2113 .audiomux = { 0x68, 0x68, 0x61, 0x61, 0x00 },
2117 /* ---- card 0x78 ---------------------------------- */
2118 /* Javier Cendan Ares <jcendan@lycos.es> */
2119 /* bt878 TV + FM without subsystem ID */
2120 .name = "Conceptronic CONTVFMi",
2125 .gpiomask = 0x008007,
2126 .muxsel = { 2, 3, 1, 1 },
2127 .audiomux = { 0, 1, 2, 2, 3 },
2130 .tuner_type = TUNER_PHILIPS_PAL,
2131 .tuner_addr = ADDR_UNSET,
2135 /*Eric DEBIEF <debief@telemsa.com>*/
2136 /*EURESYS Picolo Tetra : 4 Conexant Fusion 878A, no audio, video input set with analog multiplexers GPIO controled*/
2137 /* adds picolo_tetra_muxsel(), picolo_tetra_init(), the folowing declaration strucure, and #define BTTV_PICOLO_TETRA_CHIP*/
2139 .name = "Euresys Picolo Tetra",
2145 .gpiomask2 = 0x3C<<16,/*Set the GPIO[18]->GPIO[21] as output pin.==> drive the video inputs through analog multiplexers*/
2149 .muxsel = {2,2,2,2},/*878A input is always MUX0, see above.*/
2150 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
2153 .muxsel_hook = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/
2155 .tuner_addr = ADDR_UNSET,
2157 /* Spirit TV Tuner from http://spiritmodems.com.au */
2158 /* Stafford Goodsell <surge@goliath.homeunix.org> */
2159 .name = "Spirit TV Tuner",
2164 .gpiomask = 0x0000000f,
2165 .muxsel = { 2, 1, 1 },
2166 .audiomux = { 0x02, 0x00, 0x00, 0x00, 0x00},
2167 .tuner_type = TUNER_TEMIC_PAL,
2168 .tuner_addr = ADDR_UNSET,
2172 /* Wolfram Joost <wojo@frokaschwei.de> */
2173 .name = "AVerMedia AVerTV DVB-T 771",
2177 .tuner_type = TUNER_ABSENT,
2178 .tuner_addr = ADDR_UNSET,
2179 .muxsel = { 3 , 3 },
2188 /* ---- card 0x7c ---------------------------------- */
2189 /* Matt Jesson <dvb@jesson.eclipse.co.uk> */
2190 /* Based on the Nebula card data - added remote and new card number - BTTV_AVDVBT_761, see also ir-kbd-gpio.c */
2191 .name = "AverMedia AverTV DVB-T 761",
2195 .muxsel = { 3, 1, 2, 0}, /* Comp0, S-Video, ?, ? */
2201 .tuner_addr = ADDR_UNSET,
2206 /* andre.schwarz@matrix-vision.de */
2207 .name = "MATRIX Vision Sigma-SQ",
2213 .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2,
2214 3, 3, 3, 3, 3, 3, 3, 3 },
2215 .muxsel_hook = sigmaSQ_muxsel,
2220 .tuner_addr = ADDR_UNSET,
2222 /* andre.schwarz@matrix-vision.de */
2223 .name = "MATRIX Vision Sigma-SLC",
2229 .muxsel = { 2, 2, 2, 2 },
2230 .muxsel_hook = sigmaSLC_muxsel,
2235 .tuner_addr = ADDR_UNSET,
2237 /* BTTV_APAC_VIEWCOMP */
2238 /* Attila Kondoros <attila.kondoros@chello.hu> */
2239 /* bt878 TV + FM 0x00000000 subsystem ID */
2240 .name = "APAC Viewcomp 878(AMAX)",
2246 .muxsel = { 2, 3, 1, 1},
2247 .audiomux = { 2, 0, 0, 0, 10},
2250 .tuner_type = TUNER_PHILIPS_PAL,
2251 .tuner_addr = ADDR_UNSET,
2252 .has_remote = 1, /* miniremote works, see ir-kbd-gpio.c */
2253 .has_radio = 1, /* not every card has radio */
2256 /* ---- card 0x80 ---------------------------------- */
2257 /* Chris Pascoe <c.pascoe@itee.uq.edu.au> */
2258 .name = "DViCO FusionHDTV DVB-T Lite",
2267 .tuner_addr = ADDR_UNSET,
2269 /* Steven <photon38@pchome.com.tw> */
2270 .name = "V-Gear MyVCD",
2276 .muxsel = {2, 3, 1, 0},
2277 .audiomux = {0x31, 0x31, 0x31, 0x31, 0x31, 0x31},
2280 .tuner_type = TUNER_PHILIPS_NTSC_M,
2281 .tuner_addr = ADDR_UNSET,
2284 /* Rick C <cryptdragoon@gmail.com> */
2285 .name = "Super TV Tuner",
2290 .muxsel = { 2, 3, 1, 0},
2291 .tuner_type = TUNER_PHILIPS_NTSC,
2292 .tuner_addr = ADDR_UNSET,
2293 .gpiomask = 0x008007,
2294 .audiomux = { 0, 0x000001,0,0, 0},
2298 /* Chris Fanning <video4linux@haydon.net> */
2299 .name = "Tibet Systems 'Progress DVR' CS16",
2304 .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 },
2310 .tuner_addr = ADDR_UNSET,
2311 .muxsel_hook = tibetCS16_muxsel,
2314 /* Bill Brack <wbrack@mmm.com.hk> */
2316 * Note that, because of the card's wiring, the "master"
2317 * BT878A chip (i.e. the one which controls the analog switch
2318 * and must use this card type) is the 2nd one detected. The
2319 * other 3 chips should use card type 0x85, whose description
2320 * follows this one. There is a EEPROM on the card (which is
2321 * connected to the I2C of one of those other chips), but is
2322 * not currently handled. There is also a facility for a
2323 * "monitor", which is also not currently implemented.
2325 .name = "Kodicom 4400R (master)",
2330 .tuner_addr = ADDR_UNSET,
2332 /* GPIO bits 0-9 used for analog switch:
2333 * 00 - 03: camera selector
2334 * 04 - 06: channel (controller) selector
2335 * 07: data (1->on, 0->off)
2338 * bit 16 is input from sync separator for the channel
2340 .gpiomask = 0x0003ff,
2342 .muxsel = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
2347 .muxsel_hook = kodicom4400r_muxsel,
2350 /* Bill Brack <wbrack@mmm.com.hk> */
2351 /* Note that, for reasons unknown, the "master" BT878A chip (i.e. the
2352 * one which controls the analog switch, and must use the card type)
2353 * is the 2nd one detected. The other 3 chips should use this card
2356 .name = "Kodicom 4400R (slave)",
2361 .tuner_addr = ADDR_UNSET,
2363 .gpiomask = 0x010000,
2365 .muxsel = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
2370 .muxsel_hook = kodicom4400r_muxsel,
2373 /* ---- card 0x86---------------------------------- */
2374 /* Michael Henson <mhenson@clarityvi.com> */
2375 /* Adlink RTV24 with special unlock codes */
2376 .name = "Adlink RTV24",
2381 .muxsel = { 2, 3, 1, 0},
2383 .tuner_addr = ADDR_UNSET,
2387 /* ---- card 0x87---------------------------------- */
2388 /* Michael Krufky <mkrufky@m1k.net> */
2389 .name = "DViCO FusionHDTV 5 Lite",
2391 .tuner_type = TUNER_LG_TDVS_H062F,
2392 .tuner_addr = ADDR_UNSET,
2396 .muxsel = { 2, 3, 1 },
2397 .gpiomask = 0x00e00007,
2398 .audiomux = { 0x00400005, 0, 0x00000001, 0, 0x00c00007, 0 },
2404 /* ---- card 0x88---------------------------------- */
2405 /* Mauro Carvalho Chehab <mchehab@brturbo.com.br> */
2406 .name = "Acorp Y878F",
2411 .gpiomask = 0x01fe00,
2412 .muxsel = { 2, 3, 1, 1},
2413 .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 },
2416 .tuner_type = TUNER_YMEC_TVF66T5_B_DFF,
2417 .tuner_addr = 0xc1 >>1,
2420 /* ---- card 0x89 ---------------------------------- */
2421 .name = "Conceptronic CTVFMi v2",
2426 .gpiomask = 0x001c0007,
2427 .muxsel = { 2, 3, 1, 1 },
2428 .audiomux = { 0, 1, 2, 2, 3 },
2431 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
2432 .tuner_addr = ADDR_UNSET,
2435 .name = "Prolink Pixelview PV-BT878P+ (Rev.2E)",
2440 .gpiomask = 0x01fe00,
2441 .muxsel = { 2,3,1,1,-1 },
2442 .digital_mode = DIGITAL_MODE_CAMERA,
2443 .audiomux = { 0x00400, 0x10400, 0x04400, 0x80000, 0x12400, 0x46000 },
2446 .tuner_type = TUNER_LG_PAL_FM,
2450 static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards);
2452 /* ----------------------------------------------------------------------- */
2454 static unsigned char eeprom_data[256];
2459 void __devinit bttv_idcard(struct bttv *btv)
2461 unsigned int gpiobits;
2465 /* read PCI subsystem ID */
2466 pci_read_config_word(btv->c.pci, PCI_SUBSYSTEM_ID, &tmp);
2467 btv->cardid = tmp << 16;
2468 pci_read_config_word(btv->c.pci, PCI_SUBSYSTEM_VENDOR_ID, &tmp);
2471 if (0 != btv->cardid && 0xffffffff != btv->cardid) {
2472 /* look for the card */
2473 for (type = -1, i = 0; cards[i].id != 0; i++)
2474 if (cards[i].id == btv->cardid)
2479 printk(KERN_INFO "bttv%d: detected: %s [card=%d], "
2480 "PCI subsystem ID is %04x:%04x\n",
2481 btv->c.nr,cards[type].name,cards[type].cardnr,
2482 btv->cardid & 0xffff,
2483 (btv->cardid >> 16) & 0xffff);
2484 btv->c.type = cards[type].cardnr;
2487 printk(KERN_INFO "bttv%d: subsystem: %04x:%04x (UNKNOWN)\n",
2488 btv->c.nr, btv->cardid & 0xffff,
2489 (btv->cardid >> 16) & 0xffff);
2490 printk(KERN_DEBUG "please mail id, board name and "
2491 "the correct card= insmod option to kraxel@bytesex.org\n");
2495 /* let the user override the autodetected type */
2496 if (card[btv->c.nr] < bttv_num_tvcards)
2497 btv->c.type=card[btv->c.nr];
2499 /* print which card config we are using */
2500 printk(KERN_INFO "bttv%d: using: %s [card=%d,%s]\n",btv->c.nr,
2501 bttv_tvcards[btv->c.type].name, btv->c.type,
2502 card[btv->c.nr] < bttv_num_tvcards
2503 ? "insmod option" : "autodetected");
2505 /* overwrite gpio stuff ?? */
2506 if (UNSET == audioall && UNSET == audiomux[0])
2509 if (UNSET != audiomux[0]) {
2511 for (i = 0; i < 5; i++) {
2512 bttv_tvcards[btv->c.type].audiomux[i] = audiomux[i];
2513 gpiobits |= audiomux[i];
2516 gpiobits = audioall;
2517 for (i = 0; i < 5; i++) {
2518 bttv_tvcards[btv->c.type].audiomux[i] = audioall;
2521 bttv_tvcards[btv->c.type].gpiomask = (UNSET != gpiomask) ? gpiomask : gpiobits;
2522 printk(KERN_INFO "bttv%d: gpio config override: mask=0x%x, mux=",
2523 btv->c.nr,bttv_tvcards[btv->c.type].gpiomask);
2524 for (i = 0; i < 5; i++) {
2525 printk("%s0x%x", i ? "," : "", bttv_tvcards[btv->c.type].audiomux[i]);
2531 * (most) board specific initialisations goes here
2534 /* Some Modular Technology cards have an eeprom, but no subsystem ID */
2535 void identify_by_eeprom(struct bttv *btv, unsigned char eeprom_data[256])
2539 if (0 == strncmp(eeprom_data,"GET MM20xPCTV",13))
2540 type = BTTV_MODTEC_205;
2541 else if (0 == strncmp(eeprom_data+20,"Picolo",7))
2542 type = BTTV_EURESYS_PICOLO;
2543 else if (eeprom_data[0] == 0x84 && eeprom_data[2]== 0)
2544 type = BTTV_HAUPPAUGE; /* old bt848 */
2548 printk("bttv%d: detected by eeprom: %s [card=%d]\n",
2549 btv->c.nr, bttv_tvcards[btv->c.type].name, btv->c.type);
2553 static void flyvideo_gpio(struct bttv *btv)
2555 int gpio,has_remote,has_radio,is_capture_only,is_lr90,has_tda9820_tda9821;
2558 gpio_inout(0xffffff, 0);
2559 udelay(8); /* without this we would see the 0x1800 mask */
2561 /* FIXME: must restore OUR_EN ??? */
2563 /* all cards provide GPIO info, some have an additional eeprom
2564 * LR50: GPIO coding can be found lower right CP1 .. CP9
2565 * CP9=GPIO23 .. CP1=GPIO15; when OPEN, the corresponding GPIO reads 1.
2567 * LR90: GP9=GPIO23 .. GP1=GPIO15 (right above the bt878)
2569 * lowest 3 bytes are remote control codes (no handshake needed)
2570 * xxxFFF: No remote control chip soldered
2571 * xxxF00(LR26/LR50), xxxFE0(LR90): Remote control chip (LVA001 or CF45) soldered
2572 * Note: Some bits are Audio_Mask !
2574 ttype=(gpio&0x0f0000)>>16;
2576 case 0x0: tuner=2; /* NTSC, e.g. TPI8NSR11P */
2578 case 0x2: tuner=39;/* LG NTSC (newer TAPC series) TAPC-H701P */
2580 case 0x4: tuner=5; /* Philips PAL TPI8PSB02P, TPI8PSB12P, TPI8PSB12D or FI1216, FM1216 */
2582 case 0x6: tuner=37;/* LG PAL (newer TAPC series) TAPC-G702P */
2584 case 0xC: tuner=3; /* Philips SECAM(+PAL) FQ1216ME or FI1216MF */
2587 printk(KERN_INFO "bttv%d: FlyVideo_gpio: unknown tuner type.\n", btv->c.nr);
2590 has_remote = gpio & 0x800000;
2591 has_radio = gpio & 0x400000;
2592 /* unknown 0x200000;
2593 * unknown2 0x100000; */
2594 is_capture_only = !(gpio & 0x008000); /* GPIO15 */
2595 has_tda9820_tda9821 = !(gpio & 0x004000);
2596 is_lr90 = !(gpio & 0x002000); /* else LR26/LR50 (LR38/LR51 f. capture only) */
2598 * gpio & 0x001000 output bit for audio routing */
2601 tuner=4; /* No tuner present */
2603 printk(KERN_INFO "bttv%d: FlyVideo Radio=%s RemoteControl=%s Tuner=%d gpio=0x%06x\n",
2604 btv->c.nr, has_radio? "yes":"no ", has_remote? "yes":"no ", tuner, gpio);
2605 printk(KERN_INFO "bttv%d: FlyVideo LR90=%s tda9821/tda9820=%s capture_only=%s\n",
2606 btv->c.nr, is_lr90?"yes":"no ", has_tda9820_tda9821?"yes":"no ",
2607 is_capture_only?"yes":"no ");
2609 if(tuner!= -1) /* only set if known tuner autodetected, else let insmod option through */
2610 btv->tuner_type = tuner;
2611 btv->has_radio = has_radio;
2613 /* LR90 Audio Routing is done by 2 hef4052, so Audio_Mask has 4 bits: 0x001c80
2614 * LR26/LR50 only has 1 hef4052, Audio_Mask 0x000c00
2615 * Audio options: from tuner, from tda9821/tda9821(mono,stereo,sap), from tda9874, ext., mute */
2616 if(has_tda9820_tda9821) btv->audio_hook = lt9415_audio;
2617 /* todo: if(has_tda9874) btv->audio_hook = fv2000s_audio; */
2620 static int miro_tunermap[] = { 0,6,2,3, 4,5,6,0, 3,0,4,5, 5,2,16,1,
2621 14,2,17,1, 4,1,4,3, 1,2,16,1, 4,4,4,4 };
2622 static int miro_fmtuner[] = { 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1,
2623 1,1,1,1, 1,1,1,0, 0,0,0,0, 0,1,0,0 };
2625 static void miro_pinnacle_gpio(struct bttv *btv)
2630 gpio_inout(0xffffff, 0);
2632 id = ((gpio>>10) & 63) -1;
2633 msp = bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx");
2635 btv->tuner_type = miro_tunermap[id];
2636 if (0 == (gpio & 0x20)) {
2638 if (!miro_fmtuner[id]) {
2639 btv->has_matchbox = 1;
2640 btv->mbox_we = (1<<6);
2641 btv->mbox_most = (1<<7);
2642 btv->mbox_clk = (1<<8);
2643 btv->mbox_data = (1<<9);
2644 btv->mbox_mask = (1<<6)|(1<<7)|(1<<8)|(1<<9);
2650 if (btv->c.type == BTTV_MIRO)
2651 btv->c.type = BTTV_MIROPRO;
2652 if (btv->c.type == BTTV_PINNACLE)
2653 btv->c.type = BTTV_PINNACLEPRO;
2656 "bttv%d: miro: id=%d tuner=%d radio=%s stereo=%s\n",
2657 btv->c.nr, id+1, btv->tuner_type,
2658 !btv->has_radio ? "no" :
2659 (btv->has_matchbox ? "matchbox" : "fmtuner"),
2660 (-1 == msp) ? "no" : "yes");
2662 /* new cards with microtune tuner */
2667 info = "PAL / mono";
2670 info = "PAL+SECAM / stereo";
2674 info = "NTSC / stereo";
2678 info = "PAL+SECAM / mono";
2681 info = "NTSC / mono";
2684 info = "NTSC / stereo";
2687 info = "PAL / stereo";
2690 info = "oops: unknown card";
2694 btv->c.type = BTTV_PINNACLEPRO;
2696 "bttv%d: pinnacle/mt: id=%d info=\"%s\" radio=%s\n",
2697 btv->c.nr, id, info, btv->has_radio ? "yes" : "no");
2698 btv->tuner_type = 33;
2699 btv->pinnacle_id = id;
2703 /* GPIO21 L: Buffer aktiv, H: Buffer inaktiv */
2704 #define LM1882_SYNC_DRIVE 0x200000L
2706 static void init_ids_eagle(struct bttv *btv)
2708 gpio_inout(0xffffff,0xFFFF37);
2709 gpio_write(0x200020);
2711 /* flash strobe inverter ?! */
2712 gpio_write(0x200024);
2714 /* switch sync drive off */
2715 gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE);
2717 /* set BT848 muxel to 2 */
2718 btaor((2)<<5, ~(2<<5), BT848_IFORM);
2721 /* Muxsel helper for the IDS Eagle.
2722 * the eagles does not use the standard muxsel-bits but
2723 * has its own multiplexer */
2724 static void eagle_muxsel(struct bttv *btv, unsigned int input)
2726 btaor((2)<<5, ~(3<<5), BT848_IFORM);
2727 gpio_bits(3,bttv_tvcards[btv->c.type].muxsel[input&7]);
2730 /* set chroma ADC to sleep */
2731 btor(BT848_ADC_C_SLEEP, BT848_ADC);
2732 /* set to composite video */
2733 btand(~BT848_CONTROL_COMP, BT848_E_CONTROL);
2734 btand(~BT848_CONTROL_COMP, BT848_O_CONTROL);
2736 /* switch sync drive off */
2737 gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE);
2740 static void gvc1100_muxsel(struct bttv *btv, unsigned int input)
2742 static const int masks[] = {0x30, 0x01, 0x12, 0x23};
2743 gpio_write(masks[input%4]);
2746 /* LMLBT4x initialization - to allow access to GPIO bits for sensors input and
2749 GPIObit | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
2750 assignment | TI | O3|INx| O2| O1|IN4|IN3|IN2|IN1| | |
2752 IN - sensor inputs, INx - sensor inputs and TI XORed together
2753 O1,O2,O3 - alarm outputs (relays)
2755 OUT ENABLE 1 1 0 . 1 1 0 0 . 0 0 0 0 = 0x6C0
2759 static void init_lmlbt4x(struct bttv *btv)
2761 printk(KERN_DEBUG "LMLBT4x init\n");
2762 btwrite(0x000000, BT848_GPIO_REG_INP);
2763 gpio_inout(0xffffff, 0x0006C0);
2764 gpio_write(0x000000);
2767 static void sigmaSQ_muxsel(struct bttv *btv, unsigned int input)
2769 unsigned int inmux = input % 8;
2770 gpio_inout( 0xf, 0xf );
2771 gpio_bits( 0xf, inmux );
2774 static void sigmaSLC_muxsel(struct bttv *btv, unsigned int input)
2776 unsigned int inmux = input % 4;
2777 gpio_inout( 3<<9, 3<<9 );
2778 gpio_bits( 3<<9, inmux<<9 );
2781 /* ----------------------------------------------------------------------- */
2783 static void bttv_reset_audio(struct bttv *btv)
2786 * BT878A has a audio-reset register.
2787 * 1. This register is an audio reset function but it is in
2788 * function-0 (video capture) address space.
2789 * 2. It is enough to do this once per power-up of the card.
2790 * 3. There is a typo in the Conexant doc -- it is not at
2791 * 0x5B, but at 0x058. (B is an odd-number, obviously a typo!).
2792 * --//Shrikumar 030609
2798 printk("bttv%d: BT878A ARESET\n",btv->c.nr);
2799 btwrite((1<<7), 0x058);
2804 /* initialization part one -- before registering i2c bus */
2805 void __devinit bttv_init_card1(struct bttv *btv)
2807 switch (btv->c.type) {
2808 case BTTV_HAUPPAUGE:
2809 case BTTV_HAUPPAUGE878:
2810 boot_msp34xx(btv,5);
2812 case BTTV_VOODOOTV_FM:
2813 boot_msp34xx(btv,20);
2815 case BTTV_AVERMEDIA98:
2816 boot_msp34xx(btv,11);
2818 case BTTV_HAUPPAUGEPVR:
2821 case BTTV_TWINHAN_DST:
2822 case BTTV_AVDVBT_771:
2823 case BTTV_PINNACLESAT:
2824 btv->use_i2c_hw = 1;
2826 case BTTV_ADLINK_RTV24:
2831 if (!bttv_tvcards[btv->c.type].has_dvb)
2832 bttv_reset_audio(btv);
2835 /* initialization part two -- after registering i2c bus */
2836 void __devinit bttv_init_card2(struct bttv *btv)
2839 int addr=ADDR_UNSET;
2841 btv->tuner_type = -1;
2843 if (BTTV_UNKNOWN == btv->c.type) {
2844 bttv_readee(btv,eeprom_data,0xa0);
2845 identify_by_eeprom(btv,eeprom_data);
2848 switch (btv->c.type) {
2852 case BTTV_PINNACLEPRO:
2854 miro_pinnacle_gpio(btv);
2856 case BTTV_FLYVIDEO_98:
2858 case BTTV_LIFE_FLYKIT:
2860 case BTTV_TYPHOON_TVIEW:
2861 case BTTV_CHRONOS_VS2:
2862 case BTTV_FLYVIDEO_98FM:
2863 case BTTV_FLYVIDEO2000:
2864 case BTTV_FLYVIDEO98EZ:
2865 case BTTV_CONFERENCETV:
2866 case BTTV_LIFETEC_9415:
2869 case BTTV_HAUPPAUGE:
2870 case BTTV_HAUPPAUGE878:
2871 case BTTV_HAUPPAUGEPVR:
2872 /* pick up some config infos from the eeprom */
2873 bttv_readee(btv,eeprom_data,0xa0);
2874 hauppauge_eeprom(btv);
2876 case BTTV_AVERMEDIA98:
2877 case BTTV_AVPHONE98:
2878 bttv_readee(btv,eeprom_data,0xa0);
2879 avermedia_eeprom(btv);
2884 case BTTV_PICOLO_TETRA_CHIP:
2885 picolo_tetra_init(btv);
2889 btv->has_matchbox = 1;
2890 btv->mbox_we = 0x20;
2892 btv->mbox_clk = 0x08;
2893 btv->mbox_data = 0x10;
2894 btv->mbox_mask = 0x38;
2896 case BTTV_VOBIS_BOOSTAR:
2898 terratec_active_radio_upgrade(btv);
2900 case BTTV_MAGICTVIEW061:
2901 if (btv->cardid == 0x3002144f) {
2903 printk("bttv%d: radio detected by subsystem id (CPH05x)\n",btv->c.nr);
2907 if (btv->cardid == 0x3060121a) {
2908 /* Fix up entry for 3DFX VoodooTV 100,
2909 which is an OEM STB card variant. */
2911 btv->tuner_type=TUNER_TEMIC_NTSC;
2914 case BTTV_OSPREY1x0:
2915 case BTTV_OSPREY1x0_848:
2916 case BTTV_OSPREY101_848:
2917 case BTTV_OSPREY1x1:
2918 case BTTV_OSPREY1x1_SVID:
2919 case BTTV_OSPREY2xx:
2920 case BTTV_OSPREY2x0_SVID:
2921 case BTTV_OSPREY2x0:
2922 case BTTV_OSPREY500:
2923 case BTTV_OSPREY540:
2924 case BTTV_OSPREY2000:
2925 bttv_readee(btv,eeprom_data,0xa0);
2928 case BTTV_IDS_EAGLE:
2929 init_ids_eagle(btv);
2931 case BTTV_MODTEC_205:
2932 bttv_readee(btv,eeprom_data,0xa0);
2938 case BTTV_TIBET_CS16:
2939 tibetCS16_init(btv);
2941 case BTTV_KODICOM_4400R:
2942 kodicom4400r_init(btv);
2946 /* pll configuration */
2947 if (!(btv->id==848 && btv->revision==0x11)) {
2948 /* defaults from card list */
2949 if (PLL_28 == bttv_tvcards[btv->c.type].pll) {
2950 btv->pll.pll_ifreq=28636363;
2951 btv->pll.pll_crystal=BT848_IFORM_XT0;
2953 if (PLL_35 == bttv_tvcards[btv->c.type].pll) {
2954 btv->pll.pll_ifreq=35468950;
2955 btv->pll.pll_crystal=BT848_IFORM_XT1;
2957 /* insmod options can override */
2958 switch (pll[btv->c.nr]) {
2960 btv->pll.pll_crystal = 0;
2961 btv->pll.pll_ifreq = 0;
2962 btv->pll.pll_ofreq = 0;
2964 case 1: /* 28 MHz */
2966 btv->pll.pll_ifreq = 28636363;
2967 btv->pll.pll_ofreq = 0;
2968 btv->pll.pll_crystal = BT848_IFORM_XT0;
2970 case 2: /* 35 MHz */
2972 btv->pll.pll_ifreq = 35468950;
2973 btv->pll.pll_ofreq = 0;
2974 btv->pll.pll_crystal = BT848_IFORM_XT1;
2978 btv->pll.pll_current = -1;
2980 /* tuner configuration (from card list / autodetect / insmod option) */
2981 if (ADDR_UNSET != bttv_tvcards[btv->c.type].tuner_addr)
2982 addr = bttv_tvcards[btv->c.type].tuner_addr;
2984 if (UNSET != bttv_tvcards[btv->c.type].tuner_type)
2985 if(UNSET == btv->tuner_type)
2986 btv->tuner_type = bttv_tvcards[btv->c.type].tuner_type;
2987 if (UNSET != tuner[btv->c.nr])
2988 btv->tuner_type = tuner[btv->c.nr];
2989 printk("bttv%d: using tuner=%d\n",btv->c.nr,btv->tuner_type);
2990 if (btv->pinnacle_id != UNSET)
2991 bttv_call_i2c_clients(btv, AUDC_CONFIG_PINNACLE,
2993 if (btv->tuner_type != UNSET) {
2994 struct tuner_setup tun_setup;
2996 tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
2997 tun_setup.type = btv->tuner_type;
2998 tun_setup.addr = addr;
3000 bttv_call_i2c_clients(btv, TUNER_SET_TYPE_ADDR, &tun_setup);
3003 btv->svhs = bttv_tvcards[btv->c.type].svhs;
3004 if (svhs[btv->c.nr] != UNSET)
3005 btv->svhs = svhs[btv->c.nr];
3006 if (remote[btv->c.nr] != UNSET)
3007 btv->has_remote = remote[btv->c.nr];
3009 if (bttv_tvcards[btv->c.type].has_radio)
3011 if (bttv_tvcards[btv->c.type].has_remote)
3013 if (!bttv_tvcards[btv->c.type].no_gpioirq)
3015 if (bttv_tvcards[btv->c.type].audio_hook)
3016 btv->audio_hook=bttv_tvcards[btv->c.type].audio_hook;
3018 if (bttv_tvcards[btv->c.type].digital_mode == DIGITAL_MODE_CAMERA) {
3019 /* detect Bt832 chip for quartzsight digital camera */
3020 if ((bttv_I2CRead(btv, I2C_BT832_ALT1, "Bt832") >=0) ||
3021 (bttv_I2CRead(btv, I2C_BT832_ALT2, "Bt832") >=0))
3028 /* try to detect audio/fader chips */
3029 if (!bttv_tvcards[btv->c.type].no_msp34xx &&
3030 bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx") >=0)
3031 request_module("msp3400");
3033 if (bttv_tvcards[btv->c.type].msp34xx_alt &&
3034 bttv_I2CRead(btv, I2C_MSP3400_ALT, "MSP34xx (alternate address)") >=0)
3035 request_module("msp3400");
3037 if (!bttv_tvcards[btv->c.type].no_tda9875 &&
3038 bttv_I2CRead(btv, I2C_TDA9875, "TDA9875") >=0)
3039 request_module("tda9875");
3041 if (!bttv_tvcards[btv->c.type].no_tda7432 &&
3042 bttv_I2CRead(btv, I2C_TDA7432, "TDA7432") >=0)
3043 request_module("tda7432");
3045 if (bttv_tvcards[btv->c.type].needs_tvaudio)
3046 request_module("tvaudio");
3050 if (btv->pinnacle_id != UNSET)
3052 if (0 == tda9887 && 0 == bttv_tvcards[btv->c.type].has_dvb &&
3053 bttv_I2CRead(btv, I2C_TDA9887, "TDA9887") >=0)
3055 if((btv->tuner_type == TUNER_PHILIPS_FM1216ME_MK3) ||
3056 (btv->tuner_type == TUNER_PHILIPS_FM1236_MK3) ||
3057 (btv->tuner_type == TUNER_PHILIPS_FM1256_IH3) ||
3059 request_module("tda9887");
3060 if (btv->tuner_type != UNSET)
3061 request_module("tuner");
3065 /* ----------------------------------------------------------------------- */
3067 static void modtec_eeprom(struct bttv *btv)
3069 if( strncmp(&(eeprom_data[0x1e]),"Temic 4066 FY5",14) ==0) {
3070 btv->tuner_type=TUNER_TEMIC_4066FY5_PAL_I;
3071 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
3072 btv->c.nr,&eeprom_data[0x1e]);
3073 } else if (strncmp(&(eeprom_data[0x1e]),"Alps TSBB5",10) ==0) {
3074 btv->tuner_type=TUNER_ALPS_TSBB5_PAL_I;
3075 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
3076 btv->c.nr,&eeprom_data[0x1e]);
3077 } else if (strncmp(&(eeprom_data[0x1e]),"Philips FM1246",14) ==0) {
3078 btv->tuner_type=TUNER_PHILIPS_NTSC;
3079 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
3080 btv->c.nr,&eeprom_data[0x1e]);
3082 printk("bttv%d: Modtec: Unknown TunerString: %s\n",
3083 btv->c.nr,&eeprom_data[0x1e]);
3087 static void __devinit hauppauge_eeprom(struct bttv *btv)
3091 tveeprom_hauppauge_analog(&btv->i2c_client, &tv, eeprom_data);
3092 btv->tuner_type = tv.tuner_type;
3093 btv->has_radio = tv.has_radio;
3096 static int terratec_active_radio_upgrade(struct bttv *btv)
3101 btv->has_matchbox = 1;
3102 btv->mbox_we = 0x10;
3103 btv->mbox_most = 0x20;
3104 btv->mbox_clk = 0x08;
3105 btv->mbox_data = 0x04;
3106 btv->mbox_mask = 0x3c;
3108 btv->mbox_iow = 1 << 8;
3109 btv->mbox_ior = 1 << 9;
3110 btv->mbox_csel = 1 << 10;
3113 tea5757_write(btv, 5 * freq + 0x358); /* write 0x1ed8 */
3114 if (0x1ed8 == tea5757_read(btv)) {
3115 printk("bttv%d: Terratec Active Radio Upgrade found.\n",
3118 btv->has_matchbox = 1;
3121 btv->has_matchbox = 0;
3127 /* ----------------------------------------------------------------------- */
3130 * minimal bootstrap for the WinTV/PVR -- upload altera firmware.
3132 * The hcwamc.rbf firmware file is on the Hauppauge driver CD. Have
3133 * a look at Pvr/pvr45xxx.EXE (self-extracting zip archive, can be
3134 * unpacked with unzip).
3136 #define PVR_GPIO_DELAY 10
3138 #define BTTV_ALT_DATA 0x000001
3139 #define BTTV_ALT_DCLK 0x100000
3140 #define BTTV_ALT_NCONFIG 0x800000
3142 static int __devinit pvr_altera_load(struct bttv *btv, u8 *micro, u32 microlen)
3148 gpio_inout(0xffffff,BTTV_ALT_DATA|BTTV_ALT_DCLK|BTTV_ALT_NCONFIG);
3150 udelay(PVR_GPIO_DELAY);
3152 gpio_write(BTTV_ALT_NCONFIG);
3153 udelay(PVR_GPIO_DELAY);
3155 for (n = 0; n < microlen; n++) {
3157 for ( i = 0 ; i < 8 ; i++ ) {
3158 gpio_bits(BTTV_ALT_DCLK,0);
3160 gpio_bits(BTTV_ALT_DATA,BTTV_ALT_DATA);
3162 gpio_bits(BTTV_ALT_DATA,0);
3163 gpio_bits(BTTV_ALT_DCLK,BTTV_ALT_DCLK);
3167 gpio_bits(BTTV_ALT_DCLK,0);
3168 udelay(PVR_GPIO_DELAY);
3170 /* begin Altera init loop (Not necessary,but doesn't hurt) */
3171 for (i = 0 ; i < 30 ; i++) {
3172 gpio_bits(BTTV_ALT_DCLK,0);
3173 gpio_bits(BTTV_ALT_DCLK,BTTV_ALT_DCLK);
3175 gpio_bits(BTTV_ALT_DCLK,0);
3179 static int __devinit pvr_boot(struct bttv *btv)
3181 const struct firmware *fw_entry;
3184 rc = request_firmware(&fw_entry, "hcwamc.rbf", &btv->c.pci->dev);
3186 printk(KERN_WARNING "bttv%d: no altera firmware [via hotplug]\n",
3190 rc = pvr_altera_load(btv, fw_entry->data, fw_entry->size);
3191 printk(KERN_INFO "bttv%d: altera firmware upload %s\n",
3192 btv->c.nr, (rc < 0) ? "failed" : "ok");
3193 release_firmware(fw_entry);
3197 /* ----------------------------------------------------------------------- */
3198 /* some osprey specific stuff */
3200 static void __devinit osprey_eeprom(struct bttv *btv)
3203 unsigned char *ee = eeprom_data;
3204 unsigned long serial = 0;
3206 if (btv->c.type == 0) {
3207 /* this might be an antique... check for MMAC label in eeprom */
3208 if ((ee[0]=='M') && (ee[1]=='M') && (ee[2]=='A') && (ee[3]=='C')) {
3209 unsigned char checksum = 0;
3210 for (i =0; i<21; i++)
3212 if (checksum != ee[21])
3214 btv->c.type = BTTV_OSPREY1x0_848;
3215 for (i = 12; i < 21; i++)
3216 serial *= 10, serial += ee[i] - '0';
3219 unsigned short type;
3222 for(; offset < 8*16; offset += 16) {
3223 unsigned short checksum = 0;
3224 /* verify the checksum */
3225 for(i = 0; i<14; i++) checksum += ee[i+offset];
3226 checksum = ~checksum; /* no idea why */
3227 if ((((checksum>>8)&0x0FF) == ee[offset+14]) &&
3228 ((checksum & 0x0FF) == ee[offset+15])) {
3236 /* found a valid descriptor */
3237 type = (ee[offset+4]<<8) | (ee[offset+5]);
3243 btv->c.type = BTTV_OSPREY1x0_848;
3246 btv->c.type = BTTV_OSPREY101_848;
3252 btv->c.type = BTTV_OSPREY1x0;
3256 btv->c.type = BTTV_OSPREY1x1;
3261 btv->c.type = BTTV_OSPREY1x1_SVID;
3267 btv->c.type = BTTV_OSPREY2xx;
3271 btv->c.type = BTTV_OSPREY2x0_SVID;
3274 btv->c.type = BTTV_OSPREY500;
3278 btv->c.type = BTTV_OSPREY540;
3279 /* bttv_osprey_540_init(btv); */
3283 btv->c.type = BTTV_OSPREY2x0;
3284 /* enable output on select control lines */
3285 gpio_inout(0xffffff,0x000303);
3288 /* unknown...leave generic, but get serial # */
3291 serial = (ee[offset+6] << 24)
3292 | (ee[offset+7] << 16)
3293 | (ee[offset+8] << 8)
3297 printk(KERN_INFO "bttv%d: osprey eeprom: card=%d name=%s serial=%ld\n",
3298 btv->c.nr, btv->c.type, bttv_tvcards[btv->c.type].name,serial);
3301 /* ----------------------------------------------------------------------- */
3302 /* AVermedia specific stuff, from bktr_card.c */
3304 static int tuner_0_table[] = {
3305 TUNER_PHILIPS_NTSC, TUNER_PHILIPS_PAL /* PAL-BG*/,
3306 TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL /* PAL-I*/,
3307 TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL,
3308 TUNER_PHILIPS_SECAM, TUNER_PHILIPS_SECAM,
3309 TUNER_PHILIPS_SECAM, TUNER_PHILIPS_PAL,
3310 TUNER_PHILIPS_FM1216ME_MK3 };
3312 static int tuner_1_table[] = {
3313 TUNER_TEMIC_NTSC, TUNER_TEMIC_PAL,
3314 TUNER_TEMIC_PAL, TUNER_TEMIC_PAL,
3315 TUNER_TEMIC_PAL, TUNER_TEMIC_PAL,
3316 TUNER_TEMIC_4012FY5, TUNER_TEMIC_4012FY5, /* TUNER_TEMIC_SECAM */
3317 TUNER_TEMIC_4012FY5, TUNER_TEMIC_PAL};
3319 static void __devinit avermedia_eeprom(struct bttv *btv)
3321 int tuner_make,tuner_tv_fm,tuner_format,tuner=0;
3323 tuner_make = (eeprom_data[0x41] & 0x7);
3324 tuner_tv_fm = (eeprom_data[0x41] & 0x18) >> 3;
3325 tuner_format = (eeprom_data[0x42] & 0xf0) >> 4;
3326 btv->has_remote = (eeprom_data[0x42] & 0x01);
3328 if (tuner_make == 0 || tuner_make == 2)
3329 if(tuner_format <=0x0a)
3330 tuner = tuner_0_table[tuner_format];
3331 if (tuner_make == 1)
3332 if(tuner_format <=9)
3333 tuner = tuner_1_table[tuner_format];
3335 if (tuner_make == 4)
3336 if(tuner_format == 0x09)
3337 tuner = TUNER_LG_NTSC_NEW_TAPC; /* TAPC-G702P */
3339 printk(KERN_INFO "bttv%d: Avermedia eeprom[0x%02x%02x]: tuner=",
3340 btv->c.nr,eeprom_data[0x41],eeprom_data[0x42]);
3342 btv->tuner_type=tuner;
3345 printk("Unknown type");
3346 printk(" radio:%s remote control:%s\n",
3347 tuner_tv_fm ? "yes" : "no",
3348 btv->has_remote ? "yes" : "no");
3351 /* used on Voodoo TV/FM (Voodoo 200), S0 wired to 0x10000 */
3352 void bttv_tda9880_setnorm(struct bttv *btv, int norm)
3354 /* fix up our card entry */
3355 if(norm==VIDEO_MODE_NTSC) {
3356 bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[0]=0x957fff;
3357 bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[4]=0x957fff;
3358 dprintk("bttv_tda9880_setnorm to NTSC\n");
3361 bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[0]=0x947fff;
3362 bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[4]=0x947fff;
3363 dprintk("bttv_tda9880_setnorm to PAL\n");
3365 /* set GPIO according */
3366 gpio_bits(bttv_tvcards[btv->c.type].gpiomask,
3367 bttv_tvcards[btv->c.type].audiomux[btv->audio]);
3372 * reset/enable the MSP on some Hauppauge cards
3373 * Thanks to Kyösti Mälkki (kmalkki@cc.hut.fi)!
3378 static void __devinit boot_msp34xx(struct bttv *btv, int pin)
3380 int mask = (1 << pin);
3382 gpio_inout(mask,mask);
3385 gpio_bits(mask,mask);
3388 bttv_gpio_tracking(btv,"msp34xx");
3390 printk(KERN_INFO "bttv%d: Hauppauge/Voodoo msp34xx: reset line "
3391 "init [%d]\n", btv->c.nr, pin);
3394 static void __devinit boot_bt832(struct bttv *btv)
3398 /* ----------------------------------------------------------------------- */
3399 /* Imagenation L-Model PXC200 Framegrabber */
3400 /* This is basically the same procedure as
3401 * used by Alessandro Rubini in his pxc200
3402 * driver, but using BTTV functions */
3404 static void __devinit init_PXC200(struct bttv *btv)
3406 static int vals[] __devinitdata = { 0x08, 0x09, 0x0a, 0x0b, 0x0d, 0x0d,
3407 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
3413 /* Initialise GPIO-connevted stuff */
3414 gpio_inout(0xffffff, (1<<13));
3418 /* GPIO inputs are pulled up, so no need to drive
3419 * reset pin any longer */
3420 gpio_bits(0xffffff, 0);
3422 bttv_gpio_tracking(btv,"pxc200");
3424 /* we could/should try and reset/control the AD pots? but
3425 right now we simply turned off the crushing. Without
3426 this the AGC drifts drifts
3427 remember the EN is reverse logic -->
3428 setting BT848_ADC_AGC_EN disable the AGC
3429 tboult@eecs.lehigh.edu
3432 btwrite(BT848_ADC_RESERVED|BT848_ADC_AGC_EN, BT848_ADC);
3434 /* Initialise MAX517 DAC */
3435 printk(KERN_INFO "Setting DAC reference voltage level ...\n");
3436 bttv_I2CWrite(btv,0x5E,0,0x80,1);
3438 /* Initialise 12C508 PIC */
3439 /* The I2CWrite and I2CRead commmands are actually to the
3440 * same chips - but the R/W bit is included in the address
3441 * argument so the numbers are different */
3444 printk(KERN_INFO "Initialising 12C508 PIC chip ...\n");
3446 /* First of all, enable the clock line. This is used in the PXC200-F */
3447 val = btread(BT848_GPIO_DMA_CTL);
3448 val |= BT848_GPIO_DMA_CTL_GPCLKMODE;
3449 btwrite(val, BT848_GPIO_DMA_CTL);
3451 /* Then, push to 0 the reset pin long enough to reset the *
3452 * device same as above for the reset line, but not the same
3453 * value sent to the GPIO-connected stuff
3454 * which one is the good one? */
3455 gpio_inout(0xffffff,(1<<2));
3460 for (i = 0; i < ARRAY_SIZE(vals); i++) {
3461 tmp=bttv_I2CWrite(btv,0x1E,0,vals[i],1);
3464 "I2C Write(%2.2x) = %i\nI2C Read () = %2.2x\n\n",
3465 vals[i],tmp,bttv_I2CRead(btv,0x1F,NULL));
3469 printk(KERN_INFO "PXC200 Initialised.\n");
3474 /* ----------------------------------------------------------------------- */
3476 * The Adlink RTV-24 (aka Angelo) has some special initialisation to unlock
3477 * it. This apparently involves the following procedure for each 878 chip:
3479 * 1) write 0x00C3FEFF to the GPIO_OUT_EN register
3481 * 2) write to GPIO_DATA
3487 * read from GPIO_DATA into buf (uint_32)
3488 * - if ( data>>18 & 0x01 != 0) || ( buf>>19 & 0x01 != 1 )
3489 * error. ERROR_CPLD_Check_Failed stop.
3491 * 3) write to GPIO_DATA
3492 * - write 0x4400 + 0x0E
3494 * - write 0x4410 + 0x0E
3497 * read from GPIO_DATA into buf (uint_32)
3498 * - if ( buf>>18 & 0x01 ) || ( buf>>19 && 0x01 != 0 )
3499 * error. ERROR_CPLD_Check_Failed.
3501 /* ----------------------------------------------------------------------- */
3503 init_RTV24 (struct bttv *btv)
3505 uint32_t dataRead = 0;
3506 long watchdog_value = 0x0E;
3509 "bttv%d: Adlink RTV-24 initialisation in progress ...\n",
3512 btwrite (0x00c3feff, BT848_GPIO_OUT_EN);
3514 btwrite (0 + watchdog_value, BT848_GPIO_DATA);
3516 btwrite (0x10 + watchdog_value, BT848_GPIO_DATA);
3518 btwrite (0 + watchdog_value, BT848_GPIO_DATA);
3520 dataRead = btread (BT848_GPIO_DATA);
3522 if ((((dataRead >> 18) & 0x01) != 0) || (((dataRead >> 19) & 0x01) != 1)) {
3524 "bttv%d: Adlink RTV-24 initialisation(1) ERROR_CPLD_Check_Failed (read %d)\n",
3525 btv->c.nr, dataRead);
3528 btwrite (0x4400 + watchdog_value, BT848_GPIO_DATA);
3530 btwrite (0x4410 + watchdog_value, BT848_GPIO_DATA);
3532 btwrite (watchdog_value, BT848_GPIO_DATA);
3534 dataRead = btread (BT848_GPIO_DATA);
3536 if ((((dataRead >> 18) & 0x01) != 0) || (((dataRead >> 19) & 0x01) != 0)) {
3538 "bttv%d: Adlink RTV-24 initialisation(2) ERROR_CPLD_Check_Failed (read %d)\n",
3539 btv->c.nr, dataRead);
3545 "bttv%d: Adlink RTV-24 initialisation complete.\n", btv->c.nr);
3550 /* ----------------------------------------------------------------------- */
3551 /* Miro Pro radio stuff -- the tea5757 is connected to some GPIO ports */
3553 * Copyright (c) 1999 Csaba Halasz <qgehali@uni-miskolc.hu>
3554 * This code is placed under the terms of the GNU General Public License
3556 * Brutally hacked by Dan Sheridan <dan.sheridan@contact.org.uk> djs52 8/3/00
3559 static void bus_low(struct bttv *btv, int bit)
3561 if (btv->mbox_ior) {
3562 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3563 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3570 if (btv->mbox_ior) {
3571 gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
3576 static void bus_high(struct bttv *btv, int bit)
3578 if (btv->mbox_ior) {
3579 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3580 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3587 if (btv->mbox_ior) {
3588 gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
3593 static int bus_in(struct bttv *btv, int bit)
3595 if (btv->mbox_ior) {
3596 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3597 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3600 gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
3603 return gpio_read() & (bit);
3606 /* TEA5757 register bits */
3607 #define TEA_FREQ 0:14
3608 #define TEA_BUFFER 15:15
3610 #define TEA_SIGNAL_STRENGTH 16:17
3612 #define TEA_PORT1 18:18
3613 #define TEA_PORT0 19:19
3615 #define TEA_BAND 20:21
3616 #define TEA_BAND_FM 0
3617 #define TEA_BAND_MW 1
3618 #define TEA_BAND_LW 2
3619 #define TEA_BAND_SW 3
3621 #define TEA_MONO 22:22
3622 #define TEA_ALLOW_STEREO 0
3623 #define TEA_FORCE_MONO 1
3625 #define TEA_SEARCH_DIRECTION 23:23
3626 #define TEA_SEARCH_DOWN 0
3627 #define TEA_SEARCH_UP 1
3629 #define TEA_STATUS 24:24
3630 #define TEA_STATUS_TUNED 0
3631 #define TEA_STATUS_SEARCHING 1
3633 /* Low-level stuff */
3634 static int tea5757_read(struct bttv *btv)
3636 unsigned long timeout;
3640 /* better safe than sorry */
3641 gpio_inout(btv->mbox_mask, btv->mbox_clk | btv->mbox_we);
3643 if (btv->mbox_ior) {
3644 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3645 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3650 bttv_gpio_tracking(btv,"tea5757 read");
3652 bus_low(btv,btv->mbox_we);
3653 bus_low(btv,btv->mbox_clk);
3656 timeout= jiffies + HZ;
3658 /* wait for DATA line to go low; error if it doesn't */
3659 while (bus_in(btv,btv->mbox_data) && time_before(jiffies, timeout))
3661 if (bus_in(btv,btv->mbox_data)) {
3662 printk(KERN_WARNING "bttv%d: tea5757: read timeout\n",btv->c.nr);
3666 dprintk("bttv%d: tea5757:",btv->c.nr);
3667 for(i = 0; i < 24; i++)
3670 bus_high(btv,btv->mbox_clk);
3672 dprintk("%c",(bus_in(btv,btv->mbox_most) == 0)?'T':'-');
3673 bus_low(btv,btv->mbox_clk);
3675 value |= (bus_in(btv,btv->mbox_data) == 0)?0:1; /* MSB first */
3676 dprintk("%c", (bus_in(btv,btv->mbox_most) == 0)?'S':'M');
3678 dprintk("\nbttv%d: tea5757: read 0x%X\n", btv->c.nr, value);
3682 static int tea5757_write(struct bttv *btv, int value)
3687 gpio_inout(btv->mbox_mask, btv->mbox_clk | btv->mbox_we | btv->mbox_data);
3689 if (btv->mbox_ior) {
3690 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3691 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3695 bttv_gpio_tracking(btv,"tea5757 write");
3697 dprintk("bttv%d: tea5757: write 0x%X\n", btv->c.nr, value);
3698 bus_low(btv,btv->mbox_clk);
3699 bus_high(btv,btv->mbox_we);
3700 for(i = 0; i < 25; i++)
3702 if (reg & 0x1000000)
3703 bus_high(btv,btv->mbox_data);
3705 bus_low(btv,btv->mbox_data);
3707 bus_high(btv,btv->mbox_clk);
3709 bus_low(btv,btv->mbox_clk);
3712 bus_low(btv,btv->mbox_we); /* unmute !!! */
3716 void tea5757_set_freq(struct bttv *btv, unsigned short freq)
3718 dprintk("tea5757_set_freq %d\n",freq);
3719 tea5757_write(btv, 5 * freq + 0x358); /* add 10.7MHz (see docs) */
3723 /* ----------------------------------------------------------------------- */
3726 void winview_audio(struct bttv *btv, struct video_audio *v, int set)
3728 /* PT2254A programming Jon Tombs, jon@gte.esi.us.es */
3729 int bits_out, loops, vol, data;
3732 /* Fixed by Leandro Lucarella <luca@linuxmendoza.org.ar (07/31/01) */
3733 v->flags |= VIDEO_AUDIO_VOLUME;
3737 /* 32 levels logarithmic */
3738 vol = 32 - ((v->volume>>11));
3740 bits_out = (PT2254_DBS_IN_2>>(vol%5));
3742 bits_out |= (PT2254_DBS_IN_10>>(vol/5));
3743 bits_out |= PT2254_L_CHANNEL | PT2254_R_CHANNEL;
3745 data &= ~(WINVIEW_PT2254_CLK| WINVIEW_PT2254_DATA|
3746 WINVIEW_PT2254_STROBE);
3747 for (loops = 17; loops >= 0 ; loops--) {
3748 if (bits_out & (1<<loops))
3749 data |= WINVIEW_PT2254_DATA;
3751 data &= ~WINVIEW_PT2254_DATA;
3754 data |= WINVIEW_PT2254_CLK;
3757 data &= ~WINVIEW_PT2254_CLK;
3760 data |= WINVIEW_PT2254_STROBE;
3761 data &= ~WINVIEW_PT2254_DATA;
3764 data &= ~WINVIEW_PT2254_STROBE;
3768 /* ----------------------------------------------------------------------- */
3769 /* mono/stereo control for various cards (which don't use i2c chips but */
3770 /* connect something to the GPIO pins */
3773 gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set)
3775 unsigned int con = 0;
3778 gpio_inout(0x300, 0x300);
3779 if (v->mode & VIDEO_SOUND_LANG1)
3781 if (v->mode & VIDEO_SOUND_LANG2)
3783 if (v->mode & VIDEO_SOUND_STEREO)
3785 /* if (v->mode & VIDEO_SOUND_MONO)
3787 gpio_bits(0x300, con);
3789 v->mode = VIDEO_SOUND_STEREO |
3790 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3795 gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set)
3797 unsigned int val, con;
3799 if (btv->radio_user)
3805 if (v->mode & VIDEO_SOUND_LANG2) {
3806 if (v->mode & VIDEO_SOUND_LANG1) {
3815 if (con != (val & 0x300)) {
3816 gpio_bits(0x300, con);
3818 bttv_gpio_tracking(btv,"gvbctv5pci");
3821 switch (val & 0x70) {
3823 v->mode = VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3826 v->mode = VIDEO_SOUND_LANG2;
3829 v->mode = VIDEO_SOUND_LANG1;
3832 v->mode = VIDEO_SOUND_STEREO;
3835 v->mode = VIDEO_SOUND_MONO;
3838 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3839 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3845 * Mario Medina Nussbaum <medisoft@alohabbs.org.mx>
3846 * I discover that on BT848_GPIO_DATA address a byte 0xcce enable stereo,
3847 * 0xdde enables mono and 0xccd enables sap
3849 * Petr Vandrovec <VANDROVE@vc.cvut.cz>
3850 * P.S.: At least mask in line above is wrong - GPIO pins 3,2 select
3851 * input/output sound connection, so both must be set for output mode.
3853 * Looks like it's needed only for the "tvphone", the "tvphone 98"
3854 * handles this with a tda9840
3858 avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, int set)
3863 if (v->mode & VIDEO_SOUND_LANG2) /* SAP */
3865 if (v->mode & VIDEO_SOUND_STEREO)
3868 gpio_bits(0x03,val);
3870 bttv_gpio_tracking(btv,"avermedia");
3873 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3880 avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v, int set)
3885 if (v->mode & VIDEO_SOUND_LANG2) /* SAP */
3887 if (v->mode & VIDEO_SOUND_STEREO) /* STEREO */
3889 btaor(val, ~0x03, BT848_GPIO_DATA);
3891 bttv_gpio_tracking(btv,"avermedia");
3893 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3894 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3899 /* Lifetec 9415 handling */
3901 lt9415_audio(struct bttv *btv, struct video_audio *v, int set)
3905 if (gpio_read() & 0x4000) {
3906 v->mode = VIDEO_SOUND_MONO;
3911 if (v->mode & VIDEO_SOUND_LANG2) /* A2 SAP */
3913 if (v->mode & VIDEO_SOUND_STEREO) /* A2 stereo */
3915 if ((v->mode & VIDEO_SOUND_LANG1) ||
3916 (v->mode & VIDEO_SOUND_MONO))
3918 gpio_bits(0x0880, val);
3920 bttv_gpio_tracking(btv,"lt9415");
3922 /* autodetect doesn't work with this card :-( */
3923 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3924 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3929 /* TDA9821 on TerraTV+ Bt848, Bt878 */
3931 terratv_audio(struct bttv *btv, struct video_audio *v, int set)
3933 unsigned int con = 0;
3936 gpio_inout(0x180000,0x180000);
3937 if (v->mode & VIDEO_SOUND_LANG2)
3939 if (v->mode & VIDEO_SOUND_STEREO)
3941 gpio_bits(0x180000, con);
3943 bttv_gpio_tracking(btv,"terratv");
3945 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3946 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3951 winfast2000_audio(struct bttv *btv, struct video_audio *v, int set)
3953 unsigned long val = 0;
3956 /*btor (0xc32000, BT848_GPIO_OUT_EN);*/
3957 if (v->mode & VIDEO_SOUND_MONO) /* Mono */
3959 if (v->mode & VIDEO_SOUND_LANG1) /* Mono */
3961 if (v->mode & VIDEO_SOUND_LANG2) /* SAP */
3963 if (v->mode & VIDEO_SOUND_STEREO) /* Stereo */
3966 gpio_bits(0x430000, val);
3968 bttv_gpio_tracking(btv,"winfast2000");
3971 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3972 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3977 * Dariusz Kowalewski <darekk@automex.pl>
3978 * sound control for Prolink PV-BT878P+9B (PixelView PlayTV Pro FM+NICAM
3979 * revision 9B has on-board TDA9874A sound decoder).
3981 * Note: There are card variants without tda9874a. Forcing the "stereo sound route"
3982 * will mute this cards.
3985 pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set)
3987 unsigned int val = 0;
3989 if (btv->radio_user)
3993 if (v->mode & VIDEO_SOUND_MONO) {
3996 if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2))
3997 || (v->mode & VIDEO_SOUND_STEREO)) {
4001 gpio_bits(0x03,val);
4003 bttv_gpio_tracking(btv,"pvbt878p9b");
4006 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
4007 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
4012 * Dariusz Kowalewski <darekk@automex.pl>
4013 * sound control for FlyVideo 2000S (with tda9874 decoder)
4014 * based on pvbt878p9b_audio() - this is not tested, please fix!!!
4017 fv2000s_audio(struct bttv *btv, struct video_audio *v, int set)
4019 unsigned int val = 0xffff;
4021 if (btv->radio_user)
4024 if (v->mode & VIDEO_SOUND_MONO) {
4027 if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2))
4028 || (v->mode & VIDEO_SOUND_STEREO)) {
4029 val = 0x1080; /*-dk-???: 0x0880, 0x0080, 0x1800 ... */
4031 if (val != 0xffff) {
4032 gpio_bits(0x1800, val);
4034 bttv_gpio_tracking(btv,"fv2000s");
4037 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
4038 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
4043 * sound control for Canopus WinDVR PCI
4044 * Masaki Suzuki <masaki@btree.org>
4047 windvr_audio(struct bttv *btv, struct video_audio *v, int set)
4049 unsigned long val = 0;
4052 if (v->mode & VIDEO_SOUND_MONO)
4054 if (v->mode & VIDEO_SOUND_LANG1)
4056 if (v->mode & VIDEO_SOUND_LANG2)
4058 if (v->mode & VIDEO_SOUND_STEREO)
4061 gpio_bits(0x140000, val);
4063 bttv_gpio_tracking(btv,"windvr");
4066 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
4067 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
4072 * sound control for AD-TVK503
4073 * Hiroshi Takekawa <sian@big.or.jp>
4076 adtvk503_audio(struct bttv *btv, struct video_audio *v, int set)
4078 unsigned int con = 0xffffff;
4080 /* btaor(0x1e0000, ~0x1e0000, BT848_GPIO_OUT_EN); */
4083 /* btor(***, BT848_GPIO_OUT_EN); */
4084 if (v->mode & VIDEO_SOUND_LANG1)
4086 if (v->mode & VIDEO_SOUND_LANG2)
4088 if (v->mode & VIDEO_SOUND_STEREO)
4090 if (v->mode & VIDEO_SOUND_MONO)
4092 if (con != 0xffffff) {
4093 gpio_bits(0x1e0000,con);
4095 bttv_gpio_tracking(btv, "adtvk503");
4098 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
4099 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
4103 /* RemoteVision MX (rv605) muxsel helper [Miguel Freitas]
4105 * This is needed because rv605 don't use a normal multiplex, but a crosspoint
4106 * switch instead (CD22M3494E). This IC can have multiple active connections
4107 * between Xn (input) and Yn (output) pins. We need to clear any existing
4108 * connection prior to establish a new one, pulsing the STROBE pin.
4110 * The board hardwire Y0 (xpoint) to MUX1 and MUXOUT to Yin.
4111 * GPIO pins are wired as:
4112 * GPIO[0:3] - AX[0:3] (xpoint) - P1[0:3] (microcontroler)
4113 * GPIO[4:6] - AY[0:2] (xpoint) - P1[4:6] (microcontroler)
4114 * GPIO[7] - DATA (xpoint) - P1[7] (microcontroler)
4115 * GPIO[8] - - P3[5] (microcontroler)
4116 * GPIO[9] - RESET (xpoint) - P3[6] (microcontroler)
4117 * GPIO[10] - STROBE (xpoint) - P3[7] (microcontroler)
4118 * GPINTR - - P3[4] (microcontroler)
4120 * The microcontroler is a 80C32 like. It should be possible to change xpoint
4121 * configuration either directly (as we are doing) or using the microcontroler
4122 * which is also wired to I2C interface. I have no further info on the
4123 * microcontroler features, one would need to disassembly the firmware.
4124 * note: the vendor refused to give any information on this product, all
4125 * that stuff was found using a multimeter! :)
4127 static void rv605_muxsel(struct bttv *btv, unsigned int input)
4129 /* reset all conections */
4130 gpio_bits(0x200,0x200);
4132 gpio_bits(0x200,0x000);
4135 /* create a new conection */
4136 gpio_bits(0x480,0x080);
4137 gpio_bits(0x480,0x480);
4139 gpio_bits(0x480,0x080);
4143 /* Tibet Systems 'Progress DVR' CS16 muxsel helper [Chris Fanning]
4145 * The CS16 (available on eBay cheap) is a PCI board with four Fusion
4146 * 878A chips, a PCI bridge, an Atmel microcontroller, four sync seperator
4147 * chips, ten eight input analog multiplexors, a not chip and a few
4150 * 16 inputs on a secondary bracket are provided and can be selected
4151 * from each of the four capture chips. Two of the eight input
4152 * multiplexors are used to select from any of the 16 input signals.
4154 * Unsupported hardware capabilities:
4155 * . A video output monitor on the secondary bracket can be selected from
4156 * one of the 878A chips.
4157 * . Another passthrough but I haven't spent any time investigating it.
4158 * . Digital I/O (logic level connected to GPIO) is available from an
4161 * The on chip input mux should always be set to 2.
4162 * GPIO[16:19] - Video input selection
4163 * GPIO[0:3] - Video output monitor select (only available from one 878A)
4164 * GPIO[?:?] - Digital I/O.
4166 * There is an ATMEL microcontroller with an 8031 core on board. I have not
4167 * determined what function (if any) it provides. With the microcontroller
4168 * and sync seperator chips a guess is that it might have to do with video
4169 * switching and maybe some digital I/O.
4171 static void tibetCS16_muxsel(struct bttv *btv, unsigned int input)
4174 gpio_bits(0x0f0000, input << 16);
4177 static void tibetCS16_init(struct bttv *btv)
4179 /* enable gpio bits, mask obtained via btSpy */
4180 gpio_inout(0xffffff, 0x0f7fff);
4181 gpio_write(0x0f7fff);
4185 * The following routines for the Kodicom-4400r get a little mind-twisting.
4186 * There is a "master" controller and three "slave" controllers, together
4187 * an analog switch which connects any of 16 cameras to any of the BT87A's.
4188 * The analog switch is controlled by the "master", but the detection order
4189 * of the four BT878A chips is in an order which I just don't understand.
4190 * The "master" is actually the second controller to be detected. The
4191 * logic on the board uses logical numbers for the 4 controlers, but
4192 * those numbers are different from the detection sequence. When working
4193 * with the analog switch, we need to "map" from the detection sequence
4194 * over to the board's logical controller number. This mapping sequence
4195 * is {3, 0, 2, 1}, i.e. the first controller to be detected is logical
4196 * unit 3, the second (which is the master) is logical unit 0, etc.
4197 * We need to maintain the status of the analog switch (which of the 16
4198 * cameras is connected to which of the 4 controllers). Rather than
4199 * add to the bttv structure for this, we use the data reserved for
4200 * the mbox (unused for this card type).
4204 * First a routine to set the analog switch, which controls which camera
4205 * is routed to which controller. The switch comprises an X-address
4206 * (gpio bits 0-3, representing the camera, ranging from 0-15), and a
4207 * Y-address (gpio bits 4-6, representing the controller, ranging from 0-3).
4208 * A data value (gpio bit 7) of '1' enables the switch, and '0' disables
4209 * the switch. A STROBE bit (gpio bit 8) latches the data value into the
4210 * specified address. The idea is to set the address and data, then bring
4211 * STROBE high, and finally bring STROBE back to low.
4213 static void kodicom4400r_write(struct bttv *btv,
4214 unsigned char xaddr,
4215 unsigned char yaddr,
4216 unsigned char data) {
4219 udata = (data << 7) | ((yaddr&3) << 4) | (xaddr&0xf);
4220 gpio_bits(0x1ff, udata); /* write ADDR and DAT */
4221 gpio_bits(0x1ff, udata | (1 << 8)); /* strobe high */
4222 gpio_bits(0x1ff, udata); /* strobe low */
4226 * Next the mux select. Both the "master" and "slave" 'cards' (controllers)
4227 * use this routine. The routine finds the "master" for the card, maps
4228 * the controller number from the detected position over to the logical
4229 * number, writes the appropriate data to the analog switch, and housekeeps
4230 * the local copy of the switch information. The parameter 'input' is the
4231 * requested camera number (0 - 15).
4233 static void kodicom4400r_muxsel(struct bttv *btv, unsigned int input)
4238 static unsigned char map[4] = {3, 0, 2, 1};
4240 mctlr = master[btv->c.nr];
4241 if (mctlr == NULL) { /* ignore if master not yet detected */
4244 yaddr = (btv->c.nr - mctlr->c.nr + 1) & 3; /* the '&' is for safety */
4246 sw_status = (char *)(&mctlr->mbox_we);
4247 xaddr = input & 0xf;
4248 /* Check if the controller/camera pair has changed, else ignore */
4249 if (sw_status[yaddr] != xaddr)
4251 /* "open" the old switch, "close" the new one, save the new */
4252 kodicom4400r_write(mctlr, sw_status[yaddr], yaddr, 0);
4253 sw_status[yaddr] = xaddr;
4254 kodicom4400r_write(mctlr, xaddr, yaddr, 1);
4259 * During initialisation, we need to reset the analog switch. We
4260 * also preset the switch to map the 4 connectors on the card to the
4261 * *user's* (see above description of kodicom4400r_muxsel) channels
4264 static void kodicom4400r_init(struct bttv *btv)
4266 char *sw_status = (char *)(&btv->mbox_we);
4269 gpio_inout(0x0003ff, 0x0003ff);
4270 gpio_write(1 << 9); /* reset MUX */
4272 /* Preset camera 0 to the 4 controllers */
4273 for (ix=0; ix<4; ix++) {
4275 kodicom4400r_write(btv, ix, ix, 1);
4278 * Since this is the "master", we need to set up the
4279 * other three controller chips' pointers to this structure
4280 * for later use in the muxsel routine.
4282 if ((btv->c.nr<1) || (btv->c.nr>BTTV_MAX-3))
4284 master[btv->c.nr-1] = btv;
4285 master[btv->c.nr] = btv;
4286 master[btv->c.nr+1] = btv;
4287 master[btv->c.nr+2] = btv;
4290 /* The Grandtec X-Guard framegrabber card uses two Dual 4-channel
4291 * video multiplexers to provide up to 16 video inputs. These
4292 * multiplexers are controlled by the lower 8 GPIO pins of the
4293 * bt878. The multiplexers probably Pericom PI5V331Q or similar.
4295 * xxx0 is pin xxx of multiplexer U5,
4296 * yyy1 is pin yyy of multiplexer U2
4308 static void xguard_muxsel(struct bttv *btv, unsigned int input)
4310 static const int masks[] = {
4311 ENB0, ENB0|IN00, ENB0|IN10, ENB0|IN00|IN10,
4312 ENA0, ENA0|IN00, ENA0|IN10, ENA0|IN00|IN10,
4313 ENB1, ENB1|IN01, ENB1|IN11, ENB1|IN01|IN11,
4314 ENA1, ENA1|IN01, ENA1|IN11, ENA1|IN01|IN11,
4316 gpio_write(masks[input%16]);
4318 static void picolo_tetra_init(struct bttv *btv)
4320 /*This is the video input redirection fonctionality : I DID NOT USED IT. */
4321 btwrite (0x08<<16,BT848_GPIO_DATA);/*GPIO[19] [==> 4053 B+C] set to 1 */
4322 btwrite (0x04<<16,BT848_GPIO_DATA);/*GPIO[18] [==> 4053 A] set to 1*/
4324 static void picolo_tetra_muxsel (struct bttv* btv, unsigned int input)
4327 dprintk (KERN_DEBUG "bttv%d : picolo_tetra_muxsel => input = %d\n",btv->c.nr,input);
4328 /*Just set the right path in the analog multiplexers : channel 1 -> 4 ==> Analog Mux ==> MUX0*/
4329 /*GPIO[20]&GPIO[21] used to choose the right input*/
4330 btwrite (input<<20,BT848_GPIO_DATA);
4335 * ivc120_muxsel [Added by Alan Garfield <alan@fromorbit.com>]
4337 * The IVC120G security card has 4 i2c controlled TDA8540 matrix
4338 * swichers to provide 16 channels to MUX0. The TDA8540's have
4339 * 4 indepedant outputs and as such the IVC120G also has the
4340 * optional "Monitor Out" bus. This allows the card to be looking
4341 * at one input while the monitor is looking at another.
4343 * Since I've couldn't be bothered figuring out how to add an
4344 * independant muxsel for the monitor bus, I've just set it to
4345 * whatever the card is looking at.
4347 * OUT0 of the TDA8540's is connected to MUX0 (0x03)
4348 * OUT1 of the TDA8540's is connected to "Monitor Out" (0x0C)
4350 * TDA8540_ALT3 IN0-3 = Channel 13 - 16 (0x03)
4351 * TDA8540_ALT4 IN0-3 = Channel 1 - 4 (0x03)
4352 * TDA8540_ALT5 IN0-3 = Channel 5 - 8 (0x03)
4353 * TDA8540_ALT6 IN0-3 = Channel 9 - 12 (0x03)
4357 /* All 7 possible sub-ids for the TDA8540 Matrix Switcher */
4358 #define I2C_TDA8540 0x90
4359 #define I2C_TDA8540_ALT1 0x92
4360 #define I2C_TDA8540_ALT2 0x94
4361 #define I2C_TDA8540_ALT3 0x96
4362 #define I2C_TDA8540_ALT4 0x98
4363 #define I2C_TDA8540_ALT5 0x9a
4364 #define I2C_TDA8540_ALT6 0x9c
4366 static void ivc120_muxsel(struct bttv *btv, unsigned int input)
4369 int key = input % 4;
4370 int matrix = input / 4;
4372 dprintk("bttv%d: ivc120_muxsel: Input - %02d | TDA - %02d | In - %02d\n",
4373 btv->c.nr, input, matrix, key);
4375 /* Handles the input selection on the TDA8540's */
4376 bttv_I2CWrite(btv, I2C_TDA8540_ALT3, 0x00,
4377 ((matrix == 3) ? (key | key << 2) : 0x00), 1);
4378 bttv_I2CWrite(btv, I2C_TDA8540_ALT4, 0x00,
4379 ((matrix == 0) ? (key | key << 2) : 0x00), 1);
4380 bttv_I2CWrite(btv, I2C_TDA8540_ALT5, 0x00,
4381 ((matrix == 1) ? (key | key << 2) : 0x00), 1);
4382 bttv_I2CWrite(btv, I2C_TDA8540_ALT6, 0x00,
4383 ((matrix == 2) ? (key | key << 2) : 0x00), 1);
4385 /* Handles the output enables on the TDA8540's */
4386 bttv_I2CWrite(btv, I2C_TDA8540_ALT3, 0x02,
4387 ((matrix == 3) ? 0x03 : 0x00), 1); /* 13 - 16 */
4388 bttv_I2CWrite(btv, I2C_TDA8540_ALT4, 0x02,
4389 ((matrix == 0) ? 0x03 : 0x00), 1); /* 1-4 */
4390 bttv_I2CWrite(btv, I2C_TDA8540_ALT5, 0x02,
4391 ((matrix == 1) ? 0x03 : 0x00), 1); /* 5-8 */
4392 bttv_I2CWrite(btv, I2C_TDA8540_ALT6, 0x02,
4393 ((matrix == 2) ? 0x03 : 0x00), 1); /* 9-12 */
4395 /* Selects MUX0 for input on the 878 */
4396 btaor((0)<<5, ~(3<<5), BT848_IFORM);
4400 /* PXC200 muxsel helper
4401 * luke@syseng.anu.edu.au
4402 * another transplant
4403 * from Alessandro Rubini (rubini@linux.it)
4405 * There are 4 kinds of cards:
4406 * PXC200L which is bt848
4407 * PXC200F which is bt848 with PIC controlling mux
4408 * PXC200AL which is bt878
4409 * PXC200AF which is bt878 with PIC controlling mux
4411 #define PX_CFG_PXC200F 0x01
4412 #define PX_FLAG_PXC200A 0x00001000 /* a pxc200A is bt-878 based */
4413 #define PX_I2C_PIC 0x0f
4414 #define PX_PXC200A_CARDID 0x200a1295
4415 #define PX_I2C_CMD_CFG 0x00
4417 static void PXC200_muxsel(struct bttv *btv, unsigned int input)
4422 unsigned char buf[2];
4424 /* Read PIC config to determine if this is a PXC200F */
4428 rc=bttv_I2CWrite(btv,(PX_I2C_PIC<<1),buf[0],buf[1],1);
4430 printk(KERN_DEBUG "bttv%d: PXC200_muxsel: pic cfg write failed:%d\n", btv->c.nr,rc);
4431 /* not PXC ? do nothing */
4435 rc=bttv_I2CRead(btv,(PX_I2C_PIC<<1),NULL);
4436 if (!(rc & PX_CFG_PXC200F)) {
4437 printk(KERN_DEBUG "bttv%d: PXC200_muxsel: not PXC200F rc:%d \n", btv->c.nr,rc);
4442 /* The multiplexer in the 200F is handled by the GPIO port */
4443 /* get correct mapping between inputs */
4444 /* mux = bttv_tvcards[btv->type].muxsel[input] & 3; */
4445 /* ** not needed!? */
4448 /* make sure output pins are enabled */
4449 /* bitmask=0x30f; */
4451 /* check whether we have a PXC200A */
4452 if (btv->cardid == PX_PXC200A_CARDID) {
4453 bitmask ^= 0x180; /* use 7 and 9, not 8 and 9 */
4454 bitmask |= 7<<4; /* the DAC */
4456 btwrite(bitmask, BT848_GPIO_OUT_EN);
4458 bitmask = btread(BT848_GPIO_DATA);
4459 if (btv->cardid == PX_PXC200A_CARDID)
4460 bitmask = (bitmask & ~0x280) | ((mux & 2) << 8) | ((mux & 1) << 7);
4461 else /* older device */
4462 bitmask = (bitmask & ~0x300) | ((mux & 3) << 8);
4463 btwrite(bitmask,BT848_GPIO_DATA);
4466 * Was "to be safe, set the bt848 to input 0"
4467 * Actually, since it's ok at load time, better not messing
4468 * with these bits (on PXC200AF you need to set mux 2 here)
4470 * needed because bttv-driver sets mux before calling this function
4472 if (btv->cardid == PX_PXC200A_CARDID)
4473 btaor(2<<5, ~BT848_IFORM_MUXSEL, BT848_IFORM);
4474 else /* older device */
4475 btand(~BT848_IFORM_MUXSEL,BT848_IFORM);
4477 printk(KERN_DEBUG "bttv%d: setting input channel to:%d\n", btv->c.nr,(int)mux);
4480 /* ----------------------------------------------------------------------- */
4481 /* motherboard chipset specific stuff */
4483 void __devinit bttv_check_chipset(void)
4485 int pcipci_fail = 0;
4486 struct pci_dev *dev = NULL;
4488 if (pci_pci_problems & PCIPCI_FAIL)
4490 if (pci_pci_problems & (PCIPCI_TRITON|PCIPCI_NATOMA|PCIPCI_VIAETBF))
4492 if (pci_pci_problems & PCIPCI_VSFX)
4494 #ifdef PCIPCI_ALIMAGIK
4495 if (pci_pci_problems & PCIPCI_ALIMAGIK)
4500 /* print warnings about any quirks found */
4502 printk(KERN_INFO "bttv: Host bridge needs ETBF enabled.\n");
4504 printk(KERN_INFO "bttv: Host bridge needs VSFX enabled.\n");
4506 printk(KERN_WARNING "bttv: BT848 and your chipset may not work together.\n");
4508 printk(KERN_WARNING "bttv: overlay will be disabled.\n");
4511 printk(KERN_WARNING "bttv: overlay forced. Use this option at your own risk.\n");
4514 if (UNSET != latency)
4515 printk(KERN_INFO "bttv: pci latency fixup [%d]\n",latency);
4517 while ((dev = pci_find_device(PCI_VENDOR_ID_INTEL,
4518 PCI_DEVICE_ID_INTEL_82441, dev))) {
4520 pci_read_config_byte(dev, 0x53, &b);
4522 printk(KERN_INFO "bttv: Host bridge: 82441FX Natoma, "
4523 "bufcon=0x%02x\n",b);
4527 int __devinit bttv_handle_chipset(struct bttv *btv)
4529 unsigned char command;
4531 if (!triton1 && !vsfx && UNSET == latency)
4536 printk(KERN_INFO "bttv%d: enabling ETBF (430FX/VP3 compatibilty)\n",btv->c.nr);
4537 if (vsfx && btv->id >= 878)
4538 printk(KERN_INFO "bttv%d: enabling VSFX\n",btv->c.nr);
4539 if (UNSET != latency)
4540 printk(KERN_INFO "bttv%d: setting pci timer to %d\n",
4544 if (btv->id < 878) {
4545 /* bt848 (mis)uses a bit in the irq mask for etbf */
4547 btv->triton1 = BT848_INT_ETBF;
4549 /* bt878 has a bit in the pci config space for it */
4550 pci_read_config_byte(btv->c.pci, BT878_DEVCTRL, &command);
4552 command |= BT878_EN_TBFX;
4554 command |= BT878_EN_VSFX;
4555 pci_write_config_byte(btv->c.pci, BT878_DEVCTRL, command);
4557 if (UNSET != latency)
4558 pci_write_config_byte(btv->c.pci, PCI_LATENCY_TIMER, latency);