2 $Id: bttv-cards.c,v 1.47 2005/02/22 14:06:32 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/moduleparam.h>
33 #include <linux/kmod.h>
34 #include <linux/init.h>
35 #include <linux/pci.h>
36 #include <linux/vmalloc.h>
37 #include <linux/firmware.h>
42 #if 0 /* not working yet */
47 static void boot_msp34xx(struct bttv
*btv
, int pin
);
48 static void boot_bt832(struct bttv
*btv
);
49 static void hauppauge_eeprom(struct bttv
*btv
);
50 static void avermedia_eeprom(struct bttv
*btv
);
51 static void osprey_eeprom(struct bttv
*btv
);
52 static void modtec_eeprom(struct bttv
*btv
);
53 static void init_PXC200(struct bttv
*btv
);
55 static void winview_audio(struct bttv
*btv
, struct video_audio
*v
, int set
);
56 static void lt9415_audio(struct bttv
*btv
, struct video_audio
*v
, int set
);
57 static void avermedia_tvphone_audio(struct bttv
*btv
, struct video_audio
*v
,
59 static void avermedia_tv_stereo_audio(struct bttv
*btv
, struct video_audio
*v
,
61 static void terratv_audio(struct bttv
*btv
, struct video_audio
*v
, int set
);
62 static void gvbctv3pci_audio(struct bttv
*btv
, struct video_audio
*v
, int set
);
63 static void gvbctv5pci_audio(struct bttv
*btv
, struct video_audio
*v
, int set
);
64 static void winfast2000_audio(struct bttv
*btv
, struct video_audio
*v
, int set
);
65 static void pvbt878p9b_audio(struct bttv
*btv
, struct video_audio
*v
, int set
);
66 static void fv2000s_audio(struct bttv
*btv
, struct video_audio
*v
, int set
);
67 static void windvr_audio(struct bttv
*btv
, struct video_audio
*v
, int set
);
68 static void adtvk503_audio(struct bttv
*btv
, struct video_audio
*v
, int set
);
69 static void rv605_muxsel(struct bttv
*btv
, unsigned int input
);
70 static void eagle_muxsel(struct bttv
*btv
, unsigned int input
);
71 static void xguard_muxsel(struct bttv
*btv
, unsigned int input
);
72 static void ivc120_muxsel(struct bttv
*btv
, unsigned int input
);
73 static void gvc1100_muxsel(struct bttv
*btv
, unsigned int input
);
75 static void PXC200_muxsel(struct bttv
*btv
, unsigned int input
);
77 static void picolo_tetra_muxsel(struct bttv
*btv
, unsigned int input
);
78 static void picolo_tetra_init(struct bttv
*btv
);
80 static void tibetCS16_muxsel(struct bttv
*btv
, unsigned int input
);
81 static void tibetCS16_init(struct bttv
*btv
);
83 static void kodicom4400r_muxsel(struct bttv
*btv
, unsigned int input
);
84 static void kodicom4400r_init(struct bttv
*btv
);
86 static void sigmaSLC_muxsel(struct bttv
*btv
, unsigned int input
);
87 static void sigmaSQ_muxsel(struct bttv
*btv
, unsigned int input
);
89 static int terratec_active_radio_upgrade(struct bttv
*btv
);
90 static int tea5757_read(struct bttv
*btv
);
91 static int tea5757_write(struct bttv
*btv
, int value
);
92 static void identify_by_eeprom(struct bttv
*btv
,
93 unsigned char eeprom_data
[256]);
94 static int __devinit
pvr_boot(struct bttv
*btv
);
96 /* config variables */
97 static unsigned int triton1
=0;
98 static unsigned int vsfx
=0;
99 static unsigned int latency
= UNSET
;
100 static unsigned int no_overlay
=-1;
102 static unsigned int card
[BTTV_MAX
] = { [ 0 ... (BTTV_MAX
-1) ] = UNSET
};
103 static unsigned int pll
[BTTV_MAX
] = { [ 0 ... (BTTV_MAX
-1) ] = UNSET
};
104 static unsigned int tuner
[BTTV_MAX
] = { [ 0 ... (BTTV_MAX
-1) ] = UNSET
};
105 static unsigned int svhs
[BTTV_MAX
] = { [ 0 ... (BTTV_MAX
-1) ] = UNSET
};
106 static unsigned int remote
[BTTV_MAX
] = { [ 0 ... (BTTV_MAX
-1) ] = UNSET
};
107 static struct bttv
*master
[BTTV_MAX
] = { [ 0 ... (BTTV_MAX
-1) ] = NULL
};
109 static unsigned int autoload
= 1;
111 static unsigned int autoload
= 0;
113 static unsigned int gpiomask
= UNSET
;
114 static unsigned int audioall
= UNSET
;
115 static unsigned int audiomux
[5] = { [ 0 ... 4 ] = UNSET
};
118 module_param(triton1
, int, 0444);
119 module_param(vsfx
, int, 0444);
120 module_param(no_overlay
, int, 0444);
121 module_param(latency
, int, 0444);
122 module_param(gpiomask
, int, 0444);
123 module_param(audioall
, int, 0444);
124 module_param(autoload
, int, 0444);
126 module_param_array(card
, int, NULL
, 0444);
127 module_param_array(pll
, int, NULL
, 0444);
128 module_param_array(tuner
, int, NULL
, 0444);
129 module_param_array(svhs
, int, NULL
, 0444);
130 module_param_array(remote
, int, NULL
, 0444);
131 module_param_array(audiomux
, int, NULL
, 0444);
133 MODULE_PARM_DESC(triton1
,"set ETBF pci config bit "
134 "[enable bug compatibility for triton1 + others]");
135 MODULE_PARM_DESC(vsfx
,"set VSFX pci config bit "
136 "[yet another chipset flaw workaround]");
137 MODULE_PARM_DESC(latency
,"pci latency timer");
138 MODULE_PARM_DESC(card
,"specify TV/grabber card model, see CARDLIST file for a list");
139 MODULE_PARM_DESC(pll
,"specify installed crystal (0=none, 28=28 MHz, 35=35 MHz)");
140 MODULE_PARM_DESC(tuner
,"specify installed tuner type");
141 MODULE_PARM_DESC(autoload
,"automatically load i2c modules like tuner.o, default is 1 (yes)");
143 /* ----------------------------------------------------------------------- */
144 /* list of card IDs for bt878+ cards */
150 } cards
[] __devinitdata
= {
151 { 0x13eb0070, BTTV_HAUPPAUGE878
, "Hauppauge WinTV" },
152 { 0x39000070, BTTV_HAUPPAUGE878
, "Hauppauge WinTV-D" },
153 { 0x45000070, BTTV_HAUPPAUGEPVR
, "Hauppauge WinTV/PVR" },
154 { 0xff000070, BTTV_OSPREY1x0
, "Osprey-100" },
155 { 0xff010070, BTTV_OSPREY2x0_SVID
,"Osprey-200" },
156 { 0xff020070, BTTV_OSPREY500
, "Osprey-500" },
157 { 0xff030070, BTTV_OSPREY2000
, "Osprey-2000" },
158 { 0xff040070, BTTV_OSPREY540
, "Osprey-540" },
160 { 0x00011002, BTTV_ATI_TVWONDER
, "ATI TV Wonder" },
161 { 0x00031002, BTTV_ATI_TVWONDERVE
,"ATI TV Wonder/VE" },
163 { 0x6606107d, BTTV_WINFAST2000
, "Leadtek WinFast TV 2000" },
164 { 0x6607107d, BTTV_WINFASTVC100
, "Leadtek WinFast VC 100" },
165 { 0x6609107d, BTTV_WINFAST2000
, "Leadtek TV 2000 XP" },
166 { 0x263610b4, BTTV_STB2
, "STB TV PCI FM, Gateway P/N 6000704" },
167 { 0x264510b4, BTTV_STB2
, "STB TV PCI FM, Gateway P/N 6000704" },
168 { 0x402010fc, BTTV_GVBCTV3PCI
, "I-O Data Co. GV-BCTV3/PCI" },
169 { 0x405010fc, BTTV_GVBCTV4PCI
, "I-O Data Co. GV-BCTV4/PCI" },
170 { 0x407010fc, BTTV_GVBCTV5PCI
, "I-O Data Co. GV-BCTV5/PCI" },
171 { 0xd01810fc, BTTV_GVBCTV5PCI
, "I-O Data Co. GV-BCTV5/PCI" },
173 { 0x001211bd, BTTV_PINNACLE
, "Pinnacle PCTV" },
174 // some cards ship with byteswapped IDs ...
175 { 0x1200bd11, BTTV_PINNACLE
, "Pinnacle PCTV [bswap]" },
176 { 0xff00bd11, BTTV_PINNACLE
, "Pinnacle PCTV [bswap]" },
177 // this seems to happen as well ...
178 { 0xff1211bd, BTTV_PINNACLE
, "Pinnacle PCTV" },
180 { 0x3000121a, BTTV_VOODOOTV_FM
, "3Dfx VoodooTV FM/ VoodooTV 200" },
181 { 0x263710b4, BTTV_VOODOOTV_FM
, "3Dfx VoodooTV FM/ VoodooTV 200" },
182 { 0x3060121a, BTTV_STB2
, "3Dfx VoodooTV 100/ STB OEM" },
184 { 0x3000144f, BTTV_MAGICTVIEW063
, "(Askey Magic/others) TView99 CPH06x" },
185 { 0xa005144f, BTTV_MAGICTVIEW063
, "CPH06X TView99-Card" },
186 { 0x3002144f, BTTV_MAGICTVIEW061
, "(Askey Magic/others) TView99 CPH05x" },
187 { 0x3005144f, BTTV_MAGICTVIEW061
, "(Askey Magic/others) TView99 CPH061/06L (T1/LC)" },
188 { 0x5000144f, BTTV_MAGICTVIEW061
, "Askey CPH050" },
189 { 0x300014ff, BTTV_MAGICTVIEW061
, "TView 99 (CPH061)" },
190 { 0x300214ff, BTTV_PHOEBE_TVMAS
, "Phoebe TV Master (CPH060)" },
192 { 0x00011461, BTTV_AVPHONE98
, "AVerMedia TVPhone98" },
193 { 0x00021461, BTTV_AVERMEDIA98
, "AVermedia TVCapture 98" },
194 { 0x00031461, BTTV_AVPHONE98
, "AVerMedia TVPhone98" },
195 { 0x00041461, BTTV_AVERMEDIA98
, "AVerMedia TVCapture 98" },
196 { 0x03001461, BTTV_AVERMEDIA98
, "VDOMATE TV TUNER CARD" },
198 { 0x1117153b, BTTV_TERRATVALUE
, "Terratec TValue (Philips PAL B/G)" },
199 { 0x1118153b, BTTV_TERRATVALUE
, "Terratec TValue (Temic PAL B/G)" },
200 { 0x1119153b, BTTV_TERRATVALUE
, "Terratec TValue (Philips PAL I)" },
201 { 0x111a153b, BTTV_TERRATVALUE
, "Terratec TValue (Temic PAL I)" },
203 { 0x1123153b, BTTV_TERRATVRADIO
, "Terratec TV Radio+" },
204 { 0x1127153b, BTTV_TERRATV
, "Terratec TV+ (V1.05)" },
205 // clashes with FlyVideo
206 //{ 0x18521852, BTTV_TERRATV, "Terratec TV+ (V1.10)" },
207 { 0x1134153b, BTTV_TERRATVALUE
, "Terratec TValue (LR102)" },
208 { 0x1135153b, BTTV_TERRATVALUER
, "Terratec TValue Radio" }, // LR102
209 { 0x5018153b, BTTV_TERRATVALUE
, "Terratec TValue" }, // ??
210 { 0xff3b153b, BTTV_TERRATVALUER
, "Terratec TValue Radio" }, // ??
212 { 0x400015b0, BTTV_ZOLTRIX_GENIE
, "Zoltrix Genie TV" },
213 { 0x400a15b0, BTTV_ZOLTRIX_GENIE
, "Zoltrix Genie TV" },
214 { 0x400d15b0, BTTV_ZOLTRIX_GENIE
, "Zoltrix Genie TV / Radio" },
215 { 0x401015b0, BTTV_ZOLTRIX_GENIE
, "Zoltrix Genie TV / Radio" },
216 { 0x401615b0, BTTV_ZOLTRIX_GENIE
, "Zoltrix Genie TV / Radio" },
218 { 0x1430aa00, BTTV_PV143
, "Provideo PV143A" },
219 { 0x1431aa00, BTTV_PV143
, "Provideo PV143B" },
220 { 0x1432aa00, BTTV_PV143
, "Provideo PV143C" },
221 { 0x1433aa00, BTTV_PV143
, "Provideo PV143D" },
222 { 0x1433aa03, BTTV_PV143
, "Security Eyes" },
224 { 0x1460aa00, BTTV_PV150
, "Provideo PV150A-1" },
225 { 0x1461aa01, BTTV_PV150
, "Provideo PV150A-2" },
226 { 0x1462aa02, BTTV_PV150
, "Provideo PV150A-3" },
227 { 0x1463aa03, BTTV_PV150
, "Provideo PV150A-4" },
229 { 0x1464aa04, BTTV_PV150
, "Provideo PV150B-1" },
230 { 0x1465aa05, BTTV_PV150
, "Provideo PV150B-2" },
231 { 0x1466aa06, BTTV_PV150
, "Provideo PV150B-3" },
232 { 0x1467aa07, BTTV_PV150
, "Provideo PV150B-4" },
234 { 0xa132ff00, BTTV_IVC100
, "IVC-100" },
235 { 0xa1550000, BTTV_IVC200
, "IVC-200" },
236 { 0xa1550001, BTTV_IVC200
, "IVC-200" },
237 { 0xa1550002, BTTV_IVC200
, "IVC-200" },
238 { 0xa1550003, BTTV_IVC200
, "IVC-200" },
239 { 0xa1550100, BTTV_IVC200
, "IVC-200G" },
240 { 0xa1550101, BTTV_IVC200
, "IVC-200G" },
241 { 0xa1550102, BTTV_IVC200
, "IVC-200G" },
242 { 0xa1550103, BTTV_IVC200
, "IVC-200G" },
243 { 0xa182ff00, BTTV_IVC120
, "IVC-120G" },
244 { 0xa182ff01, BTTV_IVC120
, "IVC-120G" },
245 { 0xa182ff02, BTTV_IVC120
, "IVC-120G" },
246 { 0xa182ff03, BTTV_IVC120
, "IVC-120G" },
247 { 0xa182ff04, BTTV_IVC120
, "IVC-120G" },
248 { 0xa182ff05, BTTV_IVC120
, "IVC-120G" },
249 { 0xa182ff06, BTTV_IVC120
, "IVC-120G" },
250 { 0xa182ff07, BTTV_IVC120
, "IVC-120G" },
251 { 0xa182ff08, BTTV_IVC120
, "IVC-120G" },
252 { 0xa182ff09, BTTV_IVC120
, "IVC-120G" },
253 { 0xa182ff0a, BTTV_IVC120
, "IVC-120G" },
254 { 0xa182ff0b, BTTV_IVC120
, "IVC-120G" },
255 { 0xa182ff0c, BTTV_IVC120
, "IVC-120G" },
256 { 0xa182ff0d, BTTV_IVC120
, "IVC-120G" },
257 { 0xa182ff0e, BTTV_IVC120
, "IVC-120G" },
258 { 0xa182ff0f, BTTV_IVC120
, "IVC-120G" },
260 { 0x41424344, BTTV_GRANDTEC
, "GrandTec Multi Capture" },
261 { 0x01020304, BTTV_XGUARD
, "Grandtec Grand X-Guard" },
263 { 0x18501851, BTTV_CHRONOS_VS2
, "FlyVideo 98 (LR50)/ Chronos Video Shuttle II" },
264 { 0xa0501851, BTTV_CHRONOS_VS2
, "FlyVideo 98 (LR50)/ Chronos Video Shuttle II" },
265 { 0x18511851, BTTV_FLYVIDEO98EZ
, "FlyVideo 98EZ (LR51)/ CyberMail AV" },
266 { 0x18521852, BTTV_TYPHOON_TVIEW
, "FlyVideo 98FM (LR50)/ Typhoon TView TV/FM Tuner" },
267 { 0x41a0a051, BTTV_FLYVIDEO_98FM
, "Lifeview FlyVideo 98 LR50 Rev Q" },
268 { 0x18501f7f, BTTV_FLYVIDEO_98
, "Lifeview Flyvideo 98" },
270 { 0x010115cb, BTTV_GMV1
, "AG GMV1" },
271 { 0x010114c7, BTTV_MODTEC_205
, "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV" },
273 { 0x10b42636, BTTV_HAUPPAUGE878
, "STB ???" },
274 { 0x217d6606, BTTV_WINFAST2000
, "Leadtek WinFast TV 2000" },
275 { 0xfff6f6ff, BTTV_WINFAST2000
, "Leadtek WinFast TV 2000" },
276 { 0x03116000, BTTV_SENSORAY311
, "Sensoray 311" },
277 { 0x00790e11, BTTV_WINDVR
, "Canopus WinDVR PCI" },
278 { 0xa0fca1a0, BTTV_ZOLTRIX
, "Face to Face Tvmax" },
279 { 0x20007063, BTTV_PC_HDTV
, "pcHDTV HD-2000 TV"},
280 { 0x82b2aa6a, BTTV_SIMUS_GVC1100
, "SIMUS GVC1100" },
281 { 0x146caa0c, BTTV_PV951
, "ituner spectra8" },
282 { 0x200a1295, BTTV_PXC200
, "ImageNation PXC200A" },
284 { 0x40111554, BTTV_PV_BT878P_9B
, "Prolink Pixelview PV-BT" },
285 { 0x17de0a01, BTTV_KWORLD
, "Mecer TV/FM/Video Tuner" },
287 { 0x01051805, BTTV_PICOLO_TETRA_CHIP
, "Picolo Tetra Chip #1" },
288 { 0x01061805, BTTV_PICOLO_TETRA_CHIP
, "Picolo Tetra Chip #2" },
289 { 0x01071805, BTTV_PICOLO_TETRA_CHIP
, "Picolo Tetra Chip #3" },
290 { 0x01081805, BTTV_PICOLO_TETRA_CHIP
, "Picolo Tetra Chip #4" },
292 // likely broken, vendor id doesn't match the other magic views ...
293 //{ 0xa0fca04f, BTTV_MAGICTVIEW063, "Guillemot Maxi TV Video 3" },
295 // DVB cards (using pci function .1 for mpeg data xfer)
296 { 0x01010071, BTTV_NEBULA_DIGITV
, "Nebula Electronics DigiTV" },
297 { 0x07611461, BTTV_AVDVBT_761
, "AverMedia AverTV DVB-T 761" },
298 { 0x001c11bd, BTTV_PINNACLESAT
, "Pinnacle PCTV Sat" },
299 { 0x002611bd, BTTV_TWINHAN_DST
, "Pinnacle PCTV SAT CI" },
300 { 0x00011822, BTTV_TWINHAN_DST
, "Twinhan VisionPlus DVB" },
301 { 0xfc00270f, BTTV_TWINHAN_DST
, "ChainTech digitop DST-1000 DVB-S" },
302 { 0x07711461, BTTV_AVDVBT_771
, "AVermedia AverTV DVB-T 771" },
303 { 0xdb1018ac, BTTV_DVICO_DVBT_LITE
, "DVICO FusionHDTV DVB-T Lite" },
308 /* ----------------------------------------------------------------------- */
309 /* array with description for bt848 / bt878 tv/grabber cards */
311 struct tvcard bttv_tvcards
[] = {
313 /* ---- card 0x00 ---------------------------------- */
314 .name
= " *** UNKNOWN/GENERIC *** ",
319 .muxsel
= { 2, 3, 1, 0},
328 .muxsel
= { 2, 3, 1, 1},
329 .audiomux
= { 2, 0, 0, 0, 10},
333 .name
= "Hauppauge (bt848)",
339 .muxsel
= { 2, 3, 1, 1},
340 .audiomux
= { 0, 1, 2, 3, 4},
344 .name
= "STB, Gateway P/N 6000699 (bt848)",
350 .muxsel
= { 2, 3, 1, 1},
351 .audiomux
= { 4, 0, 2, 3, 1},
354 .tuner_type
= TUNER_PHILIPS_NTSC
,
359 /* ---- card 0x04 ---------------------------------- */
360 .name
= "Intel Create and Share PCI/ Smart Video Recorder III",
366 .muxsel
= { 2, 3, 1, 1},
371 .name
= "Diamond DTV2000",
377 .muxsel
= { 2, 3, 1, 0},
378 .audiomux
= { 0, 1, 0, 1, 3},
382 .name
= "AVerMedia TVPhone",
387 .muxsel
= { 2, 3, 1, 1},
389 .audiomux
= { 0x0c, 0x04, 0x08, 0x04, 0},
390 /* 0x04 for some cards ?? */
393 .audio_hook
= avermedia_tvphone_audio
,
396 .name
= "MATRIX-Vision MV-Delta",
402 .muxsel
= { 2, 3, 1, 0, 0},
408 /* ---- card 0x08 ---------------------------------- */
409 .name
= "Lifeview FlyVideo II (Bt848) LR26 / MAXI TV Video PCI2 LR26",
415 .muxsel
= { 2, 3, 1, 1},
416 .audiomux
= { 0, 0xc00, 0x800, 0x400, 0xc00, 0},
421 .name
= "IMS/IXmicro TurboTV",
427 .muxsel
= { 2, 3, 1, 1},
428 .audiomux
= { 1, 1, 2, 3, 0},
431 .tuner_type
= TUNER_TEMIC_PAL
,
433 .name
= "Hauppauge (bt878)",
438 .gpiomask
= 0x0f, /* old: 7 */
439 .muxsel
= { 2, 0, 1, 1},
440 .audiomux
= { 0, 1, 2, 3, 4},
445 .name
= "MIRO PCTV pro",
451 .muxsel
= { 2, 3, 1, 1},
452 .audiomux
= { 0x20001,0x10001, 0, 0,10},
457 /* ---- card 0x0c ---------------------------------- */
458 .name
= "ADS Technologies Channel Surfer TV (bt848)",
464 .muxsel
= { 2, 3, 1, 1},
465 .audiomux
= { 13, 14, 11, 7, 0, 0},
469 .name
= "AVerMedia TVCapture 98",
475 .muxsel
= { 2, 3, 1, 1},
476 .audiomux
= { 13, 14, 11, 7, 0, 0},
480 .tuner_type
= TUNER_PHILIPS_PAL
,
481 .audio_hook
= avermedia_tv_stereo_audio
,
483 .name
= "Aimslab Video Highway Xtreme (VHX)",
489 .muxsel
= { 2, 3, 1, 1},
490 .audiomux
= { 0, 2, 1, 3, 4}, /* old: { 0, 1, 2, 3, 4} */
495 .name
= "Zoltrix TV-Max",
501 .muxsel
= { 2, 3, 1, 1},
502 .audiomux
= {0 , 0, 1 , 0, 10},
507 /* ---- card 0x10 ---------------------------------- */
508 .name
= "Prolink Pixelview PlayTV (bt878)",
513 .gpiomask
= 0x01fe00,
514 .muxsel
= { 2, 3, 1, 1},
517 .audiomux
= { 0x01c000, 0, 0x018000, 0x014000, 0x002000, 0 },
519 // 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru>
520 .audiomux
= { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 },
526 .name
= "Leadtek WinView 601",
531 .gpiomask
= 0x8300f8,
532 .muxsel
= { 2, 3, 1, 1,0},
533 .audiomux
= { 0x4fa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007},
536 .audio_hook
= winview_audio
,
539 .name
= "AVEC Intercapture",
545 .muxsel
= {2, 3, 1, 1},
546 .audiomux
= {1, 0, 0, 0, 0},
550 .name
= "Lifeview FlyVideo II EZ /FlyKit LR38 Bt848 (capture only)",
555 .gpiomask
= 0x8dff00,
556 .muxsel
= { 2, 3, 1, 1},
562 /* ---- card 0x14 ---------------------------------- */
563 .name
= "CEI Raffles Card",
568 .muxsel
= {2, 3, 1, 1},
571 .name
= "Lifeview FlyVideo 98/ Lucky Star Image World ConferenceTV LR50",
573 .audio_inputs
= 2, // tuner, line in
577 .muxsel
= { 2, 3, 1, 1},
578 .audiomux
= { 0, 0x800, 0x1000, 0x1000, 0x1800},
580 .tuner_type
= TUNER_PHILIPS_PAL_I
,
582 .name
= "Askey CPH050/ Phoebe Tv Master + FM",
588 .muxsel
= { 2, 3, 1, 1},
589 .audiomux
= {0, 1, 0x800, 0x400, 0xc00, 0},
594 .name
= "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV, bt878",
600 .muxsel
= { 2, 3, -1 },
601 .digital_mode
= DIGITAL_MODE_CAMERA
,
602 .audiomux
= { 0, 0, 0, 0, 0 },
605 .tuner_type
= TUNER_ALPS_TSBB5_PAL_I
,
608 /* ---- card 0x18 ---------------------------------- */
609 .name
= "Askey CPH05X/06X (bt878) [many vendors]",
615 .muxsel
= { 2, 3, 1, 1},
616 .audiomux
= {0x400, 0x400, 0x400, 0x400, 0xc00},
622 .name
= "Terratec TerraTV+ Version 1.0 (Bt848)/ Terra TValue Version 1.0/ Vobis TV-Boostar",
627 .gpiomask
= 0x1f0fff,
628 .muxsel
= { 2, 3, 1, 1},
629 .audiomux
= { 0x20000, 0x30000, 0x10000, 0, 0x40000},
631 .tuner_type
= TUNER_PHILIPS_PAL
,
632 .audio_hook
= terratv_audio
,
634 .name
= "Hauppauge WinCam newer (bt878)",
640 .muxsel
= { 2, 0, 1, 1},
641 .audiomux
= { 0, 1, 2, 3, 4},
645 .name
= "Lifeview FlyVideo 98/ MAXI TV Video PCI2 LR50",
651 .muxsel
= { 2, 3, 1, 1},
652 .audiomux
= { 0, 0x800, 0x1000, 0x1000, 0x1800},
654 .tuner_type
= TUNER_PHILIPS_SECAM
,
657 /* ---- card 0x1c ---------------------------------- */
658 .name
= "Terratec TerraTV+ Version 1.1 (bt878)",
663 .gpiomask
= 0x1f0fff,
664 .muxsel
= { 2, 3, 1, 1},
665 .audiomux
= { 0x20000, 0x30000, 0x10000, 0x00000, 0x40000},
667 .tuner_type
= TUNER_PHILIPS_PAL
,
668 .audio_hook
= terratv_audio
,
670 External 20 pin connector (for Active Radio Upgrade board)
676 gpio05: om5610-stereo
680 gpio09+10: nIOR, nSEL ?? (bt878)
684 gpio16: u2-A0 (1st 4052bt)
687 gpio19: u4-A0 (2nd 4052)
691 00000 : Cdrom (internal audio input)
692 10000 : ext. Video audio input
701 /* Jannik Fritsch <jannik@techfak.uni-bielefeld.de> */
702 .name
= "Imagenation PXC200",
706 .svhs
= 1, /* was: 4 */
708 .muxsel
= { 2, 3, 1, 0, 0},
712 .muxsel_hook
= PXC200_muxsel
,
715 .name
= "Lifeview FlyVideo 98 LR50",
720 .gpiomask
= 0x1800, //0x8dfe00
721 .muxsel
= { 2, 3, 1, 1},
722 .audiomux
= { 0, 0x0800, 0x1000, 0x1000, 0x1800, 0 },
726 .name
= "Formac iProTV, Formac ProTV I (bt848)",
732 .muxsel
= { 2, 3, 1, 1},
733 .audiomux
= { 1, 0, 0, 0, 0 },
735 .tuner_type
= TUNER_PHILIPS_PAL
,
738 /* ---- card 0x20 ---------------------------------- */
739 .name
= "Intel Create and Share PCI/ Smart Video Recorder III",
745 .muxsel
= { 2, 3, 1, 1},
750 .name
= "Terratec TerraTValue Version Bt878",
755 .gpiomask
= 0xffff00,
756 .muxsel
= { 2, 3, 1, 1},
757 .audiomux
= { 0x500, 0, 0x300, 0x900, 0x900},
760 .tuner_type
= TUNER_PHILIPS_PAL
,
762 .name
= "Leadtek WinFast 2000/ WinFast 2000 XP",
767 .muxsel
= { 2, 3, 1, 1, 0}, // TV, CVid, SVid, CVid over SVid connector
769 .gpiomask
= 0xc33000,
770 .audiomux
= { 0x422000,0x1000,0x0000,0x620000,0x800000 },
772 /* Alexander Varakin <avarakin@hotmail.com> [stereo version] */
773 .gpiomask
= 0xb33000,
774 .audiomux
= { 0x122000,0x1000,0x0000,0x620000,0x800000 },
776 /* Audio Routing for "WinFast 2000 XP" (no tv stereo !)
777 gpio23 -- hef4052:nEnable (0x800000)
780 0x0000: external audio
784 Note: There exists another variant "Winfast 2000" with tv stereo !?
785 Note: eeprom only contains FF and pci subsystem id 107d:6606
790 .tuner_type
= 5, // default for now, gpio reads BFFF06 for Pal bg+dk
791 .audio_hook
= winfast2000_audio
,
794 .name
= "Lifeview FlyVideo 98 LR50 / Chronos Video Shuttle II",
800 .muxsel
= { 2, 3, 1, 1},
801 .audiomux
= { 0, 0x800, 0x1000, 0x1000, 0x1800},
806 /* ---- card 0x24 ---------------------------------- */
807 .name
= "Lifeview FlyVideo 98FM LR50 / Typhoon TView TV/FM Tuner",
813 .muxsel
= { 2, 3, 1, 1},
814 .audiomux
= { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 },
819 .name
= "Prolink PixelView PlayTV pro",
825 .muxsel
= { 2, 3, 1, 1 },
826 .audiomux
= { 0x21, 0x20, 0x24, 0x2c, 0x29, 0x29 },
831 .name
= "Askey CPH06X TView99",
836 .gpiomask
= 0x551e00,
837 .muxsel
= { 2, 3, 1, 0},
838 .audiomux
= { 0x551400, 0x551200, 0, 0, 0x551c00, 0x551200 },
844 .name
= "Pinnacle PCTV Studio/Rave",
849 .gpiomask
= 0x03000F,
850 .muxsel
= { 2, 3, 1, 1},
851 .audiomux
= { 2, 0xd0001, 0, 0, 1},
857 /* ---- card 0x28 ---------------------------------- */
858 .name
= "STB TV PCI FM, Gateway P/N 6000704 (bt878), 3Dfx VoodooTV 100",
864 .muxsel
= { 2, 3, 1, 1},
865 .audiomux
= { 4, 0, 2, 3, 1},
868 .tuner_type
= TUNER_PHILIPS_NTSC
,
872 .name
= "AVerMedia TVPhone 98",
878 .muxsel
= { 2, 3, 1, 1},
879 .audiomux
= { 13, 4, 11, 7, 0, 0},
884 .audio_hook
= avermedia_tvphone_audio
,
886 .name
= "ProVideo PV951", /* pic16c54 */
892 .muxsel
= { 2, 3, 1, 1},
893 .audiomux
= { 0, 0, 0, 0, 0},
899 .name
= "Little OnAir TV",
905 .muxsel
= {2, 3, 1, 1},
906 .audiomux
= {0xff9ff6, 0xff9ff6, 0xff1ff7, 0, 0xff3ffc},
911 /* ---- card 0x2c ---------------------------------- */
912 .name
= "Sigma TVII-FM",
918 .muxsel
= {2, 3, 1, 1},
919 .audiomux
= {1, 1, 0, 2, 3},
924 .name
= "MATRIX-Vision MV-Delta 2",
930 .muxsel
= { 2, 3, 1, 0, 0},
936 .name
= "Zoltrix Genie TV/FM",
941 .gpiomask
= 0xbcf03f,
942 .muxsel
= { 2, 3, 1, 1},
943 .audiomux
= { 0xbc803f, 0xbc903f, 0xbcb03f, 0, 0xbcb03f},
948 .name
= "Terratec TV/Radio+",
954 .muxsel
= { 2, 3, 1, 1},
955 .audiomux
= { 0x20000, 0x30000, 0x10000, 0, 0x40000, 0x20000 },
963 /* ---- card 0x30 ---------------------------------- */
964 .name
= "Askey CPH03x/ Dynalink Magic TView",
970 .muxsel
= { 2, 3, 1, 1},
971 .audiomux
= {2,0,0,0,1},
976 .name
= "IODATA GV-BCTV3/PCI",
981 .gpiomask
= 0x010f00,
982 .muxsel
= {2, 3, 0, 0},
983 .audiomux
= {0x10000, 0, 0x10000, 0, 0, 0},
986 .tuner_type
= TUNER_ALPS_TSHC6_NTSC
,
987 .audio_hook
= gvbctv3pci_audio
,
989 .name
= "Prolink PV-BT878P+4E / PixelView PlayTV PAK / Lenco MXTV-9578 CP",
994 .gpiomask
= 0xAA0000,
995 .muxsel
= { 2,3,1,1,-1 },
996 .digital_mode
= DIGITAL_MODE_CAMERA
,
997 .audiomux
= { 0x20000, 0, 0x80000, 0x80000, 0xa8000, 0x46000 },
1000 .tuner_type
= TUNER_PHILIPS_PAL_I
,
1002 /* GPIO wiring: (different from Rev.4C !)
1003 GPIO17: U4.A0 (first hef4052bt)
1005 GPIO20: U5.A1 (second hef4052bt)
1007 GPIO22: BT832 Reset Line
1008 GPIO23: A5,A0, U5,nEN
1009 Note: At i2c=0x8a is a Bt832 chip, which changes to 0x88 after being reset via GPIO22
1012 .name
= "Eagle Wireless Capricorn2 (bt878A)",
1018 .muxsel
= { 2, 0, 1, 1},
1019 .audiomux
= { 0, 1, 2, 3, 4},
1021 .tuner_type
= -1 /* TUNER_ALPS_TMDH2_NTSC */,
1024 /* ---- card 0x34 ---------------------------------- */
1025 /* David Härdeman <david@2gen.com> */
1026 .name
= "Pinnacle PCTV Studio Pro",
1031 .gpiomask
= 0x03000F,
1032 .muxsel
= { 2, 3, 1, 1},
1033 .audiomux
= { 1, 0xd0001, 0, 0, 10},
1034 /* sound path (5 sources):
1035 MUX1 (mask 0x03), Enable Pin 0x08 (0=enable, 1=disable)
1038 2= Mono TV sound from Tuner
1040 MUX2 (mask 0x30000):
1042 1= FM stereo Radio from Tuner */
1047 /* Claas Langbehn <claas@bigfoot.com>,
1048 Sven Grothklags <sven@upb.de> */
1049 .name
= "Typhoon TView RDS + FM Stereo / KNC1 TV Station RDS",
1055 .muxsel
= { 2, 3, 1, 1},
1056 .audiomux
= { 0, 0, 0x10, 8, 4 },
1059 .tuner_type
= TUNER_PHILIPS_PAL
,
1062 /* Tim Röstermundt <rosterm@uni-muenster.de>
1063 in de.comp.os.unix.linux.hardware:
1064 options bttv card=0 pll=1 radio=1 gpiomask=0x18e0
1065 audiomux=0x44c71f,0x44d71f,0,0x44d71f,0x44dfff
1066 options tuner type=5 */
1067 .name
= "Lifeview FlyVideo 2000 /FlyVideo A2/ Lifetec LT 9415 TV [LR90]",
1073 .muxsel
= { 2, 3, 1, 1},
1074 .audiomux
= { 0x0000,0x0800,0x1000,0x1000,0x18e0 },
1075 /* For cards with tda9820/tda9821:
1076 0x0000: Tuner normal stereo
1077 0x0080: Tuner A2 SAP (second audio program = Zweikanalton)
1078 0x0880: Tuner A2 stereo */
1082 /* Miguel Angel Alvarez <maacruz@navegalia.com>
1083 old Easy TV BT848 version (model CPH031) */
1084 .name
= "Askey CPH031/ BESTBUY Easy TV",
1090 .muxsel
= { 2, 3, 1, 0},
1091 .audiomux
= { 2, 0, 0, 0, 10},
1094 .tuner_type
= TUNER_TEMIC_PAL
,
1097 /* ---- card 0x38 ---------------------------------- */
1098 /* Gordon Heydon <gjheydon@bigfoot.com ('98) */
1099 .name
= "Lifeview FlyVideo 98FM LR50",
1105 .muxsel
= { 2, 3, 1, 1},
1106 .audiomux
= { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 },
1110 /* This is the ultimate cheapo capture card
1111 * just a BT848A on a small PCB!
1112 * Steve Hosgood <steve@equiinet.com> */
1113 .name
= "GrandTec 'Grand Video Capture' (Bt848)",
1126 /* Daniel Herrington <daniel.herrington@home.com> */
1127 .name
= "Askey CPH060/ Phoebe TV Master Only (No FM)",
1133 .muxsel
= { 2, 3, 1, 1},
1134 .audiomux
= { 0x400, 0x400, 0x400, 0x400, 0x800, 0x400 },
1137 .tuner_type
= TUNER_TEMIC_4036FY5_NTSC
,
1139 /* Matti Mottus <mottus@physic.ut.ee> */
1140 .name
= "Askey CPH03x TV Capturer",
1145 .gpiomask
= 0x03000F,
1146 .muxsel
= { 2, 3, 1, 0},
1147 .audiomux
= { 2,0,0,0,1 },
1152 /* ---- card 0x3c ---------------------------------- */
1153 /* Philip Blundell <philb@gnu.org> */
1154 .name
= "Modular Technology MM100PCTV",
1160 .muxsel
= { 2, 3, 1, 1},
1161 .audiomux
= { 2, 0, 0, 1, 8},
1163 .tuner_type
= TUNER_TEMIC_PAL
,
1166 /* Adrian Cox <adrian@humboldt.co.uk */
1167 .name
= "AG Electronics GMV1",
1180 /* Miguel Angel Alvarez <maacruz@navegalia.com>
1181 new Easy TV BT878 version (model CPH061)
1182 special thanks to Informatica Mieres for providing the card */
1183 .name
= "Askey CPH061/ BESTBUY Easy TV (bt878)",
1189 .muxsel
= { 2, 3, 1, 0},
1190 .audiomux
= { 1, 0, 4, 4, 9},
1193 .tuner_type
= TUNER_PHILIPS_PAL
,
1195 /* Lukas Gebauer <geby@volny.cz> */
1196 .name
= "ATI TV-Wonder",
1202 .muxsel
= { 2, 3, 1, 0 },
1203 .audiomux
= { 0xbffe, 0, 0xbfff, 0, 0xbffe},
1205 .tuner_type
= TUNER_TEMIC_4006FN5_MULTI_PAL
,
1208 /* ---- card 0x40 ---------------------------------- */
1209 /* Lukas Gebauer <geby@volny.cz> */
1210 .name
= "ATI TV-Wonder VE",
1216 .muxsel
= { 2, 3, 0, 1},
1217 .audiomux
= { 0, 0, 1, 0, 0},
1220 .tuner_type
= TUNER_TEMIC_4006FN5_MULTI_PAL
,
1222 /* DeeJay <deejay@westel900.net (2000S) */
1223 .name
= "Lifeview FlyVideo 2000S LR90",
1229 .muxsel
= { 2, 3, 0, 1},
1230 /* Radio changed from 1e80 to 0x800 to make
1231 FlyVideo2000S in .hu happy (gm)*/
1232 /* -dk-???: set mute=0x1800 for tda9874h daughterboard */
1233 .audiomux
= { 0x0000,0x0800,0x1000,0x1000,0x1800, 0x1080 },
1234 .audio_hook
= fv2000s_audio
,
1241 .name
= "Terratec TValueRadio",
1246 .gpiomask
= 0xffff00,
1247 .muxsel
= { 2, 3, 1, 1},
1248 .audiomux
= { 0x500, 0x500, 0x300, 0x900, 0x900},
1251 .tuner_type
= TUNER_PHILIPS_PAL
,
1254 /* TANAKA Kei <peg00625@nifty.com> */
1255 .name
= "IODATA GV-BCTV4/PCI",
1260 .gpiomask
= 0x010f00,
1261 .muxsel
= {2, 3, 0, 0},
1262 .audiomux
= {0x10000, 0, 0x10000, 0, 0, 0},
1265 .tuner_type
= TUNER_SHARP_2U5JF5540_NTSC
,
1266 .audio_hook
= gvbctv3pci_audio
,
1269 /* ---- card 0x44 ---------------------------------- */
1270 .name
= "3Dfx VoodooTV FM (Euro), VoodooTV 200 (USA)",
1271 // try "insmod msp3400 simple=0" if you have
1272 // sound problems with this card.
1277 .gpiomask
= 0x4f8a00,
1278 // 0x100000: 1=MSP enabled (0=disable again)
1279 // 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC)
1280 .audiomux
= {0x947fff, 0x987fff,0x947fff,0x947fff, 0x947fff},
1281 // tvtuner, radio, external,internal, mute, stereo
1282 /* tuner, Composit, SVid, Composit-on-Svid-adapter*/
1283 .muxsel
= { 2, 3 ,0 ,1},
1284 .tuner_type
= TUNER_MT2032
,
1288 /* Philip Blundell <pb@nexus.co.uk> */
1289 .name
= "Active Imaging AIMMS",
1298 /* Tomasz Pyra <hellfire@sedez.iq.pl> */
1299 .name
= "Prolink Pixelview PV-BT878P+ (Rev.4C,8E)",
1305 .muxsel
= { 2, 3, 1, 1},
1306 .audiomux
= { 0, 0, 11, 7, 13, 0}, // TV and Radio with same GPIO !
1312 GPIO0: U4.A0 (hef4052bt)
1314 GPIO2: U4.A1 (second hef4052bt)
1315 GPIO3: U4.nEN, U5.A0, A5.nEN
1319 .name
= "Lifeview FlyVideo 98EZ (capture only) LR51",
1324 .muxsel
= { 2, 3, 1, 1}, // AV1, AV2, SVHS, CVid adapter on SVHS
1329 /* ---- card 0x48 ---------------------------------- */
1330 /* Dariusz Kowalewski <darekk@automex.pl> */
1331 .name
= "Prolink Pixelview PV-BT878P+9B (PlayTV Pro rev.9B FM+NICAM)",
1337 .muxsel
= { 2, 3, 1, 1 },
1338 .audiomux
= { 0x01, 0x00, 0x03, 0x03, 0x09, 0x02 },
1344 .audio_hook
= pvbt878p9b_audio
, // Note: not all cards have stereo
1345 .has_radio
= 1, // Note: not all cards have radio
1352 GPIO20,22,23: R30,R29,R28
1355 /* Clay Kunz <ckunz@mail.arc.nasa.gov> */
1356 /* you must jumper JP5 for the card to work */
1357 .name
= "Sensoray 311",
1363 .muxsel
= { 2, 3, 1, 0, 0},
1368 /* Miguel Freitas <miguel@cetuc.puc-rio.br> */
1369 .name
= "RemoteVision MX (RV605)",
1375 .gpiomask2
= 0x07ff,
1376 .muxsel
= { 0x33, 0x13, 0x23, 0x43, 0xf3, 0x73, 0xe3, 0x03,
1377 0xd3, 0xb3, 0xc3, 0x63, 0x93, 0x53, 0x83, 0xa3 },
1381 .muxsel_hook
= rv605_muxsel
,
1383 .name
= "Powercolor MTV878/ MTV878R/ MTV878F",
1388 .gpiomask
= 0x1C800F, // Bit0-2: Audio select, 8-12:remote control 14:remote valid 15:remote reset
1389 .muxsel
= { 2, 1, 1, },
1390 .audiomux
= { 0, 1, 2, 2, 4 },
1392 .tuner_type
= TUNER_PHILIPS_PAL
,
1397 /* ---- card 0x4c ---------------------------------- */
1398 /* Masaki Suzuki <masaki@btree.org> */
1399 .name
= "Canopus WinDVR PCI (COMPAQ Presario 3524JP, 5112JP)",
1404 .gpiomask
= 0x140007,
1405 .muxsel
= { 2, 3, 1, 1 },
1406 .audiomux
= { 0, 1, 2, 3, 4, 0 },
1407 .tuner_type
= TUNER_PHILIPS_NTSC
,
1408 .audio_hook
= windvr_audio
,
1410 .name
= "GrandTec Multi Capture Card (Bt878)",
1416 .muxsel
= { 2, 3, 1, 0 },
1423 .name
= "Jetway TV/Capture JW-TV878-FBK, Kworld KW-TV878RF",
1429 .muxsel
= { 2, 3, 1, 1 }, // Tuner, SVid, SVHS, SVid to SVHS connector
1430 .audiomux
= { 0 ,0 ,4, 4,4,4},// Yes, this tuner uses the same audio output for TV and FM radio!
1431 // This card lacks external Audio In, so we mute it on Ext. & Int.
1432 // The PCB can take a sbx1637/sbx1673, wiring unknown.
1433 // This card lacks PCI subsystem ID, sigh.
1434 // audiomux=1: lower volume, 2+3: mute
1435 // btwincap uses 0x80000/0x80003
1439 .tuner_type
= 5, // Samsung TCPA9095PC27A (BG+DK), philips compatible, w/FM, stereo and
1440 // radio signal strength indicators work fine.
1443 GPIO0,1: HEF4052 A0,A1
1444 GPIO2: HEF4052 nENABLE
1446 GPIO8-13: IRDC357 data0-5 (data6 n.c. ?) [chip not present on my card]
1450 ?? : mtu8b56ep microcontroller for IR (GPIO wiring unknown)*/
1452 /* Arthur Tetzlaff-Deas, DSP Design Ltd <software@dspdesign.com> */
1453 .name
= "DSP Design TCVIDEO",
1456 .muxsel
= { 2, 3, 1, 0},
1461 /* ---- card 0x50 ---------------------------------- */
1462 .name
= "Hauppauge WinTV PVR",
1467 .muxsel
= { 2, 0, 1, 1},
1475 .name
= "IODATA GV-BCTV5/PCI",
1480 .gpiomask
= 0x0f0f80,
1481 .muxsel
= {2, 3, 1, 0},
1482 .audiomux
= {0x030000, 0x010000, 0, 0, 0x020000, 0},
1485 .tuner_type
= TUNER_PHILIPS_NTSC_M
,
1486 .audio_hook
= gvbctv5pci_audio
,
1489 .name
= "Osprey 100/150 (878)", /* 0x1(2|3)-45C6-C1 */
1490 .video_inputs
= 4, /* id-inputs-clock */
1494 .muxsel
= { 3, 2, 0, 1 },
1501 .name
= "Osprey 100/150 (848)", /* 0x04-54C0-C1 & older boards */
1506 .muxsel
= { 2, 3, 1 },
1514 /* ---- card 0x54 ---------------------------------- */
1515 .name
= "Osprey 101 (848)", /* 0x05-40C0-C1 */
1527 .name
= "Osprey 101/151", /* 0x1(4|5)-0004-C4 */
1539 .name
= "Osprey 101/151 w/ svid", /* 0x(16|17|20)-00C4-C1 */
1551 .name
= "Osprey 200/201/250/251", /* 0x1(8|9|E|F)-0004-C4 */
1564 /* ---- card 0x58 ---------------------------------- */
1565 .name
= "Osprey 200/250", /* 0x1(A|B)-00C4-C1 */
1577 .name
= "Osprey 210/220", /* 0x1(A|B)-04C0-C1 */
1589 .name
= "Osprey 500", /* 500 */
1601 .name
= "Osprey 540", /* 540 */
1605 #if 0 /* TODO ... */
1606 .svhs
= OSPREY540_SVID_ANALOG
,
1607 .muxsel
= { [OSPREY540_COMP_ANALOG
] = 2,
1608 [OSPREY540_SVID_ANALOG
] = 3, },
1615 #if 0 /* TODO ... */
1616 .muxsel_hook
= osprey_540_muxsel
,
1617 .picture_hook
= osprey_540_set_picture
,
1621 /* ---- card 0x5C ---------------------------------- */
1622 .name
= "Osprey 2000", /* 2000 */
1632 .no_tda7432
= 1, /* must avoid, conflicts with the bt860 */
1634 /* M G Berberich <berberic@forwiss.uni-passau.de> */
1635 .name
= "IDS Eagle",
1642 .muxsel
= { 0, 1, 2, 3 },
1643 .muxsel_hook
= eagle_muxsel
,
1648 .name
= "Pinnacle PCTV Sat",
1658 .audiomux
= { 0, 0, 0, 0, 1 },
1659 .muxsel
= { 3, 0, 1, 2},
1665 .name
= "Formac ProTV II (bt878)",
1671 // TV, Comp1, Composite over SVID con, SVID
1672 .muxsel
= { 2, 3, 1, 1},
1673 .audiomux
= { 2, 2, 0, 0, 0 },
1676 .tuner_type
= TUNER_PHILIPS_PAL
,
1678 GPIO=0x00,0x01,0x03: mute (?)
1679 0x02: both TV and radio (tuner: FM1216/I)
1680 The card has onboard audio connectors labeled "cdrom" and "board",
1681 not soldered here, though unknown wiring.
1682 Card lacks: external audio in, pci subsystem id.
1686 /* ---- card 0x60 ---------------------------------- */
1693 .muxsel
= { 2, 3, 1, 1},
1694 .audiomux
= { 0, 1, 2, 3, 4},
1699 .name
= "Euresys Picolo",
1708 .muxsel
= { 2, 0, 1},
1711 /* Luc Van Hoeylandt <luc@e-magic.be> */
1712 .name
= "ProVideo PV150", /* 0x4f */
1725 /* Hiroshi Takekawa <sian@big.or.jp> */
1726 /* This card lacks subsystem ID */
1727 .name
= "AD-TVK503", /* 0x63 */
1732 .gpiomask
= 0x001e8007,
1733 .muxsel
= { 2, 3, 1, 0 },
1734 /* Tuner, Radio, external, internal, off, on */
1735 .audiomux
= { 0x08, 0x0f, 0x0a, 0x08, 0x0f, 0x08 },
1740 .audio_hook
= adtvk503_audio
,
1743 /* ---- card 0x64 ---------------------------------- */
1744 .name
= "Hercules Smart TV Stereo",
1750 .muxsel
= { 2, 3, 1, 1 },
1756 - card lacks subsystem ID
1757 - stereo variant w/ daughter board with tda9874a @0xb0
1759 always from tda9874 independent of GPIO (?)
1760 external line in: unknown
1761 - Other chips: em78p156elp @ 0x96 (probably IR remote control)
1762 hef4053 (instead 4052) for unknown function
1765 .name
= "Pace TV & Radio Card",
1770 .muxsel
= { 2, 3, 1, 1}, // Tuner, CVid, SVid, CVid over SVid connector
1777 /* Bt878, Bt832, FI1246 tuner; no pci subsystem id
1778 only internal line out: (4pin header) RGGL
1779 Radio must be decoded by msp3410d (not routed through)*/
1780 // .digital_mode = DIGITAL_MODE_CAMERA, // todo!
1782 /* Chris Willing <chris@vislab.usyd.edu.au> */
1793 .name
= "Grand X-Guard / Trust 814PCI",
1800 .muxsel
= { 2,2,2,2, 3,3,3,3, 1,1,1,1, 0,0,0,0 },
1801 .muxsel_hook
= xguard_muxsel
,
1808 /* ---- card 0x68 ---------------------------------- */
1809 .name
= "Nebula Electronics DigiTV",
1813 .muxsel
= { 2, 3, 1, 0},
1822 /* Jorge Boncompte - DTI2 <jorge@dti2.net> */
1823 .name
= "ProVideo PV143",
1829 .muxsel
= { 2, 3, 1, 0 },
1836 /* M.Klahr@phytec.de */
1837 .name
= "PHYTEC VD-009-X1 MiniDIN (bt878)",
1840 .tuner
= -1, /* card has no tuner */
1843 .muxsel
= { 2, 3, 1, 0},
1844 .audiomux
= { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1849 .name
= "PHYTEC VD-009-X1 Combi (bt878)",
1852 .tuner
= -1, /* card has no tuner */
1855 .muxsel
= { 2, 3, 1, 1},
1856 .audiomux
= { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1862 /* ---- card 0x6c ---------------------------------- */
1863 .name
= "PHYTEC VD-009 MiniDIN (bt878)",
1866 .tuner
= -1, /* card has no tuner */
1869 .gpiomask2
= 0x03, /* gpiomask2 defines the bits used to switch audio
1870 via the upper nibble of muxsel. here: used for
1871 xternal video-mux */
1872 .muxsel
= { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x00 },
1873 .audiomux
= { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1878 .name
= "PHYTEC VD-009 Combi (bt878)",
1881 .tuner
= -1, /* card has no tuner */
1884 .gpiomask2
= 0x03, /* gpiomask2 defines the bits used to switch audio
1885 via the upper nibble of muxsel. here: used for
1886 xternal video-mux */
1887 .muxsel
= { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x01 },
1888 .audiomux
= { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1900 .muxsel
= { 2, 3, 1, 0 },
1903 /* IVC-120G - Alan Garfield <alan@fromorbit.com> */
1906 .audio_inputs
= 0, /* card has no audio */
1907 .tuner
= -1, /* card has no tuner */
1909 .svhs
= -1, /* card has no svhs */
1915 .muxsel
= { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
1916 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10 },
1917 .muxsel_hook
= ivc120_muxsel
,
1921 /* ---- card 0x70 ---------------------------------- */
1922 .name
= "pcHDTV HD-2000 TV",
1927 .muxsel
= { 2, 3, 1, 0},
1928 .tuner_type
= TUNER_PHILIPS_ATSC
,
1931 .name
= "Twinhan DST + clones",
1935 .tuner_type
= TUNER_ABSENT
,
1939 .name
= "Winfast VC100",
1943 .tuner
= -1, // no tuner
1944 .muxsel
= { 3, 1, 1, 3}, // Vid In, SVid In, Vid over SVid in connector
1948 .tuner_type
= TUNER_ABSENT
,
1951 .name
= "Teppro TEV-560/InterVision IV-560",
1957 .muxsel
= { 2, 3, 1, 1},
1958 .audiomux
= { 1, 1, 1, 1, 0},
1960 .tuner_type
= TUNER_PHILIPS_PAL
,
1964 /* ---- card 0x74 ---------------------------------- */
1965 .name
= "SIMUS GVC1100",
1972 .muxsel
= { 2, 2, 2, 2},
1974 .muxsel_hook
= gvc1100_muxsel
,
1976 /* Carlos Silva r3pek@r3pek.homelinux.org || card 0x75 */
1977 .name
= "NGS NGSTV+",
1981 .gpiomask
= 0x008007,
1982 .muxsel
= {2, 3, 0, 0},
1983 .audiomux
= {0, 0, 0, 0, 0x000003, 0},
1985 .tuner_type
= TUNER_PHILIPS_PAL
,
1988 /* http://linuxmedialabs.com */
1990 .video_inputs
= 4, /* IN1,IN2,IN3,IN4 */
1994 .muxsel
= { 2, 3, 1, 0 },
2000 /* Helmroos Harri <harri.helmroos@pp.inet.fi> */
2001 .name
= "Tekram M205 PRO",
2005 .tuner_type
= TUNER_PHILIPS_PAL
,
2009 .muxsel
= { 2, 3, 1},
2010 .audiomux
= { 0x68, 0x68, 0x61, 0x61, 0x00 },
2014 /* ---- card 0x78 ---------------------------------- */
2015 /* Javier Cendan Ares <jcendan@lycos.es> */
2016 /* bt878 TV + FM without subsystem ID */
2017 .name
= "Conceptronic CONTVFMi",
2022 .gpiomask
= 0x008007,
2023 .muxsel
= { 2, 3, 1, 1 },
2024 .audiomux
= { 0, 1, 2, 2, 3 },
2027 .tuner_type
= TUNER_PHILIPS_PAL
,
2031 /*Eric DEBIEF <debief@telemsa.com>*/
2032 /*EURESYS Picolo Tetra : 4 Conexant Fusion 878A, no audio, video input set with analog multiplexers GPIO controled*/
2033 /* adds picolo_tetra_muxsel(), picolo_tetra_init(), the folowing declaration strucure, and #define BTTV_PICOLO_TETRA_CHIP*/
2035 .name
= "Euresys Picolo Tetra",
2041 .gpiomask2
= 0x3C<<16,/*Set the GPIO[18]->GPIO[21] as output pin.==> drive the video inputs through analog multiplexers*/
2045 .muxsel
= {2,2,2,2},/*878A input is always MUX0, see above.*/
2046 .audiomux
= { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
2049 .muxsel_hook
= picolo_tetra_muxsel
,/*Required as it doesn't follow the classic input selection policy*/
2051 /* Spirit TV Tuner from http://spiritmodems.com.au */
2052 /* Stafford Goodsell <surge@goliath.homeunix.org> */
2053 .name
= "Spirit TV Tuner",
2058 .gpiomask
= 0x0000000f,
2059 .muxsel
= { 2, 1, 1 },
2060 .audiomux
= { 0x02, 0x00, 0x00, 0x00, 0x00},
2061 .tuner_type
= TUNER_TEMIC_PAL
,
2065 /* Wolfram Joost <wojo@frokaschwei.de> */
2066 .name
= "AVerMedia AVerTV DVB-T 771",
2070 .tuner_type
= TUNER_ABSENT
,
2071 .muxsel
= { 3 , 3 },
2080 /* ---- card 0x7c ---------------------------------- */
2081 /* Matt Jesson <dvb@jesson.eclipse.co.uk> */
2082 /* Based on the Nebula card data - added remote and new card number - BTTV_AVDVBT_761, see also ir-kbd-gpio.c */
2083 .name
= "AverMedia AverTV DVB-T 761",
2087 .muxsel
= { 3, 1, 2, 0}, /* Comp0, S-Video, ?, ? */
2097 /* andre.schwarz@matrix-vision.de */
2098 .name
= "MATRIX Vision Sigma-SQ",
2104 .muxsel
= { 2, 2, 2, 2, 2, 2, 2, 2,
2105 3, 3, 3, 3, 3, 3, 3, 3 },
2106 .muxsel_hook
= sigmaSQ_muxsel
,
2112 /* andre.schwarz@matrix-vision.de */
2113 .name
= "MATRIX Vision Sigma-SLC",
2119 .muxsel
= { 2, 2, 2, 2 },
2120 .muxsel_hook
= sigmaSLC_muxsel
,
2126 /* BTTV_APAC_VIEWCOMP */
2127 /* Attila Kondoros <attila.kondoros@chello.hu> */
2128 /* bt878 TV + FM 0x00000000 subsystem ID */
2129 .name
= "APAC Viewcomp 878(AMAX)",
2135 .muxsel
= { 2, 3, 1, 1},
2136 .audiomux
= { 2, 0, 0, 0, 10},
2139 .tuner_type
= TUNER_PHILIPS_PAL
,
2140 .has_remote
= 1, /* miniremote works, see ir-kbd-gpio.c */
2141 .has_radio
= 1, /* not every card has radio */
2144 /* ---- card 0x80 ---------------------------------- */
2145 /* Chris Pascoe <c.pascoe@itee.uq.edu.au> */
2146 .name
= "DVICO FusionHDTV DVB-T Lite",
2156 /* Steven <photon38@pchome.com.tw> */
2157 .name
= "V-Gear MyVCD",
2163 .muxsel
= {2, 3, 1, 0},
2164 .audiomux
= {0x31, 0x31, 0x31, 0x31, 0x31, 0x31},
2167 .tuner_type
= TUNER_PHILIPS_NTSC_M
,
2171 /* Rick C <cryptdragoon@gmail.com> */
2172 .name
= "Super TV Tuner",
2177 .muxsel
= { 2, 3, 1, 0},
2178 .tuner_type
= TUNER_PHILIPS_NTSC
,
2179 .gpiomask
= 0x008007,
2180 .audiomux
= { 0, 0x000001,0,0, 0},
2184 /* Chris Fanning <video4linux@haydon.net> */
2185 .name
= "Tibet Systems 'Progress DVR' CS16",
2190 .muxsel
= { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 },
2196 .muxsel_hook
= tibetCS16_muxsel
,
2199 /* Bill Brack <wbrack@mmm.com.hk> */
2201 * Note that, because of the card's wiring, the "master"
2202 * BT878A chip (i.e. the one which controls the analog switch
2203 * and must use this card type) is the 2nd one detected. The
2204 * other 3 chips should use card type 0x85, whose description
2205 * follows this one. There is a EEPROM on the card (which is
2206 * connected to the I2C of one of those other chips), but is
2207 * not currently handled. There is also a facility for a
2208 * "monitor", which is also not currently implemented.
2210 .name
= "Kodicom 4400R (master)",
2216 /* GPIO bits 0-9 used for analog switch:
2217 * 00 - 03: camera selector
2218 * 04 - 06: channel (controller) selector
2219 * 07: data (1->on, 0->off)
2222 * bit 16 is input from sync separator for the channel
2224 .gpiomask
= 0x0003ff,
2226 .muxsel
= { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
2231 .muxsel_hook
= kodicom4400r_muxsel
,
2234 /* Bill Brack <wbrack@mmm.com.hk> */
2235 /* Note that, for reasons unknown, the "master" BT878A chip (i.e. the
2236 * one which controls the analog switch, and must use the card type)
2237 * is the 2nd one detected. The other 3 chips should use this card
2240 .name
= "Kodicom 4400R (slave)",
2246 .gpiomask
= 0x010000,
2248 .muxsel
= { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
2253 .muxsel_hook
= kodicom4400r_muxsel
,
2256 static const unsigned int bttv_num_tvcards
= ARRAY_SIZE(bttv_tvcards
);
2258 /* ----------------------------------------------------------------------- */
2260 static unsigned char eeprom_data
[256];
2265 void __devinit
bttv_idcard(struct bttv
*btv
)
2267 unsigned int gpiobits
;
2271 /* read PCI subsystem ID */
2272 pci_read_config_word(btv
->c
.pci
, PCI_SUBSYSTEM_ID
, &tmp
);
2273 btv
->cardid
= tmp
<< 16;
2274 pci_read_config_word(btv
->c
.pci
, PCI_SUBSYSTEM_VENDOR_ID
, &tmp
);
2277 if (0 != btv
->cardid
&& 0xffffffff != btv
->cardid
) {
2278 /* look for the card */
2279 for (type
= -1, i
= 0; cards
[i
].id
!= 0; i
++)
2280 if (cards
[i
].id
== btv
->cardid
)
2285 printk(KERN_INFO
"bttv%d: detected: %s [card=%d], "
2286 "PCI subsystem ID is %04x:%04x\n",
2287 btv
->c
.nr
,cards
[type
].name
,cards
[type
].cardnr
,
2288 btv
->cardid
& 0xffff,
2289 (btv
->cardid
>> 16) & 0xffff);
2290 btv
->c
.type
= cards
[type
].cardnr
;
2293 printk(KERN_INFO
"bttv%d: subsystem: %04x:%04x (UNKNOWN)\n",
2294 btv
->c
.nr
, btv
->cardid
& 0xffff,
2295 (btv
->cardid
>> 16) & 0xffff);
2296 printk(KERN_DEBUG
"please mail id, board name and "
2297 "the correct card= insmod option to kraxel@bytesex.org\n");
2301 /* let the user override the autodetected type */
2302 if (card
[btv
->c
.nr
] < bttv_num_tvcards
)
2303 btv
->c
.type
=card
[btv
->c
.nr
];
2305 /* print which card config we are using */
2306 printk(KERN_INFO
"bttv%d: using: %s [card=%d,%s]\n",btv
->c
.nr
,
2307 bttv_tvcards
[btv
->c
.type
].name
, btv
->c
.type
,
2308 card
[btv
->c
.nr
] < bttv_num_tvcards
2309 ? "insmod option" : "autodetected");
2311 /* overwrite gpio stuff ?? */
2312 if (UNSET
== audioall
&& UNSET
== audiomux
[0])
2315 if (UNSET
!= audiomux
[0]) {
2317 for (i
= 0; i
< 5; i
++) {
2318 bttv_tvcards
[btv
->c
.type
].audiomux
[i
] = audiomux
[i
];
2319 gpiobits
|= audiomux
[i
];
2322 gpiobits
= audioall
;
2323 for (i
= 0; i
< 5; i
++) {
2324 bttv_tvcards
[btv
->c
.type
].audiomux
[i
] = audioall
;
2327 bttv_tvcards
[btv
->c
.type
].gpiomask
= (UNSET
!= gpiomask
) ? gpiomask
: gpiobits
;
2328 printk(KERN_INFO
"bttv%d: gpio config override: mask=0x%x, mux=",
2329 btv
->c
.nr
,bttv_tvcards
[btv
->c
.type
].gpiomask
);
2330 for (i
= 0; i
< 5; i
++) {
2331 printk("%s0x%x", i
? "," : "", bttv_tvcards
[btv
->c
.type
].audiomux
[i
]);
2337 * (most) board specific initialisations goes here
2340 /* Some Modular Technology cards have an eeprom, but no subsystem ID */
2341 void identify_by_eeprom(struct bttv
*btv
, unsigned char eeprom_data
[256])
2345 if (0 == strncmp(eeprom_data
,"GET MM20xPCTV",13))
2346 type
= BTTV_MODTEC_205
;
2347 else if (0 == strncmp(eeprom_data
+20,"Picolo",7))
2348 type
= BTTV_EURESYS_PICOLO
;
2349 else if (eeprom_data
[0] == 0x84 && eeprom_data
[2]== 0)
2350 type
= BTTV_HAUPPAUGE
; /* old bt848 */
2354 printk("bttv%d: detected by eeprom: %s [card=%d]\n",
2355 btv
->c
.nr
, bttv_tvcards
[btv
->c
.type
].name
, btv
->c
.type
);
2359 static void flyvideo_gpio(struct bttv
*btv
)
2361 int gpio
,has_remote
,has_radio
,is_capture_only
,is_lr90
,has_tda9820_tda9821
;
2364 gpio_inout(0xffffff, 0);
2365 udelay(8); // without this we would see the 0x1800 mask
2367 /* FIXME: must restore OUR_EN ??? */
2369 // all cards provide GPIO info, some have an additional eeprom
2370 // LR50: GPIO coding can be found lower right CP1 .. CP9
2371 // CP9=GPIO23 .. CP1=GPIO15; when OPEN, the corresponding GPIO reads 1.
2373 // LR90: GP9=GPIO23 .. GP1=GPIO15 (right above the bt878)
2375 // lowest 3 bytes are remote control codes (no handshake needed)
2376 // xxxFFF: No remote control chip soldered
2377 // xxxF00(LR26/LR50), xxxFE0(LR90): Remote control chip (LVA001 or CF45) soldered
2378 // Note: Some bits are Audio_Mask !
2380 ttype
=(gpio
&0x0f0000)>>16;
2382 case 0x0: tuner
=2; // NTSC, e.g. TPI8NSR11P
2384 case 0x2: tuner
=39;// LG NTSC (newer TAPC series) TAPC-H701P
2386 case 0x4: tuner
=5; // Philips PAL TPI8PSB02P, TPI8PSB12P, TPI8PSB12D or FI1216, FM1216
2388 case 0x6: tuner
=37; // LG PAL (newer TAPC series) TAPC-G702P
2390 case 0xC: tuner
=3; // Philips SECAM(+PAL) FQ1216ME or FI1216MF
2393 printk(KERN_INFO
"bttv%d: FlyVideo_gpio: unknown tuner type.\n", btv
->c
.nr
);
2396 has_remote
= gpio
& 0x800000;
2397 has_radio
= gpio
& 0x400000;
2398 // unknown 0x200000;
2399 // unknown2 0x100000;
2400 is_capture_only
= !(gpio
& 0x008000); //GPIO15
2401 has_tda9820_tda9821
= !(gpio
& 0x004000);
2402 is_lr90
= !(gpio
& 0x002000); // else LR26/LR50 (LR38/LR51 f. capture only)
2403 // gpio & 0x001000 // output bit for audio routing
2406 tuner
=4; // No tuner present
2408 printk(KERN_INFO
"bttv%d: FlyVideo Radio=%s RemoteControl=%s Tuner=%d gpio=0x%06x\n",
2409 btv
->c
.nr
, has_radio
? "yes":"no ", has_remote
? "yes":"no ", tuner
, gpio
);
2410 printk(KERN_INFO
"bttv%d: FlyVideo LR90=%s tda9821/tda9820=%s capture_only=%s\n",
2411 btv
->c
.nr
, is_lr90
?"yes":"no ", has_tda9820_tda9821
?"yes":"no ",
2412 is_capture_only
?"yes":"no ");
2414 if(tuner
!= -1) // only set if known tuner autodetected, else let insmod option through
2415 btv
->tuner_type
= tuner
;
2416 btv
->has_radio
= has_radio
;
2418 // LR90 Audio Routing is done by 2 hef4052, so Audio_Mask has 4 bits: 0x001c80
2419 // LR26/LR50 only has 1 hef4052, Audio_Mask 0x000c00
2420 // Audio options: from tuner, from tda9821/tda9821(mono,stereo,sap), from tda9874, ext., mute
2421 if(has_tda9820_tda9821
) btv
->audio_hook
= lt9415_audio
;
2422 //todo: if(has_tda9874) btv->audio_hook = fv2000s_audio;
2425 static int miro_tunermap
[] = { 0,6,2,3, 4,5,6,0, 3,0,4,5, 5,2,16,1,
2426 14,2,17,1, 4,1,4,3, 1,2,16,1, 4,4,4,4 };
2427 static int miro_fmtuner
[] = { 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1,
2428 1,1,1,1, 1,1,1,0, 0,0,0,0, 0,1,0,0 };
2430 static void miro_pinnacle_gpio(struct bttv
*btv
)
2435 gpio_inout(0xffffff, 0);
2437 id
= ((gpio
>>10) & 63) -1;
2438 msp
= bttv_I2CRead(btv
, I2C_MSP3400
, "MSP34xx");
2440 btv
->tuner_type
= miro_tunermap
[id
];
2441 if (0 == (gpio
& 0x20)) {
2443 if (!miro_fmtuner
[id
]) {
2444 btv
->has_matchbox
= 1;
2445 btv
->mbox_we
= (1<<6);
2446 btv
->mbox_most
= (1<<7);
2447 btv
->mbox_clk
= (1<<8);
2448 btv
->mbox_data
= (1<<9);
2449 btv
->mbox_mask
= (1<<6)|(1<<7)|(1<<8)|(1<<9);
2455 if (btv
->c
.type
== BTTV_MIRO
)
2456 btv
->c
.type
= BTTV_MIROPRO
;
2457 if (btv
->c
.type
== BTTV_PINNACLE
)
2458 btv
->c
.type
= BTTV_PINNACLEPRO
;
2461 "bttv%d: miro: id=%d tuner=%d radio=%s stereo=%s\n",
2462 btv
->c
.nr
, id
+1, btv
->tuner_type
,
2463 !btv
->has_radio
? "no" :
2464 (btv
->has_matchbox
? "matchbox" : "fmtuner"),
2465 (-1 == msp
) ? "no" : "yes");
2467 /* new cards with microtune tuner */
2472 info
= "PAL / mono";
2475 info
= "PAL+SECAM / stereo";
2479 info
= "NTSC / stereo";
2483 info
= "PAL+SECAM / mono";
2486 info
= "NTSC / mono";
2489 info
= "NTSC / stereo";
2492 info
= "PAL / stereo";
2495 info
= "oops: unknown card";
2499 btv
->c
.type
= BTTV_PINNACLEPRO
;
2501 "bttv%d: pinnacle/mt: id=%d info=\"%s\" radio=%s\n",
2502 btv
->c
.nr
, id
, info
, btv
->has_radio
? "yes" : "no");
2503 btv
->tuner_type
= 33;
2504 btv
->pinnacle_id
= id
;
2508 /* GPIO21 L: Buffer aktiv, H: Buffer inaktiv */
2509 #define LM1882_SYNC_DRIVE 0x200000L
2511 static void init_ids_eagle(struct bttv
*btv
)
2513 gpio_inout(0xffffff,0xFFFF37);
2514 gpio_write(0x200020);
2516 /* flash strobe inverter ?! */
2517 gpio_write(0x200024);
2519 /* switch sync drive off */
2520 gpio_bits(LM1882_SYNC_DRIVE
,LM1882_SYNC_DRIVE
);
2522 /* set BT848 muxel to 2 */
2523 btaor((2)<<5, ~(2<<5), BT848_IFORM
);
2526 /* Muxsel helper for the IDS Eagle.
2527 * the eagles does not use the standard muxsel-bits but
2528 * has its own multiplexer */
2529 static void eagle_muxsel(struct bttv
*btv
, unsigned int input
)
2531 btaor((2)<<5, ~(3<<5), BT848_IFORM
);
2532 gpio_bits(3,bttv_tvcards
[btv
->c
.type
].muxsel
[input
&7]);
2536 /* wake chroma ADC */
2537 btand(~BT848_ADC_C_SLEEP
, BT848_ADC
);
2538 /* set to YC video */
2539 btor(BT848_CONTROL_COMP
, BT848_E_CONTROL
);
2540 btor(BT848_CONTROL_COMP
, BT848_O_CONTROL
);
2543 /* set chroma ADC to sleep */
2544 btor(BT848_ADC_C_SLEEP
, BT848_ADC
);
2545 /* set to composite video */
2546 btand(~BT848_CONTROL_COMP
, BT848_E_CONTROL
);
2547 btand(~BT848_CONTROL_COMP
, BT848_O_CONTROL
);
2550 /* switch sync drive off */
2551 gpio_bits(LM1882_SYNC_DRIVE
,LM1882_SYNC_DRIVE
);
2554 static void gvc1100_muxsel(struct bttv
*btv
, unsigned int input
)
2556 static const int masks
[] = {0x30, 0x01, 0x12, 0x23};
2557 gpio_write(masks
[input
%4]);
2560 /* LMLBT4x initialization - to allow access to GPIO bits for sensors input and
2563 GPIObit | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
2564 assignment | TI | O3|INx| O2| O1|IN4|IN3|IN2|IN1| | |
2566 IN - sensor inputs, INx - sensor inputs and TI XORed together
2567 O1,O2,O3 - alarm outputs (relays)
2569 OUT ENABLE 1 1 0 . 1 1 0 0 . 0 0 0 0 = 0x6C0
2573 static void init_lmlbt4x(struct bttv
*btv
)
2575 printk(KERN_DEBUG
"LMLBT4x init\n");
2576 btwrite(0x000000, BT848_GPIO_REG_INP
);
2577 gpio_inout(0xffffff, 0x0006C0);
2578 gpio_write(0x000000);
2581 static void sigmaSQ_muxsel(struct bttv
*btv
, unsigned int input
)
2583 unsigned int inmux
= input
% 8;
2584 gpio_inout( 0xf, 0xf );
2585 gpio_bits( 0xf, inmux
);
2588 static void sigmaSLC_muxsel(struct bttv
*btv
, unsigned int input
)
2590 unsigned int inmux
= input
% 4;
2591 gpio_inout( 3<<9, 3<<9 );
2592 gpio_bits( 3<<9, inmux
<<9 );
2595 /* ----------------------------------------------------------------------- */
2597 static void bttv_reset_audio(struct bttv
*btv
)
2600 * BT878A has a audio-reset register.
2601 * 1. This register is an audio reset function but it is in
2602 * function-0 (video capture) address space.
2603 * 2. It is enough to do this once per power-up of the card.
2604 * 3. There is a typo in the Conexant doc -- it is not at
2605 * 0x5B, but at 0x058. (B is an odd-number, obviously a typo!).
2606 * --//Shrikumar 030609
2612 printk("bttv%d: BT878A ARESET\n",btv
->c
.nr
);
2613 btwrite((1<<7), 0x058);
2618 /* initialization part one -- before registering i2c bus */
2619 void __devinit
bttv_init_card1(struct bttv
*btv
)
2621 switch (btv
->c
.type
) {
2622 case BTTV_HAUPPAUGE
:
2623 case BTTV_HAUPPAUGE878
:
2624 boot_msp34xx(btv
,5);
2626 case BTTV_VOODOOTV_FM
:
2627 boot_msp34xx(btv
,20);
2629 case BTTV_AVERMEDIA98
:
2630 boot_msp34xx(btv
,11);
2632 case BTTV_HAUPPAUGEPVR
:
2635 case BTTV_TWINHAN_DST
:
2636 case BTTV_AVDVBT_771
:
2637 btv
->use_i2c_hw
= 1;
2640 if (!bttv_tvcards
[btv
->c
.type
].has_dvb
)
2641 bttv_reset_audio(btv
);
2644 /* initialization part two -- after registering i2c bus */
2645 void __devinit
bttv_init_card2(struct bttv
*btv
)
2648 btv
->tuner_type
= -1;
2650 if (BTTV_UNKNOWN
== btv
->c
.type
) {
2651 bttv_readee(btv
,eeprom_data
,0xa0);
2652 identify_by_eeprom(btv
,eeprom_data
);
2655 switch (btv
->c
.type
) {
2659 case BTTV_PINNACLEPRO
:
2661 miro_pinnacle_gpio(btv
);
2663 case BTTV_FLYVIDEO_98
:
2665 case BTTV_LIFE_FLYKIT
:
2667 case BTTV_TYPHOON_TVIEW
:
2668 case BTTV_CHRONOS_VS2
:
2669 case BTTV_FLYVIDEO_98FM
:
2670 case BTTV_FLYVIDEO2000
:
2671 case BTTV_FLYVIDEO98EZ
:
2672 case BTTV_CONFERENCETV
:
2673 case BTTV_LIFETEC_9415
:
2676 case BTTV_HAUPPAUGE
:
2677 case BTTV_HAUPPAUGE878
:
2678 case BTTV_HAUPPAUGEPVR
:
2679 /* pick up some config infos from the eeprom */
2680 bttv_readee(btv
,eeprom_data
,0xa0);
2681 hauppauge_eeprom(btv
);
2683 case BTTV_AVERMEDIA98
:
2684 case BTTV_AVPHONE98
:
2685 bttv_readee(btv
,eeprom_data
,0xa0);
2686 avermedia_eeprom(btv
);
2691 case BTTV_PICOLO_TETRA_CHIP
:
2692 picolo_tetra_init(btv
);
2696 btv
->has_matchbox
= 1;
2697 btv
->mbox_we
= 0x20;
2699 btv
->mbox_clk
= 0x08;
2700 btv
->mbox_data
= 0x10;
2701 btv
->mbox_mask
= 0x38;
2703 case BTTV_VOBIS_BOOSTAR
:
2705 terratec_active_radio_upgrade(btv
);
2707 case BTTV_MAGICTVIEW061
:
2708 if (btv
->cardid
== 0x3002144f) {
2710 printk("bttv%d: radio detected by subsystem id (CPH05x)\n",btv
->c
.nr
);
2714 if (btv
->cardid
== 0x3060121a) {
2715 /* Fix up entry for 3DFX VoodooTV 100,
2716 which is an OEM STB card variant. */
2718 btv
->tuner_type
=TUNER_TEMIC_NTSC
;
2721 case BTTV_OSPREY1x0
:
2722 case BTTV_OSPREY1x0_848
:
2723 case BTTV_OSPREY101_848
:
2724 case BTTV_OSPREY1x1
:
2725 case BTTV_OSPREY1x1_SVID
:
2726 case BTTV_OSPREY2xx
:
2727 case BTTV_OSPREY2x0_SVID
:
2728 case BTTV_OSPREY2x0
:
2729 case BTTV_OSPREY500
:
2730 case BTTV_OSPREY540
:
2731 case BTTV_OSPREY2000
:
2732 bttv_readee(btv
,eeprom_data
,0xa0);
2735 case BTTV_IDS_EAGLE
:
2736 init_ids_eagle(btv
);
2738 case BTTV_MODTEC_205
:
2739 bttv_readee(btv
,eeprom_data
,0xa0);
2745 case BTTV_TIBET_CS16
:
2746 tibetCS16_init(btv
);
2748 case BTTV_KODICOM_4400R
:
2749 kodicom4400r_init(btv
);
2753 /* pll configuration */
2754 if (!(btv
->id
==848 && btv
->revision
==0x11)) {
2755 /* defaults from card list */
2756 if (PLL_28
== bttv_tvcards
[btv
->c
.type
].pll
) {
2757 btv
->pll
.pll_ifreq
=28636363;
2758 btv
->pll
.pll_crystal
=BT848_IFORM_XT0
;
2760 if (PLL_35
== bttv_tvcards
[btv
->c
.type
].pll
) {
2761 btv
->pll
.pll_ifreq
=35468950;
2762 btv
->pll
.pll_crystal
=BT848_IFORM_XT1
;
2764 /* insmod options can override */
2765 switch (pll
[btv
->c
.nr
]) {
2767 btv
->pll
.pll_crystal
= 0;
2768 btv
->pll
.pll_ifreq
= 0;
2769 btv
->pll
.pll_ofreq
= 0;
2771 case 1: /* 28 MHz */
2773 btv
->pll
.pll_ifreq
= 28636363;
2774 btv
->pll
.pll_ofreq
= 0;
2775 btv
->pll
.pll_crystal
= BT848_IFORM_XT0
;
2777 case 2: /* 35 MHz */
2779 btv
->pll
.pll_ifreq
= 35468950;
2780 btv
->pll
.pll_ofreq
= 0;
2781 btv
->pll
.pll_crystal
= BT848_IFORM_XT1
;
2785 btv
->pll
.pll_current
= -1;
2787 /* tuner configuration (from card list / autodetect / insmod option) */
2788 if (UNSET
!= bttv_tvcards
[btv
->c
.type
].tuner_type
)
2789 if(UNSET
== btv
->tuner_type
)
2790 btv
->tuner_type
= bttv_tvcards
[btv
->c
.type
].tuner_type
;
2791 if (UNSET
!= tuner
[btv
->c
.nr
])
2792 btv
->tuner_type
= tuner
[btv
->c
.nr
];
2793 printk("bttv%d: using tuner=%d\n",btv
->c
.nr
,btv
->tuner_type
);
2794 if (btv
->pinnacle_id
!= UNSET
)
2795 bttv_call_i2c_clients(btv
,AUDC_CONFIG_PINNACLE
,
2797 if (btv
->tuner_type
!= UNSET
)
2798 bttv_call_i2c_clients(btv
,TUNER_SET_TYPE
,&btv
->tuner_type
);
2799 btv
->svhs
= bttv_tvcards
[btv
->c
.type
].svhs
;
2800 if (svhs
[btv
->c
.nr
] != UNSET
)
2801 btv
->svhs
= svhs
[btv
->c
.nr
];
2802 if (remote
[btv
->c
.nr
] != UNSET
)
2803 btv
->has_remote
= remote
[btv
->c
.nr
];
2805 if (bttv_tvcards
[btv
->c
.type
].has_radio
)
2807 if (bttv_tvcards
[btv
->c
.type
].has_remote
)
2809 if (bttv_tvcards
[btv
->c
.type
].no_gpioirq
)
2811 if (bttv_tvcards
[btv
->c
.type
].audio_hook
)
2812 btv
->audio_hook
=bttv_tvcards
[btv
->c
.type
].audio_hook
;
2814 if (bttv_tvcards
[btv
->c
.type
].digital_mode
== DIGITAL_MODE_CAMERA
) {
2815 /* detect Bt832 chip for quartzsight digital camera */
2816 if ((bttv_I2CRead(btv
, I2C_BT832_ALT1
, "Bt832") >=0) ||
2817 (bttv_I2CRead(btv
, I2C_BT832_ALT2
, "Bt832") >=0))
2824 /* try to detect audio/fader chips */
2825 if (!bttv_tvcards
[btv
->c
.type
].no_msp34xx
&&
2826 bttv_I2CRead(btv
, I2C_MSP3400
, "MSP34xx") >=0)
2827 request_module("msp3400");
2829 if (bttv_tvcards
[btv
->c
.type
].msp34xx_alt
&&
2830 bttv_I2CRead(btv
, I2C_MSP3400_ALT
, "MSP34xx (alternate address)") >=0)
2831 request_module("msp3400");
2833 if (!bttv_tvcards
[btv
->c
.type
].no_tda9875
&&
2834 bttv_I2CRead(btv
, I2C_TDA9875
, "TDA9875") >=0)
2835 request_module("tda9875");
2837 if (!bttv_tvcards
[btv
->c
.type
].no_tda7432
&&
2838 bttv_I2CRead(btv
, I2C_TDA7432
, "TDA7432") >=0)
2839 request_module("tda7432");
2841 if (bttv_tvcards
[btv
->c
.type
].needs_tvaudio
)
2842 request_module("tvaudio");
2846 if (btv
->pinnacle_id
!= UNSET
)
2848 if (0 == tda9887
&& 0 == bttv_tvcards
[btv
->c
.type
].has_dvb
&&
2849 bttv_I2CRead(btv
, I2C_TDA9887
, "TDA9887") >=0)
2851 if((btv
->tuner_type
== TUNER_PHILIPS_FM1216ME_MK3
) ||
2852 (btv
->tuner_type
== TUNER_PHILIPS_FM1236_MK3
) ||
2853 (btv
->tuner_type
== TUNER_PHILIPS_FM1256_IH3
) ||
2855 request_module("tda9887");
2856 if (btv
->tuner_type
!= UNSET
)
2857 request_module("tuner");
2861 /* ----------------------------------------------------------------------- */
2863 static void modtec_eeprom(struct bttv
*btv
)
2865 if( strncmp(&(eeprom_data
[0x1e]),"Temic 4066 FY5",14) ==0) {
2866 btv
->tuner_type
=TUNER_TEMIC_4066FY5_PAL_I
;
2867 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
2868 btv
->c
.nr
,&eeprom_data
[0x1e]);
2869 } else if (strncmp(&(eeprom_data
[0x1e]),"Alps TSBB5",10) ==0) {
2870 btv
->tuner_type
=TUNER_ALPS_TSBB5_PAL_I
;
2871 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
2872 btv
->c
.nr
,&eeprom_data
[0x1e]);
2873 } else if (strncmp(&(eeprom_data
[0x1e]),"Philips FM1246",14) ==0) {
2874 btv
->tuner_type
=TUNER_PHILIPS_NTSC
;
2875 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
2876 btv
->c
.nr
,&eeprom_data
[0x1e]);
2878 printk("bttv%d: Modtec: Unknown TunerString: %s\n",
2879 btv
->c
.nr
,&eeprom_data
[0x1e]);
2883 static void __devinit
hauppauge_eeprom(struct bttv
*btv
)
2887 tveeprom_hauppauge_analog(&tv
, eeprom_data
);
2888 btv
->tuner_type
= tv
.tuner_type
;
2889 btv
->has_radio
= tv
.has_radio
;
2892 static int terratec_active_radio_upgrade(struct bttv
*btv
)
2897 btv
->has_matchbox
= 1;
2898 btv
->mbox_we
= 0x10;
2899 btv
->mbox_most
= 0x20;
2900 btv
->mbox_clk
= 0x08;
2901 btv
->mbox_data
= 0x04;
2902 btv
->mbox_mask
= 0x3c;
2904 btv
->mbox_iow
= 1 << 8;
2905 btv
->mbox_ior
= 1 << 9;
2906 btv
->mbox_csel
= 1 << 10;
2909 tea5757_write(btv
, 5 * freq
+ 0x358); // write 0x1ed8
2910 if (0x1ed8 == tea5757_read(btv
)) {
2911 printk("bttv%d: Terratec Active Radio Upgrade found.\n",
2914 btv
->has_matchbox
= 1;
2917 btv
->has_matchbox
= 0;
2923 /* ----------------------------------------------------------------------- */
2926 * minimal bootstrap for the WinTV/PVR -- upload altera firmware.
2928 * The hcwamc.rbf firmware file is on the Hauppauge driver CD. Have
2929 * a look at Pvr/pvr45xxx.EXE (self-extracting zip archive, can be
2930 * unpacked with unzip).
2932 #define PVR_GPIO_DELAY 10
2934 #define BTTV_ALT_DATA 0x000001
2935 #define BTTV_ALT_DCLK 0x100000
2936 #define BTTV_ALT_NCONFIG 0x800000
2938 static int __devinit
pvr_altera_load(struct bttv
*btv
, u8
*micro
, u32 microlen
)
2944 gpio_inout(0xffffff,BTTV_ALT_DATA
|BTTV_ALT_DCLK
|BTTV_ALT_NCONFIG
);
2946 udelay(PVR_GPIO_DELAY
);
2948 gpio_write(BTTV_ALT_NCONFIG
);
2949 udelay(PVR_GPIO_DELAY
);
2951 for (n
= 0; n
< microlen
; n
++) {
2953 for ( i
= 0 ; i
< 8 ; i
++ ) {
2954 gpio_bits(BTTV_ALT_DCLK
,0);
2956 gpio_bits(BTTV_ALT_DATA
,BTTV_ALT_DATA
);
2958 gpio_bits(BTTV_ALT_DATA
,0);
2959 gpio_bits(BTTV_ALT_DCLK
,BTTV_ALT_DCLK
);
2963 gpio_bits(BTTV_ALT_DCLK
,0);
2964 udelay(PVR_GPIO_DELAY
);
2966 /* begin Altera init loop (Not necessary,but doesn't hurt) */
2967 for (i
= 0 ; i
< 30 ; i
++) {
2968 gpio_bits(BTTV_ALT_DCLK
,0);
2969 gpio_bits(BTTV_ALT_DCLK
,BTTV_ALT_DCLK
);
2971 gpio_bits(BTTV_ALT_DCLK
,0);
2975 static int __devinit
pvr_boot(struct bttv
*btv
)
2977 const struct firmware
*fw_entry
;
2980 rc
= request_firmware(&fw_entry
, "hcwamc.rbf", &btv
->c
.pci
->dev
);
2982 printk(KERN_WARNING
"bttv%d: no altera firmware [via hotplug]\n",
2986 rc
= pvr_altera_load(btv
, fw_entry
->data
, fw_entry
->size
);
2987 printk(KERN_INFO
"bttv%d: altera firmware upload %s\n",
2988 btv
->c
.nr
, (rc
< 0) ? "failed" : "ok");
2989 release_firmware(fw_entry
);
2993 /* ----------------------------------------------------------------------- */
2994 /* some osprey specific stuff */
2996 static void __devinit
osprey_eeprom(struct bttv
*btv
)
2999 unsigned char *ee
= eeprom_data
;
3000 unsigned long serial
= 0;
3002 if (btv
->c
.type
== 0) {
3003 /* this might be an antique... check for MMAC label in eeprom */
3004 if ((ee
[0]=='M') && (ee
[1]=='M') && (ee
[2]=='A') && (ee
[3]=='C')) {
3005 unsigned char checksum
= 0;
3006 for (i
=0; i
<21; i
++)
3008 if (checksum
!= ee
[21])
3010 btv
->c
.type
= BTTV_OSPREY1x0_848
;
3011 for (i
= 12; i
< 21; i
++)
3012 serial
*= 10, serial
+= ee
[i
] - '0';
3015 unsigned short type
;
3018 for(; offset
< 8*16; offset
+= 16) {
3019 unsigned short checksum
= 0;
3020 /* verify the checksum */
3021 for(i
= 0; i
<14; i
++) checksum
+= ee
[i
+offset
];
3022 checksum
= ~checksum
; /* no idea why */
3023 if ((((checksum
>>8)&0x0FF) == ee
[offset
+14]) &&
3024 ((checksum
& 0x0FF) == ee
[offset
+15])) {
3032 /* found a valid descriptor */
3033 type
= (ee
[offset
+4]<<8) | (ee
[offset
+5]);
3039 btv
->c
.type
= BTTV_OSPREY1x0_848
;
3042 btv
->c
.type
= BTTV_OSPREY101_848
;
3048 btv
->c
.type
= BTTV_OSPREY1x0
;
3052 btv
->c
.type
= BTTV_OSPREY1x1
;
3057 btv
->c
.type
= BTTV_OSPREY1x1_SVID
;
3063 btv
->c
.type
= BTTV_OSPREY2xx
;
3067 btv
->c
.type
= BTTV_OSPREY2x0_SVID
;
3070 btv
->c
.type
= BTTV_OSPREY500
;
3074 btv
->c
.type
= BTTV_OSPREY540
;
3075 /* bttv_osprey_540_init(btv); */
3079 btv
->c
.type
= BTTV_OSPREY2x0
;
3080 //enable output on select control lines
3081 gpio_inout(0xffffff,0x000303);
3084 /* unknown...leave generic, but get serial # */
3087 serial
= (ee
[offset
+6] << 24)
3088 | (ee
[offset
+7] << 16)
3089 | (ee
[offset
+8] << 8)
3093 printk(KERN_INFO
"bttv%d: osprey eeprom: card=%d name=%s serial=%ld\n",
3094 btv
->c
.nr
, btv
->c
.type
, bttv_tvcards
[btv
->c
.type
].name
,serial
);
3097 /* ----------------------------------------------------------------------- */
3098 /* AVermedia specific stuff, from bktr_card.c */
3100 static int tuner_0_table
[] = {
3101 TUNER_PHILIPS_NTSC
, TUNER_PHILIPS_PAL
/* PAL-BG*/,
3102 TUNER_PHILIPS_PAL
, TUNER_PHILIPS_PAL
/* PAL-I*/,
3103 TUNER_PHILIPS_PAL
, TUNER_PHILIPS_PAL
,
3104 TUNER_PHILIPS_SECAM
, TUNER_PHILIPS_SECAM
,
3105 TUNER_PHILIPS_SECAM
, TUNER_PHILIPS_PAL
,
3106 TUNER_PHILIPS_FM1216ME_MK3
};
3108 int tuner_0_fm_table
[] = {
3109 PHILIPS_FR1236_NTSC
, PHILIPS_FR1216_PAL
,
3110 PHILIPS_FR1216_PAL
, PHILIPS_FR1216_PAL
,
3111 PHILIPS_FR1216_PAL
, PHILIPS_FR1216_PAL
,
3112 PHILIPS_FR1236_SECAM
, PHILIPS_FR1236_SECAM
,
3113 PHILIPS_FR1236_SECAM
, PHILIPS_FR1216_PAL
};
3116 static int tuner_1_table
[] = {
3117 TUNER_TEMIC_NTSC
, TUNER_TEMIC_PAL
,
3118 TUNER_TEMIC_PAL
, TUNER_TEMIC_PAL
,
3119 TUNER_TEMIC_PAL
, TUNER_TEMIC_PAL
,
3120 TUNER_TEMIC_4012FY5
, TUNER_TEMIC_4012FY5
, //TUNER_TEMIC_SECAM
3121 TUNER_TEMIC_4012FY5
, TUNER_TEMIC_PAL
};
3123 static void __devinit
avermedia_eeprom(struct bttv
*btv
)
3125 int tuner_make
,tuner_tv_fm
,tuner_format
,tuner
=0;
3127 tuner_make
= (eeprom_data
[0x41] & 0x7);
3128 tuner_tv_fm
= (eeprom_data
[0x41] & 0x18) >> 3;
3129 tuner_format
= (eeprom_data
[0x42] & 0xf0) >> 4;
3130 btv
->has_remote
= (eeprom_data
[0x42] & 0x01);
3132 if (tuner_make
== 0 || tuner_make
== 2)
3133 if(tuner_format
<=0x0a)
3134 tuner
= tuner_0_table
[tuner_format
];
3135 if (tuner_make
== 1)
3136 if(tuner_format
<=9)
3137 tuner
= tuner_1_table
[tuner_format
];
3139 if (tuner_make
== 4)
3140 if(tuner_format
== 0x09)
3141 tuner
= TUNER_LG_NTSC_NEW_TAPC
; // TAPC-G702P
3143 printk(KERN_INFO
"bttv%d: Avermedia eeprom[0x%02x%02x]: tuner=",
3144 btv
->c
.nr
,eeprom_data
[0x41],eeprom_data
[0x42]);
3146 btv
->tuner_type
=tuner
;
3149 printk("Unknown type");
3150 printk(" radio:%s remote control:%s\n",
3151 tuner_tv_fm
? "yes" : "no",
3152 btv
->has_remote
? "yes" : "no");
3155 /* used on Voodoo TV/FM (Voodoo 200), S0 wired to 0x10000 */
3156 void bttv_tda9880_setnorm(struct bttv
*btv
, int norm
)
3158 // fix up our card entry
3159 if(norm
==VIDEO_MODE_NTSC
) {
3160 bttv_tvcards
[BTTV_VOODOOTV_FM
].audiomux
[0]=0x957fff;
3161 bttv_tvcards
[BTTV_VOODOOTV_FM
].audiomux
[4]=0x957fff;
3162 dprintk("bttv_tda9880_setnorm to NTSC\n");
3165 bttv_tvcards
[BTTV_VOODOOTV_FM
].audiomux
[0]=0x947fff;
3166 bttv_tvcards
[BTTV_VOODOOTV_FM
].audiomux
[4]=0x947fff;
3167 dprintk("bttv_tda9880_setnorm to PAL\n");
3169 // set GPIO according
3170 gpio_bits(bttv_tvcards
[btv
->c
.type
].gpiomask
,
3171 bttv_tvcards
[btv
->c
.type
].audiomux
[btv
->audio
]);
3176 * reset/enable the MSP on some Hauppauge cards
3177 * Thanks to Kyösti Mälkki (kmalkki@cc.hut.fi)!
3182 static void __devinit
boot_msp34xx(struct bttv
*btv
, int pin
)
3184 int mask
= (1 << pin
);
3186 gpio_inout(mask
,mask
);
3189 gpio_bits(mask
,mask
);
3192 bttv_gpio_tracking(btv
,"msp34xx");
3194 printk(KERN_INFO
"bttv%d: Hauppauge/Voodoo msp34xx: reset line "
3195 "init [%d]\n", btv
->c
.nr
, pin
);
3198 static void __devinit
boot_bt832(struct bttv
*btv
)
3200 #if 0 /* not working yet */
3203 switch (btv
->c
.type
) {
3204 case BTTV_PXELVWPLTVPAK
:
3205 resetbit
= 0x400000;
3207 case BTTV_MODTEC_205
:
3214 request_module("bt832");
3215 bttv_call_i2c_clients(btv
, BT832_HEXDUMP
, NULL
);
3217 printk("bttv%d: Reset Bt832 [line=0x%x]\n",btv
->c
.nr
,resetbit
);
3219 gpio_inout(resetbit
, resetbit
);
3221 gpio_bits(resetbit
, resetbit
);
3223 gpio_bits(resetbit
, 0);
3226 // bt832 on pixelview changes from i2c 0x8a to 0x88 after
3227 // being reset as above. So we must follow by this:
3228 bttv_call_i2c_clients(btv
, BT832_REATTACH
, NULL
);
3232 /* ----------------------------------------------------------------------- */
3233 /* Imagenation L-Model PXC200 Framegrabber */
3234 /* This is basically the same procedure as
3235 * used by Alessandro Rubini in his pxc200
3236 * driver, but using BTTV functions */
3238 static void __devinit
init_PXC200(struct bttv
*btv
)
3240 static int vals
[] __devinitdata
= { 0x08, 0x09, 0x0a, 0x0b, 0x0d, 0x0d,
3241 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
3247 /* Initialise GPIO-connevted stuff */
3248 gpio_inout(0xffffff, (1<<13));
3252 /* GPIO inputs are pulled up, so no need to drive
3253 * reset pin any longer */
3254 gpio_bits(0xffffff, 0);
3256 bttv_gpio_tracking(btv
,"pxc200");
3258 /* we could/should try and reset/control the AD pots? but
3259 right now we simply turned off the crushing. Without
3260 this the AGC drifts drifts
3261 remember the EN is reverse logic -->
3262 setting BT848_ADC_AGC_EN disable the AGC
3263 tboult@eecs.lehigh.edu
3266 btwrite(BT848_ADC_RESERVED
|BT848_ADC_AGC_EN
, BT848_ADC
);
3268 /* Initialise MAX517 DAC */
3269 printk(KERN_INFO
"Setting DAC reference voltage level ...\n");
3270 bttv_I2CWrite(btv
,0x5E,0,0x80,1);
3272 /* Initialise 12C508 PIC */
3273 /* The I2CWrite and I2CRead commmands are actually to the
3274 * same chips - but the R/W bit is included in the address
3275 * argument so the numbers are different */
3278 printk(KERN_INFO
"Initialising 12C508 PIC chip ...\n");
3280 /* First of all, enable the clock line. This is used in the PXC200-F */
3281 val
= btread(BT848_GPIO_DMA_CTL
);
3282 val
|= BT848_GPIO_DMA_CTL_GPCLKMODE
;
3283 btwrite(val
, BT848_GPIO_DMA_CTL
);
3285 /* Then, push to 0 the reset pin long enough to reset the *
3286 * device same as above for the reset line, but not the same
3287 * value sent to the GPIO-connected stuff
3288 * which one is the good one? */
3289 gpio_inout(0xffffff,(1<<2));
3294 for (i
= 0; i
< ARRAY_SIZE(vals
); i
++) {
3295 tmp
=bttv_I2CWrite(btv
,0x1E,0,vals
[i
],1);
3298 "I2C Write(%2.2x) = %i\nI2C Read () = %2.2x\n\n",
3299 vals
[i
],tmp
,bttv_I2CRead(btv
,0x1F,NULL
));
3303 printk(KERN_INFO
"PXC200 Initialised.\n");
3307 /* ----------------------------------------------------------------------- */
3308 /* Miro Pro radio stuff -- the tea5757 is connected to some GPIO ports */
3310 * Copyright (c) 1999 Csaba Halasz <qgehali@uni-miskolc.hu>
3311 * This code is placed under the terms of the GNU General Public License
3313 * Brutally hacked by Dan Sheridan <dan.sheridan@contact.org.uk> djs52 8/3/00
3316 static void bus_low(struct bttv
*btv
, int bit
)
3318 if (btv
->mbox_ior
) {
3319 gpio_bits(btv
->mbox_ior
| btv
->mbox_iow
| btv
->mbox_csel
,
3320 btv
->mbox_ior
| btv
->mbox_iow
| btv
->mbox_csel
);
3327 if (btv
->mbox_ior
) {
3328 gpio_bits(btv
->mbox_iow
| btv
->mbox_csel
, 0);
3333 static void bus_high(struct bttv
*btv
, int bit
)
3335 if (btv
->mbox_ior
) {
3336 gpio_bits(btv
->mbox_ior
| btv
->mbox_iow
| btv
->mbox_csel
,
3337 btv
->mbox_ior
| btv
->mbox_iow
| btv
->mbox_csel
);
3344 if (btv
->mbox_ior
) {
3345 gpio_bits(btv
->mbox_iow
| btv
->mbox_csel
, 0);
3350 static int bus_in(struct bttv
*btv
, int bit
)
3352 if (btv
->mbox_ior
) {
3353 gpio_bits(btv
->mbox_ior
| btv
->mbox_iow
| btv
->mbox_csel
,
3354 btv
->mbox_ior
| btv
->mbox_iow
| btv
->mbox_csel
);
3357 gpio_bits(btv
->mbox_iow
| btv
->mbox_csel
, 0);
3360 return gpio_read() & (bit
);
3363 /* TEA5757 register bits */
3364 #define TEA_FREQ 0:14
3365 #define TEA_BUFFER 15:15
3367 #define TEA_SIGNAL_STRENGTH 16:17
3369 #define TEA_PORT1 18:18
3370 #define TEA_PORT0 19:19
3372 #define TEA_BAND 20:21
3373 #define TEA_BAND_FM 0
3374 #define TEA_BAND_MW 1
3375 #define TEA_BAND_LW 2
3376 #define TEA_BAND_SW 3
3378 #define TEA_MONO 22:22
3379 #define TEA_ALLOW_STEREO 0
3380 #define TEA_FORCE_MONO 1
3382 #define TEA_SEARCH_DIRECTION 23:23
3383 #define TEA_SEARCH_DOWN 0
3384 #define TEA_SEARCH_UP 1
3386 #define TEA_STATUS 24:24
3387 #define TEA_STATUS_TUNED 0
3388 #define TEA_STATUS_SEARCHING 1
3390 /* Low-level stuff */
3391 static int tea5757_read(struct bttv
*btv
)
3393 unsigned long timeout
;
3397 /* better safe than sorry */
3398 gpio_inout(btv
->mbox_mask
, btv
->mbox_clk
| btv
->mbox_we
);
3400 if (btv
->mbox_ior
) {
3401 gpio_bits(btv
->mbox_ior
| btv
->mbox_iow
| btv
->mbox_csel
,
3402 btv
->mbox_ior
| btv
->mbox_iow
| btv
->mbox_csel
);
3407 bttv_gpio_tracking(btv
,"tea5757 read");
3409 bus_low(btv
,btv
->mbox_we
);
3410 bus_low(btv
,btv
->mbox_clk
);
3413 timeout
= jiffies
+ HZ
;
3415 // wait for DATA line to go low; error if it doesn't
3416 while (bus_in(btv
,btv
->mbox_data
) && time_before(jiffies
, timeout
))
3418 if (bus_in(btv
,btv
->mbox_data
)) {
3419 printk(KERN_WARNING
"bttv%d: tea5757: read timeout\n",btv
->c
.nr
);
3423 dprintk("bttv%d: tea5757:",btv
->c
.nr
);
3424 for(i
= 0; i
< 24; i
++)
3427 bus_high(btv
,btv
->mbox_clk
);
3429 dprintk("%c",(bus_in(btv
,btv
->mbox_most
) == 0)?'T':'-');
3430 bus_low(btv
,btv
->mbox_clk
);
3432 value
|= (bus_in(btv
,btv
->mbox_data
) == 0)?0:1; /* MSB first */
3433 dprintk("%c", (bus_in(btv
,btv
->mbox_most
) == 0)?'S':'M');
3435 dprintk("\nbttv%d: tea5757: read 0x%X\n", btv
->c
.nr
, value
);
3439 static int tea5757_write(struct bttv
*btv
, int value
)
3444 gpio_inout(btv
->mbox_mask
, btv
->mbox_clk
| btv
->mbox_we
| btv
->mbox_data
);
3446 if (btv
->mbox_ior
) {
3447 gpio_bits(btv
->mbox_ior
| btv
->mbox_iow
| btv
->mbox_csel
,
3448 btv
->mbox_ior
| btv
->mbox_iow
| btv
->mbox_csel
);
3452 bttv_gpio_tracking(btv
,"tea5757 write");
3454 dprintk("bttv%d: tea5757: write 0x%X\n", btv
->c
.nr
, value
);
3455 bus_low(btv
,btv
->mbox_clk
);
3456 bus_high(btv
,btv
->mbox_we
);
3457 for(i
= 0; i
< 25; i
++)
3459 if (reg
& 0x1000000)
3460 bus_high(btv
,btv
->mbox_data
);
3462 bus_low(btv
,btv
->mbox_data
);
3464 bus_high(btv
,btv
->mbox_clk
);
3466 bus_low(btv
,btv
->mbox_clk
);
3469 bus_low(btv
,btv
->mbox_we
); /* unmute !!! */
3473 void tea5757_set_freq(struct bttv
*btv
, unsigned short freq
)
3475 dprintk("tea5757_set_freq %d\n",freq
);
3476 tea5757_write(btv
, 5 * freq
+ 0x358); /* add 10.7MHz (see docs) */
3478 /* breaks Miro PCTV */
3479 value
= tea5757_read(btv
);
3480 dprintk("bttv%d: tea5757 readback=0x%x\n",btv
->c
.nr
,value
);
3485 /* ----------------------------------------------------------------------- */
3488 void winview_audio(struct bttv
*btv
, struct video_audio
*v
, int set
)
3490 /* PT2254A programming Jon Tombs, jon@gte.esi.us.es */
3491 int bits_out
, loops
, vol
, data
;
3494 /* Fixed by Leandro Lucarella <luca@linuxmendoza.org.ar (07/31/01) */
3495 v
->flags
|= VIDEO_AUDIO_VOLUME
;
3499 /* 32 levels logarithmic */
3500 vol
= 32 - ((v
->volume
>>11));
3502 bits_out
= (PT2254_DBS_IN_2
>>(vol
%5));
3504 bits_out
|= (PT2254_DBS_IN_10
>>(vol
/5));
3505 bits_out
|= PT2254_L_CHANNEL
| PT2254_R_CHANNEL
;
3507 data
&= ~(WINVIEW_PT2254_CLK
| WINVIEW_PT2254_DATA
|
3508 WINVIEW_PT2254_STROBE
);
3509 for (loops
= 17; loops
>= 0 ; loops
--) {
3510 if (bits_out
& (1<<loops
))
3511 data
|= WINVIEW_PT2254_DATA
;
3513 data
&= ~WINVIEW_PT2254_DATA
;
3516 data
|= WINVIEW_PT2254_CLK
;
3519 data
&= ~WINVIEW_PT2254_CLK
;
3522 data
|= WINVIEW_PT2254_STROBE
;
3523 data
&= ~WINVIEW_PT2254_DATA
;
3526 data
&= ~WINVIEW_PT2254_STROBE
;
3530 /* ----------------------------------------------------------------------- */
3531 /* mono/stereo control for various cards (which don't use i2c chips but */
3532 /* connect something to the GPIO pins */
3535 gvbctv3pci_audio(struct bttv
*btv
, struct video_audio
*v
, int set
)
3537 unsigned int con
= 0;
3540 gpio_inout(0x300, 0x300);
3541 if (v
->mode
& VIDEO_SOUND_LANG1
)
3543 if (v
->mode
& VIDEO_SOUND_LANG2
)
3545 if (v
->mode
& VIDEO_SOUND_STEREO
)
3547 // if (v->mode & VIDEO_SOUND_MONO)
3549 gpio_bits(0x300, con
);
3551 v
->mode
= VIDEO_SOUND_STEREO
|
3552 VIDEO_SOUND_LANG1
| VIDEO_SOUND_LANG2
;
3557 gvbctv5pci_audio(struct bttv
*btv
, struct video_audio
*v
, int set
)
3559 unsigned int val
, con
;
3561 #if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0)
3562 if (btv
->radio_user
)
3572 if (v
->mode
& VIDEO_SOUND_LANG2
) {
3573 if (v
->mode
& VIDEO_SOUND_LANG1
) {
3582 if (con
!= (val
& 0x300)) {
3583 gpio_bits(0x300, con
);
3585 bttv_gpio_tracking(btv
,"gvbctv5pci");
3588 switch (val
& 0x70) {
3590 v
->mode
= VIDEO_SOUND_LANG1
| VIDEO_SOUND_LANG2
;
3593 v
->mode
= VIDEO_SOUND_LANG2
;
3596 v
->mode
= VIDEO_SOUND_LANG1
;
3599 v
->mode
= VIDEO_SOUND_STEREO
;
3602 v
->mode
= VIDEO_SOUND_MONO
;
3605 v
->mode
= VIDEO_SOUND_MONO
| VIDEO_SOUND_STEREO
|
3606 VIDEO_SOUND_LANG1
| VIDEO_SOUND_LANG2
;
3612 * Mario Medina Nussbaum <medisoft@alohabbs.org.mx>
3613 * I discover that on BT848_GPIO_DATA address a byte 0xcce enable stereo,
3614 * 0xdde enables mono and 0xccd enables sap
3616 * Petr Vandrovec <VANDROVE@vc.cvut.cz>
3617 * P.S.: At least mask in line above is wrong - GPIO pins 3,2 select
3618 * input/output sound connection, so both must be set for output mode.
3620 * Looks like it's needed only for the "tvphone", the "tvphone 98"
3621 * handles this with a tda9840
3625 avermedia_tvphone_audio(struct bttv
*btv
, struct video_audio
*v
, int set
)
3630 if (v
->mode
& VIDEO_SOUND_LANG2
) /* SAP */
3632 if (v
->mode
& VIDEO_SOUND_STEREO
)
3635 gpio_bits(0x03,val
);
3637 bttv_gpio_tracking(btv
,"avermedia");
3640 v
->mode
= VIDEO_SOUND_MONO
| VIDEO_SOUND_STEREO
|
3647 avermedia_tv_stereo_audio(struct bttv
*btv
, struct video_audio
*v
, int set
)
3652 if (v
->mode
& VIDEO_SOUND_LANG2
) /* SAP */
3654 if (v
->mode
& VIDEO_SOUND_STEREO
) /* STEREO */
3656 btaor(val
, ~0x03, BT848_GPIO_DATA
);
3658 bttv_gpio_tracking(btv
,"avermedia");
3660 v
->mode
= VIDEO_SOUND_MONO
| VIDEO_SOUND_STEREO
|
3661 VIDEO_SOUND_LANG1
| VIDEO_SOUND_LANG2
;
3666 /* Lifetec 9415 handling */
3668 lt9415_audio(struct bttv
*btv
, struct video_audio
*v
, int set
)
3672 if (gpio_read() & 0x4000) {
3673 v
->mode
= VIDEO_SOUND_MONO
;
3678 if (v
->mode
& VIDEO_SOUND_LANG2
) /* A2 SAP */
3680 if (v
->mode
& VIDEO_SOUND_STEREO
) /* A2 stereo */
3682 if ((v
->mode
& VIDEO_SOUND_LANG1
) ||
3683 (v
->mode
& VIDEO_SOUND_MONO
))
3685 gpio_bits(0x0880, val
);
3687 bttv_gpio_tracking(btv
,"lt9415");
3689 /* autodetect doesn't work with this card :-( */
3690 v
->mode
= VIDEO_SOUND_MONO
| VIDEO_SOUND_STEREO
|
3691 VIDEO_SOUND_LANG1
| VIDEO_SOUND_LANG2
;
3696 // TDA9821 on TerraTV+ Bt848, Bt878
3698 terratv_audio(struct bttv
*btv
, struct video_audio
*v
, int set
)
3700 unsigned int con
= 0;
3703 gpio_inout(0x180000,0x180000);
3704 if (v
->mode
& VIDEO_SOUND_LANG2
)
3706 if (v
->mode
& VIDEO_SOUND_STEREO
)
3708 gpio_bits(0x180000, con
);
3710 bttv_gpio_tracking(btv
,"terratv");
3712 v
->mode
= VIDEO_SOUND_MONO
| VIDEO_SOUND_STEREO
|
3713 VIDEO_SOUND_LANG1
| VIDEO_SOUND_LANG2
;
3718 winfast2000_audio(struct bttv
*btv
, struct video_audio
*v
, int set
)
3720 unsigned long val
= 0;
3723 /*btor (0xc32000, BT848_GPIO_OUT_EN);*/
3724 if (v
->mode
& VIDEO_SOUND_MONO
) /* Mono */
3726 if (v
->mode
& VIDEO_SOUND_LANG1
) /* Mono */
3728 if (v
->mode
& VIDEO_SOUND_LANG2
) /* SAP */
3730 if (v
->mode
& VIDEO_SOUND_STEREO
) /* Stereo */
3733 gpio_bits(0x430000, val
);
3735 bttv_gpio_tracking(btv
,"winfast2000");
3738 v
->mode
= VIDEO_SOUND_MONO
| VIDEO_SOUND_STEREO
|
3739 VIDEO_SOUND_LANG1
| VIDEO_SOUND_LANG2
;
3744 * Dariusz Kowalewski <darekk@automex.pl>
3745 * sound control for Prolink PV-BT878P+9B (PixelView PlayTV Pro FM+NICAM
3746 * revision 9B has on-board TDA9874A sound decoder).
3748 * Note: There are card variants without tda9874a. Forcing the "stereo sound route"
3749 * will mute this cards.
3752 pvbt878p9b_audio(struct bttv
*btv
, struct video_audio
*v
, int set
)
3754 unsigned int val
= 0;
3756 #if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0)
3757 if (btv
->radio_user
)
3765 if (v
->mode
& VIDEO_SOUND_MONO
) {
3768 if ((v
->mode
& (VIDEO_SOUND_LANG1
| VIDEO_SOUND_LANG2
))
3769 || (v
->mode
& VIDEO_SOUND_STEREO
)) {
3773 gpio_bits(0x03,val
);
3775 bttv_gpio_tracking(btv
,"pvbt878p9b");
3778 v
->mode
= VIDEO_SOUND_MONO
| VIDEO_SOUND_STEREO
|
3779 VIDEO_SOUND_LANG1
| VIDEO_SOUND_LANG2
;
3784 * Dariusz Kowalewski <darekk@automex.pl>
3785 * sound control for FlyVideo 2000S (with tda9874 decoder)
3786 * based on pvbt878p9b_audio() - this is not tested, please fix!!!
3789 fv2000s_audio(struct bttv
*btv
, struct video_audio
*v
, int set
)
3791 unsigned int val
= 0xffff;
3793 #if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0)
3794 if (btv
->radio_user
)
3801 if (v
->mode
& VIDEO_SOUND_MONO
) {
3804 if ((v
->mode
& (VIDEO_SOUND_LANG1
| VIDEO_SOUND_LANG2
))
3805 || (v
->mode
& VIDEO_SOUND_STEREO
)) {
3806 val
= 0x1080; //-dk-???: 0x0880, 0x0080, 0x1800 ...
3808 if (val
!= 0xffff) {
3809 gpio_bits(0x1800, val
);
3811 bttv_gpio_tracking(btv
,"fv2000s");
3814 v
->mode
= VIDEO_SOUND_MONO
| VIDEO_SOUND_STEREO
|
3815 VIDEO_SOUND_LANG1
| VIDEO_SOUND_LANG2
;
3820 * sound control for Canopus WinDVR PCI
3821 * Masaki Suzuki <masaki@btree.org>
3824 windvr_audio(struct bttv
*btv
, struct video_audio
*v
, int set
)
3826 unsigned long val
= 0;
3829 if (v
->mode
& VIDEO_SOUND_MONO
)
3831 if (v
->mode
& VIDEO_SOUND_LANG1
)
3833 if (v
->mode
& VIDEO_SOUND_LANG2
)
3835 if (v
->mode
& VIDEO_SOUND_STEREO
)
3838 gpio_bits(0x140000, val
);
3840 bttv_gpio_tracking(btv
,"windvr");
3843 v
->mode
= VIDEO_SOUND_MONO
| VIDEO_SOUND_STEREO
|
3844 VIDEO_SOUND_LANG1
| VIDEO_SOUND_LANG2
;
3849 * sound control for AD-TVK503
3850 * Hiroshi Takekawa <sian@big.or.jp>
3853 adtvk503_audio(struct bttv
*btv
, struct video_audio
*v
, int set
)
3855 unsigned int con
= 0xffffff;
3857 //btaor(0x1e0000, ~0x1e0000, BT848_GPIO_OUT_EN);
3860 //btor(***, BT848_GPIO_OUT_EN);
3861 if (v
->mode
& VIDEO_SOUND_LANG1
)
3863 if (v
->mode
& VIDEO_SOUND_LANG2
)
3865 if (v
->mode
& VIDEO_SOUND_STEREO
)
3867 if (v
->mode
& VIDEO_SOUND_MONO
)
3869 if (con
!= 0xffffff) {
3870 gpio_bits(0x1e0000,con
);
3872 bttv_gpio_tracking(btv
, "adtvk503");
3875 v
->mode
= VIDEO_SOUND_MONO
| VIDEO_SOUND_STEREO
|
3876 VIDEO_SOUND_LANG1
| VIDEO_SOUND_LANG2
;
3880 /* RemoteVision MX (rv605) muxsel helper [Miguel Freitas]
3882 * This is needed because rv605 don't use a normal multiplex, but a crosspoint
3883 * switch instead (CD22M3494E). This IC can have multiple active connections
3884 * between Xn (input) and Yn (output) pins. We need to clear any existing
3885 * connection prior to establish a new one, pulsing the STROBE pin.
3887 * The board hardwire Y0 (xpoint) to MUX1 and MUXOUT to Yin.
3888 * GPIO pins are wired as:
3889 * GPIO[0:3] - AX[0:3] (xpoint) - P1[0:3] (microcontroler)
3890 * GPIO[4:6] - AY[0:2] (xpoint) - P1[4:6] (microcontroler)
3891 * GPIO[7] - DATA (xpoint) - P1[7] (microcontroler)
3892 * GPIO[8] - - P3[5] (microcontroler)
3893 * GPIO[9] - RESET (xpoint) - P3[6] (microcontroler)
3894 * GPIO[10] - STROBE (xpoint) - P3[7] (microcontroler)
3895 * GPINTR - - P3[4] (microcontroler)
3897 * The microcontroler is a 80C32 like. It should be possible to change xpoint
3898 * configuration either directly (as we are doing) or using the microcontroler
3899 * which is also wired to I2C interface. I have no further info on the
3900 * microcontroler features, one would need to disassembly the firmware.
3901 * note: the vendor refused to give any information on this product, all
3902 * that stuff was found using a multimeter! :)
3904 static void rv605_muxsel(struct bttv
*btv
, unsigned int input
)
3906 /* reset all conections */
3907 gpio_bits(0x200,0x200);
3909 gpio_bits(0x200,0x000);
3912 /* create a new conection */
3913 gpio_bits(0x480,0x080);
3914 gpio_bits(0x480,0x480);
3916 gpio_bits(0x480,0x080);
3920 /* Tibet Systems 'Progress DVR' CS16 muxsel helper [Chris Fanning]
3922 * The CS16 (available on eBay cheap) is a PCI board with four Fusion
3923 * 878A chips, a PCI bridge, an Atmel microcontroller, four sync seperator
3924 * chips, ten eight input analog multiplexors, a not chip and a few
3927 * 16 inputs on a secondary bracket are provided and can be selected
3928 * from each of the four capture chips. Two of the eight input
3929 * multiplexors are used to select from any of the 16 input signals.
3931 * Unsupported hardware capabilities:
3932 * . A video output monitor on the secondary bracket can be selected from
3933 * one of the 878A chips.
3934 * . Another passthrough but I haven't spent any time investigating it.
3935 * . Digital I/O (logic level connected to GPIO) is available from an
3938 * The on chip input mux should always be set to 2.
3939 * GPIO[16:19] - Video input selection
3940 * GPIO[0:3] - Video output monitor select (only available from one 878A)
3941 * GPIO[?:?] - Digital I/O.
3943 * There is an ATMEL microcontroller with an 8031 core on board. I have not
3944 * determined what function (if any) it provides. With the microcontroller
3945 * and sync seperator chips a guess is that it might have to do with video
3946 * switching and maybe some digital I/O.
3948 static void tibetCS16_muxsel(struct bttv
*btv
, unsigned int input
)
3951 gpio_bits(0x0f0000, input
<< 16);
3954 static void tibetCS16_init(struct bttv
*btv
)
3956 /* enable gpio bits, mask obtained via btSpy */
3957 gpio_inout(0xffffff, 0x0f7fff);
3958 gpio_write(0x0f7fff);
3962 * The following routines for the Kodicom-4400r get a little mind-twisting.
3963 * There is a "master" controller and three "slave" controllers, together
3964 * an analog switch which connects any of 16 cameras to any of the BT87A's.
3965 * The analog switch is controlled by the "master", but the detection order
3966 * of the four BT878A chips is in an order which I just don't understand.
3967 * The "master" is actually the second controller to be detected. The
3968 * logic on the board uses logical numbers for the 4 controlers, but
3969 * those numbers are different from the detection sequence. When working
3970 * with the analog switch, we need to "map" from the detection sequence
3971 * over to the board's logical controller number. This mapping sequence
3972 * is {3, 0, 2, 1}, i.e. the first controller to be detected is logical
3973 * unit 3, the second (which is the master) is logical unit 0, etc.
3974 * We need to maintain the status of the analog switch (which of the 16
3975 * cameras is connected to which of the 4 controllers). Rather than
3976 * add to the bttv structure for this, we use the data reserved for
3977 * the mbox (unused for this card type).
3981 * First a routine to set the analog switch, which controls which camera
3982 * is routed to which controller. The switch comprises an X-address
3983 * (gpio bits 0-3, representing the camera, ranging from 0-15), and a
3984 * Y-address (gpio bits 4-6, representing the controller, ranging from 0-3).
3985 * A data value (gpio bit 7) of '1' enables the switch, and '0' disables
3986 * the switch. A STROBE bit (gpio bit 8) latches the data value into the
3987 * specified address. The idea is to set the address and data, then bring
3988 * STROBE high, and finally bring STROBE back to low.
3990 static void kodicom4400r_write(struct bttv
*btv
,
3991 unsigned char xaddr
,
3992 unsigned char yaddr
,
3993 unsigned char data
) {
3996 udata
= (data
<< 7) | ((yaddr
&3) << 4) | (xaddr
&0xf);
3997 gpio_bits(0x1ff, udata
); /* write ADDR and DAT */
3998 gpio_bits(0x1ff, udata
| (1 << 8)); /* strobe high */
3999 gpio_bits(0x1ff, udata
); /* strobe low */
4003 * Next the mux select. Both the "master" and "slave" 'cards' (controllers)
4004 * use this routine. The routine finds the "master" for the card, maps
4005 * the controller number from the detected position over to the logical
4006 * number, writes the appropriate data to the analog switch, and housekeeps
4007 * the local copy of the switch information. The parameter 'input' is the
4008 * requested camera number (0 - 15).
4010 static void kodicom4400r_muxsel(struct bttv
*btv
, unsigned int input
)
4015 static unsigned char map
[4] = {3, 0, 2, 1};
4017 mctlr
= master
[btv
->c
.nr
];
4018 if (mctlr
== NULL
) { /* ignore if master not yet detected */
4021 yaddr
= (btv
->c
.nr
- mctlr
->c
.nr
+ 1) & 3; /* the '&' is for safety */
4023 sw_status
= (char *)(&mctlr
->mbox_we
);
4024 xaddr
= input
& 0xf;
4025 /* Check if the controller/camera pair has changed, else ignore */
4026 if (sw_status
[yaddr
] != xaddr
)
4028 /* "open" the old switch, "close" the new one, save the new */
4029 kodicom4400r_write(mctlr
, sw_status
[yaddr
], yaddr
, 0);
4030 sw_status
[yaddr
] = xaddr
;
4031 kodicom4400r_write(mctlr
, xaddr
, yaddr
, 1);
4036 * During initialisation, we need to reset the analog switch. We
4037 * also preset the switch to map the 4 connectors on the card to the
4038 * *user's* (see above description of kodicom4400r_muxsel) channels
4041 static void kodicom4400r_init(struct bttv
*btv
)
4043 char *sw_status
= (char *)(&btv
->mbox_we
);
4046 gpio_inout(0x0003ff, 0x0003ff);
4047 gpio_write(1 << 9); /* reset MUX */
4049 /* Preset camera 0 to the 4 controllers */
4050 for (ix
=0; ix
<4; ix
++) {
4052 kodicom4400r_write(btv
, ix
, ix
, 1);
4055 * Since this is the "master", we need to set up the
4056 * other three controller chips' pointers to this structure
4057 * for later use in the muxsel routine.
4059 if ((btv
->c
.nr
<1) || (btv
->c
.nr
>BTTV_MAX
-3))
4061 master
[btv
->c
.nr
-1] = btv
;
4062 master
[btv
->c
.nr
] = btv
;
4063 master
[btv
->c
.nr
+1] = btv
;
4064 master
[btv
->c
.nr
+2] = btv
;
4067 // The Grandtec X-Guard framegrabber card uses two Dual 4-channel
4068 // video multiplexers to provide up to 16 video inputs. These
4069 // multiplexers are controlled by the lower 8 GPIO pins of the
4070 // bt878. The multiplexers probably Pericom PI5V331Q or similar.
4072 // xxx0 is pin xxx of multiplexer U5,
4073 // yyy1 is pin yyy of multiplexer U2
4085 static void xguard_muxsel(struct bttv
*btv
, unsigned int input
)
4087 static const int masks
[] = {
4088 ENB0
, ENB0
|IN00
, ENB0
|IN10
, ENB0
|IN00
|IN10
,
4089 ENA0
, ENA0
|IN00
, ENA0
|IN10
, ENA0
|IN00
|IN10
,
4090 ENB1
, ENB1
|IN01
, ENB1
|IN11
, ENB1
|IN01
|IN11
,
4091 ENA1
, ENA1
|IN01
, ENA1
|IN11
, ENA1
|IN01
|IN11
,
4093 gpio_write(masks
[input
%16]);
4095 static void picolo_tetra_init(struct bttv
*btv
)
4097 /*This is the video input redirection fonctionality : I DID NOT USED IT. */
4098 btwrite (0x08<<16,BT848_GPIO_DATA
);/*GPIO[19] [==> 4053 B+C] set to 1 */
4099 btwrite (0x04<<16,BT848_GPIO_DATA
);/*GPIO[18] [==> 4053 A] set to 1*/
4101 static void picolo_tetra_muxsel (struct bttv
* btv
, unsigned int input
)
4104 dprintk (KERN_DEBUG
"bttv%d : picolo_tetra_muxsel => input = %d\n",btv
->c
.nr
,input
);
4105 /*Just set the right path in the analog multiplexers : channel 1 -> 4 ==> Analog Mux ==> MUX0*/
4106 /*GPIO[20]&GPIO[21] used to choose the right input*/
4107 btwrite (input
<<20,BT848_GPIO_DATA
);
4112 * ivc120_muxsel [Added by Alan Garfield <alan@fromorbit.com>]
4114 * The IVC120G security card has 4 i2c controlled TDA8540 matrix
4115 * swichers to provide 16 channels to MUX0. The TDA8540's have
4116 * 4 indepedant outputs and as such the IVC120G also has the
4117 * optional "Monitor Out" bus. This allows the card to be looking
4118 * at one input while the monitor is looking at another.
4120 * Since I've couldn't be bothered figuring out how to add an
4121 * independant muxsel for the monitor bus, I've just set it to
4122 * whatever the card is looking at.
4124 * OUT0 of the TDA8540's is connected to MUX0 (0x03)
4125 * OUT1 of the TDA8540's is connected to "Monitor Out" (0x0C)
4127 * TDA8540_ALT3 IN0-3 = Channel 13 - 16 (0x03)
4128 * TDA8540_ALT4 IN0-3 = Channel 1 - 4 (0x03)
4129 * TDA8540_ALT5 IN0-3 = Channel 5 - 8 (0x03)
4130 * TDA8540_ALT6 IN0-3 = Channel 9 - 12 (0x03)
4134 /* All 7 possible sub-ids for the TDA8540 Matrix Switcher */
4135 #define I2C_TDA8540 0x90
4136 #define I2C_TDA8540_ALT1 0x92
4137 #define I2C_TDA8540_ALT2 0x94
4138 #define I2C_TDA8540_ALT3 0x96
4139 #define I2C_TDA8540_ALT4 0x98
4140 #define I2C_TDA8540_ALT5 0x9a
4141 #define I2C_TDA8540_ALT6 0x9c
4143 static void ivc120_muxsel(struct bttv
*btv
, unsigned int input
)
4146 int key
= input
% 4;
4147 int matrix
= input
/ 4;
4149 dprintk("bttv%d: ivc120_muxsel: Input - %02d | TDA - %02d | In - %02d\n",
4150 btv
->c
.nr
, input
, matrix
, key
);
4152 // Handles the input selection on the TDA8540's
4153 bttv_I2CWrite(btv
, I2C_TDA8540_ALT3
, 0x00,
4154 ((matrix
== 3) ? (key
| key
<< 2) : 0x00), 1);
4155 bttv_I2CWrite(btv
, I2C_TDA8540_ALT4
, 0x00,
4156 ((matrix
== 0) ? (key
| key
<< 2) : 0x00), 1);
4157 bttv_I2CWrite(btv
, I2C_TDA8540_ALT5
, 0x00,
4158 ((matrix
== 1) ? (key
| key
<< 2) : 0x00), 1);
4159 bttv_I2CWrite(btv
, I2C_TDA8540_ALT6
, 0x00,
4160 ((matrix
== 2) ? (key
| key
<< 2) : 0x00), 1);
4162 // Handles the output enables on the TDA8540's
4163 bttv_I2CWrite(btv
, I2C_TDA8540_ALT3
, 0x02,
4164 ((matrix
== 3) ? 0x03 : 0x00), 1); // 13 - 16
4165 bttv_I2CWrite(btv
, I2C_TDA8540_ALT4
, 0x02,
4166 ((matrix
== 0) ? 0x03 : 0x00), 1); // 1-4
4167 bttv_I2CWrite(btv
, I2C_TDA8540_ALT5
, 0x02,
4168 ((matrix
== 1) ? 0x03 : 0x00), 1); // 5-8
4169 bttv_I2CWrite(btv
, I2C_TDA8540_ALT6
, 0x02,
4170 ((matrix
== 2) ? 0x03 : 0x00), 1); // 9-12
4172 // Selects MUX0 for input on the 878
4173 btaor((0)<<5, ~(3<<5), BT848_IFORM
);
4177 /* PXC200 muxsel helper
4178 * luke@syseng.anu.edu.au
4179 * another transplant
4180 * from Alessandro Rubini (rubini@linux.it)
4182 * There are 4 kinds of cards:
4183 * PXC200L which is bt848
4184 * PXC200F which is bt848 with PIC controlling mux
4185 * PXC200AL which is bt878
4186 * PXC200AF which is bt878 with PIC controlling mux
4188 #define PX_CFG_PXC200F 0x01
4189 #define PX_FLAG_PXC200A 0x00001000 /* a pxc200A is bt-878 based */
4190 #define PX_I2C_PIC 0x0f
4191 #define PX_PXC200A_CARDID 0x200a1295
4192 #define PX_I2C_CMD_CFG 0x00
4194 static void PXC200_muxsel(struct bttv
*btv
, unsigned int input
)
4199 unsigned char buf
[2];
4201 /* Read PIC config to determine if this is a PXC200F */
4205 rc
=bttv_I2CWrite(btv
,(PX_I2C_PIC
<<1),buf
[0],buf
[1],1);
4207 printk(KERN_DEBUG
"bttv%d: PXC200_muxsel: pic cfg write failed:%d\n", btv
->c
.nr
,rc
);
4208 /* not PXC ? do nothing */
4212 rc
=bttv_I2CRead(btv
,(PX_I2C_PIC
<<1),NULL
);
4213 if (!(rc
& PX_CFG_PXC200F
)) {
4214 printk(KERN_DEBUG
"bttv%d: PXC200_muxsel: not PXC200F rc:%d \n", btv
->c
.nr
,rc
);
4219 /* The multiplexer in the 200F is handled by the GPIO port */
4220 /* get correct mapping between inputs */
4221 /* mux = bttv_tvcards[btv->type].muxsel[input] & 3; */
4222 /* ** not needed!? */
4225 /* make sure output pins are enabled */
4226 /* bitmask=0x30f; */
4228 /* check whether we have a PXC200A */
4229 if (btv
->cardid
== PX_PXC200A_CARDID
) {
4230 bitmask
^= 0x180; /* use 7 and 9, not 8 and 9 */
4231 bitmask
|= 7<<4; /* the DAC */
4233 btwrite(bitmask
, BT848_GPIO_OUT_EN
);
4235 bitmask
= btread(BT848_GPIO_DATA
);
4236 if (btv
->cardid
== PX_PXC200A_CARDID
)
4237 bitmask
= (bitmask
& ~0x280) | ((mux
& 2) << 8) | ((mux
& 1) << 7);
4238 else /* older device */
4239 bitmask
= (bitmask
& ~0x300) | ((mux
& 3) << 8);
4240 btwrite(bitmask
,BT848_GPIO_DATA
);
4243 * Was "to be safe, set the bt848 to input 0"
4244 * Actually, since it's ok at load time, better not messing
4245 * with these bits (on PXC200AF you need to set mux 2 here)
4247 * needed because bttv-driver sets mux before calling this function
4249 if (btv
->cardid
== PX_PXC200A_CARDID
)
4250 btaor(2<<5, ~BT848_IFORM_MUXSEL
, BT848_IFORM
);
4251 else /* older device */
4252 btand(~BT848_IFORM_MUXSEL
,BT848_IFORM
);
4254 printk(KERN_DEBUG
"bttv%d: setting input channel to:%d\n", btv
->c
.nr
,(int)mux
);
4257 /* ----------------------------------------------------------------------- */
4258 /* motherboard chipset specific stuff */
4260 void __devinit
bttv_check_chipset(void)
4262 int pcipci_fail
= 0;
4263 struct pci_dev
*dev
= NULL
;
4265 if (pci_pci_problems
& PCIPCI_FAIL
)
4267 if (pci_pci_problems
& (PCIPCI_TRITON
|PCIPCI_NATOMA
|PCIPCI_VIAETBF
))
4269 if (pci_pci_problems
& PCIPCI_VSFX
)
4271 #ifdef PCIPCI_ALIMAGIK
4272 if (pci_pci_problems
& PCIPCI_ALIMAGIK
)
4277 /* print which chipset we have */
4278 while ((dev
= pci_find_class(PCI_CLASS_BRIDGE_HOST
<< 8,dev
)))
4279 printk(KERN_INFO
"bttv: Host bridge is %s\n",pci_name(dev
));
4282 /* print warnings about any quirks found */
4284 printk(KERN_INFO
"bttv: Host bridge needs ETBF enabled.\n");
4286 printk(KERN_INFO
"bttv: Host bridge needs VSFX enabled.\n");
4288 printk(KERN_WARNING
"bttv: BT848 and your chipset may not work together.\n");
4289 if (UNSET
== no_overlay
) {
4290 printk(KERN_WARNING
"bttv: going to disable overlay.\n");
4294 if (UNSET
!= latency
)
4295 printk(KERN_INFO
"bttv: pci latency fixup [%d]\n",latency
);
4297 while ((dev
= pci_find_device(PCI_VENDOR_ID_INTEL
,
4298 PCI_DEVICE_ID_INTEL_82441
, dev
))) {
4300 pci_read_config_byte(dev
, 0x53, &b
);
4302 printk(KERN_INFO
"bttv: Host bridge: 82441FX Natoma, "
4303 "bufcon=0x%02x\n",b
);
4307 int __devinit
bttv_handle_chipset(struct bttv
*btv
)
4309 unsigned char command
;
4311 if (!triton1
&& !vsfx
&& UNSET
== latency
)
4316 printk(KERN_INFO
"bttv%d: enabling ETBF (430FX/VP3 compatibilty)\n",btv
->c
.nr
);
4317 if (vsfx
&& btv
->id
>= 878)
4318 printk(KERN_INFO
"bttv%d: enabling VSFX\n",btv
->c
.nr
);
4319 if (UNSET
!= latency
)
4320 printk(KERN_INFO
"bttv%d: setting pci timer to %d\n",
4324 if (btv
->id
< 878) {
4325 /* bt848 (mis)uses a bit in the irq mask for etbf */
4327 btv
->triton1
= BT848_INT_ETBF
;
4329 /* bt878 has a bit in the pci config space for it */
4330 pci_read_config_byte(btv
->c
.pci
, BT878_DEVCTRL
, &command
);
4332 command
|= BT878_EN_TBFX
;
4334 command
|= BT878_EN_VSFX
;
4335 pci_write_config_byte(btv
->c
.pci
, BT878_DEVCTRL
, command
);
4337 if (UNSET
!= latency
)
4338 pci_write_config_byte(btv
->c
.pci
, PCI_LATENCY_TIMER
, latency
);