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 #if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)
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 void sigmaSLC_muxsel(struct bttv *btv, unsigned int input);
78 static void sigmaSQ_muxsel(struct bttv *btv, unsigned int input);
80 static int terratec_active_radio_upgrade(struct bttv *btv);
81 static int tea5757_read(struct bttv *btv);
82 static int tea5757_write(struct bttv *btv, int value);
83 static void identify_by_eeprom(struct bttv *btv,
84 unsigned char eeprom_data[256]);
86 /* config variables */
87 static unsigned int triton1=0;
88 static unsigned int vsfx=0;
89 static unsigned int latency = UNSET;
90 unsigned int no_overlay=-1;
92 static unsigned int card[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
93 static unsigned int pll[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
94 static unsigned int tuner[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
95 static unsigned int svhs[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
96 static unsigned int remote[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
98 static unsigned int autoload = 1;
100 static unsigned int autoload = 0;
102 static unsigned int gpiomask = UNSET;
103 static unsigned int audioall = UNSET;
104 static unsigned int audiomux[5] = { [ 0 ... 4 ] = UNSET };
107 MODULE_PARM(triton1,"i");
108 MODULE_PARM_DESC(triton1,"set ETBF pci config bit "
109 "[enable bug compatibility for triton1 + others]");
110 MODULE_PARM(vsfx,"i");
111 MODULE_PARM_DESC(vsfx,"set VSFX pci config bit "
112 "[yet another chipset flaw workaround]");
113 MODULE_PARM(no_overlay,"i");
114 MODULE_PARM(latency,"i");
115 MODULE_PARM_DESC(latency,"pci latency timer");
116 MODULE_PARM(card,"1-" __stringify(BTTV_MAX) "i");
117 MODULE_PARM_DESC(card,"specify TV/grabber card model, see CARDLIST file for a list");
118 MODULE_PARM(pll,"1-" __stringify(BTTV_MAX) "i");
119 MODULE_PARM_DESC(pll,"specify installed crystal (0=none, 28=28 MHz, 35=35 MHz)");
120 MODULE_PARM(tuner,"1-" __stringify(BTTV_MAX) "i");
121 MODULE_PARM_DESC(tuner,"specify installed tuner type");
122 MODULE_PARM(autoload,"i");
123 MODULE_PARM_DESC(autoload,"automatically load i2c modules like tuner.o, default is 1 (yes)");
125 MODULE_PARM(svhs,"1-" __stringify(BTTV_MAX) "i");
126 MODULE_PARM(remote,"1-" __stringify(BTTV_MAX) "i");
128 MODULE_PARM(gpiomask,"i");
129 MODULE_PARM(audioall,"i");
130 MODULE_PARM(audiomux,"1-6i");
134 static int __init p_card(char *str) { return bttv_parse(str,BTTV_MAX,card); }
135 static int __init p_pll(char *str) { return bttv_parse(str,BTTV_MAX,pll); }
136 static int __init p_tuner(char *str) { return bttv_parse(str,BTTV_MAX,tuner); }
137 __setup("bttv.card=", p_card);
138 __setup("bttv.pll=", p_pll);
139 __setup("bttv.tuner=", p_tuner);
141 int __init bttv_parse(char *str, int max, int *vals)
143 int i,number,res = 2;
145 for (i = 0; res == 2 && i < max; i++) {
146 res = get_option(&str,&number);
154 /* ----------------------------------------------------------------------- */
155 /* list of card IDs for bt878+ cards */
161 } cards[] __devinitdata = {
162 { 0x13eb0070, BTTV_HAUPPAUGE878, "Hauppauge WinTV" },
163 { 0x39000070, BTTV_HAUPPAUGE878, "Hauppauge WinTV-D" },
164 { 0x45000070, BTTV_HAUPPAUGEPVR, "Hauppauge WinTV/PVR" },
165 { 0xff000070, BTTV_OSPREY1x0, "Osprey-100" },
166 { 0xff010070, BTTV_OSPREY2x0_SVID,"Osprey-200" },
167 { 0xff020070, BTTV_OSPREY500, "Osprey-500" },
168 { 0xff030070, BTTV_OSPREY2000, "Osprey-2000" },
169 { 0xff040070, BTTV_OSPREY540, "Osprey-540" },
171 { 0x00011002, BTTV_ATI_TVWONDER, "ATI TV Wonder" },
172 { 0x00031002, BTTV_ATI_TVWONDERVE,"ATI TV Wonder/VE" },
174 { 0x6606107d, BTTV_WINFAST2000, "Leadtek WinFast TV 2000" },
175 { 0x6607107d, BTTV_WINFASTVC100, "Leadtek WinFast VC 100" },
176 { 0x6609107d, BTTV_WINFAST2000, "Leadtek TV 2000 XP" },
177 { 0x263610b4, BTTV_STB2, "STB TV PCI FM, Gateway P/N 6000704" },
178 { 0x264510b4, BTTV_STB2, "STB TV PCI FM, Gateway P/N 6000704" },
179 { 0x402010fc, BTTV_GVBCTV3PCI, "I-O Data Co. GV-BCTV3/PCI" },
180 { 0x405010fc, BTTV_GVBCTV4PCI, "I-O Data Co. GV-BCTV4/PCI" },
181 { 0x407010fc, BTTV_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" },
182 { 0xd01810fc, BTTV_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" },
184 { 0x001211bd, BTTV_PINNACLE, "Pinnacle PCTV" },
185 { 0x001c11bd, BTTV_PINNACLESAT, "Pinnacle PCTV Sat" },
186 // some cards ship with byteswapped IDs ...
187 { 0x1200bd11, BTTV_PINNACLE, "Pinnacle PCTV [bswap]" },
188 { 0xff00bd11, BTTV_PINNACLE, "Pinnacle PCTV [bswap]" },
190 { 0x3000121a, BTTV_VOODOOTV_FM, "3Dfx VoodooTV FM/ VoodooTV 200" },
191 { 0x263710b4, BTTV_VOODOOTV_FM, "3Dfx VoodooTV FM/ VoodooTV 200" },
192 { 0x3060121a, BTTV_STB2, "3Dfx VoodooTV 100/ STB OEM" },
194 { 0x3000144f, BTTV_MAGICTVIEW063, "(Askey Magic/others) TView99 CPH06x" },
195 { 0x3002144f, BTTV_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH05x" },
196 { 0x3005144f, BTTV_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH061/06L (T1/LC)" },
197 { 0x5000144f, BTTV_MAGICTVIEW061, "Askey CPH050" },
198 { 0x300014ff, BTTV_MAGICTVIEW061, "TView 99 (CPH061)" },
199 { 0x300214ff, BTTV_PHOEBE_TVMAS, "Phoebe TV Master (CPH060)" },
201 { 0x00011461, BTTV_AVPHONE98, "AVerMedia TVPhone98" },
202 { 0x00021461, BTTV_AVERMEDIA98, "AVermedia TVCapture 98" },
203 { 0x00031461, BTTV_AVPHONE98, "AVerMedia TVPhone98" },
204 { 0x00041461, BTTV_AVERMEDIA98, "AVerMedia TVCapture 98" },
205 { 0x03001461, BTTV_AVERMEDIA98, "VDOMATE TV TUNER CARD" },
207 { 0x1117153b, BTTV_TERRATVALUE, "Terratec TValue (Philips PAL B/G)" },
208 { 0x1118153b, BTTV_TERRATVALUE, "Terratec TValue (Temic PAL B/G)" },
209 { 0x1119153b, BTTV_TERRATVALUE, "Terratec TValue (Philips PAL I)" },
210 { 0x111a153b, BTTV_TERRATVALUE, "Terratec TValue (Temic PAL I)" },
212 { 0x1123153b, BTTV_TERRATVRADIO, "Terratec TV Radio+" },
213 { 0x1127153b, BTTV_TERRATV, "Terratec TV+ (V1.05)" },
214 // clashes with FlyVideo
215 //{ 0x18521852, BTTV_TERRATV, "Terratec TV+ (V1.10)" },
216 { 0x1134153b, BTTV_TERRATVALUE, "Terratec TValue (LR102)" },
217 { 0x1135153b, BTTV_TERRATVALUER, "Terratec TValue Radio" }, // LR102
218 { 0x5018153b, BTTV_TERRATVALUE, "Terratec TValue" }, // ??
219 { 0xff3b153b, BTTV_TERRATVALUER, "Terratec TValue Radio" }, // ??
221 { 0x400015b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV" },
222 { 0x400a15b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV" },
223 { 0x400d15b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
224 { 0x401015b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
225 { 0x401615b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
227 { 0x1430aa00, BTTV_PV143, "Provideo PV143A" },
228 { 0x1431aa00, BTTV_PV143, "Provideo PV143B" },
229 { 0x1432aa00, BTTV_PV143, "Provideo PV143C" },
230 { 0x1433aa00, BTTV_PV143, "Provideo PV143D" },
231 { 0x1433aa03, BTTV_PV143, "Security Eyes" },
233 { 0x1460aa00, BTTV_PV150, "Provideo PV150A-1" },
234 { 0x1461aa01, BTTV_PV150, "Provideo PV150A-2" },
235 { 0x1462aa02, BTTV_PV150, "Provideo PV150A-3" },
236 { 0x1463aa03, BTTV_PV150, "Provideo PV150A-4" },
238 { 0x1464aa04, BTTV_PV150, "Provideo PV150B-1" },
239 { 0x1465aa05, BTTV_PV150, "Provideo PV150B-2" },
240 { 0x1466aa06, BTTV_PV150, "Provideo PV150B-3" },
241 { 0x1467aa07, BTTV_PV150, "Provideo PV150B-4" },
243 { 0xa132ff00, BTTV_IVC100, "IVC-100" },
244 { 0xa1550000, BTTV_IVC200, "IVC-200" },
245 { 0xa1550001, BTTV_IVC200, "IVC-200" },
246 { 0xa1550002, BTTV_IVC200, "IVC-200" },
247 { 0xa1550003, BTTV_IVC200, "IVC-200" },
248 { 0xa1550100, BTTV_IVC200, "IVC-200G" },
249 { 0xa1550101, BTTV_IVC200, "IVC-200G" },
250 { 0xa1550102, BTTV_IVC200, "IVC-200G" },
251 { 0xa1550103, BTTV_IVC200, "IVC-200G" },
252 { 0xa182ff00, BTTV_IVC120, "IVC-120G" },
253 { 0xa182ff01, BTTV_IVC120, "IVC-120G" },
254 { 0xa182ff02, BTTV_IVC120, "IVC-120G" },
255 { 0xa182ff03, BTTV_IVC120, "IVC-120G" },
256 { 0xa182ff04, BTTV_IVC120, "IVC-120G" },
257 { 0xa182ff05, BTTV_IVC120, "IVC-120G" },
258 { 0xa182ff06, BTTV_IVC120, "IVC-120G" },
259 { 0xa182ff07, BTTV_IVC120, "IVC-120G" },
260 { 0xa182ff08, BTTV_IVC120, "IVC-120G" },
261 { 0xa182ff09, BTTV_IVC120, "IVC-120G" },
262 { 0xa182ff0a, BTTV_IVC120, "IVC-120G" },
263 { 0xa182ff0b, BTTV_IVC120, "IVC-120G" },
264 { 0xa182ff0c, BTTV_IVC120, "IVC-120G" },
265 { 0xa182ff0d, BTTV_IVC120, "IVC-120G" },
266 { 0xa182ff0e, BTTV_IVC120, "IVC-120G" },
267 { 0xa182ff0f, BTTV_IVC120, "IVC-120G" },
269 { 0x41424344, BTTV_GRANDTEC, "GrandTec Multi Capture" },
270 { 0x01020304, BTTV_XGUARD, "Grandtec Grand X-Guard" },
272 { 0x18501851, BTTV_CHRONOS_VS2, "FlyVideo 98 (LR50)/ Chronos Video Shuttle II" },
273 { 0xa0501851, BTTV_CHRONOS_VS2, "FlyVideo 98 (LR50)/ Chronos Video Shuttle II" },
274 { 0x18511851, BTTV_FLYVIDEO98EZ, "FlyVideo 98EZ (LR51)/ CyberMail AV" },
275 { 0x18521852, BTTV_TYPHOON_TVIEW, "FlyVideo 98FM (LR50)/ Typhoon TView TV/FM Tuner" },
276 { 0x41a0a051, BTTV_FLYVIDEO_98FM, "Lifeview FlyVideo 98 LR50 Rev Q" },
277 { 0x18501f7f, BTTV_FLYVIDEO_98, "Lifeview Flyvideo 98" },
279 { 0x010115cb, BTTV_GMV1, "AG GMV1" },
280 { 0x010114c7, BTTV_MODTEC_205, "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV" },
282 { 0x10b42636, BTTV_HAUPPAUGE878, "STB ???" },
283 { 0x217d6606, BTTV_WINFAST2000, "Leadtek WinFast TV 2000" },
284 { 0xfff6f6ff, BTTV_WINFAST2000, "Leadtek WinFast TV 2000" },
285 { 0x03116000, BTTV_SENSORAY311, "Sensoray 311" },
286 { 0x00790e11, BTTV_WINDVR, "Canopus WinDVR PCI" },
287 { 0xa0fca1a0, BTTV_ZOLTRIX, "Face to Face Tvmax" },
288 { 0x20007063, BTTV_PC_HDTV, "pcHDTV HD-2000 TV"},
289 { 0x82b2aa6a, BTTV_SIMUS_GVC1100, "SIMUS GVC1100" },
290 { 0x146caa0c, BTTV_PV951, "ituner spectra8" },
291 { 0x200a1295, BTTV_PXC200, "ImageNation PXC200A" },
293 { 0x40111554, BTTV_PV_BT878P_9B, "Prolink Pixelview PV-BT" },
294 { 0x17de0a01, BTTV_KWORLD, "Mecer TV/FM/Video Tuner" },
296 { 0x01051805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #1" },
297 { 0x01061805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #2" },
298 { 0x01071805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #3" },
299 { 0x01081805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #4" },
301 // likely broken, vendor id doesn't match the other magic views ...
302 //{ 0xa0fca04f, BTTV_MAGICTVIEW063, "Guillemot Maxi TV Video 3" },
304 // DVB cards (using pci function .1 for mpeg data xfer)
305 { 0x01010071, BTTV_NEBULA_DIGITV, "Nebula Electronics DigiTV" },
306 { 0x07611461, BTTV_AVDVBT_761, "AverMedia AverTV DVB-T" },
307 { 0x002611bd, BTTV_TWINHAN_DST, "Pinnacle PCTV SAT CI" },
308 { 0x00011822, BTTV_TWINHAN_DST, "Twinhan VisionPlus DVB-T" },
309 { 0xfc00270f, BTTV_TWINHAN_DST, "ChainTech digitop DST-1000 DVB-S" },
310 { 0x07711461, BTTV_AVDVBT_771, "AVermedia DVB-T 771" },
315 /* ----------------------------------------------------------------------- */
316 /* array with description for bt848 / bt878 tv/grabber cards */
318 struct tvcard bttv_tvcards[] = {
320 /* ---- card 0x00 ---------------------------------- */
321 .name = " *** UNKNOWN/GENERIC *** ",
326 .muxsel = { 2, 3, 1, 0},
335 .muxsel = { 2, 3, 1, 1},
336 .audiomux = { 2, 0, 0, 0, 10},
340 .name = "Hauppauge (bt848)",
346 .muxsel = { 2, 3, 1, 1},
347 .audiomux = { 0, 1, 2, 3, 4},
351 .name = "STB, Gateway P/N 6000699 (bt848)",
357 .muxsel = { 2, 3, 1, 1},
358 .audiomux = { 4, 0, 2, 3, 1},
361 .tuner_type = TUNER_PHILIPS_NTSC,
366 /* ---- card 0x04 ---------------------------------- */
367 .name = "Intel Create and Share PCI/ Smart Video Recorder III",
373 .muxsel = { 2, 3, 1, 1},
378 .name = "Diamond DTV2000",
384 .muxsel = { 2, 3, 1, 0},
385 .audiomux = { 0, 1, 0, 1, 3},
389 .name = "AVerMedia TVPhone",
394 .muxsel = { 2, 3, 1, 1},
396 .audiomux = { 0x0c, 0x04, 0x08, 0x04, 0},
397 /* 0x04 for some cards ?? */
400 .audio_hook = avermedia_tvphone_audio,
403 .name = "MATRIX-Vision MV-Delta",
409 .muxsel = { 2, 3, 1, 0, 0},
415 /* ---- card 0x08 ---------------------------------- */
416 .name = "Lifeview FlyVideo II (Bt848) LR26 / MAXI TV Video PCI2 LR26",
422 .muxsel = { 2, 3, 1, 1},
423 .audiomux = { 0, 0xc00, 0x800, 0x400, 0xc00, 0},
428 .name = "IMS/IXmicro TurboTV",
434 .muxsel = { 2, 3, 1, 1},
435 .audiomux = { 1, 1, 2, 3, 0},
438 .tuner_type = TUNER_TEMIC_PAL,
440 .name = "Hauppauge (bt878)",
445 .gpiomask = 0x0f, /* old: 7 */
446 .muxsel = { 2, 0, 1, 1},
447 .audiomux = { 0, 1, 2, 3, 4},
452 .name = "MIRO PCTV pro",
458 .muxsel = { 2, 3, 1, 1},
459 .audiomux = { 0x20001,0x10001, 0, 0,10},
464 /* ---- card 0x0c ---------------------------------- */
465 .name = "ADS Technologies Channel Surfer TV (bt848)",
471 .muxsel = { 2, 3, 1, 1},
472 .audiomux = { 13, 14, 11, 7, 0, 0},
476 .name = "AVerMedia TVCapture 98",
482 .muxsel = { 2, 3, 1, 1},
483 .audiomux = { 13, 14, 11, 7, 0, 0},
487 .tuner_type = TUNER_PHILIPS_PAL,
488 .audio_hook = avermedia_tv_stereo_audio,
490 .name = "Aimslab Video Highway Xtreme (VHX)",
496 .muxsel = { 2, 3, 1, 1},
497 .audiomux = { 0, 2, 1, 3, 4}, /* old: { 0, 1, 2, 3, 4} */
502 .name = "Zoltrix TV-Max",
508 .muxsel = { 2, 3, 1, 1},
509 .audiomux = {0 , 0, 1 , 0, 10},
514 /* ---- card 0x10 ---------------------------------- */
515 .name = "Prolink Pixelview PlayTV (bt878)",
520 .gpiomask = 0x01fe00,
521 .muxsel = { 2, 3, 1, 1},
524 .audiomux = { 0x01c000, 0, 0x018000, 0x014000, 0x002000, 0 },
526 // 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru>
527 .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 },
533 .name = "Leadtek WinView 601",
538 .gpiomask = 0x8300f8,
539 .muxsel = { 2, 3, 1, 1,0},
540 .audiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007},
543 .audio_hook = winview_audio,
546 .name = "AVEC Intercapture",
552 .muxsel = {2, 3, 1, 1},
553 .audiomux = {1, 0, 0, 0, 0},
557 .name = "Lifeview FlyVideo II EZ /FlyKit LR38 Bt848 (capture only)",
562 .gpiomask = 0x8dff00,
563 .muxsel = { 2, 3, 1, 1},
569 /* ---- card 0x14 ---------------------------------- */
570 .name = "CEI Raffles Card",
575 .muxsel = {2, 3, 1, 1},
578 .name = "Lifeview FlyVideo 98/ Lucky Star Image World ConferenceTV LR50",
580 .audio_inputs = 2, // tuner, line in
584 .muxsel = { 2, 3, 1, 1},
585 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800},
587 .tuner_type = TUNER_PHILIPS_PAL_I,
589 .name = "Askey CPH050/ Phoebe Tv Master + FM",
595 .muxsel = { 2, 3, 1, 1},
596 .audiomux = {0, 1, 0x800, 0x400, 0xc00, 0},
601 .name = "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV, bt878",
607 .muxsel = { 2, 3, -1 },
608 .digital_mode = DIGITAL_MODE_CAMERA,
609 .audiomux = { 0, 0, 0, 0, 0 },
612 .tuner_type = TUNER_ALPS_TSBB5_PAL_I,
615 /* ---- card 0x18 ---------------------------------- */
616 .name = "Askey CPH05X/06X (bt878) [many vendors]",
622 .muxsel = { 2, 3, 1, 1},
623 .audiomux = {0x400, 0x400, 0x400, 0x400, 0xc00},
629 .name = "Terratec TerraTV+ Version 1.0 (Bt848)/ Terra TValue Version 1.0/ Vobis TV-Boostar",
634 .gpiomask = 0x1f0fff,
635 .muxsel = { 2, 3, 1, 1},
636 .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000},
638 .tuner_type = TUNER_PHILIPS_PAL,
639 .audio_hook = terratv_audio,
641 .name = "Hauppauge WinCam newer (bt878)",
647 .muxsel = { 2, 0, 1, 1},
648 .audiomux = { 0, 1, 2, 3, 4},
652 .name = "Lifeview FlyVideo 98/ MAXI TV Video PCI2 LR50",
658 .muxsel = { 2, 3, 1, 1},
659 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800},
661 .tuner_type = TUNER_PHILIPS_SECAM,
664 /* ---- card 0x1c ---------------------------------- */
665 .name = "Terratec TerraTV+ Version 1.1 (bt878)",
670 .gpiomask = 0x1f0fff,
671 .muxsel = { 2, 3, 1, 1},
672 .audiomux = { 0x20000, 0x30000, 0x10000, 0x00000, 0x40000},
674 .tuner_type = TUNER_PHILIPS_PAL,
675 .audio_hook = terratv_audio,
677 External 20 pin connector (for Active Radio Upgrade board)
683 gpio05: om5610-stereo
687 gpio09+10: nIOR, nSEL ?? (bt878)
691 gpio16: u2-A0 (1st 4052bt)
694 gpio19: u4-A0 (2nd 4052)
698 00000 : Cdrom (internal audio input)
699 10000 : ext. Video audio input
708 /* Jannik Fritsch <jannik@techfak.uni-bielefeld.de> */
709 .name = "Imagenation PXC200",
713 .svhs = 1, /* was: 4 */
715 .muxsel = { 2, 3, 1, 0, 0},
719 .muxsel_hook = PXC200_muxsel,
722 .name = "Lifeview FlyVideo 98 LR50",
727 .gpiomask = 0x1800, //0x8dfe00
728 .muxsel = { 2, 3, 1, 1},
729 .audiomux = { 0, 0x0800, 0x1000, 0x1000, 0x1800, 0 },
733 .name = "Formac iProTV, Formac ProTV I (bt848)",
739 .muxsel = { 2, 3, 1, 1},
740 .audiomux = { 1, 0, 0, 0, 0 },
742 .tuner_type = TUNER_PHILIPS_PAL,
745 /* ---- card 0x20 ---------------------------------- */
746 .name = "Intel Create and Share PCI/ Smart Video Recorder III",
752 .muxsel = { 2, 3, 1, 1},
757 .name = "Terratec TerraTValue Version Bt878",
762 .gpiomask = 0xffff00,
763 .muxsel = { 2, 3, 1, 1},
764 .audiomux = { 0x500, 0, 0x300, 0x900, 0x900},
767 .tuner_type = TUNER_PHILIPS_PAL,
769 .name = "Leadtek WinFast 2000/ WinFast 2000 XP",
774 .muxsel = { 2, 3, 1, 1, 0}, // TV, CVid, SVid, CVid over SVid connector
776 .gpiomask = 0xc33000,
777 .audiomux = { 0x422000,0x1000,0x0000,0x620000,0x800000 },
779 /* Alexander Varakin <avarakin@hotmail.com> [stereo version] */
780 .gpiomask = 0xb33000,
781 .audiomux = { 0x122000,0x1000,0x0000,0x620000,0x800000 },
783 /* Audio Routing for "WinFast 2000 XP" (no tv stereo !)
784 gpio23 -- hef4052:nEnable (0x800000)
787 0x0000: external audio
791 Note: There exists another variant "Winfast 2000" with tv stereo !?
792 Note: eeprom only contains FF and pci subsystem id 107d:6606
797 .tuner_type = 5, // default for now, gpio reads BFFF06 for Pal bg+dk
798 .audio_hook = winfast2000_audio,
801 .name = "Lifeview FlyVideo 98 LR50 / Chronos Video Shuttle II",
807 .muxsel = { 2, 3, 1, 1},
808 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800},
813 /* ---- card 0x24 ---------------------------------- */
814 .name = "Lifeview FlyVideo 98FM LR50 / Typhoon TView TV/FM Tuner",
820 .muxsel = { 2, 3, 1, 1},
821 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 },
826 .name = "Prolink PixelView PlayTV pro",
832 .muxsel = { 2, 3, 1, 1 },
833 .audiomux = { 0x21, 0x20, 0x24, 0x2c, 0x29, 0x29 },
838 .name = "Askey CPH06X TView99",
843 .gpiomask = 0x551e00,
844 .muxsel = { 2, 3, 1, 0},
845 .audiomux = { 0x551400, 0x551200, 0, 0, 0x551c00, 0x551200 },
851 .name = "Pinnacle PCTV Studio/Rave",
856 .gpiomask = 0x03000F,
857 .muxsel = { 2, 3, 1, 1},
858 .audiomux = { 2, 0xd0001, 0, 0, 1},
864 /* ---- card 0x28 ---------------------------------- */
865 .name = "STB TV PCI FM, Gateway P/N 6000704 (bt878), 3Dfx VoodooTV 100",
871 .muxsel = { 2, 3, 1, 1},
872 .audiomux = { 4, 0, 2, 3, 1},
875 .tuner_type = TUNER_PHILIPS_NTSC,
879 .name = "AVerMedia TVPhone 98",
885 .muxsel = { 2, 3, 1, 1},
886 .audiomux = { 13, 4, 11, 7, 0, 0},
891 .audio_hook = avermedia_tvphone_audio,
893 .name = "ProVideo PV951", /* pic16c54 */
899 .muxsel = { 2, 3, 1, 1},
900 .audiomux = { 0, 0, 0, 0, 0},
906 .name = "Little OnAir TV",
912 .muxsel = {2, 3, 1, 1},
913 .audiomux = {0xff9ff6, 0xff9ff6, 0xff1ff7, 0, 0xff3ffc},
918 /* ---- card 0x2c ---------------------------------- */
919 .name = "Sigma TVII-FM",
925 .muxsel = {2, 3, 1, 1},
926 .audiomux = {1, 1, 0, 2, 3},
931 .name = "MATRIX-Vision MV-Delta 2",
937 .muxsel = { 2, 3, 1, 0, 0},
943 .name = "Zoltrix Genie TV/FM",
948 .gpiomask = 0xbcf03f,
949 .muxsel = { 2, 3, 1, 1},
950 .audiomux = { 0xbc803f, 0xbc903f, 0xbcb03f, 0, 0xbcb03f},
955 .name = "Terratec TV/Radio+",
961 .muxsel = { 2, 3, 1, 1},
962 .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000, 0x20000 },
970 /* ---- card 0x30 ---------------------------------- */
971 .name = "Askey CPH03x/ Dynalink Magic TView",
977 .muxsel = { 2, 3, 1, 1},
978 .audiomux = {2,0,0,0,1},
983 .name = "IODATA GV-BCTV3/PCI",
988 .gpiomask = 0x010f00,
989 .muxsel = {2, 3, 0, 0},
990 .audiomux = {0x10000, 0, 0x10000, 0, 0, 0},
993 .tuner_type = TUNER_ALPS_TSHC6_NTSC,
994 .audio_hook = gvbctv3pci_audio,
996 .name = "Prolink PV-BT878P+4E / PixelView PlayTV PAK / Lenco MXTV-9578 CP",
1001 .gpiomask = 0xAA0000,
1002 .muxsel = { 2,3,1,1,-1 },
1003 .digital_mode = DIGITAL_MODE_CAMERA,
1004 .audiomux = { 0x20000, 0, 0x80000, 0x80000, 0xa8000, 0x46000 },
1007 .tuner_type = TUNER_PHILIPS_PAL_I,
1009 /* GPIO wiring: (different from Rev.4C !)
1010 GPIO17: U4.A0 (first hef4052bt)
1012 GPIO20: U5.A1 (second hef4052bt)
1014 GPIO22: BT832 Reset Line
1015 GPIO23: A5,A0, U5,nEN
1016 Note: At i2c=0x8a is a Bt832 chip, which changes to 0x88 after being reset via GPIO22
1019 .name = "Eagle Wireless Capricorn2 (bt878A)",
1025 .muxsel = { 2, 0, 1, 1},
1026 .audiomux = { 0, 1, 2, 3, 4},
1028 .tuner_type = -1 /* TUNER_ALPS_TMDH2_NTSC */,
1031 /* ---- card 0x34 ---------------------------------- */
1032 /* David Härdeman <david@2gen.com> */
1033 .name = "Pinnacle PCTV Studio Pro",
1038 .gpiomask = 0x03000F,
1039 .muxsel = { 2, 3, 1, 1},
1040 .audiomux = { 1, 0xd0001, 0, 0, 10},
1041 /* sound path (5 sources):
1042 MUX1 (mask 0x03), Enable Pin 0x08 (0=enable, 1=disable)
1045 2= Mono TV sound from Tuner
1047 MUX2 (mask 0x30000):
1049 1= FM stereo Radio from Tuner */
1054 /* Claas Langbehn <claas@bigfoot.com>,
1055 Sven Grothklags <sven@upb.de> */
1056 .name = "Typhoon TView RDS + FM Stereo / KNC1 TV Station RDS",
1062 .muxsel = { 2, 3, 1, 1},
1063 .audiomux = { 0, 0, 0x10, 8, 4 },
1066 .tuner_type = TUNER_PHILIPS_PAL,
1069 /* Tim Röstermundt <rosterm@uni-muenster.de>
1070 in de.comp.os.unix.linux.hardware:
1071 options bttv card=0 pll=1 radio=1 gpiomask=0x18e0
1072 audiomux=0x44c71f,0x44d71f,0,0x44d71f,0x44dfff
1073 options tuner type=5 */
1074 .name = "Lifeview FlyVideo 2000 /FlyVideo A2/ Lifetec LT 9415 TV [LR90]",
1080 .muxsel = { 2, 3, 1, 1},
1081 .audiomux = { 0x0000,0x0800,0x1000,0x1000,0x18e0 },
1082 /* For cards with tda9820/tda9821:
1083 0x0000: Tuner normal stereo
1084 0x0080: Tuner A2 SAP (second audio program = Zweikanalton)
1085 0x0880: Tuner A2 stereo */
1089 /* Miguel Angel Alvarez <maacruz@navegalia.com>
1090 old Easy TV BT848 version (model CPH031) */
1091 .name = "Askey CPH031/ BESTBUY Easy TV",
1097 .muxsel = { 2, 3, 1, 0},
1098 .audiomux = { 2, 0, 0, 0, 10},
1101 .tuner_type = TUNER_TEMIC_PAL,
1104 /* ---- card 0x38 ---------------------------------- */
1105 /* Gordon Heydon <gjheydon@bigfoot.com ('98) */
1106 .name = "Lifeview FlyVideo 98FM LR50",
1112 .muxsel = { 2, 3, 1, 1},
1113 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 },
1117 /* This is the ultimate cheapo capture card
1118 * just a BT848A on a small PCB!
1119 * Steve Hosgood <steve@equiinet.com> */
1120 .name = "GrandTec 'Grand Video Capture' (Bt848)",
1133 /* Daniel Herrington <daniel.herrington@home.com> */
1134 .name = "Askey CPH060/ Phoebe TV Master Only (No FM)",
1140 .muxsel = { 2, 3, 1, 1},
1141 .audiomux = { 0x400, 0x400, 0x400, 0x400, 0x800, 0x400 },
1144 .tuner_type = TUNER_TEMIC_4036FY5_NTSC,
1146 /* Matti Mottus <mottus@physic.ut.ee> */
1147 .name = "Askey CPH03x TV Capturer",
1152 .gpiomask = 0x03000F,
1153 .muxsel = { 2, 3, 1, 0},
1154 .audiomux = { 2,0,0,0,1 },
1159 /* ---- card 0x3c ---------------------------------- */
1160 /* Philip Blundell <philb@gnu.org> */
1161 .name = "Modular Technology MM100PCTV",
1167 .muxsel = { 2, 3, 1, 1},
1168 .audiomux = { 2, 0, 0, 1, 8},
1170 .tuner_type = TUNER_TEMIC_PAL,
1173 /* Adrian Cox <adrian@humboldt.co.uk */
1174 .name = "AG Electronics GMV1",
1187 /* Miguel Angel Alvarez <maacruz@navegalia.com>
1188 new Easy TV BT878 version (model CPH061)
1189 special thanks to Informatica Mieres for providing the card */
1190 .name = "Askey CPH061/ BESTBUY Easy TV (bt878)",
1196 .muxsel = { 2, 3, 1, 0},
1197 .audiomux = { 1, 0, 4, 4, 9},
1200 .tuner_type = TUNER_PHILIPS_PAL,
1202 /* Lukas Gebauer <geby@volny.cz> */
1203 .name = "ATI TV-Wonder",
1209 .muxsel = { 2, 3, 1, 0 },
1210 .audiomux = { 0xbffe, 0, 0xbfff, 0, 0xbffe},
1212 .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL,
1215 /* ---- card 0x40 ---------------------------------- */
1216 /* Lukas Gebauer <geby@volny.cz> */
1217 .name = "ATI TV-Wonder VE",
1223 .muxsel = { 2, 3, 0, 1},
1224 .audiomux = { 0, 0, 1, 0, 0},
1227 .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL,
1229 /* DeeJay <deejay@westel900.net (2000S) */
1230 .name = "Lifeview FlyVideo 2000S LR90",
1236 .muxsel = { 2, 3, 0, 1},
1237 /* Radio changed from 1e80 to 0x800 to make
1238 FlyVideo2000S in .hu happy (gm)*/
1239 /* -dk-???: set mute=0x1800 for tda9874h daughterboard */
1240 .audiomux = { 0x0000,0x0800,0x1000,0x1000,0x1800, 0x1080 },
1241 .audio_hook = fv2000s_audio,
1248 .name = "Terratec TValueRadio",
1253 .gpiomask = 0xffff00,
1254 .muxsel = { 2, 3, 1, 1},
1255 .audiomux = { 0x500, 0x500, 0x300, 0x900, 0x900},
1258 .tuner_type = TUNER_PHILIPS_PAL,
1261 /* TANAKA Kei <peg00625@nifty.com> */
1262 .name = "IODATA GV-BCTV4/PCI",
1267 .gpiomask = 0x010f00,
1268 .muxsel = {2, 3, 0, 0},
1269 .audiomux = {0x10000, 0, 0x10000, 0, 0, 0},
1272 .tuner_type = TUNER_SHARP_2U5JF5540_NTSC,
1273 .audio_hook = gvbctv3pci_audio,
1276 /* ---- card 0x44 ---------------------------------- */
1277 .name = "3Dfx VoodooTV FM (Euro), VoodooTV 200 (USA)",
1278 // try "insmod msp3400 simple=0" if you have
1279 // sound problems with this card.
1284 .gpiomask = 0x4f8a00,
1285 // 0x100000: 1=MSP enabled (0=disable again)
1286 // 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC)
1287 .audiomux = {0x947fff, 0x987fff,0x947fff,0x947fff, 0x947fff},
1288 // tvtuner, radio, external,internal, mute, stereo
1289 /* tuner, Composit, SVid, Composit-on-Svid-adapter*/
1290 .muxsel = { 2, 3 ,0 ,1},
1291 .tuner_type = TUNER_MT2032,
1295 /* Philip Blundell <pb@nexus.co.uk> */
1296 .name = "Active Imaging AIMMS",
1305 /* Tomasz Pyra <hellfire@sedez.iq.pl> */
1306 .name = "Prolink Pixelview PV-BT878P+ (Rev.4C,8E)",
1312 .muxsel = { 2, 3, 1, 1},
1313 .audiomux = { 0, 0, 11, 7, 13, 0}, // TV and Radio with same GPIO !
1319 GPIO0: U4.A0 (hef4052bt)
1321 GPIO2: U4.A1 (second hef4052bt)
1322 GPIO3: U4.nEN, U5.A0, A5.nEN
1326 .name = "Lifeview FlyVideo 98EZ (capture only) LR51",
1331 .muxsel = { 2, 3, 1, 1}, // AV1, AV2, SVHS, CVid adapter on SVHS
1336 /* ---- card 0x48 ---------------------------------- */
1337 /* Dariusz Kowalewski <darekk@automex.pl> */
1338 .name = "Prolink Pixelview PV-BT878P+9B (PlayTV Pro rev.9B FM+NICAM)",
1344 .muxsel = { 2, 3, 1, 1 },
1345 .audiomux = { 0x01, 0x00, 0x03, 0x03, 0x09, 0x02 },
1351 .audio_hook = pvbt878p9b_audio, // Note: not all cards have stereo
1352 .has_radio = 1, // Note: not all cards have radio
1359 GPIO20,22,23: R30,R29,R28
1362 /* Clay Kunz <ckunz@mail.arc.nasa.gov> */
1363 /* you must jumper JP5 for the card to work */
1364 .name = "Sensoray 311",
1370 .muxsel = { 2, 3, 1, 0, 0},
1375 /* Miguel Freitas <miguel@cetuc.puc-rio.br> */
1376 .name = "RemoteVision MX (RV605)",
1382 .gpiomask2 = 0x07ff,
1383 .muxsel = { 0x33, 0x13, 0x23, 0x43, 0xf3, 0x73, 0xe3, 0x03,
1384 0xd3, 0xb3, 0xc3, 0x63, 0x93, 0x53, 0x83, 0xa3 },
1388 .muxsel_hook = rv605_muxsel,
1390 .name = "Powercolor MTV878/ MTV878R/ MTV878F",
1395 .gpiomask = 0x1C800F, // Bit0-2: Audio select, 8-12:remote control 14:remote valid 15:remote reset
1396 .muxsel = { 2, 1, 1, },
1397 .audiomux = { 0, 1, 2, 2, 4 },
1399 .tuner_type = TUNER_PHILIPS_PAL,
1404 /* ---- card 0x4c ---------------------------------- */
1405 /* Masaki Suzuki <masaki@btree.org> */
1406 .name = "Canopus WinDVR PCI (COMPAQ Presario 3524JP, 5112JP)",
1411 .gpiomask = 0x140007,
1412 .muxsel = { 2, 3, 1, 1 },
1413 .audiomux = { 0, 1, 2, 3, 4, 0 },
1414 .tuner_type = TUNER_PHILIPS_NTSC,
1415 .audio_hook = windvr_audio,
1417 .name = "GrandTec Multi Capture Card (Bt878)",
1423 .muxsel = { 2, 3, 1, 0 },
1430 .name = "Jetway TV/Capture JW-TV878-FBK, Kworld KW-TV878RF",
1436 .muxsel = { 2, 3, 1, 1 }, // Tuner, SVid, SVHS, SVid to SVHS connector
1437 .audiomux = { 0 ,0 ,4, 4,4,4},// Yes, this tuner uses the same audio output for TV and FM radio!
1438 // This card lacks external Audio In, so we mute it on Ext. & Int.
1439 // The PCB can take a sbx1637/sbx1673, wiring unknown.
1440 // This card lacks PCI subsystem ID, sigh.
1441 // audiomux=1: lower volume, 2+3: mute
1442 // btwincap uses 0x80000/0x80003
1446 .tuner_type = 5, // Samsung TCPA9095PC27A (BG+DK), philips compatible, w/FM, stereo and
1447 // radio signal strength indicators work fine.
1450 GPIO0,1: HEF4052 A0,A1
1451 GPIO2: HEF4052 nENABLE
1453 GPIO8-13: IRDC357 data0-5 (data6 n.c. ?) [chip not present on my card]
1457 ?? : mtu8b56ep microcontroller for IR (GPIO wiring unknown)*/
1459 /* Arthur Tetzlaff-Deas, DSP Design Ltd <software@dspdesign.com> */
1460 .name = "DSP Design TCVIDEO",
1463 .muxsel = { 2, 3, 1, 0},
1468 /* ---- card 0x50 ---------------------------------- */
1469 .name = "Hauppauge WinTV PVR",
1474 .muxsel = { 2, 0, 1, 1},
1482 .name = "IODATA GV-BCTV5/PCI",
1487 .gpiomask = 0x0f0f80,
1488 .muxsel = {2, 3, 1, 0},
1489 .audiomux = {0x030000, 0x010000, 0, 0, 0x020000, 0},
1492 .tuner_type = TUNER_PHILIPS_NTSC_M,
1493 .audio_hook = gvbctv5pci_audio,
1496 .name = "Osprey 100/150 (878)", /* 0x1(2|3)-45C6-C1 */
1497 .video_inputs = 4, /* id-inputs-clock */
1501 .muxsel = { 3, 2, 0, 1 },
1508 .name = "Osprey 100/150 (848)", /* 0x04-54C0-C1 & older boards */
1513 .muxsel = { 2, 3, 1 },
1521 /* ---- card 0x54 ---------------------------------- */
1522 .name = "Osprey 101 (848)", /* 0x05-40C0-C1 */
1534 .name = "Osprey 101/151", /* 0x1(4|5)-0004-C4 */
1546 .name = "Osprey 101/151 w/ svid", /* 0x(16|17|20)-00C4-C1 */
1558 .name = "Osprey 200/201/250/251", /* 0x1(8|9|E|F)-0004-C4 */
1571 /* ---- card 0x58 ---------------------------------- */
1572 .name = "Osprey 200/250", /* 0x1(A|B)-00C4-C1 */
1584 .name = "Osprey 210/220", /* 0x1(A|B)-04C0-C1 */
1596 .name = "Osprey 500", /* 500 */
1608 .name = "Osprey 540", /* 540 */
1612 #if 0 /* TODO ... */
1613 .svhs = OSPREY540_SVID_ANALOG,
1614 .muxsel = { [OSPREY540_COMP_ANALOG] = 2,
1615 [OSPREY540_SVID_ANALOG] = 3, },
1622 #if 0 /* TODO ... */
1623 .muxsel_hook = osprey_540_muxsel,
1624 .picture_hook = osprey_540_set_picture,
1628 /* ---- card 0x5C ---------------------------------- */
1629 .name = "Osprey 2000", /* 2000 */
1639 .no_tda7432 = 1, /* must avoid, conflicts with the bt860 */
1641 /* M G Berberich <berberic@forwiss.uni-passau.de> */
1642 .name = "IDS Eagle",
1649 .muxsel = { 0, 1, 2, 3 },
1650 .muxsel_hook = eagle_muxsel,
1655 .name = "Pinnacle PCTV Sat",
1665 .audiomux = { 0, 0, 0, 0, 1 },
1666 .muxsel = { 3, 0, 1, 2},
1671 .name = "Formac ProTV II (bt878)",
1677 // TV, Comp1, Composite over SVID con, SVID
1678 .muxsel = { 2, 3, 1, 1},
1679 .audiomux = { 2, 2, 0, 0, 0 },
1682 .tuner_type = TUNER_PHILIPS_PAL,
1684 GPIO=0x00,0x01,0x03: mute (?)
1685 0x02: both TV and radio (tuner: FM1216/I)
1686 The card has onboard audio connectors labeled "cdrom" and "board",
1687 not soldered here, though unknown wiring.
1688 Card lacks: external audio in, pci subsystem id.
1692 /* ---- card 0x60 ---------------------------------- */
1699 .muxsel = { 2, 3, 1, 1},
1700 .audiomux = { 0, 1, 2, 3, 4},
1705 .name = "Euresys Picolo",
1714 .muxsel = { 2, 0, 1},
1717 /* Luc Van Hoeylandt <luc@e-magic.be> */
1718 .name = "ProVideo PV150", /* 0x4f */
1731 /* Hiroshi Takekawa <sian@big.or.jp> */
1732 /* This card lacks subsystem ID */
1733 .name = "AD-TVK503", /* 0x63 */
1738 .gpiomask = 0x001e8007,
1739 .muxsel = { 2, 3, 1, 0 },
1740 /* Tuner, Radio, external, internal, off, on */
1741 .audiomux = { 0x08, 0x0f, 0x0a, 0x08, 0x0f, 0x08 },
1746 .audio_hook = adtvk503_audio,
1749 /* ---- card 0x64 ---------------------------------- */
1750 .name = "Hercules Smart TV Stereo",
1756 .muxsel = { 2, 3, 1, 1 },
1762 - card lacks subsystem ID
1763 - stereo variant w/ daughter board with tda9874a @0xb0
1765 always from tda9874 independent of GPIO (?)
1766 external line in: unknown
1767 - Other chips: em78p156elp @ 0x96 (probably IR remote control)
1768 hef4053 (instead 4052) for unknown function
1771 .name = "Pace TV & Radio Card",
1776 .muxsel = { 2, 3, 1, 1}, // Tuner, CVid, SVid, CVid over SVid connector
1783 /* Bt878, Bt832, FI1246 tuner; no pci subsystem id
1784 only internal line out: (4pin header) RGGL
1785 Radio must be decoded by msp3410d (not routed through)*/
1786 // .digital_mode = DIGITAL_MODE_CAMERA, // todo!
1788 /* Chris Willing <chris@vislab.usyd.edu.au> */
1799 .name = "Grand X-Guard / Trust 814PCI",
1806 .muxsel = { 2,2,2,2, 3,3,3,3, 1,1,1,1, 0,0,0,0 },
1807 .muxsel_hook = xguard_muxsel,
1814 /* ---- card 0x68 ---------------------------------- */
1815 .name = "Nebula Electronics DigiTV",
1819 .muxsel = { 2, 3, 1, 0},
1828 /* Jorge Boncompte - DTI2 <jorge@dti2.net> */
1829 .name = "ProVideo PV143",
1835 .muxsel = { 2, 3, 1, 0 },
1842 /* M.Klahr@phytec.de */
1843 .name = "PHYTEC VD-009-X1 MiniDIN (bt878)",
1846 .tuner = -1, /* card has no tuner */
1849 .muxsel = { 2, 3, 1, 0},
1850 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1855 .name = "PHYTEC VD-009-X1 Combi (bt878)",
1858 .tuner = -1, /* card has no tuner */
1861 .muxsel = { 2, 3, 1, 1},
1862 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1868 /* ---- card 0x6c ---------------------------------- */
1869 .name = "PHYTEC VD-009 MiniDIN (bt878)",
1872 .tuner = -1, /* card has no tuner */
1875 .gpiomask2 = 0x03, /* gpiomask2 defines the bits used to switch audio
1876 via the upper nibble of muxsel. here: used for
1877 xternal video-mux */
1878 .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x00 },
1879 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1884 .name = "PHYTEC VD-009 Combi (bt878)",
1887 .tuner = -1, /* card has no tuner */
1890 .gpiomask2 = 0x03, /* gpiomask2 defines the bits used to switch audio
1891 via the upper nibble of muxsel. here: used for
1892 xternal video-mux */
1893 .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x01 },
1894 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1906 .muxsel = { 2, 3, 1, 0 },
1909 /* IVC-120G - Alan Garfield <alan@fromorbit.com> */
1912 .audio_inputs = 0, /* card has no audio */
1913 .tuner = -1, /* card has no tuner */
1915 .svhs = -1, /* card has no svhs */
1921 .muxsel = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
1922 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10 },
1923 .muxsel_hook = ivc120_muxsel,
1927 /* ---- card 0x70 ---------------------------------- */
1928 .name = "pcHDTV HD-2000 TV",
1933 .muxsel = { 2, 3, 1, 0},
1934 .tuner_type = TUNER_PHILIPS_ATSC,
1936 .name = "Twinhan DST + clones",
1940 .tuner_type = TUNER_ABSENT,
1944 .name = "Winfast VC100",
1948 .tuner = -1, // no tuner
1949 .muxsel = { 3, 1, 1, 3}, // Vid In, SVid In, Vid over SVid in connector
1953 .tuner_type = TUNER_ABSENT,
1957 .name = "Teppro TEV-560/InterVision IV-560",
1963 .muxsel = { 2, 3, 1, 1},
1964 .audiomux = { 1, 1, 1, 1, 0},
1966 .tuner_type = TUNER_PHILIPS_PAL,
1970 /* ---- card 0x74 ---------------------------------- */
1971 .name = "SIMUS GVC1100",
1978 .muxsel = { 2, 2, 2, 2},
1980 .muxsel_hook = gvc1100_muxsel,
1982 /* Carlos Silva r3pek@r3pek.homelinux.org || card 0x75 */
1983 .name = "NGS NGSTV+",
1987 .gpiomask = 0x008007,
1988 .muxsel = {2, 3, 0, 0},
1989 .audiomux = {0, 0, 0, 0, 0x000003, 0},
1991 .tuner_type = TUNER_PHILIPS_PAL,
1994 /* http://linuxmedialabs.com */
1996 .video_inputs = 4, /* IN1,IN2,IN3,IN4 */
2000 .muxsel = { 2, 3, 1, 0 },
2006 /* Helmroos Harri <harri.helmroos@pp.inet.fi> */
2007 .name = "Tekram M205 PRO",
2011 .tuner_type = TUNER_PHILIPS_PAL,
2015 .muxsel = { 2, 3, 1},
2016 .audiomux = { 0x68, 0x68, 0x61, 0x61, 0x00 },
2020 /* ---- card 0x78 ---------------------------------- */
2021 /* Javier Cendan Ares <jcendan@lycos.es> */
2022 /* bt878 TV + FM without subsystem ID */
2023 .name = "Conceptronic CONTVFMi",
2028 .gpiomask = 0x008007,
2029 .muxsel = { 2, 3, 1, 1 },
2030 .audiomux = { 0, 1, 2, 2, 3 },
2033 .tuner_type = TUNER_PHILIPS_PAL,
2037 /*Eric DEBIEF <debief@telemsa.com>*/
2038 /*EURESYS Picolo Tetra : 4 Conexant Fusion 878A, no audio, video input set with analog multiplexers GPIO controled*/
2039 /* adds picolo_tetra_muxsel(), picolo_tetra_init(), the folowing declaration strucure, and #define BTTV_PICOLO_TETRA_CHIP*/
2041 .name = "Euresys Picolo Tetra",
2047 .gpiomask2 = 0x3C<<16,/*Set the GPIO[18]->GPIO[21] as output pin.==> drive the video inputs through analog multiplexers*/
2051 .muxsel = {2,2,2,2},/*878A input is always MUX0, see above.*/
2052 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
2055 .muxsel_hook = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/
2057 /* Spirit TV Tuner from http://spiritmodems.com.au */
2058 /* Stafford Goodsell <surge@goliath.homeunix.org> */
2059 .name = "Spirit TV Tuner",
2064 .gpiomask = 0x0000000f,
2065 .muxsel = { 2, 1, 1 },
2066 .audiomux = { 0x02, 0x00, 0x00, 0x00, 0x00},
2067 .tuner_type = TUNER_TEMIC_PAL,
2071 /* Wolfram Joost <wojo@frokaschwei.de> */
2072 .name = "AVerMedia AVerTV DVB-T 771",
2076 .tuner_type = TUNER_ABSENT,
2077 .muxsel = { 3 , 3 },
2084 #if 0 /* untested */
2088 /* ---- card 0x7c ---------------------------------- */
2089 /* Matt Jesson <dvb@jesson.eclipse.co.uk> */
2090 /* Based on the Nebula card data - added remote and new card number - BTTV_AVDVBT_761, see also ir-kbd-gpio.c */
2091 .name = "AverMedia AverTV DVB-T 761",
2095 .muxsel = { 2, 3, 1, 0},
2105 /* andre.schwarz@matrix-vision.de */
2106 .name = "MATRIX Vision Sigma-SQ",
2112 .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2,
2113 3, 3, 3, 3, 3, 3, 3, 3 },
2114 .muxsel_hook = sigmaSQ_muxsel,
2120 /* andre.schwarz@matrix-vision.de */
2121 .name = "MATRIX Vision Sigma-SLC",
2127 .muxsel = { 2, 2, 2, 2 },
2128 .muxsel_hook = sigmaSLC_muxsel,
2134 /* BTTV_APAC_VIEWCOMP */
2135 /* Attila Kondoros <attila.kondoros@chello.hu> */
2136 /* bt878 TV + FM 0x00000000 subsystem ID */
2137 .name = "APAC Viewcomp 878(AMAX)",
2143 .muxsel = { 2, 3, 1, 1},
2144 .audiomux = { 2, 0, 0, 0, 10},
2147 .tuner_type = TUNER_PHILIPS_PAL,
2148 .has_remote = 1, /* miniremote works, see ir-kbd-gpio.c */
2149 .has_radio = 1, /* not every card has radio */
2152 const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards);
2154 /* ----------------------------------------------------------------------- */
2156 static unsigned char eeprom_data[256];
2161 void __devinit bttv_idcard(struct bttv *btv)
2163 unsigned int gpiobits;
2167 /* read PCI subsystem ID */
2168 pci_read_config_word(btv->c.pci, PCI_SUBSYSTEM_ID, &tmp);
2169 btv->cardid = tmp << 16;
2170 pci_read_config_word(btv->c.pci, PCI_SUBSYSTEM_VENDOR_ID, &tmp);
2173 if (0 != btv->cardid && 0xffffffff != btv->cardid) {
2174 /* look for the card */
2175 for (type = -1, i = 0; cards[i].id != 0; i++)
2176 if (cards[i].id == btv->cardid)
2181 printk(KERN_INFO "bttv%d: detected: %s [card=%d], "
2182 "PCI subsystem ID is %04x:%04x\n",
2183 btv->c.nr,cards[type].name,cards[type].cardnr,
2184 btv->cardid & 0xffff,
2185 (btv->cardid >> 16) & 0xffff);
2186 btv->c.type = cards[type].cardnr;
2189 printk(KERN_INFO "bttv%d: subsystem: %04x:%04x (UNKNOWN)\n",
2190 btv->c.nr, btv->cardid & 0xffff,
2191 (btv->cardid >> 16) & 0xffff);
2192 printk(KERN_DEBUG "please mail id, board name and "
2193 "the correct card= insmod option to kraxel@bytesex.org\n");
2197 /* let the user override the autodetected type */
2198 if (card[btv->c.nr] < bttv_num_tvcards)
2199 btv->c.type=card[btv->c.nr];
2201 /* print which card config we are using */
2202 printk(KERN_INFO "bttv%d: using: %s [card=%d,%s]\n",btv->c.nr,
2203 bttv_tvcards[btv->c.type].name, btv->c.type,
2204 card[btv->c.nr] < bttv_num_tvcards
2205 ? "insmod option" : "autodetected");
2207 /* overwrite gpio stuff ?? */
2208 if (UNSET == audioall && UNSET == audiomux[0])
2211 if (UNSET != audiomux[0]) {
2213 for (i = 0; i < 5; i++) {
2214 bttv_tvcards[btv->c.type].audiomux[i] = audiomux[i];
2215 gpiobits |= audiomux[i];
2218 gpiobits = audioall;
2219 for (i = 0; i < 5; i++) {
2220 bttv_tvcards[btv->c.type].audiomux[i] = audioall;
2223 bttv_tvcards[btv->c.type].gpiomask = (UNSET != gpiomask) ? gpiomask : gpiobits;
2224 printk(KERN_INFO "bttv%d: gpio config override: mask=0x%x, mux=",
2225 btv->c.nr,bttv_tvcards[btv->c.type].gpiomask);
2226 for (i = 0; i < 5; i++) {
2227 printk("%s0x%x", i ? "," : "", bttv_tvcards[btv->c.type].audiomux[i]);
2233 * (most) board specific initialisations goes here
2236 /* Some Modular Technology cards have an eeprom, but no subsystem ID */
2237 void identify_by_eeprom(struct bttv *btv, unsigned char eeprom_data[256])
2241 if (0 == strncmp(eeprom_data,"GET MM20xPCTV",13))
2242 type = BTTV_MODTEC_205;
2243 else if (0 == strncmp(eeprom_data+20,"Picolo",7))
2244 type = BTTV_EURESYS_PICOLO;
2245 else if (eeprom_data[0] == 0x84 && eeprom_data[2]== 0)
2246 type = BTTV_HAUPPAUGE; /* old bt848 */
2250 printk("bttv%d: detected by eeprom: %s [card=%d]\n",
2251 btv->c.nr, bttv_tvcards[btv->c.type].name, btv->c.type);
2255 static void flyvideo_gpio(struct bttv *btv)
2257 int gpio,has_remote,has_radio,is_capture_only,is_lr90,has_tda9820_tda9821;
2260 gpio_inout(0xffffff, 0);
2261 udelay(8); // without this we would see the 0x1800 mask
2263 /* FIXME: must restore OUR_EN ??? */
2265 // all cards provide GPIO info, some have an additional eeprom
2266 // LR50: GPIO coding can be found lower right CP1 .. CP9
2267 // CP9=GPIO23 .. CP1=GPIO15; when OPEN, the corresponding GPIO reads 1.
2269 // LR90: GP9=GPIO23 .. GP1=GPIO15 (right above the bt878)
2271 // lowest 3 bytes are remote control codes (no handshake needed)
2272 // xxxFFF: No remote control chip soldered
2273 // xxxF00(LR26/LR50), xxxFE0(LR90): Remote control chip (LVA001 or CF45) soldered
2274 // Note: Some bits are Audio_Mask !
2276 ttype=(gpio&0x0f0000)>>16;
2278 case 0x0: tuner=2; // NTSC, e.g. TPI8NSR11P
2280 case 0x2: tuner=39;// LG NTSC (newer TAPC series) TAPC-H701P
2282 case 0x4: tuner=5; // Philips PAL TPI8PSB02P, TPI8PSB12P, TPI8PSB12D or FI1216, FM1216
2284 case 0x6: tuner=37; // LG PAL (newer TAPC series) TAPC-G702P
2286 case 0xC: tuner=3; // Philips SECAM(+PAL) FQ1216ME or FI1216MF
2289 printk(KERN_INFO "bttv%d: FlyVideo_gpio: unknown tuner type.\n", btv->c.nr);
2292 has_remote = gpio & 0x800000;
2293 has_radio = gpio & 0x400000;
2294 // unknown 0x200000;
2295 // unknown2 0x100000;
2296 is_capture_only = !(gpio & 0x008000); //GPIO15
2297 has_tda9820_tda9821 = !(gpio & 0x004000);
2298 is_lr90 = !(gpio & 0x002000); // else LR26/LR50 (LR38/LR51 f. capture only)
2299 // gpio & 0x001000 // output bit for audio routing
2302 tuner=4; // No tuner present
2304 printk(KERN_INFO "bttv%d: FlyVideo Radio=%s RemoteControl=%s Tuner=%d gpio=0x%06x\n",
2305 btv->c.nr, has_radio? "yes":"no ", has_remote? "yes":"no ", tuner, gpio);
2306 printk(KERN_INFO "bttv%d: FlyVideo LR90=%s tda9821/tda9820=%s capture_only=%s\n",
2307 btv->c.nr, is_lr90?"yes":"no ", has_tda9820_tda9821?"yes":"no ",
2308 is_capture_only?"yes":"no ");
2310 if(tuner!= -1) // only set if known tuner autodetected, else let insmod option through
2311 btv->tuner_type = tuner;
2312 btv->has_radio = has_radio;
2314 // LR90 Audio Routing is done by 2 hef4052, so Audio_Mask has 4 bits: 0x001c80
2315 // LR26/LR50 only has 1 hef4052, Audio_Mask 0x000c00
2316 // Audio options: from tuner, from tda9821/tda9821(mono,stereo,sap), from tda9874, ext., mute
2317 if(has_tda9820_tda9821) btv->audio_hook = lt9415_audio;
2318 //todo: if(has_tda9874) btv->audio_hook = fv2000s_audio;
2321 int miro_tunermap[] = { 0,6,2,3, 4,5,6,0, 3,0,4,5, 5,2,16,1,
2322 14,2,17,1, 4,1,4,3, 1,2,16,1, 4,4,4,4 };
2323 int miro_fmtuner[] = { 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1,
2324 1,1,1,1, 1,1,1,0, 0,0,0,0, 0,1,0,0 };
2326 static void miro_pinnacle_gpio(struct bttv *btv)
2331 gpio_inout(0xffffff, 0);
2333 id = ((gpio>>10) & 63) -1;
2334 msp = bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx");
2336 btv->tuner_type = miro_tunermap[id];
2337 if (0 == (gpio & 0x20)) {
2339 if (!miro_fmtuner[id]) {
2340 btv->has_matchbox = 1;
2341 btv->mbox_we = (1<<6);
2342 btv->mbox_most = (1<<7);
2343 btv->mbox_clk = (1<<8);
2344 btv->mbox_data = (1<<9);
2345 btv->mbox_mask = (1<<6)|(1<<7)|(1<<8)|(1<<9);
2351 if (btv->c.type == BTTV_MIRO)
2352 btv->c.type = BTTV_MIROPRO;
2353 if (btv->c.type == BTTV_PINNACLE)
2354 btv->c.type = BTTV_PINNACLEPRO;
2357 "bttv%d: miro: id=%d tuner=%d radio=%s stereo=%s\n",
2358 btv->c.nr, id+1, btv->tuner_type,
2359 !btv->has_radio ? "no" :
2360 (btv->has_matchbox ? "matchbox" : "fmtuner"),
2361 (-1 == msp) ? "no" : "yes");
2363 /* new cards with microtune tuner */
2368 info = "PAL / mono";
2371 info = "PAL+SECAM / stereo";
2375 info = "NTSC / stereo";
2379 info = "PAL+SECAM / mono";
2382 info = "NTSC / mono";
2385 info = "NTSC / stereo";
2388 info = "PAL / stereo";
2391 info = "oops: unknown card";
2395 btv->c.type = BTTV_PINNACLEPRO;
2397 "bttv%d: pinnacle/mt: id=%d info=\"%s\" radio=%s\n",
2398 btv->c.nr, id, info, btv->has_radio ? "yes" : "no");
2399 btv->tuner_type = 33;
2400 btv->pinnacle_id = id;
2404 /* GPIO21 L: Buffer aktiv, H: Buffer inaktiv */
2405 #define LM1882_SYNC_DRIVE 0x200000L
2407 static void init_ids_eagle(struct bttv *btv)
2409 gpio_inout(0xffffff,0xFFFF37);
2410 gpio_write(0x200020);
2412 /* flash strobe inverter ?! */
2413 gpio_write(0x200024);
2415 /* switch sync drive off */
2416 gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE);
2418 /* set BT848 muxel to 2 */
2419 btaor((2)<<5, ~(2<<5), BT848_IFORM);
2422 /* Muxsel helper for the IDS Eagle.
2423 * the eagles does not use the standard muxsel-bits but
2424 * has its own multiplexer */
2425 static void eagle_muxsel(struct bttv *btv, unsigned int input)
2427 btaor((2)<<5, ~(3<<5), BT848_IFORM);
2428 gpio_bits(3,bttv_tvcards[btv->c.type].muxsel[input&7]);
2432 /* wake chroma ADC */
2433 btand(~BT848_ADC_C_SLEEP, BT848_ADC);
2434 /* set to YC video */
2435 btor(BT848_CONTROL_COMP, BT848_E_CONTROL);
2436 btor(BT848_CONTROL_COMP, BT848_O_CONTROL);
2439 /* set chroma ADC to sleep */
2440 btor(BT848_ADC_C_SLEEP, BT848_ADC);
2441 /* set to composite video */
2442 btand(~BT848_CONTROL_COMP, BT848_E_CONTROL);
2443 btand(~BT848_CONTROL_COMP, BT848_O_CONTROL);
2446 /* switch sync drive off */
2447 gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE);
2450 static void gvc1100_muxsel(struct bttv *btv, unsigned int input)
2452 static const int masks[] = {0x30, 0x01, 0x12, 0x23};
2453 gpio_write(masks[input%4]);
2456 /* LMLBT4x initialization - to allow access to GPIO bits for sensors input and
2459 GPIObit | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
2460 assignment | TI | O3|INx| O2| O1|IN4|IN3|IN2|IN1| | |
2462 IN - sensor inputs, INx - sensor inputs and TI XORed together
2463 O1,O2,O3 - alarm outputs (relays)
2465 OUT ENABLE 1 1 0 . 1 1 0 0 . 0 0 0 0 = 0x6C0
2469 static void init_lmlbt4x(struct bttv *btv)
2471 printk(KERN_DEBUG "LMLBT4x init\n");
2472 btwrite(0x000000, BT848_GPIO_REG_INP);
2473 gpio_inout(0xffffff, 0x0006C0);
2474 gpio_write(0x000000);
2477 static void sigmaSQ_muxsel(struct bttv *btv, unsigned int input)
2479 unsigned int inmux = input % 8;
2480 gpio_inout( 0xf, 0xf );
2481 gpio_bits( 0xf, inmux );
2484 static void sigmaSLC_muxsel(struct bttv *btv, unsigned int input)
2486 unsigned int inmux = input % 4;
2487 gpio_inout( 3<<9, 3<<9 );
2488 gpio_bits( 3<<9, inmux<<9 );
2491 /* ----------------------------------------------------------------------- */
2493 void bttv_reset_audio(struct bttv *btv)
2496 * BT878A has a audio-reset register.
2497 * 1. This register is an audio reset function but it is in
2498 * function-0 (video capture) address space.
2499 * 2. It is enough to do this once per power-up of the card.
2500 * 3. There is a typo in the Conexant doc -- it is not at
2501 * 0x5B, but at 0x058. (B is an odd-number, obviously a typo!).
2502 * --//Shrikumar 030609
2508 printk("bttv%d: BT878A ARESET\n",btv->c.nr);
2509 btwrite((1<<7), 0x058);
2514 /* initialization part one -- before registering i2c bus */
2515 void __devinit bttv_init_card1(struct bttv *btv)
2517 switch (btv->c.type) {
2518 case BTTV_HAUPPAUGE:
2519 case BTTV_HAUPPAUGE878:
2520 boot_msp34xx(btv,5);
2522 case BTTV_VOODOOTV_FM:
2523 boot_msp34xx(btv,20);
2525 case BTTV_AVERMEDIA98:
2526 boot_msp34xx(btv,11);
2528 case BTTV_HAUPPAUGEPVR:
2531 case BTTV_TWINHAN_DST:
2532 case BTTV_AVDVBT_771:
2533 btv->use_i2c_hw = 1;
2538 /* initialization part two -- after registering i2c bus */
2539 void __devinit bttv_init_card2(struct bttv *btv)
2541 btv->tuner_type = -1;
2543 if (BTTV_UNKNOWN == btv->c.type) {
2544 bttv_readee(btv,eeprom_data,0xa0);
2545 identify_by_eeprom(btv,eeprom_data);
2548 switch (btv->c.type) {
2552 case BTTV_PINNACLEPRO:
2554 miro_pinnacle_gpio(btv);
2556 case BTTV_FLYVIDEO_98:
2558 case BTTV_LIFE_FLYKIT:
2560 case BTTV_TYPHOON_TVIEW:
2561 case BTTV_CHRONOS_VS2:
2562 case BTTV_FLYVIDEO_98FM:
2563 case BTTV_FLYVIDEO2000:
2564 case BTTV_FLYVIDEO98EZ:
2565 case BTTV_CONFERENCETV:
2566 case BTTV_LIFETEC_9415:
2569 case BTTV_HAUPPAUGE:
2570 case BTTV_HAUPPAUGE878:
2571 case BTTV_HAUPPAUGEPVR:
2572 /* pick up some config infos from the eeprom */
2573 bttv_readee(btv,eeprom_data,0xa0);
2574 hauppauge_eeprom(btv);
2576 case BTTV_AVERMEDIA98:
2577 case BTTV_AVPHONE98:
2578 bttv_readee(btv,eeprom_data,0xa0);
2579 avermedia_eeprom(btv);
2584 case BTTV_PICOLO_TETRA_CHIP:
2585 picolo_tetra_init(btv);
2589 btv->has_matchbox = 1;
2590 btv->mbox_we = 0x20;
2592 btv->mbox_clk = 0x08;
2593 btv->mbox_data = 0x10;
2594 btv->mbox_mask = 0x38;
2596 case BTTV_VOBIS_BOOSTAR:
2598 terratec_active_radio_upgrade(btv);
2600 case BTTV_MAGICTVIEW061:
2601 if (btv->cardid == 0x3002144f) {
2603 printk("bttv%d: radio detected by subsystem id (CPH05x)\n",btv->c.nr);
2607 if (btv->cardid == 0x3060121a) {
2608 /* Fix up entry for 3DFX VoodooTV 100,
2609 which is an OEM STB card variant. */
2611 btv->tuner_type=TUNER_TEMIC_NTSC;
2614 case BTTV_OSPREY1x0:
2615 case BTTV_OSPREY1x0_848:
2616 case BTTV_OSPREY101_848:
2617 case BTTV_OSPREY1x1:
2618 case BTTV_OSPREY1x1_SVID:
2619 case BTTV_OSPREY2xx:
2620 case BTTV_OSPREY2x0_SVID:
2621 case BTTV_OSPREY2x0:
2622 case BTTV_OSPREY500:
2623 case BTTV_OSPREY540:
2624 case BTTV_OSPREY2000:
2625 bttv_readee(btv,eeprom_data,0xa0);
2628 case BTTV_IDS_EAGLE:
2629 init_ids_eagle(btv);
2631 case BTTV_MODTEC_205:
2632 bttv_readee(btv,eeprom_data,0xa0);
2640 /* pll configuration */
2641 if (!(btv->id==848 && btv->revision==0x11)) {
2642 /* defaults from card list */
2643 if (PLL_28 == bttv_tvcards[btv->c.type].pll) {
2644 btv->pll.pll_ifreq=28636363;
2645 btv->pll.pll_crystal=BT848_IFORM_XT0;
2647 if (PLL_35 == bttv_tvcards[btv->c.type].pll) {
2648 btv->pll.pll_ifreq=35468950;
2649 btv->pll.pll_crystal=BT848_IFORM_XT1;
2651 /* insmod options can override */
2652 switch (pll[btv->c.nr]) {
2654 btv->pll.pll_crystal = 0;
2655 btv->pll.pll_ifreq = 0;
2656 btv->pll.pll_ofreq = 0;
2658 case 1: /* 28 MHz */
2660 btv->pll.pll_ifreq = 28636363;
2661 btv->pll.pll_ofreq = 0;
2662 btv->pll.pll_crystal = BT848_IFORM_XT0;
2664 case 2: /* 35 MHz */
2666 btv->pll.pll_ifreq = 35468950;
2667 btv->pll.pll_ofreq = 0;
2668 btv->pll.pll_crystal = BT848_IFORM_XT1;
2672 btv->pll.pll_current = -1;
2674 /* tuner configuration (from card list / autodetect / insmod option) */
2675 if (UNSET != bttv_tvcards[btv->c.type].tuner_type)
2676 if(UNSET == btv->tuner_type)
2677 btv->tuner_type = bttv_tvcards[btv->c.type].tuner_type;
2678 if (UNSET != tuner[btv->c.nr])
2679 btv->tuner_type = tuner[btv->c.nr];
2680 printk("bttv%d: using tuner=%d\n",btv->c.nr,btv->tuner_type);
2681 if (btv->pinnacle_id != UNSET)
2682 bttv_call_i2c_clients(btv,AUDC_CONFIG_PINNACLE,
2684 if (btv->tuner_type != UNSET)
2685 bttv_call_i2c_clients(btv,TUNER_SET_TYPE,&btv->tuner_type);
2686 btv->svhs = bttv_tvcards[btv->c.type].svhs;
2687 if (svhs[btv->c.nr] != UNSET)
2688 btv->svhs = svhs[btv->c.nr];
2689 if (remote[btv->c.nr] != UNSET)
2690 btv->has_remote = remote[btv->c.nr];
2692 if (bttv_tvcards[btv->c.type].has_radio)
2694 if (bttv_tvcards[btv->c.type].has_remote)
2696 if (bttv_tvcards[btv->c.type].no_gpioirq)
2698 if (bttv_tvcards[btv->c.type].audio_hook)
2699 btv->audio_hook=bttv_tvcards[btv->c.type].audio_hook;
2701 if (bttv_tvcards[btv->c.type].digital_mode == DIGITAL_MODE_CAMERA) {
2702 /* detect Bt832 chip for quartzsight digital camera */
2703 if ((bttv_I2CRead(btv, I2C_BT832_ALT1, "Bt832") >=0) ||
2704 (bttv_I2CRead(btv, I2C_BT832_ALT2, "Bt832") >=0))
2708 /* try to detect audio/fader chips */
2709 if (!bttv_tvcards[btv->c.type].no_msp34xx &&
2710 bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx") >=0) {
2712 request_module("msp3400");
2715 if (bttv_tvcards[btv->c.type].msp34xx_alt &&
2716 bttv_I2CRead(btv, I2C_MSP3400_ALT, "MSP34xx (alternate address)") >=0) {
2718 request_module("msp3400");
2721 if (!bttv_tvcards[btv->c.type].no_tda9875 &&
2722 bttv_I2CRead(btv, I2C_TDA9875, "TDA9875") >=0) {
2724 request_module("tda9875");
2727 if (!bttv_tvcards[btv->c.type].no_tda7432 &&
2728 bttv_I2CRead(btv, I2C_TDA7432, "TDA7432") >=0) {
2730 request_module("tda7432");
2733 if (bttv_tvcards[btv->c.type].needs_tvaudio) {
2735 request_module("tvaudio");
2739 if (btv->pinnacle_id != UNSET) {
2741 request_module("tda9887");
2743 if (btv->tuner_type != UNSET) {
2745 request_module("tuner");
2750 /* ----------------------------------------------------------------------- */
2751 /* some hauppauge specific stuff */
2753 static struct HAUPPAUGE_TUNER
2758 hauppauge_tuner[] __devinitdata =
2760 { TUNER_ABSENT, "" },
2761 { TUNER_ABSENT, "External" },
2762 { TUNER_ABSENT, "Unspecified" },
2763 { TUNER_PHILIPS_PAL, "Philips FI1216" },
2764 { TUNER_PHILIPS_SECAM, "Philips FI1216MF" },
2765 { TUNER_PHILIPS_NTSC, "Philips FI1236" },
2766 { TUNER_PHILIPS_PAL_I, "Philips FI1246" },
2767 { TUNER_PHILIPS_PAL_DK,"Philips FI1256" },
2768 { TUNER_PHILIPS_PAL, "Philips FI1216 MK2" },
2769 { TUNER_PHILIPS_SECAM, "Philips FI1216MF MK2" },
2770 { TUNER_PHILIPS_NTSC, "Philips FI1236 MK2" },
2771 { TUNER_PHILIPS_PAL_I, "Philips FI1246 MK2" },
2772 { TUNER_PHILIPS_PAL_DK,"Philips FI1256 MK2" },
2773 { TUNER_TEMIC_NTSC, "Temic 4032FY5" },
2774 { TUNER_TEMIC_PAL, "Temic 4002FH5" },
2775 { TUNER_TEMIC_PAL_I, "Temic 4062FY5" },
2776 { TUNER_PHILIPS_PAL, "Philips FR1216 MK2" },
2777 { TUNER_PHILIPS_SECAM, "Philips FR1216MF MK2" },
2778 { TUNER_PHILIPS_NTSC, "Philips FR1236 MK2" },
2779 { TUNER_PHILIPS_PAL_I, "Philips FR1246 MK2" },
2780 { TUNER_PHILIPS_PAL_DK,"Philips FR1256 MK2" },
2781 { TUNER_PHILIPS_PAL, "Philips FM1216" },
2782 { TUNER_PHILIPS_SECAM, "Philips FM1216MF" },
2783 { TUNER_PHILIPS_NTSC, "Philips FM1236" },
2784 { TUNER_PHILIPS_PAL_I, "Philips FM1246" },
2785 { TUNER_PHILIPS_PAL_DK,"Philips FM1256" },
2786 { TUNER_TEMIC_4036FY5_NTSC, "Temic 4036FY5" },
2787 { TUNER_ABSENT, "Samsung TCPN9082D" },
2788 { TUNER_ABSENT, "Samsung TCPM9092P" },
2789 { TUNER_TEMIC_4006FH5_PAL, "Temic 4006FH5" },
2790 { TUNER_ABSENT, "Samsung TCPN9085D" },
2791 { TUNER_ABSENT, "Samsung TCPB9085P" },
2792 { TUNER_ABSENT, "Samsung TCPL9091P" },
2793 { TUNER_TEMIC_4039FR5_NTSC, "Temic 4039FR5" },
2794 { TUNER_PHILIPS_FQ1216ME, "Philips FQ1216 ME" },
2795 { TUNER_TEMIC_4066FY5_PAL_I, "Temic 4066FY5" },
2796 { TUNER_PHILIPS_NTSC, "Philips TD1536" },
2797 { TUNER_PHILIPS_NTSC, "Philips TD1536D" },
2798 { TUNER_PHILIPS_NTSC, "Philips FMR1236" }, /* mono radio */
2799 { TUNER_ABSENT, "Philips FI1256MP" },
2800 { TUNER_ABSENT, "Samsung TCPQ9091P" },
2801 { TUNER_TEMIC_4006FN5_MULTI_PAL, "Temic 4006FN5" },
2802 { TUNER_TEMIC_4009FR5_PAL, "Temic 4009FR5" },
2803 { TUNER_TEMIC_4046FM5, "Temic 4046FM5" },
2804 { TUNER_TEMIC_4009FN5_MULTI_PAL_FM, "Temic 4009FN5" },
2805 { TUNER_ABSENT, "Philips TD1536D_FH_44"},
2806 { TUNER_LG_NTSC_FM, "LG TPI8NSR01F"},
2807 { TUNER_LG_PAL_FM, "LG TPI8PSB01D"},
2808 { TUNER_LG_PAL, "LG TPI8PSB11D"},
2809 { TUNER_LG_PAL_I_FM, "LG TAPC-I001D"},
2810 { TUNER_LG_PAL_I, "LG TAPC-I701D"}
2813 static void modtec_eeprom(struct bttv *btv)
2815 if( strncmp(&(eeprom_data[0x1e]),"Temic 4066 FY5",14) ==0) {
2816 btv->tuner_type=TUNER_TEMIC_4066FY5_PAL_I;
2817 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
2818 btv->c.nr,&eeprom_data[0x1e]);
2819 } else if (strncmp(&(eeprom_data[0x1e]),"Alps TSBB5",10) ==0) {
2820 btv->tuner_type=TUNER_ALPS_TSBB5_PAL_I;
2821 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
2822 btv->c.nr,&eeprom_data[0x1e]);
2823 } else if (strncmp(&(eeprom_data[0x1e]),"Philips FM1246",14) ==0) {
2824 btv->tuner_type=TUNER_PHILIPS_NTSC;
2825 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
2826 btv->c.nr,&eeprom_data[0x1e]);
2828 printk("bttv%d: Modtec: Unknown TunerString: %s\n",
2829 btv->c.nr,&eeprom_data[0x1e]);
2833 static void __devinit hauppauge_eeprom(struct bttv *btv)
2835 unsigned int blk2,tuner,radio,model;
2837 if (eeprom_data[0] != 0x84 || eeprom_data[2] != 0)
2838 printk(KERN_WARNING "bttv%d: Hauppauge eeprom: invalid\n",
2841 /* Block 2 starts after len+3 bytes header */
2842 blk2 = eeprom_data[1] + 3;
2844 /* decode + use some config infos */
2845 model = eeprom_data[12] << 8 | eeprom_data[11];
2846 tuner = eeprom_data[9];
2847 radio = eeprom_data[blk2-1] & 0x01;
2849 if (tuner < ARRAY_SIZE(hauppauge_tuner))
2850 btv->tuner_type = hauppauge_tuner[tuner].id;
2855 printk(KERN_INFO "bttv%d: Hauppauge eeprom: model=%d, "
2856 "tuner=%s (%d), radio=%s\n",
2857 btv->c.nr, model, hauppauge_tuner[tuner].name,
2858 btv->tuner_type, radio ? "yes" : "no");
2861 static int terratec_active_radio_upgrade(struct bttv *btv)
2866 btv->has_matchbox = 1;
2867 btv->mbox_we = 0x10;
2868 btv->mbox_most = 0x20;
2869 btv->mbox_clk = 0x08;
2870 btv->mbox_data = 0x04;
2871 btv->mbox_mask = 0x3c;
2873 btv->mbox_iow = 1 << 8;
2874 btv->mbox_ior = 1 << 9;
2875 btv->mbox_csel = 1 << 10;
2878 tea5757_write(btv, 5 * freq + 0x358); // write 0x1ed8
2879 if (0x1ed8 == tea5757_read(btv)) {
2880 printk("bttv%d: Terratec Active Radio Upgrade found.\n",
2883 btv->has_matchbox = 1;
2886 btv->has_matchbox = 0;
2892 /* ----------------------------------------------------------------------- */
2895 * minimal bootstrap for the WinTV/PVR -- upload altera firmware.
2897 * The hcwamc.rbf firmware file is on the Hauppauge driver CD. Have
2898 * a look at Pvr/pvr45xxx.EXE (self-extracting zip archive, can be
2899 * unpacked with unzip).
2901 #define PVR_GPIO_DELAY 10
2903 #define BTTV_ALT_DATA 0x000001
2904 #define BTTV_ALT_DCLK 0x100000
2905 #define BTTV_ALT_NCONFIG 0x800000
2907 static int __devinit pvr_altera_load(struct bttv *btv, u8 *micro, u32 microlen)
2913 gpio_inout(0xffffff,BTTV_ALT_DATA|BTTV_ALT_DCLK|BTTV_ALT_NCONFIG);
2915 udelay(PVR_GPIO_DELAY);
2917 gpio_write(BTTV_ALT_NCONFIG);
2918 udelay(PVR_GPIO_DELAY);
2920 for (n = 0; n < microlen; n++) {
2922 for ( i = 0 ; i < 8 ; i++ ) {
2923 gpio_bits(BTTV_ALT_DCLK,0);
2925 gpio_bits(BTTV_ALT_DATA,BTTV_ALT_DATA);
2927 gpio_bits(BTTV_ALT_DATA,0);
2928 gpio_bits(BTTV_ALT_DCLK,BTTV_ALT_DCLK);
2932 gpio_bits(BTTV_ALT_DCLK,0);
2933 udelay(PVR_GPIO_DELAY);
2935 /* begin Altera init loop (Not necessary,but doesn't hurt) */
2936 for (i = 0 ; i < 30 ; i++) {
2937 gpio_bits(BTTV_ALT_DCLK,0);
2938 gpio_bits(BTTV_ALT_DCLK,BTTV_ALT_DCLK);
2940 gpio_bits(BTTV_ALT_DCLK,0);
2944 #if !defined(CONFIG_FW_LOADER) && !defined(CONFIG_FW_LOADER_MODULE)
2945 /* old 2.4.x way -- via soundcore's mod_firmware_load */
2947 static char *firm_altera = "/usr/lib/video4linux/hcwamc.rbf";
2948 MODULE_PARM(firm_altera,"s");
2949 MODULE_PARM_DESC(firm_altera,"WinTV/PVR firmware "
2950 "(driver CD => unzip pvr45xxx.exe => hcwamc.rbf)");
2952 extern int mod_firmware_load(const char *fn, char **fp);
2954 int __devinit pvr_boot(struct bttv *btv)
2960 microlen = mod_firmware_load(firm_altera, (char**) µ);
2962 printk(KERN_WARNING "bttv%d: altera firmware not found [%s]\n",
2963 btv->c.nr, firm_altera);
2967 printk(KERN_INFO "bttv%d: uploading altera firmware [%s] ...\n",
2968 btv->c.nr, firm_altera);
2969 result = pvr_altera_load(btv, micro, microlen);
2970 printk(KERN_INFO "bttv%d: ... upload %s\n",
2971 btv->c.nr, (result < 0) ? "failed" : "ok");
2976 /* new 2.5.x way -- via hotplug firmware loader */
2978 int __devinit pvr_boot(struct bttv *btv)
2980 const struct firmware *fw_entry;
2983 rc = request_firmware(&fw_entry, "hcwamc.rbf", &btv->c.pci->dev);
2985 printk(KERN_WARNING "bttv%d: no altera firmware [via hotplug]\n",
2989 rc = pvr_altera_load(btv, fw_entry->data, fw_entry->size);
2990 printk(KERN_INFO "bttv%d: altera firmware upload %s\n",
2991 btv->c.nr, (rc < 0) ? "failed" : "ok");
2992 release_firmware(fw_entry);
2997 /* ----------------------------------------------------------------------- */
2998 /* some osprey specific stuff */
3000 static void __devinit osprey_eeprom(struct bttv *btv)
3003 unsigned char *ee = eeprom_data;
3004 unsigned long serial = 0;
3006 if (btv->c.type == 0) {
3007 /* this might be an antique... check for MMAC label in eeprom */
3008 if ((ee[0]=='M') && (ee[1]=='M') && (ee[2]=='A') && (ee[3]=='C')) {
3009 unsigned char checksum = 0;
3010 for (i =0; i<21; i++)
3012 if (checksum != ee[21])
3014 btv->c.type = BTTV_OSPREY1x0_848;
3015 for (i = 12; i < 21; i++)
3016 serial *= 10, serial += ee[i] - '0';
3019 unsigned short type;
3022 for(; offset < 8*16; offset += 16) {
3023 unsigned short checksum = 0;
3024 /* verify the checksum */
3025 for(i = 0; i<14; i++) checksum += ee[i+offset];
3026 checksum = ~checksum; /* no idea why */
3027 if ((((checksum>>8)&0x0FF) == ee[offset+14]) &&
3028 ((checksum & 0x0FF) == ee[offset+15])) {
3036 /* found a valid descriptor */
3037 type = (ee[offset+4]<<8) | (ee[offset+5]);
3043 btv->c.type = BTTV_OSPREY1x0_848;
3046 btv->c.type = BTTV_OSPREY101_848;
3052 btv->c.type = BTTV_OSPREY1x0;
3056 btv->c.type = BTTV_OSPREY1x1;
3061 btv->c.type = BTTV_OSPREY1x1_SVID;
3067 btv->c.type = BTTV_OSPREY2xx;
3071 btv->c.type = BTTV_OSPREY2x0_SVID;
3074 btv->c.type = BTTV_OSPREY500;
3078 btv->c.type = BTTV_OSPREY540;
3079 /* bttv_osprey_540_init(btv); */
3083 btv->c.type = BTTV_OSPREY2x0;
3084 //enable output on select control lines
3085 gpio_inout(0xffffff,0x000303);
3088 /* unknown...leave generic, but get serial # */
3091 serial = (ee[offset+6] << 24)
3092 | (ee[offset+7] << 16)
3093 | (ee[offset+8] << 8)
3097 printk(KERN_INFO "bttv%d: osprey eeprom: card=%d name=%s serial=%ld\n",
3098 btv->c.nr, btv->c.type, bttv_tvcards[btv->c.type].name,serial);
3101 /* ----------------------------------------------------------------------- */
3102 /* AVermedia specific stuff, from bktr_card.c */
3104 int tuner_0_table[] = {
3105 TUNER_PHILIPS_NTSC, TUNER_PHILIPS_PAL /* PAL-BG*/,
3106 TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL /* PAL-I*/,
3107 TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL,
3108 TUNER_PHILIPS_SECAM, TUNER_PHILIPS_SECAM,
3109 TUNER_PHILIPS_SECAM, TUNER_PHILIPS_PAL};
3111 int tuner_0_fm_table[] = {
3112 PHILIPS_FR1236_NTSC, PHILIPS_FR1216_PAL,
3113 PHILIPS_FR1216_PAL, PHILIPS_FR1216_PAL,
3114 PHILIPS_FR1216_PAL, PHILIPS_FR1216_PAL,
3115 PHILIPS_FR1236_SECAM, PHILIPS_FR1236_SECAM,
3116 PHILIPS_FR1236_SECAM, PHILIPS_FR1216_PAL};
3119 int tuner_1_table[] = {
3120 TUNER_TEMIC_NTSC, TUNER_TEMIC_PAL,
3121 TUNER_TEMIC_PAL, TUNER_TEMIC_PAL,
3122 TUNER_TEMIC_PAL, TUNER_TEMIC_PAL,
3123 TUNER_TEMIC_4012FY5, TUNER_TEMIC_4012FY5, //TUNER_TEMIC_SECAM
3124 TUNER_TEMIC_4012FY5, TUNER_TEMIC_PAL};
3126 static void __devinit avermedia_eeprom(struct bttv *btv)
3128 int tuner_make,tuner_tv_fm,tuner_format,tuner=0;
3130 tuner_make = (eeprom_data[0x41] & 0x7);
3131 tuner_tv_fm = (eeprom_data[0x41] & 0x18) >> 3;
3132 tuner_format = (eeprom_data[0x42] & 0xf0) >> 4;
3133 btv->has_remote = (eeprom_data[0x42] & 0x01);
3135 if (tuner_make == 0 || tuner_make == 2)
3136 if(tuner_format <=9)
3137 tuner = tuner_0_table[tuner_format];
3138 if (tuner_make == 1)
3139 if(tuner_format <=9)
3140 tuner = tuner_1_table[tuner_format];
3142 printk(KERN_INFO "bttv%d: Avermedia eeprom[0x%02x%02x]: tuner=",
3143 btv->c.nr,eeprom_data[0x41],eeprom_data[0x42]);
3145 btv->tuner_type=tuner;
3148 printk("Unknown type");
3149 printk(" radio:%s remote control:%s\n",
3150 tuner_tv_fm ? "yes" : "no",
3151 btv->has_remote ? "yes" : "no");
3154 /* used on Voodoo TV/FM (Voodoo 200), S0 wired to 0x10000 */
3155 void bttv_tda9880_setnorm(struct bttv *btv, int norm)
3157 // fix up our card entry
3158 if(norm==VIDEO_MODE_NTSC) {
3159 bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[0]=0x957fff;
3160 bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[4]=0x957fff;
3161 dprintk("bttv_tda9880_setnorm to NTSC\n");
3164 bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[0]=0x947fff;
3165 bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[4]=0x947fff;
3166 dprintk("bttv_tda9880_setnorm to PAL\n");
3168 // set GPIO according
3169 gpio_bits(bttv_tvcards[btv->c.type].gpiomask,
3170 bttv_tvcards[btv->c.type].audiomux[btv->audio]);
3175 * reset/enable the MSP on some Hauppauge cards
3176 * Thanks to Kyösti Mälkki (kmalkki@cc.hut.fi)!
3181 static void __devinit boot_msp34xx(struct bttv *btv, int pin)
3183 int mask = (1 << pin);
3185 gpio_inout(mask,mask);
3188 gpio_bits(mask,mask);
3191 bttv_gpio_tracking(btv,"msp34xx");
3193 printk(KERN_INFO "bttv%d: Hauppauge/Voodoo msp34xx: reset line "
3194 "init [%d]\n", btv->c.nr, pin);
3197 static void __devinit boot_bt832(struct bttv *btv)
3201 switch (btv->c.type) {
3202 case BTTV_PXELVWPLTVPAK:
3203 resetbit = 0x400000;
3205 case BTTV_MODTEC_205:
3212 request_module("bt832");
3213 bttv_call_i2c_clients(btv, BT832_HEXDUMP, NULL);
3215 printk("bttv%d: Reset Bt832 [line=0x%x]\n",btv->c.nr,resetbit);
3217 gpio_inout(resetbit, resetbit);
3219 gpio_bits(resetbit, resetbit);
3221 gpio_bits(resetbit, 0);
3224 // bt832 on pixelview changes from i2c 0x8a to 0x88 after
3225 // being reset as above. So we must follow by this:
3226 bttv_call_i2c_clients(btv, BT832_REATTACH, NULL);
3229 /* ----------------------------------------------------------------------- */
3230 /* Imagenation L-Model PXC200 Framegrabber */
3231 /* This is basically the same procedure as
3232 * used by Alessandro Rubini in his pxc200
3233 * driver, but using BTTV functions */
3235 static void __devinit init_PXC200(struct bttv *btv)
3237 static int vals[] __devinitdata = { 0x08, 0x09, 0x0a, 0x0b, 0x0d, 0x0d,
3238 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
3244 /* Initialise GPIO-connevted stuff */
3245 gpio_inout(0xffffff, (1<<13));
3249 /* GPIO inputs are pulled up, so no need to drive
3250 * reset pin any longer */
3251 gpio_bits(0xffffff, 0);
3253 bttv_gpio_tracking(btv,"pxc200");
3255 /* we could/should try and reset/control the AD pots? but
3256 right now we simply turned off the crushing. Without
3257 this the AGC drifts drifts
3258 remember the EN is reverse logic -->
3259 setting BT848_ADC_AGC_EN disable the AGC
3260 tboult@eecs.lehigh.edu
3263 btwrite(BT848_ADC_RESERVED|BT848_ADC_AGC_EN, BT848_ADC);
3265 /* Initialise MAX517 DAC */
3266 printk(KERN_INFO "Setting DAC reference voltage level ...\n");
3267 bttv_I2CWrite(btv,0x5E,0,0x80,1);
3269 /* Initialise 12C508 PIC */
3270 /* The I2CWrite and I2CRead commmands are actually to the
3271 * same chips - but the R/W bit is included in the address
3272 * argument so the numbers are different */
3275 printk(KERN_INFO "Initialising 12C508 PIC chip ...\n");
3277 /* First of all, enable the clock line. This is used in the PXC200-F */
3278 val = btread(BT848_GPIO_DMA_CTL);
3279 val |= BT848_GPIO_DMA_CTL_GPCLKMODE;
3280 btwrite(val, BT848_GPIO_DMA_CTL);
3282 /* Then, push to 0 the reset pin long enough to reset the *
3283 * device same as above for the reset line, but not the same
3284 * value sent to the GPIO-connected stuff
3285 * which one is the good one? */
3286 gpio_inout(0xffffff,(1<<2));
3291 for (i = 0; i < ARRAY_SIZE(vals); i++) {
3292 tmp=bttv_I2CWrite(btv,0x1E,0,vals[i],1);
3295 "I2C Write(%2.2x) = %i\nI2C Read () = %2.2x\n\n",
3296 vals[i],tmp,bttv_I2CRead(btv,0x1F,NULL));
3300 printk(KERN_INFO "PXC200 Initialised.\n");
3304 /* ----------------------------------------------------------------------- */
3305 /* Miro Pro radio stuff -- the tea5757 is connected to some GPIO ports */
3307 * Copyright (c) 1999 Csaba Halasz <qgehali@uni-miskolc.hu>
3308 * This code is placed under the terms of the GNU General Public License
3310 * Brutally hacked by Dan Sheridan <dan.sheridan@contact.org.uk> djs52 8/3/00
3313 void bus_low(struct bttv *btv, int bit)
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);
3324 if (btv->mbox_ior) {
3325 gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
3330 void bus_high(struct bttv *btv, int bit)
3332 if (btv->mbox_ior) {
3333 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3334 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3341 if (btv->mbox_ior) {
3342 gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
3347 int bus_in(struct bttv *btv, int bit)
3349 if (btv->mbox_ior) {
3350 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3351 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3354 gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
3357 return gpio_read() & (bit);
3360 /* TEA5757 register bits */
3361 #define TEA_FREQ 0:14
3362 #define TEA_BUFFER 15:15
3364 #define TEA_SIGNAL_STRENGTH 16:17
3366 #define TEA_PORT1 18:18
3367 #define TEA_PORT0 19:19
3369 #define TEA_BAND 20:21
3370 #define TEA_BAND_FM 0
3371 #define TEA_BAND_MW 1
3372 #define TEA_BAND_LW 2
3373 #define TEA_BAND_SW 3
3375 #define TEA_MONO 22:22
3376 #define TEA_ALLOW_STEREO 0
3377 #define TEA_FORCE_MONO 1
3379 #define TEA_SEARCH_DIRECTION 23:23
3380 #define TEA_SEARCH_DOWN 0
3381 #define TEA_SEARCH_UP 1
3383 #define TEA_STATUS 24:24
3384 #define TEA_STATUS_TUNED 0
3385 #define TEA_STATUS_SEARCHING 1
3387 /* Low-level stuff */
3388 static int tea5757_read(struct bttv *btv)
3390 unsigned long timeout;
3394 /* better safe than sorry */
3395 gpio_inout(btv->mbox_mask, btv->mbox_clk | btv->mbox_we);
3397 if (btv->mbox_ior) {
3398 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3399 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3404 bttv_gpio_tracking(btv,"tea5757 read");
3406 bus_low(btv,btv->mbox_we);
3407 bus_low(btv,btv->mbox_clk);
3410 timeout= jiffies + HZ;
3412 // wait for DATA line to go low; error if it doesn't
3413 while (bus_in(btv,btv->mbox_data) && time_before(jiffies, timeout))
3415 if (bus_in(btv,btv->mbox_data)) {
3416 printk(KERN_WARNING "bttv%d: tea5757: read timeout\n",btv->c.nr);
3420 dprintk("bttv%d: tea5757:",btv->c.nr);
3421 for(i = 0; i < 24; i++)
3424 bus_high(btv,btv->mbox_clk);
3426 dprintk("%c",(bus_in(btv,btv->mbox_most) == 0)?'T':'-');
3427 bus_low(btv,btv->mbox_clk);
3429 value |= (bus_in(btv,btv->mbox_data) == 0)?0:1; /* MSB first */
3430 dprintk("%c", (bus_in(btv,btv->mbox_most) == 0)?'S':'M');
3432 dprintk("\nbttv%d: tea5757: read 0x%X\n", btv->c.nr, value);
3436 static int tea5757_write(struct bttv *btv, int value)
3441 gpio_inout(btv->mbox_mask, btv->mbox_clk | btv->mbox_we | btv->mbox_data);
3443 if (btv->mbox_ior) {
3444 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3445 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3449 bttv_gpio_tracking(btv,"tea5757 write");
3451 dprintk("bttv%d: tea5757: write 0x%X\n", btv->c.nr, value);
3452 bus_low(btv,btv->mbox_clk);
3453 bus_high(btv,btv->mbox_we);
3454 for(i = 0; i < 25; i++)
3456 if (reg & 0x1000000)
3457 bus_high(btv,btv->mbox_data);
3459 bus_low(btv,btv->mbox_data);
3461 bus_high(btv,btv->mbox_clk);
3463 bus_low(btv,btv->mbox_clk);
3466 bus_low(btv,btv->mbox_we); /* unmute !!! */
3470 void tea5757_set_freq(struct bttv *btv, unsigned short freq)
3472 dprintk("tea5757_set_freq %d\n",freq);
3473 tea5757_write(btv, 5 * freq + 0x358); /* add 10.7MHz (see docs) */
3475 /* breaks Miro PCTV */
3476 value = tea5757_read(btv);
3477 dprintk("bttv%d: tea5757 readback=0x%x\n",btv->c.nr,value);
3482 /* ----------------------------------------------------------------------- */
3485 void winview_audio(struct bttv *btv, struct video_audio *v, int set)
3487 /* PT2254A programming Jon Tombs, jon@gte.esi.us.es */
3488 int bits_out, loops, vol, data;
3491 /* Fixed by Leandro Lucarella <luca@linuxmendoza.org.ar (07/31/01) */
3492 v->flags |= VIDEO_AUDIO_VOLUME;
3496 /* 32 levels logarithmic */
3497 vol = 32 - ((v->volume>>11));
3499 bits_out = (PT2254_DBS_IN_2>>(vol%5));
3501 bits_out |= (PT2254_DBS_IN_10>>(vol/5));
3502 bits_out |= PT2254_L_CHANNEL | PT2254_R_CHANNEL;
3504 data &= ~(WINVIEW_PT2254_CLK| WINVIEW_PT2254_DATA|
3505 WINVIEW_PT2254_STROBE);
3506 for (loops = 17; loops >= 0 ; loops--) {
3507 if (bits_out & (1<<loops))
3508 data |= WINVIEW_PT2254_DATA;
3510 data &= ~WINVIEW_PT2254_DATA;
3513 data |= WINVIEW_PT2254_CLK;
3516 data &= ~WINVIEW_PT2254_CLK;
3519 data |= WINVIEW_PT2254_STROBE;
3520 data &= ~WINVIEW_PT2254_DATA;
3523 data &= ~WINVIEW_PT2254_STROBE;
3527 /* ----------------------------------------------------------------------- */
3528 /* mono/stereo control for various cards (which don't use i2c chips but */
3529 /* connect something to the GPIO pins */
3532 gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set)
3534 unsigned int con = 0;
3537 gpio_inout(0x300, 0x300);
3538 if (v->mode & VIDEO_SOUND_LANG1)
3540 if (v->mode & VIDEO_SOUND_LANG2)
3542 if (v->mode & VIDEO_SOUND_STEREO)
3544 // if (v->mode & VIDEO_SOUND_MONO)
3546 gpio_bits(0x300, con);
3548 v->mode = VIDEO_SOUND_STEREO |
3549 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3554 gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set)
3556 unsigned int val, con;
3558 #if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0)
3559 if (btv->radio_user)
3569 if (v->mode & VIDEO_SOUND_LANG2) {
3570 if (v->mode & VIDEO_SOUND_LANG1) {
3579 if (con != (val & 0x300)) {
3580 gpio_bits(0x300, con);
3582 bttv_gpio_tracking(btv,"gvbctv5pci");
3585 switch (val & 0x70) {
3587 v->mode = VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3590 v->mode = VIDEO_SOUND_LANG2;
3593 v->mode = VIDEO_SOUND_LANG1;
3596 v->mode = VIDEO_SOUND_STEREO;
3599 v->mode = VIDEO_SOUND_MONO;
3602 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3603 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3609 * Mario Medina Nussbaum <medisoft@alohabbs.org.mx>
3610 * I discover that on BT848_GPIO_DATA address a byte 0xcce enable stereo,
3611 * 0xdde enables mono and 0xccd enables sap
3613 * Petr Vandrovec <VANDROVE@vc.cvut.cz>
3614 * P.S.: At least mask in line above is wrong - GPIO pins 3,2 select
3615 * input/output sound connection, so both must be set for output mode.
3617 * Looks like it's needed only for the "tvphone", the "tvphone 98"
3618 * handles this with a tda9840
3622 avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, int set)
3627 if (v->mode & VIDEO_SOUND_LANG2) /* SAP */
3629 if (v->mode & VIDEO_SOUND_STEREO)
3632 gpio_bits(0x03,val);
3634 bttv_gpio_tracking(btv,"avermedia");
3637 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3644 avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v, int set)
3649 if (v->mode & VIDEO_SOUND_LANG2) /* SAP */
3651 if (v->mode & VIDEO_SOUND_STEREO) /* STEREO */
3653 btaor(val, ~0x03, BT848_GPIO_DATA);
3655 bttv_gpio_tracking(btv,"avermedia");
3657 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3658 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3663 /* Lifetec 9415 handling */
3665 lt9415_audio(struct bttv *btv, struct video_audio *v, int set)
3669 if (gpio_read() & 0x4000) {
3670 v->mode = VIDEO_SOUND_MONO;
3675 if (v->mode & VIDEO_SOUND_LANG2) /* A2 SAP */
3677 if (v->mode & VIDEO_SOUND_STEREO) /* A2 stereo */
3679 if ((v->mode & VIDEO_SOUND_LANG1) ||
3680 (v->mode & VIDEO_SOUND_MONO))
3682 gpio_bits(0x0880, val);
3684 bttv_gpio_tracking(btv,"lt9415");
3686 /* autodetect doesn't work with this card :-( */
3687 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3688 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3693 // TDA9821 on TerraTV+ Bt848, Bt878
3695 terratv_audio(struct bttv *btv, struct video_audio *v, int set)
3697 unsigned int con = 0;
3700 gpio_inout(0x180000,0x180000);
3701 if (v->mode & VIDEO_SOUND_LANG2)
3703 if (v->mode & VIDEO_SOUND_STEREO)
3705 gpio_bits(0x180000, con);
3707 bttv_gpio_tracking(btv,"terratv");
3709 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3710 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3715 winfast2000_audio(struct bttv *btv, struct video_audio *v, int set)
3717 unsigned long val = 0;
3720 /*btor (0xc32000, BT848_GPIO_OUT_EN);*/
3721 if (v->mode & VIDEO_SOUND_MONO) /* Mono */
3723 if (v->mode & VIDEO_SOUND_LANG1) /* Mono */
3725 if (v->mode & VIDEO_SOUND_LANG2) /* SAP */
3727 if (v->mode & VIDEO_SOUND_STEREO) /* Stereo */
3730 gpio_bits(0x430000, val);
3732 bttv_gpio_tracking(btv,"winfast2000");
3735 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3736 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3741 * Dariusz Kowalewski <darekk@automex.pl>
3742 * sound control for Prolink PV-BT878P+9B (PixelView PlayTV Pro FM+NICAM
3743 * revision 9B has on-board TDA9874A sound decoder).
3745 * Note: There are card variants without tda9874a. Forcing the "stereo sound route"
3746 * will mute this cards.
3749 pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set)
3751 unsigned int val = 0;
3753 #if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0)
3754 if (btv->radio_user)
3762 if (v->mode & VIDEO_SOUND_MONO) {
3765 if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2))
3766 || (v->mode & VIDEO_SOUND_STEREO)) {
3770 gpio_bits(0x03,val);
3772 bttv_gpio_tracking(btv,"pvbt878p9b");
3775 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3776 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3781 * Dariusz Kowalewski <darekk@automex.pl>
3782 * sound control for FlyVideo 2000S (with tda9874 decoder)
3783 * based on pvbt878p9b_audio() - this is not tested, please fix!!!
3786 fv2000s_audio(struct bttv *btv, struct video_audio *v, int set)
3788 unsigned int val = 0xffff;
3790 #if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0)
3791 if (btv->radio_user)
3798 if (v->mode & VIDEO_SOUND_MONO) {
3801 if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2))
3802 || (v->mode & VIDEO_SOUND_STEREO)) {
3803 val = 0x1080; //-dk-???: 0x0880, 0x0080, 0x1800 ...
3805 if (val != 0xffff) {
3806 gpio_bits(0x1800, val);
3808 bttv_gpio_tracking(btv,"fv2000s");
3811 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3812 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3817 * sound control for Canopus WinDVR PCI
3818 * Masaki Suzuki <masaki@btree.org>
3821 windvr_audio(struct bttv *btv, struct video_audio *v, int set)
3823 unsigned long val = 0;
3826 if (v->mode & VIDEO_SOUND_MONO)
3828 if (v->mode & VIDEO_SOUND_LANG1)
3830 if (v->mode & VIDEO_SOUND_LANG2)
3832 if (v->mode & VIDEO_SOUND_STEREO)
3835 gpio_bits(0x140000, val);
3837 bttv_gpio_tracking(btv,"windvr");
3840 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3841 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3846 * sound control for AD-TVK503
3847 * Hiroshi Takekawa <sian@big.or.jp>
3850 adtvk503_audio(struct bttv *btv, struct video_audio *v, int set)
3852 unsigned int con = 0xffffff;
3854 //btaor(0x1e0000, ~0x1e0000, BT848_GPIO_OUT_EN);
3857 //btor(***, BT848_GPIO_OUT_EN);
3858 if (v->mode & VIDEO_SOUND_LANG1)
3860 if (v->mode & VIDEO_SOUND_LANG2)
3862 if (v->mode & VIDEO_SOUND_STEREO)
3864 if (v->mode & VIDEO_SOUND_MONO)
3866 if (con != 0xffffff) {
3867 gpio_bits(0x1e0000,con);
3869 bttv_gpio_tracking(btv, "adtvk503");
3872 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3873 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3877 /* RemoteVision MX (rv605) muxsel helper [Miguel Freitas]
3879 * This is needed because rv605 don't use a normal multiplex, but a crosspoint
3880 * switch instead (CD22M3494E). This IC can have multiple active connections
3881 * between Xn (input) and Yn (output) pins. We need to clear any existing
3882 * connection prior to establish a new one, pulsing the STROBE pin.
3884 * The board hardwire Y0 (xpoint) to MUX1 and MUXOUT to Yin.
3885 * GPIO pins are wired as:
3886 * GPIO[0:3] - AX[0:3] (xpoint) - P1[0:3] (microcontroler)
3887 * GPIO[4:6] - AY[0:2] (xpoint) - P1[4:6] (microcontroler)
3888 * GPIO[7] - DATA (xpoint) - P1[7] (microcontroler)
3889 * GPIO[8] - - P3[5] (microcontroler)
3890 * GPIO[9] - RESET (xpoint) - P3[6] (microcontroler)
3891 * GPIO[10] - STROBE (xpoint) - P3[7] (microcontroler)
3892 * GPINTR - - P3[4] (microcontroler)
3894 * The microcontroler is a 80C32 like. It should be possible to change xpoint
3895 * configuration either directly (as we are doing) or using the microcontroler
3896 * which is also wired to I2C interface. I have no further info on the
3897 * microcontroler features, one would need to disassembly the firmware.
3898 * note: the vendor refused to give any information on this product, all
3899 * that stuff was found using a multimeter! :)
3901 static void rv605_muxsel(struct bttv *btv, unsigned int input)
3903 /* reset all conections */
3904 gpio_bits(0x200,0x200);
3906 gpio_bits(0x200,0x000);
3909 /* create a new conection */
3910 gpio_bits(0x480,0x080);
3911 gpio_bits(0x480,0x480);
3913 gpio_bits(0x480,0x080);
3917 // The Grandtec X-Guard framegrabber card uses two Dual 4-channel
3918 // video multiplexers to provide up to 16 video inputs. These
3919 // multiplexers are controlled by the lower 8 GPIO pins of the
3920 // bt878. The multiplexers probably Pericom PI5V331Q or similar.
3922 // xxx0 is pin xxx of multiplexer U5,
3923 // yyy1 is pin yyy of multiplexer U2
3935 static void xguard_muxsel(struct bttv *btv, unsigned int input)
3937 static const int masks[] = {
3938 ENB0, ENB0|IN00, ENB0|IN10, ENB0|IN00|IN10,
3939 ENA0, ENA0|IN00, ENA0|IN10, ENA0|IN00|IN10,
3940 ENB1, ENB1|IN01, ENB1|IN11, ENB1|IN01|IN11,
3941 ENA1, ENA1|IN01, ENA1|IN11, ENA1|IN01|IN11,
3943 gpio_write(masks[input%16]);
3945 static void picolo_tetra_init(struct bttv *btv)
3947 /*This is the video input redirection fonctionality : I DID NOT USED IT. */
3948 btwrite (0x08<<16,BT848_GPIO_DATA);/*GPIO[19] [==> 4053 B+C] set to 1 */
3949 btwrite (0x04<<16,BT848_GPIO_DATA);/*GPIO[18] [==> 4053 A] set to 1*/
3951 static void picolo_tetra_muxsel (struct bttv* btv, unsigned int input)
3954 dprintk (KERN_DEBUG "bttv%d : picolo_tetra_muxsel => input = %d\n",btv->c.nr,input);
3955 /*Just set the right path in the analog multiplexers : channel 1 -> 4 ==> Analog Mux ==> MUX0*/
3956 /*GPIO[20]&GPIO[21] used to choose the right input*/
3957 btwrite (input<<20,BT848_GPIO_DATA);
3962 * ivc120_muxsel [Added by Alan Garfield <alan@fromorbit.com>]
3964 * The IVC120G security card has 4 i2c controlled TDA8540 matrix
3965 * swichers to provide 16 channels to MUX0. The TDA8540's have
3966 * 4 indepedant outputs and as such the IVC120G also has the
3967 * optional "Monitor Out" bus. This allows the card to be looking
3968 * at one input while the monitor is looking at another.
3970 * Since I've couldn't be bothered figuring out how to add an
3971 * independant muxsel for the monitor bus, I've just set it to
3972 * whatever the card is looking at.
3974 * OUT0 of the TDA8540's is connected to MUX0 (0x03)
3975 * OUT1 of the TDA8540's is connected to "Monitor Out" (0x0C)
3977 * TDA8540_ALT3 IN0-3 = Channel 13 - 16 (0x03)
3978 * TDA8540_ALT4 IN0-3 = Channel 1 - 4 (0x03)
3979 * TDA8540_ALT5 IN0-3 = Channel 5 - 8 (0x03)
3980 * TDA8540_ALT6 IN0-3 = Channel 9 - 12 (0x03)
3984 /* All 7 possible sub-ids for the TDA8540 Matrix Switcher */
3985 #define I2C_TDA8540 0x90
3986 #define I2C_TDA8540_ALT1 0x92
3987 #define I2C_TDA8540_ALT2 0x94
3988 #define I2C_TDA8540_ALT3 0x96
3989 #define I2C_TDA8540_ALT4 0x98
3990 #define I2C_TDA8540_ALT5 0x9a
3991 #define I2C_TDA8540_ALT6 0x9c
3993 static void ivc120_muxsel(struct bttv *btv, unsigned int input)
3996 int key = input % 4;
3997 int matrix = input / 4;
3999 dprintk("bttv%d: ivc120_muxsel: Input - %02d | TDA - %02d | In - %02d\n",
4000 btv->c.nr, input, matrix, key);
4002 // Handles the input selection on the TDA8540's
4003 bttv_I2CWrite(btv, I2C_TDA8540_ALT3, 0x00,
4004 ((matrix == 3) ? (key | key << 2) : 0x00), 1);
4005 bttv_I2CWrite(btv, I2C_TDA8540_ALT4, 0x00,
4006 ((matrix == 0) ? (key | key << 2) : 0x00), 1);
4007 bttv_I2CWrite(btv, I2C_TDA8540_ALT5, 0x00,
4008 ((matrix == 1) ? (key | key << 2) : 0x00), 1);
4009 bttv_I2CWrite(btv, I2C_TDA8540_ALT6, 0x00,
4010 ((matrix == 2) ? (key | key << 2) : 0x00), 1);
4012 // Handles the output enables on the TDA8540's
4013 bttv_I2CWrite(btv, I2C_TDA8540_ALT3, 0x02,
4014 ((matrix == 3) ? 0x03 : 0x00), 1); // 13 - 16
4015 bttv_I2CWrite(btv, I2C_TDA8540_ALT4, 0x02,
4016 ((matrix == 0) ? 0x03 : 0x00), 1); // 1-4
4017 bttv_I2CWrite(btv, I2C_TDA8540_ALT5, 0x02,
4018 ((matrix == 1) ? 0x03 : 0x00), 1); // 5-8
4019 bttv_I2CWrite(btv, I2C_TDA8540_ALT6, 0x02,
4020 ((matrix == 2) ? 0x03 : 0x00), 1); // 9-12
4022 // Selects MUX0 for input on the 878
4023 btaor((0)<<5, ~(3<<5), BT848_IFORM);
4027 /* ----------------------------------------------------------------------- */
4028 /* motherboard chipset specific stuff */
4030 void __devinit bttv_check_chipset(void)
4032 int pcipci_fail = 0;
4033 struct pci_dev *dev = NULL;
4035 if (pci_pci_problems & PCIPCI_FAIL)
4037 if (pci_pci_problems & (PCIPCI_TRITON|PCIPCI_NATOMA|PCIPCI_VIAETBF))
4039 if (pci_pci_problems & PCIPCI_VSFX)
4041 #ifdef PCIPCI_ALIMAGIK
4042 if (pci_pci_problems & PCIPCI_ALIMAGIK)
4047 /* print which chipset we have */
4048 while ((dev = pci_find_class(PCI_CLASS_BRIDGE_HOST << 8,dev)))
4049 printk(KERN_INFO "bttv: Host bridge is %s\n",pci_name(dev));
4052 /* print warnings about any quirks found */
4054 printk(KERN_INFO "bttv: Host bridge needs ETBF enabled.\n");
4056 printk(KERN_INFO "bttv: Host bridge needs VSFX enabled.\n");
4058 printk(KERN_WARNING "bttv: BT848 and your chipset may not work together.\n");
4059 if (UNSET == no_overlay) {
4060 printk(KERN_WARNING "bttv: going to disable overlay.\n");
4064 if (UNSET != latency)
4065 printk(KERN_INFO "bttv: pci latency fixup [%d]\n",latency);
4067 while ((dev = pci_find_device(PCI_VENDOR_ID_INTEL,
4068 PCI_DEVICE_ID_INTEL_82441, dev))) {
4070 pci_read_config_byte(dev, 0x53, &b);
4072 printk(KERN_INFO "bttv: Host bridge: 82441FX Natoma, "
4073 "bufcon=0x%02x\n",b);
4077 int __devinit bttv_handle_chipset(struct bttv *btv)
4079 unsigned char command;
4081 if (!triton1 && !vsfx && UNSET == latency)
4086 printk(KERN_INFO "bttv%d: enabling ETBF (430FX/VP3 compatibilty)\n",btv->c.nr);
4087 if (vsfx && btv->id >= 878)
4088 printk(KERN_INFO "bttv%d: enabling VSFX\n",btv->c.nr);
4089 if (UNSET != latency)
4090 printk(KERN_INFO "bttv%d: setting pci timer to %d\n",
4094 if (btv->id < 878) {
4095 /* bt848 (mis)uses a bit in the irq mask for etbf */
4097 btv->triton1 = BT848_INT_ETBF;
4099 /* bt878 has a bit in the pci config space for it */
4100 pci_read_config_byte(btv->c.pci, BT878_DEVCTRL, &command);
4102 command |= BT878_EN_TBFX;
4104 command |= BT878_EN_VSFX;
4105 pci_write_config_byte(btv->c.pci, BT878_DEVCTRL, command);
4107 if (UNSET != latency)
4108 pci_write_config_byte(btv->c.pci, PCI_LATENCY_TIMER, latency);
4113 /* PXC200 muxsel helper
4114 * luke@syseng.anu.edu.au
4115 * another transplant
4116 * from Alessandro Rubini (rubini@linux.it)
4118 * There are 4 kinds of cards:
4119 * PXC200L which is bt848
4120 * PXC200F which is bt848 with PIC controlling mux
4121 * PXC200AL which is bt878
4122 * PXC200AF which is bt878 with PIC controlling mux
4124 #define PX_CFG_PXC200F 0x01
4125 #define PX_FLAG_PXC200A 0x00001000 /* a pxc200A is bt-878 based */
4126 #define PX_I2C_PIC 0x0f
4127 #define PX_PXC200A_CARDID 0x200a1295
4128 #define PX_I2C_CMD_CFG 0x00
4130 static void PXC200_muxsel(struct bttv *btv, unsigned int input)
4135 unsigned char buf[2];
4137 /* Read PIC config to determine if this is a PXC200F */
4141 rc=bttv_I2CWrite(btv,(PX_I2C_PIC<<1),buf[0],buf[1],1);
4143 printk(KERN_DEBUG "bttv%d: PXC200_muxsel: pic cfg write failed:%d\n", btv->c.nr,rc);
4144 /* not PXC ? do nothing */
4148 rc=bttv_I2CRead(btv,(PX_I2C_PIC<<1),0);
4149 if (!(rc & PX_CFG_PXC200F)) {
4150 printk(KERN_DEBUG "bttv%d: PXC200_muxsel: not PXC200F rc:%d \n", btv->c.nr,rc);
4155 /* The multiplexer in the 200F is handled by the GPIO port */
4156 /* get correct mapping between inputs */
4157 /* mux = bttv_tvcards[btv->type].muxsel[input] & 3; */
4158 /* ** not needed!? */
4161 /* make sure output pins are enabled */
4162 /* bitmask=0x30f; */
4164 /* check whether we have a PXC200A */
4165 if (btv->cardid == PX_PXC200A_CARDID) {
4166 bitmask ^= 0x180; /* use 7 and 9, not 8 and 9 */
4167 bitmask |= 7<<4; /* the DAC */
4169 btwrite(bitmask, BT848_GPIO_OUT_EN);
4171 bitmask = btread(BT848_GPIO_DATA);
4172 if (btv->cardid == PX_PXC200A_CARDID)
4173 bitmask = (bitmask & ~0x280) | ((mux & 2) << 8) | ((mux & 1) << 7);
4174 else /* older device */
4175 bitmask = (bitmask & ~0x300) | ((mux & 3) << 8);
4176 btwrite(bitmask,BT848_GPIO_DATA);
4179 * Was "to be safe, set the bt848 to input 0"
4180 * Actually, since it's ok at load time, better not messing
4181 * with these bits (on PXC200AF you need to set mux 2 here)
4183 * needed because bttv-driver sets mux before calling this function
4185 if (btv->cardid == PX_PXC200A_CARDID)
4186 btaor(2<<5, ~BT848_IFORM_MUXSEL, BT848_IFORM);
4187 else /* older device */
4188 btand(~BT848_IFORM_MUXSEL,BT848_IFORM);
4190 printk(KERN_DEBUG "bttv%d: setting input channel to:%d\n", btv->c.nr,(int)mux);