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 int terratec_active_radio_upgrade(struct bttv *btv);
75 static int tea5757_read(struct bttv *btv);
76 static int tea5757_write(struct bttv *btv, int value);
77 static void identify_by_eeprom(struct bttv *btv,
78 unsigned char eeprom_data[256]);
80 /* config variables */
81 static unsigned int triton1=0;
82 static unsigned int vsfx=0;
83 static unsigned int latency = UNSET;
84 unsigned int no_overlay=-1;
86 static unsigned int card[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
87 static unsigned int pll[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
88 static unsigned int tuner[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
89 static unsigned int svhs[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
90 static unsigned int remote[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
92 static unsigned int autoload = 1;
94 static unsigned int autoload = 0;
96 static unsigned int gpiomask = UNSET;
97 static unsigned int audioall = UNSET;
98 static unsigned int audiomux[5] = { [ 0 ... 4 ] = UNSET };
101 MODULE_PARM(triton1,"i");
102 MODULE_PARM_DESC(triton1,"set ETBF pci config bit "
103 "[enable bug compatibility for triton1 + others]");
104 MODULE_PARM(vsfx,"i");
105 MODULE_PARM_DESC(vsfx,"set VSFX pci config bit "
106 "[yet another chipset flaw workaround]");
107 MODULE_PARM(no_overlay,"i");
108 MODULE_PARM(latency,"i");
109 MODULE_PARM_DESC(latency,"pci latency timer");
110 MODULE_PARM(card,"1-" __stringify(BTTV_MAX) "i");
111 MODULE_PARM_DESC(card,"specify TV/grabber card model, see CARDLIST file for a list");
112 MODULE_PARM(pll,"1-" __stringify(BTTV_MAX) "i");
113 MODULE_PARM_DESC(pll,"specify installed crystal (0=none, 28=28 MHz, 35=35 MHz)");
114 MODULE_PARM(tuner,"1-" __stringify(BTTV_MAX) "i");
115 MODULE_PARM_DESC(tuner,"specify installed tuner type");
116 MODULE_PARM(autoload,"i");
117 MODULE_PARM_DESC(autoload,"automatically load i2c modules like tuner.o, default is 1 (yes)");
119 MODULE_PARM(svhs,"1-" __stringify(BTTV_MAX) "i");
120 MODULE_PARM(remote,"1-" __stringify(BTTV_MAX) "i");
122 MODULE_PARM(gpiomask,"i");
123 MODULE_PARM(audioall,"i");
124 MODULE_PARM(audiomux,"1-6i");
128 static int __init p_card(char *str) { return bttv_parse(str,BTTV_MAX,card); }
129 static int __init p_pll(char *str) { return bttv_parse(str,BTTV_MAX,pll); }
130 static int __init p_tuner(char *str) { return bttv_parse(str,BTTV_MAX,tuner); }
131 __setup("bttv.card=", p_card);
132 __setup("bttv.pll=", p_pll);
133 __setup("bttv.tuner=", p_tuner);
135 int __init bttv_parse(char *str, int max, int *vals)
137 int i,number,res = 2;
139 for (i = 0; res == 2 && i < max; i++) {
140 res = get_option(&str,&number);
148 /* ----------------------------------------------------------------------- */
149 /* list of card IDs for bt878+ cards */
155 } cards[] __devinitdata = {
156 { 0x13eb0070, BTTV_HAUPPAUGE878, "Hauppauge WinTV" },
157 { 0x39000070, BTTV_HAUPPAUGE878, "Hauppauge WinTV-D" },
158 { 0x45000070, BTTV_HAUPPAUGEPVR, "Hauppauge WinTV/PVR" },
159 { 0xff000070, BTTV_OSPREY1x0, "Osprey-100" },
160 { 0xff010070, BTTV_OSPREY2x0_SVID,"Osprey-200" },
161 { 0xff020070, BTTV_OSPREY500, "Osprey-500" },
162 { 0xff030070, BTTV_OSPREY2000, "Osprey-2000" },
163 { 0xff040070, BTTV_OSPREY540, "Osprey-540" },
165 { 0x00011002, BTTV_ATI_TVWONDER, "ATI TV Wonder" },
166 { 0x00031002, BTTV_ATI_TVWONDERVE,"ATI TV Wonder/VE" },
168 { 0x6606107d, BTTV_WINFAST2000, "Leadtek WinFast TV 2000" },
169 { 0x6607107d, BTTV_WINFASTVC100, "Leadtek WinFast VC 100" },
170 { 0x263610b4, BTTV_STB2, "STB TV PCI FM, Gateway P/N 6000704" },
171 { 0x264510b4, BTTV_STB2, "STB TV PCI FM, Gateway P/N 6000704" },
172 { 0x402010fc, BTTV_GVBCTV3PCI, "I-O Data Co. GV-BCTV3/PCI" },
173 { 0x405010fc, BTTV_GVBCTV4PCI, "I-O Data Co. GV-BCTV4/PCI" },
174 { 0x407010fc, BTTV_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" },
175 { 0xd01810fc, BTTV_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" },
177 { 0x001211bd, BTTV_PINNACLE, "Pinnacle PCTV" },
178 { 0x001c11bd, BTTV_PINNACLESAT, "Pinnacle PCTV Sat" },
179 // some cards ship with byteswapped IDs ...
180 { 0x1200bd11, BTTV_PINNACLE, "Pinnacle PCTV [bswap]" },
181 { 0xff00bd11, BTTV_PINNACLE, "Pinnacle PCTV [bswap]" },
183 { 0x3000121a, BTTV_VOODOOTV_FM, "3Dfx VoodooTV FM/ VoodooTV 200" },
184 { 0x3060121a, BTTV_STB2, "3Dfx VoodooTV 100/ STB OEM" },
186 { 0x3000144f, BTTV_MAGICTVIEW063, "(Askey Magic/others) TView99 CPH06x" },
187 { 0x3002144f, BTTV_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH05x" },
188 { 0x3005144f, BTTV_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH061/06L (T1/LC)" },
189 { 0x5000144f, BTTV_MAGICTVIEW061, "Askey CPH050" },
190 { 0x300014ff, BTTV_MAGICTVIEW061, "TView 99 (CPH061)" },
191 { 0x300214ff, BTTV_PHOEBE_TVMAS, "Phoebe TV Master (CPH060)" },
193 { 0x00011461, BTTV_AVPHONE98, "AVerMedia TVPhone98" },
194 { 0x00021461, BTTV_AVERMEDIA98, "AVermedia TVCapture 98" },
195 { 0x00031461, BTTV_AVPHONE98, "AVerMedia TVPhone98" },
196 { 0x00041461, BTTV_AVERMEDIA98, "AVerMedia TVCapture 98" },
197 { 0x03001461, BTTV_AVERMEDIA98, "VDOMATE TV TUNER CARD" },
199 { 0x1117153b, BTTV_TERRATVALUE, "Terratec TValue (Philips PAL B/G)" },
200 { 0x1118153b, BTTV_TERRATVALUE, "Terratec TValue (Temic PAL B/G)" },
201 { 0x1119153b, BTTV_TERRATVALUE, "Terratec TValue (Philips PAL I)" },
202 { 0x111a153b, BTTV_TERRATVALUE, "Terratec TValue (Temic PAL I)" },
204 { 0x1123153b, BTTV_TERRATVRADIO, "Terratec TV Radio+" },
205 { 0x1127153b, BTTV_TERRATV, "Terratec TV+ (V1.05)" },
206 // clashes with FlyVideo
207 //{ 0x18521852, BTTV_TERRATV, "Terratec TV+ (V1.10)" },
208 { 0x1134153b, BTTV_TERRATVALUE, "Terratec TValue (LR102)" },
209 { 0x1135153b, BTTV_TERRATVALUER, "Terratec TValue Radio" }, // LR102
210 { 0x5018153b, BTTV_TERRATVALUE, "Terratec TValue" }, // ??
211 { 0xff3b153b, BTTV_TERRATVALUER, "Terratec TValue Radio" }, // ??
213 { 0x400015b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV" },
214 { 0x400a15b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV" },
215 { 0x400d15b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
216 { 0x401015b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
217 { 0x401615b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
219 { 0x1430aa00, BTTV_PV143, "Provideo PV143A" },
220 { 0x1431aa00, BTTV_PV143, "Provideo PV143B" },
221 { 0x1432aa00, BTTV_PV143, "Provideo PV143C" },
222 { 0x1433aa00, BTTV_PV143, "Provideo PV143D" },
224 { 0x1460aa00, BTTV_PV150, "Provideo PV150A-1" },
225 { 0x1461aa01, BTTV_PV150, "Provideo PV150A-2" },
226 { 0x1462aa02, BTTV_PV150, "Provideo PV150A-3" },
227 { 0x1463aa03, BTTV_PV150, "Provideo PV150A-4" },
229 { 0x1464aa04, BTTV_PV150, "Provideo PV150B-1" },
230 { 0x1465aa05, BTTV_PV150, "Provideo PV150B-2" },
231 { 0x1466aa06, BTTV_PV150, "Provideo PV150B-3" },
232 { 0x1467aa07, BTTV_PV150, "Provideo PV150B-4" },
234 { 0xa132ff00, BTTV_IVC100, "IVC-100" },
235 { 0xa1550000, BTTV_IVC200, "IVC-200" },
236 { 0xa1550001, BTTV_IVC200, "IVC-200" },
237 { 0xa1550002, BTTV_IVC200, "IVC-200" },
238 { 0xa1550003, BTTV_IVC200, "IVC-200" },
239 { 0xa1550100, BTTV_IVC200, "IVC-200G" },
240 { 0xa1550101, BTTV_IVC200, "IVC-200G" },
241 { 0xa1550102, BTTV_IVC200, "IVC-200G" },
242 { 0xa1550103, BTTV_IVC200, "IVC-200G" },
243 { 0xa182ff00, BTTV_IVC120, "IVC-120G" },
244 { 0xa182ff01, BTTV_IVC120, "IVC-120G" },
245 { 0xa182ff02, BTTV_IVC120, "IVC-120G" },
246 { 0xa182ff03, BTTV_IVC120, "IVC-120G" },
247 { 0xa182ff04, BTTV_IVC120, "IVC-120G" },
248 { 0xa182ff05, BTTV_IVC120, "IVC-120G" },
249 { 0xa182ff06, BTTV_IVC120, "IVC-120G" },
250 { 0xa182ff07, BTTV_IVC120, "IVC-120G" },
251 { 0xa182ff08, BTTV_IVC120, "IVC-120G" },
252 { 0xa182ff09, BTTV_IVC120, "IVC-120G" },
253 { 0xa182ff0a, BTTV_IVC120, "IVC-120G" },
254 { 0xa182ff0b, BTTV_IVC120, "IVC-120G" },
255 { 0xa182ff0c, BTTV_IVC120, "IVC-120G" },
256 { 0xa182ff0d, BTTV_IVC120, "IVC-120G" },
257 { 0xa182ff0e, BTTV_IVC120, "IVC-120G" },
258 { 0xa182ff0f, BTTV_IVC120, "IVC-120G" },
260 { 0x41424344, BTTV_GRANDTEC, "GrandTec Multi Capture" },
261 { 0x01020304, BTTV_XGUARD, "Grandtec Grand X-Guard" },
263 { 0x010115cb, BTTV_GMV1, "AG GMV1" },
264 { 0x010114c7, BTTV_MODTEC_205, "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV" },
265 { 0x18501851, BTTV_CHRONOS_VS2, "FlyVideo 98 (LR50)/ Chronos Video Shuttle II" },
266 { 0x18511851, BTTV_FLYVIDEO98EZ, "FlyVideo 98EZ (LR51)/ CyberMail AV" },
267 { 0x18521852, BTTV_TYPHOON_TVIEW, "FlyVideo 98FM (LR50)/ Typhoon TView TV/FM Tuner" },
268 { 0x41a0a051, BTTV_FLYVIDEO_98FM, "Lifeview FlyVideo 98 LR50 Rev Q" },
269 { 0x10b42636, BTTV_HAUPPAUGE878, "STB ???" },
270 { 0x217d6606, BTTV_WINFAST2000, "Leadtek WinFast TV 2000" },
271 { 0xfff6f6ff, BTTV_WINFAST2000, "Leadtek WinFast TV 2000" },
272 { 0x03116000, BTTV_SENSORAY311, "Sensoray 311" },
273 { 0x00790e11, BTTV_WINDVR, "Canopus WinDVR PCI" },
274 { 0xa0fca1a0, BTTV_ZOLTRIX, "Face to Face Tvmax" },
275 { 0x20007063, BTTV_PC_HDTV, "pcHDTV HD-2000 TV"},
276 { 0x82b2aa6a, BTTV_SIMUS_GVC1100, "SIMUS GVC1100" },
277 { 0x146caa0c, BTTV_PV951, "ituner spectra8" },
278 { 0x200a1295, BTTV_PXC200, "ImageNation PXC200A" },
280 { 0x40111554, BTTV_PV_BT878P_9B, "Prolink Pixelview PV-BT" },
281 { 0x17de0a01, BTTV_KWORLD, "Mecer TV/FM/Video Tuner" },
283 // likely broken, vendor id doesn't match the other magic views ...
284 //{ 0xa0fca04f, BTTV_MAGICTVIEW063, "Guillemot Maxi TV Video 3" },
286 // DVB cards (using pci function .1 for mpeg data xfer)
287 { 0x01010071, BTTV_NEBULA_DIGITV, "Nebula Electronics DigiTV" },
288 { 0x002611bd, BTTV_TWINHAN_DST, "Pinnacle PCTV SAT CI" },
289 { 0x00011822, BTTV_TWINHAN_DST, "Twinhan VisionPlus DVB-T" },
290 { 0xfc00270f, BTTV_TWINHAN_DST, "ChainTech digitop DST-1000 DVB-S" },
295 /* ----------------------------------------------------------------------- */
296 /* array with description for bt848 / bt878 tv/grabber cards */
298 struct tvcard bttv_tvcards[] = {
300 /* ---- card 0x00 ---------------------------------- */
301 .name = " *** UNKNOWN/GENERIC *** ",
306 .muxsel = { 2, 3, 1, 0},
315 .muxsel = { 2, 3, 1, 1},
316 .audiomux = { 2, 0, 0, 0, 10},
320 .name = "Hauppauge (bt848)",
326 .muxsel = { 2, 3, 1, 1},
327 .audiomux = { 0, 1, 2, 3, 4},
331 .name = "STB, Gateway P/N 6000699 (bt848)",
337 .muxsel = { 2, 3, 1, 1},
338 .audiomux = { 4, 0, 2, 3, 1},
341 .tuner_type = TUNER_PHILIPS_NTSC,
346 /* ---- card 0x04 ---------------------------------- */
347 .name = "Intel Create and Share PCI/ Smart Video Recorder III",
353 .muxsel = { 2, 3, 1, 1},
358 .name = "Diamond DTV2000",
364 .muxsel = { 2, 3, 1, 0},
365 .audiomux = { 0, 1, 0, 1, 3},
369 .name = "AVerMedia TVPhone",
374 .muxsel = { 2, 3, 1, 1},
376 .audiomux = { 0x0c, 0x04, 0x08, 0x04, 0},
377 /* 0x04 for some cards ?? */
380 .audio_hook = avermedia_tvphone_audio,
383 .name = "MATRIX-Vision MV-Delta",
389 .muxsel = { 2, 3, 1, 0, 0},
395 /* ---- card 0x08 ---------------------------------- */
396 .name = "Lifeview FlyVideo II (Bt848) LR26 / MAXI TV Video PCI2 LR26",
402 .muxsel = { 2, 3, 1, 1},
403 .audiomux = { 0, 0xc00, 0x800, 0x400, 0xc00, 0},
408 .name = "IMS/IXmicro TurboTV",
414 .muxsel = { 2, 3, 1, 1},
415 .audiomux = { 1, 1, 2, 3, 0},
418 .tuner_type = TUNER_TEMIC_PAL,
420 .name = "Hauppauge (bt878)",
425 .gpiomask = 0x0f, /* old: 7 */
426 .muxsel = { 2, 0, 1, 1},
427 .audiomux = { 0, 1, 2, 3, 4},
432 .name = "MIRO PCTV pro",
438 .muxsel = { 2, 3, 1, 1},
439 .audiomux = { 0x20001,0x10001, 0, 0,10},
444 /* ---- card 0x0c ---------------------------------- */
445 .name = "ADS Technologies Channel Surfer TV (bt848)",
451 .muxsel = { 2, 3, 1, 1},
452 .audiomux = { 13, 14, 11, 7, 0, 0},
456 .name = "AVerMedia TVCapture 98",
462 .muxsel = { 2, 3, 1, 1},
463 .audiomux = { 13, 14, 11, 7, 0, 0},
467 .tuner_type = TUNER_PHILIPS_PAL,
468 .audio_hook = avermedia_tv_stereo_audio,
470 .name = "Aimslab Video Highway Xtreme (VHX)",
476 .muxsel = { 2, 3, 1, 1},
477 .audiomux = { 0, 2, 1, 3, 4}, /* old: { 0, 1, 2, 3, 4} */
482 .name = "Zoltrix TV-Max",
488 .muxsel = { 2, 3, 1, 1},
489 .audiomux = {0 , 0, 1 , 0, 10},
494 /* ---- card 0x10 ---------------------------------- */
495 .name = "Prolink Pixelview PlayTV (bt878)",
500 .gpiomask = 0x01fe00,
501 .muxsel = { 2, 3, 1, 1},
504 .audiomux = { 0x01c000, 0, 0x018000, 0x014000, 0x002000, 0 },
506 // 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru>
507 .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 },
513 .name = "Leadtek WinView 601",
518 .gpiomask = 0x8300f8,
519 .muxsel = { 2, 3, 1, 1,0},
520 .audiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007},
523 .audio_hook = winview_audio,
526 .name = "AVEC Intercapture",
532 .muxsel = {2, 3, 1, 1},
533 .audiomux = {1, 0, 0, 0, 0},
537 .name = "Lifeview FlyVideo II EZ /FlyKit LR38 Bt848 (capture only)",
542 .gpiomask = 0x8dff00,
543 .muxsel = { 2, 3, 1, 1},
549 /* ---- card 0x14 ---------------------------------- */
550 .name = "CEI Raffles Card",
555 .muxsel = {2, 3, 1, 1},
558 .name = "Lifeview FlyVideo 98/ Lucky Star Image World ConferenceTV LR50",
560 .audio_inputs = 2, // tuner, line in
564 .muxsel = { 2, 3, 1, 1},
565 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800},
567 .tuner_type = TUNER_PHILIPS_PAL_I,
569 .name = "Askey CPH050/ Phoebe Tv Master + FM",
575 .muxsel = { 2, 3, 1, 1},
576 .audiomux = {0, 1, 0x800, 0x400, 0xc00, 0},
581 .name = "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV, bt878",
587 .muxsel = { 2, 3, -1 },
588 .digital_mode = DIGITAL_MODE_CAMERA,
589 .audiomux = { 0, 0, 0, 0, 0 },
592 .tuner_type = TUNER_ALPS_TSBB5_PAL_I,
595 /* ---- card 0x18 ---------------------------------- */
596 .name = "Askey CPH05X/06X (bt878) [many vendors]",
602 .muxsel = { 2, 3, 1, 1},
603 .audiomux = {0x400, 0x400, 0x400, 0x400, 0xc00},
609 .name = "Terratec TerraTV+ Version 1.0 (Bt848)/ Terra TValue Version 1.0/ Vobis TV-Boostar",
614 .gpiomask = 0x1f0fff,
615 .muxsel = { 2, 3, 1, 1},
616 .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000},
618 .tuner_type = TUNER_PHILIPS_PAL,
619 .audio_hook = terratv_audio,
621 .name = "Hauppauge WinCam newer (bt878)",
627 .muxsel = { 2, 0, 1, 1},
628 .audiomux = { 0, 1, 2, 3, 4},
632 .name = "Lifeview FlyVideo 98/ MAXI TV Video PCI2 LR50",
638 .muxsel = { 2, 3, 1, 1},
639 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800},
641 .tuner_type = TUNER_PHILIPS_SECAM,
644 /* ---- card 0x1c ---------------------------------- */
645 .name = "Terratec TerraTV+ Version 1.1 (bt878)",
650 .gpiomask = 0x1f0fff,
651 .muxsel = { 2, 3, 1, 1},
652 .audiomux = { 0x20000, 0x30000, 0x10000, 0x00000, 0x40000},
654 .tuner_type = TUNER_PHILIPS_PAL,
655 .audio_hook = terratv_audio,
657 External 20 pin connector (for Active Radio Upgrade board)
663 gpio05: om5610-stereo
667 gpio09+10: nIOR, nSEL ?? (bt878)
671 gpio16: u2-A0 (1st 4052bt)
674 gpio19: u4-A0 (2nd 4052)
678 00000 : Cdrom (internal audio input)
679 10000 : ext. Video audio input
688 /* Jannik Fritsch <jannik@techfak.uni-bielefeld.de> */
689 .name = "Imagenation PXC200",
693 .svhs = 1, /* was: 4 */
695 .muxsel = { 2, 3, 1, 0, 0},
699 .muxsel_hook = PXC200_muxsel,
702 .name = "Lifeview FlyVideo 98 LR50",
707 .gpiomask = 0x1800, //0x8dfe00
708 .muxsel = { 2, 3, 1, 1},
709 .audiomux = { 0, 0x0800, 0x1000, 0x1000, 0x1800, 0 },
713 .name = "Formac iProTV, Formac ProTV I (bt848)",
719 .muxsel = { 2, 3, 1, 1},
720 .audiomux = { 1, 0, 0, 0, 0 },
722 .tuner_type = TUNER_PHILIPS_PAL,
725 /* ---- card 0x20 ---------------------------------- */
726 .name = "Intel Create and Share PCI/ Smart Video Recorder III",
732 .muxsel = { 2, 3, 1, 1},
737 .name = "Terratec TerraTValue Version Bt878",
742 .gpiomask = 0xffff00,
743 .muxsel = { 2, 3, 1, 1},
744 .audiomux = { 0x500, 0, 0x300, 0x900, 0x900},
747 .tuner_type = TUNER_PHILIPS_PAL,
749 .name = "Leadtek WinFast 2000/ WinFast 2000 XP",
754 .muxsel = { 2, 3, 1, 1, 0}, // TV, CVid, SVid, CVid over SVid connector
756 .gpiomask = 0xc33000,
757 .audiomux = { 0x422000,0x1000,0x0000,0x620000,0x800000 },
759 /* Alexander Varakin <avarakin@hotmail.com> [stereo version] */
760 .gpiomask = 0xb33000,
761 .audiomux = { 0x122000,0x1000,0x0000,0x620000,0x800000 },
763 /* Audio Routing for "WinFast 2000 XP" (no tv stereo !)
764 gpio23 -- hef4052:nEnable (0x800000)
767 0x0000: external audio
771 Note: There exists another variant "Winfast 2000" with tv stereo !?
772 Note: eeprom only contains FF and pci subsystem id 107d:6606
777 .tuner_type = 5, // default for now, gpio reads BFFF06 for Pal bg+dk
778 .audio_hook = winfast2000_audio,
781 .name = "Lifeview FlyVideo 98 LR50 / Chronos Video Shuttle II",
787 .muxsel = { 2, 3, 1, 1},
788 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800},
793 /* ---- card 0x24 ---------------------------------- */
794 .name = "Lifeview FlyVideo 98FM LR50 / Typhoon TView TV/FM Tuner",
800 .muxsel = { 2, 3, 1, 1},
801 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 },
806 .name = "Prolink PixelView PlayTV pro",
812 .muxsel = { 2, 3, 1, 1 },
813 .audiomux = { 0x21, 0x20, 0x24, 0x2c, 0x29, 0x29 },
818 .name = "Askey CPH06X TView99",
823 .gpiomask = 0x551e00,
824 .muxsel = { 2, 3, 1, 0},
825 .audiomux = { 0x551400, 0x551200, 0, 0, 0x551c00, 0x551200 },
831 .name = "Pinnacle PCTV Studio/Rave",
836 .gpiomask = 0x03000F,
837 .muxsel = { 2, 3, 1, 1},
838 .audiomux = { 2, 0, 0, 0, 1},
844 /* ---- card 0x28 ---------------------------------- */
845 .name = "STB TV PCI FM, Gateway P/N 6000704 (bt878), 3Dfx VoodooTV 100",
851 .muxsel = { 2, 3, 1, 1},
852 .audiomux = { 4, 0, 2, 3, 1},
855 .tuner_type = TUNER_PHILIPS_NTSC,
859 .name = "AVerMedia TVPhone 98",
865 .muxsel = { 2, 3, 1, 1},
866 .audiomux = { 13, 4, 11, 7, 0, 0},
871 .audio_hook = avermedia_tvphone_audio,
873 .name = "ProVideo PV951", /* pic16c54 */
879 .muxsel = { 2, 3, 1, 1},
880 .audiomux = { 0, 0, 0, 0, 0},
886 .name = "Little OnAir TV",
892 .muxsel = {2, 3, 1, 1},
893 .audiomux = {0xff9ff6, 0xff9ff6, 0xff1ff7, 0, 0xff3ffc},
898 /* ---- card 0x2c ---------------------------------- */
899 .name = "Sigma TVII-FM",
905 .muxsel = {2, 3, 1, 1},
906 .audiomux = {1, 1, 0, 2, 3},
911 .name = "MATRIX-Vision MV-Delta 2",
917 .muxsel = { 2, 3, 1, 0, 0},
923 .name = "Zoltrix Genie TV/FM",
928 .gpiomask = 0xbcf03f,
929 .muxsel = { 2, 3, 1, 1},
930 .audiomux = { 0xbc803f, 0xbc903f, 0xbcb03f, 0, 0xbcb03f},
935 .name = "Terratec TV/Radio+",
941 .muxsel = { 2, 3, 1, 1},
942 .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000, 0x20000 },
950 /* ---- card 0x30 ---------------------------------- */
951 .name = "Askey CPH03x/ Dynalink Magic TView",
957 .muxsel = { 2, 3, 1, 1},
958 .audiomux = {2,0,0,0,1},
963 .name = "IODATA GV-BCTV3/PCI",
968 .gpiomask = 0x010f00,
969 .muxsel = {2, 3, 0, 0},
970 .audiomux = {0x10000, 0, 0x10000, 0, 0, 0},
973 .tuner_type = TUNER_ALPS_TSHC6_NTSC,
974 .audio_hook = gvbctv3pci_audio,
976 .name = "Prolink PV-BT878P+4E / PixelView PlayTV PAK / Lenco MXTV-9578 CP",
981 .gpiomask = 0xAA0000,
982 .muxsel = { 2,3,1,1,-1 },
983 .digital_mode = DIGITAL_MODE_CAMERA,
984 .audiomux = { 0x20000, 0, 0x80000, 0x80000, 0xa8000, 0x46000 },
987 .tuner_type = TUNER_PHILIPS_PAL_I,
989 /* GPIO wiring: (different from Rev.4C !)
990 GPIO17: U4.A0 (first hef4052bt)
992 GPIO20: U5.A1 (second hef4052bt)
994 GPIO22: BT832 Reset Line
995 GPIO23: A5,A0, U5,nEN
996 Note: At i2c=0x8a is a Bt832 chip, which changes to 0x88 after being reset via GPIO22
999 .name = "Eagle Wireless Capricorn2 (bt878A)",
1005 .muxsel = { 2, 0, 1, 1},
1006 .audiomux = { 0, 1, 2, 3, 4},
1008 .tuner_type = -1 /* TUNER_ALPS_TMDH2_NTSC */,
1011 /* ---- card 0x34 ---------------------------------- */
1012 /* David Härdeman <david@2gen.com> */
1013 .name = "Pinnacle PCTV Studio Pro",
1018 .gpiomask = 0x03000F,
1019 .muxsel = { 2, 3, 1, 1},
1020 .audiomux = { 1, 0xd0001, 0, 0, 10},
1021 /* sound path (5 sources):
1022 MUX1 (mask 0x03), Enable Pin 0x08 (0=enable, 1=disable)
1025 2= Mono TV sound from Tuner
1027 MUX2 (mask 0x30000):
1029 1= FM stereo Radio from Tuner */
1034 /* Claas Langbehn <claas@bigfoot.com>,
1035 Sven Grothklags <sven@upb.de> */
1036 .name = "Typhoon TView RDS + FM Stereo / KNC1 TV Station RDS",
1042 .muxsel = { 2, 3, 1, 1},
1043 .audiomux = { 0, 0, 0x10, 8, 4 },
1046 .tuner_type = TUNER_PHILIPS_PAL,
1049 /* Tim Röstermundt <rosterm@uni-muenster.de>
1050 in de.comp.os.unix.linux.hardware:
1051 options bttv card=0 pll=1 radio=1 gpiomask=0x18e0
1052 audiomux=0x44c71f,0x44d71f,0,0x44d71f,0x44dfff
1053 options tuner type=5 */
1054 .name = "Lifeview FlyVideo 2000 /FlyVideo A2/ Lifetec LT 9415 TV [LR90]",
1060 .muxsel = { 2, 3, 1, 1},
1061 .audiomux = { 0x0000,0x0800,0x1000,0x1000,0x18e0 },
1062 /* For cards with tda9820/tda9821:
1063 0x0000: Tuner normal stereo
1064 0x0080: Tuner A2 SAP (second audio program = Zweikanalton)
1065 0x0880: Tuner A2 stereo */
1069 /* Miguel Angel Alvarez <maacruz@navegalia.com>
1070 old Easy TV BT848 version (model CPH031) */
1071 .name = "Askey CPH031/ BESTBUY Easy TV",
1077 .muxsel = { 2, 3, 1, 0},
1078 .audiomux = { 2, 0, 0, 0, 10},
1081 .tuner_type = TUNER_TEMIC_PAL,
1084 /* ---- card 0x38 ---------------------------------- */
1085 /* Gordon Heydon <gjheydon@bigfoot.com ('98) */
1086 .name = "Lifeview FlyVideo 98FM LR50",
1092 .muxsel = { 2, 3, 1, 1},
1093 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 },
1097 /* This is the ultimate cheapo capture card
1098 * just a BT848A on a small PCB!
1099 * Steve Hosgood <steve@equiinet.com> */
1100 .name = "GrandTec 'Grand Video Capture' (Bt848)",
1113 /* Daniel Herrington <daniel.herrington@home.com> */
1114 .name = "Askey CPH060/ Phoebe TV Master Only (No FM)",
1120 .muxsel = { 2, 3, 1, 1},
1121 .audiomux = { 0x400, 0x400, 0x400, 0x400, 0x800, 0x400 },
1124 .tuner_type = TUNER_TEMIC_4036FY5_NTSC,
1126 /* Matti Mottus <mottus@physic.ut.ee> */
1127 .name = "Askey CPH03x TV Capturer",
1132 .gpiomask = 0x03000F,
1133 .muxsel = { 2, 3, 1, 0},
1134 .audiomux = { 2,0,0,0,1 },
1139 /* ---- card 0x3c ---------------------------------- */
1140 /* Philip Blundell <philb@gnu.org> */
1141 .name = "Modular Technology MM100PCTV",
1147 .muxsel = { 2, 3, 1, 1},
1148 .audiomux = { 2, 0, 0, 1, 8},
1150 .tuner_type = TUNER_TEMIC_PAL,
1153 /* Adrian Cox <adrian@humboldt.co.uk */
1154 .name = "AG Electronics GMV1",
1167 /* Miguel Angel Alvarez <maacruz@navegalia.com>
1168 new Easy TV BT878 version (model CPH061)
1169 special thanks to Informatica Mieres for providing the card */
1170 .name = "Askey CPH061/ BESTBUY Easy TV (bt878)",
1176 .muxsel = { 2, 3, 1, 0},
1177 .audiomux = { 1, 0, 4, 4, 9},
1180 .tuner_type = TUNER_PHILIPS_PAL,
1182 /* Lukas Gebauer <geby@volny.cz> */
1183 .name = "ATI TV-Wonder",
1189 .muxsel = { 2, 3, 1, 0 },
1190 .audiomux = { 0xbffe, 0, 0xbfff, 0, 0xbffe},
1192 .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL,
1195 /* ---- card 0x40 ---------------------------------- */
1196 /* Lukas Gebauer <geby@volny.cz> */
1197 .name = "ATI TV-Wonder VE",
1203 .muxsel = { 2, 3, 0, 1},
1204 .audiomux = { 0, 0, 1, 0, 0},
1207 .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL,
1209 /* DeeJay <deejay@westel900.net (2000S) */
1210 .name = "Lifeview FlyVideo 2000S LR90",
1216 .muxsel = { 2, 3, 0, 1},
1217 /* Radio changed from 1e80 to 0x800 to make
1218 FlyVideo2000S in .hu happy (gm)*/
1219 /* -dk-???: set mute=0x1800 for tda9874h daughterboard */
1220 .audiomux = { 0x0000,0x0800,0x1000,0x1000,0x1800, 0x1080 },
1221 .audio_hook = fv2000s_audio,
1228 .name = "Terratec TValueRadio",
1233 .gpiomask = 0xffff00,
1234 .muxsel = { 2, 3, 1, 1},
1235 .audiomux = { 0x500, 0x500, 0x300, 0x900, 0x900},
1238 .tuner_type = TUNER_PHILIPS_PAL,
1241 /* TANAKA Kei <peg00625@nifty.com> */
1242 .name = "IODATA GV-BCTV4/PCI",
1247 .gpiomask = 0x010f00,
1248 .muxsel = {2, 3, 0, 0},
1249 .audiomux = {0x10000, 0, 0x10000, 0, 0, 0},
1252 .tuner_type = TUNER_SHARP_2U5JF5540_NTSC,
1253 .audio_hook = gvbctv3pci_audio,
1256 /* ---- card 0x44 ---------------------------------- */
1257 .name = "3Dfx VoodooTV FM (Euro), VoodooTV 200 (USA)",
1258 // try "insmod msp3400 simple=0" if you have
1259 // sound problems with this card.
1264 .gpiomask = 0x4f8a00,
1265 // 0x100000: 1=MSP enabled (0=disable again)
1266 // 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC)
1267 .audiomux = {0x947fff, 0x987fff,0x947fff,0x947fff, 0x947fff},
1268 // tvtuner, radio, external,internal, mute, stereo
1269 /* tuner, Composit, SVid, Composit-on-Svid-adapter*/
1270 .muxsel = { 2, 3 ,0 ,1},
1271 .tuner_type = TUNER_MT2032,
1275 /* Philip Blundell <pb@nexus.co.uk> */
1276 .name = "Active Imaging AIMMS",
1285 /* Tomasz Pyra <hellfire@sedez.iq.pl> */
1286 .name = "Prolink Pixelview PV-BT878P+ (Rev.4C,8E)",
1292 .muxsel = { 2, 3, 1, 1},
1293 .audiomux = { 0, 0, 11, 7, 13, 0}, // TV and Radio with same GPIO !
1299 GPIO0: U4.A0 (hef4052bt)
1301 GPIO2: U4.A1 (second hef4052bt)
1302 GPIO3: U4.nEN, U5.A0, A5.nEN
1306 .name = "Lifeview FlyVideo 98EZ (capture only) LR51",
1311 .muxsel = { 2, 3, 1, 1}, // AV1, AV2, SVHS, CVid adapter on SVHS
1316 /* ---- card 0x48 ---------------------------------- */
1317 /* Dariusz Kowalewski <darekk@automex.pl> */
1318 .name = "Prolink Pixelview PV-BT878P+9B (PlayTV Pro rev.9B FM+NICAM)",
1324 .muxsel = { 2, 3, 1, 1 },
1325 .audiomux = { 0x01, 0x00, 0x03, 0x03, 0x09, 0x02 },
1331 .audio_hook = pvbt878p9b_audio, // Note: not all cards have stereo
1332 .has_radio = 1, // Note: not all cards have radio
1339 GPIO20,22,23: R30,R29,R28
1342 /* Clay Kunz <ckunz@mail.arc.nasa.gov> */
1343 /* you must jumper JP5 for the card to work */
1344 .name = "Sensoray 311",
1350 .muxsel = { 2, 3, 1, 0, 0},
1355 /* Miguel Freitas <miguel@cetuc.puc-rio.br> */
1356 .name = "RemoteVision MX (RV605)",
1362 .gpiomask2 = 0x07ff,
1363 .muxsel = { 0x33, 0x13, 0x23, 0x43, 0xf3, 0x73, 0xe3, 0x03,
1364 0xd3, 0xb3, 0xc3, 0x63, 0x93, 0x53, 0x83, 0xa3 },
1368 .muxsel_hook = rv605_muxsel,
1370 .name = "Powercolor MTV878/ MTV878R/ MTV878F",
1375 .gpiomask = 0x1C800F, // Bit0-2: Audio select, 8-12:remote control 14:remote valid 15:remote reset
1376 .muxsel = { 2, 1, 1, },
1377 .audiomux = { 0, 1, 2, 2, 4 },
1379 .tuner_type = TUNER_PHILIPS_PAL,
1384 /* ---- card 0x4c ---------------------------------- */
1385 /* Masaki Suzuki <masaki@btree.org> */
1386 .name = "Canopus WinDVR PCI (COMPAQ Presario 3524JP, 5112JP)",
1391 .gpiomask = 0x140007,
1392 .muxsel = { 2, 3, 1, 1 },
1393 .audiomux = { 0, 1, 2, 3, 4, 0 },
1394 .tuner_type = TUNER_PHILIPS_NTSC,
1395 .audio_hook = windvr_audio,
1397 .name = "GrandTec Multi Capture Card (Bt878)",
1403 .muxsel = { 2, 3, 1, 0 },
1410 .name = "Jetway TV/Capture JW-TV878-FBK, Kworld KW-TV878RF",
1416 .muxsel = { 2, 3, 1, 1 }, // Tuner, SVid, SVHS, SVid to SVHS connector
1417 .audiomux = { 0 ,0 ,4, 4,4,4},// Yes, this tuner uses the same audio output for TV and FM radio!
1418 // This card lacks external Audio In, so we mute it on Ext. & Int.
1419 // The PCB can take a sbx1637/sbx1673, wiring unknown.
1420 // This card lacks PCI subsystem ID, sigh.
1421 // audiomux=1: lower volume, 2+3: mute
1422 // btwincap uses 0x80000/0x80003
1426 .tuner_type = 5, // Samsung TCPA9095PC27A (BG+DK), philips compatible, w/FM, stereo and
1427 // radio signal strength indicators work fine.
1430 GPIO0,1: HEF4052 A0,A1
1431 GPIO2: HEF4052 nENABLE
1433 GPIO8-13: IRDC357 data0-5 (data6 n.c. ?) [chip not present on my card]
1437 ?? : mtu8b56ep microcontroller for IR (GPIO wiring unknown)*/
1439 /* Arthur Tetzlaff-Deas, DSP Design Ltd <software@dspdesign.com> */
1440 .name = "DSP Design TCVIDEO",
1443 .muxsel = { 2, 3, 1, 0},
1448 /* ---- card 0x50 ---------------------------------- */
1449 .name = "Hauppauge WinTV PVR",
1454 .muxsel = { 2, 0, 1, 1},
1462 .name = "IODATA GV-BCTV5/PCI",
1467 .gpiomask = 0x0f0f80,
1468 .muxsel = {2, 3, 1, 0},
1469 .audiomux = {0x030000, 0x010000, 0, 0, 0x020000, 0},
1472 .tuner_type = TUNER_PHILIPS_NTSC_M,
1473 .audio_hook = gvbctv5pci_audio,
1476 .name = "Osprey 100/150 (878)", /* 0x1(2|3)-45C6-C1 */
1477 .video_inputs = 4, /* id-inputs-clock */
1481 .muxsel = { 3, 2, 0, 1 },
1488 .name = "Osprey 100/150 (848)", /* 0x04-54C0-C1 & older boards */
1493 .muxsel = { 2, 3, 1 },
1501 /* ---- card 0x54 ---------------------------------- */
1502 .name = "Osprey 101 (848)", /* 0x05-40C0-C1 */
1514 .name = "Osprey 101/151", /* 0x1(4|5)-0004-C4 */
1526 .name = "Osprey 101/151 w/ svid", /* 0x(16|17|20)-00C4-C1 */
1538 .name = "Osprey 200/201/250/251", /* 0x1(8|9|E|F)-0004-C4 */
1551 /* ---- card 0x58 ---------------------------------- */
1552 .name = "Osprey 200/250", /* 0x1(A|B)-00C4-C1 */
1564 .name = "Osprey 210/220", /* 0x1(A|B)-04C0-C1 */
1576 .name = "Osprey 500", /* 500 */
1588 .name = "Osprey 540", /* 540 */
1592 #if 0 /* TODO ... */
1593 .svhs = OSPREY540_SVID_ANALOG,
1594 .muxsel = { [OSPREY540_COMP_ANALOG] = 2,
1595 [OSPREY540_SVID_ANALOG] = 3, },
1602 #if 0 /* TODO ... */
1603 .muxsel_hook = osprey_540_muxsel,
1604 .picture_hook = osprey_540_set_picture,
1608 /* ---- card 0x5C ---------------------------------- */
1609 .name = "Osprey 2000", /* 2000 */
1619 .no_tda7432 = 1, /* must avoid, conflicts with the bt860 */
1621 /* M G Berberich <berberic@forwiss.uni-passau.de> */
1622 .name = "IDS Eagle",
1629 .muxsel = { 0, 1, 2, 3 },
1630 .muxsel_hook = eagle_muxsel,
1635 .name = "Pinnacle PCTV Sat",
1645 .audiomux = { 0, 0, 0, 0, 1 },
1646 .muxsel = { 3, 0, 1, 2},
1650 .name = "Formac ProTV II (bt878)",
1656 // TV, Comp1, Composite over SVID con, SVID
1657 .muxsel = { 2, 3, 1, 1},
1658 .audiomux = { 2, 2, 0, 0, 0 },
1661 .tuner_type = TUNER_PHILIPS_PAL,
1663 GPIO=0x00,0x01,0x03: mute (?)
1664 0x02: both TV and radio (tuner: FM1216/I)
1665 The card has onboard audio connectors labeled "cdrom" and "board",
1666 not soldered here, though unknown wiring.
1667 Card lacks: external audio in, pci subsystem id.
1671 /* ---- card 0x60 ---------------------------------- */
1678 .muxsel = { 2, 3, 1, 1},
1679 .audiomux = { 0, 1, 2, 3, 4},
1684 .name = "Euresys Picolo",
1693 .muxsel = { 2, 0, 1},
1696 /* Luc Van Hoeylandt <luc@e-magic.be> */
1697 .name = "ProVideo PV150", /* 0x4f */
1710 /* Hiroshi Takekawa <sian@big.or.jp> */
1711 /* This card lacks subsystem ID */
1712 .name = "AD-TVK503", /* 0x63 */
1717 .gpiomask = 0x001e8007,
1718 .muxsel = { 2, 3, 1, 0 },
1719 /* Tuner, Radio, external, internal, off, on */
1720 .audiomux = { 0x08, 0x0f, 0x0a, 0x08, 0x0f, 0x08 },
1725 .audio_hook = adtvk503_audio,
1728 /* ---- card 0x64 ---------------------------------- */
1729 .name = "Hercules Smart TV Stereo",
1735 .muxsel = { 2, 3, 1, 1 },
1741 - card lacks subsystem ID
1742 - stereo variant w/ daughter board with tda9874a @0xb0
1744 always from tda9874 independent of GPIO (?)
1745 external line in: unknown
1746 - Other chips: em78p156elp @ 0x96 (probably IR remote control)
1747 hef4053 (instead 4052) for unknown function
1750 .name = "Pace TV & Radio Card",
1755 .muxsel = { 2, 3, 1, 1}, // Tuner, CVid, SVid, CVid over SVid connector
1762 /* Bt878, Bt832, FI1246 tuner; no pci subsystem id
1763 only internal line out: (4pin header) RGGL
1764 Radio must be decoded by msp3410d (not routed through)*/
1765 // .digital_mode = DIGITAL_MODE_CAMERA, // todo!
1767 /* Chris Willing <chris@vislab.usyd.edu.au> */
1778 .name = "Grand X-Guard / Trust 814PCI",
1785 .muxsel = { 2,2,2,2, 3,3,3,3, 1,1,1,1, 0,0,0,0 },
1786 .muxsel_hook = xguard_muxsel,
1793 /* ---- card 0x68 ---------------------------------- */
1794 .name = "Nebula Electronics DigiTV",
1798 .muxsel = { 2, 3, 1, 0},
1807 /* Jorge Boncompte - DTI2 <jorge@dti2.net> */
1808 .name = "ProVideo PV143",
1814 .muxsel = { 2, 3, 1, 0 },
1821 /* M.Klahr@phytec.de */
1822 .name = "PHYTEC VD-009-X1 MiniDIN (bt878)",
1825 .tuner = -1, /* card has no tuner */
1828 .muxsel = { 2, 3, 1, 0},
1829 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1834 .name = "PHYTEC VD-009-X1 Combi (bt878)",
1837 .tuner = -1, /* card has no tuner */
1840 .muxsel = { 2, 3, 1, 1},
1841 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1847 /* ---- card 0x6c ---------------------------------- */
1848 .name = "PHYTEC VD-009 MiniDIN (bt878)",
1851 .tuner = -1, /* card has no tuner */
1854 .gpiomask2 = 0x03, /* gpiomask2 defines the bits used to switch audio
1855 via the upper nibble of muxsel. here: used for
1856 xternal video-mux */
1857 .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x00 },
1858 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1863 .name = "PHYTEC VD-009 Combi (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, 0x01 },
1873 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1885 .muxsel = { 2, 3, 1, 0 },
1888 /* IVC-120G - Alan Garfield <alan@fromorbit.com> */
1891 .audio_inputs = 0, /* card has no audio */
1892 .tuner = -1, /* card has no tuner */
1894 .svhs = -1, /* card has no svhs */
1900 .muxsel = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
1901 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10 },
1902 .muxsel_hook = ivc120_muxsel,
1906 /* ---- card 0x70 ---------------------------------- */
1907 .name = "pcHDTV HD-2000 TV",
1912 .muxsel = { 2, 3, 1, 0},
1913 .tuner_type = TUNER_PHILIPS_ATSC,
1915 .name = "Twinhan DST + clones",
1919 .tuner_type = TUNER_ABSENT,
1923 .name = "Winfast VC100",
1927 .tuner = -1, // no tuner
1928 .muxsel = { 3, 1, 1, 3}, // Vid In, SVid In, Vid over SVid in connector
1932 .tuner_type = TUNER_ABSENT,
1936 .name = "Teppro TEV-560/InterVision IV-560",
1942 .muxsel = { 2, 3, 1, 1},
1943 .audiomux = { 1, 1, 1, 1, 0},
1945 .tuner_type = TUNER_PHILIPS_PAL,
1949 /* ---- card 0x74 ---------------------------------- */
1950 .name = "SIMUS GVC1100",
1957 .muxsel = { 2, 2, 2, 2},
1959 .muxsel_hook = gvc1100_muxsel,
1961 /* Carlos Silva r3pek@r3pek.homelinux.org || card 0x75 */
1962 .name = "NGS NGSTV+",
1966 .gpiomask = 0x008007,
1967 .muxsel = {2, 3, 0, 0},
1968 .audiomux = {0, 0, 0, 0, 0x000003, 0},
1970 .tuner_type = TUNER_PHILIPS_PAL,
1973 /* http://linuxmedialabs.com */
1975 .video_inputs = 4, /* IN1,IN2,IN3,IN4 */
1979 .muxsel = { 2, 3, 1, 0 },
1985 /* Helmroos Harri <harri.helmroos@pp.inet.fi> */
1986 .name = "Tekram M205 PRO",
1990 .tuner_type = TUNER_PHILIPS_PAL,
1994 .muxsel = { 2, 3, 1},
1995 .audiomux = { 0x68, 0x68, 0x61, 0x61, 0x00 },
1999 /* ---- card 0x78 ---------------------------------- */
2000 /* Javier Cendan Ares <jcendan@lycos.es> */
2001 /* bt878 TV + FM without subsystem ID */
2002 .name = "Conceptronic CONTVFMi",
2007 .gpiomask = 0x008007,
2008 .muxsel = { 2, 3, 1, 1 },
2009 .audiomux = { 0, 1, 2, 2, 3 },
2012 .tuner_type = TUNER_PHILIPS_PAL,
2017 const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards);
2019 /* ----------------------------------------------------------------------- */
2021 static unsigned char eeprom_data[256];
2026 void __devinit bttv_idcard(struct bttv *btv)
2028 unsigned int gpiobits;
2032 /* read PCI subsystem ID */
2033 pci_read_config_word(btv->c.pci, PCI_SUBSYSTEM_ID, &tmp);
2034 btv->cardid = tmp << 16;
2035 pci_read_config_word(btv->c.pci, PCI_SUBSYSTEM_VENDOR_ID, &tmp);
2038 if (0 != btv->cardid && 0xffffffff != btv->cardid) {
2039 /* look for the card */
2040 for (type = -1, i = 0; cards[i].id != 0; i++)
2041 if (cards[i].id == btv->cardid)
2046 printk(KERN_INFO "bttv%d: detected: %s [card=%d], "
2047 "PCI subsystem ID is %04x:%04x\n",
2048 btv->c.nr,cards[type].name,cards[type].cardnr,
2049 btv->cardid & 0xffff,
2050 (btv->cardid >> 16) & 0xffff);
2051 btv->c.type = cards[type].cardnr;
2054 printk(KERN_INFO "bttv%d: subsystem: %04x:%04x (UNKNOWN)\n",
2055 btv->c.nr, btv->cardid & 0xffff,
2056 (btv->cardid >> 16) & 0xffff);
2057 printk(KERN_DEBUG "please mail id, board name and "
2058 "the correct card= insmod option to kraxel@bytesex.org\n");
2062 /* let the user override the autodetected type */
2063 if (card[btv->c.nr] < bttv_num_tvcards)
2064 btv->c.type=card[btv->c.nr];
2066 /* print which card config we are using */
2067 printk(KERN_INFO "bttv%d: using: %s [card=%d,%s]\n",btv->c.nr,
2068 bttv_tvcards[btv->c.type].name, btv->c.type,
2069 card[btv->c.nr] < bttv_num_tvcards
2070 ? "insmod option" : "autodetected");
2072 /* overwrite gpio stuff ?? */
2073 if (UNSET == audioall && UNSET == audiomux[0])
2076 if (UNSET != audiomux[0]) {
2078 for (i = 0; i < 5; i++) {
2079 bttv_tvcards[btv->c.type].audiomux[i] = audiomux[i];
2080 gpiobits |= audiomux[i];
2083 gpiobits = audioall;
2084 for (i = 0; i < 5; i++) {
2085 bttv_tvcards[btv->c.type].audiomux[i] = audioall;
2088 bttv_tvcards[btv->c.type].gpiomask = (UNSET != gpiomask) ? gpiomask : gpiobits;
2089 printk(KERN_INFO "bttv%d: gpio config override: mask=0x%x, mux=",
2090 btv->c.nr,bttv_tvcards[btv->c.type].gpiomask);
2091 for (i = 0; i < 5; i++) {
2092 printk("%s0x%x", i ? "," : "", bttv_tvcards[btv->c.type].audiomux[i]);
2098 * (most) board specific initialisations goes here
2101 /* Some Modular Technology cards have an eeprom, but no subsystem ID */
2102 void identify_by_eeprom(struct bttv *btv, unsigned char eeprom_data[256])
2106 if (0 == strncmp(eeprom_data,"GET MM20xPCTV",13))
2107 type = BTTV_MODTEC_205;
2108 else if (0 == strncmp(eeprom_data+20,"Picolo",7))
2109 type = BTTV_EURESYS_PICOLO;
2110 else if (eeprom_data[0] == 0x84 && eeprom_data[2]== 0)
2111 type = BTTV_HAUPPAUGE; /* old bt848 */
2115 printk("bttv%d: detected by eeprom: %s [card=%d]\n",
2116 btv->c.nr, bttv_tvcards[btv->c.type].name, btv->c.type);
2120 static void flyvideo_gpio(struct bttv *btv)
2122 int gpio,has_remote,has_radio,is_capture_only,is_lr90,has_tda9820_tda9821;
2125 gpio_inout(0xffffff, 0);
2126 udelay(8); // without this we would see the 0x1800 mask
2128 /* FIXME: must restore OUR_EN ??? */
2130 // all cards provide GPIO info, some have an additional eeprom
2131 // LR50: GPIO coding can be found lower right CP1 .. CP9
2132 // CP9=GPIO23 .. CP1=GPIO15; when OPEN, the corresponding GPIO reads 1.
2134 // LR90: GP9=GPIO23 .. GP1=GPIO15 (right above the bt878)
2136 // lowest 3 bytes are remote control codes (no handshake needed)
2137 // xxxFFF: No remote control chip soldered
2138 // xxxF00(LR26/LR50), xxxFE0(LR90): Remote control chip (LVA001 or CF45) soldered
2139 // Note: Some bits are Audio_Mask !
2141 ttype=(gpio&0x0f0000)>>16;
2143 case 0x0: tuner=2; // NTSC, e.g. TPI8NSR11P
2145 case 0x2: tuner=39;// LG NTSC (newer TAPC series) TAPC-H701P
2147 case 0x4: tuner=5; // Philips PAL TPI8PSB02P, TPI8PSB12P, TPI8PSB12D or FI1216, FM1216
2149 case 0x6: tuner=37; // LG PAL (newer TAPC series) TAPC-G702P
2151 case 0xC: tuner=3; // Philips SECAM(+PAL) FQ1216ME or FI1216MF
2154 printk(KERN_INFO "bttv%d: FlyVideo_gpio: unknown tuner type.\n", btv->c.nr);
2157 has_remote = gpio & 0x800000;
2158 has_radio = gpio & 0x400000;
2159 // unknown 0x200000;
2160 // unknown2 0x100000;
2161 is_capture_only = !(gpio & 0x008000); //GPIO15
2162 has_tda9820_tda9821 = !(gpio & 0x004000);
2163 is_lr90 = !(gpio & 0x002000); // else LR26/LR50 (LR38/LR51 f. capture only)
2164 // gpio & 0x001000 // output bit for audio routing
2167 tuner=4; // No tuner present
2169 printk(KERN_INFO "bttv%d: FlyVideo Radio=%s RemoteControl=%s Tuner=%d gpio=0x%06x\n",
2170 btv->c.nr, has_radio? "yes":"no ", has_remote? "yes":"no ", tuner, gpio);
2171 printk(KERN_INFO "bttv%d: FlyVideo LR90=%s tda9821/tda9820=%s capture_only=%s\n",
2172 btv->c.nr, is_lr90?"yes":"no ", has_tda9820_tda9821?"yes":"no ",
2173 is_capture_only?"yes":"no ");
2175 if(tuner!= -1) // only set if known tuner autodetected, else let insmod option through
2176 btv->tuner_type = tuner;
2177 btv->has_radio = has_radio;
2179 // LR90 Audio Routing is done by 2 hef4052, so Audio_Mask has 4 bits: 0x001c80
2180 // LR26/LR50 only has 1 hef4052, Audio_Mask 0x000c00
2181 // Audio options: from tuner, from tda9821/tda9821(mono,stereo,sap), from tda9874, ext., mute
2182 if(has_tda9820_tda9821) btv->audio_hook = lt9415_audio;
2183 //todo: if(has_tda9874) btv->audio_hook = fv2000s_audio;
2186 int miro_tunermap[] = { 0,6,2,3, 4,5,6,0, 3,0,4,5, 5,2,16,1,
2187 14,2,17,1, 4,1,4,3, 1,2,16,1, 4,4,4,4 };
2188 int miro_fmtuner[] = { 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1,
2189 1,1,1,1, 1,1,1,0, 0,0,0,0, 0,1,0,0 };
2191 static void miro_pinnacle_gpio(struct bttv *btv)
2196 gpio_inout(0xffffff, 0);
2198 id = ((gpio>>10) & 63) -1;
2199 msp = bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx");
2201 btv->tuner_type = miro_tunermap[id];
2202 if (0 == (gpio & 0x20)) {
2204 if (!miro_fmtuner[id]) {
2205 btv->has_matchbox = 1;
2206 btv->mbox_we = (1<<6);
2207 btv->mbox_most = (1<<7);
2208 btv->mbox_clk = (1<<8);
2209 btv->mbox_data = (1<<9);
2210 btv->mbox_mask = (1<<6)|(1<<7)|(1<<8)|(1<<9);
2216 if (btv->c.type == BTTV_MIRO)
2217 btv->c.type = BTTV_MIROPRO;
2218 if (btv->c.type == BTTV_PINNACLE)
2219 btv->c.type = BTTV_PINNACLEPRO;
2222 "bttv%d: miro: id=%d tuner=%d radio=%s stereo=%s\n",
2223 btv->c.nr, id+1, btv->tuner_type,
2224 !btv->has_radio ? "no" :
2225 (btv->has_matchbox ? "matchbox" : "fmtuner"),
2226 (-1 == msp) ? "no" : "yes");
2228 /* new cards with microtune tuner */
2233 info = "PAL / mono";
2236 info = "PAL+SECAM / stereo";
2240 info = "NTSC / stereo";
2244 info = "PAL+SECAM / mono";
2247 info = "NTSC / mono";
2250 info = "NTSC / stereo";
2253 info = "PAL / stereo";
2256 info = "oops: unknown card";
2260 btv->c.type = BTTV_PINNACLEPRO;
2262 "bttv%d: pinnacle/mt: id=%d info=\"%s\" radio=%s\n",
2263 btv->c.nr, id, info, btv->has_radio ? "yes" : "no");
2264 btv->tuner_type = 33;
2265 btv->pinnacle_id = id;
2269 /* GPIO21 L: Buffer aktiv, H: Buffer inaktiv */
2270 #define LM1882_SYNC_DRIVE 0x200000L
2272 static void init_ids_eagle(struct bttv *btv)
2274 gpio_inout(0xffffff,0xFFFF37);
2275 gpio_write(0x200020);
2277 /* flash strobe inverter ?! */
2278 gpio_write(0x200024);
2280 /* switch sync drive off */
2281 gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE);
2283 /* set BT848 muxel to 2 */
2284 btaor((2)<<5, ~(2<<5), BT848_IFORM);
2287 /* Muxsel helper for the IDS Eagle.
2288 * the eagles does not use the standard muxsel-bits but
2289 * has its own multiplexer */
2290 static void eagle_muxsel(struct bttv *btv, unsigned int input)
2292 btaor((2)<<5, ~(3<<5), BT848_IFORM);
2293 gpio_bits(3,bttv_tvcards[btv->c.type].muxsel[input&7]);
2297 /* wake chroma ADC */
2298 btand(~BT848_ADC_C_SLEEP, BT848_ADC);
2299 /* set to YC video */
2300 btor(BT848_CONTROL_COMP, BT848_E_CONTROL);
2301 btor(BT848_CONTROL_COMP, BT848_O_CONTROL);
2304 /* set chroma ADC to sleep */
2305 btor(BT848_ADC_C_SLEEP, BT848_ADC);
2306 /* set to composite video */
2307 btand(~BT848_CONTROL_COMP, BT848_E_CONTROL);
2308 btand(~BT848_CONTROL_COMP, BT848_O_CONTROL);
2311 /* switch sync drive off */
2312 gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE);
2315 static void gvc1100_muxsel(struct bttv *btv, unsigned int input)
2317 static const int masks[] = {0x30, 0x01, 0x12, 0x23};
2318 gpio_write(masks[input%4]);
2321 /* LMLBT4x initialization - to allow access to GPIO bits for sensors input and
2324 GPIObit | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
2325 assignment | TI | O3|INx| O2| O1|IN4|IN3|IN2|IN1| | |
2327 IN - sensor inputs, INx - sensor inputs and TI XORed together
2328 O1,O2,O3 - alarm outputs (relays)
2330 OUT ENABLE 1 1 0 . 1 1 0 0 . 0 0 0 0 = 0x6C0
2334 static void init_lmlbt4x(struct bttv *btv)
2336 printk(KERN_DEBUG "LMLBT4x init\n");
2337 btwrite(0x000000, BT848_GPIO_REG_INP);
2338 gpio_inout(0xffffff, 0x0006C0);
2339 gpio_write(0x000000);
2343 /* ----------------------------------------------------------------------- */
2345 void bttv_reset_audio(struct bttv *btv)
2348 * BT878A has a audio-reset register.
2349 * 1. This register is an audio reset function but it is in
2350 * function-0 (video capture) address space.
2351 * 2. It is enough to do this once per power-up of the card.
2352 * 3. There is a typo in the Conexant doc -- it is not at
2353 * 0x5B, but at 0x058. (B is an odd-number, obviously a typo!).
2354 * --//Shrikumar 030609
2360 printk("bttv%d: BT878A ARESET\n",btv->c.nr);
2361 btwrite((1<<7), 0x058);
2366 /* initialization part one -- before registering i2c bus */
2367 void __devinit bttv_init_card1(struct bttv *btv)
2369 switch (btv->c.type) {
2370 case BTTV_HAUPPAUGE:
2371 case BTTV_HAUPPAUGE878:
2372 boot_msp34xx(btv,5);
2374 case BTTV_VOODOOTV_FM:
2375 boot_msp34xx(btv,20);
2377 case BTTV_AVERMEDIA98:
2378 boot_msp34xx(btv,11);
2380 case BTTV_HAUPPAUGEPVR:
2383 case BTTV_TWINHAN_DST:
2384 btv->use_i2c_hw = 1;
2389 /* initialization part two -- after registering i2c bus */
2390 void __devinit bttv_init_card2(struct bttv *btv)
2392 btv->tuner_type = -1;
2394 if (BTTV_UNKNOWN == btv->c.type) {
2395 bttv_readee(btv,eeprom_data,0xa0);
2396 identify_by_eeprom(btv,eeprom_data);
2399 switch (btv->c.type) {
2403 case BTTV_PINNACLEPRO:
2405 miro_pinnacle_gpio(btv);
2407 case BTTV_FLYVIDEO_98:
2409 case BTTV_LIFE_FLYKIT:
2411 case BTTV_TYPHOON_TVIEW:
2412 case BTTV_CHRONOS_VS2:
2413 case BTTV_FLYVIDEO_98FM:
2414 case BTTV_FLYVIDEO2000:
2415 case BTTV_FLYVIDEO98EZ:
2416 case BTTV_CONFERENCETV:
2417 case BTTV_LIFETEC_9415:
2420 case BTTV_HAUPPAUGE:
2421 case BTTV_HAUPPAUGE878:
2422 case BTTV_HAUPPAUGEPVR:
2423 /* pick up some config infos from the eeprom */
2424 bttv_readee(btv,eeprom_data,0xa0);
2425 hauppauge_eeprom(btv);
2427 case BTTV_AVERMEDIA98:
2428 case BTTV_AVPHONE98:
2429 bttv_readee(btv,eeprom_data,0xa0);
2430 avermedia_eeprom(btv);
2437 btv->has_matchbox = 1;
2438 btv->mbox_we = 0x20;
2440 btv->mbox_clk = 0x08;
2441 btv->mbox_data = 0x10;
2442 btv->mbox_mask = 0x38;
2444 case BTTV_VOBIS_BOOSTAR:
2446 terratec_active_radio_upgrade(btv);
2448 case BTTV_MAGICTVIEW061:
2449 if (btv->cardid == 0x3002144f) {
2451 printk("bttv%d: radio detected by subsystem id (CPH05x)\n",btv->c.nr);
2455 if (btv->cardid == 0x3060121a) {
2456 /* Fix up entry for 3DFX VoodooTV 100,
2457 which is an OEM STB card variant. */
2459 btv->tuner_type=TUNER_TEMIC_NTSC;
2462 case BTTV_OSPREY1x0:
2463 case BTTV_OSPREY1x0_848:
2464 case BTTV_OSPREY101_848:
2465 case BTTV_OSPREY1x1:
2466 case BTTV_OSPREY1x1_SVID:
2467 case BTTV_OSPREY2xx:
2468 case BTTV_OSPREY2x0_SVID:
2469 case BTTV_OSPREY2x0:
2470 case BTTV_OSPREY500:
2471 case BTTV_OSPREY540:
2472 case BTTV_OSPREY2000:
2473 bttv_readee(btv,eeprom_data,0xa0);
2476 case BTTV_IDS_EAGLE:
2477 init_ids_eagle(btv);
2479 case BTTV_MODTEC_205:
2480 bttv_readee(btv,eeprom_data,0xa0);
2488 /* pll configuration */
2489 if (!(btv->id==848 && btv->revision==0x11)) {
2490 /* defaults from card list */
2491 if (PLL_28 == bttv_tvcards[btv->c.type].pll) {
2492 btv->pll.pll_ifreq=28636363;
2493 btv->pll.pll_crystal=BT848_IFORM_XT0;
2495 if (PLL_35 == bttv_tvcards[btv->c.type].pll) {
2496 btv->pll.pll_ifreq=35468950;
2497 btv->pll.pll_crystal=BT848_IFORM_XT1;
2499 /* insmod options can override */
2500 switch (pll[btv->c.nr]) {
2502 btv->pll.pll_crystal = 0;
2503 btv->pll.pll_ifreq = 0;
2504 btv->pll.pll_ofreq = 0;
2506 case 1: /* 28 MHz */
2508 btv->pll.pll_ifreq = 28636363;
2509 btv->pll.pll_ofreq = 0;
2510 btv->pll.pll_crystal = BT848_IFORM_XT0;
2512 case 2: /* 35 MHz */
2514 btv->pll.pll_ifreq = 35468950;
2515 btv->pll.pll_ofreq = 0;
2516 btv->pll.pll_crystal = BT848_IFORM_XT1;
2520 btv->pll.pll_current = -1;
2522 /* tuner configuration (from card list / autodetect / insmod option) */
2523 if (UNSET != bttv_tvcards[btv->c.type].tuner_type)
2524 if(UNSET == btv->tuner_type)
2525 btv->tuner_type = bttv_tvcards[btv->c.type].tuner_type;
2526 if (UNSET != tuner[btv->c.nr])
2527 btv->tuner_type = tuner[btv->c.nr];
2528 printk("bttv%d: using tuner=%d\n",btv->c.nr,btv->tuner_type);
2529 if (btv->pinnacle_id != UNSET)
2530 bttv_call_i2c_clients(btv,AUDC_CONFIG_PINNACLE,
2532 if (btv->tuner_type != UNSET)
2533 bttv_call_i2c_clients(btv,TUNER_SET_TYPE,&btv->tuner_type);
2534 btv->svhs = bttv_tvcards[btv->c.type].svhs;
2535 if (svhs[btv->c.nr] != UNSET)
2536 btv->svhs = svhs[btv->c.nr];
2537 if (remote[btv->c.nr] != UNSET)
2538 btv->has_remote = remote[btv->c.nr];
2540 if (bttv_tvcards[btv->c.type].has_radio)
2542 if (bttv_tvcards[btv->c.type].has_remote)
2544 if (bttv_tvcards[btv->c.type].no_gpioirq)
2546 if (bttv_tvcards[btv->c.type].audio_hook)
2547 btv->audio_hook=bttv_tvcards[btv->c.type].audio_hook;
2549 if (bttv_tvcards[btv->c.type].digital_mode == DIGITAL_MODE_CAMERA) {
2550 /* detect Bt832 chip for quartzsight digital camera */
2551 if ((bttv_I2CRead(btv, I2C_BT832_ALT1, "Bt832") >=0) ||
2552 (bttv_I2CRead(btv, I2C_BT832_ALT2, "Bt832") >=0))
2556 /* try to detect audio/fader chips */
2557 if (!bttv_tvcards[btv->c.type].no_msp34xx &&
2558 bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx") >=0) {
2560 request_module("msp3400");
2563 if (bttv_tvcards[btv->c.type].msp34xx_alt &&
2564 bttv_I2CRead(btv, I2C_MSP3400_ALT, "MSP34xx (alternate address)") >=0) {
2566 request_module("msp3400");
2569 if (!bttv_tvcards[btv->c.type].no_tda9875 &&
2570 bttv_I2CRead(btv, I2C_TDA9875, "TDA9875") >=0) {
2572 request_module("tda9875");
2575 if (!bttv_tvcards[btv->c.type].no_tda7432 &&
2576 bttv_I2CRead(btv, I2C_TDA7432, "TDA7432") >=0) {
2578 request_module("tda7432");
2581 if (bttv_tvcards[btv->c.type].needs_tvaudio) {
2583 request_module("tvaudio");
2587 if (btv->pinnacle_id != UNSET) {
2589 request_module("tda9887");
2591 if (btv->tuner_type != UNSET) {
2593 request_module("tuner");
2598 /* ----------------------------------------------------------------------- */
2599 /* some hauppauge specific stuff */
2601 static struct HAUPPAUGE_TUNER
2606 hauppauge_tuner[] __devinitdata =
2608 { TUNER_ABSENT, "" },
2609 { TUNER_ABSENT, "External" },
2610 { TUNER_ABSENT, "Unspecified" },
2611 { TUNER_PHILIPS_PAL, "Philips FI1216" },
2612 { TUNER_PHILIPS_SECAM, "Philips FI1216MF" },
2613 { TUNER_PHILIPS_NTSC, "Philips FI1236" },
2614 { TUNER_PHILIPS_PAL_I, "Philips FI1246" },
2615 { TUNER_PHILIPS_PAL_DK,"Philips FI1256" },
2616 { TUNER_PHILIPS_PAL, "Philips FI1216 MK2" },
2617 { TUNER_PHILIPS_SECAM, "Philips FI1216MF MK2" },
2618 { TUNER_PHILIPS_NTSC, "Philips FI1236 MK2" },
2619 { TUNER_PHILIPS_PAL_I, "Philips FI1246 MK2" },
2620 { TUNER_PHILIPS_PAL_DK,"Philips FI1256 MK2" },
2621 { TUNER_TEMIC_NTSC, "Temic 4032FY5" },
2622 { TUNER_TEMIC_PAL, "Temic 4002FH5" },
2623 { TUNER_TEMIC_PAL_I, "Temic 4062FY5" },
2624 { TUNER_PHILIPS_PAL, "Philips FR1216 MK2" },
2625 { TUNER_PHILIPS_SECAM, "Philips FR1216MF MK2" },
2626 { TUNER_PHILIPS_NTSC, "Philips FR1236 MK2" },
2627 { TUNER_PHILIPS_PAL_I, "Philips FR1246 MK2" },
2628 { TUNER_PHILIPS_PAL_DK,"Philips FR1256 MK2" },
2629 { TUNER_PHILIPS_PAL, "Philips FM1216" },
2630 { TUNER_PHILIPS_SECAM, "Philips FM1216MF" },
2631 { TUNER_PHILIPS_NTSC, "Philips FM1236" },
2632 { TUNER_PHILIPS_PAL_I, "Philips FM1246" },
2633 { TUNER_PHILIPS_PAL_DK,"Philips FM1256" },
2634 { TUNER_TEMIC_4036FY5_NTSC, "Temic 4036FY5" },
2635 { TUNER_ABSENT, "Samsung TCPN9082D" },
2636 { TUNER_ABSENT, "Samsung TCPM9092P" },
2637 { TUNER_TEMIC_4006FH5_PAL, "Temic 4006FH5" },
2638 { TUNER_ABSENT, "Samsung TCPN9085D" },
2639 { TUNER_ABSENT, "Samsung TCPB9085P" },
2640 { TUNER_ABSENT, "Samsung TCPL9091P" },
2641 { TUNER_TEMIC_4039FR5_NTSC, "Temic 4039FR5" },
2642 { TUNER_PHILIPS_FQ1216ME, "Philips FQ1216 ME" },
2643 { TUNER_TEMIC_4066FY5_PAL_I, "Temic 4066FY5" },
2644 { TUNER_PHILIPS_NTSC, "Philips TD1536" },
2645 { TUNER_PHILIPS_NTSC, "Philips TD1536D" },
2646 { TUNER_PHILIPS_NTSC, "Philips FMR1236" }, /* mono radio */
2647 { TUNER_ABSENT, "Philips FI1256MP" },
2648 { TUNER_ABSENT, "Samsung TCPQ9091P" },
2649 { TUNER_TEMIC_4006FN5_MULTI_PAL, "Temic 4006FN5" },
2650 { TUNER_TEMIC_4009FR5_PAL, "Temic 4009FR5" },
2651 { TUNER_TEMIC_4046FM5, "Temic 4046FM5" },
2652 { TUNER_TEMIC_4009FN5_MULTI_PAL_FM, "Temic 4009FN5" },
2653 { TUNER_ABSENT, "Philips TD1536D_FH_44"},
2654 { TUNER_LG_NTSC_FM, "LG TPI8NSR01F"},
2655 { TUNER_LG_PAL_FM, "LG TPI8PSB01D"},
2656 { TUNER_LG_PAL, "LG TPI8PSB11D"},
2657 { TUNER_LG_PAL_I_FM, "LG TAPC-I001D"},
2658 { TUNER_LG_PAL_I, "LG TAPC-I701D"}
2661 static void modtec_eeprom(struct bttv *btv)
2663 if( strncmp(&(eeprom_data[0x1e]),"Temic 4066 FY5",14) ==0) {
2664 btv->tuner_type=TUNER_TEMIC_4066FY5_PAL_I;
2665 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
2666 btv->c.nr,&eeprom_data[0x1e]);
2667 } else if (strncmp(&(eeprom_data[0x1e]),"Alps TSBB5",10) ==0) {
2668 btv->tuner_type=TUNER_ALPS_TSBB5_PAL_I;
2669 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
2670 btv->c.nr,&eeprom_data[0x1e]);
2672 printk("bttv%d: Modtec: Unknown TunerString: %s\n",
2673 btv->c.nr,&eeprom_data[0x1e]);
2677 static void __devinit hauppauge_eeprom(struct bttv *btv)
2679 unsigned int blk2,tuner,radio,model;
2681 if (eeprom_data[0] != 0x84 || eeprom_data[2] != 0)
2682 printk(KERN_WARNING "bttv%d: Hauppauge eeprom: invalid\n",
2685 /* Block 2 starts after len+3 bytes header */
2686 blk2 = eeprom_data[1] + 3;
2688 /* decode + use some config infos */
2689 model = eeprom_data[12] << 8 | eeprom_data[11];
2690 tuner = eeprom_data[9];
2691 radio = eeprom_data[blk2-1] & 0x01;
2693 if (tuner < ARRAY_SIZE(hauppauge_tuner))
2694 btv->tuner_type = hauppauge_tuner[tuner].id;
2699 printk(KERN_INFO "bttv%d: Hauppauge eeprom: model=%d, "
2700 "tuner=%s (%d), radio=%s\n",
2701 btv->c.nr, model, hauppauge_tuner[tuner].name,
2702 btv->tuner_type, radio ? "yes" : "no");
2705 static int terratec_active_radio_upgrade(struct bttv *btv)
2710 btv->has_matchbox = 1;
2711 btv->mbox_we = 0x10;
2712 btv->mbox_most = 0x20;
2713 btv->mbox_clk = 0x08;
2714 btv->mbox_data = 0x04;
2715 btv->mbox_mask = 0x3c;
2717 btv->mbox_iow = 1 << 8;
2718 btv->mbox_ior = 1 << 9;
2719 btv->mbox_csel = 1 << 10;
2722 tea5757_write(btv, 5 * freq + 0x358); // write 0x1ed8
2723 if (0x1ed8 == tea5757_read(btv)) {
2724 printk("bttv%d: Terratec Active Radio Upgrade found.\n",
2727 btv->has_matchbox = 1;
2730 btv->has_matchbox = 0;
2736 /* ----------------------------------------------------------------------- */
2739 * minimal bootstrap for the WinTV/PVR -- upload altera firmware.
2741 * The hcwamc.rbf firmware file is on the Hauppauge driver CD. Have
2742 * a look at Pvr/pvr45xxx.EXE (self-extracting zip archive, can be
2743 * unpacked with unzip).
2745 #define PVR_GPIO_DELAY 10
2747 #define BTTV_ALT_DATA 0x000001
2748 #define BTTV_ALT_DCLK 0x100000
2749 #define BTTV_ALT_NCONFIG 0x800000
2751 static int __devinit pvr_altera_load(struct bttv *btv, u8 *micro, u32 microlen)
2757 gpio_inout(0xffffff,BTTV_ALT_DATA|BTTV_ALT_DCLK|BTTV_ALT_NCONFIG);
2759 udelay(PVR_GPIO_DELAY);
2761 gpio_write(BTTV_ALT_NCONFIG);
2762 udelay(PVR_GPIO_DELAY);
2764 for (n = 0; n < microlen; n++) {
2766 for ( i = 0 ; i < 8 ; i++ ) {
2767 gpio_bits(BTTV_ALT_DCLK,0);
2769 gpio_bits(BTTV_ALT_DATA,BTTV_ALT_DATA);
2771 gpio_bits(BTTV_ALT_DATA,0);
2772 gpio_bits(BTTV_ALT_DCLK,BTTV_ALT_DCLK);
2776 gpio_bits(BTTV_ALT_DCLK,0);
2777 udelay(PVR_GPIO_DELAY);
2779 /* begin Altera init loop (Not necessary,but doesn't hurt) */
2780 for (i = 0 ; i < 30 ; i++) {
2781 gpio_bits(BTTV_ALT_DCLK,0);
2782 gpio_bits(BTTV_ALT_DCLK,BTTV_ALT_DCLK);
2784 gpio_bits(BTTV_ALT_DCLK,0);
2788 #ifndef CONFIG_FW_LOADER
2789 /* old 2.4.x way -- via soundcore's mod_firmware_load */
2791 static char *firm_altera = "/usr/lib/video4linux/hcwamc.rbf";
2792 MODULE_PARM(firm_altera,"s");
2793 MODULE_PARM_DESC(firm_altera,"WinTV/PVR firmware "
2794 "(driver CD => unzip pvr45xxx.exe => hcwamc.rbf)");
2796 extern int mod_firmware_load(const char *fn, char **fp);
2798 int __devinit pvr_boot(struct bttv *btv)
2804 microlen = mod_firmware_load(firm_altera, (char**) µ);
2806 printk(KERN_WARNING "bttv%d: altera firmware not found [%s]\n",
2807 btv->c.nr, firm_altera);
2811 printk(KERN_INFO "bttv%d: uploading altera firmware [%s] ...\n",
2812 btv->c.nr, firm_altera);
2813 result = pvr_altera_load(btv, micro, microlen);
2814 printk(KERN_INFO "bttv%d: ... upload %s\n",
2815 btv->c.nr, (result < 0) ? "failed" : "ok");
2820 /* new 2.5.x way -- via hotplug firmware loader */
2822 int __devinit pvr_boot(struct bttv *btv)
2824 const struct firmware *fw_entry;
2827 rc = request_firmware(&fw_entry, "hcwamc.rbf", &btv->c.pci->dev);
2829 printk(KERN_WARNING "bttv%d: no altera firmware [via hotplug]\n",
2833 rc = pvr_altera_load(btv, fw_entry->data, fw_entry->size);
2834 printk(KERN_INFO "bttv%d: altera firmware upload %s\n",
2835 btv->c.nr, (rc < 0) ? "failed" : "ok");
2836 release_firmware(fw_entry);
2841 /* ----------------------------------------------------------------------- */
2842 /* some osprey specific stuff */
2844 static void __devinit osprey_eeprom(struct bttv *btv)
2847 unsigned char *ee = eeprom_data;
2848 unsigned long serial = 0;
2850 if (btv->c.type == 0) {
2851 /* this might be an antique... check for MMAC label in eeprom */
2852 if ((ee[0]=='M') && (ee[1]=='M') && (ee[2]=='A') && (ee[3]=='C')) {
2853 unsigned char checksum = 0;
2854 for (i =0; i<21; i++)
2856 if (checksum != ee[21])
2858 btv->c.type = BTTV_OSPREY1x0_848;
2859 for (i = 12; i < 21; i++)
2860 serial *= 10, serial += ee[i] - '0';
2863 unsigned short type;
2866 for(; offset < 8*16; offset += 16) {
2867 unsigned short checksum = 0;
2868 /* verify the checksum */
2869 for(i = 0; i<14; i++) checksum += ee[i+offset];
2870 checksum = ~checksum; /* no idea why */
2871 if ((((checksum>>8)&0x0FF) == ee[offset+14]) &&
2872 ((checksum & 0x0FF) == ee[offset+15])) {
2880 /* found a valid descriptor */
2881 type = (ee[offset+4]<<8) | (ee[offset+5]);
2887 btv->c.type = BTTV_OSPREY1x0_848;
2890 btv->c.type = BTTV_OSPREY101_848;
2896 btv->c.type = BTTV_OSPREY1x0;
2900 btv->c.type = BTTV_OSPREY1x1;
2905 btv->c.type = BTTV_OSPREY1x1_SVID;
2911 btv->c.type = BTTV_OSPREY2xx;
2915 btv->c.type = BTTV_OSPREY2x0_SVID;
2918 btv->c.type = BTTV_OSPREY500;
2922 btv->c.type = BTTV_OSPREY540;
2923 /* bttv_osprey_540_init(btv); */
2927 btv->c.type = BTTV_OSPREY2x0;
2928 //enable output on select control lines
2929 gpio_inout(0xffffff,0x000303);
2932 /* unknown...leave generic, but get serial # */
2935 serial = (ee[offset+6] << 24)
2936 | (ee[offset+7] << 16)
2937 | (ee[offset+8] << 8)
2941 printk(KERN_INFO "bttv%d: osprey eeprom: card=%d name=%s serial=%ld\n",
2942 btv->c.nr, btv->c.type, bttv_tvcards[btv->c.type].name,serial);
2945 /* ----------------------------------------------------------------------- */
2946 /* AVermedia specific stuff, from bktr_card.c */
2948 int tuner_0_table[] = {
2949 TUNER_PHILIPS_NTSC, TUNER_PHILIPS_PAL /* PAL-BG*/,
2950 TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL /* PAL-I*/,
2951 TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL,
2952 TUNER_PHILIPS_SECAM, TUNER_PHILIPS_SECAM,
2953 TUNER_PHILIPS_SECAM, TUNER_PHILIPS_PAL};
2955 int tuner_0_fm_table[] = {
2956 PHILIPS_FR1236_NTSC, PHILIPS_FR1216_PAL,
2957 PHILIPS_FR1216_PAL, PHILIPS_FR1216_PAL,
2958 PHILIPS_FR1216_PAL, PHILIPS_FR1216_PAL,
2959 PHILIPS_FR1236_SECAM, PHILIPS_FR1236_SECAM,
2960 PHILIPS_FR1236_SECAM, PHILIPS_FR1216_PAL};
2963 int tuner_1_table[] = {
2964 TUNER_TEMIC_NTSC, TUNER_TEMIC_PAL,
2965 TUNER_TEMIC_PAL, TUNER_TEMIC_PAL,
2966 TUNER_TEMIC_PAL, TUNER_TEMIC_PAL,
2967 TUNER_TEMIC_4012FY5, TUNER_TEMIC_4012FY5, //TUNER_TEMIC_SECAM
2968 TUNER_TEMIC_4012FY5, TUNER_TEMIC_PAL};
2970 static void __devinit avermedia_eeprom(struct bttv *btv)
2972 int tuner_make,tuner_tv_fm,tuner_format,tuner=0;
2974 tuner_make = (eeprom_data[0x41] & 0x7);
2975 tuner_tv_fm = (eeprom_data[0x41] & 0x18) >> 3;
2976 tuner_format = (eeprom_data[0x42] & 0xf0) >> 4;
2977 btv->has_remote = (eeprom_data[0x42] & 0x01);
2979 if (tuner_make == 0 || tuner_make == 2)
2980 if(tuner_format <=9)
2981 tuner = tuner_0_table[tuner_format];
2982 if (tuner_make == 1)
2983 if(tuner_format <=9)
2984 tuner = tuner_1_table[tuner_format];
2986 printk(KERN_INFO "bttv%d: Avermedia eeprom[0x%02x%02x]: tuner=",
2987 btv->c.nr,eeprom_data[0x41],eeprom_data[0x42]);
2989 btv->tuner_type=tuner;
2992 printk("Unknown type");
2993 printk(" radio:%s remote control:%s\n",
2994 tuner_tv_fm ? "yes" : "no",
2995 btv->has_remote ? "yes" : "no");
2998 /* used on Voodoo TV/FM (Voodoo 200), S0 wired to 0x10000 */
2999 void bttv_tda9880_setnorm(struct bttv *btv, int norm)
3001 // fix up our card entry
3002 if(norm==VIDEO_MODE_NTSC) {
3003 bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[0]=0x957fff;
3004 bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[4]=0x957fff;
3005 dprintk("bttv_tda9880_setnorm to NTSC\n");
3008 bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[0]=0x947fff;
3009 bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[4]=0x947fff;
3010 dprintk("bttv_tda9880_setnorm to PAL\n");
3012 // set GPIO according
3013 gpio_bits(bttv_tvcards[btv->c.type].gpiomask,
3014 bttv_tvcards[btv->c.type].audiomux[btv->audio]);
3019 * reset/enable the MSP on some Hauppauge cards
3020 * Thanks to Kyösti Mälkki (kmalkki@cc.hut.fi)!
3025 static void __devinit boot_msp34xx(struct bttv *btv, int pin)
3027 int mask = (1 << pin);
3029 gpio_inout(mask,mask);
3032 gpio_bits(mask,mask);
3035 bttv_gpio_tracking(btv,"msp34xx");
3037 printk(KERN_INFO "bttv%d: Hauppauge/Voodoo msp34xx: reset line "
3038 "init [%d]\n", btv->c.nr, pin);
3041 static void __devinit boot_bt832(struct bttv *btv)
3045 switch (btv->c.type) {
3046 case BTTV_PXELVWPLTVPAK:
3047 resetbit = 0x400000;
3049 case BTTV_MODTEC_205:
3056 request_module("bt832");
3057 bttv_call_i2c_clients(btv, BT832_HEXDUMP, NULL);
3059 printk("bttv%d: Reset Bt832 [line=0x%x]\n",btv->c.nr,resetbit);
3061 gpio_inout(resetbit, resetbit);
3063 gpio_bits(resetbit, resetbit);
3065 gpio_bits(resetbit, 0);
3068 // bt832 on pixelview changes from i2c 0x8a to 0x88 after
3069 // being reset as above. So we must follow by this:
3070 bttv_call_i2c_clients(btv, BT832_REATTACH, NULL);
3073 /* ----------------------------------------------------------------------- */
3074 /* Imagenation L-Model PXC200 Framegrabber */
3075 /* This is basically the same procedure as
3076 * used by Alessandro Rubini in his pxc200
3077 * driver, but using BTTV functions */
3079 static void __devinit init_PXC200(struct bttv *btv)
3081 static int vals[] __devinitdata = { 0x08, 0x09, 0x0a, 0x0b, 0x0d, 0x0d,
3082 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
3088 /* Initialise GPIO-connevted stuff */
3089 gpio_inout(0xffffff, (1<<13));
3093 /* GPIO inputs are pulled up, so no need to drive
3094 * reset pin any longer */
3095 gpio_bits(0xffffff, 0);
3097 bttv_gpio_tracking(btv,"pxc200");
3099 /* we could/should try and reset/control the AD pots? but
3100 right now we simply turned off the crushing. Without
3101 this the AGC drifts drifts
3102 remember the EN is reverse logic -->
3103 setting BT848_ADC_AGC_EN disable the AGC
3104 tboult@eecs.lehigh.edu
3107 btwrite(BT848_ADC_RESERVED|BT848_ADC_AGC_EN, BT848_ADC);
3109 /* Initialise MAX517 DAC */
3110 printk(KERN_INFO "Setting DAC reference voltage level ...\n");
3111 bttv_I2CWrite(btv,0x5E,0,0x80,1);
3113 /* Initialise 12C508 PIC */
3114 /* The I2CWrite and I2CRead commmands are actually to the
3115 * same chips - but the R/W bit is included in the address
3116 * argument so the numbers are different */
3119 printk(KERN_INFO "Initialising 12C508 PIC chip ...\n");
3121 /* First of all, enable the clock line. This is used in the PXC200-F */
3122 val = btread(BT848_GPIO_DMA_CTL);
3123 val |= BT848_GPIO_DMA_CTL_GPCLKMODE;
3124 btwrite(val, BT848_GPIO_DMA_CTL);
3126 /* Then, push to 0 the reset pin long enough to reset the *
3127 * device same as above for the reset line, but not the same
3128 * value sent to the GPIO-connected stuff
3129 * which one is the good one? */
3130 gpio_inout(0xffffff,(1<<2));
3135 for (i = 0; i < ARRAY_SIZE(vals); i++) {
3136 tmp=bttv_I2CWrite(btv,0x1E,0,vals[i],1);
3139 "I2C Write(%2.2x) = %i\nI2C Read () = %2.2x\n\n",
3140 vals[i],tmp,bttv_I2CRead(btv,0x1F,NULL));
3144 printk(KERN_INFO "PXC200 Initialised.\n");
3148 /* ----------------------------------------------------------------------- */
3149 /* Miro Pro radio stuff -- the tea5757 is connected to some GPIO ports */
3151 * Copyright (c) 1999 Csaba Halasz <qgehali@uni-miskolc.hu>
3152 * This code is placed under the terms of the GNU General Public License
3154 * Brutally hacked by Dan Sheridan <dan.sheridan@contact.org.uk> djs52 8/3/00
3157 void bus_low(struct bttv *btv, int bit)
3159 if (btv->mbox_ior) {
3160 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3161 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3168 if (btv->mbox_ior) {
3169 gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
3174 void bus_high(struct bttv *btv, int bit)
3176 if (btv->mbox_ior) {
3177 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3178 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3185 if (btv->mbox_ior) {
3186 gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
3191 int bus_in(struct bttv *btv, int bit)
3193 if (btv->mbox_ior) {
3194 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3195 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3198 gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
3201 return gpio_read() & (bit);
3204 /* TEA5757 register bits */
3205 #define TEA_FREQ 0:14
3206 #define TEA_BUFFER 15:15
3208 #define TEA_SIGNAL_STRENGTH 16:17
3210 #define TEA_PORT1 18:18
3211 #define TEA_PORT0 19:19
3213 #define TEA_BAND 20:21
3214 #define TEA_BAND_FM 0
3215 #define TEA_BAND_MW 1
3216 #define TEA_BAND_LW 2
3217 #define TEA_BAND_SW 3
3219 #define TEA_MONO 22:22
3220 #define TEA_ALLOW_STEREO 0
3221 #define TEA_FORCE_MONO 1
3223 #define TEA_SEARCH_DIRECTION 23:23
3224 #define TEA_SEARCH_DOWN 0
3225 #define TEA_SEARCH_UP 1
3227 #define TEA_STATUS 24:24
3228 #define TEA_STATUS_TUNED 0
3229 #define TEA_STATUS_SEARCHING 1
3231 /* Low-level stuff */
3232 static int tea5757_read(struct bttv *btv)
3234 unsigned long timeout;
3238 /* better safe than sorry */
3239 gpio_inout(btv->mbox_mask, btv->mbox_clk | btv->mbox_we);
3241 if (btv->mbox_ior) {
3242 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3243 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3248 bttv_gpio_tracking(btv,"tea5757 read");
3250 bus_low(btv,btv->mbox_we);
3251 bus_low(btv,btv->mbox_clk);
3254 timeout= jiffies + HZ;
3256 // wait for DATA line to go low; error if it doesn't
3257 while (bus_in(btv,btv->mbox_data) && time_before(jiffies, timeout))
3259 if (bus_in(btv,btv->mbox_data)) {
3260 printk(KERN_WARNING "bttv%d: tea5757: read timeout\n",btv->c.nr);
3264 dprintk("bttv%d: tea5757:",btv->c.nr);
3265 for(i = 0; i < 24; i++)
3268 bus_high(btv,btv->mbox_clk);
3270 dprintk("%c",(bus_in(btv,btv->mbox_most) == 0)?'T':'-');
3271 bus_low(btv,btv->mbox_clk);
3273 value |= (bus_in(btv,btv->mbox_data) == 0)?0:1; /* MSB first */
3274 dprintk("%c", (bus_in(btv,btv->mbox_most) == 0)?'S':'M');
3276 dprintk("\nbttv%d: tea5757: read 0x%X\n", btv->c.nr, value);
3280 static int tea5757_write(struct bttv *btv, int value)
3285 gpio_inout(btv->mbox_mask, btv->mbox_clk | btv->mbox_we | btv->mbox_data);
3287 if (btv->mbox_ior) {
3288 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3289 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3293 bttv_gpio_tracking(btv,"tea5757 write");
3295 dprintk("bttv%d: tea5757: write 0x%X\n", btv->c.nr, value);
3296 bus_low(btv,btv->mbox_clk);
3297 bus_high(btv,btv->mbox_we);
3298 for(i = 0; i < 25; i++)
3300 if (reg & 0x1000000)
3301 bus_high(btv,btv->mbox_data);
3303 bus_low(btv,btv->mbox_data);
3305 bus_high(btv,btv->mbox_clk);
3307 bus_low(btv,btv->mbox_clk);
3310 bus_low(btv,btv->mbox_we); /* unmute !!! */
3314 void tea5757_set_freq(struct bttv *btv, unsigned short freq)
3316 dprintk("tea5757_set_freq %d\n",freq);
3317 tea5757_write(btv, 5 * freq + 0x358); /* add 10.7MHz (see docs) */
3319 /* breaks Miro PCTV */
3320 value = tea5757_read(btv);
3321 dprintk("bttv%d: tea5757 readback=0x%x\n",btv->c.nr,value);
3326 /* ----------------------------------------------------------------------- */
3329 void winview_audio(struct bttv *btv, struct video_audio *v, int set)
3331 /* PT2254A programming Jon Tombs, jon@gte.esi.us.es */
3332 int bits_out, loops, vol, data;
3335 /* Fixed by Leandro Lucarella <luca@linuxmendoza.org.ar (07/31/01) */
3336 v->flags |= VIDEO_AUDIO_VOLUME;
3340 /* 32 levels logarithmic */
3341 vol = 32 - ((v->volume>>11));
3343 bits_out = (PT2254_DBS_IN_2>>(vol%5));
3345 bits_out |= (PT2254_DBS_IN_10>>(vol/5));
3346 bits_out |= PT2254_L_CHANNEL | PT2254_R_CHANNEL;
3348 data &= ~(WINVIEW_PT2254_CLK| WINVIEW_PT2254_DATA|
3349 WINVIEW_PT2254_STROBE);
3350 for (loops = 17; loops >= 0 ; loops--) {
3351 if (bits_out & (1<<loops))
3352 data |= WINVIEW_PT2254_DATA;
3354 data &= ~WINVIEW_PT2254_DATA;
3357 data |= WINVIEW_PT2254_CLK;
3360 data &= ~WINVIEW_PT2254_CLK;
3363 data |= WINVIEW_PT2254_STROBE;
3364 data &= ~WINVIEW_PT2254_DATA;
3367 data &= ~WINVIEW_PT2254_STROBE;
3371 /* ----------------------------------------------------------------------- */
3372 /* mono/stereo control for various cards (which don't use i2c chips but */
3373 /* connect something to the GPIO pins */
3376 gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set)
3378 unsigned int con = 0;
3381 gpio_inout(0x300, 0x300);
3382 if (v->mode & VIDEO_SOUND_LANG1)
3384 if (v->mode & VIDEO_SOUND_LANG2)
3386 if (v->mode & VIDEO_SOUND_STEREO)
3388 // if (v->mode & VIDEO_SOUND_MONO)
3390 gpio_bits(0x300, con);
3392 v->mode = VIDEO_SOUND_STEREO |
3393 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3398 gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set)
3400 unsigned int val, con;
3402 #if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0)
3403 if (btv->radio_user)
3413 if (v->mode & VIDEO_SOUND_LANG2) {
3414 if (v->mode & VIDEO_SOUND_LANG1) {
3423 if (con != (val & 0x300)) {
3424 gpio_bits(0x300, con);
3426 bttv_gpio_tracking(btv,"gvbctv5pci");
3429 switch (val & 0x70) {
3431 v->mode = VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3434 v->mode = VIDEO_SOUND_LANG2;
3437 v->mode = VIDEO_SOUND_LANG1;
3440 v->mode = VIDEO_SOUND_STEREO;
3443 v->mode = VIDEO_SOUND_MONO;
3446 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3447 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3453 * Mario Medina Nussbaum <medisoft@alohabbs.org.mx>
3454 * I discover that on BT848_GPIO_DATA address a byte 0xcce enable stereo,
3455 * 0xdde enables mono and 0xccd enables sap
3457 * Petr Vandrovec <VANDROVE@vc.cvut.cz>
3458 * P.S.: At least mask in line above is wrong - GPIO pins 3,2 select
3459 * input/output sound connection, so both must be set for output mode.
3461 * Looks like it's needed only for the "tvphone", the "tvphone 98"
3462 * handles this with a tda9840
3466 avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, int set)
3471 if (v->mode & VIDEO_SOUND_LANG2) /* SAP */
3473 if (v->mode & VIDEO_SOUND_STEREO)
3476 gpio_bits(0x03,val);
3478 bttv_gpio_tracking(btv,"avermedia");
3481 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3488 avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v, int set)
3493 if (v->mode & VIDEO_SOUND_LANG2) /* SAP */
3495 if (v->mode & VIDEO_SOUND_STEREO) /* STEREO */
3497 btaor(val, ~0x03, BT848_GPIO_DATA);
3499 bttv_gpio_tracking(btv,"avermedia");
3501 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3502 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3507 /* Lifetec 9415 handling */
3509 lt9415_audio(struct bttv *btv, struct video_audio *v, int set)
3513 if (gpio_read() & 0x4000) {
3514 v->mode = VIDEO_SOUND_MONO;
3519 if (v->mode & VIDEO_SOUND_LANG2) /* A2 SAP */
3521 if (v->mode & VIDEO_SOUND_STEREO) /* A2 stereo */
3523 if ((v->mode & VIDEO_SOUND_LANG1) ||
3524 (v->mode & VIDEO_SOUND_MONO))
3526 gpio_bits(0x0880, val);
3528 bttv_gpio_tracking(btv,"lt9415");
3530 /* autodetect doesn't work with this card :-( */
3531 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3532 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3537 // TDA9821 on TerraTV+ Bt848, Bt878
3539 terratv_audio(struct bttv *btv, struct video_audio *v, int set)
3541 unsigned int con = 0;
3544 gpio_inout(0x180000,0x180000);
3545 if (v->mode & VIDEO_SOUND_LANG2)
3547 if (v->mode & VIDEO_SOUND_STEREO)
3549 gpio_bits(0x180000, con);
3551 bttv_gpio_tracking(btv,"terratv");
3553 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3554 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3559 winfast2000_audio(struct bttv *btv, struct video_audio *v, int set)
3561 unsigned long val = 0;
3564 /*btor (0xc32000, BT848_GPIO_OUT_EN);*/
3565 if (v->mode & VIDEO_SOUND_MONO) /* Mono */
3567 if (v->mode & VIDEO_SOUND_LANG1) /* Mono */
3569 if (v->mode & VIDEO_SOUND_LANG2) /* SAP */
3571 if (v->mode & VIDEO_SOUND_STEREO) /* Stereo */
3574 gpio_bits(0x430000, val);
3576 bttv_gpio_tracking(btv,"winfast2000");
3579 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3580 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3585 * Dariusz Kowalewski <darekk@automex.pl>
3586 * sound control for Prolink PV-BT878P+9B (PixelView PlayTV Pro FM+NICAM
3587 * revision 9B has on-board TDA9874A sound decoder).
3589 * Note: There are card variants without tda9874a. Forcing the "stereo sound route"
3590 * will mute this cards.
3593 pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set)
3595 unsigned int val = 0;
3597 #if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0)
3598 if (btv->radio_user)
3606 if (v->mode & VIDEO_SOUND_MONO) {
3609 if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2))
3610 || (v->mode & VIDEO_SOUND_STEREO)) {
3614 gpio_bits(0x03,val);
3616 bttv_gpio_tracking(btv,"pvbt878p9b");
3619 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3620 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3625 * Dariusz Kowalewski <darekk@automex.pl>
3626 * sound control for FlyVideo 2000S (with tda9874 decoder)
3627 * based on pvbt878p9b_audio() - this is not tested, please fix!!!
3630 fv2000s_audio(struct bttv *btv, struct video_audio *v, int set)
3632 unsigned int val = 0xffff;
3634 #if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0)
3635 if (btv->radio_user)
3642 if (v->mode & VIDEO_SOUND_MONO) {
3645 if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2))
3646 || (v->mode & VIDEO_SOUND_STEREO)) {
3647 val = 0x1080; //-dk-???: 0x0880, 0x0080, 0x1800 ...
3649 if (val != 0xffff) {
3650 gpio_bits(0x1800, val);
3652 bttv_gpio_tracking(btv,"fv2000s");
3655 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3656 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3661 * sound control for Canopus WinDVR PCI
3662 * Masaki Suzuki <masaki@btree.org>
3665 windvr_audio(struct bttv *btv, struct video_audio *v, int set)
3667 unsigned long val = 0;
3670 if (v->mode & VIDEO_SOUND_MONO)
3672 if (v->mode & VIDEO_SOUND_LANG1)
3674 if (v->mode & VIDEO_SOUND_LANG2)
3676 if (v->mode & VIDEO_SOUND_STEREO)
3679 gpio_bits(0x140000, val);
3681 bttv_gpio_tracking(btv,"windvr");
3684 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3685 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3690 * sound control for AD-TVK503
3691 * Hiroshi Takekawa <sian@big.or.jp>
3694 adtvk503_audio(struct bttv *btv, struct video_audio *v, int set)
3696 unsigned int con = 0xffffff;
3698 //btaor(0x1e0000, ~0x1e0000, BT848_GPIO_OUT_EN);
3701 //btor(***, BT848_GPIO_OUT_EN);
3702 if (v->mode & VIDEO_SOUND_LANG1)
3704 if (v->mode & VIDEO_SOUND_LANG2)
3706 if (v->mode & VIDEO_SOUND_STEREO)
3708 if (v->mode & VIDEO_SOUND_MONO)
3710 if (con != 0xffffff) {
3711 gpio_bits(0x1e0000,con);
3713 bttv_gpio_tracking(btv, "adtvk503");
3716 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3717 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3721 /* RemoteVision MX (rv605) muxsel helper [Miguel Freitas]
3723 * This is needed because rv605 don't use a normal multiplex, but a crosspoint
3724 * switch instead (CD22M3494E). This IC can have multiple active connections
3725 * between Xn (input) and Yn (output) pins. We need to clear any existing
3726 * connection prior to establish a new one, pulsing the STROBE pin.
3728 * The board hardwire Y0 (xpoint) to MUX1 and MUXOUT to Yin.
3729 * GPIO pins are wired as:
3730 * GPIO[0:3] - AX[0:3] (xpoint) - P1[0:3] (microcontroler)
3731 * GPIO[4:6] - AY[0:2] (xpoint) - P1[4:6] (microcontroler)
3732 * GPIO[7] - DATA (xpoint) - P1[7] (microcontroler)
3733 * GPIO[8] - - P3[5] (microcontroler)
3734 * GPIO[9] - RESET (xpoint) - P3[6] (microcontroler)
3735 * GPIO[10] - STROBE (xpoint) - P3[7] (microcontroler)
3736 * GPINTR - - P3[4] (microcontroler)
3738 * The microcontroler is a 80C32 like. It should be possible to change xpoint
3739 * configuration either directly (as we are doing) or using the microcontroler
3740 * which is also wired to I2C interface. I have no further info on the
3741 * microcontroler features, one would need to disassembly the firmware.
3742 * note: the vendor refused to give any information on this product, all
3743 * that stuff was found using a multimeter! :)
3745 static void rv605_muxsel(struct bttv *btv, unsigned int input)
3747 /* reset all conections */
3748 gpio_bits(0x200,0x200);
3750 gpio_bits(0x200,0x000);
3753 /* create a new conection */
3754 gpio_bits(0x480,0x080);
3755 gpio_bits(0x480,0x480);
3757 gpio_bits(0x480,0x080);
3761 // The Grandtec X-Guard framegrabber card uses two Dual 4-channel
3762 // video multiplexers to provide up to 16 video inputs. These
3763 // multiplexers are controlled by the lower 8 GPIO pins of the
3764 // bt878. The multiplexers probably Pericom PI5V331Q or similar.
3766 // xxx0 is pin xxx of multiplexer U5,
3767 // yyy1 is pin yyy of multiplexer U2
3779 static void xguard_muxsel(struct bttv *btv, unsigned int input)
3781 static const int masks[] = {
3782 ENB0, ENB0|IN00, ENB0|IN10, ENB0|IN00|IN10,
3783 ENA0, ENA0|IN00, ENA0|IN10, ENA0|IN00|IN10,
3784 ENB1, ENB1|IN01, ENB1|IN11, ENB1|IN01|IN11,
3785 ENA1, ENA1|IN01, ENA1|IN11, ENA1|IN01|IN11,
3787 gpio_write(masks[input%16]);
3791 * ivc120_muxsel [Added by Alan Garfield <alan@fromorbit.com>]
3793 * The IVC120G security card has 4 i2c controlled TDA8540 matrix
3794 * swichers to provide 16 channels to MUX0. The TDA8540's have
3795 * 4 indepedant outputs and as such the IVC120G also has the
3796 * optional "Monitor Out" bus. This allows the card to be looking
3797 * at one input while the monitor is looking at another.
3799 * Since I've couldn't be bothered figuring out how to add an
3800 * independant muxsel for the monitor bus, I've just set it to
3801 * whatever the card is looking at.
3803 * OUT0 of the TDA8540's is connected to MUX0 (0x03)
3804 * OUT1 of the TDA8540's is connected to "Monitor Out" (0x0C)
3806 * TDA8540_ALT3 IN0-3 = Channel 13 - 16 (0x03)
3807 * TDA8540_ALT4 IN0-3 = Channel 1 - 4 (0x03)
3808 * TDA8540_ALT5 IN0-3 = Channel 5 - 8 (0x03)
3809 * TDA8540_ALT6 IN0-3 = Channel 9 - 12 (0x03)
3813 /* All 7 possible sub-ids for the TDA8540 Matrix Switcher */
3814 #define I2C_TDA8540 0x90
3815 #define I2C_TDA8540_ALT1 0x92
3816 #define I2C_TDA8540_ALT2 0x94
3817 #define I2C_TDA8540_ALT3 0x96
3818 #define I2C_TDA8540_ALT4 0x98
3819 #define I2C_TDA8540_ALT5 0x9a
3820 #define I2C_TDA8540_ALT6 0x9c
3822 static void ivc120_muxsel(struct bttv *btv, unsigned int input)
3825 int key = input % 4;
3826 int matrix = input / 4;
3828 dprintk("bttv%d: ivc120_muxsel: Input - %02d | TDA - %02d | In - %02d\n",
3829 btv->c.nr, input, matrix, key);
3831 // Handles the input selection on the TDA8540's
3832 bttv_I2CWrite(btv, I2C_TDA8540_ALT3, 0x00,
3833 ((matrix == 3) ? (key | key << 2) : 0x00), 1);
3834 bttv_I2CWrite(btv, I2C_TDA8540_ALT4, 0x00,
3835 ((matrix == 0) ? (key | key << 2) : 0x00), 1);
3836 bttv_I2CWrite(btv, I2C_TDA8540_ALT5, 0x00,
3837 ((matrix == 1) ? (key | key << 2) : 0x00), 1);
3838 bttv_I2CWrite(btv, I2C_TDA8540_ALT6, 0x00,
3839 ((matrix == 2) ? (key | key << 2) : 0x00), 1);
3841 // Handles the output enables on the TDA8540's
3842 bttv_I2CWrite(btv, I2C_TDA8540_ALT3, 0x02,
3843 ((matrix == 3) ? 0x03 : 0x00), 1); // 13 - 16
3844 bttv_I2CWrite(btv, I2C_TDA8540_ALT4, 0x02,
3845 ((matrix == 0) ? 0x03 : 0x00), 1); // 1-4
3846 bttv_I2CWrite(btv, I2C_TDA8540_ALT5, 0x02,
3847 ((matrix == 1) ? 0x03 : 0x00), 1); // 5-8
3848 bttv_I2CWrite(btv, I2C_TDA8540_ALT6, 0x02,
3849 ((matrix == 2) ? 0x03 : 0x00), 1); // 9-12
3851 // Selects MUX0 for input on the 878
3852 btaor((0)<<5, ~(3<<5), BT848_IFORM);
3856 /* ----------------------------------------------------------------------- */
3857 /* motherboard chipset specific stuff */
3859 void __devinit bttv_check_chipset(void)
3861 int pcipci_fail = 0;
3862 struct pci_dev *dev = NULL;
3864 if (pci_pci_problems & PCIPCI_FAIL)
3866 if (pci_pci_problems & (PCIPCI_TRITON|PCIPCI_NATOMA|PCIPCI_VIAETBF))
3868 if (pci_pci_problems & PCIPCI_VSFX)
3870 #ifdef PCIPCI_ALIMAGIK
3871 if (pci_pci_problems & PCIPCI_ALIMAGIK)
3876 /* print which chipset we have */
3877 while ((dev = pci_find_class(PCI_CLASS_BRIDGE_HOST << 8,dev)))
3878 printk(KERN_INFO "bttv: Host bridge is %s\n",pci_name(dev));
3881 /* print warnings about any quirks found */
3883 printk(KERN_INFO "bttv: Host bridge needs ETBF enabled.\n");
3885 printk(KERN_INFO "bttv: Host bridge needs VSFX enabled.\n");
3887 printk(KERN_WARNING "bttv: BT848 and your chipset may not work together.\n");
3888 if (UNSET == no_overlay) {
3889 printk(KERN_WARNING "bttv: going to disable overlay.\n");
3893 if (UNSET != latency)
3894 printk(KERN_INFO "bttv: pci latency fixup [%d]\n",latency);
3896 while ((dev = pci_find_device(PCI_VENDOR_ID_INTEL,
3897 PCI_DEVICE_ID_INTEL_82441, dev))) {
3899 pci_read_config_byte(dev, 0x53, &b);
3901 printk(KERN_INFO "bttv: Host bridge: 82441FX Natoma, "
3902 "bufcon=0x%02x\n",b);
3906 int __devinit bttv_handle_chipset(struct bttv *btv)
3908 unsigned char command;
3910 if (!triton1 && !vsfx && UNSET == latency)
3915 printk(KERN_INFO "bttv%d: enabling ETBF (430FX/VP3 compatibilty)\n",btv->c.nr);
3916 if (vsfx && btv->id >= 878)
3917 printk(KERN_INFO "bttv%d: enabling VSFX\n",btv->c.nr);
3918 if (UNSET != latency)
3919 printk(KERN_INFO "bttv%d: setting pci timer to %d\n",
3923 if (btv->id < 878) {
3924 /* bt848 (mis)uses a bit in the irq mask for etbf */
3926 btv->triton1 = BT848_INT_ETBF;
3928 /* bt878 has a bit in the pci config space for it */
3929 pci_read_config_byte(btv->c.pci, BT878_DEVCTRL, &command);
3931 command |= BT878_EN_TBFX;
3933 command |= BT878_EN_VSFX;
3934 pci_write_config_byte(btv->c.pci, BT878_DEVCTRL, command);
3936 if (UNSET != latency)
3937 pci_write_config_byte(btv->c.pci, PCI_LATENCY_TIMER, latency);
3942 /* PXC200 muxsel helper
3943 * luke@syseng.anu.edu.au
3944 * another transplant
3945 * from Alessandro Rubini (rubini@linux.it)
3947 * There are 4 kinds of cards:
3948 * PXC200L which is bt848
3949 * PXC200F which is bt848 with PIC controlling mux
3950 * PXC200AL which is bt878
3951 * PXC200AF which is bt878 with PIC controlling mux
3953 #define PX_CFG_PXC200F 0x01
3954 #define PX_FLAG_PXC200A 0x00001000 /* a pxc200A is bt-878 based */
3955 #define PX_I2C_PIC 0x0f
3956 #define PX_PXC200A_CARDID 0x200a1295
3957 #define PX_I2C_CMD_CFG 0x00
3959 static void PXC200_muxsel(struct bttv *btv, unsigned int input)
3964 unsigned char buf[2];
3966 /* Read PIC config to determine if this is a PXC200F */
3970 rc=bttv_I2CWrite(btv,(PX_I2C_PIC<<1),buf[0],buf[1],1);
3972 printk(KERN_DEBUG "bttv%d: PXC200_muxsel: pic cfg write failed:%d\n", btv->c.nr,rc);
3973 /* not PXC ? do nothing */
3977 rc=bttv_I2CRead(btv,(PX_I2C_PIC<<1),0);
3978 if (!(rc & PX_CFG_PXC200F)) {
3979 printk(KERN_DEBUG "bttv%d: PXC200_muxsel: not PXC200F rc:%d \n", btv->c.nr,rc);
3984 /* The multiplexer in the 200F is handled by the GPIO port */
3985 /* get correct mapping between inputs */
3986 /* mux = bttv_tvcards[btv->type].muxsel[input] & 3; */
3987 /* ** not needed!? */
3990 /* make sure output pins are enabled */
3991 /* bitmask=0x30f; */
3993 /* check whether we have a PXC200A */
3994 if (btv->cardid == PX_PXC200A_CARDID) {
3995 bitmask ^= 0x180; /* use 7 and 9, not 8 and 9 */
3996 bitmask |= 7<<4; /* the DAC */
3998 btwrite(bitmask, BT848_GPIO_OUT_EN);
4000 bitmask = btread(BT848_GPIO_DATA);
4001 if (btv->cardid == PX_PXC200A_CARDID)
4002 bitmask = (bitmask & ~0x280) | ((mux & 2) << 8) | ((mux & 1) << 7);
4003 else /* older device */
4004 bitmask = (bitmask & ~0x300) | ((mux & 3) << 8);
4005 btwrite(bitmask,BT848_GPIO_DATA);
4008 * Was "to be safe, set the bt848 to input 0"
4009 * Actually, since it's ok at load time, better not messing
4010 * with these bits (on PXC200AF you need to set mux 2 here)
4012 * needed because bttv-driver sets mux before calling this function
4014 if (btv->cardid == PX_PXC200A_CARDID)
4015 btaor(2<<5, ~BT848_IFORM_MUXSEL, BT848_IFORM);
4016 else /* older device */
4017 btand(~BT848_IFORM_MUXSEL,BT848_IFORM);
4019 printk(KERN_DEBUG "bttv%d: setting input channel to:%d\n", btv->c.nr,(int)mux);