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