aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/bttv-cards.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/bttv-cards.c')
-rw-r--r--drivers/media/video/bttv-cards.c4350
1 files changed, 4350 insertions, 0 deletions
diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c
new file mode 100644
index 000000000000..abce874e71cc
--- /dev/null
+++ b/drivers/media/video/bttv-cards.c
@@ -0,0 +1,4350 @@
1/*
2 $Id: bttv-cards.c,v 1.47 2005/02/22 14:06:32 kraxel Exp $
3
4 bttv-cards.c
5
6 this file has configuration informations - card-specific stuff
7 like the big tvcards array for the most part
8
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>
12
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.
17
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.
22
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.
26
27*/
28
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>
38
39#include <asm/io.h>
40
41#include "bttvp.h"
42#if 0 /* not working yet */
43#include "bt832.h"
44#endif
45
46/* fwd decl */
47static void boot_msp34xx(struct bttv *btv, int pin);
48static void boot_bt832(struct bttv *btv);
49static void hauppauge_eeprom(struct bttv *btv);
50static void avermedia_eeprom(struct bttv *btv);
51static void osprey_eeprom(struct bttv *btv);
52static void modtec_eeprom(struct bttv *btv);
53static void init_PXC200(struct bttv *btv);
54
55static void winview_audio(struct bttv *btv, struct video_audio *v, int set);
56static void lt9415_audio(struct bttv *btv, struct video_audio *v, int set);
57static void avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v,
58 int set);
59static void avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v,
60 int set);
61static void terratv_audio(struct bttv *btv, struct video_audio *v, int set);
62static void gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set);
63static void gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set);
64static void winfast2000_audio(struct bttv *btv, struct video_audio *v, int set);
65static void pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set);
66static void fv2000s_audio(struct bttv *btv, struct video_audio *v, int set);
67static void windvr_audio(struct bttv *btv, struct video_audio *v, int set);
68static void adtvk503_audio(struct bttv *btv, struct video_audio *v, int set);
69static void rv605_muxsel(struct bttv *btv, unsigned int input);
70static void eagle_muxsel(struct bttv *btv, unsigned int input);
71static void xguard_muxsel(struct bttv *btv, unsigned int input);
72static void ivc120_muxsel(struct bttv *btv, unsigned int input);
73static void gvc1100_muxsel(struct bttv *btv, unsigned int input);
74
75static void PXC200_muxsel(struct bttv *btv, unsigned int input);
76
77static void picolo_tetra_muxsel(struct bttv *btv, unsigned int input);
78static void picolo_tetra_init(struct bttv *btv);
79
80static void tibetCS16_muxsel(struct bttv *btv, unsigned int input);
81static void tibetCS16_init(struct bttv *btv);
82
83static void kodicom4400r_muxsel(struct bttv *btv, unsigned int input);
84static void kodicom4400r_init(struct bttv *btv);
85
86static void sigmaSLC_muxsel(struct bttv *btv, unsigned int input);
87static void sigmaSQ_muxsel(struct bttv *btv, unsigned int input);
88
89static int terratec_active_radio_upgrade(struct bttv *btv);
90static int tea5757_read(struct bttv *btv);
91static int tea5757_write(struct bttv *btv, int value);
92static void identify_by_eeprom(struct bttv *btv,
93 unsigned char eeprom_data[256]);
94static int __devinit pvr_boot(struct bttv *btv);
95
96/* config variables */
97static unsigned int triton1=0;
98static unsigned int vsfx=0;
99static unsigned int latency = UNSET;
100static unsigned int no_overlay=-1;
101
102static unsigned int card[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
103static unsigned int pll[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
104static unsigned int tuner[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
105static unsigned int svhs[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
106static unsigned int remote[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
107static struct bttv *master[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = NULL };
108#ifdef MODULE
109static unsigned int autoload = 1;
110#else
111static unsigned int autoload = 0;
112#endif
113static unsigned int gpiomask = UNSET;
114static unsigned int audioall = UNSET;
115static unsigned int audiomux[5] = { [ 0 ... 4 ] = UNSET };
116
117/* insmod options */
118module_param(triton1, int, 0444);
119module_param(vsfx, int, 0444);
120module_param(no_overlay, int, 0444);
121module_param(latency, int, 0444);
122module_param(gpiomask, int, 0444);
123module_param(audioall, int, 0444);
124module_param(autoload, int, 0444);
125
126module_param_array(card, int, NULL, 0444);
127module_param_array(pll, int, NULL, 0444);
128module_param_array(tuner, int, NULL, 0444);
129module_param_array(svhs, int, NULL, 0444);
130module_param_array(remote, int, NULL, 0444);
131module_param_array(audiomux, int, NULL, 0444);
132
133MODULE_PARM_DESC(triton1,"set ETBF pci config bit "
134 "[enable bug compatibility for triton1 + others]");
135MODULE_PARM_DESC(vsfx,"set VSFX pci config bit "
136 "[yet another chipset flaw workaround]");
137MODULE_PARM_DESC(latency,"pci latency timer");
138MODULE_PARM_DESC(card,"specify TV/grabber card model, see CARDLIST file for a list");
139MODULE_PARM_DESC(pll,"specify installed crystal (0=none, 28=28 MHz, 35=35 MHz)");
140MODULE_PARM_DESC(tuner,"specify installed tuner type");
141MODULE_PARM_DESC(autoload,"automatically load i2c modules like tuner.o, default is 1 (yes)");
142
143/* ----------------------------------------------------------------------- */
144/* list of card IDs for bt878+ cards */
145
146static struct CARD {
147 unsigned id;
148 int cardnr;
149 char *name;
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" },
159
160 { 0x00011002, BTTV_ATI_TVWONDER, "ATI TV Wonder" },
161 { 0x00031002, BTTV_ATI_TVWONDERVE,"ATI TV Wonder/VE" },
162
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" },
172
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" },
179
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" },
183
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)" },
191
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" },
197
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)" },
202
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" }, // ??
211
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" },
217
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" },
223
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" },
228
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" },
233
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" },
259
260 { 0x41424344, BTTV_GRANDTEC, "GrandTec Multi Capture" },
261 { 0x01020304, BTTV_XGUARD, "Grandtec Grand X-Guard" },
262
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" },
269
270 { 0x010115cb, BTTV_GMV1, "AG GMV1" },
271 { 0x010114c7, BTTV_MODTEC_205, "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV" },
272
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" },
283
284 { 0x40111554, BTTV_PV_BT878P_9B, "Prolink Pixelview PV-BT" },
285 { 0x17de0a01, BTTV_KWORLD, "Mecer TV/FM/Video Tuner" },
286
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" },
291
292 // likely broken, vendor id doesn't match the other magic views ...
293 //{ 0xa0fca04f, BTTV_MAGICTVIEW063, "Guillemot Maxi TV Video 3" },
294
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" },
304
305 { 0, -1, NULL }
306};
307
308/* ----------------------------------------------------------------------- */
309/* array with description for bt848 / bt878 tv/grabber cards */
310
311struct tvcard bttv_tvcards[] = {
312{
313/* ---- card 0x00 ---------------------------------- */
314 .name = " *** UNKNOWN/GENERIC *** ",
315 .video_inputs = 4,
316 .audio_inputs = 1,
317 .tuner = 0,
318 .svhs = 2,
319 .muxsel = { 2, 3, 1, 0},
320 .tuner_type = -1,
321},{
322 .name = "MIRO PCTV",
323 .video_inputs = 4,
324 .audio_inputs = 1,
325 .tuner = 0,
326 .svhs = 2,
327 .gpiomask = 15,
328 .muxsel = { 2, 3, 1, 1},
329 .audiomux = { 2, 0, 0, 0, 10},
330 .needs_tvaudio = 1,
331 .tuner_type = -1,
332},{
333 .name = "Hauppauge (bt848)",
334 .video_inputs = 4,
335 .audio_inputs = 1,
336 .tuner = 0,
337 .svhs = 2,
338 .gpiomask = 7,
339 .muxsel = { 2, 3, 1, 1},
340 .audiomux = { 0, 1, 2, 3, 4},
341 .needs_tvaudio = 1,
342 .tuner_type = -1,
343},{
344 .name = "STB, Gateway P/N 6000699 (bt848)",
345 .video_inputs = 3,
346 .audio_inputs = 1,
347 .tuner = 0,
348 .svhs = 2,
349 .gpiomask = 7,
350 .muxsel = { 2, 3, 1, 1},
351 .audiomux = { 4, 0, 2, 3, 1},
352 .no_msp34xx = 1,
353 .needs_tvaudio = 1,
354 .tuner_type = TUNER_PHILIPS_NTSC,
355 .pll = PLL_28,
356 .has_radio = 1,
357},{
358
359/* ---- card 0x04 ---------------------------------- */
360 .name = "Intel Create and Share PCI/ Smart Video Recorder III",
361 .video_inputs = 4,
362 .audio_inputs = 0,
363 .tuner = -1,
364 .svhs = 2,
365 .gpiomask = 0,
366 .muxsel = { 2, 3, 1, 1},
367 .audiomux = { 0 },
368 .needs_tvaudio = 0,
369 .tuner_type = 4,
370},{
371 .name = "Diamond DTV2000",
372 .video_inputs = 4,
373 .audio_inputs = 1,
374 .tuner = 0,
375 .svhs = 2,
376 .gpiomask = 3,
377 .muxsel = { 2, 3, 1, 0},
378 .audiomux = { 0, 1, 0, 1, 3},
379 .needs_tvaudio = 1,
380 .tuner_type = -1,
381},{
382 .name = "AVerMedia TVPhone",
383 .video_inputs = 3,
384 .audio_inputs = 1,
385 .tuner = 0,
386 .svhs = 3,
387 .muxsel = { 2, 3, 1, 1},
388 .gpiomask = 0x0f,
389 .audiomux = { 0x0c, 0x04, 0x08, 0x04, 0},
390 /* 0x04 for some cards ?? */
391 .needs_tvaudio = 1,
392 .tuner_type = -1,
393 .audio_hook = avermedia_tvphone_audio,
394 .has_remote = 1,
395},{
396 .name = "MATRIX-Vision MV-Delta",
397 .video_inputs = 5,
398 .audio_inputs = 1,
399 .tuner = -1,
400 .svhs = 3,
401 .gpiomask = 0,
402 .muxsel = { 2, 3, 1, 0, 0},
403 .audiomux = {0 },
404 .needs_tvaudio = 1,
405 .tuner_type = -1,
406},{
407
408/* ---- card 0x08 ---------------------------------- */
409 .name = "Lifeview FlyVideo II (Bt848) LR26 / MAXI TV Video PCI2 LR26",
410 .video_inputs = 4,
411 .audio_inputs = 1,
412 .tuner = 0,
413 .svhs = 2,
414 .gpiomask = 0xc00,
415 .muxsel = { 2, 3, 1, 1},
416 .audiomux = { 0, 0xc00, 0x800, 0x400, 0xc00, 0},
417 .needs_tvaudio = 1,
418 .pll = PLL_28,
419 .tuner_type = -1,
420},{
421 .name = "IMS/IXmicro TurboTV",
422 .video_inputs = 3,
423 .audio_inputs = 1,
424 .tuner = 0,
425 .svhs = 2,
426 .gpiomask = 3,
427 .muxsel = { 2, 3, 1, 1},
428 .audiomux = { 1, 1, 2, 3, 0},
429 .needs_tvaudio = 0,
430 .pll = PLL_28,
431 .tuner_type = TUNER_TEMIC_PAL,
432},{
433 .name = "Hauppauge (bt878)",
434 .video_inputs = 4,
435 .audio_inputs = 1,
436 .tuner = 0,
437 .svhs = 2,
438 .gpiomask = 0x0f, /* old: 7 */
439 .muxsel = { 2, 0, 1, 1},
440 .audiomux = { 0, 1, 2, 3, 4},
441 .needs_tvaudio = 1,
442 .pll = PLL_28,
443 .tuner_type = -1,
444},{
445 .name = "MIRO PCTV pro",
446 .video_inputs = 3,
447 .audio_inputs = 1,
448 .tuner = 0,
449 .svhs = 2,
450 .gpiomask = 0x3014f,
451 .muxsel = { 2, 3, 1, 1},
452 .audiomux = { 0x20001,0x10001, 0, 0,10},
453 .needs_tvaudio = 1,
454 .tuner_type = -1,
455},{
456
457/* ---- card 0x0c ---------------------------------- */
458 .name = "ADS Technologies Channel Surfer TV (bt848)",
459 .video_inputs = 3,
460 .audio_inputs = 1,
461 .tuner = 0,
462 .svhs = 2,
463 .gpiomask = 15,
464 .muxsel = { 2, 3, 1, 1},
465 .audiomux = { 13, 14, 11, 7, 0, 0},
466 .needs_tvaudio = 1,
467 .tuner_type = -1,
468},{
469 .name = "AVerMedia TVCapture 98",
470 .video_inputs = 3,
471 .audio_inputs = 4,
472 .tuner = 0,
473 .svhs = 2,
474 .gpiomask = 15,
475 .muxsel = { 2, 3, 1, 1},
476 .audiomux = { 13, 14, 11, 7, 0, 0},
477 .needs_tvaudio = 1,
478 .msp34xx_alt = 1,
479 .pll = PLL_28,
480 .tuner_type = TUNER_PHILIPS_PAL,
481 .audio_hook = avermedia_tv_stereo_audio,
482},{
483 .name = "Aimslab Video Highway Xtreme (VHX)",
484 .video_inputs = 3,
485 .audio_inputs = 1,
486 .tuner = 0,
487 .svhs = 2,
488 .gpiomask = 7,
489 .muxsel = { 2, 3, 1, 1},
490 .audiomux = { 0, 2, 1, 3, 4}, /* old: { 0, 1, 2, 3, 4} */
491 .needs_tvaudio = 1,
492 .pll = PLL_28,
493 .tuner_type = -1,
494},{
495 .name = "Zoltrix TV-Max",
496 .video_inputs = 3,
497 .audio_inputs = 1,
498 .tuner = 0,
499 .svhs = 2,
500 .gpiomask = 15,
501 .muxsel = { 2, 3, 1, 1},
502 .audiomux = {0 , 0, 1 , 0, 10},
503 .needs_tvaudio = 1,
504 .tuner_type = -1,
505},{
506
507/* ---- card 0x10 ---------------------------------- */
508 .name = "Prolink Pixelview PlayTV (bt878)",
509 .video_inputs = 3,
510 .audio_inputs = 1,
511 .tuner = 0,
512 .svhs = 2,
513 .gpiomask = 0x01fe00,
514 .muxsel = { 2, 3, 1, 1},
515#if 0
516 // old
517 .audiomux = { 0x01c000, 0, 0x018000, 0x014000, 0x002000, 0 },
518#else
519 // 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru>
520 .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 },
521#endif
522 .needs_tvaudio = 1,
523 .pll = PLL_28,
524 .tuner_type = -1,
525},{
526 .name = "Leadtek WinView 601",
527 .video_inputs = 3,
528 .audio_inputs = 1,
529 .tuner = 0,
530 .svhs = 2,
531 .gpiomask = 0x8300f8,
532 .muxsel = { 2, 3, 1, 1,0},
533 .audiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007},
534 .needs_tvaudio = 1,
535 .tuner_type = -1,
536 .audio_hook = winview_audio,
537 .has_radio = 1,
538},{
539 .name = "AVEC Intercapture",
540 .video_inputs = 3,
541 .audio_inputs = 2,
542 .tuner = 0,
543 .svhs = 2,
544 .gpiomask = 0,
545 .muxsel = {2, 3, 1, 1},
546 .audiomux = {1, 0, 0, 0, 0},
547 .needs_tvaudio = 1,
548 .tuner_type = -1,
549},{
550 .name = "Lifeview FlyVideo II EZ /FlyKit LR38 Bt848 (capture only)",
551 .video_inputs = 4,
552 .audio_inputs = 1,
553 .tuner = -1,
554 .svhs = -1,
555 .gpiomask = 0x8dff00,
556 .muxsel = { 2, 3, 1, 1},
557 .audiomux = { 0 },
558 .no_msp34xx = 1,
559 .tuner_type = -1,
560},{
561
562/* ---- card 0x14 ---------------------------------- */
563 .name = "CEI Raffles Card",
564 .video_inputs = 3,
565 .audio_inputs = 3,
566 .tuner = 0,
567 .svhs = 2,
568 .muxsel = {2, 3, 1, 1},
569 .tuner_type = -1,
570},{
571 .name = "Lifeview FlyVideo 98/ Lucky Star Image World ConferenceTV LR50",
572 .video_inputs = 4,
573 .audio_inputs = 2, // tuner, line in
574 .tuner = 0,
575 .svhs = 2,
576 .gpiomask = 0x1800,
577 .muxsel = { 2, 3, 1, 1},
578 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800},
579 .pll = PLL_28,
580 .tuner_type = TUNER_PHILIPS_PAL_I,
581},{
582 .name = "Askey CPH050/ Phoebe Tv Master + FM",
583 .video_inputs = 3,
584 .audio_inputs = 1,
585 .tuner = 0,
586 .svhs = 2,
587 .gpiomask = 0xc00,
588 .muxsel = { 2, 3, 1, 1},
589 .audiomux = {0, 1, 0x800, 0x400, 0xc00, 0},
590 .needs_tvaudio = 1,
591 .pll = PLL_28,
592 .tuner_type = -1,
593},{
594 .name = "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV, bt878",
595 .video_inputs = 3,
596 .audio_inputs = 1,
597 .tuner = 0,
598 .svhs = -1,
599 .gpiomask = 7,
600 .muxsel = { 2, 3, -1 },
601 .digital_mode = DIGITAL_MODE_CAMERA,
602 .audiomux = { 0, 0, 0, 0, 0 },
603 .no_msp34xx = 1,
604 .pll = PLL_28,
605 .tuner_type = TUNER_ALPS_TSBB5_PAL_I,
606},{
607
608/* ---- card 0x18 ---------------------------------- */
609 .name = "Askey CPH05X/06X (bt878) [many vendors]",
610 .video_inputs = 3,
611 .audio_inputs = 1,
612 .tuner = 0,
613 .svhs = 2,
614 .gpiomask = 0xe00,
615 .muxsel = { 2, 3, 1, 1},
616 .audiomux = {0x400, 0x400, 0x400, 0x400, 0xc00},
617 .needs_tvaudio = 1,
618 .pll = PLL_28,
619 .tuner_type = -1,
620 .has_remote = 1,
621},{
622 .name = "Terratec TerraTV+ Version 1.0 (Bt848)/ Terra TValue Version 1.0/ Vobis TV-Boostar",
623 .video_inputs = 3,
624 .audio_inputs = 1,
625 .tuner = 0,
626 .svhs = 2,
627 .gpiomask = 0x1f0fff,
628 .muxsel = { 2, 3, 1, 1},
629 .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000},
630 .needs_tvaudio = 0,
631 .tuner_type = TUNER_PHILIPS_PAL,
632 .audio_hook = terratv_audio,
633},{
634 .name = "Hauppauge WinCam newer (bt878)",
635 .video_inputs = 4,
636 .audio_inputs = 1,
637 .tuner = 0,
638 .svhs = 3,
639 .gpiomask = 7,
640 .muxsel = { 2, 0, 1, 1},
641 .audiomux = { 0, 1, 2, 3, 4},
642 .needs_tvaudio = 1,
643 .tuner_type = -1,
644},{
645 .name = "Lifeview FlyVideo 98/ MAXI TV Video PCI2 LR50",
646 .video_inputs = 4,
647 .audio_inputs = 2,
648 .tuner = 0,
649 .svhs = 2,
650 .gpiomask = 0x1800,
651 .muxsel = { 2, 3, 1, 1},
652 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800},
653 .pll = PLL_28,
654 .tuner_type = TUNER_PHILIPS_SECAM,
655},{
656
657/* ---- card 0x1c ---------------------------------- */
658 .name = "Terratec TerraTV+ Version 1.1 (bt878)",
659 .video_inputs = 3,
660 .audio_inputs = 1,
661 .tuner = 0,
662 .svhs = 2,
663 .gpiomask = 0x1f0fff,
664 .muxsel = { 2, 3, 1, 1},
665 .audiomux = { 0x20000, 0x30000, 0x10000, 0x00000, 0x40000},
666 .needs_tvaudio = 0,
667 .tuner_type = TUNER_PHILIPS_PAL,
668 .audio_hook = terratv_audio,
669 /* GPIO wiring:
670 External 20 pin connector (for Active Radio Upgrade board)
671 gpio00: i2c-sda
672 gpio01: i2c-scl
673 gpio02: om5610-data
674 gpio03: om5610-clk
675 gpio04: om5610-wre
676 gpio05: om5610-stereo
677 gpio06: rds6588-davn
678 gpio07: Pin 7 n.c.
679 gpio08: nIOW
680 gpio09+10: nIOR, nSEL ?? (bt878)
681 gpio09: nIOR (bt848)
682 gpio10: nSEL (bt848)
683 Sound Routing:
684 gpio16: u2-A0 (1st 4052bt)
685 gpio17: u2-A1
686 gpio18: u2-nEN
687 gpio19: u4-A0 (2nd 4052)
688 gpio20: u4-A1
689 u4-nEN - GND
690 Btspy:
691 00000 : Cdrom (internal audio input)
692 10000 : ext. Video audio input
693 20000 : TV Mono
694 a0000 : TV Mono/2
695 1a0000 : TV Stereo
696 30000 : Radio
697 40000 : Mute
698 */
699
700},{
701 /* Jannik Fritsch <jannik@techfak.uni-bielefeld.de> */
702 .name = "Imagenation PXC200",
703 .video_inputs = 5,
704 .audio_inputs = 1,
705 .tuner = -1,
706 .svhs = 1, /* was: 4 */
707 .gpiomask = 0,
708 .muxsel = { 2, 3, 1, 0, 0},
709 .audiomux = { 0 },
710 .needs_tvaudio = 1,
711 .tuner_type = -1,
712 .muxsel_hook = PXC200_muxsel,
713
714},{
715 .name = "Lifeview FlyVideo 98 LR50",
716 .video_inputs = 4,
717 .audio_inputs = 1,
718 .tuner = 0,
719 .svhs = 2,
720 .gpiomask = 0x1800, //0x8dfe00
721 .muxsel = { 2, 3, 1, 1},
722 .audiomux = { 0, 0x0800, 0x1000, 0x1000, 0x1800, 0 },
723 .pll = PLL_28,
724 .tuner_type = -1,
725},{
726 .name = "Formac iProTV, Formac ProTV I (bt848)",
727 .video_inputs = 4,
728 .audio_inputs = 1,
729 .tuner = 0,
730 .svhs = 3,
731 .gpiomask = 1,
732 .muxsel = { 2, 3, 1, 1},
733 .audiomux = { 1, 0, 0, 0, 0 },
734 .pll = PLL_28,
735 .tuner_type = TUNER_PHILIPS_PAL,
736},{
737
738/* ---- card 0x20 ---------------------------------- */
739 .name = "Intel Create and Share PCI/ Smart Video Recorder III",
740 .video_inputs = 4,
741 .audio_inputs = 0,
742 .tuner = -1,
743 .svhs = 2,
744 .gpiomask = 0,
745 .muxsel = { 2, 3, 1, 1},
746 .audiomux = { 0 },
747 .needs_tvaudio = 0,
748 .tuner_type = 4,
749},{
750 .name = "Terratec TerraTValue Version Bt878",
751 .video_inputs = 3,
752 .audio_inputs = 1,
753 .tuner = 0,
754 .svhs = 2,
755 .gpiomask = 0xffff00,
756 .muxsel = { 2, 3, 1, 1},
757 .audiomux = { 0x500, 0, 0x300, 0x900, 0x900},
758 .needs_tvaudio = 1,
759 .pll = PLL_28,
760 .tuner_type = TUNER_PHILIPS_PAL,
761},{
762 .name = "Leadtek WinFast 2000/ WinFast 2000 XP",
763 .video_inputs = 4,
764 .audio_inputs = 1,
765 .tuner = 0,
766 .svhs = 2,
767 .muxsel = { 2, 3, 1, 1, 0}, // TV, CVid, SVid, CVid over SVid connector
768#if 0
769 .gpiomask = 0xc33000,
770 .audiomux = { 0x422000,0x1000,0x0000,0x620000,0x800000 },
771#else
772 /* Alexander Varakin <avarakin@hotmail.com> [stereo version] */
773 .gpiomask = 0xb33000,
774 .audiomux = { 0x122000,0x1000,0x0000,0x620000,0x800000 },
775#endif
776 /* Audio Routing for "WinFast 2000 XP" (no tv stereo !)
777 gpio23 -- hef4052:nEnable (0x800000)
778 gpio12 -- hef4052:A1
779 gpio13 -- hef4052:A0
780 0x0000: external audio
781 0x1000: FM
782 0x2000: TV
783 0x3000: n.c.
784 Note: There exists another variant "Winfast 2000" with tv stereo !?
785 Note: eeprom only contains FF and pci subsystem id 107d:6606
786 */
787 .needs_tvaudio = 0,
788 .pll = PLL_28,
789 .has_radio = 1,
790 .tuner_type = 5, // default for now, gpio reads BFFF06 for Pal bg+dk
791 .audio_hook = winfast2000_audio,
792 .has_remote = 1,
793},{
794 .name = "Lifeview FlyVideo 98 LR50 / Chronos Video Shuttle II",
795 .video_inputs = 4,
796 .audio_inputs = 3,
797 .tuner = 0,
798 .svhs = 2,
799 .gpiomask = 0x1800,
800 .muxsel = { 2, 3, 1, 1},
801 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800},
802 .pll = PLL_28,
803 .tuner_type = -1,
804},{
805
806/* ---- card 0x24 ---------------------------------- */
807 .name = "Lifeview FlyVideo 98FM LR50 / Typhoon TView TV/FM Tuner",
808 .video_inputs = 4,
809 .audio_inputs = 3,
810 .tuner = 0,
811 .svhs = 2,
812 .gpiomask = 0x1800,
813 .muxsel = { 2, 3, 1, 1},
814 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 },
815 .pll = PLL_28,
816 .tuner_type = -1,
817 .has_radio = 1,
818},{
819 .name = "Prolink PixelView PlayTV pro",
820 .video_inputs = 3,
821 .audio_inputs = 1,
822 .tuner = 0,
823 .svhs = 2,
824 .gpiomask = 0xff,
825 .muxsel = { 2, 3, 1, 1 },
826 .audiomux = { 0x21, 0x20, 0x24, 0x2c, 0x29, 0x29 },
827 .no_msp34xx = 1,
828 .pll = PLL_28,
829 .tuner_type = -1,
830},{
831 .name = "Askey CPH06X TView99",
832 .video_inputs = 4,
833 .audio_inputs = 1,
834 .tuner = 0,
835 .svhs = 2,
836 .gpiomask = 0x551e00,
837 .muxsel = { 2, 3, 1, 0},
838 .audiomux = { 0x551400, 0x551200, 0, 0, 0x551c00, 0x551200 },
839 .needs_tvaudio = 1,
840 .pll = PLL_28,
841 .tuner_type = 1,
842 .has_remote = 1,
843},{
844 .name = "Pinnacle PCTV Studio/Rave",
845 .video_inputs = 3,
846 .audio_inputs = 1,
847 .tuner = 0,
848 .svhs = 2,
849 .gpiomask = 0x03000F,
850 .muxsel = { 2, 3, 1, 1},
851 .audiomux = { 2, 0xd0001, 0, 0, 1},
852 .needs_tvaudio = 0,
853 .pll = PLL_28,
854 .tuner_type = -1,
855},{
856
857/* ---- card 0x28 ---------------------------------- */
858 .name = "STB TV PCI FM, Gateway P/N 6000704 (bt878), 3Dfx VoodooTV 100",
859 .video_inputs = 3,
860 .audio_inputs = 1,
861 .tuner = 0,
862 .svhs = 2,
863 .gpiomask = 7,
864 .muxsel = { 2, 3, 1, 1},
865 .audiomux = { 4, 0, 2, 3, 1},
866 .no_msp34xx = 1,
867 .needs_tvaudio = 1,
868 .tuner_type = TUNER_PHILIPS_NTSC,
869 .pll = PLL_28,
870 .has_radio = 1,
871},{
872 .name = "AVerMedia TVPhone 98",
873 .video_inputs = 3,
874 .audio_inputs = 4,
875 .tuner = 0,
876 .svhs = 2,
877 .gpiomask = 15,
878 .muxsel = { 2, 3, 1, 1},
879 .audiomux = { 13, 4, 11, 7, 0, 0},
880 .needs_tvaudio = 1,
881 .pll = PLL_28,
882 .tuner_type = -1,
883 .has_radio = 1,
884 .audio_hook = avermedia_tvphone_audio,
885},{
886 .name = "ProVideo PV951", /* pic16c54 */
887 .video_inputs = 3,
888 .audio_inputs = 1,
889 .tuner = 0,
890 .svhs = 2,
891 .gpiomask = 0,
892 .muxsel = { 2, 3, 1, 1},
893 .audiomux = { 0, 0, 0, 0, 0},
894 .needs_tvaudio = 1,
895 .no_msp34xx = 1,
896 .pll = PLL_28,
897 .tuner_type = 1,
898},{
899 .name = "Little OnAir TV",
900 .video_inputs = 3,
901 .audio_inputs = 1,
902 .tuner = 0,
903 .svhs = 2,
904 .gpiomask = 0xe00b,
905 .muxsel = {2, 3, 1, 1},
906 .audiomux = {0xff9ff6, 0xff9ff6, 0xff1ff7, 0, 0xff3ffc},
907 .no_msp34xx = 1,
908 .tuner_type = -1,
909},{
910
911/* ---- card 0x2c ---------------------------------- */
912 .name = "Sigma TVII-FM",
913 .video_inputs = 2,
914 .audio_inputs = 1,
915 .tuner = 0,
916 .svhs = -1,
917 .gpiomask = 3,
918 .muxsel = {2, 3, 1, 1},
919 .audiomux = {1, 1, 0, 2, 3},
920 .no_msp34xx = 1,
921 .pll = PLL_NONE,
922 .tuner_type = -1,
923},{
924 .name = "MATRIX-Vision MV-Delta 2",
925 .video_inputs = 5,
926 .audio_inputs = 1,
927 .tuner = -1,
928 .svhs = 3,
929 .gpiomask = 0,
930 .muxsel = { 2, 3, 1, 0, 0},
931 .audiomux = {0 },
932 .no_msp34xx = 1,
933 .pll = PLL_28,
934 .tuner_type = -1,
935},{
936 .name = "Zoltrix Genie TV/FM",
937 .video_inputs = 3,
938 .audio_inputs = 1,
939 .tuner = 0,
940 .svhs = 2,
941 .gpiomask = 0xbcf03f,
942 .muxsel = { 2, 3, 1, 1},
943 .audiomux = { 0xbc803f, 0xbc903f, 0xbcb03f, 0, 0xbcb03f},
944 .no_msp34xx = 1,
945 .pll = PLL_28,
946 .tuner_type = 21,
947},{
948 .name = "Terratec TV/Radio+",
949 .video_inputs = 3,
950 .audio_inputs = 1,
951 .tuner = 0,
952 .svhs = 2,
953 .gpiomask = 0x70000,
954 .muxsel = { 2, 3, 1, 1},
955 .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000, 0x20000 },
956 .needs_tvaudio = 1,
957 .no_msp34xx = 1,
958 .pll = PLL_35,
959 .tuner_type = 1,
960 .has_radio = 1,
961},{
962
963/* ---- card 0x30 ---------------------------------- */
964 .name = "Askey CPH03x/ Dynalink Magic TView",
965 .video_inputs = 3,
966 .audio_inputs = 1,
967 .tuner = 0,
968 .svhs = 2,
969 .gpiomask = 15,
970 .muxsel = { 2, 3, 1, 1},
971 .audiomux = {2,0,0,0,1},
972 .needs_tvaudio = 1,
973 .pll = PLL_28,
974 .tuner_type = -1,
975},{
976 .name = "IODATA GV-BCTV3/PCI",
977 .video_inputs = 3,
978 .audio_inputs = 1,
979 .tuner = 0,
980 .svhs = 2,
981 .gpiomask = 0x010f00,
982 .muxsel = {2, 3, 0, 0},
983 .audiomux = {0x10000, 0, 0x10000, 0, 0, 0},
984 .no_msp34xx = 1,
985 .pll = PLL_28,
986 .tuner_type = TUNER_ALPS_TSHC6_NTSC,
987 .audio_hook = gvbctv3pci_audio,
988},{
989 .name = "Prolink PV-BT878P+4E / PixelView PlayTV PAK / Lenco MXTV-9578 CP",
990 .video_inputs = 5,
991 .audio_inputs = 1,
992 .tuner = 0,
993 .svhs = 3,
994 .gpiomask = 0xAA0000,
995 .muxsel = { 2,3,1,1,-1 },
996 .digital_mode = DIGITAL_MODE_CAMERA,
997 .audiomux = { 0x20000, 0, 0x80000, 0x80000, 0xa8000, 0x46000 },
998 .no_msp34xx = 1,
999 .pll = PLL_28,
1000 .tuner_type = TUNER_PHILIPS_PAL_I,
1001 .has_remote = 1,
1002 /* GPIO wiring: (different from Rev.4C !)
1003 GPIO17: U4.A0 (first hef4052bt)
1004 GPIO19: U4.A1
1005 GPIO20: U5.A1 (second hef4052bt)
1006 GPIO21: U4.nEN
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
1010 */
1011},{
1012 .name = "Eagle Wireless Capricorn2 (bt878A)",
1013 .video_inputs = 4,
1014 .audio_inputs = 1,
1015 .tuner = 0,
1016 .svhs = 2,
1017 .gpiomask = 7,
1018 .muxsel = { 2, 0, 1, 1},
1019 .audiomux = { 0, 1, 2, 3, 4},
1020 .pll = PLL_28,
1021 .tuner_type = -1 /* TUNER_ALPS_TMDH2_NTSC */,
1022},{
1023
1024/* ---- card 0x34 ---------------------------------- */
1025 /* David Härdeman <david@2gen.com> */
1026 .name = "Pinnacle PCTV Studio Pro",
1027 .video_inputs = 4,
1028 .audio_inputs = 1,
1029 .tuner = 0,
1030 .svhs = 3,
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)
1036 0= ext. Audio IN
1037 1= from MUX2
1038 2= Mono TV sound from Tuner
1039 3= not connected
1040 MUX2 (mask 0x30000):
1041 0,2,3= from MSP34xx
1042 1= FM stereo Radio from Tuner */
1043 .needs_tvaudio = 0,
1044 .pll = PLL_28,
1045 .tuner_type = -1,
1046},{
1047 /* Claas Langbehn <claas@bigfoot.com>,
1048 Sven Grothklags <sven@upb.de> */
1049 .name = "Typhoon TView RDS + FM Stereo / KNC1 TV Station RDS",
1050 .video_inputs = 4,
1051 .audio_inputs = 3,
1052 .tuner = 0,
1053 .svhs = 2,
1054 .gpiomask = 0x1c,
1055 .muxsel = { 2, 3, 1, 1},
1056 .audiomux = { 0, 0, 0x10, 8, 4 },
1057 .needs_tvaudio = 1,
1058 .pll = PLL_28,
1059 .tuner_type = TUNER_PHILIPS_PAL,
1060 .has_radio = 1,
1061},{
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]",
1068 .video_inputs = 4,
1069 .audio_inputs = 1,
1070 .tuner = 0,
1071 .svhs = 2,
1072 .gpiomask = 0x18e0,
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 */
1079 .pll = PLL_28,
1080 .tuner_type = -1,
1081},{
1082 /* Miguel Angel Alvarez <maacruz@navegalia.com>
1083 old Easy TV BT848 version (model CPH031) */
1084 .name = "Askey CPH031/ BESTBUY Easy TV",
1085 .video_inputs = 4,
1086 .audio_inputs = 1,
1087 .tuner = 0,
1088 .svhs = 2,
1089 .gpiomask = 0xF,
1090 .muxsel = { 2, 3, 1, 0},
1091 .audiomux = { 2, 0, 0, 0, 10},
1092 .needs_tvaudio = 0,
1093 .pll = PLL_28,
1094 .tuner_type = TUNER_TEMIC_PAL,
1095},{
1096
1097/* ---- card 0x38 ---------------------------------- */
1098 /* Gordon Heydon <gjheydon@bigfoot.com ('98) */
1099 .name = "Lifeview FlyVideo 98FM LR50",
1100 .video_inputs = 4,
1101 .audio_inputs = 3,
1102 .tuner = 0,
1103 .svhs = 2,
1104 .gpiomask = 0x1800,
1105 .muxsel = { 2, 3, 1, 1},
1106 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 },
1107 .pll = PLL_28,
1108 .tuner_type = 5,
1109},{
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)",
1114 .video_inputs = 2,
1115 .audio_inputs = 0,
1116 .tuner = -1,
1117 .svhs = 1,
1118 .gpiomask = 0,
1119 .muxsel = { 3, 1 },
1120 .audiomux = { 0 },
1121 .needs_tvaudio = 0,
1122 .no_msp34xx = 1,
1123 .pll = PLL_35,
1124 .tuner_type = -1,
1125},{
1126 /* Daniel Herrington <daniel.herrington@home.com> */
1127 .name = "Askey CPH060/ Phoebe TV Master Only (No FM)",
1128 .video_inputs = 3,
1129 .audio_inputs = 1,
1130 .tuner = 0,
1131 .svhs = 2,
1132 .gpiomask = 0xe00,
1133 .muxsel = { 2, 3, 1, 1},
1134 .audiomux = { 0x400, 0x400, 0x400, 0x400, 0x800, 0x400 },
1135 .needs_tvaudio = 1,
1136 .pll = PLL_28,
1137 .tuner_type = TUNER_TEMIC_4036FY5_NTSC,
1138},{
1139 /* Matti Mottus <mottus@physic.ut.ee> */
1140 .name = "Askey CPH03x TV Capturer",
1141 .video_inputs = 4,
1142 .audio_inputs = 1,
1143 .tuner = 0,
1144 .svhs = 2,
1145 .gpiomask = 0x03000F,
1146 .muxsel = { 2, 3, 1, 0},
1147 .audiomux = { 2,0,0,0,1 },
1148 .pll = PLL_28,
1149 .tuner_type = 0,
1150},{
1151
1152/* ---- card 0x3c ---------------------------------- */
1153 /* Philip Blundell <philb@gnu.org> */
1154 .name = "Modular Technology MM100PCTV",
1155 .video_inputs = 2,
1156 .audio_inputs = 2,
1157 .tuner = 0,
1158 .svhs = -1,
1159 .gpiomask = 11,
1160 .muxsel = { 2, 3, 1, 1},
1161 .audiomux = { 2, 0, 0, 1, 8},
1162 .pll = PLL_35,
1163 .tuner_type = TUNER_TEMIC_PAL,
1164
1165},{
1166 /* Adrian Cox <adrian@humboldt.co.uk */
1167 .name = "AG Electronics GMV1",
1168 .video_inputs = 2,
1169 .audio_inputs = 0,
1170 .tuner = -1,
1171 .svhs = 1,
1172 .gpiomask = 0xF,
1173 .muxsel = { 2, 2},
1174 .audiomux = { },
1175 .no_msp34xx = 1,
1176 .needs_tvaudio = 0,
1177 .pll = PLL_28,
1178 .tuner_type = -1,
1179},{
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)",
1184 .video_inputs = 3,
1185 .audio_inputs = 2,
1186 .tuner = 0,
1187 .svhs = 2,
1188 .gpiomask = 0xFF,
1189 .muxsel = { 2, 3, 1, 0},
1190 .audiomux = { 1, 0, 4, 4, 9},
1191 .needs_tvaudio = 0,
1192 .pll = PLL_28,
1193 .tuner_type = TUNER_PHILIPS_PAL,
1194},{
1195 /* Lukas Gebauer <geby@volny.cz> */
1196 .name = "ATI TV-Wonder",
1197 .video_inputs = 3,
1198 .audio_inputs = 1,
1199 .tuner = 0,
1200 .svhs = 2,
1201 .gpiomask = 0xf03f,
1202 .muxsel = { 2, 3, 1, 0 },
1203 .audiomux = { 0xbffe, 0, 0xbfff, 0, 0xbffe},
1204 .pll = PLL_28,
1205 .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL,
1206},{
1207
1208/* ---- card 0x40 ---------------------------------- */
1209 /* Lukas Gebauer <geby@volny.cz> */
1210 .name = "ATI TV-Wonder VE",
1211 .video_inputs = 2,
1212 .audio_inputs = 1,
1213 .tuner = 0,
1214 .svhs = -1,
1215 .gpiomask = 1,
1216 .muxsel = { 2, 3, 0, 1},
1217 .audiomux = { 0, 0, 1, 0, 0},
1218 .no_msp34xx = 1,
1219 .pll = PLL_28,
1220 .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL,
1221},{
1222 /* DeeJay <deejay@westel900.net (2000S) */
1223 .name = "Lifeview FlyVideo 2000S LR90",
1224 .video_inputs = 3,
1225 .audio_inputs = 3,
1226 .tuner = 0,
1227 .svhs = 2,
1228 .gpiomask = 0x18e0,
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,
1235 .no_msp34xx = 1,
1236 .no_tda9875 = 1,
1237 .needs_tvaudio = 1,
1238 .pll = PLL_28,
1239 .tuner_type = 5,
1240},{
1241 .name = "Terratec TValueRadio",
1242 .video_inputs = 3,
1243 .audio_inputs = 1,
1244 .tuner = 0,
1245 .svhs = 2,
1246 .gpiomask = 0xffff00,
1247 .muxsel = { 2, 3, 1, 1},
1248 .audiomux = { 0x500, 0x500, 0x300, 0x900, 0x900},
1249 .needs_tvaudio = 1,
1250 .pll = PLL_28,
1251 .tuner_type = TUNER_PHILIPS_PAL,
1252 .has_radio = 1,
1253},{
1254 /* TANAKA Kei <peg00625@nifty.com> */
1255 .name = "IODATA GV-BCTV4/PCI",
1256 .video_inputs = 3,
1257 .audio_inputs = 1,
1258 .tuner = 0,
1259 .svhs = 2,
1260 .gpiomask = 0x010f00,
1261 .muxsel = {2, 3, 0, 0},
1262 .audiomux = {0x10000, 0, 0x10000, 0, 0, 0},
1263 .no_msp34xx = 1,
1264 .pll = PLL_28,
1265 .tuner_type = TUNER_SHARP_2U5JF5540_NTSC,
1266 .audio_hook = gvbctv3pci_audio,
1267},{
1268
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.
1273 .video_inputs = 4,
1274 .audio_inputs = 1,
1275 .tuner = 0,
1276 .svhs = -1,
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,
1285 .pll = PLL_28,
1286 .has_radio = 1,
1287},{
1288 /* Philip Blundell <pb@nexus.co.uk> */
1289 .name = "Active Imaging AIMMS",
1290 .video_inputs = 1,
1291 .audio_inputs = 0,
1292 .tuner = -1,
1293 .tuner_type = -1,
1294 .pll = PLL_28,
1295 .muxsel = { 2 },
1296 .gpiomask = 0
1297},{
1298 /* Tomasz Pyra <hellfire@sedez.iq.pl> */
1299 .name = "Prolink Pixelview PV-BT878P+ (Rev.4C,8E)",
1300 .video_inputs = 3,
1301 .audio_inputs = 4,
1302 .tuner = 0,
1303 .svhs = 2,
1304 .gpiomask = 15,
1305 .muxsel = { 2, 3, 1, 1},
1306 .audiomux = { 0, 0, 11, 7, 13, 0}, // TV and Radio with same GPIO !
1307 .needs_tvaudio = 1,
1308 .pll = PLL_28,
1309 .tuner_type = 25,
1310 .has_remote = 1,
1311 /* GPIO wiring:
1312 GPIO0: U4.A0 (hef4052bt)
1313 GPIO1: U4.A1
1314 GPIO2: U4.A1 (second hef4052bt)
1315 GPIO3: U4.nEN, U5.A0, A5.nEN
1316 GPIO8-15: vrd866b ?
1317 */
1318},{
1319 .name = "Lifeview FlyVideo 98EZ (capture only) LR51",
1320 .video_inputs = 4,
1321 .audio_inputs = 0,
1322 .tuner = -1,
1323 .svhs = 2,
1324 .muxsel = { 2, 3, 1, 1}, // AV1, AV2, SVHS, CVid adapter on SVHS
1325 .pll = PLL_28,
1326 .no_msp34xx = 1,
1327},{
1328
1329/* ---- card 0x48 ---------------------------------- */
1330 /* Dariusz Kowalewski <darekk@automex.pl> */
1331 .name = "Prolink Pixelview PV-BT878P+9B (PlayTV Pro rev.9B FM+NICAM)",
1332 .video_inputs = 4,
1333 .audio_inputs = 1,
1334 .tuner = 0,
1335 .svhs = 2,
1336 .gpiomask = 0x3f,
1337 .muxsel = { 2, 3, 1, 1 },
1338 .audiomux = { 0x01, 0x00, 0x03, 0x03, 0x09, 0x02 },
1339 .needs_tvaudio = 1,
1340 .no_msp34xx = 1,
1341 .no_tda9875 = 1,
1342 .pll = PLL_28,
1343 .tuner_type = 5,
1344 .audio_hook = pvbt878p9b_audio, // Note: not all cards have stereo
1345 .has_radio = 1, // Note: not all cards have radio
1346 .has_remote = 1,
1347 /* GPIO wiring:
1348 GPIO0: A0 hef4052
1349 GPIO1: A1 hef4052
1350 GPIO3: nEN hef4052
1351 GPIO8-15: vrd866b
1352 GPIO20,22,23: R30,R29,R28
1353 */
1354},{
1355 /* Clay Kunz <ckunz@mail.arc.nasa.gov> */
1356 /* you must jumper JP5 for the card to work */
1357 .name = "Sensoray 311",
1358 .video_inputs = 5,
1359 .audio_inputs = 0,
1360 .tuner = -1,
1361 .svhs = 4,
1362 .gpiomask = 0,
1363 .muxsel = { 2, 3, 1, 0, 0},
1364 .audiomux = { 0 },
1365 .needs_tvaudio = 0,
1366 .tuner_type = -1,
1367},{
1368 /* Miguel Freitas <miguel@cetuc.puc-rio.br> */
1369 .name = "RemoteVision MX (RV605)",
1370 .video_inputs = 16,
1371 .audio_inputs = 0,
1372 .tuner = -1,
1373 .svhs = -1,
1374 .gpiomask = 0x00,
1375 .gpiomask2 = 0x07ff,
1376 .muxsel = { 0x33, 0x13, 0x23, 0x43, 0xf3, 0x73, 0xe3, 0x03,
1377 0xd3, 0xb3, 0xc3, 0x63, 0x93, 0x53, 0x83, 0xa3 },
1378 .no_msp34xx = 1,
1379 .no_tda9875 = 1,
1380 .tuner_type = -1,
1381 .muxsel_hook = rv605_muxsel,
1382},{
1383 .name = "Powercolor MTV878/ MTV878R/ MTV878F",
1384 .video_inputs = 3,
1385 .audio_inputs = 2,
1386 .tuner = 0,
1387 .svhs = 2,
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 },
1391 .needs_tvaudio = 0,
1392 .tuner_type = TUNER_PHILIPS_PAL,
1393 .pll = PLL_28,
1394 .has_radio = 1,
1395},{
1396
1397/* ---- card 0x4c ---------------------------------- */
1398 /* Masaki Suzuki <masaki@btree.org> */
1399 .name = "Canopus WinDVR PCI (COMPAQ Presario 3524JP, 5112JP)",
1400 .video_inputs = 3,
1401 .audio_inputs = 1,
1402 .tuner = 0,
1403 .svhs = 2,
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,
1409},{
1410 .name = "GrandTec Multi Capture Card (Bt878)",
1411 .video_inputs = 4,
1412 .audio_inputs = 0,
1413 .tuner = -1,
1414 .svhs = -1,
1415 .gpiomask = 0,
1416 .muxsel = { 2, 3, 1, 0 },
1417 .audiomux = { 0 },
1418 .needs_tvaudio = 0,
1419 .no_msp34xx = 1,
1420 .pll = PLL_28,
1421 .tuner_type = -1,
1422},{
1423 .name = "Jetway TV/Capture JW-TV878-FBK, Kworld KW-TV878RF",
1424 .video_inputs = 4,
1425 .audio_inputs = 3,
1426 .tuner = 0,
1427 .svhs = 2,
1428 .gpiomask = 7,
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
1436 .needs_tvaudio = 0,
1437 .no_msp34xx = 1,
1438 .pll = PLL_28,
1439 .tuner_type = 5, // Samsung TCPA9095PC27A (BG+DK), philips compatible, w/FM, stereo and
1440 // radio signal strength indicators work fine.
1441 .has_radio = 1,
1442 /* GPIO Info:
1443 GPIO0,1: HEF4052 A0,A1
1444 GPIO2: HEF4052 nENABLE
1445 GPIO3-7: n.c.
1446 GPIO8-13: IRDC357 data0-5 (data6 n.c. ?) [chip not present on my card]
1447 GPIO14,15: ??
1448 GPIO16-21: n.c.
1449 GPIO22,23: ??
1450 ?? : mtu8b56ep microcontroller for IR (GPIO wiring unknown)*/
1451},{
1452 /* Arthur Tetzlaff-Deas, DSP Design Ltd <software@dspdesign.com> */
1453 .name = "DSP Design TCVIDEO",
1454 .video_inputs = 4,
1455 .svhs = -1,
1456 .muxsel = { 2, 3, 1, 0},
1457 .pll = PLL_28,
1458 .tuner_type = -1,
1459},{
1460
1461 /* ---- card 0x50 ---------------------------------- */
1462 .name = "Hauppauge WinTV PVR",
1463 .video_inputs = 4,
1464 .audio_inputs = 1,
1465 .tuner = 0,
1466 .svhs = 2,
1467 .muxsel = { 2, 0, 1, 1},
1468 .needs_tvaudio = 1,
1469 .pll = PLL_28,
1470 .tuner_type = -1,
1471
1472 .gpiomask = 7,
1473 .audiomux = {7},
1474},{
1475 .name = "IODATA GV-BCTV5/PCI",
1476 .video_inputs = 3,
1477 .audio_inputs = 1,
1478 .tuner = 0,
1479 .svhs = 2,
1480 .gpiomask = 0x0f0f80,
1481 .muxsel = {2, 3, 1, 0},
1482 .audiomux = {0x030000, 0x010000, 0, 0, 0x020000, 0},
1483 .no_msp34xx = 1,
1484 .pll = PLL_28,
1485 .tuner_type = TUNER_PHILIPS_NTSC_M,
1486 .audio_hook = gvbctv5pci_audio,
1487 .has_radio = 1,
1488},{
1489 .name = "Osprey 100/150 (878)", /* 0x1(2|3)-45C6-C1 */
1490 .video_inputs = 4, /* id-inputs-clock */
1491 .audio_inputs = 0,
1492 .tuner = -1,
1493 .svhs = 3,
1494 .muxsel = { 3, 2, 0, 1 },
1495 .pll = PLL_28,
1496 .tuner_type = -1,
1497 .no_msp34xx = 1,
1498 .no_tda9875 = 1,
1499 .no_tda7432 = 1,
1500},{
1501 .name = "Osprey 100/150 (848)", /* 0x04-54C0-C1 & older boards */
1502 .video_inputs = 3,
1503 .audio_inputs = 0,
1504 .tuner = -1,
1505 .svhs = 2,
1506 .muxsel = { 2, 3, 1 },
1507 .pll = PLL_28,
1508 .tuner_type = -1,
1509 .no_msp34xx = 1,
1510 .no_tda9875 = 1,
1511 .no_tda7432 = 1,
1512},{
1513
1514 /* ---- card 0x54 ---------------------------------- */
1515 .name = "Osprey 101 (848)", /* 0x05-40C0-C1 */
1516 .video_inputs = 2,
1517 .audio_inputs = 0,
1518 .tuner = -1,
1519 .svhs = 1,
1520 .muxsel = { 3, 1 },
1521 .pll = PLL_28,
1522 .tuner_type = -1,
1523 .no_msp34xx = 1,
1524 .no_tda9875 = 1,
1525 .no_tda7432 = 1,
1526},{
1527 .name = "Osprey 101/151", /* 0x1(4|5)-0004-C4 */
1528 .video_inputs = 1,
1529 .audio_inputs = 0,
1530 .tuner = -1,
1531 .svhs = -1,
1532 .muxsel = { 0 },
1533 .pll = PLL_28,
1534 .tuner_type = -1,
1535 .no_msp34xx = 1,
1536 .no_tda9875 = 1,
1537 .no_tda7432 = 1,
1538},{
1539 .name = "Osprey 101/151 w/ svid", /* 0x(16|17|20)-00C4-C1 */
1540 .video_inputs = 2,
1541 .audio_inputs = 0,
1542 .tuner = -1,
1543 .svhs = 1,
1544 .muxsel = { 0, 1 },
1545 .pll = PLL_28,
1546 .tuner_type = -1,
1547 .no_msp34xx = 1,
1548 .no_tda9875 = 1,
1549 .no_tda7432 = 1,
1550},{
1551 .name = "Osprey 200/201/250/251", /* 0x1(8|9|E|F)-0004-C4 */
1552 .video_inputs = 1,
1553 .audio_inputs = 1,
1554 .tuner = -1,
1555 .svhs = -1,
1556 .muxsel = { 0 },
1557 .pll = PLL_28,
1558 .tuner_type = -1,
1559 .no_msp34xx = 1,
1560 .no_tda9875 = 1,
1561 .no_tda7432 = 1,
1562},{
1563
1564 /* ---- card 0x58 ---------------------------------- */
1565 .name = "Osprey 200/250", /* 0x1(A|B)-00C4-C1 */
1566 .video_inputs = 2,
1567 .audio_inputs = 1,
1568 .tuner = -1,
1569 .svhs = 1,
1570 .muxsel = { 0, 1 },
1571 .pll = PLL_28,
1572 .tuner_type = -1,
1573 .no_msp34xx = 1,
1574 .no_tda9875 = 1,
1575 .no_tda7432 = 1,
1576},{
1577 .name = "Osprey 210/220", /* 0x1(A|B)-04C0-C1 */
1578 .video_inputs = 2,
1579 .audio_inputs = 1,
1580 .tuner = -1,
1581 .svhs = 1,
1582 .muxsel = { 2, 3 },
1583 .pll = PLL_28,
1584 .tuner_type = -1,
1585 .no_msp34xx = 1,
1586 .no_tda9875 = 1,
1587 .no_tda7432 = 1,
1588},{
1589 .name = "Osprey 500", /* 500 */
1590 .video_inputs = 2,
1591 .audio_inputs = 1,
1592 .tuner = -1,
1593 .svhs = 1,
1594 .muxsel = { 2, 3 },
1595 .pll = PLL_28,
1596 .tuner_type = -1,
1597 .no_msp34xx = 1,
1598 .no_tda9875 = 1,
1599 .no_tda7432 = 1,
1600},{
1601 .name = "Osprey 540", /* 540 */
1602 .video_inputs = 4,
1603 .audio_inputs = 1,
1604 .tuner = -1,
1605#if 0 /* TODO ... */
1606 .svhs = OSPREY540_SVID_ANALOG,
1607 .muxsel = { [OSPREY540_COMP_ANALOG] = 2,
1608 [OSPREY540_SVID_ANALOG] = 3, },
1609#endif
1610 .pll = PLL_28,
1611 .tuner_type = -1,
1612 .no_msp34xx = 1,
1613 .no_tda9875 = 1,
1614 .no_tda7432 = 1,
1615#if 0 /* TODO ... */
1616 .muxsel_hook = osprey_540_muxsel,
1617 .picture_hook = osprey_540_set_picture,
1618#endif
1619},{
1620
1621 /* ---- card 0x5C ---------------------------------- */
1622 .name = "Osprey 2000", /* 2000 */
1623 .video_inputs = 2,
1624 .audio_inputs = 1,
1625 .tuner = -1,
1626 .svhs = 1,
1627 .muxsel = { 2, 3 },
1628 .pll = PLL_28,
1629 .tuner_type = -1,
1630 .no_msp34xx = 1,
1631 .no_tda9875 = 1,
1632 .no_tda7432 = 1, /* must avoid, conflicts with the bt860 */
1633},{
1634 /* M G Berberich <berberic@forwiss.uni-passau.de> */
1635 .name = "IDS Eagle",
1636 .video_inputs = 4,
1637 .audio_inputs = 0,
1638 .tuner = -1,
1639 .tuner_type = -1,
1640 .svhs = -1,
1641 .gpiomask = 0,
1642 .muxsel = { 0, 1, 2, 3 },
1643 .muxsel_hook = eagle_muxsel,
1644 .no_msp34xx = 1,
1645 .no_tda9875 = 1,
1646 .pll = PLL_28,
1647},{
1648 .name = "Pinnacle PCTV Sat",
1649 .video_inputs = 2,
1650 .audio_inputs = 0,
1651 .svhs = 1,
1652 .tuner = -1,
1653 .tuner_type = -1,
1654 .no_msp34xx = 1,
1655 .no_tda9875 = 1,
1656 .no_tda7432 = 1,
1657 .gpiomask = 0x01,
1658 .audiomux = { 0, 0, 0, 0, 1 },
1659 .muxsel = { 3, 0, 1, 2},
1660 .needs_tvaudio = 0,
1661 .pll = PLL_28,
1662 .no_gpioirq = 1,
1663 .has_dvb = 1,
1664},{
1665 .name = "Formac ProTV II (bt878)",
1666 .video_inputs = 4,
1667 .audio_inputs = 1,
1668 .tuner = 0,
1669 .svhs = 3,
1670 .gpiomask = 2,
1671 // TV, Comp1, Composite over SVID con, SVID
1672 .muxsel = { 2, 3, 1, 1},
1673 .audiomux = { 2, 2, 0, 0, 0 },
1674 .pll = PLL_28,
1675 .has_radio = 1,
1676 .tuner_type = TUNER_PHILIPS_PAL,
1677 /* sound routing:
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.
1683 */
1684},{
1685
1686 /* ---- card 0x60 ---------------------------------- */
1687 .name = "MachTV",
1688 .video_inputs = 3,
1689 .audio_inputs = 1,
1690 .tuner = 0,
1691 .svhs = -1,
1692 .gpiomask = 7,
1693 .muxsel = { 2, 3, 1, 1},
1694 .audiomux = { 0, 1, 2, 3, 4},
1695 .needs_tvaudio = 1,
1696 .tuner_type = 5,
1697 .pll = 1,
1698},{
1699 .name = "Euresys Picolo",
1700 .video_inputs = 3,
1701 .audio_inputs = 0,
1702 .tuner = -1,
1703 .svhs = 2,
1704 .gpiomask = 0,
1705 .no_msp34xx = 1,
1706 .no_tda9875 = 1,
1707 .no_tda7432 = 1,
1708 .muxsel = { 2, 0, 1},
1709 .pll = PLL_28,
1710},{
1711 /* Luc Van Hoeylandt <luc@e-magic.be> */
1712 .name = "ProVideo PV150", /* 0x4f */
1713 .video_inputs = 2,
1714 .audio_inputs = 0,
1715 .tuner = -1,
1716 .svhs = -1,
1717 .gpiomask = 0,
1718 .muxsel = { 2, 3 },
1719 .audiomux = { 0 },
1720 .needs_tvaudio = 0,
1721 .no_msp34xx = 1,
1722 .pll = PLL_28,
1723 .tuner_type = -1,
1724},{
1725 /* Hiroshi Takekawa <sian@big.or.jp> */
1726 /* This card lacks subsystem ID */
1727 .name = "AD-TVK503", /* 0x63 */
1728 .video_inputs = 4,
1729 .audio_inputs = 1,
1730 .tuner = 0,
1731 .svhs = 2,
1732 .gpiomask = 0x001e8007,
1733 .muxsel = { 2, 3, 1, 0 },
1734 /* Tuner, Radio, external, internal, off, on */
1735 .audiomux = { 0x08, 0x0f, 0x0a, 0x08, 0x0f, 0x08 },
1736 .needs_tvaudio = 0,
1737 .no_msp34xx = 1,
1738 .pll = PLL_28,
1739 .tuner_type = 2,
1740 .audio_hook = adtvk503_audio,
1741},{
1742
1743 /* ---- card 0x64 ---------------------------------- */
1744 .name = "Hercules Smart TV Stereo",
1745 .video_inputs = 4,
1746 .audio_inputs = 1,
1747 .tuner = 0,
1748 .svhs = 2,
1749 .gpiomask = 0x00,
1750 .muxsel = { 2, 3, 1, 1 },
1751 .needs_tvaudio = 1,
1752 .no_msp34xx = 1,
1753 .pll = PLL_28,
1754 .tuner_type = 5,
1755 /* Notes:
1756 - card lacks subsystem ID
1757 - stereo variant w/ daughter board with tda9874a @0xb0
1758 - Audio Routing:
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
1763 */
1764},{
1765 .name = "Pace TV & Radio Card",
1766 .video_inputs = 4,
1767 .audio_inputs = 1,
1768 .tuner = 0,
1769 .svhs = 2,
1770 .muxsel = { 2, 3, 1, 1}, // Tuner, CVid, SVid, CVid over SVid connector
1771 .gpiomask = 0,
1772 .no_tda9875 = 1,
1773 .no_tda7432 = 1,
1774 .tuner_type = 1,
1775 .has_radio = 1,
1776 .pll = PLL_28,
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!
1781},{
1782 /* Chris Willing <chris@vislab.usyd.edu.au> */
1783 .name = "IVC-200",
1784 .video_inputs = 1,
1785 .audio_inputs = 0,
1786 .tuner = -1,
1787 .tuner_type = -1,
1788 .svhs = -1,
1789 .gpiomask = 0xdf,
1790 .muxsel = { 2 },
1791 .pll = PLL_28,
1792},{
1793 .name = "Grand X-Guard / Trust 814PCI",
1794 .video_inputs = 16,
1795 .audio_inputs = 0,
1796 .tuner = -1,
1797 .svhs = -1,
1798 .tuner_type = 4,
1799 .gpiomask2 = 0xff,
1800 .muxsel = { 2,2,2,2, 3,3,3,3, 1,1,1,1, 0,0,0,0 },
1801 .muxsel_hook = xguard_muxsel,
1802 .no_msp34xx = 1,
1803 .no_tda9875 = 1,
1804 .no_tda7432 = 1,
1805 .pll = PLL_28,
1806},{
1807
1808 /* ---- card 0x68 ---------------------------------- */
1809 .name = "Nebula Electronics DigiTV",
1810 .video_inputs = 1,
1811 .tuner = -1,
1812 .svhs = -1,
1813 .muxsel = { 2, 3, 1, 0},
1814 .no_msp34xx = 1,
1815 .no_tda9875 = 1,
1816 .no_tda7432 = 1,
1817 .pll = PLL_28,
1818 .tuner_type = -1,
1819 .has_dvb = 1,
1820 .no_gpioirq = 1,
1821},{
1822 /* Jorge Boncompte - DTI2 <jorge@dti2.net> */
1823 .name = "ProVideo PV143",
1824 .video_inputs = 4,
1825 .audio_inputs = 0,
1826 .tuner = -1,
1827 .svhs = -1,
1828 .gpiomask = 0,
1829 .muxsel = { 2, 3, 1, 0 },
1830 .audiomux = { 0 },
1831 .needs_tvaudio = 0,
1832 .no_msp34xx = 1,
1833 .pll = PLL_28,
1834 .tuner_type = -1,
1835},{
1836 /* M.Klahr@phytec.de */
1837 .name = "PHYTEC VD-009-X1 MiniDIN (bt878)",
1838 .video_inputs = 4,
1839 .audio_inputs = 0,
1840 .tuner = -1, /* card has no tuner */
1841 .svhs = 3,
1842 .gpiomask = 0x00,
1843 .muxsel = { 2, 3, 1, 0},
1844 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1845 .needs_tvaudio = 1,
1846 .pll = PLL_28,
1847 .tuner_type = -1,
1848},{
1849 .name = "PHYTEC VD-009-X1 Combi (bt878)",
1850 .video_inputs = 4,
1851 .audio_inputs = 0,
1852 .tuner = -1, /* card has no tuner */
1853 .svhs = 3,
1854 .gpiomask = 0x00,
1855 .muxsel = { 2, 3, 1, 1},
1856 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
1857 .needs_tvaudio = 1,
1858 .pll = PLL_28,
1859 .tuner_type = -1,
1860},{
1861
1862 /* ---- card 0x6c ---------------------------------- */
1863 .name = "PHYTEC VD-009 MiniDIN (bt878)",
1864 .video_inputs = 10,
1865 .audio_inputs = 0,
1866 .tuner = -1, /* card has no tuner */
1867 .svhs = 9,
1868 .gpiomask = 0x00,
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 */
1874 .needs_tvaudio = 1,
1875 .pll = PLL_28,
1876 .tuner_type = -1,
1877},{
1878 .name = "PHYTEC VD-009 Combi (bt878)",
1879 .video_inputs = 10,
1880 .audio_inputs = 0,
1881 .tuner = -1, /* card has no tuner */
1882 .svhs = 9,
1883 .gpiomask = 0x00,
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 */
1889 .needs_tvaudio = 1,
1890 .pll = PLL_28,
1891 .tuner_type = -1,
1892},{
1893 .name = "IVC-100",
1894 .video_inputs = 4,
1895 .audio_inputs = 0,
1896 .tuner = -1,
1897 .tuner_type = -1,
1898 .svhs = -1,
1899 .gpiomask = 0xdf,
1900 .muxsel = { 2, 3, 1, 0 },
1901 .pll = PLL_28,
1902},{
1903 /* IVC-120G - Alan Garfield <alan@fromorbit.com> */
1904 .name = "IVC-120G",
1905 .video_inputs = 16,
1906 .audio_inputs = 0, /* card has no audio */
1907 .tuner = -1, /* card has no tuner */
1908 .tuner_type = -1,
1909 .svhs = -1, /* card has no svhs */
1910 .needs_tvaudio = 0,
1911 .no_msp34xx = 1,
1912 .no_tda9875 = 1,
1913 .no_tda7432 = 1,
1914 .gpiomask = 0x00,
1915 .muxsel = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
1916 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10 },
1917 .muxsel_hook = ivc120_muxsel,
1918 .pll = PLL_28,
1919},{
1920
1921 /* ---- card 0x70 ---------------------------------- */
1922 .name = "pcHDTV HD-2000 TV",
1923 .video_inputs = 4,
1924 .audio_inputs = 1,
1925 .tuner = 0,
1926 .svhs = 2,
1927 .muxsel = { 2, 3, 1, 0},
1928 .tuner_type = TUNER_PHILIPS_ATSC,
1929 .has_dvb = 1,
1930},{
1931 .name = "Twinhan DST + clones",
1932 .no_msp34xx = 1,
1933 .no_tda9875 = 1,
1934 .no_tda7432 = 1,
1935 .tuner_type = TUNER_ABSENT,
1936 .no_video = 1,
1937 .has_dvb = 1,
1938},{
1939 .name = "Winfast VC100",
1940 .video_inputs = 3,
1941 .audio_inputs = 0,
1942 .svhs = 1,
1943 .tuner = -1, // no tuner
1944 .muxsel = { 3, 1, 1, 3}, // Vid In, SVid In, Vid over SVid in connector
1945 .no_msp34xx = 1,
1946 .no_tda9875 = 1,
1947 .no_tda7432 = 1,
1948 .tuner_type = TUNER_ABSENT,
1949 .no_video = 1,
1950 .pll = PLL_28,
1951},{
1952 .name = "Teppro TEV-560/InterVision IV-560",
1953 .video_inputs = 3,
1954 .audio_inputs = 1,
1955 .tuner = 0,
1956 .svhs = 2,
1957 .gpiomask = 3,
1958 .muxsel = { 2, 3, 1, 1},
1959 .audiomux = { 1, 1, 1, 1, 0},
1960 .needs_tvaudio = 1,
1961 .tuner_type = TUNER_PHILIPS_PAL,
1962 .pll = PLL_35,
1963},{
1964
1965 /* ---- card 0x74 ---------------------------------- */
1966 .name = "SIMUS GVC1100",
1967 .video_inputs = 4,
1968 .audio_inputs = 0,
1969 .tuner = -1,
1970 .svhs = -1,
1971 .tuner_type = -1,
1972 .pll = PLL_28,
1973 .muxsel = { 2, 2, 2, 2},
1974 .gpiomask = 0x3F,
1975 .muxsel_hook = gvc1100_muxsel,
1976},{
1977 /* Carlos Silva r3pek@r3pek.homelinux.org || card 0x75 */
1978 .name = "NGS NGSTV+",
1979 .video_inputs = 3,
1980 .tuner = 0,
1981 .svhs = 2,
1982 .gpiomask = 0x008007,
1983 .muxsel = {2, 3, 0, 0},
1984 .audiomux = {0, 0, 0, 0, 0x000003, 0},
1985 .pll = PLL_28,
1986 .tuner_type = TUNER_PHILIPS_PAL,
1987 .has_remote = 1,
1988},{
1989 /* http://linuxmedialabs.com */
1990 .name = "LMLBT4",
1991 .video_inputs = 4, /* IN1,IN2,IN3,IN4 */
1992 .audio_inputs = 0,
1993 .tuner = -1,
1994 .svhs = -1,
1995 .muxsel = { 2, 3, 1, 0 },
1996 .no_msp34xx = 1,
1997 .no_tda9875 = 1,
1998 .no_tda7432 = 1,
1999 .needs_tvaudio = 0,
2000},{
2001 /* Helmroos Harri <harri.helmroos@pp.inet.fi> */
2002 .name = "Tekram M205 PRO",
2003 .video_inputs = 3,
2004 .audio_inputs = 1,
2005 .tuner = 0,
2006 .tuner_type = TUNER_PHILIPS_PAL,
2007 .svhs = 2,
2008 .needs_tvaudio = 0,
2009 .gpiomask = 0x68,
2010 .muxsel = { 2, 3, 1},
2011 .audiomux = { 0x68, 0x68, 0x61, 0x61, 0x00 },
2012 .pll = PLL_28,
2013},{
2014
2015 /* ---- card 0x78 ---------------------------------- */
2016 /* Javier Cendan Ares <jcendan@lycos.es> */
2017 /* bt878 TV + FM without subsystem ID */
2018 .name = "Conceptronic CONTVFMi",
2019 .video_inputs = 3,
2020 .audio_inputs = 1,
2021 .tuner = 0,
2022 .svhs = 2,
2023 .gpiomask = 0x008007,
2024 .muxsel = { 2, 3, 1, 1 },
2025 .audiomux = { 0, 1, 2, 2, 3 },
2026 .needs_tvaudio = 0,
2027 .pll = PLL_28,
2028 .tuner_type = TUNER_PHILIPS_PAL,
2029 .has_remote = 1,
2030 .has_radio = 1,
2031},{
2032 /*Eric DEBIEF <debief@telemsa.com>*/
2033 /*EURESYS Picolo Tetra : 4 Conexant Fusion 878A, no audio, video input set with analog multiplexers GPIO controled*/
2034 /* adds picolo_tetra_muxsel(), picolo_tetra_init(), the folowing declaration strucure, and #define BTTV_PICOLO_TETRA_CHIP*/
2035 /*0x79 in bttv.h*/
2036 .name = "Euresys Picolo Tetra",
2037 .video_inputs = 4,
2038 .audio_inputs = 0,
2039 .tuner = -1,
2040 .svhs = -1,
2041 .gpiomask = 0,
2042 .gpiomask2 = 0x3C<<16,/*Set the GPIO[18]->GPIO[21] as output pin.==> drive the video inputs through analog multiplexers*/
2043 .no_msp34xx = 1,
2044 .no_tda9875 = 1,
2045 .no_tda7432 = 1,
2046 .muxsel = {2,2,2,2},/*878A input is always MUX0, see above.*/
2047 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
2048 .pll = PLL_28,
2049 .needs_tvaudio = 0,
2050 .muxsel_hook = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/
2051},{
2052 /* Spirit TV Tuner from http://spiritmodems.com.au */
2053 /* Stafford Goodsell <surge@goliath.homeunix.org> */
2054 .name = "Spirit TV Tuner",
2055 .video_inputs = 3,
2056 .audio_inputs = 1,
2057 .tuner = 0,
2058 .svhs = 2,
2059 .gpiomask = 0x0000000f,
2060 .muxsel = { 2, 1, 1 },
2061 .audiomux = { 0x02, 0x00, 0x00, 0x00, 0x00},
2062 .tuner_type = TUNER_TEMIC_PAL,
2063 .no_msp34xx = 1,
2064 .no_tda9875 = 1,
2065},{
2066 /* Wolfram Joost <wojo@frokaschwei.de> */
2067 .name = "AVerMedia AVerTV DVB-T 771",
2068 .video_inputs = 2,
2069 .svhs = 1,
2070 .tuner = -1,
2071 .tuner_type = TUNER_ABSENT,
2072 .muxsel = { 3 , 3 },
2073 .no_msp34xx = 1,
2074 .no_tda9875 = 1,
2075 .no_tda7432 = 1,
2076 .pll = PLL_28,
2077 .has_dvb = 1,
2078 .no_gpioirq = 1,
2079 .has_remote = 1,
2080},{
2081 /* ---- card 0x7c ---------------------------------- */
2082 /* Matt Jesson <dvb@jesson.eclipse.co.uk> */
2083 /* Based on the Nebula card data - added remote and new card number - BTTV_AVDVBT_761, see also ir-kbd-gpio.c */
2084 .name = "AverMedia AverTV DVB-T 761",
2085 .video_inputs = 2,
2086 .tuner = -1,
2087 .svhs = 1,
2088 .muxsel = { 3, 1, 2, 0}, /* Comp0, S-Video, ?, ? */
2089 .no_msp34xx = 1,
2090 .no_tda9875 = 1,
2091 .no_tda7432 = 1,
2092 .pll = PLL_28,
2093 .tuner_type = -1,
2094 .has_dvb = 1,
2095 .no_gpioirq = 1,
2096 .has_remote = 1,
2097},{
2098 /* andre.schwarz@matrix-vision.de */
2099 .name = "MATRIX Vision Sigma-SQ",
2100 .video_inputs = 16,
2101 .audio_inputs = 0,
2102 .tuner = -1,
2103 .svhs = -1,
2104 .gpiomask = 0x0,
2105 .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2,
2106 3, 3, 3, 3, 3, 3, 3, 3 },
2107 .muxsel_hook = sigmaSQ_muxsel,
2108 .audiomux = { 0 },
2109 .no_msp34xx = 1,
2110 .pll = PLL_28,
2111 .tuner_type = -1,
2112},{
2113 /* andre.schwarz@matrix-vision.de */
2114 .name = "MATRIX Vision Sigma-SLC",
2115 .video_inputs = 4,
2116 .audio_inputs = 0,
2117 .tuner = -1,
2118 .svhs = -1,
2119 .gpiomask = 0x0,
2120 .muxsel = { 2, 2, 2, 2 },
2121 .muxsel_hook = sigmaSLC_muxsel,
2122 .audiomux = { 0 },
2123 .no_msp34xx = 1,
2124 .pll = PLL_28,
2125 .tuner_type = -1,
2126},{
2127 /* BTTV_APAC_VIEWCOMP */
2128 /* Attila Kondoros <attila.kondoros@chello.hu> */
2129 /* bt878 TV + FM 0x00000000 subsystem ID */
2130 .name = "APAC Viewcomp 878(AMAX)",
2131 .video_inputs = 2,
2132 .audio_inputs = 1,
2133 .tuner = 0,
2134 .svhs = -1,
2135 .gpiomask = 0xFF,
2136 .muxsel = { 2, 3, 1, 1},
2137 .audiomux = { 2, 0, 0, 0, 10},
2138 .needs_tvaudio = 0,
2139 .pll = PLL_28,
2140 .tuner_type = TUNER_PHILIPS_PAL,
2141 .has_remote = 1, /* miniremote works, see ir-kbd-gpio.c */
2142 .has_radio = 1, /* not every card has radio */
2143},{
2144
2145 /* ---- card 0x80 ---------------------------------- */
2146 /* Chris Pascoe <c.pascoe@itee.uq.edu.au> */
2147 .name = "DVICO FusionHDTV DVB-T Lite",
2148 .tuner = -1,
2149 .no_msp34xx = 1,
2150 .no_tda9875 = 1,
2151 .no_tda7432 = 1,
2152 .pll = PLL_28,
2153 .no_video = 1,
2154 .has_dvb = 1,
2155 .tuner_type = -1,
2156},{
2157 /* Steven <photon38@pchome.com.tw> */
2158 .name = "V-Gear MyVCD",
2159 .video_inputs = 3,
2160 .audio_inputs = 1,
2161 .tuner = 0,
2162 .svhs = 2,
2163 .gpiomask = 0x3f,
2164 .muxsel = {2, 3, 1, 0},
2165 .audiomux = {0x31, 0x31, 0x31, 0x31, 0x31, 0x31},
2166 .no_msp34xx = 1,
2167 .pll = PLL_28,
2168 .tuner_type = TUNER_PHILIPS_NTSC_M,
2169 .has_radio = 0,
2170 // .has_remote = 1,
2171},{
2172 /* Rick C <cryptdragoon@gmail.com> */
2173 .name = "Super TV Tuner",
2174 .video_inputs = 4,
2175 .audio_inputs = 1,
2176 .tuner = 0,
2177 .svhs = 2,
2178 .muxsel = { 2, 3, 1, 0},
2179 .tuner_type = TUNER_PHILIPS_NTSC,
2180 .gpiomask = 0x008007,
2181 .audiomux = { 0, 0x000001,0,0, 0},
2182 .needs_tvaudio = 1,
2183 .has_radio = 1,
2184},{
2185 /* Chris Fanning <video4linux@haydon.net> */
2186 .name = "Tibet Systems 'Progress DVR' CS16",
2187 .video_inputs = 16,
2188 .audio_inputs = 0,
2189 .tuner = -1,
2190 .svhs = -1,
2191 .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 },
2192 .pll = PLL_28,
2193 .no_msp34xx = 1,
2194 .no_tda9875 = 1,
2195 .no_tda7432 = 1,
2196 .tuner_type = -1,
2197 .muxsel_hook = tibetCS16_muxsel,
2198},
2199{
2200 /* Bill Brack <wbrack@mmm.com.hk> */
2201 /*
2202 * Note that, because of the card's wiring, the "master"
2203 * BT878A chip (i.e. the one which controls the analog switch
2204 * and must use this card type) is the 2nd one detected. The
2205 * other 3 chips should use card type 0x85, whose description
2206 * follows this one. There is a EEPROM on the card (which is
2207 * connected to the I2C of one of those other chips), but is
2208 * not currently handled. There is also a facility for a
2209 * "monitor", which is also not currently implemented.
2210 */
2211 .name = "Kodicom 4400R (master)",
2212 .video_inputs = 16,
2213 .audio_inputs = 0,
2214 .tuner = -1,
2215 .tuner_type = -1,
2216 .svhs = -1,
2217 /* GPIO bits 0-9 used for analog switch:
2218 * 00 - 03: camera selector
2219 * 04 - 06: channel (controller) selector
2220 * 07: data (1->on, 0->off)
2221 * 08: strobe
2222 * 09: reset
2223 * bit 16 is input from sync separator for the channel
2224 */
2225 .gpiomask = 0x0003ff,
2226 .no_gpioirq = 1,
2227 .muxsel = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
2228 .pll = PLL_28,
2229 .no_msp34xx = 1,
2230 .no_tda7432 = 1,
2231 .no_tda9875 = 1,
2232 .muxsel_hook = kodicom4400r_muxsel,
2233},
2234{
2235 /* Bill Brack <wbrack@mmm.com.hk> */
2236 /* Note that, for reasons unknown, the "master" BT878A chip (i.e. the
2237 * one which controls the analog switch, and must use the card type)
2238 * is the 2nd one detected. The other 3 chips should use this card
2239 * type
2240 */
2241 .name = "Kodicom 4400R (slave)",
2242 .video_inputs = 16,
2243 .audio_inputs = 0,
2244 .tuner = -1,
2245 .tuner_type = -1,
2246 .svhs = -1,
2247 .gpiomask = 0x010000,
2248 .no_gpioirq = 1,
2249 .muxsel = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
2250 .pll = PLL_28,
2251 .no_msp34xx = 1,
2252 .no_tda7432 = 1,
2253 .no_tda9875 = 1,
2254 .muxsel_hook = kodicom4400r_muxsel,
2255}};
2256
2257static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards);
2258
2259/* ----------------------------------------------------------------------- */
2260
2261static unsigned char eeprom_data[256];
2262
2263/*
2264 * identify card
2265 */
2266void __devinit bttv_idcard(struct bttv *btv)
2267{
2268 unsigned int gpiobits;
2269 int i,type;
2270 unsigned short tmp;
2271
2272 /* read PCI subsystem ID */
2273 pci_read_config_word(btv->c.pci, PCI_SUBSYSTEM_ID, &tmp);
2274 btv->cardid = tmp << 16;
2275 pci_read_config_word(btv->c.pci, PCI_SUBSYSTEM_VENDOR_ID, &tmp);
2276 btv->cardid |= tmp;
2277
2278 if (0 != btv->cardid && 0xffffffff != btv->cardid) {
2279 /* look for the card */
2280 for (type = -1, i = 0; cards[i].id != 0; i++)
2281 if (cards[i].id == btv->cardid)
2282 type = i;
2283
2284 if (type != -1) {
2285 /* found it */
2286 printk(KERN_INFO "bttv%d: detected: %s [card=%d], "
2287 "PCI subsystem ID is %04x:%04x\n",
2288 btv->c.nr,cards[type].name,cards[type].cardnr,
2289 btv->cardid & 0xffff,
2290 (btv->cardid >> 16) & 0xffff);
2291 btv->c.type = cards[type].cardnr;
2292 } else {
2293 /* 404 */
2294 printk(KERN_INFO "bttv%d: subsystem: %04x:%04x (UNKNOWN)\n",
2295 btv->c.nr, btv->cardid & 0xffff,
2296 (btv->cardid >> 16) & 0xffff);
2297 printk(KERN_DEBUG "please mail id, board name and "
2298 "the correct card= insmod option to kraxel@bytesex.org\n");
2299 }
2300 }
2301
2302 /* let the user override the autodetected type */
2303 if (card[btv->c.nr] < bttv_num_tvcards)
2304 btv->c.type=card[btv->c.nr];
2305
2306 /* print which card config we are using */
2307 printk(KERN_INFO "bttv%d: using: %s [card=%d,%s]\n",btv->c.nr,
2308 bttv_tvcards[btv->c.type].name, btv->c.type,
2309 card[btv->c.nr] < bttv_num_tvcards
2310 ? "insmod option" : "autodetected");
2311
2312 /* overwrite gpio stuff ?? */
2313 if (UNSET == audioall && UNSET == audiomux[0])
2314 return;
2315
2316 if (UNSET != audiomux[0]) {
2317 gpiobits = 0;
2318 for (i = 0; i < 5; i++) {
2319 bttv_tvcards[btv->c.type].audiomux[i] = audiomux[i];
2320 gpiobits |= audiomux[i];
2321 }
2322 } else {
2323 gpiobits = audioall;
2324 for (i = 0; i < 5; i++) {
2325 bttv_tvcards[btv->c.type].audiomux[i] = audioall;
2326 }
2327 }
2328 bttv_tvcards[btv->c.type].gpiomask = (UNSET != gpiomask) ? gpiomask : gpiobits;
2329 printk(KERN_INFO "bttv%d: gpio config override: mask=0x%x, mux=",
2330 btv->c.nr,bttv_tvcards[btv->c.type].gpiomask);
2331 for (i = 0; i < 5; i++) {
2332 printk("%s0x%x", i ? "," : "", bttv_tvcards[btv->c.type].audiomux[i]);
2333 }
2334 printk("\n");
2335}
2336
2337/*
2338 * (most) board specific initialisations goes here
2339 */
2340
2341/* Some Modular Technology cards have an eeprom, but no subsystem ID */
2342void identify_by_eeprom(struct bttv *btv, unsigned char eeprom_data[256])
2343{
2344 int type = -1;
2345
2346 if (0 == strncmp(eeprom_data,"GET MM20xPCTV",13))
2347 type = BTTV_MODTEC_205;
2348 else if (0 == strncmp(eeprom_data+20,"Picolo",7))
2349 type = BTTV_EURESYS_PICOLO;
2350 else if (eeprom_data[0] == 0x84 && eeprom_data[2]== 0)
2351 type = BTTV_HAUPPAUGE; /* old bt848 */
2352
2353 if (-1 != type) {
2354 btv->c.type = type;
2355 printk("bttv%d: detected by eeprom: %s [card=%d]\n",
2356 btv->c.nr, bttv_tvcards[btv->c.type].name, btv->c.type);
2357 }
2358}
2359
2360static void flyvideo_gpio(struct bttv *btv)
2361{
2362 int gpio,has_remote,has_radio,is_capture_only,is_lr90,has_tda9820_tda9821;
2363 int tuner=-1,ttype;
2364
2365 gpio_inout(0xffffff, 0);
2366 udelay(8); // without this we would see the 0x1800 mask
2367 gpio = gpio_read();
2368 /* FIXME: must restore OUR_EN ??? */
2369
2370 // all cards provide GPIO info, some have an additional eeprom
2371 // LR50: GPIO coding can be found lower right CP1 .. CP9
2372 // CP9=GPIO23 .. CP1=GPIO15; when OPEN, the corresponding GPIO reads 1.
2373 // GPIO14-12: n.c.
2374 // LR90: GP9=GPIO23 .. GP1=GPIO15 (right above the bt878)
2375
2376 // lowest 3 bytes are remote control codes (no handshake needed)
2377 // xxxFFF: No remote control chip soldered
2378 // xxxF00(LR26/LR50), xxxFE0(LR90): Remote control chip (LVA001 or CF45) soldered
2379 // Note: Some bits are Audio_Mask !
2380
2381 ttype=(gpio&0x0f0000)>>16;
2382 switch(ttype) {
2383 case 0x0: tuner=2; // NTSC, e.g. TPI8NSR11P
2384 break;
2385 case 0x2: tuner=39;// LG NTSC (newer TAPC series) TAPC-H701P
2386 break;
2387 case 0x4: tuner=5; // Philips PAL TPI8PSB02P, TPI8PSB12P, TPI8PSB12D or FI1216, FM1216
2388 break;
2389 case 0x6: tuner=37; // LG PAL (newer TAPC series) TAPC-G702P
2390 break;
2391 case 0xC: tuner=3; // Philips SECAM(+PAL) FQ1216ME or FI1216MF
2392 break;
2393 default:
2394 printk(KERN_INFO "bttv%d: FlyVideo_gpio: unknown tuner type.\n", btv->c.nr);
2395 }
2396
2397 has_remote = gpio & 0x800000;
2398 has_radio = gpio & 0x400000;
2399 // unknown 0x200000;
2400 // unknown2 0x100000;
2401 is_capture_only = !(gpio & 0x008000); //GPIO15
2402 has_tda9820_tda9821 = !(gpio & 0x004000);
2403 is_lr90 = !(gpio & 0x002000); // else LR26/LR50 (LR38/LR51 f. capture only)
2404 // gpio & 0x001000 // output bit for audio routing
2405
2406 if(is_capture_only)
2407 tuner=4; // No tuner present
2408
2409 printk(KERN_INFO "bttv%d: FlyVideo Radio=%s RemoteControl=%s Tuner=%d gpio=0x%06x\n",
2410 btv->c.nr, has_radio? "yes":"no ", has_remote? "yes":"no ", tuner, gpio);
2411 printk(KERN_INFO "bttv%d: FlyVideo LR90=%s tda9821/tda9820=%s capture_only=%s\n",
2412 btv->c.nr, is_lr90?"yes":"no ", has_tda9820_tda9821?"yes":"no ",
2413 is_capture_only?"yes":"no ");
2414
2415 if(tuner!= -1) // only set if known tuner autodetected, else let insmod option through
2416 btv->tuner_type = tuner;
2417 btv->has_radio = has_radio;
2418
2419 // LR90 Audio Routing is done by 2 hef4052, so Audio_Mask has 4 bits: 0x001c80
2420 // LR26/LR50 only has 1 hef4052, Audio_Mask 0x000c00
2421 // Audio options: from tuner, from tda9821/tda9821(mono,stereo,sap), from tda9874, ext., mute
2422 if(has_tda9820_tda9821) btv->audio_hook = lt9415_audio;
2423 //todo: if(has_tda9874) btv->audio_hook = fv2000s_audio;
2424}
2425
2426static int miro_tunermap[] = { 0,6,2,3, 4,5,6,0, 3,0,4,5, 5,2,16,1,
2427 14,2,17,1, 4,1,4,3, 1,2,16,1, 4,4,4,4 };
2428static int miro_fmtuner[] = { 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1,
2429 1,1,1,1, 1,1,1,0, 0,0,0,0, 0,1,0,0 };
2430
2431static void miro_pinnacle_gpio(struct bttv *btv)
2432{
2433 int id,msp,gpio;
2434 char *info;
2435
2436 gpio_inout(0xffffff, 0);
2437 gpio = gpio_read();
2438 id = ((gpio>>10) & 63) -1;
2439 msp = bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx");
2440 if (id < 32) {
2441 btv->tuner_type = miro_tunermap[id];
2442 if (0 == (gpio & 0x20)) {
2443 btv->has_radio = 1;
2444 if (!miro_fmtuner[id]) {
2445 btv->has_matchbox = 1;
2446 btv->mbox_we = (1<<6);
2447 btv->mbox_most = (1<<7);
2448 btv->mbox_clk = (1<<8);
2449 btv->mbox_data = (1<<9);
2450 btv->mbox_mask = (1<<6)|(1<<7)|(1<<8)|(1<<9);
2451 }
2452 } else {
2453 btv->has_radio = 0;
2454 }
2455 if (-1 != msp) {
2456 if (btv->c.type == BTTV_MIRO)
2457 btv->c.type = BTTV_MIROPRO;
2458 if (btv->c.type == BTTV_PINNACLE)
2459 btv->c.type = BTTV_PINNACLEPRO;
2460 }
2461 printk(KERN_INFO
2462 "bttv%d: miro: id=%d tuner=%d radio=%s stereo=%s\n",
2463 btv->c.nr, id+1, btv->tuner_type,
2464 !btv->has_radio ? "no" :
2465 (btv->has_matchbox ? "matchbox" : "fmtuner"),
2466 (-1 == msp) ? "no" : "yes");
2467 } else {
2468 /* new cards with microtune tuner */
2469 id = 63 - id;
2470 btv->has_radio = 0;
2471 switch (id) {
2472 case 1:
2473 info = "PAL / mono";
2474 break;
2475 case 2:
2476 info = "PAL+SECAM / stereo";
2477 btv->has_radio = 1;
2478 break;
2479 case 3:
2480 info = "NTSC / stereo";
2481 btv->has_radio = 1;
2482 break;
2483 case 4:
2484 info = "PAL+SECAM / mono";
2485 break;
2486 case 5:
2487 info = "NTSC / mono";
2488 break;
2489 case 6:
2490 info = "NTSC / stereo";
2491 break;
2492 case 7:
2493 info = "PAL / stereo";
2494 break;
2495 default:
2496 info = "oops: unknown card";
2497 break;
2498 }
2499 if (-1 != msp)
2500 btv->c.type = BTTV_PINNACLEPRO;
2501 printk(KERN_INFO
2502 "bttv%d: pinnacle/mt: id=%d info=\"%s\" radio=%s\n",
2503 btv->c.nr, id, info, btv->has_radio ? "yes" : "no");
2504 btv->tuner_type = 33;
2505 btv->pinnacle_id = id;
2506 }
2507}
2508
2509/* GPIO21 L: Buffer aktiv, H: Buffer inaktiv */
2510#define LM1882_SYNC_DRIVE 0x200000L
2511
2512static void init_ids_eagle(struct bttv *btv)
2513{
2514 gpio_inout(0xffffff,0xFFFF37);
2515 gpio_write(0x200020);
2516
2517 /* flash strobe inverter ?! */
2518 gpio_write(0x200024);
2519
2520 /* switch sync drive off */
2521 gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE);
2522
2523 /* set BT848 muxel to 2 */
2524 btaor((2)<<5, ~(2<<5), BT848_IFORM);
2525}
2526
2527/* Muxsel helper for the IDS Eagle.
2528 * the eagles does not use the standard muxsel-bits but
2529 * has its own multiplexer */
2530static void eagle_muxsel(struct bttv *btv, unsigned int input)
2531{
2532 btaor((2)<<5, ~(3<<5), BT848_IFORM);
2533 gpio_bits(3,bttv_tvcards[btv->c.type].muxsel[input&7]);
2534
2535#if 0
2536 /* svhs */
2537 /* wake chroma ADC */
2538 btand(~BT848_ADC_C_SLEEP, BT848_ADC);
2539 /* set to YC video */
2540 btor(BT848_CONTROL_COMP, BT848_E_CONTROL);
2541 btor(BT848_CONTROL_COMP, BT848_O_CONTROL);
2542#else
2543 /* composite */
2544 /* set chroma ADC to sleep */
2545 btor(BT848_ADC_C_SLEEP, BT848_ADC);
2546 /* set to composite video */
2547 btand(~BT848_CONTROL_COMP, BT848_E_CONTROL);
2548 btand(~BT848_CONTROL_COMP, BT848_O_CONTROL);
2549#endif
2550
2551 /* switch sync drive off */
2552 gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE);
2553}
2554
2555static void gvc1100_muxsel(struct bttv *btv, unsigned int input)
2556{
2557 static const int masks[] = {0x30, 0x01, 0x12, 0x23};
2558 gpio_write(masks[input%4]);
2559}
2560
2561/* LMLBT4x initialization - to allow access to GPIO bits for sensors input and
2562 alarms output
2563
2564 GPIObit | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
2565 assignment | TI | O3|INx| O2| O1|IN4|IN3|IN2|IN1| | |
2566
2567 IN - sensor inputs, INx - sensor inputs and TI XORed together
2568 O1,O2,O3 - alarm outputs (relays)
2569
2570 OUT ENABLE 1 1 0 . 1 1 0 0 . 0 0 0 0 = 0x6C0
2571
2572*/
2573
2574static void init_lmlbt4x(struct bttv *btv)
2575{
2576 printk(KERN_DEBUG "LMLBT4x init\n");
2577 btwrite(0x000000, BT848_GPIO_REG_INP);
2578 gpio_inout(0xffffff, 0x0006C0);
2579 gpio_write(0x000000);
2580}
2581
2582static void sigmaSQ_muxsel(struct bttv *btv, unsigned int input)
2583{
2584 unsigned int inmux = input % 8;
2585 gpio_inout( 0xf, 0xf );
2586 gpio_bits( 0xf, inmux );
2587}
2588
2589static void sigmaSLC_muxsel(struct bttv *btv, unsigned int input)
2590{
2591 unsigned int inmux = input % 4;
2592 gpio_inout( 3<<9, 3<<9 );
2593 gpio_bits( 3<<9, inmux<<9 );
2594}
2595
2596/* ----------------------------------------------------------------------- */
2597
2598static void bttv_reset_audio(struct bttv *btv)
2599{
2600 /*
2601 * BT878A has a audio-reset register.
2602 * 1. This register is an audio reset function but it is in
2603 * function-0 (video capture) address space.
2604 * 2. It is enough to do this once per power-up of the card.
2605 * 3. There is a typo in the Conexant doc -- it is not at
2606 * 0x5B, but at 0x058. (B is an odd-number, obviously a typo!).
2607 * --//Shrikumar 030609
2608 */
2609 if (btv->id != 878)
2610 return;
2611
2612 if (bttv_debug)
2613 printk("bttv%d: BT878A ARESET\n",btv->c.nr);
2614 btwrite((1<<7), 0x058);
2615 udelay(10);
2616 btwrite( 0, 0x058);
2617}
2618
2619/* initialization part one -- before registering i2c bus */
2620void __devinit bttv_init_card1(struct bttv *btv)
2621{
2622 switch (btv->c.type) {
2623 case BTTV_HAUPPAUGE:
2624 case BTTV_HAUPPAUGE878:
2625 boot_msp34xx(btv,5);
2626 break;
2627 case BTTV_VOODOOTV_FM:
2628 boot_msp34xx(btv,20);
2629 break;
2630 case BTTV_AVERMEDIA98:
2631 boot_msp34xx(btv,11);
2632 break;
2633 case BTTV_HAUPPAUGEPVR:
2634 pvr_boot(btv);
2635 break;
2636 case BTTV_TWINHAN_DST:
2637 case BTTV_AVDVBT_771:
2638 btv->use_i2c_hw = 1;
2639 break;
2640 }
2641 if (!bttv_tvcards[btv->c.type].has_dvb)
2642 bttv_reset_audio(btv);
2643}
2644
2645/* initialization part two -- after registering i2c bus */
2646void __devinit bttv_init_card2(struct bttv *btv)
2647{
2648 int tda9887;
2649 btv->tuner_type = -1;
2650
2651 if (BTTV_UNKNOWN == btv->c.type) {
2652 bttv_readee(btv,eeprom_data,0xa0);
2653 identify_by_eeprom(btv,eeprom_data);
2654 }
2655
2656 switch (btv->c.type) {
2657 case BTTV_MIRO:
2658 case BTTV_MIROPRO:
2659 case BTTV_PINNACLE:
2660 case BTTV_PINNACLEPRO:
2661 /* miro/pinnacle */
2662 miro_pinnacle_gpio(btv);
2663 break;
2664 case BTTV_FLYVIDEO_98:
2665 case BTTV_MAXI:
2666 case BTTV_LIFE_FLYKIT:
2667 case BTTV_FLYVIDEO:
2668 case BTTV_TYPHOON_TVIEW:
2669 case BTTV_CHRONOS_VS2:
2670 case BTTV_FLYVIDEO_98FM:
2671 case BTTV_FLYVIDEO2000:
2672 case BTTV_FLYVIDEO98EZ:
2673 case BTTV_CONFERENCETV:
2674 case BTTV_LIFETEC_9415:
2675 flyvideo_gpio(btv);
2676 break;
2677 case BTTV_HAUPPAUGE:
2678 case BTTV_HAUPPAUGE878:
2679 case BTTV_HAUPPAUGEPVR:
2680 /* pick up some config infos from the eeprom */
2681 bttv_readee(btv,eeprom_data,0xa0);
2682 hauppauge_eeprom(btv);
2683 break;
2684 case BTTV_AVERMEDIA98:
2685 case BTTV_AVPHONE98:
2686 bttv_readee(btv,eeprom_data,0xa0);
2687 avermedia_eeprom(btv);
2688 break;
2689 case BTTV_PXC200:
2690 init_PXC200(btv);
2691 break;
2692 case BTTV_PICOLO_TETRA_CHIP:
2693 picolo_tetra_init(btv);
2694 break;
2695 case BTTV_VHX:
2696 btv->has_radio = 1;
2697 btv->has_matchbox = 1;
2698 btv->mbox_we = 0x20;
2699 btv->mbox_most = 0;
2700 btv->mbox_clk = 0x08;
2701 btv->mbox_data = 0x10;
2702 btv->mbox_mask = 0x38;
2703 break;
2704 case BTTV_VOBIS_BOOSTAR:
2705 case BTTV_TERRATV:
2706 terratec_active_radio_upgrade(btv);
2707 break;
2708 case BTTV_MAGICTVIEW061:
2709 if (btv->cardid == 0x3002144f) {
2710 btv->has_radio=1;
2711 printk("bttv%d: radio detected by subsystem id (CPH05x)\n",btv->c.nr);
2712 }
2713 break;
2714 case BTTV_STB2:
2715 if (btv->cardid == 0x3060121a) {
2716 /* Fix up entry for 3DFX VoodooTV 100,
2717 which is an OEM STB card variant. */
2718 btv->has_radio=0;
2719 btv->tuner_type=TUNER_TEMIC_NTSC;
2720 }
2721 break;
2722 case BTTV_OSPREY1x0:
2723 case BTTV_OSPREY1x0_848:
2724 case BTTV_OSPREY101_848:
2725 case BTTV_OSPREY1x1:
2726 case BTTV_OSPREY1x1_SVID:
2727 case BTTV_OSPREY2xx:
2728 case BTTV_OSPREY2x0_SVID:
2729 case BTTV_OSPREY2x0:
2730 case BTTV_OSPREY500:
2731 case BTTV_OSPREY540:
2732 case BTTV_OSPREY2000:
2733 bttv_readee(btv,eeprom_data,0xa0);
2734 osprey_eeprom(btv);
2735 break;
2736 case BTTV_IDS_EAGLE:
2737 init_ids_eagle(btv);
2738 break;
2739 case BTTV_MODTEC_205:
2740 bttv_readee(btv,eeprom_data,0xa0);
2741 modtec_eeprom(btv);
2742 break;
2743 case BTTV_LMLBT4:
2744 init_lmlbt4x(btv);
2745 break;
2746 case BTTV_TIBET_CS16:
2747 tibetCS16_init(btv);
2748 break;
2749 case BTTV_KODICOM_4400R:
2750 kodicom4400r_init(btv);
2751 break;
2752 }
2753
2754 /* pll configuration */
2755 if (!(btv->id==848 && btv->revision==0x11)) {
2756 /* defaults from card list */
2757 if (PLL_28 == bttv_tvcards[btv->c.type].pll) {
2758 btv->pll.pll_ifreq=28636363;
2759 btv->pll.pll_crystal=BT848_IFORM_XT0;
2760 }
2761 if (PLL_35 == bttv_tvcards[btv->c.type].pll) {
2762 btv->pll.pll_ifreq=35468950;
2763 btv->pll.pll_crystal=BT848_IFORM_XT1;
2764 }
2765 /* insmod options can override */
2766 switch (pll[btv->c.nr]) {
2767 case 0: /* none */
2768 btv->pll.pll_crystal = 0;
2769 btv->pll.pll_ifreq = 0;
2770 btv->pll.pll_ofreq = 0;
2771 break;
2772 case 1: /* 28 MHz */
2773 case 28:
2774 btv->pll.pll_ifreq = 28636363;
2775 btv->pll.pll_ofreq = 0;
2776 btv->pll.pll_crystal = BT848_IFORM_XT0;
2777 break;
2778 case 2: /* 35 MHz */
2779 case 35:
2780 btv->pll.pll_ifreq = 35468950;
2781 btv->pll.pll_ofreq = 0;
2782 btv->pll.pll_crystal = BT848_IFORM_XT1;
2783 break;
2784 }
2785 }
2786 btv->pll.pll_current = -1;
2787
2788 bttv_reset_audio(btv);
2789
2790 /* tuner configuration (from card list / autodetect / insmod option) */
2791 if (UNSET != bttv_tvcards[btv->c.type].tuner_type)
2792 if(UNSET == btv->tuner_type)
2793 btv->tuner_type = bttv_tvcards[btv->c.type].tuner_type;
2794 if (UNSET != tuner[btv->c.nr])
2795 btv->tuner_type = tuner[btv->c.nr];
2796 printk("bttv%d: using tuner=%d\n",btv->c.nr,btv->tuner_type);
2797 if (btv->pinnacle_id != UNSET)
2798 bttv_call_i2c_clients(btv,AUDC_CONFIG_PINNACLE,
2799 &btv->pinnacle_id);
2800 if (btv->tuner_type != UNSET)
2801 bttv_call_i2c_clients(btv,TUNER_SET_TYPE,&btv->tuner_type);
2802 btv->svhs = bttv_tvcards[btv->c.type].svhs;
2803 if (svhs[btv->c.nr] != UNSET)
2804 btv->svhs = svhs[btv->c.nr];
2805 if (remote[btv->c.nr] != UNSET)
2806 btv->has_remote = remote[btv->c.nr];
2807
2808 if (bttv_tvcards[btv->c.type].has_radio)
2809 btv->has_radio=1;
2810 if (bttv_tvcards[btv->c.type].has_remote)
2811 btv->has_remote=1;
2812 if (bttv_tvcards[btv->c.type].no_gpioirq)
2813 btv->gpioirq=0;
2814 if (bttv_tvcards[btv->c.type].audio_hook)
2815 btv->audio_hook=bttv_tvcards[btv->c.type].audio_hook;
2816
2817 if (bttv_tvcards[btv->c.type].digital_mode == DIGITAL_MODE_CAMERA) {
2818 /* detect Bt832 chip for quartzsight digital camera */
2819 if ((bttv_I2CRead(btv, I2C_BT832_ALT1, "Bt832") >=0) ||
2820 (bttv_I2CRead(btv, I2C_BT832_ALT2, "Bt832") >=0))
2821 boot_bt832(btv);
2822 }
2823
2824 if (!autoload)
2825 return;
2826
2827 /* try to detect audio/fader chips */
2828 if (!bttv_tvcards[btv->c.type].no_msp34xx &&
2829 bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx") >=0)
2830 request_module("msp3400");
2831
2832 if (bttv_tvcards[btv->c.type].msp34xx_alt &&
2833 bttv_I2CRead(btv, I2C_MSP3400_ALT, "MSP34xx (alternate address)") >=0)
2834 request_module("msp3400");
2835
2836 if (!bttv_tvcards[btv->c.type].no_tda9875 &&
2837 bttv_I2CRead(btv, I2C_TDA9875, "TDA9875") >=0)
2838 request_module("tda9875");
2839
2840 if (!bttv_tvcards[btv->c.type].no_tda7432 &&
2841 bttv_I2CRead(btv, I2C_TDA7432, "TDA7432") >=0)
2842 request_module("tda7432");
2843
2844 if (bttv_tvcards[btv->c.type].needs_tvaudio)
2845 request_module("tvaudio");
2846
2847 /* tuner modules */
2848 tda9887 = 0;
2849 if (btv->pinnacle_id != UNSET)
2850 tda9887 = 1;
2851 if (0 == tda9887 && 0 == bttv_tvcards[btv->c.type].has_dvb &&
2852 bttv_I2CRead(btv, I2C_TDA9887, "TDA9887") >=0)
2853 tda9887 = 1;
2854 if((btv->tuner_type == TUNER_PHILIPS_FM1216ME_MK3) ||
2855 (btv->tuner_type == TUNER_PHILIPS_FM1236_MK3) ||
2856 (btv->tuner_type == TUNER_PHILIPS_FM1256_IH3) ||
2857 tda9887)
2858 request_module("tda9887");
2859 if (btv->tuner_type != UNSET)
2860 request_module("tuner");
2861}
2862
2863
2864/* ----------------------------------------------------------------------- */
2865
2866static void modtec_eeprom(struct bttv *btv)
2867{
2868 if( strncmp(&(eeprom_data[0x1e]),"Temic 4066 FY5",14) ==0) {
2869 btv->tuner_type=TUNER_TEMIC_4066FY5_PAL_I;
2870 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
2871 btv->c.nr,&eeprom_data[0x1e]);
2872 } else if (strncmp(&(eeprom_data[0x1e]),"Alps TSBB5",10) ==0) {
2873 btv->tuner_type=TUNER_ALPS_TSBB5_PAL_I;
2874 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
2875 btv->c.nr,&eeprom_data[0x1e]);
2876 } else if (strncmp(&(eeprom_data[0x1e]),"Philips FM1246",14) ==0) {
2877 btv->tuner_type=TUNER_PHILIPS_NTSC;
2878 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
2879 btv->c.nr,&eeprom_data[0x1e]);
2880 } else {
2881 printk("bttv%d: Modtec: Unknown TunerString: %s\n",
2882 btv->c.nr,&eeprom_data[0x1e]);
2883 }
2884}
2885
2886static void __devinit hauppauge_eeprom(struct bttv *btv)
2887{
2888 struct tveeprom tv;
2889
2890 tveeprom_hauppauge_analog(&tv, eeprom_data);
2891 btv->tuner_type = tv.tuner_type;
2892 btv->has_radio = tv.has_radio;
2893}
2894
2895static int terratec_active_radio_upgrade(struct bttv *btv)
2896{
2897 int freq;
2898
2899 btv->has_radio = 1;
2900 btv->has_matchbox = 1;
2901 btv->mbox_we = 0x10;
2902 btv->mbox_most = 0x20;
2903 btv->mbox_clk = 0x08;
2904 btv->mbox_data = 0x04;
2905 btv->mbox_mask = 0x3c;
2906
2907 btv->mbox_iow = 1 << 8;
2908 btv->mbox_ior = 1 << 9;
2909 btv->mbox_csel = 1 << 10;
2910
2911 freq=88000/62.5;
2912 tea5757_write(btv, 5 * freq + 0x358); // write 0x1ed8
2913 if (0x1ed8 == tea5757_read(btv)) {
2914 printk("bttv%d: Terratec Active Radio Upgrade found.\n",
2915 btv->c.nr);
2916 btv->has_radio = 1;
2917 btv->has_matchbox = 1;
2918 } else {
2919 btv->has_radio = 0;
2920 btv->has_matchbox = 0;
2921 }
2922 return 0;
2923}
2924
2925
2926/* ----------------------------------------------------------------------- */
2927
2928/*
2929 * minimal bootstrap for the WinTV/PVR -- upload altera firmware.
2930 *
2931 * The hcwamc.rbf firmware file is on the Hauppauge driver CD. Have
2932 * a look at Pvr/pvr45xxx.EXE (self-extracting zip archive, can be
2933 * unpacked with unzip).
2934 */
2935#define PVR_GPIO_DELAY 10
2936
2937#define BTTV_ALT_DATA 0x000001
2938#define BTTV_ALT_DCLK 0x100000
2939#define BTTV_ALT_NCONFIG 0x800000
2940
2941static int __devinit pvr_altera_load(struct bttv *btv, u8 *micro, u32 microlen)
2942{
2943 u32 n;
2944 u8 bits;
2945 int i;
2946
2947 gpio_inout(0xffffff,BTTV_ALT_DATA|BTTV_ALT_DCLK|BTTV_ALT_NCONFIG);
2948 gpio_write(0);
2949 udelay(PVR_GPIO_DELAY);
2950
2951 gpio_write(BTTV_ALT_NCONFIG);
2952 udelay(PVR_GPIO_DELAY);
2953
2954 for (n = 0; n < microlen; n++) {
2955 bits = micro[n];
2956 for ( i = 0 ; i < 8 ; i++ ) {
2957 gpio_bits(BTTV_ALT_DCLK,0);
2958 if (bits & 0x01)
2959 gpio_bits(BTTV_ALT_DATA,BTTV_ALT_DATA);
2960 else
2961 gpio_bits(BTTV_ALT_DATA,0);
2962 gpio_bits(BTTV_ALT_DCLK,BTTV_ALT_DCLK);
2963 bits >>= 1;
2964 }
2965 }
2966 gpio_bits(BTTV_ALT_DCLK,0);
2967 udelay(PVR_GPIO_DELAY);
2968
2969 /* begin Altera init loop (Not necessary,but doesn't hurt) */
2970 for (i = 0 ; i < 30 ; i++) {
2971 gpio_bits(BTTV_ALT_DCLK,0);
2972 gpio_bits(BTTV_ALT_DCLK,BTTV_ALT_DCLK);
2973 }
2974 gpio_bits(BTTV_ALT_DCLK,0);
2975 return 0;
2976}
2977
2978static int __devinit pvr_boot(struct bttv *btv)
2979{
2980 const struct firmware *fw_entry;
2981 int rc;
2982
2983 rc = request_firmware(&fw_entry, "hcwamc.rbf", &btv->c.pci->dev);
2984 if (rc != 0) {
2985 printk(KERN_WARNING "bttv%d: no altera firmware [via hotplug]\n",
2986 btv->c.nr);
2987 return rc;
2988 }
2989 rc = pvr_altera_load(btv, fw_entry->data, fw_entry->size);
2990 printk(KERN_INFO "bttv%d: altera firmware upload %s\n",
2991 btv->c.nr, (rc < 0) ? "failed" : "ok");
2992 release_firmware(fw_entry);
2993 return rc;
2994}
2995
2996/* ----------------------------------------------------------------------- */
2997/* some osprey specific stuff */
2998
2999static void __devinit osprey_eeprom(struct bttv *btv)
3000{
3001 int i = 0;
3002 unsigned char *ee = eeprom_data;
3003 unsigned long serial = 0;
3004
3005 if (btv->c.type == 0) {
3006 /* this might be an antique... check for MMAC label in eeprom */
3007 if ((ee[0]=='M') && (ee[1]=='M') && (ee[2]=='A') && (ee[3]=='C')) {
3008 unsigned char checksum = 0;
3009 for (i =0; i<21; i++)
3010 checksum += ee[i];
3011 if (checksum != ee[21])
3012 return;
3013 btv->c.type = BTTV_OSPREY1x0_848;
3014 for (i = 12; i < 21; i++)
3015 serial *= 10, serial += ee[i] - '0';
3016 }
3017 } else {
3018 unsigned short type;
3019 int offset = 4*16;
3020
3021 for(; offset < 8*16; offset += 16) {
3022 unsigned short checksum = 0;
3023 /* verify the checksum */
3024 for(i = 0; i<14; i++) checksum += ee[i+offset];
3025 checksum = ~checksum; /* no idea why */
3026 if ((((checksum>>8)&0x0FF) == ee[offset+14]) &&
3027 ((checksum & 0x0FF) == ee[offset+15])) {
3028 break;
3029 }
3030 }
3031
3032 if (offset >= 8*16)
3033 return;
3034
3035 /* found a valid descriptor */
3036 type = (ee[offset+4]<<8) | (ee[offset+5]);
3037
3038 switch(type) {
3039
3040 /* 848 based */
3041 case 0x0004:
3042 btv->c.type = BTTV_OSPREY1x0_848;
3043 break;
3044 case 0x0005:
3045 btv->c.type = BTTV_OSPREY101_848;
3046 break;
3047
3048 /* 878 based */
3049 case 0x0012:
3050 case 0x0013:
3051 btv->c.type = BTTV_OSPREY1x0;
3052 break;
3053 case 0x0014:
3054 case 0x0015:
3055 btv->c.type = BTTV_OSPREY1x1;
3056 break;
3057 case 0x0016:
3058 case 0x0017:
3059 case 0x0020:
3060 btv->c.type = BTTV_OSPREY1x1_SVID;
3061 break;
3062 case 0x0018:
3063 case 0x0019:
3064 case 0x001E:
3065 case 0x001F:
3066 btv->c.type = BTTV_OSPREY2xx;
3067 break;
3068 case 0x001A:
3069 case 0x001B:
3070 btv->c.type = BTTV_OSPREY2x0_SVID;
3071 break;
3072 case 0x0040:
3073 btv->c.type = BTTV_OSPREY500;
3074 break;
3075 case 0x0050:
3076 case 0x0056:
3077 btv->c.type = BTTV_OSPREY540;
3078 /* bttv_osprey_540_init(btv); */
3079 break;
3080 case 0x0060:
3081 case 0x0070:
3082 btv->c.type = BTTV_OSPREY2x0;
3083 //enable output on select control lines
3084 gpio_inout(0xffffff,0x000303);
3085 break;
3086 default:
3087 /* unknown...leave generic, but get serial # */
3088 break;
3089 }
3090 serial = (ee[offset+6] << 24)
3091 | (ee[offset+7] << 16)
3092 | (ee[offset+8] << 8)
3093 | (ee[offset+9]);
3094 }
3095
3096 printk(KERN_INFO "bttv%d: osprey eeprom: card=%d name=%s serial=%ld\n",
3097 btv->c.nr, btv->c.type, bttv_tvcards[btv->c.type].name,serial);
3098}
3099
3100/* ----------------------------------------------------------------------- */
3101/* AVermedia specific stuff, from bktr_card.c */
3102
3103static int tuner_0_table[] = {
3104 TUNER_PHILIPS_NTSC, TUNER_PHILIPS_PAL /* PAL-BG*/,
3105 TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL /* PAL-I*/,
3106 TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL,
3107 TUNER_PHILIPS_SECAM, TUNER_PHILIPS_SECAM,
3108 TUNER_PHILIPS_SECAM, TUNER_PHILIPS_PAL,
3109 TUNER_PHILIPS_FM1216ME_MK3 };
3110#if 0
3111int tuner_0_fm_table[] = {
3112 PHILIPS_FR1236_NTSC, PHILIPS_FR1216_PAL,
3113 PHILIPS_FR1216_PAL, PHILIPS_FR1216_PAL,
3114 PHILIPS_FR1216_PAL, PHILIPS_FR1216_PAL,
3115 PHILIPS_FR1236_SECAM, PHILIPS_FR1236_SECAM,
3116 PHILIPS_FR1236_SECAM, PHILIPS_FR1216_PAL};
3117#endif
3118
3119static int tuner_1_table[] = {
3120 TUNER_TEMIC_NTSC, TUNER_TEMIC_PAL,
3121 TUNER_TEMIC_PAL, TUNER_TEMIC_PAL,
3122 TUNER_TEMIC_PAL, TUNER_TEMIC_PAL,
3123 TUNER_TEMIC_4012FY5, TUNER_TEMIC_4012FY5, //TUNER_TEMIC_SECAM
3124 TUNER_TEMIC_4012FY5, TUNER_TEMIC_PAL};
3125
3126static void __devinit avermedia_eeprom(struct bttv *btv)
3127{
3128 int tuner_make,tuner_tv_fm,tuner_format,tuner=0;
3129
3130 tuner_make = (eeprom_data[0x41] & 0x7);
3131 tuner_tv_fm = (eeprom_data[0x41] & 0x18) >> 3;
3132 tuner_format = (eeprom_data[0x42] & 0xf0) >> 4;
3133 btv->has_remote = (eeprom_data[0x42] & 0x01);
3134
3135 if (tuner_make == 0 || tuner_make == 2)
3136 if(tuner_format <=0x0a)
3137 tuner = tuner_0_table[tuner_format];
3138 if (tuner_make == 1)
3139 if(tuner_format <=9)
3140 tuner = tuner_1_table[tuner_format];
3141
3142 if (tuner_make == 4)
3143 if(tuner_format == 0x09)
3144 tuner = TUNER_LG_NTSC_NEW_TAPC; // TAPC-G702P
3145
3146 printk(KERN_INFO "bttv%d: Avermedia eeprom[0x%02x%02x]: tuner=",
3147 btv->c.nr,eeprom_data[0x41],eeprom_data[0x42]);
3148 if(tuner) {
3149 btv->tuner_type=tuner;
3150 printk("%d",tuner);
3151 } else
3152 printk("Unknown type");
3153 printk(" radio:%s remote control:%s\n",
3154 tuner_tv_fm ? "yes" : "no",
3155 btv->has_remote ? "yes" : "no");
3156}
3157
3158/* used on Voodoo TV/FM (Voodoo 200), S0 wired to 0x10000 */
3159void bttv_tda9880_setnorm(struct bttv *btv, int norm)
3160{
3161 // fix up our card entry
3162 if(norm==VIDEO_MODE_NTSC) {
3163 bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[0]=0x957fff;
3164 bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[4]=0x957fff;
3165 dprintk("bttv_tda9880_setnorm to NTSC\n");
3166 }
3167 else {
3168 bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[0]=0x947fff;
3169 bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[4]=0x947fff;
3170 dprintk("bttv_tda9880_setnorm to PAL\n");
3171 }
3172 // set GPIO according
3173 gpio_bits(bttv_tvcards[btv->c.type].gpiomask,
3174 bttv_tvcards[btv->c.type].audiomux[btv->audio]);
3175}
3176
3177
3178/*
3179 * reset/enable the MSP on some Hauppauge cards
3180 * Thanks to Kyösti Mälkki (kmalkki@cc.hut.fi)!
3181 *
3182 * Hauppauge: pin 5
3183 * Voodoo: pin 20
3184 */
3185static void __devinit boot_msp34xx(struct bttv *btv, int pin)
3186{
3187 int mask = (1 << pin);
3188
3189 gpio_inout(mask,mask);
3190 gpio_bits(mask,0);
3191 udelay(2500);
3192 gpio_bits(mask,mask);
3193
3194 if (bttv_gpio)
3195 bttv_gpio_tracking(btv,"msp34xx");
3196 if (bttv_verbose)
3197 printk(KERN_INFO "bttv%d: Hauppauge/Voodoo msp34xx: reset line "
3198 "init [%d]\n", btv->c.nr, pin);
3199}
3200
3201static void __devinit boot_bt832(struct bttv *btv)
3202{
3203#if 0 /* not working yet */
3204 int resetbit=0;
3205
3206 switch (btv->c.type) {
3207 case BTTV_PXELVWPLTVPAK:
3208 resetbit = 0x400000;
3209 break;
3210 case BTTV_MODTEC_205:
3211 resetbit = 1<<9;
3212 break;
3213 default:
3214 BUG();
3215 }
3216
3217 request_module("bt832");
3218 bttv_call_i2c_clients(btv, BT832_HEXDUMP, NULL);
3219
3220 printk("bttv%d: Reset Bt832 [line=0x%x]\n",btv->c.nr,resetbit);
3221 gpio_write(0);
3222 gpio_inout(resetbit, resetbit);
3223 udelay(5);
3224 gpio_bits(resetbit, resetbit);
3225 udelay(5);
3226 gpio_bits(resetbit, 0);
3227 udelay(5);
3228
3229 // bt832 on pixelview changes from i2c 0x8a to 0x88 after
3230 // being reset as above. So we must follow by this:
3231 bttv_call_i2c_clients(btv, BT832_REATTACH, NULL);
3232#endif
3233}
3234
3235/* ----------------------------------------------------------------------- */
3236/* Imagenation L-Model PXC200 Framegrabber */
3237/* This is basically the same procedure as
3238 * used by Alessandro Rubini in his pxc200
3239 * driver, but using BTTV functions */
3240
3241static void __devinit init_PXC200(struct bttv *btv)
3242{
3243 static int vals[] __devinitdata = { 0x08, 0x09, 0x0a, 0x0b, 0x0d, 0x0d,
3244 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
3245 0x00 };
3246 unsigned int i;
3247 int tmp;
3248 u32 val;
3249
3250 /* Initialise GPIO-connevted stuff */
3251 gpio_inout(0xffffff, (1<<13));
3252 gpio_write(0);
3253 udelay(3);
3254 gpio_write(1<<13);
3255 /* GPIO inputs are pulled up, so no need to drive
3256 * reset pin any longer */
3257 gpio_bits(0xffffff, 0);
3258 if (bttv_gpio)
3259 bttv_gpio_tracking(btv,"pxc200");
3260
3261 /* we could/should try and reset/control the AD pots? but
3262 right now we simply turned off the crushing. Without
3263 this the AGC drifts drifts
3264 remember the EN is reverse logic -->
3265 setting BT848_ADC_AGC_EN disable the AGC
3266 tboult@eecs.lehigh.edu
3267 */
3268
3269 btwrite(BT848_ADC_RESERVED|BT848_ADC_AGC_EN, BT848_ADC);
3270
3271 /* Initialise MAX517 DAC */
3272 printk(KERN_INFO "Setting DAC reference voltage level ...\n");
3273 bttv_I2CWrite(btv,0x5E,0,0x80,1);
3274
3275 /* Initialise 12C508 PIC */
3276 /* The I2CWrite and I2CRead commmands are actually to the
3277 * same chips - but the R/W bit is included in the address
3278 * argument so the numbers are different */
3279
3280
3281 printk(KERN_INFO "Initialising 12C508 PIC chip ...\n");
3282
3283 /* First of all, enable the clock line. This is used in the PXC200-F */
3284 val = btread(BT848_GPIO_DMA_CTL);
3285 val |= BT848_GPIO_DMA_CTL_GPCLKMODE;
3286 btwrite(val, BT848_GPIO_DMA_CTL);
3287
3288 /* Then, push to 0 the reset pin long enough to reset the *
3289 * device same as above for the reset line, but not the same
3290 * value sent to the GPIO-connected stuff
3291 * which one is the good one? */
3292 gpio_inout(0xffffff,(1<<2));
3293 gpio_write(0);
3294 udelay(10);
3295 gpio_write(1<<2);
3296
3297 for (i = 0; i < ARRAY_SIZE(vals); i++) {
3298 tmp=bttv_I2CWrite(btv,0x1E,0,vals[i],1);
3299 if (tmp != -1) {
3300 printk(KERN_INFO
3301 "I2C Write(%2.2x) = %i\nI2C Read () = %2.2x\n\n",
3302 vals[i],tmp,bttv_I2CRead(btv,0x1F,NULL));
3303 }
3304 }
3305
3306 printk(KERN_INFO "PXC200 Initialised.\n");
3307}
3308
3309
3310/* ----------------------------------------------------------------------- */
3311/* Miro Pro radio stuff -- the tea5757 is connected to some GPIO ports */
3312/*
3313 * Copyright (c) 1999 Csaba Halasz <qgehali@uni-miskolc.hu>
3314 * This code is placed under the terms of the GNU General Public License
3315 *
3316 * Brutally hacked by Dan Sheridan <dan.sheridan@contact.org.uk> djs52 8/3/00
3317 */
3318
3319static void bus_low(struct bttv *btv, int bit)
3320{
3321 if (btv->mbox_ior) {
3322 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3323 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3324 udelay(5);
3325 }
3326
3327 gpio_bits(bit,0);
3328 udelay(5);
3329
3330 if (btv->mbox_ior) {
3331 gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
3332 udelay(5);
3333 }
3334}
3335
3336static void bus_high(struct bttv *btv, int bit)
3337{
3338 if (btv->mbox_ior) {
3339 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3340 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3341 udelay(5);
3342 }
3343
3344 gpio_bits(bit,bit);
3345 udelay(5);
3346
3347 if (btv->mbox_ior) {
3348 gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
3349 udelay(5);
3350 }
3351}
3352
3353static int bus_in(struct bttv *btv, int bit)
3354{
3355 if (btv->mbox_ior) {
3356 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3357 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3358 udelay(5);
3359
3360 gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
3361 udelay(5);
3362 }
3363 return gpio_read() & (bit);
3364}
3365
3366/* TEA5757 register bits */
3367#define TEA_FREQ 0:14
3368#define TEA_BUFFER 15:15
3369
3370#define TEA_SIGNAL_STRENGTH 16:17
3371
3372#define TEA_PORT1 18:18
3373#define TEA_PORT0 19:19
3374
3375#define TEA_BAND 20:21
3376#define TEA_BAND_FM 0
3377#define TEA_BAND_MW 1
3378#define TEA_BAND_LW 2
3379#define TEA_BAND_SW 3
3380
3381#define TEA_MONO 22:22
3382#define TEA_ALLOW_STEREO 0
3383#define TEA_FORCE_MONO 1
3384
3385#define TEA_SEARCH_DIRECTION 23:23
3386#define TEA_SEARCH_DOWN 0
3387#define TEA_SEARCH_UP 1
3388
3389#define TEA_STATUS 24:24
3390#define TEA_STATUS_TUNED 0
3391#define TEA_STATUS_SEARCHING 1
3392
3393/* Low-level stuff */
3394static int tea5757_read(struct bttv *btv)
3395{
3396 unsigned long timeout;
3397 int value = 0;
3398 int i;
3399
3400 /* better safe than sorry */
3401 gpio_inout(btv->mbox_mask, btv->mbox_clk | btv->mbox_we);
3402
3403 if (btv->mbox_ior) {
3404 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3405 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3406 udelay(5);
3407 }
3408
3409 if (bttv_gpio)
3410 bttv_gpio_tracking(btv,"tea5757 read");
3411
3412 bus_low(btv,btv->mbox_we);
3413 bus_low(btv,btv->mbox_clk);
3414
3415 udelay(10);
3416 timeout= jiffies + HZ;
3417
3418 // wait for DATA line to go low; error if it doesn't
3419 while (bus_in(btv,btv->mbox_data) && time_before(jiffies, timeout))
3420 schedule();
3421 if (bus_in(btv,btv->mbox_data)) {
3422 printk(KERN_WARNING "bttv%d: tea5757: read timeout\n",btv->c.nr);
3423 return -1;
3424 }
3425
3426 dprintk("bttv%d: tea5757:",btv->c.nr);
3427 for(i = 0; i < 24; i++)
3428 {
3429 udelay(5);
3430 bus_high(btv,btv->mbox_clk);
3431 udelay(5);
3432 dprintk("%c",(bus_in(btv,btv->mbox_most) == 0)?'T':'-');
3433 bus_low(btv,btv->mbox_clk);
3434 value <<= 1;
3435 value |= (bus_in(btv,btv->mbox_data) == 0)?0:1; /* MSB first */
3436 dprintk("%c", (bus_in(btv,btv->mbox_most) == 0)?'S':'M');
3437 }
3438 dprintk("\nbttv%d: tea5757: read 0x%X\n", btv->c.nr, value);
3439 return value;
3440}
3441
3442static int tea5757_write(struct bttv *btv, int value)
3443{
3444 int i;
3445 int reg = value;
3446
3447 gpio_inout(btv->mbox_mask, btv->mbox_clk | btv->mbox_we | btv->mbox_data);
3448
3449 if (btv->mbox_ior) {
3450 gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
3451 btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
3452 udelay(5);
3453 }
3454 if (bttv_gpio)
3455 bttv_gpio_tracking(btv,"tea5757 write");
3456
3457 dprintk("bttv%d: tea5757: write 0x%X\n", btv->c.nr, value);
3458 bus_low(btv,btv->mbox_clk);
3459 bus_high(btv,btv->mbox_we);
3460 for(i = 0; i < 25; i++)
3461 {
3462 if (reg & 0x1000000)
3463 bus_high(btv,btv->mbox_data);
3464 else
3465 bus_low(btv,btv->mbox_data);
3466 reg <<= 1;
3467 bus_high(btv,btv->mbox_clk);
3468 udelay(10);
3469 bus_low(btv,btv->mbox_clk);
3470 udelay(10);
3471 }
3472 bus_low(btv,btv->mbox_we); /* unmute !!! */
3473 return 0;
3474}
3475
3476void tea5757_set_freq(struct bttv *btv, unsigned short freq)
3477{
3478 dprintk("tea5757_set_freq %d\n",freq);
3479 tea5757_write(btv, 5 * freq + 0x358); /* add 10.7MHz (see docs) */
3480#if 0
3481 /* breaks Miro PCTV */
3482 value = tea5757_read(btv);
3483 dprintk("bttv%d: tea5757 readback=0x%x\n",btv->c.nr,value);
3484#endif
3485}
3486
3487
3488/* ----------------------------------------------------------------------- */
3489/* winview */
3490
3491void winview_audio(struct bttv *btv, struct video_audio *v, int set)
3492{
3493 /* PT2254A programming Jon Tombs, jon@gte.esi.us.es */
3494 int bits_out, loops, vol, data;
3495
3496 if (!set) {
3497 /* Fixed by Leandro Lucarella <luca@linuxmendoza.org.ar (07/31/01) */
3498 v->flags |= VIDEO_AUDIO_VOLUME;
3499 return;
3500 }
3501
3502 /* 32 levels logarithmic */
3503 vol = 32 - ((v->volume>>11));
3504 /* units */
3505 bits_out = (PT2254_DBS_IN_2>>(vol%5));
3506 /* tens */
3507 bits_out |= (PT2254_DBS_IN_10>>(vol/5));
3508 bits_out |= PT2254_L_CHANNEL | PT2254_R_CHANNEL;
3509 data = gpio_read();
3510 data &= ~(WINVIEW_PT2254_CLK| WINVIEW_PT2254_DATA|
3511 WINVIEW_PT2254_STROBE);
3512 for (loops = 17; loops >= 0 ; loops--) {
3513 if (bits_out & (1<<loops))
3514 data |= WINVIEW_PT2254_DATA;
3515 else
3516 data &= ~WINVIEW_PT2254_DATA;
3517 gpio_write(data);
3518 udelay(5);
3519 data |= WINVIEW_PT2254_CLK;
3520 gpio_write(data);
3521 udelay(5);
3522 data &= ~WINVIEW_PT2254_CLK;
3523 gpio_write(data);
3524 }
3525 data |= WINVIEW_PT2254_STROBE;
3526 data &= ~WINVIEW_PT2254_DATA;
3527 gpio_write(data);
3528 udelay(10);
3529 data &= ~WINVIEW_PT2254_STROBE;
3530 gpio_write(data);
3531}
3532
3533/* ----------------------------------------------------------------------- */
3534/* mono/stereo control for various cards (which don't use i2c chips but */
3535/* connect something to the GPIO pins */
3536
3537static void
3538gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set)
3539{
3540 unsigned int con = 0;
3541
3542 if (set) {
3543 gpio_inout(0x300, 0x300);
3544 if (v->mode & VIDEO_SOUND_LANG1)
3545 con = 0x000;
3546 if (v->mode & VIDEO_SOUND_LANG2)
3547 con = 0x300;
3548 if (v->mode & VIDEO_SOUND_STEREO)
3549 con = 0x200;
3550// if (v->mode & VIDEO_SOUND_MONO)
3551// con = 0x100;
3552 gpio_bits(0x300, con);
3553 } else {
3554 v->mode = VIDEO_SOUND_STEREO |
3555 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3556 }
3557}
3558
3559static void
3560gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set)
3561{
3562 unsigned int val, con;
3563
3564#if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0)
3565 if (btv->radio_user)
3566 return;
3567#else
3568 if (btv->radio)
3569 return;
3570#endif
3571
3572 val = gpio_read();
3573 if (set) {
3574 con = 0x000;
3575 if (v->mode & VIDEO_SOUND_LANG2) {
3576 if (v->mode & VIDEO_SOUND_LANG1) {
3577 /* LANG1 + LANG2 */
3578 con = 0x100;
3579 }
3580 else {
3581 /* LANG2 */
3582 con = 0x300;
3583 }
3584 }
3585 if (con != (val & 0x300)) {
3586 gpio_bits(0x300, con);
3587 if (bttv_gpio)
3588 bttv_gpio_tracking(btv,"gvbctv5pci");
3589 }
3590 } else {
3591 switch (val & 0x70) {
3592 case 0x10:
3593 v->mode = VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3594 break;
3595 case 0x30:
3596 v->mode = VIDEO_SOUND_LANG2;
3597 break;
3598 case 0x50:
3599 v->mode = VIDEO_SOUND_LANG1;
3600 break;
3601 case 0x60:
3602 v->mode = VIDEO_SOUND_STEREO;
3603 break;
3604 case 0x70:
3605 v->mode = VIDEO_SOUND_MONO;
3606 break;
3607 default:
3608 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3609 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3610 }
3611 }
3612}
3613
3614/*
3615 * Mario Medina Nussbaum <medisoft@alohabbs.org.mx>
3616 * I discover that on BT848_GPIO_DATA address a byte 0xcce enable stereo,
3617 * 0xdde enables mono and 0xccd enables sap
3618 *
3619 * Petr Vandrovec <VANDROVE@vc.cvut.cz>
3620 * P.S.: At least mask in line above is wrong - GPIO pins 3,2 select
3621 * input/output sound connection, so both must be set for output mode.
3622 *
3623 * Looks like it's needed only for the "tvphone", the "tvphone 98"
3624 * handles this with a tda9840
3625 *
3626 */
3627static void
3628avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, int set)
3629{
3630 int val = 0;
3631
3632 if (set) {
3633 if (v->mode & VIDEO_SOUND_LANG2) /* SAP */
3634 val = 0x02;
3635 if (v->mode & VIDEO_SOUND_STEREO)
3636 val = 0x01;
3637 if (val) {
3638 gpio_bits(0x03,val);
3639 if (bttv_gpio)
3640 bttv_gpio_tracking(btv,"avermedia");
3641 }
3642 } else {
3643 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3644 VIDEO_SOUND_LANG1;
3645 return;
3646 }
3647}
3648
3649static void
3650avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v, int set)
3651{
3652 int val = 0;
3653
3654 if (set) {
3655 if (v->mode & VIDEO_SOUND_LANG2) /* SAP */
3656 val = 0x01;
3657 if (v->mode & VIDEO_SOUND_STEREO) /* STEREO */
3658 val = 0x02;
3659 btaor(val, ~0x03, BT848_GPIO_DATA);
3660 if (bttv_gpio)
3661 bttv_gpio_tracking(btv,"avermedia");
3662 } else {
3663 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3664 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3665 return;
3666 }
3667}
3668
3669/* Lifetec 9415 handling */
3670static void
3671lt9415_audio(struct bttv *btv, struct video_audio *v, int set)
3672{
3673 int val = 0;
3674
3675 if (gpio_read() & 0x4000) {
3676 v->mode = VIDEO_SOUND_MONO;
3677 return;
3678 }
3679
3680 if (set) {
3681 if (v->mode & VIDEO_SOUND_LANG2) /* A2 SAP */
3682 val = 0x0080;
3683 if (v->mode & VIDEO_SOUND_STEREO) /* A2 stereo */
3684 val = 0x0880;
3685 if ((v->mode & VIDEO_SOUND_LANG1) ||
3686 (v->mode & VIDEO_SOUND_MONO))
3687 val = 0;
3688 gpio_bits(0x0880, val);
3689 if (bttv_gpio)
3690 bttv_gpio_tracking(btv,"lt9415");
3691 } else {
3692 /* autodetect doesn't work with this card :-( */
3693 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3694 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3695 return;
3696 }
3697}
3698
3699// TDA9821 on TerraTV+ Bt848, Bt878
3700static void
3701terratv_audio(struct bttv *btv, struct video_audio *v, int set)
3702{
3703 unsigned int con = 0;
3704
3705 if (set) {
3706 gpio_inout(0x180000,0x180000);
3707 if (v->mode & VIDEO_SOUND_LANG2)
3708 con = 0x080000;
3709 if (v->mode & VIDEO_SOUND_STEREO)
3710 con = 0x180000;
3711 gpio_bits(0x180000, con);
3712 if (bttv_gpio)
3713 bttv_gpio_tracking(btv,"terratv");
3714 } else {
3715 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3716 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3717 }
3718}
3719
3720static void
3721winfast2000_audio(struct bttv *btv, struct video_audio *v, int set)
3722{
3723 unsigned long val = 0;
3724
3725 if (set) {
3726 /*btor (0xc32000, BT848_GPIO_OUT_EN);*/
3727 if (v->mode & VIDEO_SOUND_MONO) /* Mono */
3728 val = 0x420000;
3729 if (v->mode & VIDEO_SOUND_LANG1) /* Mono */
3730 val = 0x420000;
3731 if (v->mode & VIDEO_SOUND_LANG2) /* SAP */
3732 val = 0x410000;
3733 if (v->mode & VIDEO_SOUND_STEREO) /* Stereo */
3734 val = 0x020000;
3735 if (val) {
3736 gpio_bits(0x430000, val);
3737 if (bttv_gpio)
3738 bttv_gpio_tracking(btv,"winfast2000");
3739 }
3740 } else {
3741 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3742 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3743 }
3744}
3745
3746/*
3747 * Dariusz Kowalewski <darekk@automex.pl>
3748 * sound control for Prolink PV-BT878P+9B (PixelView PlayTV Pro FM+NICAM
3749 * revision 9B has on-board TDA9874A sound decoder).
3750 *
3751 * Note: There are card variants without tda9874a. Forcing the "stereo sound route"
3752 * will mute this cards.
3753 */
3754static void
3755pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set)
3756{
3757 unsigned int val = 0;
3758
3759#if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0)
3760 if (btv->radio_user)
3761 return;
3762#else
3763 if (btv->radio)
3764 return;
3765#endif
3766
3767 if (set) {
3768 if (v->mode & VIDEO_SOUND_MONO) {
3769 val = 0x01;
3770 }
3771 if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2))
3772 || (v->mode & VIDEO_SOUND_STEREO)) {
3773 val = 0x02;
3774 }
3775 if (val) {
3776 gpio_bits(0x03,val);
3777 if (bttv_gpio)
3778 bttv_gpio_tracking(btv,"pvbt878p9b");
3779 }
3780 } else {
3781 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3782 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3783 }
3784}
3785
3786/*
3787 * Dariusz Kowalewski <darekk@automex.pl>
3788 * sound control for FlyVideo 2000S (with tda9874 decoder)
3789 * based on pvbt878p9b_audio() - this is not tested, please fix!!!
3790 */
3791static void
3792fv2000s_audio(struct bttv *btv, struct video_audio *v, int set)
3793{
3794 unsigned int val = 0xffff;
3795
3796#if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0)
3797 if (btv->radio_user)
3798 return;
3799#else
3800 if (btv->radio)
3801 return;
3802#endif
3803 if (set) {
3804 if (v->mode & VIDEO_SOUND_MONO) {
3805 val = 0x0000;
3806 }
3807 if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2))
3808 || (v->mode & VIDEO_SOUND_STEREO)) {
3809 val = 0x1080; //-dk-???: 0x0880, 0x0080, 0x1800 ...
3810 }
3811 if (val != 0xffff) {
3812 gpio_bits(0x1800, val);
3813 if (bttv_gpio)
3814 bttv_gpio_tracking(btv,"fv2000s");
3815 }
3816 } else {
3817 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3818 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3819 }
3820}
3821
3822/*
3823 * sound control for Canopus WinDVR PCI
3824 * Masaki Suzuki <masaki@btree.org>
3825 */
3826static void
3827windvr_audio(struct bttv *btv, struct video_audio *v, int set)
3828{
3829 unsigned long val = 0;
3830
3831 if (set) {
3832 if (v->mode & VIDEO_SOUND_MONO)
3833 val = 0x040000;
3834 if (v->mode & VIDEO_SOUND_LANG1)
3835 val = 0;
3836 if (v->mode & VIDEO_SOUND_LANG2)
3837 val = 0x100000;
3838 if (v->mode & VIDEO_SOUND_STEREO)
3839 val = 0;
3840 if (val) {
3841 gpio_bits(0x140000, val);
3842 if (bttv_gpio)
3843 bttv_gpio_tracking(btv,"windvr");
3844 }
3845 } else {
3846 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3847 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3848 }
3849}
3850
3851/*
3852 * sound control for AD-TVK503
3853 * Hiroshi Takekawa <sian@big.or.jp>
3854 */
3855static void
3856adtvk503_audio(struct bttv *btv, struct video_audio *v, int set)
3857{
3858 unsigned int con = 0xffffff;
3859
3860 //btaor(0x1e0000, ~0x1e0000, BT848_GPIO_OUT_EN);
3861
3862 if (set) {
3863 //btor(***, BT848_GPIO_OUT_EN);
3864 if (v->mode & VIDEO_SOUND_LANG1)
3865 con = 0x00000000;
3866 if (v->mode & VIDEO_SOUND_LANG2)
3867 con = 0x00180000;
3868 if (v->mode & VIDEO_SOUND_STEREO)
3869 con = 0x00000000;
3870 if (v->mode & VIDEO_SOUND_MONO)
3871 con = 0x00060000;
3872 if (con != 0xffffff) {
3873 gpio_bits(0x1e0000,con);
3874 if (bttv_gpio)
3875 bttv_gpio_tracking(btv, "adtvk503");
3876 }
3877 } else {
3878 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
3879 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
3880 }
3881}
3882
3883/* RemoteVision MX (rv605) muxsel helper [Miguel Freitas]
3884 *
3885 * This is needed because rv605 don't use a normal multiplex, but a crosspoint
3886 * switch instead (CD22M3494E). This IC can have multiple active connections
3887 * between Xn (input) and Yn (output) pins. We need to clear any existing
3888 * connection prior to establish a new one, pulsing the STROBE pin.
3889 *
3890 * The board hardwire Y0 (xpoint) to MUX1 and MUXOUT to Yin.
3891 * GPIO pins are wired as:
3892 * GPIO[0:3] - AX[0:3] (xpoint) - P1[0:3] (microcontroler)
3893 * GPIO[4:6] - AY[0:2] (xpoint) - P1[4:6] (microcontroler)
3894 * GPIO[7] - DATA (xpoint) - P1[7] (microcontroler)
3895 * GPIO[8] - - P3[5] (microcontroler)
3896 * GPIO[9] - RESET (xpoint) - P3[6] (microcontroler)
3897 * GPIO[10] - STROBE (xpoint) - P3[7] (microcontroler)
3898 * GPINTR - - P3[4] (microcontroler)
3899 *
3900 * The microcontroler is a 80C32 like. It should be possible to change xpoint
3901 * configuration either directly (as we are doing) or using the microcontroler
3902 * which is also wired to I2C interface. I have no further info on the
3903 * microcontroler features, one would need to disassembly the firmware.
3904 * note: the vendor refused to give any information on this product, all
3905 * that stuff was found using a multimeter! :)
3906 */
3907static void rv605_muxsel(struct bttv *btv, unsigned int input)
3908{
3909 /* reset all conections */
3910 gpio_bits(0x200,0x200);
3911 mdelay(1);
3912 gpio_bits(0x200,0x000);
3913 mdelay(1);
3914
3915 /* create a new conection */
3916 gpio_bits(0x480,0x080);
3917 gpio_bits(0x480,0x480);
3918 mdelay(1);
3919 gpio_bits(0x480,0x080);
3920 mdelay(1);
3921}
3922
3923/* Tibet Systems 'Progress DVR' CS16 muxsel helper [Chris Fanning]
3924 *
3925 * The CS16 (available on eBay cheap) is a PCI board with four Fusion
3926 * 878A chips, a PCI bridge, an Atmel microcontroller, four sync seperator
3927 * chips, ten eight input analog multiplexors, a not chip and a few
3928 * other components.
3929 *
3930 * 16 inputs on a secondary bracket are provided and can be selected
3931 * from each of the four capture chips. Two of the eight input
3932 * multiplexors are used to select from any of the 16 input signals.
3933 *
3934 * Unsupported hardware capabilities:
3935 * . A video output monitor on the secondary bracket can be selected from
3936 * one of the 878A chips.
3937 * . Another passthrough but I haven't spent any time investigating it.
3938 * . Digital I/O (logic level connected to GPIO) is available from an
3939 * onboard header.
3940 *
3941 * The on chip input mux should always be set to 2.
3942 * GPIO[16:19] - Video input selection
3943 * GPIO[0:3] - Video output monitor select (only available from one 878A)
3944 * GPIO[?:?] - Digital I/O.
3945 *
3946 * There is an ATMEL microcontroller with an 8031 core on board. I have not
3947 * determined what function (if any) it provides. With the microcontroller
3948 * and sync seperator chips a guess is that it might have to do with video
3949 * switching and maybe some digital I/O.
3950 */
3951static void tibetCS16_muxsel(struct bttv *btv, unsigned int input)
3952{
3953 /* video mux */
3954 gpio_bits(0x0f0000, input << 16);
3955}
3956
3957static void tibetCS16_init(struct bttv *btv)
3958{
3959 /* enable gpio bits, mask obtained via btSpy */
3960 gpio_inout(0xffffff, 0x0f7fff);
3961 gpio_write(0x0f7fff);
3962}
3963
3964/*
3965 * The following routines for the Kodicom-4400r get a little mind-twisting.
3966 * There is a "master" controller and three "slave" controllers, together
3967 * an analog switch which connects any of 16 cameras to any of the BT87A's.
3968 * The analog switch is controlled by the "master", but the detection order
3969 * of the four BT878A chips is in an order which I just don't understand.
3970 * The "master" is actually the second controller to be detected. The
3971 * logic on the board uses logical numbers for the 4 controlers, but
3972 * those numbers are different from the detection sequence. When working
3973 * with the analog switch, we need to "map" from the detection sequence
3974 * over to the board's logical controller number. This mapping sequence
3975 * is {3, 0, 2, 1}, i.e. the first controller to be detected is logical
3976 * unit 3, the second (which is the master) is logical unit 0, etc.
3977 * We need to maintain the status of the analog switch (which of the 16
3978 * cameras is connected to which of the 4 controllers). Rather than
3979 * add to the bttv structure for this, we use the data reserved for
3980 * the mbox (unused for this card type).
3981 */
3982
3983/*
3984 * First a routine to set the analog switch, which controls which camera
3985 * is routed to which controller. The switch comprises an X-address
3986 * (gpio bits 0-3, representing the camera, ranging from 0-15), and a
3987 * Y-address (gpio bits 4-6, representing the controller, ranging from 0-3).
3988 * A data value (gpio bit 7) of '1' enables the switch, and '0' disables
3989 * the switch. A STROBE bit (gpio bit 8) latches the data value into the
3990 * specified address. The idea is to set the address and data, then bring
3991 * STROBE high, and finally bring STROBE back to low.
3992 */
3993static void kodicom4400r_write(struct bttv *btv,
3994 unsigned char xaddr,
3995 unsigned char yaddr,
3996 unsigned char data) {
3997 unsigned int udata;
3998
3999 udata = (data << 7) | ((yaddr&3) << 4) | (xaddr&0xf);
4000 gpio_bits(0x1ff, udata); /* write ADDR and DAT */
4001 gpio_bits(0x1ff, udata | (1 << 8)); /* strobe high */
4002 gpio_bits(0x1ff, udata); /* strobe low */
4003}
4004
4005/*
4006 * Next the mux select. Both the "master" and "slave" 'cards' (controllers)
4007 * use this routine. The routine finds the "master" for the card, maps
4008 * the controller number from the detected position over to the logical
4009 * number, writes the appropriate data to the analog switch, and housekeeps
4010 * the local copy of the switch information. The parameter 'input' is the
4011 * requested camera number (0 - 15).
4012 */
4013static void kodicom4400r_muxsel(struct bttv *btv, unsigned int input)
4014{
4015 char *sw_status;
4016 int xaddr, yaddr;
4017 struct bttv *mctlr;
4018 static unsigned char map[4] = {3, 0, 2, 1};
4019
4020 mctlr = master[btv->c.nr];
4021 if (mctlr == NULL) { /* ignore if master not yet detected */
4022 return;
4023 }
4024 yaddr = (btv->c.nr - mctlr->c.nr + 1) & 3; /* the '&' is for safety */
4025 yaddr = map[yaddr];
4026 sw_status = (char *)(&mctlr->mbox_we);
4027 xaddr = input & 0xf;
4028 /* Check if the controller/camera pair has changed, else ignore */
4029 if (sw_status[yaddr] != xaddr)
4030 {
4031 /* "open" the old switch, "close" the new one, save the new */
4032 kodicom4400r_write(mctlr, sw_status[yaddr], yaddr, 0);
4033 sw_status[yaddr] = xaddr;
4034 kodicom4400r_write(mctlr, xaddr, yaddr, 1);
4035 }
4036}
4037
4038/*
4039 * During initialisation, we need to reset the analog switch. We
4040 * also preset the switch to map the 4 connectors on the card to the
4041 * *user's* (see above description of kodicom4400r_muxsel) channels
4042 * 0 through 3
4043 */
4044static void kodicom4400r_init(struct bttv *btv)
4045{
4046 char *sw_status = (char *)(&btv->mbox_we);
4047 int ix;
4048
4049 gpio_inout(0x0003ff, 0x0003ff);
4050 gpio_write(1 << 9); /* reset MUX */
4051 gpio_write(0);
4052 /* Preset camera 0 to the 4 controllers */
4053 for (ix=0; ix<4; ix++) {
4054 sw_status[ix] = ix;
4055 kodicom4400r_write(btv, ix, ix, 1);
4056 }
4057 /*
4058 * Since this is the "master", we need to set up the
4059 * other three controller chips' pointers to this structure
4060 * for later use in the muxsel routine.
4061 */
4062 if ((btv->c.nr<1) || (btv->c.nr>BTTV_MAX-3))
4063 return;
4064 master[btv->c.nr-1] = btv;
4065 master[btv->c.nr] = btv;
4066 master[btv->c.nr+1] = btv;
4067 master[btv->c.nr+2] = btv;
4068}
4069
4070// The Grandtec X-Guard framegrabber card uses two Dual 4-channel
4071// video multiplexers to provide up to 16 video inputs. These
4072// multiplexers are controlled by the lower 8 GPIO pins of the
4073// bt878. The multiplexers probably Pericom PI5V331Q or similar.
4074
4075// xxx0 is pin xxx of multiplexer U5,
4076// yyy1 is pin yyy of multiplexer U2
4077
4078#define ENA0 0x01
4079#define ENB0 0x02
4080#define ENA1 0x04
4081#define ENB1 0x08
4082
4083#define IN10 0x10
4084#define IN00 0x20
4085#define IN11 0x40
4086#define IN01 0x80
4087
4088static void xguard_muxsel(struct bttv *btv, unsigned int input)
4089{
4090 static const int masks[] = {
4091 ENB0, ENB0|IN00, ENB0|IN10, ENB0|IN00|IN10,
4092 ENA0, ENA0|IN00, ENA0|IN10, ENA0|IN00|IN10,
4093 ENB1, ENB1|IN01, ENB1|IN11, ENB1|IN01|IN11,
4094 ENA1, ENA1|IN01, ENA1|IN11, ENA1|IN01|IN11,
4095 };
4096 gpio_write(masks[input%16]);
4097}
4098static void picolo_tetra_init(struct bttv *btv)
4099{
4100 /*This is the video input redirection fonctionality : I DID NOT USED IT. */
4101 btwrite (0x08<<16,BT848_GPIO_DATA);/*GPIO[19] [==> 4053 B+C] set to 1 */
4102 btwrite (0x04<<16,BT848_GPIO_DATA);/*GPIO[18] [==> 4053 A] set to 1*/
4103}
4104static void picolo_tetra_muxsel (struct bttv* btv, unsigned int input)
4105{
4106
4107 dprintk (KERN_DEBUG "bttv%d : picolo_tetra_muxsel => input = %d\n",btv->c.nr,input);
4108 /*Just set the right path in the analog multiplexers : channel 1 -> 4 ==> Analog Mux ==> MUX0*/
4109 /*GPIO[20]&GPIO[21] used to choose the right input*/
4110 btwrite (input<<20,BT848_GPIO_DATA);
4111
4112}
4113
4114/*
4115 * ivc120_muxsel [Added by Alan Garfield <alan@fromorbit.com>]
4116 *
4117 * The IVC120G security card has 4 i2c controlled TDA8540 matrix
4118 * swichers to provide 16 channels to MUX0. The TDA8540's have
4119 * 4 indepedant outputs and as such the IVC120G also has the
4120 * optional "Monitor Out" bus. This allows the card to be looking
4121 * at one input while the monitor is looking at another.
4122 *
4123 * Since I've couldn't be bothered figuring out how to add an
4124 * independant muxsel for the monitor bus, I've just set it to
4125 * whatever the card is looking at.
4126 *
4127 * OUT0 of the TDA8540's is connected to MUX0 (0x03)
4128 * OUT1 of the TDA8540's is connected to "Monitor Out" (0x0C)
4129 *
4130 * TDA8540_ALT3 IN0-3 = Channel 13 - 16 (0x03)
4131 * TDA8540_ALT4 IN0-3 = Channel 1 - 4 (0x03)
4132 * TDA8540_ALT5 IN0-3 = Channel 5 - 8 (0x03)
4133 * TDA8540_ALT6 IN0-3 = Channel 9 - 12 (0x03)
4134 *
4135 */
4136
4137/* All 7 possible sub-ids for the TDA8540 Matrix Switcher */
4138#define I2C_TDA8540 0x90
4139#define I2C_TDA8540_ALT1 0x92
4140#define I2C_TDA8540_ALT2 0x94
4141#define I2C_TDA8540_ALT3 0x96
4142#define I2C_TDA8540_ALT4 0x98
4143#define I2C_TDA8540_ALT5 0x9a
4144#define I2C_TDA8540_ALT6 0x9c
4145
4146static void ivc120_muxsel(struct bttv *btv, unsigned int input)
4147{
4148 // Simple maths
4149 int key = input % 4;
4150 int matrix = input / 4;
4151
4152 dprintk("bttv%d: ivc120_muxsel: Input - %02d | TDA - %02d | In - %02d\n",
4153 btv->c.nr, input, matrix, key);
4154
4155 // Handles the input selection on the TDA8540's
4156 bttv_I2CWrite(btv, I2C_TDA8540_ALT3, 0x00,
4157 ((matrix == 3) ? (key | key << 2) : 0x00), 1);
4158 bttv_I2CWrite(btv, I2C_TDA8540_ALT4, 0x00,
4159 ((matrix == 0) ? (key | key << 2) : 0x00), 1);
4160 bttv_I2CWrite(btv, I2C_TDA8540_ALT5, 0x00,
4161 ((matrix == 1) ? (key | key << 2) : 0x00), 1);
4162 bttv_I2CWrite(btv, I2C_TDA8540_ALT6, 0x00,
4163 ((matrix == 2) ? (key | key << 2) : 0x00), 1);
4164
4165 // Handles the output enables on the TDA8540's
4166 bttv_I2CWrite(btv, I2C_TDA8540_ALT3, 0x02,
4167 ((matrix == 3) ? 0x03 : 0x00), 1); // 13 - 16
4168 bttv_I2CWrite(btv, I2C_TDA8540_ALT4, 0x02,
4169 ((matrix == 0) ? 0x03 : 0x00), 1); // 1-4
4170 bttv_I2CWrite(btv, I2C_TDA8540_ALT5, 0x02,
4171 ((matrix == 1) ? 0x03 : 0x00), 1); // 5-8
4172 bttv_I2CWrite(btv, I2C_TDA8540_ALT6, 0x02,
4173 ((matrix == 2) ? 0x03 : 0x00), 1); // 9-12
4174
4175 // Selects MUX0 for input on the 878
4176 btaor((0)<<5, ~(3<<5), BT848_IFORM);
4177}
4178
4179
4180/* PXC200 muxsel helper
4181 * luke@syseng.anu.edu.au
4182 * another transplant
4183 * from Alessandro Rubini (rubini@linux.it)
4184 *
4185 * There are 4 kinds of cards:
4186 * PXC200L which is bt848
4187 * PXC200F which is bt848 with PIC controlling mux
4188 * PXC200AL which is bt878
4189 * PXC200AF which is bt878 with PIC controlling mux
4190 */
4191#define PX_CFG_PXC200F 0x01
4192#define PX_FLAG_PXC200A 0x00001000 /* a pxc200A is bt-878 based */
4193#define PX_I2C_PIC 0x0f
4194#define PX_PXC200A_CARDID 0x200a1295
4195#define PX_I2C_CMD_CFG 0x00
4196
4197static void PXC200_muxsel(struct bttv *btv, unsigned int input)
4198{
4199 int rc;
4200 long mux;
4201 int bitmask;
4202 unsigned char buf[2];
4203
4204 /* Read PIC config to determine if this is a PXC200F */
4205 /* PX_I2C_CMD_CFG*/
4206 buf[0]=0;
4207 buf[1]=0;
4208 rc=bttv_I2CWrite(btv,(PX_I2C_PIC<<1),buf[0],buf[1],1);
4209 if (rc) {
4210 printk(KERN_DEBUG "bttv%d: PXC200_muxsel: pic cfg write failed:%d\n", btv->c.nr,rc);
4211 /* not PXC ? do nothing */
4212 return;
4213 }
4214
4215 rc=bttv_I2CRead(btv,(PX_I2C_PIC<<1),NULL);
4216 if (!(rc & PX_CFG_PXC200F)) {
4217 printk(KERN_DEBUG "bttv%d: PXC200_muxsel: not PXC200F rc:%d \n", btv->c.nr,rc);
4218 return;
4219 }
4220
4221
4222 /* The multiplexer in the 200F is handled by the GPIO port */
4223 /* get correct mapping between inputs */
4224 /* mux = bttv_tvcards[btv->type].muxsel[input] & 3; */
4225 /* ** not needed!? */
4226 mux = input;
4227
4228 /* make sure output pins are enabled */
4229 /* bitmask=0x30f; */
4230 bitmask=0x302;
4231 /* check whether we have a PXC200A */
4232 if (btv->cardid == PX_PXC200A_CARDID) {
4233 bitmask ^= 0x180; /* use 7 and 9, not 8 and 9 */
4234 bitmask |= 7<<4; /* the DAC */
4235 }
4236 btwrite(bitmask, BT848_GPIO_OUT_EN);
4237
4238 bitmask = btread(BT848_GPIO_DATA);
4239 if (btv->cardid == PX_PXC200A_CARDID)
4240 bitmask = (bitmask & ~0x280) | ((mux & 2) << 8) | ((mux & 1) << 7);
4241 else /* older device */
4242 bitmask = (bitmask & ~0x300) | ((mux & 3) << 8);
4243 btwrite(bitmask,BT848_GPIO_DATA);
4244
4245 /*
4246 * Was "to be safe, set the bt848 to input 0"
4247 * Actually, since it's ok at load time, better not messing
4248 * with these bits (on PXC200AF you need to set mux 2 here)
4249 *
4250 * needed because bttv-driver sets mux before calling this function
4251 */
4252 if (btv->cardid == PX_PXC200A_CARDID)
4253 btaor(2<<5, ~BT848_IFORM_MUXSEL, BT848_IFORM);
4254 else /* older device */
4255 btand(~BT848_IFORM_MUXSEL,BT848_IFORM);
4256
4257 printk(KERN_DEBUG "bttv%d: setting input channel to:%d\n", btv->c.nr,(int)mux);
4258}
4259
4260/* ----------------------------------------------------------------------- */
4261/* motherboard chipset specific stuff */
4262
4263void __devinit bttv_check_chipset(void)
4264{
4265 int pcipci_fail = 0;
4266 struct pci_dev *dev = NULL;
4267
4268 if (pci_pci_problems & PCIPCI_FAIL)
4269 pcipci_fail = 1;
4270 if (pci_pci_problems & (PCIPCI_TRITON|PCIPCI_NATOMA|PCIPCI_VIAETBF))
4271 triton1 = 1;
4272 if (pci_pci_problems & PCIPCI_VSFX)
4273 vsfx = 1;
4274#ifdef PCIPCI_ALIMAGIK
4275 if (pci_pci_problems & PCIPCI_ALIMAGIK)
4276 latency = 0x0A;
4277#endif
4278
4279#if 0
4280 /* print which chipset we have */
4281 while ((dev = pci_find_class(PCI_CLASS_BRIDGE_HOST << 8,dev)))
4282 printk(KERN_INFO "bttv: Host bridge is %s\n",pci_name(dev));
4283#endif
4284
4285 /* print warnings about any quirks found */
4286 if (triton1)
4287 printk(KERN_INFO "bttv: Host bridge needs ETBF enabled.\n");
4288 if (vsfx)
4289 printk(KERN_INFO "bttv: Host bridge needs VSFX enabled.\n");
4290 if (pcipci_fail) {
4291 printk(KERN_WARNING "bttv: BT848 and your chipset may not work together.\n");
4292 if (UNSET == no_overlay) {
4293 printk(KERN_WARNING "bttv: going to disable overlay.\n");
4294 no_overlay = 1;
4295 }
4296 }
4297 if (UNSET != latency)
4298 printk(KERN_INFO "bttv: pci latency fixup [%d]\n",latency);
4299
4300 while ((dev = pci_find_device(PCI_VENDOR_ID_INTEL,
4301 PCI_DEVICE_ID_INTEL_82441, dev))) {
4302 unsigned char b;
4303 pci_read_config_byte(dev, 0x53, &b);
4304 if (bttv_debug)
4305 printk(KERN_INFO "bttv: Host bridge: 82441FX Natoma, "
4306 "bufcon=0x%02x\n",b);
4307 }
4308}
4309
4310int __devinit bttv_handle_chipset(struct bttv *btv)
4311{
4312 unsigned char command;
4313
4314 if (!triton1 && !vsfx && UNSET == latency)
4315 return 0;
4316
4317 if (bttv_verbose) {
4318 if (triton1)
4319 printk(KERN_INFO "bttv%d: enabling ETBF (430FX/VP3 compatibilty)\n",btv->c.nr);
4320 if (vsfx && btv->id >= 878)
4321 printk(KERN_INFO "bttv%d: enabling VSFX\n",btv->c.nr);
4322 if (UNSET != latency)
4323 printk(KERN_INFO "bttv%d: setting pci timer to %d\n",
4324 btv->c.nr,latency);
4325 }
4326
4327 if (btv->id < 878) {
4328 /* bt848 (mis)uses a bit in the irq mask for etbf */
4329 if (triton1)
4330 btv->triton1 = BT848_INT_ETBF;
4331 } else {
4332 /* bt878 has a bit in the pci config space for it */
4333 pci_read_config_byte(btv->c.pci, BT878_DEVCTRL, &command);
4334 if (triton1)
4335 command |= BT878_EN_TBFX;
4336 if (vsfx)
4337 command |= BT878_EN_VSFX;
4338 pci_write_config_byte(btv->c.pci, BT878_DEVCTRL, command);
4339 }
4340 if (UNSET != latency)
4341 pci_write_config_byte(btv->c.pci, PCI_LATENCY_TIMER, latency);
4342 return 0;
4343}
4344
4345
4346/*
4347 * Local variables:
4348 * c-basic-offset: 8
4349 * End:
4350 */