4 this file has configuration informations - card-specific stuff
5 like the big tvcards array for the most part
7 Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de)
8 & Marcus Metzler (mocm@thp.uni-koeln.de)
9 (c) 1999-2001 Gerd Knorr <kraxel@goldbach.in-berlin.de>
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 #include <linux/config.h>
28 #include <linux/delay.h>
29 #include <linux/module.h>
30 #include <linux/kmod.h>
31 #include <linux/init.h>
32 #include <linux/pci.h>
33 #include <linux/vmalloc.h>
34 #ifdef CONFIG_FW_LOADER
35 # include <linux/firmware.h>
44 static void boot_msp34xx(struct bttv *btv, int pin);
45 static void boot_bt832(struct bttv *btv);
46 static void hauppauge_eeprom(struct bttv *btv);
47 static void avermedia_eeprom(struct bttv *btv);
48 static void osprey_eeprom(struct bttv *btv);
49 static void modtec_eeprom(struct bttv *btv);
50 static void init_PXC200(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 int terratec_active_radio_upgrade(struct bttv *btv);
78 static int tea5757_read(struct bttv *btv);
79 static int tea5757_write(struct bttv *btv, int value);
80 static void identify_by_eeprom(struct bttv *btv,
81 unsigned char eeprom_data[256]);
83 /* config variables */
84 static unsigned int triton1=0;
85 static unsigned int vsfx=0;
86 static unsigned int latency = UNSET;
87 unsigned int no_overlay=-1;
89 static unsigned int card[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
90 static unsigned int pll[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
91 static unsigned int tuner[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
92 static unsigned int svhs[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
93 static unsigned int remote[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
95 static unsigned int autoload = 1;
97 static unsigned int autoload = 0;
99 static unsigned int gpiomask = UNSET;
100 static unsigned int audioall = UNSET;
101 static unsigned int audiomux[5] = { [ 0 ... 4 ] = UNSET };
104 MODULE_PARM(triton1,"i");
105 MODULE_PARM_DESC(triton1,"set ETBF pci config bit "
106 "[enable bug compatibility for triton1 + others]");
107 MODULE_PARM(vsfx,"i");
108 MODULE_PARM_DESC(vsfx,"set VSFX pci config bit "
109 "[yet another chipset flaw workaround]");
110 MODULE_PARM(no_overlay,"i");
111 MODULE_PARM(latency,"i");
112 MODULE_PARM_DESC(latency,"pci latency timer");
113 MODULE_PARM(card,"1-" __stringify(BTTV_MAX) "i");
114 MODULE_PARM_DESC(card,"specify TV/grabber card model, see CARDLIST file for a list");
115 MODULE_PARM(pll,"1-" __stringify(BTTV_MAX) "i");
116 MODULE_PARM_DESC(pll,"specify installed crystal (0=none, 28=28 MHz, 35=35 MHz)");
117 MODULE_PARM(tuner,"1-" __stringify(BTTV_MAX) "i");
118 MODULE_PARM_DESC(tuner,"specify installed tuner type");
119 MODULE_PARM(autoload,"i");
120 MODULE_PARM_DESC(autoload,"automatically load i2c modules like tuner.o, default is 1 (yes)");
122 MODULE_PARM(svhs,"1-" __stringify(BTTV_MAX) "i");
123 MODULE_PARM(remote,"1-" __stringify(BTTV_MAX) "i");
125 MODULE_PARM(gpiomask,"i");
126 MODULE_PARM(audioall,"i");
127 MODULE_PARM(audiomux,"1-6i");
131 static int __init p_card(char *str) { return bttv_parse(str,BTTV_MAX,card); }
132 static int __init p_pll(char *str) { return bttv_parse(str,BTTV_MAX,pll); }
133 static int __init p_tuner(char *str) { return bttv_parse(str,BTTV_MAX,tuner); }
134 __setup("bttv.card=", p_card);
135 __setup("bttv.pll=", p_pll);
136 __setup("bttv.tuner=", p_tuner);
138 int __init bttv_parse(char *str, int max, int *vals)
140 int i,number,res = 2;
142 for (i = 0; res == 2 && i < max; i++) {
143 res = get_option(&str,&number);
151 /* ----------------------------------------------------------------------- */
152 /* list of card IDs for bt878+ cards */
158 } cards[] __devinitdata = {
159 { 0x13eb0070, BTTV_HAUPPAUGE878, "Hauppauge WinTV" },
160 { 0x39000070, BTTV_HAUPPAUGE878, "Hauppauge WinTV-D" },
161 { 0x45000070, BTTV_HAUPPAUGEPVR, "Hauppauge WinTV/PVR" },
162 { 0xff000070, BTTV_OSPREY1x0, "Osprey-100" },
163 { 0xff010070, BTTV_OSPREY2x0_SVID,"Osprey-200" },
164 { 0xff020070, BTTV_OSPREY500, "Osprey-500" },
165 { 0xff030070, BTTV_OSPREY2000, "Osprey-2000" },
166 { 0xff040070, BTTV_OSPREY540, "Osprey-540" },
168 { 0x00011002, BTTV_ATI_TVWONDER, "ATI TV Wonder" },
169 { 0x00031002, BTTV_ATI_TVWONDERVE,"ATI TV Wonder/VE" },
171 { 0x6606107d, BTTV_WINFAST2000, "Leadtek WinFast TV 2000" },
172 { 0x6607107d, BTTV_WINFASTVC100, "Leadtek WinFast VC 100" },
173 { 0x263610b4, BTTV_STB2, "STB TV PCI FM, Gateway P/N 6000704" },
174 { 0x264510b4, BTTV_STB2, "STB TV PCI FM, Gateway P/N 6000704" },
175 { 0x402010fc, BTTV_GVBCTV3PCI, "I-O Data Co. GV-BCTV3/PCI" },
176 { 0x405010fc, BTTV_GVBCTV4PCI, "I-O Data Co. GV-BCTV4/PCI" },
177 { 0x407010fc, BTTV_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" },
178 { 0xd01810fc, BTTV_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" },
180 { 0x001211bd, BTTV_PINNACLE, "Pinnacle PCTV" },
181 { 0x001c11bd, BTTV_PINNACLESAT, "Pinnacle PCTV Sat" },
182 // some cards ship with byteswapped IDs ...
183 { 0x1200bd11, BTTV_PINNACLE, "Pinnacle PCTV [bswap]" },
184 { 0xff00bd11, BTTV_PINNACLE, "Pinnacle PCTV [bswap]" },
186 { 0x3000121a, BTTV_VOODOOTV_FM, "3Dfx VoodooTV FM/ VoodooTV 200" },
187 { 0x263710b4, BTTV_VOODOOTV_FM, "3Dfx VoodooTV FM/ VoodooTV 200" },
188 { 0x3060121a, BTTV_STB2, "3Dfx VoodooTV 100/ STB OEM" },
190 { 0x3000144f, BTTV_MAGICTVIEW063, "(Askey Magic/others) TView99 CPH06x" },
191 { 0x3002144f, BTTV_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH05x" },
192 { 0x3005144f, BTTV_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH061/06L (T1/LC)" },
193 { 0x5000144f, BTTV_MAGICTVIEW061, "Askey CPH050" },
194 { 0x300014ff, BTTV_MAGICTVIEW061, "TView 99 (CPH061)" },
195 { 0x300214ff, BTTV_PHOEBE_TVMAS, "Phoebe TV Master (CPH060)" },
197 { 0x00011461, BTTV_AVPHONE98, "AVerMedia TVPhone98" },
198 { 0x00021461, BTTV_AVERMEDIA98, "AVermedia TVCapture 98" },
199 { 0x00031461, BTTV_AVPHONE98, "AVerMedia TVPhone98" },
200 { 0x00041461, BTTV_AVERMEDIA98, "AVerMedia TVCapture 98" },
201 { 0x03001461, BTTV_AVERMEDIA98, "VDOMATE TV TUNER CARD" },
203 { 0x1117153b, BTTV_TERRATVALUE, "Terratec TValue (Philips PAL B/G)" },
204 { 0x1118153b, BTTV_TERRATVALUE, "Terratec TValue (Temic PAL B/G)" },
205 { 0x1119153b, BTTV_TERRATVALUE, "Terratec TValue (Philips PAL I)" },
206 { 0x111a153b, BTTV_TERRATVALUE, "Terratec TValue (Temic PAL I)" },
208 { 0x1123153b, BTTV_TERRATVRADIO, "Terratec TV Radio+" },
209 { 0x1127153b, BTTV_TERRATV, "Terratec TV+ (V1.05)" },
210 // clashes with FlyVideo
211 //{ 0x18521852, BTTV_TERRATV, "Terratec TV+ (V1.10)" },
212 { 0x1134153b, BTTV_TERRATVALUE, "Terratec TValue (LR102)" },
213 { 0x1135153b, BTTV_TERRATVALUER, "Terratec TValue Radio" }, // LR102
214 { 0x5018153b, BTTV_TERRATVALUE, "Terratec TValue" }, // ??
215 { 0xff3b153b, BTTV_TERRATVALUER, "Terratec TValue Radio" }, // ??
217 { 0x400015b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV" },
218 { 0x400a15b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV" },
219 { 0x400d15b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
220 { 0x401015b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
221 { 0x401615b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
223 { 0x1430aa00, BTTV_PV143, "Provideo PV143A" },
224 { 0x1431aa00, BTTV_PV143, "Provideo PV143B" },
225 { 0x1432aa00, BTTV_PV143, "Provideo PV143C" },
226 { 0x1433aa00, BTTV_PV143, "Provideo PV143D" },
228 { 0x1460aa00, BTTV_PV150, "Provideo PV150A-1" },
229 { 0x1461aa01, BTTV_PV150, "Provideo PV150A-2" },
230 { 0x1462aa02, BTTV_PV150, "Provideo PV150A-3" },
231 { 0x1463aa03, BTTV_PV150, "Provideo PV150A-4" },
233 { 0x1464aa04, BTTV_PV150, "Provideo PV150B-1" },
234 { 0x1465aa05, BTTV_PV150, "Provideo PV150B-2" },
235 { 0x1466aa06, BTTV_PV150, "Provideo PV150B-3" },
236 { 0x1467aa07, BTTV_PV150, "Provideo PV150B-4" },
238 { 0xa132ff00, BTTV_IVC100, "IVC-100" },
239 { 0xa1550000, BTTV_IVC200, "IVC-200" },
240 { 0xa1550001, BTTV_IVC200, "IVC-200" },
241 { 0xa1550002, BTTV_IVC200, "IVC-200" },
242 { 0xa1550003, BTTV_IVC200, "IVC-200" },
243 { 0xa1550100, BTTV_IVC200, "IVC-200G" },
244 { 0xa1550101, BTTV_IVC200, "IVC-200G" },
245 { 0xa1550102, BTTV_IVC200, "IVC-200G" },
246 { 0xa1550103, BTTV_IVC200, "IVC-200G" },
247 { 0xa182ff00, BTTV_IVC120, "IVC-120G" },
248 { 0xa182ff01, BTTV_IVC120, "IVC-120G" },
249 { 0xa182ff02, BTTV_IVC120, "IVC-120G" },
250 { 0xa182ff03, BTTV_IVC120, "IVC-120G" },
251 { 0xa182ff04, BTTV_IVC120, "IVC-120G" },
252 { 0xa182ff05, BTTV_IVC120, "IVC-120G" },
253 { 0xa182ff06, BTTV_IVC120, "IVC-120G" },
254 { 0xa182ff07, BTTV_IVC120, "IVC-120G" },
255 { 0xa182ff08, BTTV_IVC120, "IVC-120G" },
256 { 0xa182ff09, BTTV_IVC120, "IVC-120G" },
257 { 0xa182ff0a, BTTV_IVC120, "IVC-120G" },
258 { 0xa182ff0b, BTTV_IVC120, "IVC-120G" },
259 { 0xa182ff0c, BTTV_IVC120, "IVC-120G" },
260 { 0xa182ff0d, BTTV_IVC120, "IVC-120G" },
261 { 0xa182ff0e, BTTV_IVC120, "IVC-120G" },
262 { 0xa182ff0f, BTTV_IVC120, "IVC-120G" },
264 { 0x41424344, BTTV_GRANDTEC, "GrandTec Multi Capture" },
265 { 0x01020304, BTTV_XGUARD, "Grandtec Grand X-Guard" },
267 { 0x18501851, BTTV_CHRONOS_VS2, "FlyVideo 98 (LR50)/ Chronos Video Shuttle II" },
268 { 0x18511851, BTTV_FLYVIDEO98EZ, "FlyVideo 98EZ (LR51)/ CyberMail AV" },
269 { 0x18521852, BTTV_TYPHOON_TVIEW, "FlyVideo 98FM (LR50)/ Typhoon TView TV/FM Tuner" },
270 { 0x41a0a051, BTTV_FLYVIDEO_98FM, "Lifeview FlyVideo 98 LR50 Rev Q" },
271 { 0x18501f7f, BTTV_FLYVIDEO_98, "Lifeview Flyvideo 98" },
273 { 0x010115cb, BTTV_GMV1, "AG GMV1" },
274 { 0x010114c7, BTTV_MODTEC_205, "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV" },
276 { 0x10b42636, BTTV_HAUPPAUGE878, "STB ???" },
277 { 0x217d6606, BTTV_WINFAST2000, "Leadtek WinFast TV 2000" },
278 { 0xfff6f6ff, BTTV_WINFAST2000, "Leadtek WinFast TV 2000" },
279 { 0x03116000, BTTV_SENSORAY311, "Sensoray 311" },
280 { 0x00790e11, BTTV_WINDVR, "Canopus WinDVR PCI" },
281 { 0xa0fca1a0, BTTV_ZOLTRIX, "Face to Face Tvmax" },
282 { 0x20007063, BTTV_PC_HDTV, "pcHDTV HD-2000 TV"},
283 { 0x82b2aa6a, BTTV_SIMUS_GVC1100, "SIMUS GVC1100" },
284 { 0x146caa0c, BTTV_PV951, "ituner spectra8" },
285 { 0x200a1295, BTTV_PXC200, "ImageNation PXC200A" },
287 { 0x40111554, BTTV_PV_BT878P_9B, "Prolink Pixelview PV-BT" },
288 { 0x17de0a01, BTTV_KWORLD, "Mecer TV/FM/Video Tuner" },
290 { 0x01051805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #1" },
291 { 0x01061805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #2" },
292 { 0x01071805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #3" },
293 { 0x01081805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #4" },
295 // likely broken, vendor id doesn't match the other magic views ...
296 //{ 0xa0fca04f, BTTV_MAGICTVIEW063, "Guillemot Maxi TV Video 3" },
298 // DVB cards (using pci function .1 for mpeg data xfer)
299 { 0x01010071, BTTV_NEBULA_DIGITV, "Nebula Electronics DigiTV" },
300 { 0x07611461, BTTV_NEBULA_DIGITV, "AverMedia AverTV DVB-T" },
301 { 0x002611bd, BTTV_TWINHAN_DST, "Pinnacle PCTV SAT CI" },
302 { 0x00011822, BTTV_TWINHAN_DST, "Twinhan VisionPlus DVB-T" },
303 { 0xfc00270f, BTTV_TWINHAN_DST, "ChainTech digitop DST-1000 DVB-S" },
304 { 0x07711461, BTTV_AVDVBT_771, "AVermedia DVB-T 771" },
309 /* ----------------------------------------------------------------------- */
310 /* array with description for bt848 / bt878 tv/grabber cards */
312 struct tvcard bttv_tvcards[] = {
314 /* ---- card 0x00 ---------------------------------- */
315 .name = " *** UNKNOWN/GENERIC *** ",
320 .muxsel = { 2, 3, 1, 0},
329 .muxsel = { 2, 3, 1, 1},
330 .audiomux = { 2, 0, 0, 0, 10},
334 .name = "Hauppauge (bt848)",
340 .muxsel = { 2, 3, 1, 1},
341 .audiomux = { 0, 1, 2, 3, 4},
345 .name = "STB, Gateway P/N 6000699 (bt848)",
351 .muxsel = { 2, 3, 1, 1},
352 .audiomux = { 4, 0, 2, 3, 1},
355 .tuner_type = TUNER_PHILIPS_NTSC,
360 /* ---- card 0x04 ---------------------------------- */
361 .name = "Intel Create and Share PCI/ Smart Video Recorder III",
367 .muxsel = { 2, 3, 1, 1},
372 .name = "Diamond DTV2000",
378 .muxsel = { 2, 3, 1, 0},
379 .audiomux = { 0, 1, 0, 1, 3},
383 .name = "AVerMedia TVPhone",
388 .muxsel = { 2, 3, 1, 1},
390 .audiomux = { 0x0c, 0x04, 0x08, 0x04, 0},
391 /* 0x04 for some cards ?? */
394 .audio_hook = avermedia_tvphone_audio,
397 .name = "MATRIX-Vision MV-Delta",
403 .muxsel = { 2, 3, 1, 0, 0},
409 /* ---- card 0x08 ---------------------------------- */
410 .name = "Lifeview FlyVideo II (Bt848) LR26 / MAXI TV Video PCI2 LR26",
416 .muxsel = { 2, 3, 1, 1},
417 .audiomux = { 0, 0xc00, 0x800, 0x400, 0xc00, 0},
422 .name = "IMS/IXmicro TurboTV",
428 .muxsel = { 2, 3, 1, 1},
429 .audiomux = { 1, 1, 2, 3, 0},
432 .tuner_type = TUNER_TEMIC_PAL,
434 .name = "Hauppauge (bt878)",
439 .gpiomask = 0x0f, /* old: 7 */
440 .muxsel = { 2, 0, 1, 1},
441 .audiomux = { 0, 1, 2, 3, 4},
446 .name = "MIRO PCTV pro",
452 .muxsel = { 2, 3, 1, 1},
453 .audiomux = { 0x20001,0x10001, 0, 0,10},
458 /* ---- card 0x0c ---------------------------------- */
459 .name = "ADS Technologies Channel Surfer TV (bt848)",
465 .muxsel = { 2, 3, 1, 1},
466 .audiomux = { 13, 14, 11, 7, 0, 0},
470 .name = "AVerMedia TVCapture 98",
476 .muxsel = { 2, 3, 1, 1},
477 .audiomux = { 13, 14, 11, 7, 0, 0},
481 .tuner_type = TUNER_PHILIPS_PAL,
482 .audio_hook = avermedia_tv_stereo_audio,
484 .name = "Aimslab Video Highway Xtreme (VHX)",
490 .muxsel = { 2, 3, 1, 1},
491 .audiomux = { 0, 2, 1, 3, 4}, /* old: { 0, 1, 2, 3, 4} */
496 .name = "Zoltrix TV-Max",
502 .muxsel = { 2, 3, 1, 1},
503 .audiomux = {0 , 0, 1 , 0, 10},
508 /* ---- card 0x10 ---------------------------------- */
509 .name = "Prolink Pixelview PlayTV (bt878)",
514 .gpiomask = 0x01fe00,
515 .muxsel = { 2, 3, 1, 1},
518 .audiomux = { 0x01c000, 0, 0x018000, 0x014000, 0x002000, 0 },
520 // 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru>
521 .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 },
527 .name = "Leadtek WinView 601",
532 .gpiomask = 0x8300f8,
533 .muxsel = { 2, 3, 1, 1,0},
534 .audiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007},
537 .audio_hook = winview_audio,
540 .name = "AVEC Intercapture",
546 .muxsel = {2, 3, 1, 1},
547 .audiomux = {1, 0, 0, 0, 0},
551 .name = "Lifeview FlyVideo II EZ /FlyKit LR38 Bt848 (capture only)",
556 .gpiomask = 0x8dff00,
557 .muxsel = { 2, 3, 1, 1},
563 /* ---- card 0x14 ---------------------------------- */
564 .name = "CEI Raffles Card",
569 .muxsel = {2, 3, 1, 1},
572 .name = "Lifeview FlyVideo 98/ Lucky Star Image World ConferenceTV LR50",
574 .audio_inputs = 2, // tuner, line in
578 .muxsel = { 2, 3, 1, 1},
579 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800},
581 .tuner_type = TUNER_PHILIPS_PAL_I,
583 .name = "Askey CPH050/ Phoebe Tv Master + FM",
589 .muxsel = { 2, 3, 1, 1},
590 .audiomux = {0, 1, 0x800, 0x400, 0xc00, 0},
595 .name = "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV, bt878",
601 .muxsel = { 2, 3, -1 },
602 .digital_mode = DIGITAL_MODE_CAMERA,
603 .audiomux = { 0, 0, 0, 0, 0 },
606 .tuner_type = TUNER_ALPS_TSBB5_PAL_I,
609 /* ---- card 0x18 ---------------------------------- */
610 .name = "Askey CPH05X/06X (bt878) [many vendors]",
616 .muxsel = { 2, 3, 1, 1},
617 .audiomux = {0x400, 0x400, 0x400, 0x400, 0xc00},
623 .name = "Terratec TerraTV+ Version 1.0 (Bt848)/ Terra TValue Version 1.0/ Vobis TV-Boostar",
628 .gpiomask = 0x1f0fff,
629 .muxsel = { 2, 3, 1, 1},
630 .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000},
632 .tuner_type = TUNER_PHILIPS_PAL,
633 .audio_hook = terratv_audio,
635 .name = "Hauppauge WinCam newer (bt878)",
641 .muxsel = { 2, 0, 1, 1},
642 .audiomux = { 0, 1, 2, 3, 4},
646 .name = "Lifeview FlyVideo 98/ MAXI TV Video PCI2 LR50",
652 .muxsel = { 2, 3, 1, 1},
653 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800},
655 .tuner_type = TUNER_PHILIPS_SECAM,
658 /* ---- card 0x1c ---------------------------------- */
659 .name = "Terratec TerraTV+ Version 1.1 (bt878)",
664 .gpiomask = 0x1f0fff,
665 .muxsel = { 2, 3, 1, 1},
666 .audiomux = { 0x20000, 0x30000, 0x10000, 0x00000, 0x40000},
668 .tuner_type = TUNER_PHILIPS_PAL,
669 .audio_hook = terratv_audio,
671 External 20 pin connector (for Active Radio Upgrade board)
677 gpio05: om5610-stereo
681 gpio09+10: nIOR, nSEL ?? (bt878)
685 gpio16: u2-A0 (1st 4052bt)
688 gpio19: u4-A0 (2nd 4052)
692 00000 : Cdrom (internal audio input)
693 10000 : ext. Video audio input
702 /* Jannik Fritsch <jannik@techfak.uni-bielefeld.de> */
703 .name = "Imagenation PXC200",
707 .svhs = 1, /* was: 4 */
709 .muxsel = { 2, 3, 1, 0, 0},
713 .muxsel_hook = PXC200_muxsel,
716 .name = "Lifeview FlyVideo 98 LR50",
721 .gpiomask = 0x1800, //0x8dfe00
722 .muxsel = { 2, 3, 1, 1},
723 .audiomux = { 0, 0x0800, 0x1000, 0x1000, 0x1800, 0 },
727 .name = "Formac iProTV, Formac ProTV I (bt848)",
733 .muxsel = { 2, 3, 1, 1},
734 .audiomux = { 1, 0, 0, 0, 0 },
736 .tuner_type = TUNER_PHILIPS_PAL,
739 /* ---- card 0x20 ---------------------------------- */
740 .name = "Intel Create and Share PCI/ Smart Video Recorder III",
746 .muxsel = { 2, 3, 1, 1},
751 .name = "Terratec TerraTValue Version Bt878",
756 .gpiomask = 0xffff00,
757 .muxsel = { 2, 3, 1, 1},
758 .audiomux = { 0x500, 0, 0x300, 0x900, 0x900},
761 .tuner_type = TUNER_PHILIPS_PAL,
763 .name = "Leadtek WinFast 2000/ WinFast 2000 XP",
768 .muxsel = { 2, 3, 1, 1, 0}, // TV, CVid, SVid, CVid over SVid connector
770 .gpiomask = 0xc33000,
771 .audiomux = { 0x422000,0x1000,0x0000,0x620000,0x800000 },
773 /* Alexander Varakin <avarakin@hotmail.com> [stereo version] */
774 .gpiomask = 0xb33000,
775 .audiomux = { 0x122000,0x1000,0x0000,0x620000,0x800000 },
777 /* Audio Routing for "WinFast 2000 XP" (no tv stereo !)
778 gpio23 -- hef4052:nEnable (0x800000)
781 0x0000: external audio
785 Note: There exists another variant "Winfast 2000" with tv stereo !?
786 Note: eeprom only contains FF and pci subsystem id 107d:6606
791 .tuner_type = 5, // default for now, gpio reads BFFF06 for Pal bg+dk
792 .audio_hook = winfast2000_audio,
795 .name = "Lifeview FlyVideo 98 LR50 / Chronos Video Shuttle II",
801 .muxsel = { 2, 3, 1, 1},
802 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800},
807 /* ---- card 0x24 ---------------------------------- */
808 .name = "Lifeview FlyVideo 98FM LR50 / Typhoon TView TV/FM Tuner",
814 .muxsel = { 2, 3, 1, 1},
815 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 },
820 .name = "Prolink PixelView PlayTV pro",
826 .muxsel = { 2, 3, 1, 1 },
827 .audiomux = { 0x21, 0x20, 0x24, 0x2c, 0x29, 0x29 },
832 .name = "Askey CPH06X TView99",
837 .gpiomask = 0x551e00,
838 .muxsel = { 2, 3, 1, 0},
839 .audiomux = { 0x551400, 0x551200, 0, 0, 0x551c00, 0x551200 },
845 .name = "Pinnacle PCTV Studio/Rave",
850 .gpiomask = 0x03000F,
851 .muxsel = { 2, 3, 1, 1},
852 .audiomux = { 2, 0xd0001, 0, 0, 1},
858 /* ---- card 0x28 ---------------------------------- */
859 .name = "STB TV PCI FM, Gateway P/N 6000704 (bt878), 3Dfx VoodooTV 100",
865 .muxsel = { 2, 3, 1, 1},
866 .audiomux = { 4, 0, 2, 3, 1},
869 .tuner_type = TUNER_PHILIPS_NTSC,
873 .name = "AVerMedia TVPhone 98",
879 .muxsel = { 2, 3, 1, 1},
880 .audiomux = { 13, 4, 11, 7, 0, 0},
885 .audio_hook = avermedia_tvphone_audio,
887 .name = "ProVideo PV951", /* pic16c54 */
893 .muxsel = { 2, 3, 1, 1},
894 .audiomux = { 0, 0, 0, 0, 0},
900 .name = "Little OnAir TV",
906 .muxsel = {2, 3, 1, 1},
907 .audiomux = {0xff9ff6, 0xff9ff6, 0xff1ff7, 0, 0xff3ffc},
912 /* ---- card 0x2c ---------------------------------- */
913 .name = "Sigma TVII-FM",
919 .muxsel = {2, 3, 1, 1},
920 .audiomux = {1, 1, 0, 2, 3},
925 .name = "MATRIX-Vision MV-Delta 2",
931 .muxsel = { 2, 3, 1, 0, 0},
937 .name = "Zoltrix Genie TV/FM",
942 .gpiomask = 0xbcf03f,
943 .muxsel = { 2, 3, 1, 1},
944 .audiomux = { 0xbc803f, 0xbc903f, 0xbcb03f, 0, 0xbcb03f},
949 .name = "Terratec TV/Radio+",
955 .muxsel = { 2, 3, 1, 1},
956 .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000, 0x20000 },
964 /* ---- card 0x30 ---------------------------------- */
965 .name = "Askey CPH03x/ Dynalink Magic TView",
971 .muxsel = { 2, 3, 1, 1},
972 .audiomux = {2,0,0,0,1},
977 .name = "IODATA GV-BCTV3/PCI",
982 .gpiomask = 0x010f00,
983 .muxsel = {2, 3, 0, 0},
984 .audiomux = {0x10000, 0, 0x10000, 0, 0, 0},
987 .tuner_type = TUNER_ALPS_TSHC6_NTSC,
988 .audio_hook = gvbctv3pci_audio,
990 .name = "Prolink PV-BT878P+4E / PixelView PlayTV PAK / Lenco MXTV-9578 CP",
995 .gpiomask = 0xAA0000,
996 .muxsel = { 2,3,1,1,-1 },
997 .digital_mode = DIGITAL_MODE_CAMERA,
998 .audiomux = { 0x20000, 0, 0x80000, 0x80000, 0xa8000, 0x46000 },
1001 .tuner_type = TUNER_PHILIPS_PAL_I,
1003 /* GPIO wiring: (different from Rev.4C !)
1004 GPIO17: U4.A0 (first hef4052bt)
1006 GPIO20: U5.A1 (second hef4052bt)
1008 GPIO22: BT832 Reset Line
1009 GPIO23: A5,A0, U5,nEN
1010 Note: At i2c=0x8a is a Bt832 chip, which changes to 0x88 after being reset via GPIO22
1013 .name = "Eagle Wireless Capricorn2 (bt878A)",
1019 .muxsel = { 2, 0, 1, 1},
1020 .audiomux = { 0, 1, 2, 3, 4},
1022 .tuner_type = -1 /* TUNER_ALPS_TMDH2_NTSC */,
1025 /* ---- card 0x34 ---------------------------------- */
1026 /* David Härdeman <david@2gen.com> */
1027 .name = "Pinnacle PCTV Studio Pro",
1032 .gpiomask = 0x03000F,
1033 .muxsel = { 2, 3, 1, 1},
1034 .audiomux = { 1, 0xd0001, 0, 0, 10},
1035 /* sound path (5 sources):
1036 MUX1 (mask 0x03), Enable Pin 0x08 (0=enable, 1=disable)
1039 2= Mono TV sound from Tuner
1041 MUX2 (mask 0x30000):
1043 1= FM stereo Radio from Tuner */
1048 /* Claas Langbehn <claas@bigfoot.com>,
1049 Sven Grothklags <sven@upb.de> */
1050 .name = "Typhoon TView RDS + FM Stereo / KNC1 TV Station RDS",
1056 .muxsel = { 2, 3, 1, 1},
1057 .audiomux = { 0, 0, 0x10, 8, 4 },
1060 .tuner_type = TUNER_PHILIPS_PAL,
1063 /* Tim Röstermundt <rosterm@uni-muenster.de>
1064 in de.comp.os.unix.linux.hardware:
1065 options bttv card=0 pll=1 radio=1 gpiomask=0x18e0
1066 audiomux=0x44c71f,0x44d71f,0,0x44d71f,0x44dfff
1067 options tuner type=5 */
1068 .name = "Lifeview FlyVideo 2000 /FlyVideo A2/ Lifetec LT 9415 TV [LR90]",
1074 .muxsel = { 2, 3, 1, 1},
1075 .audiomux = { 0x0000,0x0800,0x1000,0x1000,0x18e0 },
1076 /* For cards with tda9820/tda9821:
1077 0x0000: Tuner normal stereo
1078 0x0080: Tuner A2 SAP (second audio program = Zweikanalton)
1079 0x0880: Tuner A2 stereo */
1083 /* Miguel Angel Alvarez <maacruz@navegalia.com>
1084 old Easy TV BT848 version (model CPH031) */
1085 .name = "Askey CPH031/ BESTBUY Easy TV",
1091 .muxsel = { 2, 3, 1, 0},
1092 .audiomux = { 2, 0, 0, 0, 10},
1095 .tuner_type = TUNER_TEMIC_PAL,
1098 /* ---- card 0x38 ---------------------------------- */
1099 /* Gordon Heydon <gjheydon@bigfoot.com ('98) */
1100 .name = "Lifeview FlyVideo 98FM LR50",
1106 .muxsel = { 2, 3, 1, 1},
1107 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 },
1111 /* This is the ultimate cheapo capture card
1112 * just a BT848A on a small PCB!
1113 * Steve Hosgood <steve@equiinet.com> */
1114 .name = "GrandTec 'Grand Video Capture' (Bt848)",
1127 /* Daniel Herrington <daniel.herrington@home.com> */
1128 .name = "Askey CPH060/ Phoebe TV Master Only (No FM)",
1134 .muxsel = { 2, 3, 1, 1},
1135 .audiomux = { 0x400, 0x400, 0x400, 0x400, 0x800, 0x400 },
1138 .tuner_type = TUNER_TEMIC_4036FY5_NTSC,
1140 /* Matti Mottus <mottus@physic.ut.ee> */
1141 .name = "Askey CPH03x TV Capturer",
1146 .gpiomask = 0x03000F,
1147 .muxsel = { 2, 3, 1, 0},
1148 .audiomux = { 2,0,0,0,1 },
1153 /* ---- card 0x3c ---------------------------------- */
1154 /* Philip Blundell <philb@gnu.org> */
1155 .name = "Modular Technology MM100PCTV",
1161 .muxsel = { 2, 3, 1, 1},
1162 .audiomux = { 2, 0, 0, 1, 8},
1164 .tuner_type = TUNER_TEMIC_PAL,
1167 /* Adrian Cox <adrian@humboldt.co.uk */
1168 .name = "AG Electronics GMV1",
1181 /* Miguel Angel Alvarez <maacruz@navegalia.com>
1182 new Easy TV BT878 version (model CPH061)
1183 special thanks to Informatica Mieres for providing the card */
1184 .name = "Askey CPH061/ BESTBUY Easy TV (bt878)",
1190 .muxsel = { 2, 3, 1, 0},
1191 .audiomux = { 1, 0, 4, 4, 9},
1194 .tuner_type = TUNER_PHILIPS_PAL,
1196 /* Lukas Gebauer <geby@volny.cz> */
1197 .name = "ATI TV-Wonder",
1203 .muxsel = { 2, 3, 1, 0 },
1204 .audiomux = { 0xbffe, 0, 0xbfff, 0, 0xbffe},
1206 .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL,
1209 /* ---- card 0x40 ---------------------------------- */
1210 /* Lukas Gebauer <geby@volny.cz> */
1211 .name = "ATI TV-Wonder VE",
1217 .muxsel = { 2, 3, 0, 1},
1218 .audiomux = { 0, 0, 1, 0, 0},
1221 .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL,
1223 /* DeeJay <deejay@westel900.net (2000S) */
1224 .name = "Lifeview FlyVideo 2000S LR90",
1230 .muxsel = { 2, 3, 0, 1},
1231 /* Radio changed from 1e80 to 0x800 to make
1232 FlyVideo2000S in .hu happy (gm)*/
1233 /* -dk-???: set mute=0x1800 for tda9874h daughterboard */
1234 .audiomux = { 0x0000,0x0800,0x1000,0x1000,0x1800, 0x1080 },
1235 .audio_hook = fv2000s_audio,
1242 .name = "Terratec TValueRadio",
1247 .gpiomask = 0xffff00,
1248 .muxsel = { 2, 3, 1, 1},
1249 .audiomux = { 0x500, 0x500, 0x300, 0x900, 0x900},
1252 .tuner_type = TUNER_PHILIPS_PAL,
1255 /* TANAKA Kei <peg00625@nifty.com> */
1256 .name = "IODATA GV-BCTV4/PCI",
1261 .gpiomask = 0x010f00,
1262 .muxsel = {2, 3, 0, 0},
1263 .audiomux = {0x10000, 0, 0x10000, 0, 0, 0},
1266 .tuner_type = TUNER_SHARP_2U5JF5540_NTSC,
1267 .audio_hook = gvbctv3pci_audio,
1270 /* ---- card 0x44 ---------------------------------- */
1271 .name = "3Dfx VoodooTV FM (Euro), VoodooTV 200 (USA)",
1272 // try "insmod msp3400 simple=0" if you have
1273 // sound problems with this card.
1278 .gpiomask = 0x4f8a00,
1279 // 0x100000: 1=MSP enabled (0=disable again)
1280 // 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC)
1281 .audiomux = {0x947fff, 0x987fff,0x947fff,0x947fff, 0x947fff},
1282 // tvtuner, radio, external,internal, mute, stereo
1283 /* tuner, Composit, SVid, Composit-on-Svid-adapter*/
1284 .muxsel = { 2, 3 ,0 ,1},
1285 .tuner_type = TUNER_MT2032,
1289 /* Philip Blundell <pb@nexus.co.uk> */
1290 .name = "Active Imaging AIMMS",
1299 /* Tomasz Pyra <hellfire@sedez.iq.pl> */
1300 .name = "Prolink Pixelview PV-BT878P+ (Rev.4C,8E)",
1306 .muxsel = { 2, 3, 1, 1},
1307 .audiomux = { 0, 0, 11, 7, 13, 0}, // TV and Radio with same GPIO !
1313 GPIO0: U4.A0 (hef4052bt)
1315 GPIO2: U4.A1 (second hef4052bt)
1316 GPIO3: U4.nEN, U5.A0, A5.nEN
1320 .name = "Lifeview FlyVideo 98EZ (capture only) LR51",
1325 .muxsel = { 2, 3, 1, 1}, // AV1, AV2, SVHS, CVid adapter on SVHS
1330 /* ---- card 0x48 ---------------------------------- */
1331 /* Dariusz Kowalewski <darekk@automex.pl> */
1332 .name = "Prolink Pixelview PV-BT878P+9B (PlayTV Pro rev.9B FM+NICAM)",
1338 .muxsel = { 2, 3, 1, 1 },
1339 .audiomux = { 0x01, 0x00, 0x03, 0x03, 0x09, 0x02 },
1345 .audio_hook = pvbt878p9b_audio, // Note: not all cards have stereo
1346 .has_radio = 1, // Note: not all cards have radio
1353 GPIO20,22,23: R30,R29,R28
1356 /* Clay Kunz <ckunz@mail.arc.nasa.gov> */
1357 /* you must jumper JP5 for the card to work */
1358 .name = "Sensoray 311",
1364 .muxsel = { 2, 3, 1, 0, 0},
1369 /* Miguel Freitas <miguel@cetuc.puc-rio.br> */
1370 .name = "RemoteVision MX (RV605)",
1376 .gpiomask2 = 0x07ff,
1377 .muxsel = { 0x33, 0x13, 0x23, 0x43, 0xf3, 0x73, 0xe3, 0x03,
1378 0xd3, 0xb3, 0xc3, 0x63, 0x93, 0x53, 0x83, 0xa3 },
1382 .muxsel_hook = rv605_muxsel,
1384 .name = "Powercolor MTV878/ MTV878R/ MTV878F",
1389 .gpiomask = 0x1C800F, // Bit0-2: Audio select, 8-12:remote control 14:remote valid 15:remote reset
1390 .muxsel = { 2, 1, 1, },
1391 .audiomux = { 0, 1, 2, 2, 4 },
1393 .tuner_type = TUNER_PHILIPS_PAL,
1398 /* ---- card 0x4c ---------------------------------- */
1399 /* Masaki Suzuki <masaki@btree.org> */
1400 .name = "Canopus WinDVR PCI (COMPAQ Presario 3524JP, 5112JP)",
1405 .gpiomask = 0x140007,
1406 .muxsel = { 2, 3, 1, 1 },
1407 .audiomux = { 0, 1, 2, 3, 4, 0 },
1408 .tuner_type = TUNER_PHILIPS_NTSC,
1409 .audio_hook = windvr_audio,
1411 .name = "GrandTec Multi Capture Card (Bt878)",
1417 .muxsel = { 2, 3, 1, 0 },
1424 .name = "Jetway TV/Capture JW-TV878-FBK, Kworld KW-TV878RF",
1430 .muxsel = { 2, 3, 1, 1 }, // Tuner, SVid, SVHS, SVid to SVHS connector
1431 .audiomux = { 0 ,0 ,4, 4,4,4},// Yes, this tuner uses the same audio output for TV and FM radio!
1432 // This card lacks external Audio In, so we mute it on Ext. & Int.
1433 // The PCB can take a sbx1637/sbx1673, wiring unknown.
1434 // This card lacks PCI subsystem ID, sigh.
1435 // audiomux=1: lower volume, 2+3: mute
1436 // btwincap uses 0x80000/0x80003
1440 .tuner_type = 5, // Samsung TCPA9095PC27A (BG+DK), philips compatible, w/FM, stereo and
1441 // radio signal strength indicators work fine.
1444 GPIO0,1: HEF4052 A0,A1
1445 GPIO2: HEF4052 nENABLE
1447 GPIO8-13: IRDC357 data0-5 (data6 n.c. ?) [chip not present on my card]
1451 ?? : mtu8b56ep microcontroller for IR (GPIO wiring unknown)*/
1453 /* Arthur Tetzlaff-Deas, DSP Design Ltd <software@dspdesign.com> */
1454 .name = "DSP Design TCVIDEO",
1457 .muxsel = { 2, 3, 1, 0},
1462 /* ---- card 0x50 ---------------------------------- */
1463 .name = "Hauppauge WinTV PVR",
1468 .muxsel = { 2, 0, 1, 1},
1476 .name = "IODATA GV-BCTV5/PCI",
1481 .gpiomask = 0x0f0f80,
1482 .muxsel = {2, 3, 1, 0},
1483 .audiomux = {0x030000, 0x010000, 0, 0, 0x020000, 0},
1486 .tuner_type = TUNER_PHILIPS_NTSC_M,
1487 .audio_hook = gvbctv5pci_audio,
1490 .name = "Osprey 100/150 (878)", /* 0x1(2|3)-45C6-C1 */
1491 .video_inputs = 4, /* id-inputs-clock */
1495 .muxsel = { 3, 2, 0, 1 },
1502 .name = "Osprey 100/150 (848)", /* 0x04-54C0-C1 & older boards */
1507 .muxsel = { 2, 3, 1 },
1515 /* ---- card 0x54 ---------------------------------- */
1516 .name = "Osprey 101 (848)", /* 0x05-40C0-C1 */
1528 .name = "Osprey 101/151", /* 0x1(4|5)-0004-C4 */
1540 .name = "Osprey 101/151 w/ svid", /* 0x(16|17|20)-00C4-C1 */
1552 .name = "Osprey 200/201/250/251", /* 0x1(8|9|E|F)-0004-C4 */
1565 /* ---- card 0x58 ---------------------------------- */
1566 .name = "Osprey 200/250", /* 0x1(A|B)-00C4-C1 */
1578 .name = "Osprey 210/220", /* 0x1(A|B)-04C0-C1 */
1590 .name = "Osprey 500", /* 500 */
1602 .name = "Osprey 540", /* 540 */
1606 #if 0 /* TODO ... */
1607 .svhs = OSPREY540_SVID_ANALOG,
1608 .muxsel = { [OSPREY540_COMP_ANALOG] = 2,
1609 [OSPREY540_SVID_ANALOG] = 3, },
1616 #if 0 /* TODO ... */
1617 .muxsel_hook = osprey_540_muxsel,
1618 .picture_hook = osprey_540_set_picture,
1622 /* ---- card 0x5C ---------------------------------- */
1623 .name = "Osprey 2000", /* 2000 */
1633 .no_tda7432 = 1, /* must avoid, conflicts with the bt860 */
1635 /* M G Berberich <berberic@forwiss.uni-passau.de> */
1636 .name = "IDS Eagle",
1643 .muxsel = { 0, 1, 2, 3 },
1644 .muxsel_hook = eagle_muxsel,
1649 .name = "Pinnacle PCTV Sat",
1659 .audiomux = { 0, 0, 0, 0, 1 },
1660 .muxsel = { 3, 0, 1, 2},
1665 .name = "Formac ProTV II (bt878)",
1671 // TV, Comp1, Composite over SVID con, SVID
1672 .muxsel = { 2, 3, 1, 1},
1673 .audiomux = { 2, 2, 0, 0, 0 },
1676 .tuner_type = TUNER_PHILIPS_PAL,
1678 GPIO=0x00,0x01,0x03: mute (?)
1679 0x02: both TV and radio (tuner: FM1216/I)
1680 The card has onboard audio connectors labeled "cdrom" and "board",
1681 not soldered here, though unknown wiring.
1682 Card lacks: external audio in, pci subsystem id.
1686 /* ---- card 0x60 ---------------------------------- */
1693 .muxsel = { 2, 3, 1, 1},
1694 .audiomux = { 0, 1, 2, 3, 4},
1699 .name = "Euresys Picolo",
1708 .muxsel = { 2, 0, 1},
1711 /* Luc Van Hoeylandt <luc@e-magic.be> */
1712 .name = "ProVideo PV150", /* 0x4f */
1725 /* Hiroshi Takekawa <sian@big.or.jp> */
1726 /* This card lacks subsystem ID */
1727 .name = "AD-TVK503", /* 0x63 */
1732 .gpiomask = 0x001e8007,
1733 .muxsel = { 2, 3, 1, 0 },
1734 /* Tuner, Radio, external, internal, off, on */
1735 .audiomux = { 0x08, 0x0f, 0x0a, 0x08, 0x0f, 0x08 },
1740 .audio_hook = adtvk503_audio,
1743 /* ---- card 0x64 ---------------------------------- */
1744 .name = "Hercules Smart TV Stereo",
1750 .muxsel = { 2, 3, 1, 1 },
1756 - card lacks subsystem ID
1757 - stereo variant w/ daughter board with tda9874a @0xb0
1759 always from tda9874 independent of GPIO (?)
1760 external line in: unknown
1761 - Other chips: em78p156elp @ 0x96 (probably IR remote control)
1762 hef4053 (instead 4052) for unknown function
1765 .name = "Pace TV & Radio Card",
1770 .muxsel = { 2, 3, 1, 1}, // Tuner, CVid, SVid, CVid over SVid connector
1777 /* Bt878, Bt832, FI1246 tuner; no pci subsystem id
1778 only internal line out: (4pin header) RGGL
1779 Radio must be decoded by msp3410d (not routed through)*/
1780 // .digital_mode = DIGITAL_MODE_CAMERA, // todo!
1782 /* Chris Willing <chris@vislab.usyd.edu.au> */
1793 .name = "Grand X-Guard / Trust 814PCI",
1800 .muxsel = { 2,2,2,2, 3,3,3,3, 1,1,1,1, 0,0,0,0 },
1801 .muxsel_hook = xguard_muxsel,
1808 /* ---- card 0x68 ---------------------------------- */
1809 .name = "Nebula Electronics DigiTV",
1813 .muxsel = { 2, 3, 1, 0},
1822 /* Jorge Boncompte - DTI2 <jorge@dti2.net> */
1823 .name = "ProVideo PV143",
1829 .muxsel = { 2, 3, 1, 0 },
1836 /* M.Klahr@phytec.de */
1837 .name = "PHYTEC VD-009-X1 MiniDIN (bt878)",
1840 .tuner = -1, /* card has no tuner */
1843 .muxsel = { 2, 3, 1, 0},
1844 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1849 .name = "PHYTEC VD-009-X1 Combi (bt878)",
1852 .tuner = -1, /* card has no tuner */
1855 .muxsel = { 2, 3, 1, 1},
1856 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1862 /* ---- card 0x6c ---------------------------------- */
1863 .name = "PHYTEC VD-009 MiniDIN (bt878)",
1866 .tuner = -1, /* card has no tuner */
1869 .gpiomask2 = 0x03, /* gpiomask2 defines the bits used to switch audio
1870 via the upper nibble of muxsel. here: used for
1871 xternal video-mux */
1872 .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x00 },
1873 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1878 .name = "PHYTEC VD-009 Combi (bt878)",
1881 .tuner = -1, /* card has no tuner */
1884 .gpiomask2 = 0x03, /* gpiomask2 defines the bits used to switch audio
1885 via the upper nibble of muxsel. here: used for
1886 xternal video-mux */
1887 .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x01 },
1888 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1900 .muxsel = { 2, 3, 1, 0 },
1903 /* IVC-120G - Alan Garfield <alan@fromorbit.com> */
1906 .audio_inputs = 0, /* card has no audio */
1907 .tuner = -1, /* card has no tuner */
1909 .svhs = -1, /* card has no svhs */
1915 .muxsel = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
1916 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10 },
1917 .muxsel_hook = ivc120_muxsel,
1921 /* ---- card 0x70 ---------------------------------- */
1922 .name = "pcHDTV HD-2000 TV",
1927 .muxsel = { 2, 3, 1, 0},
1928 .tuner_type = TUNER_PHILIPS_ATSC,
1930 .name = "Twinhan DST + clones",
1934 .tuner_type = TUNER_ABSENT,
1938 .name = "Winfast VC100",
1942 .tuner = -1, // no tuner
1943 .muxsel = { 3, 1, 1, 3}, // Vid In, SVid In, Vid over SVid in connector
1947 .tuner_type = TUNER_ABSENT,
1951 .name = "Teppro TEV-560/InterVision IV-560",
1957 .muxsel = { 2, 3, 1, 1},
1958 .audiomux = { 1, 1, 1, 1, 0},
1960 .tuner_type = TUNER_PHILIPS_PAL,
1964 /* ---- card 0x74 ---------------------------------- */
1965 .name = "SIMUS GVC1100",
1972 .muxsel = { 2, 2, 2, 2},
1974 .muxsel_hook = gvc1100_muxsel,
1976 /* Carlos Silva r3pek@r3pek.homelinux.org || card 0x75 */
1977 .name = "NGS NGSTV+",
1981 .gpiomask = 0x008007,
1982 .muxsel = {2, 3, 0, 0},
1983 .audiomux = {0, 0, 0, 0, 0x000003, 0},
1985 .tuner_type = TUNER_PHILIPS_PAL,
1988 /* http://linuxmedialabs.com */
1990 .video_inputs = 4, /* IN1,IN2,IN3,IN4 */
1994 .muxsel = { 2, 3, 1, 0 },
2000 /* Helmroos Harri <harri.helmroos@pp.inet.fi> */
2001 .name = "Tekram M205 PRO",
2005 .tuner_type = TUNER_PHILIPS_PAL,
2009 .muxsel = { 2, 3, 1},
2010 .audiomux = { 0x68, 0x68, 0x61, 0x61, 0x00 },
2014 /* ---- card 0x78 ---------------------------------- */
2015 /* Javier Cendan Ares <jcendan@lycos.es> */
2016 /* bt878 TV + FM without subsystem ID */
2017 .name = "Conceptronic CONTVFMi",
2022 .gpiomask = 0x008007,
2023 .muxsel = { 2, 3, 1, 1 },
2024 .audiomux = { 0, 1, 2, 2, 3 },
2027 .tuner_type = TUNER_PHILIPS_PAL,
2031 /*Eric DEBIEF <debief@telemsa.com>*/
2032 /*EURESYS Picolo Tetra : 4 Conexant Fusion 878A, no audio, video input set with analog multiplexers GPIO controled*/
2033 /* adds picolo_tetra_muxsel(), picolo_tetra_init(), the folowing declaration strucure, and #define BTTV_PICOLO_TETRA_CHIP*/
2035 .name = "Euresys Picolo Tetra",
2041 .gpiomask2 = 0x3C<<16,/*Set the GPIO[18]->GPIO[21] as output pin.==> drive the video inputs through analog multiplexers*/
2045 .muxsel = {2,2,2,2},/*878A input is always MUX0, see above.*/
2046 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
2049 .muxsel_hook = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/
2051 /* Spirit TV Tuner from http://spiritmodems.com.au */
2052 /* Stafford Goodsell <surge@goliath.homeunix.org> */
2053 .name = "Spirit TV Tuner",
2058 .gpiomask = 0x0000000f,
2059 .muxsel = { 2, 1, 1 },
2060 .audiomux = { 0x02, 0x00, 0x00, 0x00, 0x00},
2061 .tuner_type = TUNER_TEMIC_PAL,
2065 /* Wolfram Joost <wojo@frokaschwei.de> */
2066 .name = "AVerMedia AVerTV DVB-T 771",
2070 .tuner_type = TUNER_ABSENT,
2071 .muxsel = { 3 , 3 },
2078 #if 0 /* untested */
2083 const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards);
2085 /* ----------------------------------------------------------------------- */
2087 static unsigned char eeprom_data[256];
2092 void __devinit bttv_idcard(struct bttv *btv)
2094 unsigned int gpiobits;
2098 /* read PCI subsystem ID */
2099 pci_read_config_word(btv->c.pci, PCI_SUBSYSTEM_ID, &tmp);
2100 btv->cardid = tmp << 16;
2101 pci_read_config_word(btv->c.pci, PCI_SUBSYSTEM_VENDOR_ID, &tmp);
2104 if (0 != btv->cardid && 0xffffffff != btv->cardid) {
2105 /* look for the card */
2106 for (type = -1, i = 0; cards[i].id != 0; i++)
2107 if (cards[i].id == btv->cardid)
2112 printk(KERN_INFO "bttv%d: detected: %s [card=%d], "
2113 "PCI subsystem ID is %04x:%04x\n",
2114 btv->c.nr,cards[type].name,cards[type].cardnr,
2115 btv->cardid & 0xffff,
2116 (btv->cardid >> 16) & 0xffff);
2117 btv->c.type = cards[type].cardnr;
2120 printk(KERN_INFO "bttv%d: subsystem: %04x:%04x (UNKNOWN)\n",
2121 btv->c.nr, btv->cardid & 0xffff,
2122 (btv->cardid >> 16) & 0xffff);
2123 printk(KERN_DEBUG "please mail id, board name and "
2124 "the correct card= insmod option to kraxel@bytesex.org\n");
2128 /* let the user override the autodetected type */
2129 if (card[btv->c.nr] < bttv_num_tvcards)
2130 btv->c.type=card[btv->c.nr];
2132 /* print which card config we are using */
2133 printk(KERN_INFO "bttv%d: using: %s [card=%d,%s]\n",btv->c.nr,
2134 bttv_tvcards[btv->c.type].name, btv->c.type,
2135 card[btv->c.nr] < bttv_num_tvcards
2136 ? "insmod option" : "autodetected");
2138 /* overwrite gpio stuff ?? */
2139 if (UNSET == audioall && UNSET == audiomux[0])
2142 if (UNSET != audiomux[0]) {
2144 for (i = 0; i < 5; i++) {
2145 bttv_tvcards[btv->c.type].audiomux[i] = audiomux[i];
2146 gpiobits |= audiomux[i];
2149 gpiobits = audioall;
2150 for (i = 0; i < 5; i++) {
2151 bttv_tvcards[btv->c.type].audiomux[i] = audioall;
2154 bttv_tvcards[btv->c.type].gpiomask = (UNSET != gpiomask) ? gpiomask : gpiobits;
2155 printk(KERN_INFO "bttv%d: gpio config override: mask=0x%x, mux=",
2156 btv->c.nr,bttv_tvcards[btv->c.type].gpiomask);
2157 for (i = 0; i < 5; i++) {
2158 printk("%s0x%x", i ? "," : "", bttv_tvcards[btv->c.type].audiomux[i]);
2164 * (most) board specific initialisations goes here
2167 /* Some Modular Technology cards have an eeprom, but no subsystem ID */
2168 void identify_by_eeprom(struct bttv *btv, unsigned char eeprom_data[256])
2172 if (0 == strncmp(eeprom_data,"GET MM20xPCTV",13))
2173 type = BTTV_MODTEC_205;
2174 else if (0 == strncmp(eeprom_data+20,"Picolo",7))
2175 type = BTTV_EURESYS_PICOLO;
2176 else if (eeprom_data[0] == 0x84 && eeprom_data[2]== 0)
2177 type = BTTV_HAUPPAUGE; /* old bt848 */
2181 printk("bttv%d: detected by eeprom: %s [card=%d]\n",
2182 btv->c.nr, bttv_tvcards[btv->c.type].name, btv->c.type);
2186 static void flyvideo_gpio(struct bttv *btv)
2188 int gpio,has_remote,has_radio,is_capture_only,is_lr90,has_tda9820_tda9821;
2191 gpio_inout(0xffffff, 0);
2192 udelay(8); // without this we would see the 0x1800 mask
2194 /* FIXME: must restore OUR_EN ??? */
2196 // all cards provide GPIO info, some have an additional eeprom
2197 // LR50: GPIO coding can be found lower right CP1 .. CP9
2198 // CP9=GPIO23 .. CP1=GPIO15; when OPEN, the corresponding GPIO reads 1.
2200 // LR90: GP9=GPIO23 .. GP1=GPIO15 (right above the bt878)
2202 // lowest 3 bytes are remote control codes (no handshake needed)
2203 // xxxFFF: No remote control chip soldered
2204 // xxxF00(LR26/LR50), xxxFE0(LR90): Remote control chip (LVA001 or CF45) soldered
2205 // Note: Some bits are Audio_Mask !
2207 ttype=(gpio&0x0f0000)>>16;
2209 case 0x0: tuner=2; // NTSC, e.g. TPI8NSR11P
2211 case 0x2: tuner=39;// LG NTSC (newer TAPC series) TAPC-H701P
2213 case 0x4: tuner=5; // Philips PAL TPI8PSB02P, TPI8PSB12P, TPI8PSB12D or FI1216, FM1216
2215 case 0x6: tuner=37; // LG PAL (newer TAPC series) TAPC-G702P
2217 case 0xC: tuner=3; // Philips SECAM(+PAL) FQ1216ME or FI1216MF
2220 printk(KERN_INFO "bttv%d: FlyVideo_gpio: unknown tuner type.\n", btv->c.nr);
2223 has_remote = gpio & 0x800000;
2224 has_radio = gpio & 0x400000;
2225 // unknown 0x200000;
2226 // unknown2 0x100000;
2227 is_capture_only = !(gpio & 0x008000); //GPIO15
2228 has_tda9820_tda9821 = !(gpio & 0x004000);
2229 is_lr90 = !(gpio & 0x002000); // else LR26/LR50 (LR38/LR51 f. capture only)
2230 // gpio & 0x001000 // output bit for audio routing
2233 tuner=4; // No tuner present
2235 printk(KERN_INFO "bttv%d: FlyVideo Radio=%s RemoteControl=%s Tuner=%d gpio=0x%06x\n",
2236 btv->c.nr, has_radio? "yes":"no ", has_remote? "yes":"no ", tuner, gpio);
2237 printk(KERN_INFO "bttv%d: FlyVideo LR90=%s tda9821/tda9820=%s capture_only=%s\n",
2238 btv->c.nr, is_lr90?"yes":"no ", has_tda9820_tda9821?"yes":"no ",
2239 is_capture_only?"yes":"no ");
2241 if(tuner!= -1) // only set if known tuner autodetected, else let insmod option through
2242 btv->tuner_type = tuner;
2243 btv->has_radio = has_radio;
2245 // LR90 Audio Routing is done by 2 hef4052, so Audio_Mask has 4 bits: 0x001c80
2246 // LR26/LR50 only has 1 hef4052, Audio_Mask 0x000c00
2247 // Audio options: from tuner, from tda9821/tda9821(mono,stereo,sap), from tda9874, ext., mute
2248 if(has_tda9820_tda9821) btv->audio_hook = lt9415_audio;
2249 //todo: if(has_tda9874) btv->audio_hook = fv2000s_audio;
2252 int miro_tunermap[] = { 0,6,2,3, 4,5,6,0, 3,0,4,5, 5,2,16,1,
2253 14,2,17,1, 4,1,4,3, 1,2,16,1, 4,4,4,4 };
2254 int miro_fmtuner[] = { 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1,
2255 1,1,1,1, 1,1,1,0, 0,0,0,0, 0,1,0,0 };
2257 static void miro_pinnacle_gpio(struct bttv *btv)
2262 gpio_inout(0xffffff, 0);
2264 id = ((gpio>>10) & 63) -1;
2265 msp = bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx");
2267 btv->tuner_type = miro_tunermap[id];
2268 if (0 == (gpio & 0x20)) {
2270 if (!miro_fmtuner[id]) {
2271 btv->has_matchbox = 1;
2272 btv->mbox_we = (1<<6);
2273 btv->mbox_most = (1<<7);
2274 btv->mbox_clk = (1<<8);
2275 btv->mbox_data = (1<<9);
2276 btv->mbox_mask = (1<<6)|(1<<7)|(1<<8)|(1<<9);
2282 if (btv->c.type == BTTV_MIRO)
2283 btv->c.type = BTTV_MIROPRO;
2284 if (btv->c.type == BTTV_PINNACLE)
2285 btv->c.type = BTTV_PINNACLEPRO;
2288 "bttv%d: miro: id=%d tuner=%d radio=%s stereo=%s\n",
2289 btv->c.nr, id+1, btv->tuner_type,
2290 !btv->has_radio ? "no" :
2291 (btv->has_matchbox ? "matchbox" : "fmtuner"),
2292 (-1 == msp) ? "no" : "yes");
2294 /* new cards with microtune tuner */
2299 info = "PAL / mono";
2302 info = "PAL+SECAM / stereo";
2306 info = "NTSC / stereo";
2310 info = "PAL+SECAM / mono";
2313 info = "NTSC / mono";
2316 info = "NTSC / stereo";
2319 info = "PAL / stereo";
2322 info = "oops: unknown card";
2326 btv->c.type = BTTV_PINNACLEPRO;
2328 "bttv%d: pinnacle/mt: id=%d info=\"%s\" radio=%s\n",
2329 btv->c.nr, id, info, btv->has_radio ? "yes" : "no");
2330 btv->tuner_type = 33;
2331 btv->pinnacle_id = id;
2335 /* GPIO21 L: Buffer aktiv, H: Buffer inaktiv */
2336 #define LM1882_SYNC_DRIVE 0x200000L
2338 static void init_ids_eagle(struct bttv *btv)
2340 gpio_inout(0xffffff,0xFFFF37);
2341 gpio_write(0x200020);
2343 /* flash strobe inverter ?! */
2344 gpio_write(0x200024);
2346 /* switch sync drive off */
2347 gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE);
2349 /* set BT848 muxel to 2 */
2350 btaor((2)<<5, ~(2<<5), BT848_IFORM);
2353 /* Muxsel helper for the IDS Eagle.
2354 * the eagles does not use the standard muxsel-bits but
2355 * has its own multiplexer */
2356 static void eagle_muxsel(struct bttv *btv, unsigned int input)
2358 btaor((2)<<5, ~(3<<5), BT848_IFORM);
2359 gpio_bits(3,bttv_tvcards[btv->c.type].muxsel[input&7]);
2363 /* wake chroma ADC */
2364 btand(~BT848_ADC_C_SLEEP, BT848_ADC);
2365 /* set to YC video */
2366 btor(BT848_CONTROL_COMP, BT848_E_CONTROL);
2367 btor(BT848_CONTROL_COMP, BT848_O_CONTROL);
2370 /* set chroma ADC to sleep */
2371 btor(BT848_ADC_C_SLEEP, BT848_ADC);
2372 /* set to composite video */
2373 btand(~BT848_CONTROL_COMP, BT848_E_CONTROL);
2374 btand(~BT848_CONTROL_COMP, BT848_O_CONTROL);
2377 /* switch sync drive off */
2378 gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE);
2381 static void gvc1100_muxsel(struct bttv *btv, unsigned int input)
2383 static const int masks[] = {0x30, 0x01, 0x12, 0x23};
2384 gpio_write(masks[input%4]);
2387 /* LMLBT4x initialization - to allow access to GPIO bits for sensors input and
2390 GPIObit | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
2391 assignment | TI | O3|INx| O2| O1|IN4|IN3|IN2|IN1| | |
2393 IN - sensor inputs, INx - sensor inputs and TI XORed together
2394 O1,O2,O3 - alarm outputs (relays)
2396 OUT ENABLE 1 1 0 . 1 1 0 0 . 0 0 0 0 = 0x6C0
2400 static void init_lmlbt4x(struct bttv *btv)
2402 printk(KERN_DEBUG "LMLBT4x init\n");
2403 btwrite(0x000000, BT848_GPIO_REG_INP);
2404 gpio_inout(0xffffff, 0x0006C0);
2405 gpio_write(0x000000);
2409 /* ----------------------------------------------------------------------- */
2411 void bttv_reset_audio(struct bttv *btv)
2414 * BT878A has a audio-reset register.
2415 * 1. This register is an audio reset function but it is in
2416 * function-0 (video capture) address space.
2417 * 2. It is enough to do this once per power-up of the card.
2418 * 3. There is a typo in the Conexant doc -- it is not at
2419 * 0x5B, but at 0x058. (B is an odd-number, obviously a typo!).
2420 * --//Shrikumar 030609
2426 printk("bttv%d: BT878A ARESET\n",btv->c.nr);
2427 btwrite((1<<7), 0x058);
2432 /* initialization part one -- before registering i2c bus */
2433 void __devinit bttv_init_card1(struct bttv *btv)
2435 switch (btv->c.type) {
2436 case BTTV_HAUPPAUGE:
2437 case BTTV_HAUPPAUGE878:
2438 boot_msp34xx(btv,5);
2440 case BTTV_VOODOOTV_FM:
2441 boot_msp34xx(btv,20);
2443 case BTTV_AVERMEDIA98:
2444 boot_msp34xx(btv,11);
2446 case BTTV_HAUPPAUGEPVR:
2449 case BTTV_TWINHAN_DST:
2450 case BTTV_AVDVBT_771:
2451 btv->use_i2c_hw = 1;
2456 /* initialization part two -- after registering i2c bus */
2457 void __devinit bttv_init_card2(struct bttv *btv)
2459 btv->tuner_type = -1;
2461 if (BTTV_UNKNOWN == btv->c.type) {
2462 bttv_readee(btv,eeprom_data,0xa0);
2463 identify_by_eeprom(btv,eeprom_data);
2466 switch (btv->c.type) {
2470 case BTTV_PINNACLEPRO:
2472 miro_pinnacle_gpio(btv);
2474 case BTTV_FLYVIDEO_98:
2476 case BTTV_LIFE_FLYKIT:
2478 case BTTV_TYPHOON_TVIEW:
2479 case BTTV_CHRONOS_VS2:
2480 case BTTV_FLYVIDEO_98FM:
2481 case BTTV_FLYVIDEO2000:
2482 case BTTV_FLYVIDEO98EZ:
2483 case BTTV_CONFERENCETV:
2484 case BTTV_LIFETEC_9415:
2487 case BTTV_HAUPPAUGE:
2488 case BTTV_HAUPPAUGE878:
2489 case BTTV_HAUPPAUGEPVR:
2490 /* pick up some config infos from the eeprom */
2491 bttv_readee(btv,eeprom_data,0xa0);
2492 hauppauge_eeprom(btv);
2494 case BTTV_AVERMEDIA98:
2495 case BTTV_AVPHONE98:
2496 bttv_readee(btv,eeprom_data,0xa0);
2497 avermedia_eeprom(btv);
2502 case BTTV_PICOLO_TETRA_CHIP:
2503 picolo_tetra_init(btv);
2507 btv->has_matchbox = 1;
2508 btv->mbox_we = 0x20;
2510 btv->mbox_clk = 0x08;
2511 btv->mbox_data = 0x10;
2512 btv->mbox_mask = 0x38;
2514 case BTTV_VOBIS_BOOSTAR:
2516 terratec_active_radio_upgrade(btv);
2518 case BTTV_MAGICTVIEW061:
2519 if (btv->cardid == 0x3002144f) {
2521 printk("bttv%d: radio detected by subsystem id (CPH05x)\n",btv->c.nr);
2525 if (btv->cardid == 0x3060121a) {
2526 /* Fix up entry for 3DFX VoodooTV 100,
2527 which is an OEM STB card variant. */
2529 btv->tuner_type=TUNER_TEMIC_NTSC;
2532 case BTTV_OSPREY1x0:
2533 case BTTV_OSPREY1x0_848:
2534 case BTTV_OSPREY101_848:
2535 case BTTV_OSPREY1x1:
2536 case BTTV_OSPREY1x1_SVID:
2537 case BTTV_OSPREY2xx:
2538 case BTTV_OSPREY2x0_SVID:
2539 case BTTV_OSPREY2x0:
2540 case BTTV_OSPREY500:
2541 case BTTV_OSPREY540:
2542 case BTTV_OSPREY2000:
2543 bttv_readee(btv,eeprom_data,0xa0);
2546 case BTTV_IDS_EAGLE:
2547 init_ids_eagle(btv);
2549 case BTTV_MODTEC_205:
2550 bttv_readee(btv,eeprom_data,0xa0);
2558 /* pll configuration */
2559 if (!(btv->id==848 && btv->revision==0x11)) {
2560 /* defaults from card list */
2561 if (PLL_28 == bttv_tvcards[btv->c.type].pll) {
2562 btv->pll.pll_ifreq=28636363;
2563 btv->pll.pll_crystal=BT848_IFORM_XT0;
2565 if (PLL_35 == bttv_tvcards[btv->c.type].pll) {
2566 btv->pll.pll_ifreq=35468950;
2567 btv->pll.pll_crystal=BT848_IFORM_XT1;
2569 /* insmod options can override */
2570 switch (pll[btv->c.nr]) {
2572 btv->pll.pll_crystal = 0;
2573 btv->pll.pll_ifreq = 0;
2574 btv->pll.pll_ofreq = 0;
2576 case 1: /* 28 MHz */
2578 btv->pll.pll_ifreq = 28636363;
2579 btv->pll.pll_ofreq = 0;
2580 btv->pll.pll_crystal = BT848_IFORM_XT0;
2582 case 2: /* 35 MHz */
2584 btv->pll.pll_ifreq = 35468950;
2585 btv->pll.pll_ofreq = 0;
2586 btv->pll.pll_crystal = BT848_IFORM_XT1;
2590 btv->pll.pll_current = -1;
2592 /* tuner configuration (from card list / autodetect / insmod option) */
2593 if (UNSET != bttv_tvcards[btv->c.type].tuner_type)
2594 if(UNSET == btv->tuner_type)
2595 btv->tuner_type = bttv_tvcards[btv->c.type].tuner_type;
2596 if (UNSET != tuner[btv->c.nr])
2597 btv->tuner_type = tuner[btv->c.nr];
2598 printk("bttv%d: using tuner=%d\n",btv->c.nr,btv->tuner_type);
2599 if (btv->pinnacle_id != UNSET)
2600 bttv_call_i2c_clients(btv,AUDC_CONFIG_PINNACLE,
2602 if (btv->tuner_type != UNSET)
2603 bttv_call_i2c_clients(btv,TUNER_SET_TYPE,&btv->tuner_type);
2604 btv->svhs = bttv_tvcards[btv->c.type].svhs;
2605 if (svhs[btv->c.nr] != UNSET)
2606 btv->svhs = svhs[btv->c.nr];
2607 if (remote[btv->c.nr] != UNSET)
2608 btv->has_remote = remote[btv->c.nr];
2610 if (bttv_tvcards[btv->c.type].has_radio)
2612 if (bttv_tvcards[btv->c.type].has_remote)
2614 if (bttv_tvcards[btv->c.type].no_gpioirq)
2616 if (bttv_tvcards[btv->c.type].audio_hook)
2617 btv->audio_hook=bttv_tvcards[btv->c.type].audio_hook;
2619 if (bttv_tvcards[btv->c.type].digital_mode == DIGITAL_MODE_CAMERA) {
2620 /* detect Bt832 chip for quartzsight digital camera */
2621 if ((bttv_I2CRead(btv, I2C_BT832_ALT1, "Bt832") >=0) ||
2622 (bttv_I2CRead(btv, I2C_BT832_ALT2, "Bt832") >=0))
2626 /* try to detect audio/fader chips */
2627 if (!bttv_tvcards[btv->c.type].no_msp34xx &&
2628 bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx") >=0) {
2630 request_module("msp3400");
2633 if (bttv_tvcards[btv->c.type].msp34xx_alt &&
2634 bttv_I2CRead(btv, I2C_MSP3400_ALT, "MSP34xx (alternate address)") >=0) {
2636 request_module("msp3400");
2639 if (!bttv_tvcards[btv->c.type].no_tda9875 &&
2640 bttv_I2CRead(btv, I2C_TDA9875, "TDA9875") >=0) {
2642 request_module("tda9875");
2645 if (!bttv_tvcards[btv->c.type].no_tda7432 &&
2646 bttv_I2CRead(btv, I2C_TDA7432, "TDA7432") >=0) {
2648 request_module("tda7432");
2651 if (bttv_tvcards[btv->c.type].needs_tvaudio) {
2653 request_module("tvaudio");
2657 if (btv->pinnacle_id != UNSET) {
2659 request_module("tda9887");
2661 if (btv->tuner_type != UNSET) {
2663 request_module("tuner");
2668 /* ----------------------------------------------------------------------- */
2669 /* some hauppauge specific stuff */
2671 static struct HAUPPAUGE_TUNER
2676 hauppauge_tuner[] __devinitdata =
2678 { TUNER_ABSENT, "" },
2679 { TUNER_ABSENT, "External" },
2680 { TUNER_ABSENT, "Unspecified" },
2681 { TUNER_PHILIPS_PAL, "Philips FI1216" },
2682 { TUNER_PHILIPS_SECAM, "Philips FI1216MF" },
2683 { TUNER_PHILIPS_NTSC, "Philips FI1236" },
2684 { TUNER_PHILIPS_PAL_I, "Philips FI1246" },
2685 { TUNER_PHILIPS_PAL_DK,"Philips FI1256" },
2686 { TUNER_PHILIPS_PAL, "Philips FI1216 MK2" },
2687 { TUNER_PHILIPS_SECAM, "Philips FI1216MF MK2" },
2688 { TUNER_PHILIPS_NTSC, "Philips FI1236 MK2" },
2689 { TUNER_PHILIPS_PAL_I, "Philips FI1246 MK2" },
2690 { TUNER_PHILIPS_PAL_DK,"Philips FI1256 MK2" },
2691 { TUNER_TEMIC_NTSC, "Temic 4032FY5" },
2692 { TUNER_TEMIC_PAL, "Temic 4002FH5" },
2693 { TUNER_TEMIC_PAL_I, "Temic 4062FY5" },
2694 { TUNER_PHILIPS_PAL, "Philips FR1216 MK2" },
2695 { TUNER_PHILIPS_SECAM, "Philips FR1216MF MK2" },
2696 { TUNER_PHILIPS_NTSC, "Philips FR1236 MK2" },
2697 { TUNER_PHILIPS_PAL_I, "Philips FR1246 MK2" },
2698 { TUNER_PHILIPS_PAL_DK,"Philips FR1256 MK2" },
2699 { TUNER_PHILIPS_PAL, "Philips FM1216" },
2700 { TUNER_PHILIPS_SECAM, "Philips FM1216MF" },
2701 { TUNER_PHILIPS_NTSC, "Philips FM1236" },
2702 { TUNER_PHILIPS_PAL_I, "Philips FM1246" },
2703 { TUNER_PHILIPS_PAL_DK,"Philips FM1256" },
2704 { TUNER_TEMIC_4036FY5_NTSC, "Temic 4036FY5" },
2705 { TUNER_ABSENT, "Samsung TCPN9082D" },
2706 { TUNER_ABSENT, "Samsung TCPM9092P" },
2707 { TUNER_TEMIC_4006FH5_PAL, "Temic 4006FH5" },
2708 { TUNER_ABSENT, "Samsung TCPN9085D" },
2709 { TUNER_ABSENT, "Samsung TCPB9085P" },
2710 { TUNER_ABSENT, "Samsung TCPL9091P" },
2711 { TUNER_TEMIC_4039FR5_NTSC, "Temic 4039FR5" },
2712 { TUNER_PHILIPS_FQ1216ME, "Philips FQ1216 ME" },
2713 { TUNER_TEMIC_4066FY5_PAL_I, "Temic 4066FY5" },
2714 { TUNER_PHILIPS_NTSC, "Philips TD1536" },
2715 { TUNER_PHILIPS_NTSC, "Philips TD1536D" },
2716 { TUNER_PHILIPS_NTSC, "Philips FMR1236" }, /* mono radio */
2717 { TUNER_ABSENT, "Philips FI1256MP" },
2718 { TUNER_ABSENT, "Samsung TCPQ9091P" },
2719 { TUNER_TEMIC_4006FN5_MULTI_PAL, "Temic 4006FN5" },
2720 { TUNER_TEMIC_4009FR5_PAL, "Temic 4009FR5" },
2721 { TUNER_TEMIC_4046FM5, "Temic 4046FM5" },
2722 { TUNER_TEMIC_4009FN5_MULTI_PAL_FM, "Temic 4009FN5" },
2723 { TUNER_ABSENT, "Philips TD1536D_FH_44"},
2724 { TUNER_LG_NTSC_FM, "LG TPI8NSR01F"},
2725 { TUNER_LG_PAL_FM, "LG TPI8PSB01D"},
2726 { TUNER_LG_PAL, "LG TPI8PSB11D"},
2727 { TUNER_LG_PAL_I_FM, "LG TAPC-I001D"},
2728 { TUNER_LG_PAL_I, "LG TAPC-I701D"}
2731 static void modtec_eeprom(struct bttv *btv)
2733 if( strncmp(&(eeprom_data[0x1e]),"Temic 4066 FY5",14) ==0) {
2734 btv->tuner_type=TUNER_TEMIC_4066FY5_PAL_I;
2735 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
2736 btv->c.nr,&eeprom_data[0x1e]);
2737 } else if (strncmp(&(eeprom_data[0x1e]),"Alps TSBB5",10) ==0) {
2738 btv->tuner_type=TUNER_ALPS_TSBB5_PAL_I;
2739 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
2740 btv->c.nr,&eeprom_data[0x1e]);
2741 } else if (strncmp(&(eeprom_data[0x1e]),"Philips FM1246",14) ==0) {
2742 btv->tuner_type=TUNER_PHILIPS_NTSC;
2743 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
2744 btv->c.nr,&eeprom_data[0x1e]);
2746 printk("bttv%d: Modtec: Unknown TunerString: %s\n",
2747 btv->c.nr,&eeprom_data[0x1e]);
2751 static void __devinit hauppauge_eeprom(struct bttv *btv)
2753 unsigned int blk2,tuner,radio,model;
2755 if (eeprom_data[0] != 0x84 || eeprom_data[2] != 0)
2756 printk(KERN_WARNING "bttv%d: Hauppauge eeprom: invalid\n",
2759 /* Block 2 starts after len+3 bytes header */
2760 blk2 = eeprom_data[1] + 3;
2762 /* decode + use some config infos */
2763 model = eeprom_data[12] << 8 | eeprom_data[11];
2764 tuner = eeprom_data[9];
2765 radio = eeprom_data[blk2-1] & 0x01;
2767 if (tuner < ARRAY_SIZE(hauppauge_tuner))
2768 btv->tuner_type = hauppauge_tuner[tuner].id;
2773 printk(KERN_INFO "bttv%d: Hauppauge eeprom: model=%d, "
2774 "tuner=%s (%d), radio=%s\n",
2775 btv->c.nr, model, hauppauge_tuner[tuner].name,
2776 btv->tuner_type, radio ? "yes" : "no");
2779 static int terratec_active_radio_upgrade(struct bttv *btv)
2784 btv->has_matchbox = 1;
2785 btv->mbox_we = 0x10;
2786 btv->mbox_most = 0x20;
2787 btv->mbox_clk = 0x08;
2788 btv->mbox_data = 0x04;
2789 btv->mbox_mask = 0x3c;
2791 btv->mbox_iow = 1 << 8;
2792 btv->mbox_ior = 1 << 9;
2793 btv->mbox_csel = 1 << 10;
2796 tea5757_write(btv, 5 * freq + 0x358); // write 0x1ed8
2797 if (0x1ed8 == tea5757_read(btv)) {
2798 printk("bttv%d: Terratec Active Radio Upgrade found.\n",
2801 btv->has_matchbox = 1;
2804 btv->has_matchbox = 0;
2810 /* ----------------------------------------------------------------------- */
2813 * minimal bootstrap for the WinTV/PVR -- upload altera firmware.
2815 * The hcwamc.rbf firmware file is on the Hauppauge driver CD. Have
2816 * a look at Pvr/pvr45xxx.EXE (self-extracting zip archive, can be
2817 * unpacked with unzip).
2819 #define PVR_GPIO_DELAY 10
2821 #define BTTV_ALT_DATA 0x000001
2822 #define BTTV_ALT_DCLK 0x100000
2823 #define BTTV_ALT_NCONFIG 0x800000
2825 static int __devinit pvr_altera_load(struct bttv *btv, u8 *micro, u32 microlen)
2831 gpio_inout(0xffffff,BTTV_ALT_DATA|BTTV_ALT_DCLK|BTTV_ALT_NCONFIG);
2833 udelay(PVR_GPIO_DELAY);
2835 gpio_write(BTTV_ALT_NCONFIG);
2836 udelay(PVR_GPIO_DELAY);
2838 for (n = 0; n < microlen; n++) {
2840 for ( i = 0 ; i < 8 ; i++ ) {
2841 gpio_bits(BTTV_ALT_DCLK,0);
2843 gpio_bits(BTTV_ALT_DATA,BTTV_ALT_DATA);
2845 gpio_bits(BTTV_ALT_DATA,0);
2846 gpio_bits(BTTV_ALT_DCLK,BTTV_ALT_DCLK);
2850 gpio_bits(BTTV_ALT_DCLK,0);
2851 udelay(PVR_GPIO_DELAY);
2853 /* begin Altera init loop (Not necessary,but doesn't hurt) */
2854 for (i = 0 ; i < 30 ; i++) {
2855 gpio_bits(BTTV_ALT_DCLK,0);
2856 gpio_bits(BTTV_ALT_DCLK,BTTV_ALT_DCLK);
2858 gpio_bits(BTTV_ALT_DCLK,0);
2862 #ifndef CONFIG_FW_LOADER
2863 /* old 2.4.x way -- via soundcore's mod_firmware_load */
2865 static char *firm_altera = "/usr/lib/video4linux/hcwamc.rbf";
2866 MODULE_PARM(firm_altera,"s");
2867 MODULE_PARM_DESC(firm_altera,"WinTV/PVR firmware "
2868 "(driver CD => unzip pvr45xxx.exe => hcwamc.rbf)");
2870 extern int mod_firmware_load(const char *fn, char **fp);
2872 int __devinit pvr_boot(struct bttv *btv)
2878 microlen = mod_firmware_load(firm_altera, (char**) µ);
2880 printk(KERN_WARNING "bttv%d: altera firmware not found [%s]\n",
2881 btv->c.nr, firm_altera);
2885 printk(KERN_INFO "bttv%d: uploading altera firmware [%s] ...\n",
2886 btv->c.nr, firm_altera);
2887 result = pvr_altera_load(btv, micro, microlen);
2888 printk(KERN_INFO "bttv%d: ... upload %s\n",
2889 btv->c.nr, (result < 0) ? "failed" : "ok");
2894 /* new 2.5.x way -- via hotplug firmware loader */
2896 int __devinit pvr_boot(struct bttv *btv)
2898 const struct firmware *fw_entry;
2901 rc = request_firmware(&fw_entry, "hcwamc.rbf", &btv->c.pci->dev);
2903 printk(KERN_WARNING "bttv%d: no altera firmware [via hotplug]\n",
2907 rc = pvr_altera_load(btv, fw_entry->data, fw_entry->size);
2908 printk(KERN_INFO "bttv%d: altera firmware upload %s\n",
2909 btv->c.nr, (rc < 0) ? "failed" : "ok");
2910 release_firmware(fw_entry);
2915 /* ----------------------------------------------------------------------- */
2916 /* some osprey specific stuff */
2918 static void __devinit osprey_eeprom(struct bttv *btv)
2921 unsigned char *ee = eeprom_data;
2922 unsigned long serial = 0;
2924 if (btv->c.type == 0) {
2925 /* this might be an antique... check for MMAC label in eeprom */
2926 if ((ee[0]=='M') && (ee[1]=='M') && (ee[2]=='A') && (ee[3]=='C')) {
2927 unsigned char checksum = 0;
2928 for (i =0; i<21; i++)
2930 if (checksum != ee[21])
2932 btv->c.type = BTTV_OSPREY1x0_848;
2933 for (i = 12; i < 21; i++)
2934 serial *= 10, serial += ee[i] - '0';
2937 unsigned short type;
2940 for(; offset < 8*16; offset += 16) {
2941 unsigned short checksum = 0;
2942 /* verify the checksum */
2943 for(i = 0; i<14; i++) checksum += ee[i+offset];
2944 checksum = ~checksum; /* no idea why */
2945 if ((((checksum>>8)&0x0FF) == ee[offset+14]) &&
2946 ((checksum & 0x0FF) == ee[offset+15])) {
2954 /* found a valid descriptor */
2955 type = (ee[offset+4]<<8) | (ee[offset+5]);
2961 btv->c.type = BTTV_OSPREY1x0_848;
2964 btv->c.type = BTTV_OSPREY101_848;
2970 btv->c.type = BTTV_OSPREY1x0;
2974 btv->c.type = BTTV_OSPREY1x1;
2979 btv->c.type = BTTV_OSPREY1x1_SVID;
2985 btv->c.type = BTTV_OSPREY2xx;
2989 btv->c.type = BTTV_OSPREY2x0_SVID;
2992 btv->c.type = BTTV_OSPREY500;
2996 btv->c.type = BTTV_OSPREY540;
2997 /* bttv_osprey_540_init(btv); */
3001 btv->c.type = BTTV_OSPREY2x0;
3002 //enable output on select control lines
3003 gpio_inout(0xffffff,0x000303);
3006 /* unknown...leave generic, but get serial # */
3009 serial = (ee[offset+6] << 24)
3010 | (ee[offset+7] << 16)
3011 | (ee[offset+8] << 8)
3015 printk(KERN_INFO "bttv%d: osprey eeprom: card=%d name=%s serial=%ld\n",
3016 btv->c.nr, btv->c.type, bttv_tvcards[btv->c.type].name,serial);
3019 /* ----------------------------------------------------------------------- */
3020 /* AVermedia specific stuff, from bktr_card.c */
3022 int tuner_0_table[] = {
3023 TUNER_PHILIPS_NTSC, TUNER_PHILIPS_PAL /* PAL-BG*/,
3024 TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL /* PAL-I*/,
3025 TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL,
3026 TUNER_PHILIPS_SECAM, TUNER_PHILIPS_SECAM,
3027 TUNER_PHILIPS_SECAM, TUNER_PHILIPS_PAL};
3029 int tuner_0_fm_table[] = {
3030 PHILIPS_FR1236_NTSC, PHILIPS_FR1216_PAL,
3031 PHILIPS_FR1216_PAL, PHILIPS_FR1216_PAL,
3032 PHILIPS_FR1216_PAL, PHILIPS_FR1216_PAL,
3033 PHILIPS_FR1236_SECAM, PHILIPS_FR1236_SECAM,
3034 PHILIPS_FR1236_SECAM, PHILIPS_FR1216_PAL};
3037 int tuner_1_table[] = {
3038 TUNER_TEMIC_NTSC, TUNER_TEMIC_PAL,
3039 TUNER_TEMIC_PAL, TUNER_TEMIC_PAL,
3040 TUNER_TEMIC_PAL, TUNER_TEMIC_PAL,
3041 TUNER_TEMIC_4012FY5, TUNER_TEMIC_4012FY5, //TUNER_TEMIC_SECAM
3042 TUNER_TEMIC_4012FY5, TUNER_TEMIC_PAL};
3044 static void __devinit avermedia_eeprom(struct bttv *btv)
3046 int tuner_make,tuner_tv_fm,tuner_format,tuner=0;
3048 tuner_make = (eeprom_data[0x41] & 0x7);
3049 tuner_tv_fm = (eeprom_data[0x41] & 0x18) >> 3;
3050 tuner_format = (eeprom_data[0x42] & 0xf0) >> 4;
3051 btv->has_remote = (eeprom_data[0x42] & 0x01);
3053 if (tuner_make == 0 || tuner_make == 2)
3054 if(tuner_format <=9)
3055 tuner = tuner_0_table[tuner_format];
3056 if (tuner_make == 1)
3057 if(tuner_format <=9)
3058 tuner = tuner_1_table[tuner_format];
3060 printk(KERN_INFO "bttv%d: Avermedia eeprom[0x%02x%02x]: tuner=",
3061 btv->c.nr,eeprom_data[0x41],eeprom_data[0x42]);
3063 btv->tuner_type=tuner;
3066 printk("Unknown type");
3067 printk(" radio:%s remote control:%s\n",
3068 tuner_tv_fm ? "yes" : "no",
3069 btv->has_remote ? "yes" : "no");
3072 /* used on Voodoo TV/FM (Voodoo 200), S0 wired to 0x10000 */
3073 void bttv_tda9880_setnorm(struct bttv *btv, int norm)
3075 // fix up our card entry
3076 if(norm==VIDEO_MODE_NTSC) {
3077 bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[0]=0x957fff;
3078 bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[4]=0x957fff;
3079 dprintk("bttv_tda9880_setnorm to NTSC\n");
3082 bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[0]=0x947fff;
3083 bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[4]=0x947fff;
3084 dprintk("bttv_tda9880_setnorm to PAL\n");
3086 // set GPIO according
3087 gpio_bits(bttv_tvcards[btv->c.type].gpiomask,
3088 bttv_tvcards[btv->c.type].audiomux[btv->audio]);
3093 * reset/enable the MSP on some Hauppauge cards
3094 * Thanks to Kyösti Mälkki (kmalkki@cc.hut.fi)!
3099 static void __devinit boot_msp34xx(struct bttv *btv, int pin)
3101 int mask = (1 << pin);
3103 gpio_inout(mask,mask);
3106 gpio_bits(mask,mask);
3109 bttv_gpio_tracking(btv,"msp34xx");
3111 printk(KERN_INFO "bttv%d: Hauppauge/Voodoo msp34xx: reset line "
3112 "init [%d]\n", btv->c.nr, pin);
3115 static void __devinit boot_bt832(struct bttv *btv)
3119 switch (btv->c.type) {
3120 case BTTV_PXELVWPLTVPAK:
3121 resetbit = 0x400000;
3123 case BTTV_MODTEC_205:
3130 request_module("bt832");
3131 bttv_call_i2c_clients(btv, BT832_HEXDUMP, NULL);
3133 printk("bttv%d: Reset Bt832 [line=0x%x]\n",btv->c.nr,resetbit);
3135 gpio_inout(resetbit, resetbit);
3137 gpio_bits(resetbit, resetbit);
3139 gpio_bits(resetbit, 0);
3142 // bt832 on pixelview changes from i2c 0x8a to 0x88 after
3143 // being reset as above. So we must follow by this:
3144 bttv_call_i2c_clients(btv, BT832_REATTACH, NULL);
3147 /* ----------------------------------------------------------------------- */
3148 /* Imagenation L-Model PXC200 Framegrabber */
3149 /* This is basically the same procedure as
3150 * used by Alessandro Rubini in his pxc200
3151 * driver, but using BTTV functions */
3153 static void __devinit init_PXC200(struct bttv *btv)
3155 static int vals[] __devinitdata = { 0x08, 0x09, 0x0a, 0x0b, 0x0d, 0x0d,
3156 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
3162 /* Initialise GPIO-connevted stuff */
3163 gpio_inout(0xffffff, (1<<13));
3167 /* GPIO inputs are pulled up, so no need to drive
3168 * reset pin any longer */
3169 gpio_bits(0xffffff, 0);
3171 bttv_gpio_tracking(btv,"pxc200");
3173 /* we could/should try and reset/control the AD pots? but
3174 right now we simply turned off the crushing. Without
3175 this the AGC drifts drifts
3176 remember the EN is reverse logic -->
3177 setting BT848_ADC_AGC_EN disable the AGC
3178 tboult@eecs.lehigh.edu
3181 btwrite(BT848_ADC_RESERVED|BT848_ADC_AGC_EN, BT848_ADC);
3183 /* Initialise MAX517 DAC */
3184 printk(KERN_INFO "Setting DAC reference voltage level ...\n");
3185 bttv_I2CWrite(btv,0x5E,0,0x80,1);
3187 /* Initialise 12C508 PIC */
3188 /* The I2CWrite and I2CRead commmands are actually to the
3189 * same chips - but the R/W bit is included in the address
3190 * argument so the numbers are different */
3193 printk(KERN_INFO "Initialising 12C508 PIC chip ...\n");
3195 /* First of all, enable the clock line. This is used in the PXC200-F */
3196 val = btread(BT848_GPIO_DMA_CTL);
3197 val |= BT848_GPIO_DMA_CTL_GPCLKMODE;
3198 btwrite(val, BT848_GPIO_DMA_CTL);
3200 /* Then, push to 0 the reset pin long enough to reset the *
3201 * device same as above for the reset line, but not the same
3202 * value sent to the GPIO-connected stuff
3203 * which one is the good one? */
3204 gpio_inout(0xffffff,(1<<2));
3209 for (i = 0; i < ARRAY_SIZE(vals); i++) {
3210 tmp=bttv_I2CWrite(btv,0x1E,0,vals[i],1);
3213 "I2C Write(%2.2x) = %i\nI2C Read () = %2.2x\n\n",
3214 vals[i],tmp,bttv_I2CRead(btv,0x1F,NULL));
3218 printk(KERN_INFO "PXC200 Initialised.\n");
3222 /* ----------------------------------------------------------------------- */
3223 /* Miro Pro radio stuff -- the tea5757 is connected to some GPIO ports */
3225 * Copyright (c) 1999 Csaba Halasz <qgehali@uni-miskolc.hu>
3226 * This code is placed under the terms of the GNU General Public License
3228 * Brutally hacked by Dan Sheridan <dan.sheridan@contact.org.uk> djs52 8/3/00
3231 void bus_low(struct bttv *btv, int bit)
3233 if (btv->mbox_ior) {
3234 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3235 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3242 if (btv->mbox_ior) {
3243 gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
3248 void bus_high(struct bttv *btv, int bit)
3250 if (btv->mbox_ior) {
3251 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3252 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3259 if (btv->mbox_ior) {
3260 gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
3265 int bus_in(struct bttv *btv, int bit)
3267 if (btv->mbox_ior) {
3268 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3269 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3272 gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
3275 return gpio_read() & (bit);
3278 /* TEA5757 register bits */
3279 #define TEA_FREQ 0:14
3280 #define TEA_BUFFER 15:15
3282 #define TEA_SIGNAL_STRENGTH 16:17
3284 #define TEA_PORT1 18:18
3285 #define TEA_PORT0 19:19
3287 #define TEA_BAND 20:21
3288 #define TEA_BAND_FM 0
3289 #define TEA_BAND_MW 1
3290 #define TEA_BAND_LW 2
3291 #define TEA_BAND_SW 3
3293 #define TEA_MONO 22:22
3294 #define TEA_ALLOW_STEREO 0
3295 #define TEA_FORCE_MONO 1
3297 #define TEA_SEARCH_DIRECTION 23:23
3298 #define TEA_SEARCH_DOWN 0
3299 #define TEA_SEARCH_UP 1
3301 #define TEA_STATUS 24:24
3302 #define TEA_STATUS_TUNED 0
3303 #define TEA_STATUS_SEARCHING 1
3305 /* Low-level stuff */
3306 static int tea5757_read(struct bttv *btv)
3308 unsigned long timeout;
3312 /* better safe than sorry */
3313 gpio_inout(btv->mbox_mask, btv->mbox_clk | btv->mbox_we);
3315 if (btv->mbox_ior) {
3316 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3317 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3322 bttv_gpio_tracking(btv,"tea5757 read");
3324 bus_low(btv,btv->mbox_we);
3325 bus_low(btv,btv->mbox_clk);
3328 timeout= jiffies + HZ;
3330 // wait for DATA line to go low; error if it doesn't
3331 while (bus_in(btv,btv->mbox_data) && time_before(jiffies, timeout))
3333 if (bus_in(btv,btv->mbox_data)) {
3334 printk(KERN_WARNING "bttv%d: tea5757: read timeout\n",btv->c.nr);
3338 dprintk("bttv%d: tea5757:",btv->c.nr);
3339 for(i = 0; i < 24; i++)
3342 bus_high(btv,btv->mbox_clk);
3344 dprintk("%c",(bus_in(btv,btv->mbox_most) == 0)?'T':'-');
3345 bus_low(btv,btv->mbox_clk);
3347 value |= (bus_in(btv,btv->mbox_data) == 0)?0:1; /* MSB first */
3348 dprintk("%c", (bus_in(btv,btv->mbox_most) == 0)?'S':'M');
3350 dprintk("\nbttv%d: tea5757: read 0x%X\n", btv->c.nr, value);
3354 static int tea5757_write(struct bttv *btv, int value)
3359 gpio_inout(btv->mbox_mask, btv->mbox_clk | btv->mbox_we | btv->mbox_data);
3361 if (btv->mbox_ior) {
3362 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3363 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3367 bttv_gpio_tracking(btv,"tea5757 write");
3369 dprintk("bttv%d: tea5757: write 0x%X\n", btv->c.nr, value);
3370 bus_low(btv,btv->mbox_clk);
3371 bus_high(btv,btv->mbox_we);
3372 for(i = 0; i < 25; i++)
3374 if (reg & 0x1000000)
3375 bus_high(btv,btv->mbox_data);
3377 bus_low(btv,btv->mbox_data);
3379 bus_high(btv,btv->mbox_clk);
3381 bus_low(btv,btv->mbox_clk);
3384 bus_low(btv,btv->mbox_we); /* unmute !!! */
3388 void tea5757_set_freq(struct bttv *btv, unsigned short freq)
3390 dprintk("tea5757_set_freq %d\n",freq);
3391 tea5757_write(btv, 5 * freq + 0x358); /* add 10.7MHz (see docs) */
3393 /* breaks Miro PCTV */
3394 value = tea5757_read(btv);
3395 dprintk("bttv%d: tea5757 readback=0x%x\n",btv->c.nr,value);
3400 /* ----------------------------------------------------------------------- */
3403 void winview_audio(struct bttv *btv, struct video_audio *v, int set)
3405 /* PT2254A programming Jon Tombs, jon@gte.esi.us.es */
3406 int bits_out, loops, vol, data;
3409 /* Fixed by Leandro Lucarella <luca@linuxmendoza.org.ar (07/31/01) */
3410 v->flags |= VIDEO_AUDIO_VOLUME;
3414 /* 32 levels logarithmic */
3415 vol = 32 - ((v->volume>>11));
3417 bits_out = (PT2254_DBS_IN_2>>(vol%5));
3419 bits_out |= (PT2254_DBS_IN_10>>(vol/5));
3420 bits_out |= PT2254_L_CHANNEL | PT2254_R_CHANNEL;
3422 data &= ~(WINVIEW_PT2254_CLK| WINVIEW_PT2254_DATA|
3423 WINVIEW_PT2254_STROBE);
3424 for (loops = 17; loops >= 0 ; loops--) {
3425 if (bits_out & (1<<loops))
3426 data |= WINVIEW_PT2254_DATA;
3428 data &= ~WINVIEW_PT2254_DATA;
3431 data |= WINVIEW_PT2254_CLK;
3434 data &= ~WINVIEW_PT2254_CLK;
3437 data |= WINVIEW_PT2254_STROBE;
3438 data &= ~WINVIEW_PT2254_DATA;
3441 data &= ~WINVIEW_PT2254_STROBE;
3445 /* ----------------------------------------------------------------------- */
3446 /* mono/stereo control for various cards (which don't use i2c chips but */
3447 /* connect something to the GPIO pins */
3450 gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set)
3452 unsigned int con = 0;
3455 gpio_inout(0x300, 0x300);
3456 if (v->mode & VIDEO_SOUND_LANG1)
3458 if (v->mode & VIDEO_SOUND_LANG2)
3460 if (v->mode & VIDEO_SOUND_STEREO)
3462 // if (v->mode & VIDEO_SOUND_MONO)
3464 gpio_bits(0x300, con);
3466 v->mode = VIDEO_SOUND_STEREO |
3467 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3472 gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set)
3474 unsigned int val, con;
3476 #if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0)
3477 if (btv->radio_user)
3487 if (v->mode & VIDEO_SOUND_LANG2) {
3488 if (v->mode & VIDEO_SOUND_LANG1) {
3497 if (con != (val & 0x300)) {
3498 gpio_bits(0x300, con);
3500 bttv_gpio_tracking(btv,"gvbctv5pci");
3503 switch (val & 0x70) {
3505 v->mode = VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3508 v->mode = VIDEO_SOUND_LANG2;
3511 v->mode = VIDEO_SOUND_LANG1;
3514 v->mode = VIDEO_SOUND_STEREO;
3517 v->mode = VIDEO_SOUND_MONO;
3520 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3521 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3527 * Mario Medina Nussbaum <medisoft@alohabbs.org.mx>
3528 * I discover that on BT848_GPIO_DATA address a byte 0xcce enable stereo,
3529 * 0xdde enables mono and 0xccd enables sap
3531 * Petr Vandrovec <VANDROVE@vc.cvut.cz>
3532 * P.S.: At least mask in line above is wrong - GPIO pins 3,2 select
3533 * input/output sound connection, so both must be set for output mode.
3535 * Looks like it's needed only for the "tvphone", the "tvphone 98"
3536 * handles this with a tda9840
3540 avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, int set)
3545 if (v->mode & VIDEO_SOUND_LANG2) /* SAP */
3547 if (v->mode & VIDEO_SOUND_STEREO)
3550 gpio_bits(0x03,val);
3552 bttv_gpio_tracking(btv,"avermedia");
3555 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3562 avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v, int set)
3567 if (v->mode & VIDEO_SOUND_LANG2) /* SAP */
3569 if (v->mode & VIDEO_SOUND_STEREO) /* STEREO */
3571 btaor(val, ~0x03, BT848_GPIO_DATA);
3573 bttv_gpio_tracking(btv,"avermedia");
3575 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3576 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3581 /* Lifetec 9415 handling */
3583 lt9415_audio(struct bttv *btv, struct video_audio *v, int set)
3587 if (gpio_read() & 0x4000) {
3588 v->mode = VIDEO_SOUND_MONO;
3593 if (v->mode & VIDEO_SOUND_LANG2) /* A2 SAP */
3595 if (v->mode & VIDEO_SOUND_STEREO) /* A2 stereo */
3597 if ((v->mode & VIDEO_SOUND_LANG1) ||
3598 (v->mode & VIDEO_SOUND_MONO))
3600 gpio_bits(0x0880, val);
3602 bttv_gpio_tracking(btv,"lt9415");
3604 /* autodetect doesn't work with this card :-( */
3605 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3606 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3611 // TDA9821 on TerraTV+ Bt848, Bt878
3613 terratv_audio(struct bttv *btv, struct video_audio *v, int set)
3615 unsigned int con = 0;
3618 gpio_inout(0x180000,0x180000);
3619 if (v->mode & VIDEO_SOUND_LANG2)
3621 if (v->mode & VIDEO_SOUND_STEREO)
3623 gpio_bits(0x180000, con);
3625 bttv_gpio_tracking(btv,"terratv");
3627 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3628 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3633 winfast2000_audio(struct bttv *btv, struct video_audio *v, int set)
3635 unsigned long val = 0;
3638 /*btor (0xc32000, BT848_GPIO_OUT_EN);*/
3639 if (v->mode & VIDEO_SOUND_MONO) /* Mono */
3641 if (v->mode & VIDEO_SOUND_LANG1) /* Mono */
3643 if (v->mode & VIDEO_SOUND_LANG2) /* SAP */
3645 if (v->mode & VIDEO_SOUND_STEREO) /* Stereo */
3648 gpio_bits(0x430000, val);
3650 bttv_gpio_tracking(btv,"winfast2000");
3653 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3654 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3659 * Dariusz Kowalewski <darekk@automex.pl>
3660 * sound control for Prolink PV-BT878P+9B (PixelView PlayTV Pro FM+NICAM
3661 * revision 9B has on-board TDA9874A sound decoder).
3663 * Note: There are card variants without tda9874a. Forcing the "stereo sound route"
3664 * will mute this cards.
3667 pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set)
3669 unsigned int val = 0;
3671 #if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0)
3672 if (btv->radio_user)
3680 if (v->mode & VIDEO_SOUND_MONO) {
3683 if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2))
3684 || (v->mode & VIDEO_SOUND_STEREO)) {
3688 gpio_bits(0x03,val);
3690 bttv_gpio_tracking(btv,"pvbt878p9b");
3693 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3694 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3699 * Dariusz Kowalewski <darekk@automex.pl>
3700 * sound control for FlyVideo 2000S (with tda9874 decoder)
3701 * based on pvbt878p9b_audio() - this is not tested, please fix!!!
3704 fv2000s_audio(struct bttv *btv, struct video_audio *v, int set)
3706 unsigned int val = 0xffff;
3708 #if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0)
3709 if (btv->radio_user)
3716 if (v->mode & VIDEO_SOUND_MONO) {
3719 if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2))
3720 || (v->mode & VIDEO_SOUND_STEREO)) {
3721 val = 0x1080; //-dk-???: 0x0880, 0x0080, 0x1800 ...
3723 if (val != 0xffff) {
3724 gpio_bits(0x1800, val);
3726 bttv_gpio_tracking(btv,"fv2000s");
3729 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3730 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3735 * sound control for Canopus WinDVR PCI
3736 * Masaki Suzuki <masaki@btree.org>
3739 windvr_audio(struct bttv *btv, struct video_audio *v, int set)
3741 unsigned long val = 0;
3744 if (v->mode & VIDEO_SOUND_MONO)
3746 if (v->mode & VIDEO_SOUND_LANG1)
3748 if (v->mode & VIDEO_SOUND_LANG2)
3750 if (v->mode & VIDEO_SOUND_STEREO)
3753 gpio_bits(0x140000, val);
3755 bttv_gpio_tracking(btv,"windvr");
3758 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3759 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3764 * sound control for AD-TVK503
3765 * Hiroshi Takekawa <sian@big.or.jp>
3768 adtvk503_audio(struct bttv *btv, struct video_audio *v, int set)
3770 unsigned int con = 0xffffff;
3772 //btaor(0x1e0000, ~0x1e0000, BT848_GPIO_OUT_EN);
3775 //btor(***, BT848_GPIO_OUT_EN);
3776 if (v->mode & VIDEO_SOUND_LANG1)
3778 if (v->mode & VIDEO_SOUND_LANG2)
3780 if (v->mode & VIDEO_SOUND_STEREO)
3782 if (v->mode & VIDEO_SOUND_MONO)
3784 if (con != 0xffffff) {
3785 gpio_bits(0x1e0000,con);
3787 bttv_gpio_tracking(btv, "adtvk503");
3790 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3791 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3795 /* RemoteVision MX (rv605) muxsel helper [Miguel Freitas]
3797 * This is needed because rv605 don't use a normal multiplex, but a crosspoint
3798 * switch instead (CD22M3494E). This IC can have multiple active connections
3799 * between Xn (input) and Yn (output) pins. We need to clear any existing
3800 * connection prior to establish a new one, pulsing the STROBE pin.
3802 * The board hardwire Y0 (xpoint) to MUX1 and MUXOUT to Yin.
3803 * GPIO pins are wired as:
3804 * GPIO[0:3] - AX[0:3] (xpoint) - P1[0:3] (microcontroler)
3805 * GPIO[4:6] - AY[0:2] (xpoint) - P1[4:6] (microcontroler)
3806 * GPIO[7] - DATA (xpoint) - P1[7] (microcontroler)
3807 * GPIO[8] - - P3[5] (microcontroler)
3808 * GPIO[9] - RESET (xpoint) - P3[6] (microcontroler)
3809 * GPIO[10] - STROBE (xpoint) - P3[7] (microcontroler)
3810 * GPINTR - - P3[4] (microcontroler)
3812 * The microcontroler is a 80C32 like. It should be possible to change xpoint
3813 * configuration either directly (as we are doing) or using the microcontroler
3814 * which is also wired to I2C interface. I have no further info on the
3815 * microcontroler features, one would need to disassembly the firmware.
3816 * note: the vendor refused to give any information on this product, all
3817 * that stuff was found using a multimeter! :)
3819 static void rv605_muxsel(struct bttv *btv, unsigned int input)
3821 /* reset all conections */
3822 gpio_bits(0x200,0x200);
3824 gpio_bits(0x200,0x000);
3827 /* create a new conection */
3828 gpio_bits(0x480,0x080);
3829 gpio_bits(0x480,0x480);
3831 gpio_bits(0x480,0x080);
3835 // The Grandtec X-Guard framegrabber card uses two Dual 4-channel
3836 // video multiplexers to provide up to 16 video inputs. These
3837 // multiplexers are controlled by the lower 8 GPIO pins of the
3838 // bt878. The multiplexers probably Pericom PI5V331Q or similar.
3840 // xxx0 is pin xxx of multiplexer U5,
3841 // yyy1 is pin yyy of multiplexer U2
3853 static void xguard_muxsel(struct bttv *btv, unsigned int input)
3855 static const int masks[] = {
3856 ENB0, ENB0|IN00, ENB0|IN10, ENB0|IN00|IN10,
3857 ENA0, ENA0|IN00, ENA0|IN10, ENA0|IN00|IN10,
3858 ENB1, ENB1|IN01, ENB1|IN11, ENB1|IN01|IN11,
3859 ENA1, ENA1|IN01, ENA1|IN11, ENA1|IN01|IN11,
3861 gpio_write(masks[input%16]);
3863 static void picolo_tetra_init(struct bttv *btv)
3865 /*This is the video input redirection fonctionality : I DID NOT USED IT. */
3866 btwrite (0x08<<16,BT848_GPIO_DATA);/*GPIO[19] [==> 4053 B+C] set to 1 */
3867 btwrite (0x04<<16,BT848_GPIO_DATA);/*GPIO[18] [==> 4053 A] set to 1*/
3869 static void picolo_tetra_muxsel (struct bttv* btv, unsigned int input)
3872 dprintk (KERN_DEBUG "bttv%d : picolo_tetra_muxsel => input = %d\n",btv->c.nr,input);
3873 /*Just set the right path in the analog multiplexers : channel 1 -> 4 ==> Analog Mux ==> MUX0*/
3874 /*GPIO[20]&GPIO[21] used to choose the right input*/
3875 btwrite (input<<20,BT848_GPIO_DATA);
3880 * ivc120_muxsel [Added by Alan Garfield <alan@fromorbit.com>]
3882 * The IVC120G security card has 4 i2c controlled TDA8540 matrix
3883 * swichers to provide 16 channels to MUX0. The TDA8540's have
3884 * 4 indepedant outputs and as such the IVC120G also has the
3885 * optional "Monitor Out" bus. This allows the card to be looking
3886 * at one input while the monitor is looking at another.
3888 * Since I've couldn't be bothered figuring out how to add an
3889 * independant muxsel for the monitor bus, I've just set it to
3890 * whatever the card is looking at.
3892 * OUT0 of the TDA8540's is connected to MUX0 (0x03)
3893 * OUT1 of the TDA8540's is connected to "Monitor Out" (0x0C)
3895 * TDA8540_ALT3 IN0-3 = Channel 13 - 16 (0x03)
3896 * TDA8540_ALT4 IN0-3 = Channel 1 - 4 (0x03)
3897 * TDA8540_ALT5 IN0-3 = Channel 5 - 8 (0x03)
3898 * TDA8540_ALT6 IN0-3 = Channel 9 - 12 (0x03)
3902 /* All 7 possible sub-ids for the TDA8540 Matrix Switcher */
3903 #define I2C_TDA8540 0x90
3904 #define I2C_TDA8540_ALT1 0x92
3905 #define I2C_TDA8540_ALT2 0x94
3906 #define I2C_TDA8540_ALT3 0x96
3907 #define I2C_TDA8540_ALT4 0x98
3908 #define I2C_TDA8540_ALT5 0x9a
3909 #define I2C_TDA8540_ALT6 0x9c
3911 static void ivc120_muxsel(struct bttv *btv, unsigned int input)
3914 int key = input % 4;
3915 int matrix = input / 4;
3917 dprintk("bttv%d: ivc120_muxsel: Input - %02d | TDA - %02d | In - %02d\n",
3918 btv->c.nr, input, matrix, key);
3920 // Handles the input selection on the TDA8540's
3921 bttv_I2CWrite(btv, I2C_TDA8540_ALT3, 0x00,
3922 ((matrix == 3) ? (key | key << 2) : 0x00), 1);
3923 bttv_I2CWrite(btv, I2C_TDA8540_ALT4, 0x00,
3924 ((matrix == 0) ? (key | key << 2) : 0x00), 1);
3925 bttv_I2CWrite(btv, I2C_TDA8540_ALT5, 0x00,
3926 ((matrix == 1) ? (key | key << 2) : 0x00), 1);
3927 bttv_I2CWrite(btv, I2C_TDA8540_ALT6, 0x00,
3928 ((matrix == 2) ? (key | key << 2) : 0x00), 1);
3930 // Handles the output enables on the TDA8540's
3931 bttv_I2CWrite(btv, I2C_TDA8540_ALT3, 0x02,
3932 ((matrix == 3) ? 0x03 : 0x00), 1); // 13 - 16
3933 bttv_I2CWrite(btv, I2C_TDA8540_ALT4, 0x02,
3934 ((matrix == 0) ? 0x03 : 0x00), 1); // 1-4
3935 bttv_I2CWrite(btv, I2C_TDA8540_ALT5, 0x02,
3936 ((matrix == 1) ? 0x03 : 0x00), 1); // 5-8
3937 bttv_I2CWrite(btv, I2C_TDA8540_ALT6, 0x02,
3938 ((matrix == 2) ? 0x03 : 0x00), 1); // 9-12
3940 // Selects MUX0 for input on the 878
3941 btaor((0)<<5, ~(3<<5), BT848_IFORM);
3945 /* ----------------------------------------------------------------------- */
3946 /* motherboard chipset specific stuff */
3948 void __devinit bttv_check_chipset(void)
3950 int pcipci_fail = 0;
3951 struct pci_dev *dev = NULL;
3953 if (pci_pci_problems & PCIPCI_FAIL)
3955 if (pci_pci_problems & (PCIPCI_TRITON|PCIPCI_NATOMA|PCIPCI_VIAETBF))
3957 if (pci_pci_problems & PCIPCI_VSFX)
3959 #ifdef PCIPCI_ALIMAGIK
3960 if (pci_pci_problems & PCIPCI_ALIMAGIK)
3965 /* print which chipset we have */
3966 while ((dev = pci_find_class(PCI_CLASS_BRIDGE_HOST << 8,dev)))
3967 printk(KERN_INFO "bttv: Host bridge is %s\n",pci_name(dev));
3970 /* print warnings about any quirks found */
3972 printk(KERN_INFO "bttv: Host bridge needs ETBF enabled.\n");
3974 printk(KERN_INFO "bttv: Host bridge needs VSFX enabled.\n");
3976 printk(KERN_WARNING "bttv: BT848 and your chipset may not work together.\n");
3977 if (UNSET == no_overlay) {
3978 printk(KERN_WARNING "bttv: going to disable overlay.\n");
3982 if (UNSET != latency)
3983 printk(KERN_INFO "bttv: pci latency fixup [%d]\n",latency);
3985 while ((dev = pci_find_device(PCI_VENDOR_ID_INTEL,
3986 PCI_DEVICE_ID_INTEL_82441, dev))) {
3988 pci_read_config_byte(dev, 0x53, &b);
3990 printk(KERN_INFO "bttv: Host bridge: 82441FX Natoma, "
3991 "bufcon=0x%02x\n",b);
3995 int __devinit bttv_handle_chipset(struct bttv *btv)
3997 unsigned char command;
3999 if (!triton1 && !vsfx && UNSET == latency)
4004 printk(KERN_INFO "bttv%d: enabling ETBF (430FX/VP3 compatibilty)\n",btv->c.nr);
4005 if (vsfx && btv->id >= 878)
4006 printk(KERN_INFO "bttv%d: enabling VSFX\n",btv->c.nr);
4007 if (UNSET != latency)
4008 printk(KERN_INFO "bttv%d: setting pci timer to %d\n",
4012 if (btv->id < 878) {
4013 /* bt848 (mis)uses a bit in the irq mask for etbf */
4015 btv->triton1 = BT848_INT_ETBF;
4017 /* bt878 has a bit in the pci config space for it */
4018 pci_read_config_byte(btv->c.pci, BT878_DEVCTRL, &command);
4020 command |= BT878_EN_TBFX;
4022 command |= BT878_EN_VSFX;
4023 pci_write_config_byte(btv->c.pci, BT878_DEVCTRL, command);
4025 if (UNSET != latency)
4026 pci_write_config_byte(btv->c.pci, PCI_LATENCY_TIMER, latency);
4031 /* PXC200 muxsel helper
4032 * luke@syseng.anu.edu.au
4033 * another transplant
4034 * from Alessandro Rubini (rubini@linux.it)
4036 * There are 4 kinds of cards:
4037 * PXC200L which is bt848
4038 * PXC200F which is bt848 with PIC controlling mux
4039 * PXC200AL which is bt878
4040 * PXC200AF which is bt878 with PIC controlling mux
4042 #define PX_CFG_PXC200F 0x01
4043 #define PX_FLAG_PXC200A 0x00001000 /* a pxc200A is bt-878 based */
4044 #define PX_I2C_PIC 0x0f
4045 #define PX_PXC200A_CARDID 0x200a1295
4046 #define PX_I2C_CMD_CFG 0x00
4048 static void PXC200_muxsel(struct bttv *btv, unsigned int input)
4053 unsigned char buf[2];
4055 /* Read PIC config to determine if this is a PXC200F */
4059 rc=bttv_I2CWrite(btv,(PX_I2C_PIC<<1),buf[0],buf[1],1);
4061 printk(KERN_DEBUG "bttv%d: PXC200_muxsel: pic cfg write failed:%d\n", btv->c.nr,rc);
4062 /* not PXC ? do nothing */
4066 rc=bttv_I2CRead(btv,(PX_I2C_PIC<<1),NULL);
4067 if (!(rc & PX_CFG_PXC200F)) {
4068 printk(KERN_DEBUG "bttv%d: PXC200_muxsel: not PXC200F rc:%d \n", btv->c.nr,rc);
4073 /* The multiplexer in the 200F is handled by the GPIO port */
4074 /* get correct mapping between inputs */
4075 /* mux = bttv_tvcards[btv->type].muxsel[input] & 3; */
4076 /* ** not needed!? */
4079 /* make sure output pins are enabled */
4080 /* bitmask=0x30f; */
4082 /* check whether we have a PXC200A */
4083 if (btv->cardid == PX_PXC200A_CARDID) {
4084 bitmask ^= 0x180; /* use 7 and 9, not 8 and 9 */
4085 bitmask |= 7<<4; /* the DAC */
4087 btwrite(bitmask, BT848_GPIO_OUT_EN);
4089 bitmask = btread(BT848_GPIO_DATA);
4090 if (btv->cardid == PX_PXC200A_CARDID)
4091 bitmask = (bitmask & ~0x280) | ((mux & 2) << 8) | ((mux & 1) << 7);
4092 else /* older device */
4093 bitmask = (bitmask & ~0x300) | ((mux & 3) << 8);
4094 btwrite(bitmask,BT848_GPIO_DATA);
4097 * Was "to be safe, set the bt848 to input 0"
4098 * Actually, since it's ok at load time, better not messing
4099 * with these bits (on PXC200AF you need to set mux 2 here)
4101 * needed because bttv-driver sets mux before calling this function
4103 if (btv->cardid == PX_PXC200A_CARDID)
4104 btaor(2<<5, ~BT848_IFORM_MUXSEL, BT848_IFORM);
4105 else /* older device */
4106 btand(~BT848_IFORM_MUXSEL,BT848_IFORM);
4108 printk(KERN_DEBUG "bttv%d: setting input channel to:%d\n", btv->c.nr,(int)mux);