2 $Id: bttv-cards.c,v 1.32 2004/11/07 13:17:14 kraxel Exp $
6 this file has configuration informations - card-specific stuff
7 like the big tvcards array for the most part
9 Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de)
10 & Marcus Metzler (mocm@thp.uni-koeln.de)
11 (c) 1999-2001 Gerd Knorr <kraxel@goldbach.in-berlin.de>
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 #include <linux/config.h>
30 #include <linux/delay.h>
31 #include <linux/module.h>
32 #include <linux/kmod.h>
33 #include <linux/init.h>
34 #include <linux/pci.h>
35 #include <linux/vmalloc.h>
36 #if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)
37 # include <linux/firmware.h>
46 static void boot_msp34xx(struct bttv *btv, int pin);
47 static void boot_bt832(struct bttv *btv);
48 static void hauppauge_eeprom(struct bttv *btv);
49 static void avermedia_eeprom(struct bttv *btv);
50 static void osprey_eeprom(struct bttv *btv);
51 static void modtec_eeprom(struct bttv *btv);
52 static void init_PXC200(struct bttv *btv);
54 static void winview_audio(struct bttv *btv, struct video_audio *v, int set);
55 static void lt9415_audio(struct bttv *btv, struct video_audio *v, int set);
56 static void avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v,
58 static void avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v,
60 static void terratv_audio(struct bttv *btv, struct video_audio *v, int set);
61 static void gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set);
62 static void gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set);
63 static void winfast2000_audio(struct bttv *btv, struct video_audio *v, int set);
64 static void pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set);
65 static void fv2000s_audio(struct bttv *btv, struct video_audio *v, int set);
66 static void windvr_audio(struct bttv *btv, struct video_audio *v, int set);
67 static void adtvk503_audio(struct bttv *btv, struct video_audio *v, int set);
68 static void rv605_muxsel(struct bttv *btv, unsigned int input);
69 static void eagle_muxsel(struct bttv *btv, unsigned int input);
70 static void xguard_muxsel(struct bttv *btv, unsigned int input);
71 static void ivc120_muxsel(struct bttv *btv, unsigned int input);
72 static void gvc1100_muxsel(struct bttv *btv, unsigned int input);
74 static void PXC200_muxsel(struct bttv *btv, unsigned int input);
76 static void picolo_tetra_muxsel(struct bttv *btv, unsigned int input);
77 static void picolo_tetra_init(struct bttv *btv);
79 static void sigmaSLC_muxsel(struct bttv *btv, unsigned int input);
80 static void sigmaSQ_muxsel(struct bttv *btv, unsigned int input);
82 static int terratec_active_radio_upgrade(struct bttv *btv);
83 static int tea5757_read(struct bttv *btv);
84 static int tea5757_write(struct bttv *btv, int value);
85 static void identify_by_eeprom(struct bttv *btv,
86 unsigned char eeprom_data[256]);
88 /* config variables */
89 static unsigned int triton1=0;
90 static unsigned int vsfx=0;
91 static unsigned int latency = UNSET;
92 unsigned int no_overlay=-1;
94 static unsigned int card[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
95 static unsigned int pll[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
96 static unsigned int tuner[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
97 static unsigned int svhs[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
98 static unsigned int remote[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
100 static unsigned int autoload = 1;
102 static unsigned int autoload = 0;
104 static unsigned int gpiomask = UNSET;
105 static unsigned int audioall = UNSET;
106 static unsigned int audiomux[5] = { [ 0 ... 4 ] = UNSET };
109 module_param(triton1, int, 0444);
110 module_param(vsfx, int, 0444);
111 module_param(no_overlay, int, 0444);
112 module_param(latency, int, 0444);
113 module_param(gpiomask, int, 0444);
114 module_param(audioall, int, 0444);
115 module_param(autoload, int, 0444);
117 module_param_array(card, int, NULL, 0444);
118 module_param_array(pll, int, NULL, 0444);
119 module_param_array(tuner, int, NULL, 0444);
120 module_param_array(svhs, int, NULL, 0444);
121 module_param_array(remote, int, NULL, 0444);
122 module_param_array(audiomux, int, NULL, 0444);
124 MODULE_PARM_DESC(triton1,"set ETBF pci config bit "
125 "[enable bug compatibility for triton1 + others]");
126 MODULE_PARM_DESC(vsfx,"set VSFX pci config bit "
127 "[yet another chipset flaw workaround]");
128 MODULE_PARM_DESC(latency,"pci latency timer");
129 MODULE_PARM_DESC(card,"specify TV/grabber card model, see CARDLIST file for a list");
130 MODULE_PARM_DESC(pll,"specify installed crystal (0=none, 28=28 MHz, 35=35 MHz)");
131 MODULE_PARM_DESC(tuner,"specify installed tuner type");
132 MODULE_PARM_DESC(autoload,"automatically load i2c modules like tuner.o, default is 1 (yes)");
134 /* ----------------------------------------------------------------------- */
135 /* list of card IDs for bt878+ cards */
141 } cards[] __devinitdata = {
142 { 0x13eb0070, BTTV_HAUPPAUGE878, "Hauppauge WinTV" },
143 { 0x39000070, BTTV_HAUPPAUGE878, "Hauppauge WinTV-D" },
144 { 0x45000070, BTTV_HAUPPAUGEPVR, "Hauppauge WinTV/PVR" },
145 { 0xff000070, BTTV_OSPREY1x0, "Osprey-100" },
146 { 0xff010070, BTTV_OSPREY2x0_SVID,"Osprey-200" },
147 { 0xff020070, BTTV_OSPREY500, "Osprey-500" },
148 { 0xff030070, BTTV_OSPREY2000, "Osprey-2000" },
149 { 0xff040070, BTTV_OSPREY540, "Osprey-540" },
151 { 0x00011002, BTTV_ATI_TVWONDER, "ATI TV Wonder" },
152 { 0x00031002, BTTV_ATI_TVWONDERVE,"ATI TV Wonder/VE" },
154 { 0x6606107d, BTTV_WINFAST2000, "Leadtek WinFast TV 2000" },
155 { 0x6607107d, BTTV_WINFASTVC100, "Leadtek WinFast VC 100" },
156 { 0x6609107d, BTTV_WINFAST2000, "Leadtek TV 2000 XP" },
157 { 0x263610b4, BTTV_STB2, "STB TV PCI FM, Gateway P/N 6000704" },
158 { 0x264510b4, BTTV_STB2, "STB TV PCI FM, Gateway P/N 6000704" },
159 { 0x402010fc, BTTV_GVBCTV3PCI, "I-O Data Co. GV-BCTV3/PCI" },
160 { 0x405010fc, BTTV_GVBCTV4PCI, "I-O Data Co. GV-BCTV4/PCI" },
161 { 0x407010fc, BTTV_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" },
162 { 0xd01810fc, BTTV_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" },
164 { 0x001211bd, BTTV_PINNACLE, "Pinnacle PCTV" },
165 // some cards ship with byteswapped IDs ...
166 { 0x1200bd11, BTTV_PINNACLE, "Pinnacle PCTV [bswap]" },
167 { 0xff00bd11, BTTV_PINNACLE, "Pinnacle PCTV [bswap]" },
169 { 0x3000121a, BTTV_VOODOOTV_FM, "3Dfx VoodooTV FM/ VoodooTV 200" },
170 { 0x263710b4, BTTV_VOODOOTV_FM, "3Dfx VoodooTV FM/ VoodooTV 200" },
171 { 0x3060121a, BTTV_STB2, "3Dfx VoodooTV 100/ STB OEM" },
173 { 0x3000144f, BTTV_MAGICTVIEW063, "(Askey Magic/others) TView99 CPH06x" },
174 { 0xa005144f, BTTV_MAGICTVIEW063, "CPH06X TView99-Card" },
175 { 0x3002144f, BTTV_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH05x" },
176 { 0x3005144f, BTTV_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH061/06L (T1/LC)" },
177 { 0x5000144f, BTTV_MAGICTVIEW061, "Askey CPH050" },
178 { 0x300014ff, BTTV_MAGICTVIEW061, "TView 99 (CPH061)" },
179 { 0x300214ff, BTTV_PHOEBE_TVMAS, "Phoebe TV Master (CPH060)" },
181 { 0x00011461, BTTV_AVPHONE98, "AVerMedia TVPhone98" },
182 { 0x00021461, BTTV_AVERMEDIA98, "AVermedia TVCapture 98" },
183 { 0x00031461, BTTV_AVPHONE98, "AVerMedia TVPhone98" },
184 { 0x00041461, BTTV_AVERMEDIA98, "AVerMedia TVCapture 98" },
185 { 0x03001461, BTTV_AVERMEDIA98, "VDOMATE TV TUNER CARD" },
187 { 0x1117153b, BTTV_TERRATVALUE, "Terratec TValue (Philips PAL B/G)" },
188 { 0x1118153b, BTTV_TERRATVALUE, "Terratec TValue (Temic PAL B/G)" },
189 { 0x1119153b, BTTV_TERRATVALUE, "Terratec TValue (Philips PAL I)" },
190 { 0x111a153b, BTTV_TERRATVALUE, "Terratec TValue (Temic PAL I)" },
192 { 0x1123153b, BTTV_TERRATVRADIO, "Terratec TV Radio+" },
193 { 0x1127153b, BTTV_TERRATV, "Terratec TV+ (V1.05)" },
194 // clashes with FlyVideo
195 //{ 0x18521852, BTTV_TERRATV, "Terratec TV+ (V1.10)" },
196 { 0x1134153b, BTTV_TERRATVALUE, "Terratec TValue (LR102)" },
197 { 0x1135153b, BTTV_TERRATVALUER, "Terratec TValue Radio" }, // LR102
198 { 0x5018153b, BTTV_TERRATVALUE, "Terratec TValue" }, // ??
199 { 0xff3b153b, BTTV_TERRATVALUER, "Terratec TValue Radio" }, // ??
201 { 0x400015b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV" },
202 { 0x400a15b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV" },
203 { 0x400d15b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
204 { 0x401015b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
205 { 0x401615b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
207 { 0x1430aa00, BTTV_PV143, "Provideo PV143A" },
208 { 0x1431aa00, BTTV_PV143, "Provideo PV143B" },
209 { 0x1432aa00, BTTV_PV143, "Provideo PV143C" },
210 { 0x1433aa00, BTTV_PV143, "Provideo PV143D" },
211 { 0x1433aa03, BTTV_PV143, "Security Eyes" },
213 { 0x1460aa00, BTTV_PV150, "Provideo PV150A-1" },
214 { 0x1461aa01, BTTV_PV150, "Provideo PV150A-2" },
215 { 0x1462aa02, BTTV_PV150, "Provideo PV150A-3" },
216 { 0x1463aa03, BTTV_PV150, "Provideo PV150A-4" },
218 { 0x1464aa04, BTTV_PV150, "Provideo PV150B-1" },
219 { 0x1465aa05, BTTV_PV150, "Provideo PV150B-2" },
220 { 0x1466aa06, BTTV_PV150, "Provideo PV150B-3" },
221 { 0x1467aa07, BTTV_PV150, "Provideo PV150B-4" },
223 { 0xa132ff00, BTTV_IVC100, "IVC-100" },
224 { 0xa1550000, BTTV_IVC200, "IVC-200" },
225 { 0xa1550001, BTTV_IVC200, "IVC-200" },
226 { 0xa1550002, BTTV_IVC200, "IVC-200" },
227 { 0xa1550003, BTTV_IVC200, "IVC-200" },
228 { 0xa1550100, BTTV_IVC200, "IVC-200G" },
229 { 0xa1550101, BTTV_IVC200, "IVC-200G" },
230 { 0xa1550102, BTTV_IVC200, "IVC-200G" },
231 { 0xa1550103, BTTV_IVC200, "IVC-200G" },
232 { 0xa182ff00, BTTV_IVC120, "IVC-120G" },
233 { 0xa182ff01, BTTV_IVC120, "IVC-120G" },
234 { 0xa182ff02, BTTV_IVC120, "IVC-120G" },
235 { 0xa182ff03, BTTV_IVC120, "IVC-120G" },
236 { 0xa182ff04, BTTV_IVC120, "IVC-120G" },
237 { 0xa182ff05, BTTV_IVC120, "IVC-120G" },
238 { 0xa182ff06, BTTV_IVC120, "IVC-120G" },
239 { 0xa182ff07, BTTV_IVC120, "IVC-120G" },
240 { 0xa182ff08, BTTV_IVC120, "IVC-120G" },
241 { 0xa182ff09, BTTV_IVC120, "IVC-120G" },
242 { 0xa182ff0a, BTTV_IVC120, "IVC-120G" },
243 { 0xa182ff0b, BTTV_IVC120, "IVC-120G" },
244 { 0xa182ff0c, BTTV_IVC120, "IVC-120G" },
245 { 0xa182ff0d, BTTV_IVC120, "IVC-120G" },
246 { 0xa182ff0e, BTTV_IVC120, "IVC-120G" },
247 { 0xa182ff0f, BTTV_IVC120, "IVC-120G" },
249 { 0x41424344, BTTV_GRANDTEC, "GrandTec Multi Capture" },
250 { 0x01020304, BTTV_XGUARD, "Grandtec Grand X-Guard" },
252 { 0x18501851, BTTV_CHRONOS_VS2, "FlyVideo 98 (LR50)/ Chronos Video Shuttle II" },
253 { 0xa0501851, BTTV_CHRONOS_VS2, "FlyVideo 98 (LR50)/ Chronos Video Shuttle II" },
254 { 0x18511851, BTTV_FLYVIDEO98EZ, "FlyVideo 98EZ (LR51)/ CyberMail AV" },
255 { 0x18521852, BTTV_TYPHOON_TVIEW, "FlyVideo 98FM (LR50)/ Typhoon TView TV/FM Tuner" },
256 { 0x41a0a051, BTTV_FLYVIDEO_98FM, "Lifeview FlyVideo 98 LR50 Rev Q" },
257 { 0x18501f7f, BTTV_FLYVIDEO_98, "Lifeview Flyvideo 98" },
259 { 0x010115cb, BTTV_GMV1, "AG GMV1" },
260 { 0x010114c7, BTTV_MODTEC_205, "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV" },
262 { 0x10b42636, BTTV_HAUPPAUGE878, "STB ???" },
263 { 0x217d6606, BTTV_WINFAST2000, "Leadtek WinFast TV 2000" },
264 { 0xfff6f6ff, BTTV_WINFAST2000, "Leadtek WinFast TV 2000" },
265 { 0x03116000, BTTV_SENSORAY311, "Sensoray 311" },
266 { 0x00790e11, BTTV_WINDVR, "Canopus WinDVR PCI" },
267 { 0xa0fca1a0, BTTV_ZOLTRIX, "Face to Face Tvmax" },
268 { 0x20007063, BTTV_PC_HDTV, "pcHDTV HD-2000 TV"},
269 { 0x82b2aa6a, BTTV_SIMUS_GVC1100, "SIMUS GVC1100" },
270 { 0x146caa0c, BTTV_PV951, "ituner spectra8" },
271 { 0x200a1295, BTTV_PXC200, "ImageNation PXC200A" },
273 { 0x40111554, BTTV_PV_BT878P_9B, "Prolink Pixelview PV-BT" },
274 { 0x17de0a01, BTTV_KWORLD, "Mecer TV/FM/Video Tuner" },
276 { 0x01051805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #1" },
277 { 0x01061805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #2" },
278 { 0x01071805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #3" },
279 { 0x01081805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #4" },
281 // likely broken, vendor id doesn't match the other magic views ...
282 //{ 0xa0fca04f, BTTV_MAGICTVIEW063, "Guillemot Maxi TV Video 3" },
284 // DVB cards (using pci function .1 for mpeg data xfer)
285 { 0x01010071, BTTV_NEBULA_DIGITV, "Nebula Electronics DigiTV" },
286 { 0x07611461, BTTV_AVDVBT_761, "AverMedia AverTV DVB-T" },
287 { 0x001c11bd, BTTV_PINNACLESAT, "Pinnacle PCTV Sat" },
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" },
291 { 0x07711461, BTTV_AVDVBT_771, "AVermedia DVB-T 771" },
292 { 0xdb1018ac, BTTV_DVICO_DVBT_LITE, "DVICO FusionHDTV DVB-T Lite" },
297 /* ----------------------------------------------------------------------- */
298 /* array with description for bt848 / bt878 tv/grabber cards */
300 struct tvcard bttv_tvcards[] = {
302 /* ---- card 0x00 ---------------------------------- */
303 .name = " *** UNKNOWN/GENERIC *** ",
308 .muxsel = { 2, 3, 1, 0},
317 .muxsel = { 2, 3, 1, 1},
318 .audiomux = { 2, 0, 0, 0, 10},
322 .name = "Hauppauge (bt848)",
328 .muxsel = { 2, 3, 1, 1},
329 .audiomux = { 0, 1, 2, 3, 4},
333 .name = "STB, Gateway P/N 6000699 (bt848)",
339 .muxsel = { 2, 3, 1, 1},
340 .audiomux = { 4, 0, 2, 3, 1},
343 .tuner_type = TUNER_PHILIPS_NTSC,
348 /* ---- card 0x04 ---------------------------------- */
349 .name = "Intel Create and Share PCI/ Smart Video Recorder III",
355 .muxsel = { 2, 3, 1, 1},
360 .name = "Diamond DTV2000",
366 .muxsel = { 2, 3, 1, 0},
367 .audiomux = { 0, 1, 0, 1, 3},
371 .name = "AVerMedia TVPhone",
376 .muxsel = { 2, 3, 1, 1},
378 .audiomux = { 0x0c, 0x04, 0x08, 0x04, 0},
379 /* 0x04 for some cards ?? */
382 .audio_hook = avermedia_tvphone_audio,
385 .name = "MATRIX-Vision MV-Delta",
391 .muxsel = { 2, 3, 1, 0, 0},
397 /* ---- card 0x08 ---------------------------------- */
398 .name = "Lifeview FlyVideo II (Bt848) LR26 / MAXI TV Video PCI2 LR26",
404 .muxsel = { 2, 3, 1, 1},
405 .audiomux = { 0, 0xc00, 0x800, 0x400, 0xc00, 0},
410 .name = "IMS/IXmicro TurboTV",
416 .muxsel = { 2, 3, 1, 1},
417 .audiomux = { 1, 1, 2, 3, 0},
420 .tuner_type = TUNER_TEMIC_PAL,
422 .name = "Hauppauge (bt878)",
427 .gpiomask = 0x0f, /* old: 7 */
428 .muxsel = { 2, 0, 1, 1},
429 .audiomux = { 0, 1, 2, 3, 4},
434 .name = "MIRO PCTV pro",
440 .muxsel = { 2, 3, 1, 1},
441 .audiomux = { 0x20001,0x10001, 0, 0,10},
446 /* ---- card 0x0c ---------------------------------- */
447 .name = "ADS Technologies Channel Surfer TV (bt848)",
453 .muxsel = { 2, 3, 1, 1},
454 .audiomux = { 13, 14, 11, 7, 0, 0},
458 .name = "AVerMedia TVCapture 98",
464 .muxsel = { 2, 3, 1, 1},
465 .audiomux = { 13, 14, 11, 7, 0, 0},
469 .tuner_type = TUNER_PHILIPS_PAL,
470 .audio_hook = avermedia_tv_stereo_audio,
472 .name = "Aimslab Video Highway Xtreme (VHX)",
478 .muxsel = { 2, 3, 1, 1},
479 .audiomux = { 0, 2, 1, 3, 4}, /* old: { 0, 1, 2, 3, 4} */
484 .name = "Zoltrix TV-Max",
490 .muxsel = { 2, 3, 1, 1},
491 .audiomux = {0 , 0, 1 , 0, 10},
496 /* ---- card 0x10 ---------------------------------- */
497 .name = "Prolink Pixelview PlayTV (bt878)",
502 .gpiomask = 0x01fe00,
503 .muxsel = { 2, 3, 1, 1},
506 .audiomux = { 0x01c000, 0, 0x018000, 0x014000, 0x002000, 0 },
508 // 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru>
509 .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 },
515 .name = "Leadtek WinView 601",
520 .gpiomask = 0x8300f8,
521 .muxsel = { 2, 3, 1, 1,0},
522 .audiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007},
525 .audio_hook = winview_audio,
528 .name = "AVEC Intercapture",
534 .muxsel = {2, 3, 1, 1},
535 .audiomux = {1, 0, 0, 0, 0},
539 .name = "Lifeview FlyVideo II EZ /FlyKit LR38 Bt848 (capture only)",
544 .gpiomask = 0x8dff00,
545 .muxsel = { 2, 3, 1, 1},
551 /* ---- card 0x14 ---------------------------------- */
552 .name = "CEI Raffles Card",
557 .muxsel = {2, 3, 1, 1},
560 .name = "Lifeview FlyVideo 98/ Lucky Star Image World ConferenceTV LR50",
562 .audio_inputs = 2, // tuner, line in
566 .muxsel = { 2, 3, 1, 1},
567 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800},
569 .tuner_type = TUNER_PHILIPS_PAL_I,
571 .name = "Askey CPH050/ Phoebe Tv Master + FM",
577 .muxsel = { 2, 3, 1, 1},
578 .audiomux = {0, 1, 0x800, 0x400, 0xc00, 0},
583 .name = "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV, bt878",
589 .muxsel = { 2, 3, -1 },
590 .digital_mode = DIGITAL_MODE_CAMERA,
591 .audiomux = { 0, 0, 0, 0, 0 },
594 .tuner_type = TUNER_ALPS_TSBB5_PAL_I,
597 /* ---- card 0x18 ---------------------------------- */
598 .name = "Askey CPH05X/06X (bt878) [many vendors]",
604 .muxsel = { 2, 3, 1, 1},
605 .audiomux = {0x400, 0x400, 0x400, 0x400, 0xc00},
611 .name = "Terratec TerraTV+ Version 1.0 (Bt848)/ Terra TValue Version 1.0/ Vobis TV-Boostar",
616 .gpiomask = 0x1f0fff,
617 .muxsel = { 2, 3, 1, 1},
618 .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000},
620 .tuner_type = TUNER_PHILIPS_PAL,
621 .audio_hook = terratv_audio,
623 .name = "Hauppauge WinCam newer (bt878)",
629 .muxsel = { 2, 0, 1, 1},
630 .audiomux = { 0, 1, 2, 3, 4},
634 .name = "Lifeview FlyVideo 98/ MAXI TV Video PCI2 LR50",
640 .muxsel = { 2, 3, 1, 1},
641 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800},
643 .tuner_type = TUNER_PHILIPS_SECAM,
646 /* ---- card 0x1c ---------------------------------- */
647 .name = "Terratec TerraTV+ Version 1.1 (bt878)",
652 .gpiomask = 0x1f0fff,
653 .muxsel = { 2, 3, 1, 1},
654 .audiomux = { 0x20000, 0x30000, 0x10000, 0x00000, 0x40000},
656 .tuner_type = TUNER_PHILIPS_PAL,
657 .audio_hook = terratv_audio,
659 External 20 pin connector (for Active Radio Upgrade board)
665 gpio05: om5610-stereo
669 gpio09+10: nIOR, nSEL ?? (bt878)
673 gpio16: u2-A0 (1st 4052bt)
676 gpio19: u4-A0 (2nd 4052)
680 00000 : Cdrom (internal audio input)
681 10000 : ext. Video audio input
690 /* Jannik Fritsch <jannik@techfak.uni-bielefeld.de> */
691 .name = "Imagenation PXC200",
695 .svhs = 1, /* was: 4 */
697 .muxsel = { 2, 3, 1, 0, 0},
701 .muxsel_hook = PXC200_muxsel,
704 .name = "Lifeview FlyVideo 98 LR50",
709 .gpiomask = 0x1800, //0x8dfe00
710 .muxsel = { 2, 3, 1, 1},
711 .audiomux = { 0, 0x0800, 0x1000, 0x1000, 0x1800, 0 },
715 .name = "Formac iProTV, Formac ProTV I (bt848)",
721 .muxsel = { 2, 3, 1, 1},
722 .audiomux = { 1, 0, 0, 0, 0 },
724 .tuner_type = TUNER_PHILIPS_PAL,
727 /* ---- card 0x20 ---------------------------------- */
728 .name = "Intel Create and Share PCI/ Smart Video Recorder III",
734 .muxsel = { 2, 3, 1, 1},
739 .name = "Terratec TerraTValue Version Bt878",
744 .gpiomask = 0xffff00,
745 .muxsel = { 2, 3, 1, 1},
746 .audiomux = { 0x500, 0, 0x300, 0x900, 0x900},
749 .tuner_type = TUNER_PHILIPS_PAL,
751 .name = "Leadtek WinFast 2000/ WinFast 2000 XP",
756 .muxsel = { 2, 3, 1, 1, 0}, // TV, CVid, SVid, CVid over SVid connector
758 .gpiomask = 0xc33000,
759 .audiomux = { 0x422000,0x1000,0x0000,0x620000,0x800000 },
761 /* Alexander Varakin <avarakin@hotmail.com> [stereo version] */
762 .gpiomask = 0xb33000,
763 .audiomux = { 0x122000,0x1000,0x0000,0x620000,0x800000 },
765 /* Audio Routing for "WinFast 2000 XP" (no tv stereo !)
766 gpio23 -- hef4052:nEnable (0x800000)
769 0x0000: external audio
773 Note: There exists another variant "Winfast 2000" with tv stereo !?
774 Note: eeprom only contains FF and pci subsystem id 107d:6606
779 .tuner_type = 5, // default for now, gpio reads BFFF06 for Pal bg+dk
780 .audio_hook = winfast2000_audio,
783 .name = "Lifeview FlyVideo 98 LR50 / Chronos Video Shuttle II",
789 .muxsel = { 2, 3, 1, 1},
790 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800},
795 /* ---- card 0x24 ---------------------------------- */
796 .name = "Lifeview FlyVideo 98FM LR50 / Typhoon TView TV/FM Tuner",
802 .muxsel = { 2, 3, 1, 1},
803 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 },
808 .name = "Prolink PixelView PlayTV pro",
814 .muxsel = { 2, 3, 1, 1 },
815 .audiomux = { 0x21, 0x20, 0x24, 0x2c, 0x29, 0x29 },
820 .name = "Askey CPH06X TView99",
825 .gpiomask = 0x551e00,
826 .muxsel = { 2, 3, 1, 0},
827 .audiomux = { 0x551400, 0x551200, 0, 0, 0x551c00, 0x551200 },
833 .name = "Pinnacle PCTV Studio/Rave",
838 .gpiomask = 0x03000F,
839 .muxsel = { 2, 3, 1, 1},
840 .audiomux = { 2, 0xd0001, 0, 0, 1},
846 /* ---- card 0x28 ---------------------------------- */
847 .name = "STB TV PCI FM, Gateway P/N 6000704 (bt878), 3Dfx VoodooTV 100",
853 .muxsel = { 2, 3, 1, 1},
854 .audiomux = { 4, 0, 2, 3, 1},
857 .tuner_type = TUNER_PHILIPS_NTSC,
861 .name = "AVerMedia TVPhone 98",
867 .muxsel = { 2, 3, 1, 1},
868 .audiomux = { 13, 4, 11, 7, 0, 0},
873 .audio_hook = avermedia_tvphone_audio,
875 .name = "ProVideo PV951", /* pic16c54 */
881 .muxsel = { 2, 3, 1, 1},
882 .audiomux = { 0, 0, 0, 0, 0},
888 .name = "Little OnAir TV",
894 .muxsel = {2, 3, 1, 1},
895 .audiomux = {0xff9ff6, 0xff9ff6, 0xff1ff7, 0, 0xff3ffc},
900 /* ---- card 0x2c ---------------------------------- */
901 .name = "Sigma TVII-FM",
907 .muxsel = {2, 3, 1, 1},
908 .audiomux = {1, 1, 0, 2, 3},
913 .name = "MATRIX-Vision MV-Delta 2",
919 .muxsel = { 2, 3, 1, 0, 0},
925 .name = "Zoltrix Genie TV/FM",
930 .gpiomask = 0xbcf03f,
931 .muxsel = { 2, 3, 1, 1},
932 .audiomux = { 0xbc803f, 0xbc903f, 0xbcb03f, 0, 0xbcb03f},
937 .name = "Terratec TV/Radio+",
943 .muxsel = { 2, 3, 1, 1},
944 .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000, 0x20000 },
952 /* ---- card 0x30 ---------------------------------- */
953 .name = "Askey CPH03x/ Dynalink Magic TView",
959 .muxsel = { 2, 3, 1, 1},
960 .audiomux = {2,0,0,0,1},
965 .name = "IODATA GV-BCTV3/PCI",
970 .gpiomask = 0x010f00,
971 .muxsel = {2, 3, 0, 0},
972 .audiomux = {0x10000, 0, 0x10000, 0, 0, 0},
975 .tuner_type = TUNER_ALPS_TSHC6_NTSC,
976 .audio_hook = gvbctv3pci_audio,
978 .name = "Prolink PV-BT878P+4E / PixelView PlayTV PAK / Lenco MXTV-9578 CP",
983 .gpiomask = 0xAA0000,
984 .muxsel = { 2,3,1,1,-1 },
985 .digital_mode = DIGITAL_MODE_CAMERA,
986 .audiomux = { 0x20000, 0, 0x80000, 0x80000, 0xa8000, 0x46000 },
989 .tuner_type = TUNER_PHILIPS_PAL_I,
991 /* GPIO wiring: (different from Rev.4C !)
992 GPIO17: U4.A0 (first hef4052bt)
994 GPIO20: U5.A1 (second hef4052bt)
996 GPIO22: BT832 Reset Line
997 GPIO23: A5,A0, U5,nEN
998 Note: At i2c=0x8a is a Bt832 chip, which changes to 0x88 after being reset via GPIO22
1001 .name = "Eagle Wireless Capricorn2 (bt878A)",
1007 .muxsel = { 2, 0, 1, 1},
1008 .audiomux = { 0, 1, 2, 3, 4},
1010 .tuner_type = -1 /* TUNER_ALPS_TMDH2_NTSC */,
1013 /* ---- card 0x34 ---------------------------------- */
1014 /* David Härdeman <david@2gen.com> */
1015 .name = "Pinnacle PCTV Studio Pro",
1020 .gpiomask = 0x03000F,
1021 .muxsel = { 2, 3, 1, 1},
1022 .audiomux = { 1, 0xd0001, 0, 0, 10},
1023 /* sound path (5 sources):
1024 MUX1 (mask 0x03), Enable Pin 0x08 (0=enable, 1=disable)
1027 2= Mono TV sound from Tuner
1029 MUX2 (mask 0x30000):
1031 1= FM stereo Radio from Tuner */
1036 /* Claas Langbehn <claas@bigfoot.com>,
1037 Sven Grothklags <sven@upb.de> */
1038 .name = "Typhoon TView RDS + FM Stereo / KNC1 TV Station RDS",
1044 .muxsel = { 2, 3, 1, 1},
1045 .audiomux = { 0, 0, 0x10, 8, 4 },
1048 .tuner_type = TUNER_PHILIPS_PAL,
1051 /* Tim Röstermundt <rosterm@uni-muenster.de>
1052 in de.comp.os.unix.linux.hardware:
1053 options bttv card=0 pll=1 radio=1 gpiomask=0x18e0
1054 audiomux=0x44c71f,0x44d71f,0,0x44d71f,0x44dfff
1055 options tuner type=5 */
1056 .name = "Lifeview FlyVideo 2000 /FlyVideo A2/ Lifetec LT 9415 TV [LR90]",
1062 .muxsel = { 2, 3, 1, 1},
1063 .audiomux = { 0x0000,0x0800,0x1000,0x1000,0x18e0 },
1064 /* For cards with tda9820/tda9821:
1065 0x0000: Tuner normal stereo
1066 0x0080: Tuner A2 SAP (second audio program = Zweikanalton)
1067 0x0880: Tuner A2 stereo */
1071 /* Miguel Angel Alvarez <maacruz@navegalia.com>
1072 old Easy TV BT848 version (model CPH031) */
1073 .name = "Askey CPH031/ BESTBUY Easy TV",
1079 .muxsel = { 2, 3, 1, 0},
1080 .audiomux = { 2, 0, 0, 0, 10},
1083 .tuner_type = TUNER_TEMIC_PAL,
1086 /* ---- card 0x38 ---------------------------------- */
1087 /* Gordon Heydon <gjheydon@bigfoot.com ('98) */
1088 .name = "Lifeview FlyVideo 98FM LR50",
1094 .muxsel = { 2, 3, 1, 1},
1095 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 },
1099 /* This is the ultimate cheapo capture card
1100 * just a BT848A on a small PCB!
1101 * Steve Hosgood <steve@equiinet.com> */
1102 .name = "GrandTec 'Grand Video Capture' (Bt848)",
1115 /* Daniel Herrington <daniel.herrington@home.com> */
1116 .name = "Askey CPH060/ Phoebe TV Master Only (No FM)",
1122 .muxsel = { 2, 3, 1, 1},
1123 .audiomux = { 0x400, 0x400, 0x400, 0x400, 0x800, 0x400 },
1126 .tuner_type = TUNER_TEMIC_4036FY5_NTSC,
1128 /* Matti Mottus <mottus@physic.ut.ee> */
1129 .name = "Askey CPH03x TV Capturer",
1134 .gpiomask = 0x03000F,
1135 .muxsel = { 2, 3, 1, 0},
1136 .audiomux = { 2,0,0,0,1 },
1141 /* ---- card 0x3c ---------------------------------- */
1142 /* Philip Blundell <philb@gnu.org> */
1143 .name = "Modular Technology MM100PCTV",
1149 .muxsel = { 2, 3, 1, 1},
1150 .audiomux = { 2, 0, 0, 1, 8},
1152 .tuner_type = TUNER_TEMIC_PAL,
1155 /* Adrian Cox <adrian@humboldt.co.uk */
1156 .name = "AG Electronics GMV1",
1169 /* Miguel Angel Alvarez <maacruz@navegalia.com>
1170 new Easy TV BT878 version (model CPH061)
1171 special thanks to Informatica Mieres for providing the card */
1172 .name = "Askey CPH061/ BESTBUY Easy TV (bt878)",
1178 .muxsel = { 2, 3, 1, 0},
1179 .audiomux = { 1, 0, 4, 4, 9},
1182 .tuner_type = TUNER_PHILIPS_PAL,
1184 /* Lukas Gebauer <geby@volny.cz> */
1185 .name = "ATI TV-Wonder",
1191 .muxsel = { 2, 3, 1, 0 },
1192 .audiomux = { 0xbffe, 0, 0xbfff, 0, 0xbffe},
1194 .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL,
1197 /* ---- card 0x40 ---------------------------------- */
1198 /* Lukas Gebauer <geby@volny.cz> */
1199 .name = "ATI TV-Wonder VE",
1205 .muxsel = { 2, 3, 0, 1},
1206 .audiomux = { 0, 0, 1, 0, 0},
1209 .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL,
1211 /* DeeJay <deejay@westel900.net (2000S) */
1212 .name = "Lifeview FlyVideo 2000S LR90",
1218 .muxsel = { 2, 3, 0, 1},
1219 /* Radio changed from 1e80 to 0x800 to make
1220 FlyVideo2000S in .hu happy (gm)*/
1221 /* -dk-???: set mute=0x1800 for tda9874h daughterboard */
1222 .audiomux = { 0x0000,0x0800,0x1000,0x1000,0x1800, 0x1080 },
1223 .audio_hook = fv2000s_audio,
1230 .name = "Terratec TValueRadio",
1235 .gpiomask = 0xffff00,
1236 .muxsel = { 2, 3, 1, 1},
1237 .audiomux = { 0x500, 0x500, 0x300, 0x900, 0x900},
1240 .tuner_type = TUNER_PHILIPS_PAL,
1243 /* TANAKA Kei <peg00625@nifty.com> */
1244 .name = "IODATA GV-BCTV4/PCI",
1249 .gpiomask = 0x010f00,
1250 .muxsel = {2, 3, 0, 0},
1251 .audiomux = {0x10000, 0, 0x10000, 0, 0, 0},
1254 .tuner_type = TUNER_SHARP_2U5JF5540_NTSC,
1255 .audio_hook = gvbctv3pci_audio,
1258 /* ---- card 0x44 ---------------------------------- */
1259 .name = "3Dfx VoodooTV FM (Euro), VoodooTV 200 (USA)",
1260 // try "insmod msp3400 simple=0" if you have
1261 // sound problems with this card.
1266 .gpiomask = 0x4f8a00,
1267 // 0x100000: 1=MSP enabled (0=disable again)
1268 // 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC)
1269 .audiomux = {0x947fff, 0x987fff,0x947fff,0x947fff, 0x947fff},
1270 // tvtuner, radio, external,internal, mute, stereo
1271 /* tuner, Composit, SVid, Composit-on-Svid-adapter*/
1272 .muxsel = { 2, 3 ,0 ,1},
1273 .tuner_type = TUNER_MT2032,
1277 /* Philip Blundell <pb@nexus.co.uk> */
1278 .name = "Active Imaging AIMMS",
1287 /* Tomasz Pyra <hellfire@sedez.iq.pl> */
1288 .name = "Prolink Pixelview PV-BT878P+ (Rev.4C,8E)",
1294 .muxsel = { 2, 3, 1, 1},
1295 .audiomux = { 0, 0, 11, 7, 13, 0}, // TV and Radio with same GPIO !
1301 GPIO0: U4.A0 (hef4052bt)
1303 GPIO2: U4.A1 (second hef4052bt)
1304 GPIO3: U4.nEN, U5.A0, A5.nEN
1308 .name = "Lifeview FlyVideo 98EZ (capture only) LR51",
1313 .muxsel = { 2, 3, 1, 1}, // AV1, AV2, SVHS, CVid adapter on SVHS
1318 /* ---- card 0x48 ---------------------------------- */
1319 /* Dariusz Kowalewski <darekk@automex.pl> */
1320 .name = "Prolink Pixelview PV-BT878P+9B (PlayTV Pro rev.9B FM+NICAM)",
1326 .muxsel = { 2, 3, 1, 1 },
1327 .audiomux = { 0x01, 0x00, 0x03, 0x03, 0x09, 0x02 },
1333 .audio_hook = pvbt878p9b_audio, // Note: not all cards have stereo
1334 .has_radio = 1, // Note: not all cards have radio
1341 GPIO20,22,23: R30,R29,R28
1344 /* Clay Kunz <ckunz@mail.arc.nasa.gov> */
1345 /* you must jumper JP5 for the card to work */
1346 .name = "Sensoray 311",
1352 .muxsel = { 2, 3, 1, 0, 0},
1357 /* Miguel Freitas <miguel@cetuc.puc-rio.br> */
1358 .name = "RemoteVision MX (RV605)",
1364 .gpiomask2 = 0x07ff,
1365 .muxsel = { 0x33, 0x13, 0x23, 0x43, 0xf3, 0x73, 0xe3, 0x03,
1366 0xd3, 0xb3, 0xc3, 0x63, 0x93, 0x53, 0x83, 0xa3 },
1370 .muxsel_hook = rv605_muxsel,
1372 .name = "Powercolor MTV878/ MTV878R/ MTV878F",
1377 .gpiomask = 0x1C800F, // Bit0-2: Audio select, 8-12:remote control 14:remote valid 15:remote reset
1378 .muxsel = { 2, 1, 1, },
1379 .audiomux = { 0, 1, 2, 2, 4 },
1381 .tuner_type = TUNER_PHILIPS_PAL,
1386 /* ---- card 0x4c ---------------------------------- */
1387 /* Masaki Suzuki <masaki@btree.org> */
1388 .name = "Canopus WinDVR PCI (COMPAQ Presario 3524JP, 5112JP)",
1393 .gpiomask = 0x140007,
1394 .muxsel = { 2, 3, 1, 1 },
1395 .audiomux = { 0, 1, 2, 3, 4, 0 },
1396 .tuner_type = TUNER_PHILIPS_NTSC,
1397 .audio_hook = windvr_audio,
1399 .name = "GrandTec Multi Capture Card (Bt878)",
1405 .muxsel = { 2, 3, 1, 0 },
1412 .name = "Jetway TV/Capture JW-TV878-FBK, Kworld KW-TV878RF",
1418 .muxsel = { 2, 3, 1, 1 }, // Tuner, SVid, SVHS, SVid to SVHS connector
1419 .audiomux = { 0 ,0 ,4, 4,4,4},// Yes, this tuner uses the same audio output for TV and FM radio!
1420 // This card lacks external Audio In, so we mute it on Ext. & Int.
1421 // The PCB can take a sbx1637/sbx1673, wiring unknown.
1422 // This card lacks PCI subsystem ID, sigh.
1423 // audiomux=1: lower volume, 2+3: mute
1424 // btwincap uses 0x80000/0x80003
1428 .tuner_type = 5, // Samsung TCPA9095PC27A (BG+DK), philips compatible, w/FM, stereo and
1429 // radio signal strength indicators work fine.
1432 GPIO0,1: HEF4052 A0,A1
1433 GPIO2: HEF4052 nENABLE
1435 GPIO8-13: IRDC357 data0-5 (data6 n.c. ?) [chip not present on my card]
1439 ?? : mtu8b56ep microcontroller for IR (GPIO wiring unknown)*/
1441 /* Arthur Tetzlaff-Deas, DSP Design Ltd <software@dspdesign.com> */
1442 .name = "DSP Design TCVIDEO",
1445 .muxsel = { 2, 3, 1, 0},
1450 /* ---- card 0x50 ---------------------------------- */
1451 .name = "Hauppauge WinTV PVR",
1456 .muxsel = { 2, 0, 1, 1},
1464 .name = "IODATA GV-BCTV5/PCI",
1469 .gpiomask = 0x0f0f80,
1470 .muxsel = {2, 3, 1, 0},
1471 .audiomux = {0x030000, 0x010000, 0, 0, 0x020000, 0},
1474 .tuner_type = TUNER_PHILIPS_NTSC_M,
1475 .audio_hook = gvbctv5pci_audio,
1478 .name = "Osprey 100/150 (878)", /* 0x1(2|3)-45C6-C1 */
1479 .video_inputs = 4, /* id-inputs-clock */
1483 .muxsel = { 3, 2, 0, 1 },
1490 .name = "Osprey 100/150 (848)", /* 0x04-54C0-C1 & older boards */
1495 .muxsel = { 2, 3, 1 },
1503 /* ---- card 0x54 ---------------------------------- */
1504 .name = "Osprey 101 (848)", /* 0x05-40C0-C1 */
1516 .name = "Osprey 101/151", /* 0x1(4|5)-0004-C4 */
1528 .name = "Osprey 101/151 w/ svid", /* 0x(16|17|20)-00C4-C1 */
1540 .name = "Osprey 200/201/250/251", /* 0x1(8|9|E|F)-0004-C4 */
1553 /* ---- card 0x58 ---------------------------------- */
1554 .name = "Osprey 200/250", /* 0x1(A|B)-00C4-C1 */
1566 .name = "Osprey 210/220", /* 0x1(A|B)-04C0-C1 */
1578 .name = "Osprey 500", /* 500 */
1590 .name = "Osprey 540", /* 540 */
1594 #if 0 /* TODO ... */
1595 .svhs = OSPREY540_SVID_ANALOG,
1596 .muxsel = { [OSPREY540_COMP_ANALOG] = 2,
1597 [OSPREY540_SVID_ANALOG] = 3, },
1604 #if 0 /* TODO ... */
1605 .muxsel_hook = osprey_540_muxsel,
1606 .picture_hook = osprey_540_set_picture,
1610 /* ---- card 0x5C ---------------------------------- */
1611 .name = "Osprey 2000", /* 2000 */
1621 .no_tda7432 = 1, /* must avoid, conflicts with the bt860 */
1623 /* M G Berberich <berberic@forwiss.uni-passau.de> */
1624 .name = "IDS Eagle",
1631 .muxsel = { 0, 1, 2, 3 },
1632 .muxsel_hook = eagle_muxsel,
1637 .name = "Pinnacle PCTV Sat",
1647 .audiomux = { 0, 0, 0, 0, 1 },
1648 .muxsel = { 3, 0, 1, 2},
1654 .name = "Formac ProTV II (bt878)",
1660 // TV, Comp1, Composite over SVID con, SVID
1661 .muxsel = { 2, 3, 1, 1},
1662 .audiomux = { 2, 2, 0, 0, 0 },
1665 .tuner_type = TUNER_PHILIPS_PAL,
1667 GPIO=0x00,0x01,0x03: mute (?)
1668 0x02: both TV and radio (tuner: FM1216/I)
1669 The card has onboard audio connectors labeled "cdrom" and "board",
1670 not soldered here, though unknown wiring.
1671 Card lacks: external audio in, pci subsystem id.
1675 /* ---- card 0x60 ---------------------------------- */
1682 .muxsel = { 2, 3, 1, 1},
1683 .audiomux = { 0, 1, 2, 3, 4},
1688 .name = "Euresys Picolo",
1697 .muxsel = { 2, 0, 1},
1700 /* Luc Van Hoeylandt <luc@e-magic.be> */
1701 .name = "ProVideo PV150", /* 0x4f */
1714 /* Hiroshi Takekawa <sian@big.or.jp> */
1715 /* This card lacks subsystem ID */
1716 .name = "AD-TVK503", /* 0x63 */
1721 .gpiomask = 0x001e8007,
1722 .muxsel = { 2, 3, 1, 0 },
1723 /* Tuner, Radio, external, internal, off, on */
1724 .audiomux = { 0x08, 0x0f, 0x0a, 0x08, 0x0f, 0x08 },
1729 .audio_hook = adtvk503_audio,
1732 /* ---- card 0x64 ---------------------------------- */
1733 .name = "Hercules Smart TV Stereo",
1739 .muxsel = { 2, 3, 1, 1 },
1745 - card lacks subsystem ID
1746 - stereo variant w/ daughter board with tda9874a @0xb0
1748 always from tda9874 independent of GPIO (?)
1749 external line in: unknown
1750 - Other chips: em78p156elp @ 0x96 (probably IR remote control)
1751 hef4053 (instead 4052) for unknown function
1754 .name = "Pace TV & Radio Card",
1759 .muxsel = { 2, 3, 1, 1}, // Tuner, CVid, SVid, CVid over SVid connector
1766 /* Bt878, Bt832, FI1246 tuner; no pci subsystem id
1767 only internal line out: (4pin header) RGGL
1768 Radio must be decoded by msp3410d (not routed through)*/
1769 // .digital_mode = DIGITAL_MODE_CAMERA, // todo!
1771 /* Chris Willing <chris@vislab.usyd.edu.au> */
1782 .name = "Grand X-Guard / Trust 814PCI",
1789 .muxsel = { 2,2,2,2, 3,3,3,3, 1,1,1,1, 0,0,0,0 },
1790 .muxsel_hook = xguard_muxsel,
1797 /* ---- card 0x68 ---------------------------------- */
1798 .name = "Nebula Electronics DigiTV",
1802 .muxsel = { 2, 3, 1, 0},
1811 /* Jorge Boncompte - DTI2 <jorge@dti2.net> */
1812 .name = "ProVideo PV143",
1818 .muxsel = { 2, 3, 1, 0 },
1825 /* M.Klahr@phytec.de */
1826 .name = "PHYTEC VD-009-X1 MiniDIN (bt878)",
1829 .tuner = -1, /* card has no tuner */
1832 .muxsel = { 2, 3, 1, 0},
1833 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1838 .name = "PHYTEC VD-009-X1 Combi (bt878)",
1841 .tuner = -1, /* card has no tuner */
1844 .muxsel = { 2, 3, 1, 1},
1845 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1851 /* ---- card 0x6c ---------------------------------- */
1852 .name = "PHYTEC VD-009 MiniDIN (bt878)",
1855 .tuner = -1, /* card has no tuner */
1858 .gpiomask2 = 0x03, /* gpiomask2 defines the bits used to switch audio
1859 via the upper nibble of muxsel. here: used for
1860 xternal video-mux */
1861 .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x00 },
1862 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1867 .name = "PHYTEC VD-009 Combi (bt878)",
1870 .tuner = -1, /* card has no tuner */
1873 .gpiomask2 = 0x03, /* gpiomask2 defines the bits used to switch audio
1874 via the upper nibble of muxsel. here: used for
1875 xternal video-mux */
1876 .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x01 },
1877 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1889 .muxsel = { 2, 3, 1, 0 },
1892 /* IVC-120G - Alan Garfield <alan@fromorbit.com> */
1895 .audio_inputs = 0, /* card has no audio */
1896 .tuner = -1, /* card has no tuner */
1898 .svhs = -1, /* card has no svhs */
1904 .muxsel = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
1905 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10 },
1906 .muxsel_hook = ivc120_muxsel,
1910 /* ---- card 0x70 ---------------------------------- */
1911 .name = "pcHDTV HD-2000 TV",
1916 .muxsel = { 2, 3, 1, 0},
1917 .tuner_type = TUNER_PHILIPS_ATSC,
1919 .name = "Twinhan DST + clones",
1923 .tuner_type = TUNER_ABSENT,
1927 .name = "Winfast VC100",
1931 .tuner = -1, // no tuner
1932 .muxsel = { 3, 1, 1, 3}, // Vid In, SVid In, Vid over SVid in connector
1936 .tuner_type = TUNER_ABSENT,
1940 .name = "Teppro TEV-560/InterVision IV-560",
1946 .muxsel = { 2, 3, 1, 1},
1947 .audiomux = { 1, 1, 1, 1, 0},
1949 .tuner_type = TUNER_PHILIPS_PAL,
1953 /* ---- card 0x74 ---------------------------------- */
1954 .name = "SIMUS GVC1100",
1961 .muxsel = { 2, 2, 2, 2},
1963 .muxsel_hook = gvc1100_muxsel,
1965 /* Carlos Silva r3pek@r3pek.homelinux.org || card 0x75 */
1966 .name = "NGS NGSTV+",
1970 .gpiomask = 0x008007,
1971 .muxsel = {2, 3, 0, 0},
1972 .audiomux = {0, 0, 0, 0, 0x000003, 0},
1974 .tuner_type = TUNER_PHILIPS_PAL,
1977 /* http://linuxmedialabs.com */
1979 .video_inputs = 4, /* IN1,IN2,IN3,IN4 */
1983 .muxsel = { 2, 3, 1, 0 },
1989 /* Helmroos Harri <harri.helmroos@pp.inet.fi> */
1990 .name = "Tekram M205 PRO",
1994 .tuner_type = TUNER_PHILIPS_PAL,
1998 .muxsel = { 2, 3, 1},
1999 .audiomux = { 0x68, 0x68, 0x61, 0x61, 0x00 },
2003 /* ---- card 0x78 ---------------------------------- */
2004 /* Javier Cendan Ares <jcendan@lycos.es> */
2005 /* bt878 TV + FM without subsystem ID */
2006 .name = "Conceptronic CONTVFMi",
2011 .gpiomask = 0x008007,
2012 .muxsel = { 2, 3, 1, 1 },
2013 .audiomux = { 0, 1, 2, 2, 3 },
2016 .tuner_type = TUNER_PHILIPS_PAL,
2020 /*Eric DEBIEF <debief@telemsa.com>*/
2021 /*EURESYS Picolo Tetra : 4 Conexant Fusion 878A, no audio, video input set with analog multiplexers GPIO controled*/
2022 /* adds picolo_tetra_muxsel(), picolo_tetra_init(), the folowing declaration strucure, and #define BTTV_PICOLO_TETRA_CHIP*/
2024 .name = "Euresys Picolo Tetra",
2030 .gpiomask2 = 0x3C<<16,/*Set the GPIO[18]->GPIO[21] as output pin.==> drive the video inputs through analog multiplexers*/
2034 .muxsel = {2,2,2,2},/*878A input is always MUX0, see above.*/
2035 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
2038 .muxsel_hook = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/
2040 /* Spirit TV Tuner from http://spiritmodems.com.au */
2041 /* Stafford Goodsell <surge@goliath.homeunix.org> */
2042 .name = "Spirit TV Tuner",
2047 .gpiomask = 0x0000000f,
2048 .muxsel = { 2, 1, 1 },
2049 .audiomux = { 0x02, 0x00, 0x00, 0x00, 0x00},
2050 .tuner_type = TUNER_TEMIC_PAL,
2054 /* Wolfram Joost <wojo@frokaschwei.de> */
2055 .name = "AVerMedia AVerTV DVB-T 771",
2059 .tuner_type = TUNER_ABSENT,
2060 .muxsel = { 3 , 3 },
2069 /* ---- card 0x7c ---------------------------------- */
2070 /* Matt Jesson <dvb@jesson.eclipse.co.uk> */
2071 /* Based on the Nebula card data - added remote and new card number - BTTV_AVDVBT_761, see also ir-kbd-gpio.c */
2072 .name = "AverMedia AverTV DVB-T 761",
2076 .muxsel = { 3, 1, 2, 0}, /* Comp0, S-Video, ?, ? */
2086 /* andre.schwarz@matrix-vision.de */
2087 .name = "MATRIX Vision Sigma-SQ",
2093 .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2,
2094 3, 3, 3, 3, 3, 3, 3, 3 },
2095 .muxsel_hook = sigmaSQ_muxsel,
2101 /* andre.schwarz@matrix-vision.de */
2102 .name = "MATRIX Vision Sigma-SLC",
2108 .muxsel = { 2, 2, 2, 2 },
2109 .muxsel_hook = sigmaSLC_muxsel,
2115 /* BTTV_APAC_VIEWCOMP */
2116 /* Attila Kondoros <attila.kondoros@chello.hu> */
2117 /* bt878 TV + FM 0x00000000 subsystem ID */
2118 .name = "APAC Viewcomp 878(AMAX)",
2124 .muxsel = { 2, 3, 1, 1},
2125 .audiomux = { 2, 0, 0, 0, 10},
2128 .tuner_type = TUNER_PHILIPS_PAL,
2129 .has_remote = 1, /* miniremote works, see ir-kbd-gpio.c */
2130 .has_radio = 1, /* not every card has radio */
2133 /* ---- card 0x80 ---------------------------------- */
2134 /* Chris Pascoe <c.pascoe@itee.uq.edu.au> */
2135 .name = "DVICO FusionHDTV DVB-T Lite",
2145 /* Steven <photon38@pchome.com.tw> */
2146 .name = "V-Gear MyVCD",
2152 .muxsel = {2, 3, 1, 0},
2153 .audiomux = {0x31, 0x31, 0x31, 0x31, 0x31, 0x31},
2156 .tuner_type = TUNER_PHILIPS_NTSC_M,
2161 const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards);
2163 /* ----------------------------------------------------------------------- */
2165 static unsigned char eeprom_data[256];
2170 void __devinit bttv_idcard(struct bttv *btv)
2172 unsigned int gpiobits;
2176 /* read PCI subsystem ID */
2177 pci_read_config_word(btv->c.pci, PCI_SUBSYSTEM_ID, &tmp);
2178 btv->cardid = tmp << 16;
2179 pci_read_config_word(btv->c.pci, PCI_SUBSYSTEM_VENDOR_ID, &tmp);
2182 if (0 != btv->cardid && 0xffffffff != btv->cardid) {
2183 /* look for the card */
2184 for (type = -1, i = 0; cards[i].id != 0; i++)
2185 if (cards[i].id == btv->cardid)
2190 printk(KERN_INFO "bttv%d: detected: %s [card=%d], "
2191 "PCI subsystem ID is %04x:%04x\n",
2192 btv->c.nr,cards[type].name,cards[type].cardnr,
2193 btv->cardid & 0xffff,
2194 (btv->cardid >> 16) & 0xffff);
2195 btv->c.type = cards[type].cardnr;
2198 printk(KERN_INFO "bttv%d: subsystem: %04x:%04x (UNKNOWN)\n",
2199 btv->c.nr, btv->cardid & 0xffff,
2200 (btv->cardid >> 16) & 0xffff);
2201 printk(KERN_DEBUG "please mail id, board name and "
2202 "the correct card= insmod option to kraxel@bytesex.org\n");
2206 /* let the user override the autodetected type */
2207 if (card[btv->c.nr] < bttv_num_tvcards)
2208 btv->c.type=card[btv->c.nr];
2210 /* print which card config we are using */
2211 printk(KERN_INFO "bttv%d: using: %s [card=%d,%s]\n",btv->c.nr,
2212 bttv_tvcards[btv->c.type].name, btv->c.type,
2213 card[btv->c.nr] < bttv_num_tvcards
2214 ? "insmod option" : "autodetected");
2216 /* overwrite gpio stuff ?? */
2217 if (UNSET == audioall && UNSET == audiomux[0])
2220 if (UNSET != audiomux[0]) {
2222 for (i = 0; i < 5; i++) {
2223 bttv_tvcards[btv->c.type].audiomux[i] = audiomux[i];
2224 gpiobits |= audiomux[i];
2227 gpiobits = audioall;
2228 for (i = 0; i < 5; i++) {
2229 bttv_tvcards[btv->c.type].audiomux[i] = audioall;
2232 bttv_tvcards[btv->c.type].gpiomask = (UNSET != gpiomask) ? gpiomask : gpiobits;
2233 printk(KERN_INFO "bttv%d: gpio config override: mask=0x%x, mux=",
2234 btv->c.nr,bttv_tvcards[btv->c.type].gpiomask);
2235 for (i = 0; i < 5; i++) {
2236 printk("%s0x%x", i ? "," : "", bttv_tvcards[btv->c.type].audiomux[i]);
2242 * (most) board specific initialisations goes here
2245 /* Some Modular Technology cards have an eeprom, but no subsystem ID */
2246 void identify_by_eeprom(struct bttv *btv, unsigned char eeprom_data[256])
2250 if (0 == strncmp(eeprom_data,"GET MM20xPCTV",13))
2251 type = BTTV_MODTEC_205;
2252 else if (0 == strncmp(eeprom_data+20,"Picolo",7))
2253 type = BTTV_EURESYS_PICOLO;
2254 else if (eeprom_data[0] == 0x84 && eeprom_data[2]== 0)
2255 type = BTTV_HAUPPAUGE; /* old bt848 */
2259 printk("bttv%d: detected by eeprom: %s [card=%d]\n",
2260 btv->c.nr, bttv_tvcards[btv->c.type].name, btv->c.type);
2264 static void flyvideo_gpio(struct bttv *btv)
2266 int gpio,has_remote,has_radio,is_capture_only,is_lr90,has_tda9820_tda9821;
2269 gpio_inout(0xffffff, 0);
2270 udelay(8); // without this we would see the 0x1800 mask
2272 /* FIXME: must restore OUR_EN ??? */
2274 // all cards provide GPIO info, some have an additional eeprom
2275 // LR50: GPIO coding can be found lower right CP1 .. CP9
2276 // CP9=GPIO23 .. CP1=GPIO15; when OPEN, the corresponding GPIO reads 1.
2278 // LR90: GP9=GPIO23 .. GP1=GPIO15 (right above the bt878)
2280 // lowest 3 bytes are remote control codes (no handshake needed)
2281 // xxxFFF: No remote control chip soldered
2282 // xxxF00(LR26/LR50), xxxFE0(LR90): Remote control chip (LVA001 or CF45) soldered
2283 // Note: Some bits are Audio_Mask !
2285 ttype=(gpio&0x0f0000)>>16;
2287 case 0x0: tuner=2; // NTSC, e.g. TPI8NSR11P
2289 case 0x2: tuner=39;// LG NTSC (newer TAPC series) TAPC-H701P
2291 case 0x4: tuner=5; // Philips PAL TPI8PSB02P, TPI8PSB12P, TPI8PSB12D or FI1216, FM1216
2293 case 0x6: tuner=37; // LG PAL (newer TAPC series) TAPC-G702P
2295 case 0xC: tuner=3; // Philips SECAM(+PAL) FQ1216ME or FI1216MF
2298 printk(KERN_INFO "bttv%d: FlyVideo_gpio: unknown tuner type.\n", btv->c.nr);
2301 has_remote = gpio & 0x800000;
2302 has_radio = gpio & 0x400000;
2303 // unknown 0x200000;
2304 // unknown2 0x100000;
2305 is_capture_only = !(gpio & 0x008000); //GPIO15
2306 has_tda9820_tda9821 = !(gpio & 0x004000);
2307 is_lr90 = !(gpio & 0x002000); // else LR26/LR50 (LR38/LR51 f. capture only)
2308 // gpio & 0x001000 // output bit for audio routing
2311 tuner=4; // No tuner present
2313 printk(KERN_INFO "bttv%d: FlyVideo Radio=%s RemoteControl=%s Tuner=%d gpio=0x%06x\n",
2314 btv->c.nr, has_radio? "yes":"no ", has_remote? "yes":"no ", tuner, gpio);
2315 printk(KERN_INFO "bttv%d: FlyVideo LR90=%s tda9821/tda9820=%s capture_only=%s\n",
2316 btv->c.nr, is_lr90?"yes":"no ", has_tda9820_tda9821?"yes":"no ",
2317 is_capture_only?"yes":"no ");
2319 if(tuner!= -1) // only set if known tuner autodetected, else let insmod option through
2320 btv->tuner_type = tuner;
2321 btv->has_radio = has_radio;
2323 // LR90 Audio Routing is done by 2 hef4052, so Audio_Mask has 4 bits: 0x001c80
2324 // LR26/LR50 only has 1 hef4052, Audio_Mask 0x000c00
2325 // Audio options: from tuner, from tda9821/tda9821(mono,stereo,sap), from tda9874, ext., mute
2326 if(has_tda9820_tda9821) btv->audio_hook = lt9415_audio;
2327 //todo: if(has_tda9874) btv->audio_hook = fv2000s_audio;
2330 int miro_tunermap[] = { 0,6,2,3, 4,5,6,0, 3,0,4,5, 5,2,16,1,
2331 14,2,17,1, 4,1,4,3, 1,2,16,1, 4,4,4,4 };
2332 int miro_fmtuner[] = { 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1,
2333 1,1,1,1, 1,1,1,0, 0,0,0,0, 0,1,0,0 };
2335 static void miro_pinnacle_gpio(struct bttv *btv)
2340 gpio_inout(0xffffff, 0);
2342 id = ((gpio>>10) & 63) -1;
2343 msp = bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx");
2345 btv->tuner_type = miro_tunermap[id];
2346 if (0 == (gpio & 0x20)) {
2348 if (!miro_fmtuner[id]) {
2349 btv->has_matchbox = 1;
2350 btv->mbox_we = (1<<6);
2351 btv->mbox_most = (1<<7);
2352 btv->mbox_clk = (1<<8);
2353 btv->mbox_data = (1<<9);
2354 btv->mbox_mask = (1<<6)|(1<<7)|(1<<8)|(1<<9);
2360 if (btv->c.type == BTTV_MIRO)
2361 btv->c.type = BTTV_MIROPRO;
2362 if (btv->c.type == BTTV_PINNACLE)
2363 btv->c.type = BTTV_PINNACLEPRO;
2366 "bttv%d: miro: id=%d tuner=%d radio=%s stereo=%s\n",
2367 btv->c.nr, id+1, btv->tuner_type,
2368 !btv->has_radio ? "no" :
2369 (btv->has_matchbox ? "matchbox" : "fmtuner"),
2370 (-1 == msp) ? "no" : "yes");
2372 /* new cards with microtune tuner */
2377 info = "PAL / mono";
2380 info = "PAL+SECAM / stereo";
2384 info = "NTSC / stereo";
2388 info = "PAL+SECAM / mono";
2391 info = "NTSC / mono";
2394 info = "NTSC / stereo";
2397 info = "PAL / stereo";
2400 info = "oops: unknown card";
2404 btv->c.type = BTTV_PINNACLEPRO;
2406 "bttv%d: pinnacle/mt: id=%d info=\"%s\" radio=%s\n",
2407 btv->c.nr, id, info, btv->has_radio ? "yes" : "no");
2408 btv->tuner_type = 33;
2409 btv->pinnacle_id = id;
2413 /* GPIO21 L: Buffer aktiv, H: Buffer inaktiv */
2414 #define LM1882_SYNC_DRIVE 0x200000L
2416 static void init_ids_eagle(struct bttv *btv)
2418 gpio_inout(0xffffff,0xFFFF37);
2419 gpio_write(0x200020);
2421 /* flash strobe inverter ?! */
2422 gpio_write(0x200024);
2424 /* switch sync drive off */
2425 gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE);
2427 /* set BT848 muxel to 2 */
2428 btaor((2)<<5, ~(2<<5), BT848_IFORM);
2431 /* Muxsel helper for the IDS Eagle.
2432 * the eagles does not use the standard muxsel-bits but
2433 * has its own multiplexer */
2434 static void eagle_muxsel(struct bttv *btv, unsigned int input)
2436 btaor((2)<<5, ~(3<<5), BT848_IFORM);
2437 gpio_bits(3,bttv_tvcards[btv->c.type].muxsel[input&7]);
2441 /* wake chroma ADC */
2442 btand(~BT848_ADC_C_SLEEP, BT848_ADC);
2443 /* set to YC video */
2444 btor(BT848_CONTROL_COMP, BT848_E_CONTROL);
2445 btor(BT848_CONTROL_COMP, BT848_O_CONTROL);
2448 /* set chroma ADC to sleep */
2449 btor(BT848_ADC_C_SLEEP, BT848_ADC);
2450 /* set to composite video */
2451 btand(~BT848_CONTROL_COMP, BT848_E_CONTROL);
2452 btand(~BT848_CONTROL_COMP, BT848_O_CONTROL);
2455 /* switch sync drive off */
2456 gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE);
2459 static void gvc1100_muxsel(struct bttv *btv, unsigned int input)
2461 static const int masks[] = {0x30, 0x01, 0x12, 0x23};
2462 gpio_write(masks[input%4]);
2465 /* LMLBT4x initialization - to allow access to GPIO bits for sensors input and
2468 GPIObit | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
2469 assignment | TI | O3|INx| O2| O1|IN4|IN3|IN2|IN1| | |
2471 IN - sensor inputs, INx - sensor inputs and TI XORed together
2472 O1,O2,O3 - alarm outputs (relays)
2474 OUT ENABLE 1 1 0 . 1 1 0 0 . 0 0 0 0 = 0x6C0
2478 static void init_lmlbt4x(struct bttv *btv)
2480 printk(KERN_DEBUG "LMLBT4x init\n");
2481 btwrite(0x000000, BT848_GPIO_REG_INP);
2482 gpio_inout(0xffffff, 0x0006C0);
2483 gpio_write(0x000000);
2486 static void sigmaSQ_muxsel(struct bttv *btv, unsigned int input)
2488 unsigned int inmux = input % 8;
2489 gpio_inout( 0xf, 0xf );
2490 gpio_bits( 0xf, inmux );
2493 static void sigmaSLC_muxsel(struct bttv *btv, unsigned int input)
2495 unsigned int inmux = input % 4;
2496 gpio_inout( 3<<9, 3<<9 );
2497 gpio_bits( 3<<9, inmux<<9 );
2500 /* ----------------------------------------------------------------------- */
2502 void bttv_reset_audio(struct bttv *btv)
2505 * BT878A has a audio-reset register.
2506 * 1. This register is an audio reset function but it is in
2507 * function-0 (video capture) address space.
2508 * 2. It is enough to do this once per power-up of the card.
2509 * 3. There is a typo in the Conexant doc -- it is not at
2510 * 0x5B, but at 0x058. (B is an odd-number, obviously a typo!).
2511 * --//Shrikumar 030609
2517 printk("bttv%d: BT878A ARESET\n",btv->c.nr);
2518 btwrite((1<<7), 0x058);
2523 /* initialization part one -- before registering i2c bus */
2524 void __devinit bttv_init_card1(struct bttv *btv)
2526 switch (btv->c.type) {
2527 case BTTV_HAUPPAUGE:
2528 case BTTV_HAUPPAUGE878:
2529 boot_msp34xx(btv,5);
2531 case BTTV_VOODOOTV_FM:
2532 boot_msp34xx(btv,20);
2534 case BTTV_AVERMEDIA98:
2535 boot_msp34xx(btv,11);
2537 case BTTV_HAUPPAUGEPVR:
2540 case BTTV_TWINHAN_DST:
2541 case BTTV_AVDVBT_771:
2542 btv->use_i2c_hw = 1;
2547 /* initialization part two -- after registering i2c bus */
2548 void __devinit bttv_init_card2(struct bttv *btv)
2551 btv->tuner_type = -1;
2553 if (BTTV_UNKNOWN == btv->c.type) {
2554 bttv_readee(btv,eeprom_data,0xa0);
2555 identify_by_eeprom(btv,eeprom_data);
2558 switch (btv->c.type) {
2562 case BTTV_PINNACLEPRO:
2564 miro_pinnacle_gpio(btv);
2566 case BTTV_FLYVIDEO_98:
2568 case BTTV_LIFE_FLYKIT:
2570 case BTTV_TYPHOON_TVIEW:
2571 case BTTV_CHRONOS_VS2:
2572 case BTTV_FLYVIDEO_98FM:
2573 case BTTV_FLYVIDEO2000:
2574 case BTTV_FLYVIDEO98EZ:
2575 case BTTV_CONFERENCETV:
2576 case BTTV_LIFETEC_9415:
2579 case BTTV_HAUPPAUGE:
2580 case BTTV_HAUPPAUGE878:
2581 case BTTV_HAUPPAUGEPVR:
2582 /* pick up some config infos from the eeprom */
2583 bttv_readee(btv,eeprom_data,0xa0);
2584 hauppauge_eeprom(btv);
2586 case BTTV_AVERMEDIA98:
2587 case BTTV_AVPHONE98:
2588 bttv_readee(btv,eeprom_data,0xa0);
2589 avermedia_eeprom(btv);
2594 case BTTV_PICOLO_TETRA_CHIP:
2595 picolo_tetra_init(btv);
2599 btv->has_matchbox = 1;
2600 btv->mbox_we = 0x20;
2602 btv->mbox_clk = 0x08;
2603 btv->mbox_data = 0x10;
2604 btv->mbox_mask = 0x38;
2606 case BTTV_VOBIS_BOOSTAR:
2608 terratec_active_radio_upgrade(btv);
2610 case BTTV_MAGICTVIEW061:
2611 if (btv->cardid == 0x3002144f) {
2613 printk("bttv%d: radio detected by subsystem id (CPH05x)\n",btv->c.nr);
2617 if (btv->cardid == 0x3060121a) {
2618 /* Fix up entry for 3DFX VoodooTV 100,
2619 which is an OEM STB card variant. */
2621 btv->tuner_type=TUNER_TEMIC_NTSC;
2624 case BTTV_OSPREY1x0:
2625 case BTTV_OSPREY1x0_848:
2626 case BTTV_OSPREY101_848:
2627 case BTTV_OSPREY1x1:
2628 case BTTV_OSPREY1x1_SVID:
2629 case BTTV_OSPREY2xx:
2630 case BTTV_OSPREY2x0_SVID:
2631 case BTTV_OSPREY2x0:
2632 case BTTV_OSPREY500:
2633 case BTTV_OSPREY540:
2634 case BTTV_OSPREY2000:
2635 bttv_readee(btv,eeprom_data,0xa0);
2638 case BTTV_IDS_EAGLE:
2639 init_ids_eagle(btv);
2641 case BTTV_MODTEC_205:
2642 bttv_readee(btv,eeprom_data,0xa0);
2650 /* pll configuration */
2651 if (!(btv->id==848 && btv->revision==0x11)) {
2652 /* defaults from card list */
2653 if (PLL_28 == bttv_tvcards[btv->c.type].pll) {
2654 btv->pll.pll_ifreq=28636363;
2655 btv->pll.pll_crystal=BT848_IFORM_XT0;
2657 if (PLL_35 == bttv_tvcards[btv->c.type].pll) {
2658 btv->pll.pll_ifreq=35468950;
2659 btv->pll.pll_crystal=BT848_IFORM_XT1;
2661 /* insmod options can override */
2662 switch (pll[btv->c.nr]) {
2664 btv->pll.pll_crystal = 0;
2665 btv->pll.pll_ifreq = 0;
2666 btv->pll.pll_ofreq = 0;
2668 case 1: /* 28 MHz */
2670 btv->pll.pll_ifreq = 28636363;
2671 btv->pll.pll_ofreq = 0;
2672 btv->pll.pll_crystal = BT848_IFORM_XT0;
2674 case 2: /* 35 MHz */
2676 btv->pll.pll_ifreq = 35468950;
2677 btv->pll.pll_ofreq = 0;
2678 btv->pll.pll_crystal = BT848_IFORM_XT1;
2682 btv->pll.pll_current = -1;
2684 /* tuner configuration (from card list / autodetect / insmod option) */
2685 if (UNSET != bttv_tvcards[btv->c.type].tuner_type)
2686 if(UNSET == btv->tuner_type)
2687 btv->tuner_type = bttv_tvcards[btv->c.type].tuner_type;
2688 if (UNSET != tuner[btv->c.nr])
2689 btv->tuner_type = tuner[btv->c.nr];
2690 printk("bttv%d: using tuner=%d\n",btv->c.nr,btv->tuner_type);
2691 if (btv->pinnacle_id != UNSET)
2692 bttv_call_i2c_clients(btv,AUDC_CONFIG_PINNACLE,
2694 if (btv->tuner_type != UNSET)
2695 bttv_call_i2c_clients(btv,TUNER_SET_TYPE,&btv->tuner_type);
2696 btv->svhs = bttv_tvcards[btv->c.type].svhs;
2697 if (svhs[btv->c.nr] != UNSET)
2698 btv->svhs = svhs[btv->c.nr];
2699 if (remote[btv->c.nr] != UNSET)
2700 btv->has_remote = remote[btv->c.nr];
2702 if (bttv_tvcards[btv->c.type].has_radio)
2704 if (bttv_tvcards[btv->c.type].has_remote)
2706 if (bttv_tvcards[btv->c.type].no_gpioirq)
2708 if (bttv_tvcards[btv->c.type].audio_hook)
2709 btv->audio_hook=bttv_tvcards[btv->c.type].audio_hook;
2711 if (bttv_tvcards[btv->c.type].digital_mode == DIGITAL_MODE_CAMERA) {
2712 /* detect Bt832 chip for quartzsight digital camera */
2713 if ((bttv_I2CRead(btv, I2C_BT832_ALT1, "Bt832") >=0) ||
2714 (bttv_I2CRead(btv, I2C_BT832_ALT2, "Bt832") >=0))
2721 /* try to detect audio/fader chips */
2722 if (!bttv_tvcards[btv->c.type].no_msp34xx &&
2723 bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx") >=0)
2724 request_module("msp3400");
2726 if (bttv_tvcards[btv->c.type].msp34xx_alt &&
2727 bttv_I2CRead(btv, I2C_MSP3400_ALT, "MSP34xx (alternate address)") >=0)
2728 request_module("msp3400");
2730 if (!bttv_tvcards[btv->c.type].no_tda9875 &&
2731 bttv_I2CRead(btv, I2C_TDA9875, "TDA9875") >=0)
2732 request_module("tda9875");
2734 if (!bttv_tvcards[btv->c.type].no_tda7432 &&
2735 bttv_I2CRead(btv, I2C_TDA7432, "TDA7432") >=0)
2736 request_module("tda7432");
2738 if (bttv_tvcards[btv->c.type].needs_tvaudio)
2739 request_module("tvaudio");
2743 if (btv->pinnacle_id != UNSET)
2745 if (0 == tda9887 && 0 == bttv_tvcards[btv->c.type].has_dvb &&
2746 bttv_I2CRead(btv, I2C_TDA9887, "TDA9887") >=0)
2749 request_module("tda9887");
2750 if (btv->tuner_type != UNSET)
2751 request_module("tuner");
2755 /* ----------------------------------------------------------------------- */
2756 /* some hauppauge specific stuff */
2758 static struct HAUPPAUGE_TUNER
2763 hauppauge_tuner[] __devinitdata =
2765 { TUNER_ABSENT, "" },
2766 { TUNER_ABSENT, "External" },
2767 { TUNER_ABSENT, "Unspecified" },
2768 { TUNER_PHILIPS_PAL, "Philips FI1216" },
2769 { TUNER_PHILIPS_SECAM, "Philips FI1216MF" },
2770 { TUNER_PHILIPS_NTSC, "Philips FI1236" },
2771 { TUNER_PHILIPS_PAL_I, "Philips FI1246" },
2772 { TUNER_PHILIPS_PAL_DK,"Philips FI1256" },
2773 { TUNER_PHILIPS_PAL, "Philips FI1216 MK2" },
2774 { TUNER_PHILIPS_SECAM, "Philips FI1216MF MK2" },
2775 { TUNER_PHILIPS_NTSC, "Philips FI1236 MK2" },
2776 { TUNER_PHILIPS_PAL_I, "Philips FI1246 MK2" },
2777 { TUNER_PHILIPS_PAL_DK,"Philips FI1256 MK2" },
2778 { TUNER_TEMIC_NTSC, "Temic 4032FY5" },
2779 { TUNER_TEMIC_PAL, "Temic 4002FH5" },
2780 { TUNER_TEMIC_PAL_I, "Temic 4062FY5" },
2781 { TUNER_PHILIPS_PAL, "Philips FR1216 MK2" },
2782 { TUNER_PHILIPS_SECAM, "Philips FR1216MF MK2" },
2783 { TUNER_PHILIPS_NTSC, "Philips FR1236 MK2" },
2784 { TUNER_PHILIPS_PAL_I, "Philips FR1246 MK2" },
2785 { TUNER_PHILIPS_PAL_DK,"Philips FR1256 MK2" },
2786 { TUNER_PHILIPS_PAL, "Philips FM1216" },
2787 { TUNER_PHILIPS_SECAM, "Philips FM1216MF" },
2788 { TUNER_PHILIPS_NTSC, "Philips FM1236" },
2789 { TUNER_PHILIPS_PAL_I, "Philips FM1246" },
2790 { TUNER_PHILIPS_PAL_DK,"Philips FM1256" },
2791 { TUNER_TEMIC_4036FY5_NTSC, "Temic 4036FY5" },
2792 { TUNER_ABSENT, "Samsung TCPN9082D" },
2793 { TUNER_ABSENT, "Samsung TCPM9092P" },
2794 { TUNER_TEMIC_4006FH5_PAL, "Temic 4006FH5" },
2795 { TUNER_ABSENT, "Samsung TCPN9085D" },
2796 { TUNER_ABSENT, "Samsung TCPB9085P" },
2797 { TUNER_ABSENT, "Samsung TCPL9091P" },
2798 { TUNER_TEMIC_4039FR5_NTSC, "Temic 4039FR5" },
2799 { TUNER_PHILIPS_FQ1216ME, "Philips FQ1216 ME" },
2800 { TUNER_TEMIC_4066FY5_PAL_I, "Temic 4066FY5" },
2801 { TUNER_PHILIPS_NTSC, "Philips TD1536" },
2802 { TUNER_PHILIPS_NTSC, "Philips TD1536D" },
2803 { TUNER_PHILIPS_NTSC, "Philips FMR1236" }, /* mono radio */
2804 { TUNER_ABSENT, "Philips FI1256MP" },
2805 { TUNER_ABSENT, "Samsung TCPQ9091P" },
2806 { TUNER_TEMIC_4006FN5_MULTI_PAL, "Temic 4006FN5" },
2807 { TUNER_TEMIC_4009FR5_PAL, "Temic 4009FR5" },
2808 { TUNER_TEMIC_4046FM5, "Temic 4046FM5" },
2809 { TUNER_TEMIC_4009FN5_MULTI_PAL_FM, "Temic 4009FN5" },
2810 { TUNER_ABSENT, "Philips TD1536D_FH_44"},
2811 { TUNER_LG_NTSC_FM, "LG TPI8NSR01F"},
2812 { TUNER_LG_PAL_FM, "LG TPI8PSB01D"},
2813 { TUNER_LG_PAL, "LG TPI8PSB11D"},
2814 { TUNER_LG_PAL_I_FM, "LG TAPC-I001D"},
2815 { TUNER_LG_PAL_I, "LG TAPC-I701D"}
2818 static void modtec_eeprom(struct bttv *btv)
2820 if( strncmp(&(eeprom_data[0x1e]),"Temic 4066 FY5",14) ==0) {
2821 btv->tuner_type=TUNER_TEMIC_4066FY5_PAL_I;
2822 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
2823 btv->c.nr,&eeprom_data[0x1e]);
2824 } else if (strncmp(&(eeprom_data[0x1e]),"Alps TSBB5",10) ==0) {
2825 btv->tuner_type=TUNER_ALPS_TSBB5_PAL_I;
2826 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
2827 btv->c.nr,&eeprom_data[0x1e]);
2828 } else if (strncmp(&(eeprom_data[0x1e]),"Philips FM1246",14) ==0) {
2829 btv->tuner_type=TUNER_PHILIPS_NTSC;
2830 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
2831 btv->c.nr,&eeprom_data[0x1e]);
2833 printk("bttv%d: Modtec: Unknown TunerString: %s\n",
2834 btv->c.nr,&eeprom_data[0x1e]);
2838 static void __devinit hauppauge_eeprom(struct bttv *btv)
2840 unsigned int blk2,tuner,radio,model;
2842 if (eeprom_data[0] != 0x84 || eeprom_data[2] != 0)
2843 printk(KERN_WARNING "bttv%d: Hauppauge eeprom: invalid\n",
2846 /* Block 2 starts after len+3 bytes header */
2847 blk2 = eeprom_data[1] + 3;
2849 /* decode + use some config infos */
2850 model = eeprom_data[12] << 8 | eeprom_data[11];
2851 tuner = eeprom_data[9];
2852 radio = eeprom_data[blk2-1] & 0x01;
2854 if (tuner < ARRAY_SIZE(hauppauge_tuner))
2855 btv->tuner_type = hauppauge_tuner[tuner].id;
2860 printk(KERN_INFO "bttv%d: Hauppauge eeprom: model=%d, "
2861 "tuner=%s (%d), radio=%s\n",
2862 btv->c.nr, model, (tuner < ARRAY_SIZE(hauppauge_tuner)
2863 ? hauppauge_tuner[tuner].name : "?"),
2864 btv->tuner_type, radio ? "yes" : "no");
2867 static int terratec_active_radio_upgrade(struct bttv *btv)
2872 btv->has_matchbox = 1;
2873 btv->mbox_we = 0x10;
2874 btv->mbox_most = 0x20;
2875 btv->mbox_clk = 0x08;
2876 btv->mbox_data = 0x04;
2877 btv->mbox_mask = 0x3c;
2879 btv->mbox_iow = 1 << 8;
2880 btv->mbox_ior = 1 << 9;
2881 btv->mbox_csel = 1 << 10;
2884 tea5757_write(btv, 5 * freq + 0x358); // write 0x1ed8
2885 if (0x1ed8 == tea5757_read(btv)) {
2886 printk("bttv%d: Terratec Active Radio Upgrade found.\n",
2889 btv->has_matchbox = 1;
2892 btv->has_matchbox = 0;
2898 /* ----------------------------------------------------------------------- */
2901 * minimal bootstrap for the WinTV/PVR -- upload altera firmware.
2903 * The hcwamc.rbf firmware file is on the Hauppauge driver CD. Have
2904 * a look at Pvr/pvr45xxx.EXE (self-extracting zip archive, can be
2905 * unpacked with unzip).
2907 #define PVR_GPIO_DELAY 10
2909 #define BTTV_ALT_DATA 0x000001
2910 #define BTTV_ALT_DCLK 0x100000
2911 #define BTTV_ALT_NCONFIG 0x800000
2913 static int __devinit pvr_altera_load(struct bttv *btv, u8 *micro, u32 microlen)
2919 gpio_inout(0xffffff,BTTV_ALT_DATA|BTTV_ALT_DCLK|BTTV_ALT_NCONFIG);
2921 udelay(PVR_GPIO_DELAY);
2923 gpio_write(BTTV_ALT_NCONFIG);
2924 udelay(PVR_GPIO_DELAY);
2926 for (n = 0; n < microlen; n++) {
2928 for ( i = 0 ; i < 8 ; i++ ) {
2929 gpio_bits(BTTV_ALT_DCLK,0);
2931 gpio_bits(BTTV_ALT_DATA,BTTV_ALT_DATA);
2933 gpio_bits(BTTV_ALT_DATA,0);
2934 gpio_bits(BTTV_ALT_DCLK,BTTV_ALT_DCLK);
2938 gpio_bits(BTTV_ALT_DCLK,0);
2939 udelay(PVR_GPIO_DELAY);
2941 /* begin Altera init loop (Not necessary,but doesn't hurt) */
2942 for (i = 0 ; i < 30 ; i++) {
2943 gpio_bits(BTTV_ALT_DCLK,0);
2944 gpio_bits(BTTV_ALT_DCLK,BTTV_ALT_DCLK);
2946 gpio_bits(BTTV_ALT_DCLK,0);
2950 int __devinit pvr_boot(struct bttv *btv)
2952 const struct firmware *fw_entry;
2955 rc = request_firmware(&fw_entry, "hcwamc.rbf", &btv->c.pci->dev);
2957 printk(KERN_WARNING "bttv%d: no altera firmware [via hotplug]\n",
2961 rc = pvr_altera_load(btv, fw_entry->data, fw_entry->size);
2962 printk(KERN_INFO "bttv%d: altera firmware upload %s\n",
2963 btv->c.nr, (rc < 0) ? "failed" : "ok");
2964 release_firmware(fw_entry);
2968 /* ----------------------------------------------------------------------- */
2969 /* some osprey specific stuff */
2971 static void __devinit osprey_eeprom(struct bttv *btv)
2974 unsigned char *ee = eeprom_data;
2975 unsigned long serial = 0;
2977 if (btv->c.type == 0) {
2978 /* this might be an antique... check for MMAC label in eeprom */
2979 if ((ee[0]=='M') && (ee[1]=='M') && (ee[2]=='A') && (ee[3]=='C')) {
2980 unsigned char checksum = 0;
2981 for (i =0; i<21; i++)
2983 if (checksum != ee[21])
2985 btv->c.type = BTTV_OSPREY1x0_848;
2986 for (i = 12; i < 21; i++)
2987 serial *= 10, serial += ee[i] - '0';
2990 unsigned short type;
2993 for(; offset < 8*16; offset += 16) {
2994 unsigned short checksum = 0;
2995 /* verify the checksum */
2996 for(i = 0; i<14; i++) checksum += ee[i+offset];
2997 checksum = ~checksum; /* no idea why */
2998 if ((((checksum>>8)&0x0FF) == ee[offset+14]) &&
2999 ((checksum & 0x0FF) == ee[offset+15])) {
3007 /* found a valid descriptor */
3008 type = (ee[offset+4]<<8) | (ee[offset+5]);
3014 btv->c.type = BTTV_OSPREY1x0_848;
3017 btv->c.type = BTTV_OSPREY101_848;
3023 btv->c.type = BTTV_OSPREY1x0;
3027 btv->c.type = BTTV_OSPREY1x1;
3032 btv->c.type = BTTV_OSPREY1x1_SVID;
3038 btv->c.type = BTTV_OSPREY2xx;
3042 btv->c.type = BTTV_OSPREY2x0_SVID;
3045 btv->c.type = BTTV_OSPREY500;
3049 btv->c.type = BTTV_OSPREY540;
3050 /* bttv_osprey_540_init(btv); */
3054 btv->c.type = BTTV_OSPREY2x0;
3055 //enable output on select control lines
3056 gpio_inout(0xffffff,0x000303);
3059 /* unknown...leave generic, but get serial # */
3062 serial = (ee[offset+6] << 24)
3063 | (ee[offset+7] << 16)
3064 | (ee[offset+8] << 8)
3068 printk(KERN_INFO "bttv%d: osprey eeprom: card=%d name=%s serial=%ld\n",
3069 btv->c.nr, btv->c.type, bttv_tvcards[btv->c.type].name,serial);
3072 /* ----------------------------------------------------------------------- */
3073 /* AVermedia specific stuff, from bktr_card.c */
3075 int tuner_0_table[] = {
3076 TUNER_PHILIPS_NTSC, TUNER_PHILIPS_PAL /* PAL-BG*/,
3077 TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL /* PAL-I*/,
3078 TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL,
3079 TUNER_PHILIPS_SECAM, TUNER_PHILIPS_SECAM,
3080 TUNER_PHILIPS_SECAM, TUNER_PHILIPS_PAL};
3082 int tuner_0_fm_table[] = {
3083 PHILIPS_FR1236_NTSC, PHILIPS_FR1216_PAL,
3084 PHILIPS_FR1216_PAL, PHILIPS_FR1216_PAL,
3085 PHILIPS_FR1216_PAL, PHILIPS_FR1216_PAL,
3086 PHILIPS_FR1236_SECAM, PHILIPS_FR1236_SECAM,
3087 PHILIPS_FR1236_SECAM, PHILIPS_FR1216_PAL};
3090 int tuner_1_table[] = {
3091 TUNER_TEMIC_NTSC, TUNER_TEMIC_PAL,
3092 TUNER_TEMIC_PAL, TUNER_TEMIC_PAL,
3093 TUNER_TEMIC_PAL, TUNER_TEMIC_PAL,
3094 TUNER_TEMIC_4012FY5, TUNER_TEMIC_4012FY5, //TUNER_TEMIC_SECAM
3095 TUNER_TEMIC_4012FY5, TUNER_TEMIC_PAL};
3097 static void __devinit avermedia_eeprom(struct bttv *btv)
3099 int tuner_make,tuner_tv_fm,tuner_format,tuner=0;
3101 tuner_make = (eeprom_data[0x41] & 0x7);
3102 tuner_tv_fm = (eeprom_data[0x41] & 0x18) >> 3;
3103 tuner_format = (eeprom_data[0x42] & 0xf0) >> 4;
3104 btv->has_remote = (eeprom_data[0x42] & 0x01);
3106 if (tuner_make == 0 || tuner_make == 2)
3107 if(tuner_format <=9)
3108 tuner = tuner_0_table[tuner_format];
3109 if (tuner_make == 1)
3110 if(tuner_format <=9)
3111 tuner = tuner_1_table[tuner_format];
3113 printk(KERN_INFO "bttv%d: Avermedia eeprom[0x%02x%02x]: tuner=",
3114 btv->c.nr,eeprom_data[0x41],eeprom_data[0x42]);
3116 btv->tuner_type=tuner;
3119 printk("Unknown type");
3120 printk(" radio:%s remote control:%s\n",
3121 tuner_tv_fm ? "yes" : "no",
3122 btv->has_remote ? "yes" : "no");
3125 /* used on Voodoo TV/FM (Voodoo 200), S0 wired to 0x10000 */
3126 void bttv_tda9880_setnorm(struct bttv *btv, int norm)
3128 // fix up our card entry
3129 if(norm==VIDEO_MODE_NTSC) {
3130 bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[0]=0x957fff;
3131 bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[4]=0x957fff;
3132 dprintk("bttv_tda9880_setnorm to NTSC\n");
3135 bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[0]=0x947fff;
3136 bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[4]=0x947fff;
3137 dprintk("bttv_tda9880_setnorm to PAL\n");
3139 // set GPIO according
3140 gpio_bits(bttv_tvcards[btv->c.type].gpiomask,
3141 bttv_tvcards[btv->c.type].audiomux[btv->audio]);
3146 * reset/enable the MSP on some Hauppauge cards
3147 * Thanks to Kyösti Mälkki (kmalkki@cc.hut.fi)!
3152 static void __devinit boot_msp34xx(struct bttv *btv, int pin)
3154 int mask = (1 << pin);
3156 gpio_inout(mask,mask);
3159 gpio_bits(mask,mask);
3162 bttv_gpio_tracking(btv,"msp34xx");
3164 printk(KERN_INFO "bttv%d: Hauppauge/Voodoo msp34xx: reset line "
3165 "init [%d]\n", btv->c.nr, pin);
3168 static void __devinit boot_bt832(struct bttv *btv)
3172 switch (btv->c.type) {
3173 case BTTV_PXELVWPLTVPAK:
3174 resetbit = 0x400000;
3176 case BTTV_MODTEC_205:
3183 request_module("bt832");
3184 bttv_call_i2c_clients(btv, BT832_HEXDUMP, NULL);
3186 printk("bttv%d: Reset Bt832 [line=0x%x]\n",btv->c.nr,resetbit);
3188 gpio_inout(resetbit, resetbit);
3190 gpio_bits(resetbit, resetbit);
3192 gpio_bits(resetbit, 0);
3195 // bt832 on pixelview changes from i2c 0x8a to 0x88 after
3196 // being reset as above. So we must follow by this:
3197 bttv_call_i2c_clients(btv, BT832_REATTACH, NULL);
3200 /* ----------------------------------------------------------------------- */
3201 /* Imagenation L-Model PXC200 Framegrabber */
3202 /* This is basically the same procedure as
3203 * used by Alessandro Rubini in his pxc200
3204 * driver, but using BTTV functions */
3206 static void __devinit init_PXC200(struct bttv *btv)
3208 static int vals[] __devinitdata = { 0x08, 0x09, 0x0a, 0x0b, 0x0d, 0x0d,
3209 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
3215 /* Initialise GPIO-connevted stuff */
3216 gpio_inout(0xffffff, (1<<13));
3220 /* GPIO inputs are pulled up, so no need to drive
3221 * reset pin any longer */
3222 gpio_bits(0xffffff, 0);
3224 bttv_gpio_tracking(btv,"pxc200");
3226 /* we could/should try and reset/control the AD pots? but
3227 right now we simply turned off the crushing. Without
3228 this the AGC drifts drifts
3229 remember the EN is reverse logic -->
3230 setting BT848_ADC_AGC_EN disable the AGC
3231 tboult@eecs.lehigh.edu
3234 btwrite(BT848_ADC_RESERVED|BT848_ADC_AGC_EN, BT848_ADC);
3236 /* Initialise MAX517 DAC */
3237 printk(KERN_INFO "Setting DAC reference voltage level ...\n");
3238 bttv_I2CWrite(btv,0x5E,0,0x80,1);
3240 /* Initialise 12C508 PIC */
3241 /* The I2CWrite and I2CRead commmands are actually to the
3242 * same chips - but the R/W bit is included in the address
3243 * argument so the numbers are different */
3246 printk(KERN_INFO "Initialising 12C508 PIC chip ...\n");
3248 /* First of all, enable the clock line. This is used in the PXC200-F */
3249 val = btread(BT848_GPIO_DMA_CTL);
3250 val |= BT848_GPIO_DMA_CTL_GPCLKMODE;
3251 btwrite(val, BT848_GPIO_DMA_CTL);
3253 /* Then, push to 0 the reset pin long enough to reset the *
3254 * device same as above for the reset line, but not the same
3255 * value sent to the GPIO-connected stuff
3256 * which one is the good one? */
3257 gpio_inout(0xffffff,(1<<2));
3262 for (i = 0; i < ARRAY_SIZE(vals); i++) {
3263 tmp=bttv_I2CWrite(btv,0x1E,0,vals[i],1);
3266 "I2C Write(%2.2x) = %i\nI2C Read () = %2.2x\n\n",
3267 vals[i],tmp,bttv_I2CRead(btv,0x1F,NULL));
3271 printk(KERN_INFO "PXC200 Initialised.\n");
3275 /* ----------------------------------------------------------------------- */
3276 /* Miro Pro radio stuff -- the tea5757 is connected to some GPIO ports */
3278 * Copyright (c) 1999 Csaba Halasz <qgehali@uni-miskolc.hu>
3279 * This code is placed under the terms of the GNU General Public License
3281 * Brutally hacked by Dan Sheridan <dan.sheridan@contact.org.uk> djs52 8/3/00
3284 void bus_low(struct bttv *btv, int bit)
3286 if (btv->mbox_ior) {
3287 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3288 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3295 if (btv->mbox_ior) {
3296 gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
3301 void bus_high(struct bttv *btv, int bit)
3303 if (btv->mbox_ior) {
3304 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3305 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3312 if (btv->mbox_ior) {
3313 gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
3318 int bus_in(struct bttv *btv, int bit)
3320 if (btv->mbox_ior) {
3321 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3322 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3325 gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
3328 return gpio_read() & (bit);
3331 /* TEA5757 register bits */
3332 #define TEA_FREQ 0:14
3333 #define TEA_BUFFER 15:15
3335 #define TEA_SIGNAL_STRENGTH 16:17
3337 #define TEA_PORT1 18:18
3338 #define TEA_PORT0 19:19
3340 #define TEA_BAND 20:21
3341 #define TEA_BAND_FM 0
3342 #define TEA_BAND_MW 1
3343 #define TEA_BAND_LW 2
3344 #define TEA_BAND_SW 3
3346 #define TEA_MONO 22:22
3347 #define TEA_ALLOW_STEREO 0
3348 #define TEA_FORCE_MONO 1
3350 #define TEA_SEARCH_DIRECTION 23:23
3351 #define TEA_SEARCH_DOWN 0
3352 #define TEA_SEARCH_UP 1
3354 #define TEA_STATUS 24:24
3355 #define TEA_STATUS_TUNED 0
3356 #define TEA_STATUS_SEARCHING 1
3358 /* Low-level stuff */
3359 static int tea5757_read(struct bttv *btv)
3361 unsigned long timeout;
3365 /* better safe than sorry */
3366 gpio_inout(btv->mbox_mask, btv->mbox_clk | btv->mbox_we);
3368 if (btv->mbox_ior) {
3369 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3370 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3375 bttv_gpio_tracking(btv,"tea5757 read");
3377 bus_low(btv,btv->mbox_we);
3378 bus_low(btv,btv->mbox_clk);
3381 timeout= jiffies + HZ;
3383 // wait for DATA line to go low; error if it doesn't
3384 while (bus_in(btv,btv->mbox_data) && time_before(jiffies, timeout))
3386 if (bus_in(btv,btv->mbox_data)) {
3387 printk(KERN_WARNING "bttv%d: tea5757: read timeout\n",btv->c.nr);
3391 dprintk("bttv%d: tea5757:",btv->c.nr);
3392 for(i = 0; i < 24; i++)
3395 bus_high(btv,btv->mbox_clk);
3397 dprintk("%c",(bus_in(btv,btv->mbox_most) == 0)?'T':'-');
3398 bus_low(btv,btv->mbox_clk);
3400 value |= (bus_in(btv,btv->mbox_data) == 0)?0:1; /* MSB first */
3401 dprintk("%c", (bus_in(btv,btv->mbox_most) == 0)?'S':'M');
3403 dprintk("\nbttv%d: tea5757: read 0x%X\n", btv->c.nr, value);
3407 static int tea5757_write(struct bttv *btv, int value)
3412 gpio_inout(btv->mbox_mask, btv->mbox_clk | btv->mbox_we | btv->mbox_data);
3414 if (btv->mbox_ior) {
3415 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3416 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3420 bttv_gpio_tracking(btv,"tea5757 write");
3422 dprintk("bttv%d: tea5757: write 0x%X\n", btv->c.nr, value);
3423 bus_low(btv,btv->mbox_clk);
3424 bus_high(btv,btv->mbox_we);
3425 for(i = 0; i < 25; i++)
3427 if (reg & 0x1000000)
3428 bus_high(btv,btv->mbox_data);
3430 bus_low(btv,btv->mbox_data);
3432 bus_high(btv,btv->mbox_clk);
3434 bus_low(btv,btv->mbox_clk);
3437 bus_low(btv,btv->mbox_we); /* unmute !!! */
3441 void tea5757_set_freq(struct bttv *btv, unsigned short freq)
3443 dprintk("tea5757_set_freq %d\n",freq);
3444 tea5757_write(btv, 5 * freq + 0x358); /* add 10.7MHz (see docs) */
3446 /* breaks Miro PCTV */
3447 value = tea5757_read(btv);
3448 dprintk("bttv%d: tea5757 readback=0x%x\n",btv->c.nr,value);
3453 /* ----------------------------------------------------------------------- */
3456 void winview_audio(struct bttv *btv, struct video_audio *v, int set)
3458 /* PT2254A programming Jon Tombs, jon@gte.esi.us.es */
3459 int bits_out, loops, vol, data;
3462 /* Fixed by Leandro Lucarella <luca@linuxmendoza.org.ar (07/31/01) */
3463 v->flags |= VIDEO_AUDIO_VOLUME;
3467 /* 32 levels logarithmic */
3468 vol = 32 - ((v->volume>>11));
3470 bits_out = (PT2254_DBS_IN_2>>(vol%5));
3472 bits_out |= (PT2254_DBS_IN_10>>(vol/5));
3473 bits_out |= PT2254_L_CHANNEL | PT2254_R_CHANNEL;
3475 data &= ~(WINVIEW_PT2254_CLK| WINVIEW_PT2254_DATA|
3476 WINVIEW_PT2254_STROBE);
3477 for (loops = 17; loops >= 0 ; loops--) {
3478 if (bits_out & (1<<loops))
3479 data |= WINVIEW_PT2254_DATA;
3481 data &= ~WINVIEW_PT2254_DATA;
3484 data |= WINVIEW_PT2254_CLK;
3487 data &= ~WINVIEW_PT2254_CLK;
3490 data |= WINVIEW_PT2254_STROBE;
3491 data &= ~WINVIEW_PT2254_DATA;
3494 data &= ~WINVIEW_PT2254_STROBE;
3498 /* ----------------------------------------------------------------------- */
3499 /* mono/stereo control for various cards (which don't use i2c chips but */
3500 /* connect something to the GPIO pins */
3503 gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set)
3505 unsigned int con = 0;
3508 gpio_inout(0x300, 0x300);
3509 if (v->mode & VIDEO_SOUND_LANG1)
3511 if (v->mode & VIDEO_SOUND_LANG2)
3513 if (v->mode & VIDEO_SOUND_STEREO)
3515 // if (v->mode & VIDEO_SOUND_MONO)
3517 gpio_bits(0x300, con);
3519 v->mode = VIDEO_SOUND_STEREO |
3520 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3525 gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set)
3527 unsigned int val, con;
3529 #if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0)
3530 if (btv->radio_user)
3540 if (v->mode & VIDEO_SOUND_LANG2) {
3541 if (v->mode & VIDEO_SOUND_LANG1) {
3550 if (con != (val & 0x300)) {
3551 gpio_bits(0x300, con);
3553 bttv_gpio_tracking(btv,"gvbctv5pci");
3556 switch (val & 0x70) {
3558 v->mode = VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3561 v->mode = VIDEO_SOUND_LANG2;
3564 v->mode = VIDEO_SOUND_LANG1;
3567 v->mode = VIDEO_SOUND_STEREO;
3570 v->mode = VIDEO_SOUND_MONO;
3573 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3574 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3580 * Mario Medina Nussbaum <medisoft@alohabbs.org.mx>
3581 * I discover that on BT848_GPIO_DATA address a byte 0xcce enable stereo,
3582 * 0xdde enables mono and 0xccd enables sap
3584 * Petr Vandrovec <VANDROVE@vc.cvut.cz>
3585 * P.S.: At least mask in line above is wrong - GPIO pins 3,2 select
3586 * input/output sound connection, so both must be set for output mode.
3588 * Looks like it's needed only for the "tvphone", the "tvphone 98"
3589 * handles this with a tda9840
3593 avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, int set)
3598 if (v->mode & VIDEO_SOUND_LANG2) /* SAP */
3600 if (v->mode & VIDEO_SOUND_STEREO)
3603 gpio_bits(0x03,val);
3605 bttv_gpio_tracking(btv,"avermedia");
3608 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3615 avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v, int set)
3620 if (v->mode & VIDEO_SOUND_LANG2) /* SAP */
3622 if (v->mode & VIDEO_SOUND_STEREO) /* STEREO */
3624 btaor(val, ~0x03, BT848_GPIO_DATA);
3626 bttv_gpio_tracking(btv,"avermedia");
3628 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3629 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3634 /* Lifetec 9415 handling */
3636 lt9415_audio(struct bttv *btv, struct video_audio *v, int set)
3640 if (gpio_read() & 0x4000) {
3641 v->mode = VIDEO_SOUND_MONO;
3646 if (v->mode & VIDEO_SOUND_LANG2) /* A2 SAP */
3648 if (v->mode & VIDEO_SOUND_STEREO) /* A2 stereo */
3650 if ((v->mode & VIDEO_SOUND_LANG1) ||
3651 (v->mode & VIDEO_SOUND_MONO))
3653 gpio_bits(0x0880, val);
3655 bttv_gpio_tracking(btv,"lt9415");
3657 /* autodetect doesn't work with this card :-( */
3658 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3659 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3664 // TDA9821 on TerraTV+ Bt848, Bt878
3666 terratv_audio(struct bttv *btv, struct video_audio *v, int set)
3668 unsigned int con = 0;
3671 gpio_inout(0x180000,0x180000);
3672 if (v->mode & VIDEO_SOUND_LANG2)
3674 if (v->mode & VIDEO_SOUND_STEREO)
3676 gpio_bits(0x180000, con);
3678 bttv_gpio_tracking(btv,"terratv");
3680 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3681 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3686 winfast2000_audio(struct bttv *btv, struct video_audio *v, int set)
3688 unsigned long val = 0;
3691 /*btor (0xc32000, BT848_GPIO_OUT_EN);*/
3692 if (v->mode & VIDEO_SOUND_MONO) /* Mono */
3694 if (v->mode & VIDEO_SOUND_LANG1) /* Mono */
3696 if (v->mode & VIDEO_SOUND_LANG2) /* SAP */
3698 if (v->mode & VIDEO_SOUND_STEREO) /* Stereo */
3701 gpio_bits(0x430000, val);
3703 bttv_gpio_tracking(btv,"winfast2000");
3706 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3707 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3712 * Dariusz Kowalewski <darekk@automex.pl>
3713 * sound control for Prolink PV-BT878P+9B (PixelView PlayTV Pro FM+NICAM
3714 * revision 9B has on-board TDA9874A sound decoder).
3716 * Note: There are card variants without tda9874a. Forcing the "stereo sound route"
3717 * will mute this cards.
3720 pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set)
3722 unsigned int val = 0;
3724 #if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0)
3725 if (btv->radio_user)
3733 if (v->mode & VIDEO_SOUND_MONO) {
3736 if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2))
3737 || (v->mode & VIDEO_SOUND_STEREO)) {
3741 gpio_bits(0x03,val);
3743 bttv_gpio_tracking(btv,"pvbt878p9b");
3746 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3747 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3752 * Dariusz Kowalewski <darekk@automex.pl>
3753 * sound control for FlyVideo 2000S (with tda9874 decoder)
3754 * based on pvbt878p9b_audio() - this is not tested, please fix!!!
3757 fv2000s_audio(struct bttv *btv, struct video_audio *v, int set)
3759 unsigned int val = 0xffff;
3761 #if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0)
3762 if (btv->radio_user)
3769 if (v->mode & VIDEO_SOUND_MONO) {
3772 if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2))
3773 || (v->mode & VIDEO_SOUND_STEREO)) {
3774 val = 0x1080; //-dk-???: 0x0880, 0x0080, 0x1800 ...
3776 if (val != 0xffff) {
3777 gpio_bits(0x1800, val);
3779 bttv_gpio_tracking(btv,"fv2000s");
3782 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3783 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3788 * sound control for Canopus WinDVR PCI
3789 * Masaki Suzuki <masaki@btree.org>
3792 windvr_audio(struct bttv *btv, struct video_audio *v, int set)
3794 unsigned long val = 0;
3797 if (v->mode & VIDEO_SOUND_MONO)
3799 if (v->mode & VIDEO_SOUND_LANG1)
3801 if (v->mode & VIDEO_SOUND_LANG2)
3803 if (v->mode & VIDEO_SOUND_STEREO)
3806 gpio_bits(0x140000, val);
3808 bttv_gpio_tracking(btv,"windvr");
3811 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3812 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3817 * sound control for AD-TVK503
3818 * Hiroshi Takekawa <sian@big.or.jp>
3821 adtvk503_audio(struct bttv *btv, struct video_audio *v, int set)
3823 unsigned int con = 0xffffff;
3825 //btaor(0x1e0000, ~0x1e0000, BT848_GPIO_OUT_EN);
3828 //btor(***, BT848_GPIO_OUT_EN);
3829 if (v->mode & VIDEO_SOUND_LANG1)
3831 if (v->mode & VIDEO_SOUND_LANG2)
3833 if (v->mode & VIDEO_SOUND_STEREO)
3835 if (v->mode & VIDEO_SOUND_MONO)
3837 if (con != 0xffffff) {
3838 gpio_bits(0x1e0000,con);
3840 bttv_gpio_tracking(btv, "adtvk503");
3843 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3844 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3848 /* RemoteVision MX (rv605) muxsel helper [Miguel Freitas]
3850 * This is needed because rv605 don't use a normal multiplex, but a crosspoint
3851 * switch instead (CD22M3494E). This IC can have multiple active connections
3852 * between Xn (input) and Yn (output) pins. We need to clear any existing
3853 * connection prior to establish a new one, pulsing the STROBE pin.
3855 * The board hardwire Y0 (xpoint) to MUX1 and MUXOUT to Yin.
3856 * GPIO pins are wired as:
3857 * GPIO[0:3] - AX[0:3] (xpoint) - P1[0:3] (microcontroler)
3858 * GPIO[4:6] - AY[0:2] (xpoint) - P1[4:6] (microcontroler)
3859 * GPIO[7] - DATA (xpoint) - P1[7] (microcontroler)
3860 * GPIO[8] - - P3[5] (microcontroler)
3861 * GPIO[9] - RESET (xpoint) - P3[6] (microcontroler)
3862 * GPIO[10] - STROBE (xpoint) - P3[7] (microcontroler)
3863 * GPINTR - - P3[4] (microcontroler)
3865 * The microcontroler is a 80C32 like. It should be possible to change xpoint
3866 * configuration either directly (as we are doing) or using the microcontroler
3867 * which is also wired to I2C interface. I have no further info on the
3868 * microcontroler features, one would need to disassembly the firmware.
3869 * note: the vendor refused to give any information on this product, all
3870 * that stuff was found using a multimeter! :)
3872 static void rv605_muxsel(struct bttv *btv, unsigned int input)
3874 /* reset all conections */
3875 gpio_bits(0x200,0x200);
3877 gpio_bits(0x200,0x000);
3880 /* create a new conection */
3881 gpio_bits(0x480,0x080);
3882 gpio_bits(0x480,0x480);
3884 gpio_bits(0x480,0x080);
3888 // The Grandtec X-Guard framegrabber card uses two Dual 4-channel
3889 // video multiplexers to provide up to 16 video inputs. These
3890 // multiplexers are controlled by the lower 8 GPIO pins of the
3891 // bt878. The multiplexers probably Pericom PI5V331Q or similar.
3893 // xxx0 is pin xxx of multiplexer U5,
3894 // yyy1 is pin yyy of multiplexer U2
3906 static void xguard_muxsel(struct bttv *btv, unsigned int input)
3908 static const int masks[] = {
3909 ENB0, ENB0|IN00, ENB0|IN10, ENB0|IN00|IN10,
3910 ENA0, ENA0|IN00, ENA0|IN10, ENA0|IN00|IN10,
3911 ENB1, ENB1|IN01, ENB1|IN11, ENB1|IN01|IN11,
3912 ENA1, ENA1|IN01, ENA1|IN11, ENA1|IN01|IN11,
3914 gpio_write(masks[input%16]);
3916 static void picolo_tetra_init(struct bttv *btv)
3918 /*This is the video input redirection fonctionality : I DID NOT USED IT. */
3919 btwrite (0x08<<16,BT848_GPIO_DATA);/*GPIO[19] [==> 4053 B+C] set to 1 */
3920 btwrite (0x04<<16,BT848_GPIO_DATA);/*GPIO[18] [==> 4053 A] set to 1*/
3922 static void picolo_tetra_muxsel (struct bttv* btv, unsigned int input)
3925 dprintk (KERN_DEBUG "bttv%d : picolo_tetra_muxsel => input = %d\n",btv->c.nr,input);
3926 /*Just set the right path in the analog multiplexers : channel 1 -> 4 ==> Analog Mux ==> MUX0*/
3927 /*GPIO[20]&GPIO[21] used to choose the right input*/
3928 btwrite (input<<20,BT848_GPIO_DATA);
3933 * ivc120_muxsel [Added by Alan Garfield <alan@fromorbit.com>]
3935 * The IVC120G security card has 4 i2c controlled TDA8540 matrix
3936 * swichers to provide 16 channels to MUX0. The TDA8540's have
3937 * 4 indepedant outputs and as such the IVC120G also has the
3938 * optional "Monitor Out" bus. This allows the card to be looking
3939 * at one input while the monitor is looking at another.
3941 * Since I've couldn't be bothered figuring out how to add an
3942 * independant muxsel for the monitor bus, I've just set it to
3943 * whatever the card is looking at.
3945 * OUT0 of the TDA8540's is connected to MUX0 (0x03)
3946 * OUT1 of the TDA8540's is connected to "Monitor Out" (0x0C)
3948 * TDA8540_ALT3 IN0-3 = Channel 13 - 16 (0x03)
3949 * TDA8540_ALT4 IN0-3 = Channel 1 - 4 (0x03)
3950 * TDA8540_ALT5 IN0-3 = Channel 5 - 8 (0x03)
3951 * TDA8540_ALT6 IN0-3 = Channel 9 - 12 (0x03)
3955 /* All 7 possible sub-ids for the TDA8540 Matrix Switcher */
3956 #define I2C_TDA8540 0x90
3957 #define I2C_TDA8540_ALT1 0x92
3958 #define I2C_TDA8540_ALT2 0x94
3959 #define I2C_TDA8540_ALT3 0x96
3960 #define I2C_TDA8540_ALT4 0x98
3961 #define I2C_TDA8540_ALT5 0x9a
3962 #define I2C_TDA8540_ALT6 0x9c
3964 static void ivc120_muxsel(struct bttv *btv, unsigned int input)
3967 int key = input % 4;
3968 int matrix = input / 4;
3970 dprintk("bttv%d: ivc120_muxsel: Input - %02d | TDA - %02d | In - %02d\n",
3971 btv->c.nr, input, matrix, key);
3973 // Handles the input selection on the TDA8540's
3974 bttv_I2CWrite(btv, I2C_TDA8540_ALT3, 0x00,
3975 ((matrix == 3) ? (key | key << 2) : 0x00), 1);
3976 bttv_I2CWrite(btv, I2C_TDA8540_ALT4, 0x00,
3977 ((matrix == 0) ? (key | key << 2) : 0x00), 1);
3978 bttv_I2CWrite(btv, I2C_TDA8540_ALT5, 0x00,
3979 ((matrix == 1) ? (key | key << 2) : 0x00), 1);
3980 bttv_I2CWrite(btv, I2C_TDA8540_ALT6, 0x00,
3981 ((matrix == 2) ? (key | key << 2) : 0x00), 1);
3983 // Handles the output enables on the TDA8540's
3984 bttv_I2CWrite(btv, I2C_TDA8540_ALT3, 0x02,
3985 ((matrix == 3) ? 0x03 : 0x00), 1); // 13 - 16
3986 bttv_I2CWrite(btv, I2C_TDA8540_ALT4, 0x02,
3987 ((matrix == 0) ? 0x03 : 0x00), 1); // 1-4
3988 bttv_I2CWrite(btv, I2C_TDA8540_ALT5, 0x02,
3989 ((matrix == 1) ? 0x03 : 0x00), 1); // 5-8
3990 bttv_I2CWrite(btv, I2C_TDA8540_ALT6, 0x02,
3991 ((matrix == 2) ? 0x03 : 0x00), 1); // 9-12
3993 // Selects MUX0 for input on the 878
3994 btaor((0)<<5, ~(3<<5), BT848_IFORM);
3998 /* PXC200 muxsel helper
3999 * luke@syseng.anu.edu.au
4000 * another transplant
4001 * from Alessandro Rubini (rubini@linux.it)
4003 * There are 4 kinds of cards:
4004 * PXC200L which is bt848
4005 * PXC200F which is bt848 with PIC controlling mux
4006 * PXC200AL which is bt878
4007 * PXC200AF which is bt878 with PIC controlling mux
4009 #define PX_CFG_PXC200F 0x01
4010 #define PX_FLAG_PXC200A 0x00001000 /* a pxc200A is bt-878 based */
4011 #define PX_I2C_PIC 0x0f
4012 #define PX_PXC200A_CARDID 0x200a1295
4013 #define PX_I2C_CMD_CFG 0x00
4015 static void PXC200_muxsel(struct bttv *btv, unsigned int input)
4020 unsigned char buf[2];
4022 /* Read PIC config to determine if this is a PXC200F */
4026 rc=bttv_I2CWrite(btv,(PX_I2C_PIC<<1),buf[0],buf[1],1);
4028 printk(KERN_DEBUG "bttv%d: PXC200_muxsel: pic cfg write failed:%d\n", btv->c.nr,rc);
4029 /* not PXC ? do nothing */
4033 rc=bttv_I2CRead(btv,(PX_I2C_PIC<<1),NULL);
4034 if (!(rc & PX_CFG_PXC200F)) {
4035 printk(KERN_DEBUG "bttv%d: PXC200_muxsel: not PXC200F rc:%d \n", btv->c.nr,rc);
4040 /* The multiplexer in the 200F is handled by the GPIO port */
4041 /* get correct mapping between inputs */
4042 /* mux = bttv_tvcards[btv->type].muxsel[input] & 3; */
4043 /* ** not needed!? */
4046 /* make sure output pins are enabled */
4047 /* bitmask=0x30f; */
4049 /* check whether we have a PXC200A */
4050 if (btv->cardid == PX_PXC200A_CARDID) {
4051 bitmask ^= 0x180; /* use 7 and 9, not 8 and 9 */
4052 bitmask |= 7<<4; /* the DAC */
4054 btwrite(bitmask, BT848_GPIO_OUT_EN);
4056 bitmask = btread(BT848_GPIO_DATA);
4057 if (btv->cardid == PX_PXC200A_CARDID)
4058 bitmask = (bitmask & ~0x280) | ((mux & 2) << 8) | ((mux & 1) << 7);
4059 else /* older device */
4060 bitmask = (bitmask & ~0x300) | ((mux & 3) << 8);
4061 btwrite(bitmask,BT848_GPIO_DATA);
4064 * Was "to be safe, set the bt848 to input 0"
4065 * Actually, since it's ok at load time, better not messing
4066 * with these bits (on PXC200AF you need to set mux 2 here)
4068 * needed because bttv-driver sets mux before calling this function
4070 if (btv->cardid == PX_PXC200A_CARDID)
4071 btaor(2<<5, ~BT848_IFORM_MUXSEL, BT848_IFORM);
4072 else /* older device */
4073 btand(~BT848_IFORM_MUXSEL,BT848_IFORM);
4075 printk(KERN_DEBUG "bttv%d: setting input channel to:%d\n", btv->c.nr,(int)mux);
4078 /* ----------------------------------------------------------------------- */
4079 /* motherboard chipset specific stuff */
4081 void __devinit bttv_check_chipset(void)
4083 int pcipci_fail = 0;
4084 struct pci_dev *dev = NULL;
4086 if (pci_pci_problems & PCIPCI_FAIL)
4088 if (pci_pci_problems & (PCIPCI_TRITON|PCIPCI_NATOMA|PCIPCI_VIAETBF))
4090 if (pci_pci_problems & PCIPCI_VSFX)
4092 #ifdef PCIPCI_ALIMAGIK
4093 if (pci_pci_problems & PCIPCI_ALIMAGIK)
4098 /* print which chipset we have */
4099 while ((dev = pci_find_class(PCI_CLASS_BRIDGE_HOST << 8,dev)))
4100 printk(KERN_INFO "bttv: Host bridge is %s\n",pci_name(dev));
4103 /* print warnings about any quirks found */
4105 printk(KERN_INFO "bttv: Host bridge needs ETBF enabled.\n");
4107 printk(KERN_INFO "bttv: Host bridge needs VSFX enabled.\n");
4109 printk(KERN_WARNING "bttv: BT848 and your chipset may not work together.\n");
4110 if (UNSET == no_overlay) {
4111 printk(KERN_WARNING "bttv: going to disable overlay.\n");
4115 if (UNSET != latency)
4116 printk(KERN_INFO "bttv: pci latency fixup [%d]\n",latency);
4118 while ((dev = pci_find_device(PCI_VENDOR_ID_INTEL,
4119 PCI_DEVICE_ID_INTEL_82441, dev))) {
4121 pci_read_config_byte(dev, 0x53, &b);
4123 printk(KERN_INFO "bttv: Host bridge: 82441FX Natoma, "
4124 "bufcon=0x%02x\n",b);
4128 int __devinit bttv_handle_chipset(struct bttv *btv)
4130 unsigned char command;
4132 if (!triton1 && !vsfx && UNSET == latency)
4137 printk(KERN_INFO "bttv%d: enabling ETBF (430FX/VP3 compatibilty)\n",btv->c.nr);
4138 if (vsfx && btv->id >= 878)
4139 printk(KERN_INFO "bttv%d: enabling VSFX\n",btv->c.nr);
4140 if (UNSET != latency)
4141 printk(KERN_INFO "bttv%d: setting pci timer to %d\n",
4145 if (btv->id < 878) {
4146 /* bt848 (mis)uses a bit in the irq mask for etbf */
4148 btv->triton1 = BT848_INT_ETBF;
4150 /* bt878 has a bit in the pci config space for it */
4151 pci_read_config_byte(btv->c.pci, BT878_DEVCTRL, &command);
4153 command |= BT878_EN_TBFX;
4155 command |= BT878_EN_VSFX;
4156 pci_write_config_byte(btv->c.pci, BT878_DEVCTRL, command);
4158 if (UNSET != latency)
4159 pci_write_config_byte(btv->c.pci, PCI_LATENCY_TIMER, latency);