Subversion Repositories shark

Rev

Rev 180 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
170 giacomo 1
/*
2
    bttv-cards.c
3
 
4
    this file has configuration informations - card-specific stuff
5
    like the big tvcards array for the most part
6
 
7
    Copyright (C) 1996,97,98 Ralph  Metzler (rjkm@thp.uni-koeln.de)
8
                           & Marcus Metzler (mocm@thp.uni-koeln.de)
9
    (c) 1999-2001 Gerd Knorr <kraxel@goldbach.in-berlin.de>
10
 
11
    This program is free software; you can redistribute it and/or modify
12
    it under the terms of the GNU General Public License as published by
13
    the Free Software Foundation; either version 2 of the License, or
14
    (at your option) any later version.
15
 
16
    This program is distributed in the hope that it will be useful,
17
    but WITHOUT ANY WARRANTY; without even the implied warranty of
18
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
    GNU General Public License for more details.
20
 
21
    You should have received a copy of the GNU General Public License
22
    along with this program; if not, write to the Free Software
23
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24
 
25
*/
26
 
27
/* SHARK version by Giacomo Guidi <giacomo@gandalf.sssup.it> */
28
 
29
#define __NO_VERSION__ 1
30
 
31
#include <unistd.h>
32
#include <linux/pci.h>
33
 
34
#include "drivers/bttv.h"
35
#include "drivers/tuner.h"
36
 
37
/* fwd decl */
38
static void boot_msp34xx(struct bttv *btv, int pin);
39
static void hauppauge_eeprom(struct bttv *btv);
40
static void osprey_eeprom(struct bttv *btv);
41
static void avermedia_eeprom(struct bttv *btv);
42
static void init_PXC200(struct bttv *btv);
43
#if 0
44
static void init_tea5757(struct bttv *btv);
45
#endif
46
 
47
static void winview_audio(struct bttv *btv, struct video_audio *v, int set);
48
static void lt9415_audio(struct bttv *btv, struct video_audio *v, int set);
49
static void avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v,
50
                                    int set);
51
static void terratv_audio(struct bttv *btv, struct video_audio *v, int set);
52
static void gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set);
53
static void winfast2000_audio(struct bttv *btv, struct video_audio *v, int set);
54
static void pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set);
55
static void fv2000s_audio(struct bttv *btv, struct video_audio *v, int set);
56
static void windvr_audio(struct bttv *btv, struct video_audio *v, int set);
57
static void rv605_muxsel(struct bttv *btv, unsigned int input);
58
 
59
/* config variables */
60
static int triton1=0;
61
static int vsfx=0;
62
int no_overlay=-1;
63
static unsigned int card[4]  = { -1, -1, -1, -1 };
64
static unsigned int pll[4]   = { -1, -1, -1, -1 };
65
static unsigned int tuner[4] = { -1, -1, -1, -1 };
66
static unsigned int gpiomask = -1;
67
static unsigned int audioall = -1;
68
static unsigned int audiomux[5] = { -1, -1, -1, -1, -1 };
69
 
70
/* ----------------------------------------------------------------------- */
71
/* list of card IDs for bt878+ cards                                       */
72
 
73
static struct CARD {
74
        unsigned id;
75
        int cardnr;
76
        char *name;
77
} cards[] = {
78
        { 0x13eb0070, BTTV_HAUPPAUGE878,  "Hauppauge WinTV" },
79
        { 0x39000070, BTTV_HAUPPAUGE878,  "Hauppauge WinTV-D" },
80
        { 0x45000070, BTTV_HAUPPAUGE878,  "Hauppauge WinTV/PVR" },
81
        { 0xff000070, BTTV_OSPREY1x0,     "Osprey-100" },
82
        { 0xff010070, BTTV_OSPREY2x0_SVID,"Osprey-200" },
83
        { 0xff020070, BTTV_OSPREY5x0,     "Osprey-500" },
84
        { 0xff030070, BTTV_OSPREY2000,    "Osprey-2000" },
85
 
86
        { 0x00011002, BTTV_ATI_TVWONDER,  "ATI TV Wonder" },
87
        { 0x00031002, BTTV_ATI_TVWONDERVE,"ATI TV Wonder/VE" },
88
 
89
        { 0x6606107d, BTTV_WINFAST2000,   "Leadtek WinFast TV 2000" },
90
        { 0x263610b4, BTTV_STB2,          "STB TV PCI FM, P/N 6000704" },
91
        { 0x402010fc, BTTV_GVBCTV3PCI,    "I-O Data Co. GV-BCTV3/PCI" },
92
        { 0x405010fc, BTTV_GVBCTV4PCI,    "I-O Data Co. GV-BCTV4/PCI" },
93
 
94
        { 0x1200bd11, BTTV_PINNACLE,      "Pinnacle PCTV" },
95
        { 0x001211bd, BTTV_PINNACLE,      "Pinnacle PCTV" },
96
        { 0x001c11bd, BTTV_PINNACLE,      "Pinnacle PCTV Sat" },
97
 
98
        { 0x3000121a, BTTV_VOODOOTV_FM,   "3Dfx VoodooTV FM/ VoodooTV 200" },
99
 
100
        { 0x3000144f, BTTV_MAGICTVIEW063, "(Askey Magic/others) TView99 CPH06x" },
101
        { 0x3002144f, BTTV_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH05x" },
102
        { 0x3005144f, BTTV_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH061/06L (T1/LC)" },
103
 
104
        { 0x00011461, BTTV_AVPHONE98,     "AVerMedia TVPhone98" },
105
        { 0x00021461, BTTV_AVERMEDIA98,   "AVermedia TVCapture 98" },
106
        { 0x00031461, BTTV_AVPHONE98,     "AVerMedia TVPhone98" },
107
        { 0x00041461, BTTV_AVERMEDIA98,   "AVerMedia TVCapture 98" },
108
 
109
        { 0x300014ff, BTTV_MAGICTVIEW061, "TView 99 (CPH061)" },
110
        { 0x300214ff, BTTV_PHOEBE_TVMAS,  "Phoebe TV Master (CPH060)" },
111
 
112
        { 0x1117153b, BTTV_TERRATVALUE,   "Terratec TValue" },
113
        { 0x1118153b, BTTV_TERRATVALUE,   "Terratec TValue" },
114
        { 0x1119153b, BTTV_TERRATVALUE,   "Terratec TValue" },
115
        { 0x111a153b, BTTV_TERRATVALUE,   "Terratec TValue" },
116
        { 0x1123153b, BTTV_TERRATVRADIO,  "Terratec TV Radio+" },
117
        { 0x1127153b, BTTV_TERRATV,       "Terratec TV+"    },
118
        // clashes with flyvideo
119
        //{ 0x18521852, BTTV_TERRATV,     "Terratec TV+"    },
120
        { 0x1134153b, BTTV_TERRATVALUE,   "Terratec TValue" },
121
        { 0x1135153b, BTTV_TERRATVALUER,  "Terratec TValue Radio" },
122
        { 0x5018153b, BTTV_TERRATVALUE,   "Terratec TValue" },
123
 
124
        { 0x400a15b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV" },
125
        { 0x400d15b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
126
        { 0x401015b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
127
        { 0x401615b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
128
 
129
        { 0x010115cb, BTTV_GMV1,          "AG GMV1" },
130
        { 0x010114c7, BTTV_MODTEC_205,    "Modular Technology MM205 PCTV" },
131
        { 0x18501851, BTTV_CHRONOS_VS2,   "Flyvideo 98 (LR50)/ Chronos Video Shuttle II" },
132
        { 0x18511851, BTTV_FLYVIDEO98EZ,  "Flyvideo 98EZ (LR51)/ CyberMail AV" },
133
        { 0x18521852, BTTV_TYPHOON_TVIEW, "Flyvideo 98FM (LR50)/ Typhoon TView TV/FM Tuner" },
134
        { 0x10b42636, BTTV_HAUPPAUGE878,  "STB ???" },
135
        { 0x217d6606, BTTV_WINFAST2000,   "Leadtek WinFast TV 2000" },
136
        { 0x03116000, BTTV_SENSORAY311,   "Sensoray 311" },
137
        { 0x00790e11, BTTV_WINDVR,        "Canopus WinDVR PCI" },
138
        { 0xa0fca1a0, BTTV_ZOLTRIX,       "Face to Face Tvmax" },
139
        { 0x0350109e, BTTV_PXC200,        "Imagenation PXC200" },
140
 
141
        { 0, -1, NULL }
142
};
143
 
144
/* ----------------------------------------------------------------------- */
145
/* array with description for bt848 / bt878 tv/grabber cards               */
146
 
147
struct tvcard bttv_tvcards[] = {
148
{
149
/* ---- card 0x00 ---------------------------------- */
150
        name:           " *** UNKNOWN/GENERIC *** ",
151
        video_inputs:   4,
152
        audio_inputs:   1,
153
        tuner:          0,
154
        svhs:           2,
155
        muxsel:         { 2, 3, 1, 0},
156
        tuner_type:     -1,
157
},{
158
        name:           "MIRO PCTV",
159
        video_inputs:   4,
160
        audio_inputs:   1,
161
        tuner:          0,
162
        svhs:           2,
163
        gpiomask:       15,
164
        muxsel:         { 2, 3, 1, 1},
165
        audiomux:       { 2, 0, 0, 0, 10},
166
        needs_tvaudio:  1,
167
        tuner_type:     -1,
168
},{
169
        name:           "Hauppauge (bt848)",
170
        video_inputs:   4,
171
        audio_inputs:   1,
172
        tuner:          0,
173
        svhs:           2,
174
        gpiomask:       7,
175
        muxsel:         { 2, 3, 1, 1},
176
        audiomux:       { 0, 1, 2, 3, 4},
177
        needs_tvaudio:  1,
178
        tuner_type:     -1,
179
},{
180
        name:           "STB",
181
        video_inputs:   3,
182
        audio_inputs:   1,
183
        tuner:          0,
184
        svhs:           2,
185
        gpiomask:       7,
186
        muxsel:         { 2, 3, 1, 1},
187
        audiomux:       { 4, 0, 2, 3, 1},
188
        no_msp34xx:     1,
189
        needs_tvaudio:  1,
190
        tuner_type:     -1,
191
},{
192
 
193
/* ---- card 0x04 ---------------------------------- */
194
        name:           "Intel",
195
        video_inputs:   3,
196
        audio_inputs:   1,
197
        tuner:          0,
198
        svhs:           -1,
199
        gpiomask:       7,
200
        muxsel:         { 2, 3, 1, 1},
201
        audiomux:       { 0, 1, 2, 3, 4},
202
        needs_tvaudio:  1,
203
        tuner_type:     -1,
204
},{
205
        name:           "Diamond DTV2000",
206
        video_inputs:   4,
207
        audio_inputs:   1,
208
        tuner:          0,
209
        svhs:           2,
210
        gpiomask:       3,
211
        muxsel:         { 2, 3, 1, 0},
212
        audiomux:       { 0, 1, 0, 1, 3},
213
        needs_tvaudio:  1,
214
        tuner_type:     -1,
215
},{
216
        name:           "AVerMedia TVPhone",
217
        video_inputs:   3,
218
        audio_inputs:   1,
219
        tuner:          0,
220
        svhs:           3,
221
        muxsel:         { 2, 3, 1, 1},
222
        gpiomask:       0x0f,
223
        audiomux:       { 0x0c, 0x04, 0x08, 0x04, 0},
224
        /*                0x04 for some cards ?? */
225
        needs_tvaudio:  1,
226
        tuner_type:     -1,
227
        audio_hook:     avermedia_tvphone_audio,
228
},{
229
        name:           "MATRIX-Vision MV-Delta",
230
        video_inputs:   5,
231
        audio_inputs:   1,
232
        tuner:          -1,
233
        svhs:           3,
234
        gpiomask:       0,
235
        muxsel:         { 2, 3, 1, 0, 0},
236
        audiomux:       {0 },
237
        needs_tvaudio:  1,
238
        tuner_type:     -1,
239
},{
240
 
241
/* ---- card 0x08 ---------------------------------- */
242
        name:           "FlyVideo II (Bt848) LR26",
243
        video_inputs:   4,
244
        audio_inputs:   1,
245
        tuner:          0,
246
        svhs:           2,
247
        gpiomask:       0xc00,
248
        muxsel:         { 2, 3, 1, 1},
249
        audiomux:       { 0, 0xc00, 0x800, 0x400, 0xc00, 0},
250
        needs_tvaudio:  1,
251
        pll:            PLL_28,
252
        tuner_type:     -1,
253
},{
254
        name:           "IXMicro TurboTV",
255
        video_inputs:   3,
256
        audio_inputs:   1,
257
        tuner:          0,
258
        svhs:           2,
259
        gpiomask:       3,
260
        muxsel:         { 2, 3, 1, 1},
261
        audiomux:       { 1, 1, 2, 3, 0},
262
        needs_tvaudio:  1,
263
        tuner_type:     -1,
264
},{
265
        name:           "Hauppauge (bt878)",
266
        video_inputs:   4,
267
        audio_inputs:   1,
268
        tuner:          0,
269
        svhs:           2,
270
        gpiomask:       0x0f, /* old: 7 */
271
        muxsel:         { 2, 0, 1, 1},
272
        audiomux:       { 0, 1, 2, 3, 4},
273
        needs_tvaudio:  1,
274
        pll:            PLL_28,
275
        tuner_type:     -1,
276
},{
277
        name:           "MIRO PCTV pro",
278
        video_inputs:   3,
279
        audio_inputs:   1,
280
        tuner:          0,
281
        svhs:           2,
282
        gpiomask:       0x3014f,
283
        muxsel:         { 2, 3, 1, 1},
284
        audiomux:       { 0x20001,0x10001, 0, 0,10},
285
        needs_tvaudio:  1,
286
        tuner_type:     -1,
287
},{
288
 
289
/* ---- card 0x0c ---------------------------------- */
290
        name:           "ADS Technologies Channel Surfer TV",
291
        video_inputs:   3,
292
        audio_inputs:   1,
293
        tuner:          0,
294
        svhs:           2,
295
        gpiomask:       15,
296
        muxsel:         { 2, 3, 1, 1},
297
        audiomux:       { 13, 14, 11, 7, 0, 0},
298
        needs_tvaudio:  1,
299
        tuner_type:     -1,
300
},{
301
        name:           "AVerMedia TVCapture 98",
302
        video_inputs:   3,
303
        audio_inputs:   4,
304
        tuner:          0,
305
        svhs:           2,
306
        gpiomask:       15,
307
        muxsel:         { 2, 3, 1, 1},
308
        audiomux:       { 13, 14, 11, 7, 0, 0},
309
        needs_tvaudio:  1,
310
        pll:            PLL_28,
311
        tuner_type:     -1,
312
},{
313
        name:           "Aimslab Video Highway Xtreme (VHX)",
314
        video_inputs:   3,
315
        audio_inputs:   1,
316
        tuner:          0,
317
        svhs:           2,
318
        gpiomask:       7,
319
        muxsel:         { 2, 3, 1, 1},
320
        audiomux:       { 0, 2, 1, 3, 4}, /* old: { 0, 1, 2, 3, 4} */
321
        needs_tvaudio:  1,
322
        tuner_type:     -1,
323
},{
324
        name:           "Zoltrix TV-Max",
325
        video_inputs:   3,
326
        audio_inputs:   1,
327
        tuner:          0,
328
        svhs:           2,
329
        gpiomask:       15,
330
        muxsel:         { 2, 3, 1, 1},
331
        audiomux:       {0 , 0, 1 , 0, 10},
332
        needs_tvaudio:  1,
333
        tuner_type:     -1,
334
},{
335
 
336
/* ---- card 0x10 ---------------------------------- */
337
        name:           "Pixelview PlayTV (bt878)",
338
        video_inputs:   3,
339
        audio_inputs:   1,
340
        tuner:          0,
341
        svhs:           2,
342
        gpiomask:       0x01fe00,
343
        muxsel:         { 2, 3, 1, 1},
344
        audiomux:       { 0x01c000, 0, 0x018000, 0x014000, 0x002000, 0 },
345
        needs_tvaudio:  1,
346
        pll:            PLL_28,
347
        tuner_type:     -1,
348
},{
349
        name:           "Leadtek WinView 601",
350
        video_inputs:   3,
351
        audio_inputs:   1,
352
        tuner:          0,
353
        svhs:           2,
354
        gpiomask:       0x8300f8,
355
        muxsel:         { 2, 3, 1, 1,0},
356
        audiomux:       { 0x4fa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007},
357
        needs_tvaudio:  1,
358
        tuner_type:     -1,
359
        audio_hook:     winview_audio,
360
        has_radio:      1,
361
},{
362
        name:           "AVEC Intercapture",
363
        video_inputs:   3,
364
        audio_inputs:   2,
365
        tuner:          0,
366
        svhs:           2,
367
        gpiomask:       0,
368
        muxsel:         {2, 3, 1, 1},
369
        audiomux:       {1, 0, 0, 0, 0},
370
        needs_tvaudio:  1,
371
        tuner_type:     -1,
372
},{
373
        name:           "LifeView FlyKit w/o Tuner",
374
        video_inputs:   3,
375
        audio_inputs:   1,
376
        tuner:          -1,
377
        svhs:           -1,
378
        gpiomask:       0x8dff00,
379
        muxsel:         { 2, 3, 1, 1},
380
        audiomux:       { 0 },
381
        no_msp34xx:     1,
382
        tuner_type:     -1,
383
},{
384
 
385
/* ---- card 0x14 ---------------------------------- */
386
        name:           "CEI Raffles Card",
387
        video_inputs:   3,
388
        audio_inputs:   3,
389
        tuner:          0,
390
        svhs:           2,
391
        muxsel:         {2, 3, 1, 1},
392
        tuner_type:     -1,
393
},{
394
        name:           "Lucky Star Image World ConferenceTV",
395
        video_inputs:   3,
396
        audio_inputs:   1,
397
        tuner:          0,
398
        svhs:           2,
399
        gpiomask:       0x00fffe07,
400
        muxsel:         { 2, 3, 1, 1},
401
        audiomux:       { 131072, 1, 1638400, 3, 4},
402
        needs_tvaudio:  1,
403
        pll:            PLL_28,
404
        tuner_type:     TUNER_PHILIPS_PAL_I,
405
},{
406
        name:           "Phoebe Tv Master + FM (CPH050)",
407
        video_inputs:   3,
408
        audio_inputs:   1,
409
        tuner:          0,
410
        svhs:           2,
411
        gpiomask:       0xc00,
412
        muxsel:         { 2, 3, 1, 1},
413
        audiomux:       {0, 1, 0x800, 0x400, 0xc00, 0},
414
        needs_tvaudio:  1,
415
        tuner_type:     -1,
416
},{
417
        name:           "Modular Technology MM205 PCTV, bt878",
418
        video_inputs:   2,
419
        audio_inputs:   1,
420
        tuner:          0,
421
        svhs:           -1,
422
        gpiomask:       7,
423
        muxsel:         { 2, 3 },
424
        audiomux:       { 0, 0, 0, 0, 0 },
425
        no_msp34xx:     1,
426
        pll:            PLL_28,
427
        tuner_type:     TUNER_ALPS_TSBB5_PAL_I,
428
},{
429
 
430
/* ---- card 0x18 ---------------------------------- */
431
        name:           "[many vendors] CPH05X/06X (bt878)",
432
        video_inputs:   3,
433
        audio_inputs:   1,
434
        tuner:          0,
435
        svhs:           2,
436
        gpiomask:       0xe00,
437
        muxsel:         { 2, 3, 1, 1},
438
        audiomux:       {0x400, 0x400, 0x400, 0x400, 0xc00},
439
        needs_tvaudio:  1,
440
        pll:            PLL_28,
441
        tuner_type:     -1,
442
},{
443
        name:           "Terratec/Vobis TV-Boostar",
444
        video_inputs:   3,
445
        audio_inputs:   1,
446
        tuner:          0,
447
        svhs:           2,
448
        gpiomask:       16777215,
449
        muxsel:         { 2, 3, 1, 1},
450
        audiomux:       { 131072, 1, 1638400, 3,4},
451
        needs_tvaudio:  1,
452
        tuner_type:     -1,
453
},{
454
        name:           "Newer Hauppauge WinCam (bt878)",
455
        video_inputs:   4,
456
        audio_inputs:   1,
457
        tuner:          0,
458
        svhs:           3,
459
        gpiomask:       7,
460
        muxsel:         { 2, 0, 1, 1},
461
        audiomux:       { 0, 1, 2, 3, 4},
462
        needs_tvaudio:  1,
463
        tuner_type:     -1,
464
},{
465
        name:           "MAXI TV Video PCI2",
466
        video_inputs:   3,
467
        audio_inputs:   1,
468
        tuner:          0,
469
        svhs:           2,
470
        gpiomask:       0xffff,
471
        muxsel:         { 2, 3, 1, 1},
472
        audiomux:       { 0, 1, 2, 3, 0xc00},
473
        needs_tvaudio:  1,
474
        tuner_type:     TUNER_PHILIPS_SECAM,
475
},{
476
 
477
/* ---- card 0x1c ---------------------------------- */
478
        name:           "Terratec TerraTV+",
479
        video_inputs:   3,
480
        audio_inputs:   1,
481
        tuner:          0,
482
        svhs:           2,
483
        gpiomask:       0x70000,
484
        muxsel:         { 2, 3, 1, 1},
485
        audiomux:       { 0x20000, 0x30000, 0x10000, 0x00000, 0x40000},
486
        needs_tvaudio:  1,
487
        tuner_type:     TUNER_PHILIPS_PAL,
488
        audio_hook:     terratv_audio,
489
},{
490
        /* Jannik Fritsch <jannik@techfak.uni-bielefeld.de> */
491
        name:           "Imagenation PXC200",
492
        video_inputs:   5,
493
        audio_inputs:   1,
494
        tuner:          -1,
495
        svhs:           1, /* was: 4 */
496
        gpiomask:       0,
497
        muxsel:         { 2, 3, 1, 0, 0},
498
        audiomux:       { 0 },
499
        needs_tvaudio:  1,
500
        tuner_type:     -1,
501
},{
502
        name:           "FlyVideo 98",
503
        video_inputs:   3,
504
        audio_inputs:   1,
505
        tuner:          0,
506
        svhs:           2,
507
        gpiomask:       0x1800,  //0x8dfe00
508
        muxsel:         {2, 3, 1, 1},
509
        audiomux:       { 0, 0x0800, 0x1000, 0x1000, 0x1800, 0 },
510
        needs_tvaudio:  1,
511
        tuner_type:     -1,
512
},{
513
        name:           "iProTV",
514
        video_inputs:   3,
515
        audio_inputs:   1,
516
        tuner:          0,
517
        svhs:           2,
518
        gpiomask:       1,
519
        muxsel:         { 2, 3, 1, 1},
520
        audiomux:       { 1, 0, 0, 0, 0 },
521
        tuner_type:     -1,
522
},{
523
 
524
/* ---- card 0x20 ---------------------------------- */
525
        name:           "Intel Create and Share PCI",
526
        video_inputs:   4,
527
        audio_inputs:   1,
528
        tuner:          -1,
529
        svhs:           2,
530
        gpiomask:       7,
531
        muxsel:         { 2, 3, 1, 1},
532
        audiomux:       { 4, 4, 4, 4, 4},
533
        needs_tvaudio:  1,
534
        tuner_type:     -1,
535
},{
536
        name:           "Terratec TerraTValue",
537
        video_inputs:   3,
538
        audio_inputs:   1,
539
        tuner:          0,
540
        svhs:           2,
541
        gpiomask:       0xffff00,
542
        muxsel:         { 2, 3, 1, 1},
543
        audiomux:       { 0x500, 0, 0x300, 0x900, 0x900},
544
        needs_tvaudio:  1,
545
        pll:            PLL_28,
546
        tuner_type:     TUNER_PHILIPS_PAL,
547
},{
548
        name:           "Leadtek WinFast 2000",
549
        video_inputs:   3,
550
        audio_inputs:   1,
551
        tuner:          0,
552
        svhs:           2,
553
        gpiomask:       0xc33000,
554
        muxsel:         { 2, 3, 1, 1,0},
555
        audiomux:       { 0x422000,0x001000,0x621100,0x620000,0x800000,0x620000},
556
        needs_tvaudio:  0,
557
        pll:            PLL_28,
558
        tuner_type:     -1,
559
        audio_hook:     winfast2000_audio,
560
},{
561
        name:           "Flyvideo 98 (LR50Q) / Chronos Video Shuttle II",
562
        video_inputs:   3,
563
        audio_inputs:   3,
564
        tuner:          0,
565
        svhs:           2,
566
        gpiomask:       0x1800,
567
        muxsel:         { 2, 3, 1, 1},
568
        audiomux:       { 0, 0x800, 0x1000, 0x1000, 0x1800},
569
        needs_tvaudio:  1,
570
        pll:            PLL_28,
571
        tuner_type:     -1,
572
},{
573
 
574
/* ---- card 0x24 ---------------------------------- */
575
        name:           "Flyvideo 98FM (LR50Q) / Typhoon TView TV/FM Tuner",
576
        video_inputs:   3,
577
        audio_inputs:   3,
578
        tuner:          0,
579
        svhs:           2,
580
        gpiomask:       0x1800,
581
        muxsel:         { 2, 3, 1, 1},
582
        audiomux:       { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 },
583
        needs_tvaudio:  1,
584
        pll:            PLL_28,
585
        tuner_type:     -1,
586
        has_radio:      1,
587
},{
588
        name:           "PixelView PlayTV pro",
589
        video_inputs:   3,
590
        audio_inputs:   1,
591
        tuner:          0,
592
        svhs:           2,
593
        gpiomask:       0xff,
594
        muxsel:         { 2, 3, 1, 1 },
595
        audiomux:       { 0x21, 0x20, 0x24, 0x2c, 0x29, 0x29 },
596
        no_msp34xx:     1,
597
        pll:            PLL_28,
598
        tuner_type:     -1,
599
},{
600
        name:           "TView99 CPH06X",
601
        video_inputs:   4,
602
        audio_inputs:   1,
603
        tuner:          0,
604
        svhs:           2,
605
        gpiomask:       0x551e00,
606
        muxsel:         { 2, 3, 1, 0},
607
        audiomux:       { 0x551400, 0x551200, 0, 0, 0x551c00, 0x551200 },
608
        needs_tvaudio:  1,
609
        pll:            PLL_28,
610
        tuner_type:     -1,
611
},{
612
        name:           "Pinnacle PCTV Studio/Rave",
613
        video_inputs:   3,
614
        audio_inputs:   1,
615
        tuner:          0,
616
        svhs:           2,
617
        gpiomask:       0x03000F,
618
        muxsel:         { 2, 3, 1, 1},
619
        audiomux:       { 2, 0, 0, 0, 1},
620
        needs_tvaudio:  1,
621
        pll:            PLL_28,
622
        tuner_type:     -1,
623
},{
624
 
625
/* ---- card 0x28 ---------------------------------- */
626
        name:           "STB2",
627
        video_inputs:   3,
628
        audio_inputs:   1,
629
        tuner:          0,
630
        svhs:           2,
631
        gpiomask:       7,
632
        muxsel:         { 2, 3, 1, 1},
633
        audiomux:       { 4, 0, 2, 3, 1},
634
        no_msp34xx:     1,
635
        needs_tvaudio:  1,
636
        tuner_type:     -1,
637
},{
638
        name:           "AVerMedia TVPhone 98",
639
        video_inputs:   3,
640
        audio_inputs:   4,
641
        tuner:          0,
642
        svhs:           2,
643
        gpiomask:       12,
644
        muxsel:         { 2, 3, 1, 1},
645
        audiomux:       { 13, 4, 11, 7, 0, 0},
646
        needs_tvaudio:  1,
647
        pll:            PLL_28,
648
        tuner_type:     -1,
649
        has_radio:      1,
650
},{
651
        name:           "ProVideo PV951", /* pic16c54 */
652
        video_inputs:   3,
653
        audio_inputs:   1,
654
        tuner:          0,
655
        svhs:           2,
656
        gpiomask:       0,
657
        muxsel:         { 2, 3, 1, 1},
658
        audiomux:       { 0, 0, 0, 0, 0},
659
        no_msp34xx:     1,
660
        pll:            PLL_28,
661
        tuner_type:     1,
662
},{
663
        name:           "Little OnAir TV",
664
        video_inputs:   3,
665
        audio_inputs:   1,
666
        tuner:          0,
667
        svhs:           2,
668
        gpiomask:       0xe00b,
669
        muxsel:         {2, 3, 1, 1},
670
        audiomux:       {0xff9ff6, 0xff9ff6, 0xff1ff7, 0, 0xff3ffc},
671
        no_msp34xx:     1,
672
        tuner_type:     -1,
673
},{
674
 
675
/* ---- card 0x2c ---------------------------------- */
676
        name:           "Sigma TVII-FM",
677
        video_inputs:   2,
678
        audio_inputs:   1,
679
        tuner:          0,
680
        svhs:           -1,
681
        gpiomask:       3,
682
        muxsel:         {2, 3, 1, 1},
683
        audiomux:       {1, 1, 0, 2, 3},
684
        no_msp34xx:     1,
685
        pll:            PLL_NONE,
686
        tuner_type:     -1,
687
},{
688
        name:           "MATRIX-Vision MV-Delta 2",
689
        video_inputs:   5,
690
        audio_inputs:   1,
691
        tuner:          -1,
692
        svhs:           3,
693
        gpiomask:       0,
694
        muxsel:         { 2, 3, 1, 0, 0},
695
        audiomux:       {0 },
696
        no_msp34xx:     1,
697
        pll:            PLL_28,
698
        tuner_type:     -1,
699
},{
700
        name:           "Zoltrix Genie TV/FM",
701
        video_inputs:   3,
702
        audio_inputs:   1,
703
        tuner:          0,
704
        svhs:           2,
705
        gpiomask:       0xbcf03f,
706
        muxsel:         { 2, 3, 1, 1},
707
        audiomux:       { 0xbc803f, 0xbc903f, 0xbcb03f, 0, 0xbcb03f},
708
        no_msp34xx:     1,
709
        pll:            PLL_28,
710
        tuner_type:     21,
711
},{
712
        name:           "Terratec TV/Radio+",
713
        video_inputs:   3,
714
        audio_inputs:   1,
715
        tuner:          0,
716
        svhs:           2,
717
        gpiomask:       0x1f0000,
718
        muxsel:         { 2, 3, 1, 1},
719
        audiomux:       { 0xe2ffff, 0xebffff, 0, 0, 0xe0ffff, 0xe2ffff },
720
        needs_tvaudio:  1,
721
        no_msp34xx:     1,
722
        pll:            PLL_35,
723
        tuner_type:     1,
724
        has_radio:      1,
725
},{
726
 
727
/* ---- card 0x30 ---------------------------------- */
728
        name:           "Dynalink Magic TView ",
729
        video_inputs:   3,
730
        audio_inputs:   1,
731
        tuner:          0,
732
        svhs:           2,
733
        gpiomask:       15,
734
        muxsel:         { 2, 3, 1, 1},
735
        audiomux:       {2,0,0,0,1},
736
        needs_tvaudio:  1,
737
        pll:            PLL_28,
738
        tuner_type:     -1,
739
},{
740
        name:           "IODATA GV-BCTV3/PCI",
741
        video_inputs:   3,
742
        audio_inputs:   1,
743
        tuner:          0,
744
        svhs:           2,
745
        gpiomask:       0x010f00,
746
        muxsel:         {2, 3, 0, 0},
747
        audiomux:       {0x10000, 0, 0x10000, 0, 0, 0},
748
        no_msp34xx:     1,
749
        pll:            PLL_28,
750
        tuner_type:     TUNER_ALPS_TSHC6_NTSC,
751
        audio_hook:     gvbctv3pci_audio,
752
},{
753
        name:           "Prolink PV-BT878P+4E / PixelView PlayTV PAK / Lenco MXTV-9578 CP",
754
        video_inputs:   4,
755
        audio_inputs:   1,
756
        tuner:          0,
757
        svhs:           3,
758
        gpiomask:       0xAA0000,
759
        muxsel:         { 2,3,1,1 },
760
        audiomux:       { 0x20000, 0, 0x80000, 0x80000, 0xa8000, 0x46000  },
761
        no_msp34xx:     1,
762
        pll:            PLL_28,
763
        tuner_type:     TUNER_PHILIPS_PAL_I,
764
},{
765
        name:           "Eagle Wireless Capricorn2 (bt878A)",
766
        video_inputs:   4,
767
        audio_inputs:   1,
768
        tuner:          0,
769
        svhs:           2,
770
        gpiomask:       7,
771
        muxsel:         { 2, 0, 1, 1},
772
        audiomux:       { 0, 1, 2, 3, 4},
773
        pll:            PLL_28,
774
        tuner_type:     -1 /* TUNER_ALPS_TMDH2_NTSC */,
775
},{
776
 
777
/* ---- card 0x34 ---------------------------------- */
778
        /* David Härdeman <david@2gen.com> */
779
        name:           "Pinnacle PCTV Studio Pro",
780
        video_inputs:   3,
781
        audio_inputs:   1,
782
        tuner:          0,
783
        svhs:           2,
784
        gpiomask:       0x03000F,
785
        muxsel:         { 2, 3, 1, 1},
786
        audiomux:       { 1, 0x10001, 0, 0, 10},
787
        needs_tvaudio:  1,
788
        pll:            PLL_28,
789
        tuner_type:     -1,
790
},{
791
        /* Claas Langbehn <claas@bigfoot.com>,
792
           Sven Grothklags <sven@upb.de> */
793
        name:           "Typhoon TView RDS + FM Stereo / KNC1 TV Station RDS",
794
        video_inputs:   3,
795
        audio_inputs:   3,
796
        tuner:          0,
797
        svhs:           2,
798
        gpiomask:       0x1c,
799
        muxsel:         { 2, 3, 1, 1},
800
        audiomux:       { 0, 0, 0x10, 8, 4 },
801
        needs_tvaudio:  1,
802
        pll:            PLL_28,
803
        tuner_type:     TUNER_PHILIPS_PAL_I,
804
        has_radio:      1,
805
},{
806
        /* Tim Röstermundt <rosterm@uni-muenster.de>
807
           in de.comp.os.unix.linux.hardware:
808
                options bttv card=0 pll=1 radio=1 gpiomask=0x18e0
809
                audiomux=0x44c71f,0x44d71f,0,0x44d71f,0x44dfff
810
                options tuner type=5 */
811
        name:           "Lifetec LT 9415 TV (LR90 Rev.F)",
812
        video_inputs:   4,
813
        audio_inputs:   1,
814
        tuner:          0,
815
        svhs:           2,
816
        gpiomask:       0x18e0,
817
        muxsel:         { 2, 3, 1, 1},
818
        audiomux:       { 0x0000,0x0800,0x1000,0x1000,0x18e0 },
819
                       /* 0x0000: Tuner normal stereo
820
                          0x0080: Tuner A2 SAP (second audio program = Zweikanalton)
821
                          0x0880: Tuner A2 stereo */
822
        pll:            PLL_28,
823
        tuner_type:     TUNER_PHILIPS_PAL,
824
        audio_hook:     lt9415_audio,
825
        has_radio:      1,
826
},{
827
        /* Miguel Angel Alvarez <maacruz@navegalia.com>
828
           old Easy TV BT848 version (model CPH031) */
829
        name:           "BESTBUY Easy TV (CPH031)",
830
        video_inputs:   4,
831
        audio_inputs:   1,
832
        tuner:          0,
833
        svhs:           2,
834
        gpiomask:       0xF,
835
        muxsel:         { 2, 3, 1, 0},
836
        audiomux:       { 2, 0, 0, 0, 10},
837
        needs_tvaudio:  0,
838
        pll:            PLL_28,
839
        tuner_type:     TUNER_TEMIC_PAL,
840
},{
841
 
842
/* ---- card 0x38 ---------------------------------- */
843
        /* Gordon Heydon <gjheydon@bigfoot.com ('98) */
844
        name:           "FlyVideo '98/FM",
845
        video_inputs:   3,
846
        audio_inputs:   3,
847
        tuner:          0,
848
        svhs:           2,
849
        gpiomask:       0x1800,
850
        muxsel:         { 2, 3, 0, 1},
851
        audiomux:       { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 },
852
        needs_tvaudio:  1,
853
        pll:            PLL_28,
854
        tuner_type:     5,
855
},{
856
        /* This is the ultimate cheapo capture card
857
         * just a BT848A on a small PCB!
858
         * Steve Hosgood <steve@equiinet.com> */
859
        name:           "GrandTec 'Grand Video Capture' (Bt848)",
860
        video_inputs:   2,
861
        audio_inputs:   0,
862
        tuner:          -1,
863
        svhs:           1,
864
        gpiomask:       0,
865
        muxsel:         { 3, 1 },
866
        audiomux:       { 0 },
867
        needs_tvaudio:  0,
868
        no_msp34xx:     1,
869
        pll:            PLL_35,
870
        tuner_type:     -1,
871
},{
872
        /* Daniel Herrington <daniel.herrington@home.com> */
873
        name:           "Phoebe TV Master Only (No FM) CPH060",
874
        video_inputs:   3,
875
        audio_inputs:   1,
876
        tuner:          0,
877
        svhs:           2,
878
        gpiomask:       0xe00,
879
        muxsel:         { 2, 3, 1, 1},
880
        audiomux:       { 0x400, 0x400, 0x400, 0x400, 0x800, 0x400 },
881
        needs_tvaudio:  1,
882
        pll:            PLL_NONE,
883
        tuner_type:     TUNER_TEMIC_4036FY5_NTSC,
884
},{
885
        /* Matti Mottus <mottus@physic.ut.ee> */
886
        name:           "TV Capturer (CPH03X)",
887
        video_inputs:   4,
888
        audio_inputs:   1,
889
        tuner:          0,
890
        svhs:           2,
891
        gpiomask:       0x03000F,
892
        muxsel:         { 2, 3, 1, 0},
893
        audiomux:       { 2,0,0,0,1 },
894
        pll:            PLL_28,
895
        tuner_type:     0,
896
},{
897
 
898
/* ---- card 0x3c ---------------------------------- */
899
        /* Philip Blundell <philb@gnu.org> */
900
        name:           "Modular Technology MM100PCTV",
901
        video_inputs:   2,
902
        audio_inputs:   2,
903
        tuner:          0,
904
        svhs:           -1,
905
        gpiomask:       11,
906
        muxsel:         { 2, 3, 1, 1},
907
        audiomux:       { 2, 0, 0, 1, 8},
908
        pll:            PLL_35,
909
        tuner_type:     TUNER_TEMIC_PAL,
910
 
911
},{
912
        /* Adrian Cox <adrian@humboldt.co.uk */
913
        name:           "AG Electronics GMV1",
914
        video_inputs:   2,
915
        audio_inputs:   0,
916
        tuner:          -1,
917
        svhs:           1,
918
        gpiomask:       0xF,
919
        muxsel:         { 2, 2},
920
        audiomux:       { },
921
        no_msp34xx:     1,
922
        needs_tvaudio:  0,
923
        pll:            PLL_28,
924
        tuner_type:     -1,
925
},{
926
        /* Miguel Angel Alvarez <maacruz@navegalia.com>
927
           new Easy TV BT878 version (model CPH061)
928
           special thanks to Informatica Mieres for providing the card */
929
        name:           "BESTBUY Easy TV (bt878)",
930
        video_inputs:   3,
931
        audio_inputs:   2,
932
        tuner:          0,
933
        svhs:           2,
934
        gpiomask:       0xFF,
935
        muxsel:         { 2, 3, 1, 0},
936
        audiomux:       { 1, 0, 4, 4, 9},
937
        needs_tvaudio:  0,
938
        pll:            PLL_28,
939
        tuner_type:     TUNER_PHILIPS_PAL,
940
},{
941
        /* Lukas Gebauer <geby@volny.cz> */
942
        name:           "ATI TV-Wonder",
943
        video_inputs:   3,
944
        audio_inputs:   1,
945
        tuner:          0,
946
        svhs:           2,
947
        gpiomask:       0xf03f,
948
        muxsel:         { 2, 3, 1, 0 },
949
        audiomux:       { 0xbffe, 0, 0xbfff, 0, 0xbffe},
950
        pll:            PLL_28,
951
        tuner_type:     TUNER_TEMIC_4006FN5_MULTI_PAL,
952
},{
953
 
954
/* ---- card 0x40 ---------------------------------- */
955
        /* Lukas Gebauer <geby@volny.cz> */
956
        name:           "ATI TV-Wonder VE",
957
        video_inputs:   2,
958
        audio_inputs:   1,
959
        tuner:          0,
960
        svhs:           -1,
961
        gpiomask:       1,
962
        muxsel:         { 2, 3, 0, 1},
963
        audiomux:       { 0, 0, 1, 0, 0},
964
        no_msp34xx:     1,
965
        pll:            PLL_28,
966
        tuner_type:     TUNER_TEMIC_4006FN5_MULTI_PAL,
967
},{
968
        /* DeeJay <deejay@westel900.net (2000S) */
969
        name:           "FlyVideo 2000S",
970
        video_inputs:   3,
971
        audio_inputs:   3,
972
        tuner:          0,
973
        svhs:           2,
974
        gpiomask:       0x18e0,
975
        muxsel:         { 2, 3, 0, 1},
976
                        /* Radio changed from 1e80 to 0x800 to make
977
                           Flyvideo2000S in .hu happy (gm)*/
978
                        /* -dk-???: set mute=0x1800 for tda9874h daughterboard */
979
        audiomux:       { 0x0000,0x0800,0x1000,0x1000,0x1800, 0x1080 },
980
        audio_hook:     fv2000s_audio,
981
        no_msp34xx:     1,
982
        no_tda9875:     1,
983
        needs_tvaudio:  1,
984
        pll:            PLL_28,
985
        tuner_type:     5,
986
},{
987
        name:           "Terratec TValueRadio",
988
        video_inputs:   3,
989
        audio_inputs:   1,
990
        tuner:          0,
991
        svhs:           2,
992
        gpiomask:       0xffff00,
993
        muxsel:         { 2, 3, 1, 1},
994
        audiomux:       { 0x500, 0x500, 0x300, 0x900, 0x900},
995
        needs_tvaudio:  1,
996
        pll:            PLL_28,
997
        tuner_type:     TUNER_PHILIPS_PAL,
998
        has_radio:      1,
999
},{
1000
        /* TANAKA Kei <peg00625@nifty.com> */
1001
        name:           "IODATA GV-BCTV4/PCI",
1002
        video_inputs:   3,
1003
        audio_inputs:   1,
1004
        tuner:          0,
1005
        svhs:           2,
1006
        gpiomask:       0x010f00,
1007
        muxsel:         {2, 3, 0, 0},
1008
        audiomux:       {0x10000, 0, 0x10000, 0, 0, 0},
1009
        no_msp34xx:     1,
1010
        pll:            PLL_28,
1011
        tuner_type:     TUNER_SHARP_2U5JF5540_NTSC,
1012
        audio_hook:     gvbctv3pci_audio,
1013
},{
1014
 
1015
/* ---- card 0x44 ---------------------------------- */
1016
        name:           "3Dfx VoodooTV FM (Euro), VoodooTV 200 (USA)",
1017
        // try "insmod msp3400 simple=0" if you have
1018
        // sound problems with this card.
1019
        video_inputs:   4,
1020
        audio_inputs:   1,
1021
        tuner:          0,
1022
        svhs:           -1,
1023
        gpiomask:       0x4f8a00,
1024
        // 0x100000: 1=MSP enabled (0=disable again)
1025
        // 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC)
1026
        audiomux:       {0x947fff, 0x987fff,0x947fff,0x947fff, 0x947fff},
1027
        // tvtuner, radio,   external,internal, mute,  stereo
1028
        /* tuner, Composit, SVid, Composit-on-Svid-adapter*/
1029
        muxsel:         { 2, 3 ,0 ,1},
1030
        tuner_type:     TUNER_MT2032,
1031
        pll:            PLL_28,
1032
        has_radio:      1,
1033
},{
1034
        /* Philip Blundell <pb@nexus.co.uk> */
1035
        name:           "Active Imaging AIMMS",
1036
        video_inputs:   1,
1037
        audio_inputs:   0,
1038
        tuner:          -1,
1039
        tuner_type:     -1,
1040
        pll:            PLL_28,
1041
        muxsel:         { 2 },
1042
        gpiomask:       0
1043
},{
1044
        /* Tomasz Pyra <hellfire@sedez.iq.pl> */
1045
        name:           "Pixelview PV-BT878P+ (Rev.4C)",
1046
        video_inputs:   3,
1047
        audio_inputs:   4,
1048
        tuner:          0,
1049
        svhs:           2,
1050
        gpiomask:       15,
1051
        muxsel:         { 2, 3, 1, 1},
1052
        audiomux:       { 0, 0, 11, 7, 13, 0},
1053
        needs_tvaudio:  1,
1054
        pll:            PLL_28,
1055
        tuner_type:     25,
1056
},{
1057
        name:           "Flyvideo 98EZ (capture only)",
1058
        video_inputs:   4,
1059
        audio_inputs:   0,
1060
        tuner:          -1,
1061
        svhs:           2,
1062
        muxsel:         { 2, 3, 1, 1}, // AV1, AV2, SVHS, CVid adapter on SVHS
1063
        pll:            PLL_28,
1064
        no_msp34xx:     1,
1065
},{
1066
 
1067
/* ---- card 0x48 ---------------------------------- */
1068
        /* Dariusz Kowalewski <darekk@automex.pl> */
1069
        name:           "Pixelview PV-BT878P+9B (PlayTV Pro rev.9B FM+NICAM)",
1070
        video_inputs:   3,
1071
        audio_inputs:   1,
1072
        tuner:          0,
1073
        svhs:           2,
1074
        gpiomask:       0x3f,
1075
        muxsel:         { 2, 3, 0, 1 },
1076
        audiomux:       { 0x01, 0x00, 0x03, 0x03, 0x09, 0x02 },
1077
        needs_tvaudio:  1,
1078
        no_msp34xx:     1,
1079
        no_tda9875:     1,
1080
        pll:            PLL_28,
1081
        tuner_type:     -1,
1082
        audio_hook:     pvbt878p9b_audio,
1083
        has_radio:      1,
1084
},{
1085
        /* Clay Kunz <ckunz@mail.arc.nasa.gov> */
1086
        /* you must jumper JP5 for the card to work */
1087
        name:           "Sensoray 311",
1088
        video_inputs:   5,
1089
        audio_inputs:   0,
1090
        tuner:          -1,
1091
        svhs:           4,
1092
        gpiomask:       0,
1093
        muxsel:         { 2, 3, 1, 0, 0},
1094
        audiomux:       { 0 },
1095
        needs_tvaudio:  0,
1096
        tuner_type:     -1,
1097
},{
1098
        /* Miguel Freitas <miguel@cetuc.puc-rio.br> */
1099
        name:           "RemoteVision MX (RV605)",
1100
        video_inputs:   16,
1101
        audio_inputs:   0,
1102
        tuner:          -1,
1103
        svhs:           -1,
1104
        gpiomask:       0x00,
1105
        gpiomask2:      0x07ff,
1106
        muxsel:         { 0x33, 0x13, 0x23, 0x43, 0xf3, 0x73, 0xe3, 0x03,
1107
                          0xd3, 0xb3, 0xc3, 0x63, 0x93, 0x53, 0x83, 0xa3 },
1108
        no_msp34xx:     1,
1109
        no_tda9875:     1,
1110
        tuner_type:     -1,
1111
        muxsel_hook:    rv605_muxsel,
1112
},{
1113
        name:           "Powercolor MTV878/ MTV878R/ MTV878F",
1114
        video_inputs:   3,
1115
        audio_inputs:   2,
1116
        tuner:          0,
1117
        svhs:           2,
1118
        gpiomask:       0x1C800F,  // Bit0-2: Audio select, 8-12:remote control 14:remote valid 15:remote reset
1119
        muxsel:         { 2, 1, 1, },
1120
        audiomux:       { 0, 1, 2, 2, 4 },
1121
        needs_tvaudio:  0,
1122
        tuner_type:     TUNER_PHILIPS_PAL,
1123
        pll:            PLL_28,
1124
        has_radio:      1,
1125
},{
1126
 
1127
/* ---- card 0x4c ---------------------------------- */
1128
        /* Masaki Suzuki <masaki@btree.org> */
1129
        name:           "Canopus WinDVR PCI (COMPAQ Presario 3524JP, 5112JP)",
1130
        video_inputs:   3,
1131
        audio_inputs:   1,
1132
        tuner:          0,
1133
        svhs:           2,
1134
        gpiomask:       0x140007,
1135
        muxsel:         { 2, 3, 1, 1 },
1136
        audiomux:       { 0, 1, 2, 3, 4, 0 },
1137
        tuner_type:     TUNER_PHILIPS_NTSC,
1138
        audio_hook:     windvr_audio,
1139
},{
1140
        name:           "GrandTec Multi Capture Card (Bt878)",
1141
        video_inputs:   4,
1142
        audio_inputs:   0,
1143
        tuner:          -1,
1144
        svhs:           -1,
1145
        gpiomask:       0,
1146
        muxsel:         { 2, 3, 1, 0 },
1147
        audiomux:       { 0 },
1148
        needs_tvaudio:  0,
1149
        no_msp34xx:     1,
1150
        pll:            PLL_28,
1151
        tuner_type:     -1,
1152
},{
1153
        /* http://www.aopen.com/products/video/va1000.htm */
1154
        name:           "AOPEN VA1000",
1155
        video_inputs:   3, /* coax, AV, s-vid */
1156
        audio_inputs:   1,
1157
        tuner:          0,
1158
        tuner_type:     TUNER_LG_PAL, /* actually TP18PSB12P (PAL B/G) */
1159
        audiomux:       { 2, 0, 0, 0 },
1160
        muxsel:         { 2, 3, 1, 0 },
1161
        pll:            PLL_28,
1162
},{
1163
        name:           "Osprey 100/150 (878)", /* 0x1(2|3)-45C6-C1 */
1164
        video_inputs:   4,                  /* id-inputs-clock */
1165
        audio_inputs:   0,
1166
        tuner:          -1,
1167
        svhs:           3,
1168
        muxsel:         { 3, 2, 0, 1 },
1169
        pll:            PLL_28,
1170
        tuner_type:     -1,
1171
        no_msp34xx:     1,
1172
        no_tda9875:     1,
1173
        no_tda7432:     1,
1174
},{
1175
/* ---- card 0x50 ---------------------------------- */
1176
        name:           "Osprey 100/150 (848)", /* 0x04-54C0-C1 & older boards */
1177
        video_inputs:   3,
1178
        audio_inputs:   0,
1179
        tuner:          -1,
1180
        svhs:           2,
1181
        muxsel:         { 2, 3, 1 },
1182
        pll:            PLL_28,
1183
        tuner_type:     -1,
1184
        no_msp34xx:     1,
1185
        no_tda9875:     1,
1186
        no_tda7432:     1,
1187
},{
1188
        name:           "Osprey 101 (848)", /* 0x05-40C0-C1 */
1189
        video_inputs:   2,
1190
        audio_inputs:   0,
1191
        tuner:          -1,
1192
        svhs:           1,
1193
        muxsel:         { 3, 1 },
1194
        pll:            PLL_28,
1195
        tuner_type:     -1,
1196
        no_msp34xx:     1,
1197
        no_tda9875:     1,
1198
        no_tda7432:     1,
1199
},{
1200
        name:           "Osprey 101/151",       /* 0x1(4|5)-0004-C4 */
1201
        video_inputs:   1,
1202
        audio_inputs:   0,
1203
        tuner:          -1,
1204
        svhs:           -1,
1205
        muxsel:         { 0 },
1206
        pll:            PLL_28,
1207
        tuner_type:     -1,
1208
        no_msp34xx:     1,
1209
        no_tda9875:     1,
1210
        no_tda7432:     1,
1211
},{
1212
        name:           "Osprey 101/151 w/ svid",  /* 0x(16|17|20)-00C4-C1 */
1213
        video_inputs:   2,
1214
        audio_inputs:   0,
1215
        tuner:          -1,
1216
        svhs:           1,
1217
        muxsel:         { 0, 1 },
1218
        pll:            PLL_28,
1219
        tuner_type:     -1,
1220
        no_msp34xx:     1,
1221
        no_tda9875:     1,
1222
        no_tda7432:     1,
1223
},{
1224
/* ---- card 0x54 ---------------------------------- */
1225
        name:           "Osprey 200/201/250/251",  /* 0x1(8|9|E|F)-0004-C4 */
1226
        video_inputs:   1,
1227
        audio_inputs:   1,
1228
        tuner:          -1,
1229
        svhs:           -1,
1230
        muxsel:         { 0 },
1231
        pll:            PLL_28,
1232
        tuner_type:     -1,
1233
        no_msp34xx:     1,
1234
        no_tda9875:     1,
1235
        no_tda7432:     1,
1236
},{
1237
        name:           "Osprey 200/250",   /* 0x1(A|B)-00C4-C1 */
1238
        video_inputs:   2,
1239
        audio_inputs:   1,
1240
        tuner:          -1,
1241
        svhs:           1,
1242
        muxsel:         { 0, 1 },
1243
        pll:            PLL_28,
1244
        tuner_type:     -1,
1245
        no_msp34xx:     1,
1246
        no_tda9875:     1,
1247
        no_tda7432:     1,
1248
},{
1249
        name:           "Osprey 210/220",   /* 0x1(A|B)-04C0-C1 */
1250
        video_inputs:   2,
1251
        audio_inputs:   1,
1252
        tuner:          -1,
1253
        svhs:           1,
1254
        muxsel:         { 2, 3 },
1255
        pll:            PLL_28,
1256
        tuner_type:     -1,
1257
        no_msp34xx:     1,
1258
        no_tda9875:     1,
1259
        no_tda7432:     1,
1260
},{
1261
        name:           "Osprey 5x0",   /* 500 and 540 */
1262
        video_inputs:   2,
1263
        audio_inputs:   1,
1264
        tuner:          -1,
1265
        svhs:           1,
1266
        muxsel:         { 0, 1 },
1267
        pll:            PLL_28,
1268
        tuner_type:     -1,
1269
        no_msp34xx:     1,
1270
        no_tda9875:     1,
1271
        no_tda7432:     1,
1272
},{
1273
/* ---- card 0x58 ---------------------------------- */
1274
        name:           "Osprey 2000",  /* 2000 */
1275
        video_inputs:   2,
1276
        audio_inputs:   1,
1277
        tuner:          -1,
1278
        svhs:           1,
1279
        muxsel:         { 2, 3 },
1280
        pll:            PLL_28,
1281
        tuner_type:     -1,
1282
        no_msp34xx:     1,
1283
        no_tda9875:     1,
1284
        no_tda7432:     1,      /* must avoid, conflicts with the bt860 */
1285
}};
1286
 
1287
const int bttv_num_tvcards = (sizeof(bttv_tvcards)/sizeof(struct tvcard));
1288
 
1289
/* ----------------------------------------------------------------------- */
1290
 
1291
static unsigned char eeprom_data[256];
1292
 
1293
/*
1294
 * identify card
1295
 */
1296
void bttv_idcard(struct bttv *btv)
1297
{
1298
        unsigned int gpiobits;
1299
        int i,type;
1300
        unsigned short tmp;
1301
 
1302
        /* read PCI subsystem ID */
1303
        pci_read_config_word(btv->dev, 2, &tmp);
1304
        btv->cardid = tmp << 16;
1305
        pci_read_config_word(btv->dev, 0, &tmp);
1306
        btv->cardid |= tmp;
1307
 
1308
        if (0 != btv->cardid && 0xffffffff != btv->cardid) {
1309
                /* look for the card */
1310
                for (type = -1, i = 0; cards[i].id != 0; i++)
1311
                        if (cards[i].id  == btv->cardid)
1312
                                type = i;
1313
 
1314
                if (type != -1) {
1315
                        /* found it */
1316
                        printk(KERN_INFO "bttv%d: %s [card=%d], "
1317
                               "PCI ID is %04x:%04x\n",
1318
                               btv->nr,cards[type].name,cards[type].cardnr,
1319
                               btv->cardid & 0xffff, btv->cardid >> 16);
1320
                        btv->type = cards[type].cardnr;
1321
                } else {
1322
                        /* 404 */
1323
                        printk(KERN_INFO "bttv%d: subsystem: %04x:%04x (UNKNOWN)\n",
1324
                               btv->nr, btv->cardid&0xffff, btv->cardid>>16);
1325
                }
1326
        }
1327
 
1328
        /* let the user override the autodetected type */
1329
        if (card[btv->nr] >= 0 && card[btv->nr] < bttv_num_tvcards)
1330
                btv->type=card[btv->nr];
1331
 
1332
        /* print which card config we are using */
1333
        sprintf(btv->video_dev.name,"BT%d%s(%.23s)",
1334
                btv->id,
1335
                (btv->id==848 && btv->revision==0x12) ? "A" : "",
1336
                bttv_tvcards[btv->type].name);
1337
        printk(KERN_INFO "bttv%d: using: %s [card=%d,%s]\n",btv->nr,
1338
               btv->video_dev.name,btv->type,
1339
               (card[btv->nr] >= 0 && card[btv->nr] < bttv_num_tvcards) ?
1340
               "insmod option" : "autodetected");
1341
 
1342
        /* overwrite gpio stuff ?? */
1343
        if (-1 == audioall && -1 == audiomux[0])
1344
                return;
1345
 
1346
        if (-1 != audiomux[0]) {
1347
                gpiobits = 0;
1348
                for (i = 0; i < 5; i++) {
1349
                        bttv_tvcards[btv->type].audiomux[i] = audiomux[i];
1350
                        gpiobits |= audiomux[i];
1351
                }
1352
        } else {
1353
                gpiobits = audioall;
1354
                for (i = 0; i < 5; i++) {
1355
                        bttv_tvcards[btv->type].audiomux[i] = audioall;
1356
                }
1357
        }
1358
        bttv_tvcards[btv->type].gpiomask = (-1 != gpiomask) ? gpiomask : gpiobits;
1359
        cprintf("[info  ] bttv%d: gpio config override: mask=0x%lx, mux=",
1360
               btv->nr,bttv_tvcards[btv->type].gpiomask);
1361
        for (i = 0; i < 5; i++) {
1362
                cprintf("%s0x%lx", i ? "," : "", bttv_tvcards[btv->type].audiomux[i]);
1363
        }
1364
        cprintf("\n");
1365
}
1366
 
1367
/*
1368
 * (most) board specific initialisations goes here
1369
 */
1370
 
1371
static void flyvideo_gpio(struct bttv *btv)
1372
{
1373
        int gpio,outbits;
1374
        int tuner=-1,ttype;
1375
 
1376
        outbits = btread(BT848_GPIO_OUT_EN);
1377
        btwrite(0x00, BT848_GPIO_OUT_EN);
1378
        udelay(8);  // without this we would see the 0x1800 mask
1379
        gpio=gpioread();
1380
        btwrite(outbits, BT848_GPIO_OUT_EN);
1381
        // all cards provide GPIO info, some have an additional eeprom
1382
 
1383
        // lowest 3 bytes are remote control codes (no handshake needed)
1384
        ttype=(gpio&0x0f0000)>>16;
1385
        switch(ttype) {
1386
        case 0: tuner=4; // None
1387
                break;
1388
        case 4: tuner=5; // Philips PAL
1389
                break;
1390
        case 6: tuner=37; // LG PAL (newer TAPC series)
1391
                break;
1392
        case 0xC: tuner=3; // Philips SECAM(+PAL)
1393
                break;
1394
        default:
1395
                printk(KERN_INFO "bttv%d: flyvideo_gpio: unknown tuner type.\n", btv->nr);
1396
        }
1397
 
1398
        printk(KERN_INFO "bttv%d: Flyvideo Radio=%s RemoteControl=%s Tuner=%d gpio=0x%06x\n",
1399
               btv->nr,
1400
               gpio&0x400000? "yes":"no",
1401
               gpio&0x800000? "yes":"no", tuner, gpio);
1402
 
1403
        btv->tuner_type = tuner;
1404
        btv->has_radio = gpio&0x400000? 1:0;
1405
}
1406
 
1407
int miro_tunermap[] = { 0,6,2,3,   4,5,6,0,  3,0,4,5,  5,2,16,1,
1408
                        14,2,17,1, 4,1,4,3,  1,2,16,1, 4,4,4,4 };
1409
int miro_fmtuner[]  = { 0,0,0,0,   0,0,0,0,  0,0,0,0,  0,0,0,1,
1410
                        1,1,1,1,   1,1,1,0,  0,0,0,0,  0,0,0,0 };
1411
 
1412
/* initialization part one -- before registering i2c bus */
1413
void bttv_init_card1(struct bttv *btv)
1414
{
1415
        if (btv->type == BTTV_HAUPPAUGE || btv->type == BTTV_HAUPPAUGE878)
1416
                boot_msp34xx(btv,5);
1417
        if (btv->type == BTTV_VOODOOTV_FM)
1418
                boot_msp34xx(btv,20);
1419
 
1420
        /*printk("bttv: end of init -- pre i2c\n");*/
1421
}
1422
 
1423
/* initialization part one -- after registering i2c bus */
1424
void bttv_init_card2(struct bttv *btv)
1425
{
1426
        /* miro/pinnacle */
1427
        if (btv->type == BTTV_MIRO      ||
1428
            btv->type == BTTV_MIROPRO   ||
1429
            btv->type == BTTV_PINNACLE  ||
1430
            btv->type == BTTV_PINNACLEPRO) {
1431
                int id,msp;
1432
                id  = ((gpioread()>>10) & 31) -1;
1433
                msp = bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx");
1434
                btv->tuner_type = miro_tunermap[id];
1435
                if (0 == (gpioread() & 0x20)) {
1436
                        btv->has_radio = 1;
1437
                        if (!miro_fmtuner[id]) {
1438
                                btv->has_matchbox = 1;
1439
                                btv->mbox_we    = (1<<6);
1440
                                btv->mbox_most  = (1<<7);
1441
                                btv->mbox_clk   = (1<<8);
1442
                                btv->mbox_data  = (1<<9);
1443
                                btv->mbox_mask  = (1<<6)|(1<<7)|(1<<8)|(1<<9);
1444
                        }
1445
                } else {
1446
                        btv->has_radio = 0;
1447
                }
1448
                if (-1 != msp) {
1449
                        if (btv->type == BTTV_MIRO)
1450
                                btv->type = BTTV_MIROPRO;
1451
                        if (btv->type == BTTV_PINNACLE)
1452
                                btv->type = BTTV_PINNACLEPRO;
1453
                }
1454
                if (bttv_verbose)
1455
                        printk(KERN_INFO "bttv%d: miro: id=%d tuner=%d "
1456
                               "radio=%s stereo=%s\n",
1457
                               btv->nr, id+1, btv->tuner_type,
1458
                               !btv->has_radio ? "no" :
1459
                                   (btv->has_matchbox ? "matchbox" : "fmtuner"),
1460
                               (-1 == msp) ? "no" : "yes");
1461
#if 0
1462
                if (btv->has_matchbox) {
1463
                        if (bttv_verbose)
1464
                                printk(KERN_INFO "Initializing TEA5757...\n");
1465
                        init_tea5757(btv);
1466
                }
1467
#endif
1468
        }
1469
 
1470
        if (btv->type == BTTV_FLYVIDEO_98    ||
1471
            btv->type == BTTV_FLYVIDEO       ||
1472
            btv->type == BTTV_TYPHOON_TVIEW  ||
1473
            btv->type == BTTV_CHRONOS_VS2    ||
1474
            btv->type == BTTV_FLYVIDEO_98FM  ||
1475
            btv->type == BTTV_FLYVIDEO2000   ||
1476
            btv->type == BTTV_FLYVIDEO98EZ)
1477
                flyvideo_gpio(btv);
1478
 
1479
        if (btv->type == BTTV_HAUPPAUGE || btv->type == BTTV_HAUPPAUGE878) {
1480
                /* pick up some config infos from the eeprom */
1481
                bttv_readee(btv,eeprom_data,0xa0);
1482
                hauppauge_eeprom(btv);
1483
        }
1484
 
1485
        if ((btv->type >= BTTV_OSPREY_BEGIN) && (btv->type <= BTTV_OSPREY_END)) {
1486
                /* check for config info in the eeprom */
1487
                bttv_readee(btv,eeprom_data,0xa0);
1488
                osprey_eeprom(btv);
1489
        }
1490
 
1491
        if (btv->type == BTTV_AVERMEDIA98 || btv->type == BTTV_AVPHONE98) {
1492
                bttv_readee(btv,eeprom_data,0xa0);
1493
                avermedia_eeprom(btv);
1494
        }
1495
 
1496
        if (btv->type == BTTV_PXC200)
1497
                init_PXC200(btv);
1498
 
1499
        if (btv->type == BTTV_VHX) {
1500
                btv->has_radio    = 1;
1501
                btv->has_matchbox = 1;
1502
                btv->mbox_we      = 0x20;
1503
                btv->mbox_most    = 0;
1504
                btv->mbox_clk     = 0x08;
1505
                btv->mbox_data    = 0x10;
1506
                btv->mbox_mask    = 0x38;
1507
        }
1508
 
1509
        if (btv->type == BTTV_LIFETEC_9415) {
1510
                if (gpioread() & 0x4000)
1511
                        cprintf("bttv%d: lifetec: tv mono/fm stereo card\n", btv->nr);
1512
                else
1513
                        cprintf("bttv%d: lifetec: stereo(TDA9821) card\n",btv->nr);
1514
        }
1515
 
1516
        if (btv->type == BTTV_MAGICTVIEW061) {
1517
                if(btv->cardid == 0x4002144f) {
1518
                        btv->has_radio=1;
1519
                        cprintf("bttv%d: radio detected by subsystem id (CPH05x)\n",btv->nr);
1520
                }
1521
        }
1522
 
1523
        /* pll configuration */
1524
        if (!(btv->id==848 && btv->revision==0x11)) {
1525
                /* defaults from card list */
1526
                if (PLL_28 == bttv_tvcards[btv->type].pll) {
1527
                        btv->pll.pll_ifreq=28636363;
1528
                        btv->pll.pll_crystal=BT848_IFORM_XT0;
1529
                }
1530
                if (PLL_35 == bttv_tvcards[btv->type].pll) {
1531
                        btv->pll.pll_ifreq=35468950;
1532
                        btv->pll.pll_crystal=BT848_IFORM_XT1;
1533
                }
1534
                /* insmod options can override */
1535
                switch (pll[btv->nr]) {
1536
                case 0: /* none */
1537
                        btv->pll.pll_crystal = 0;
1538
                        btv->pll.pll_ifreq   = 0;
1539
                        btv->pll.pll_ofreq   = 0;
1540
                        break;
1541
                case 1: /* 28 MHz */
1542
                case 28:
1543
                        btv->pll.pll_ifreq   = 28636363;
1544
                        btv->pll.pll_ofreq   = 0;
1545
                        btv->pll.pll_crystal = BT848_IFORM_XT0;
1546
                        break;
1547
                case 2: /* 35 MHz */
1548
                case 35:
1549
                        btv->pll.pll_ifreq   = 35468950;
1550
                        btv->pll.pll_ofreq   = 0;
1551
                        btv->pll.pll_crystal = BT848_IFORM_XT1;
1552
                        break;
1553
                }
1554
        }
1555
 
1556
        /* tuner configuration (from card list / insmod option) */
1557
        if (-1 != bttv_tvcards[btv->type].tuner_type)
1558
                btv->tuner_type = bttv_tvcards[btv->type].tuner_type;
1559
        if (-1 != tuner[btv->nr])
1560
                btv->tuner_type = tuner[btv->nr];
1561
 
1562
        if (bttv_tvcards[btv->type].has_radio)
1563
                btv->has_radio=1;
1564
 
1565
        /* try to detect audio/fader chips */
1566
        if (!bttv_tvcards[btv->type].no_msp34xx &&
1567
            bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx") >=0) {
1568
        }
1569
 
1570
        if (!bttv_tvcards[btv->type].no_tda9875 &&
1571
            bttv_I2CRead(btv, I2C_TDA9875, "TDA9875") >=0) {
1572
        }
1573
 
1574
        if (!bttv_tvcards[btv->type].no_tda7432 &&
1575
            bttv_I2CRead(btv, I2C_TDA7432, "TDA7432") >=0) {
1576
        }
1577
 
1578
        if (bttv_tvcards[btv->type].needs_tvaudio) {
1579
        }
1580
 
1581
        if (bttv_tvcards[btv->type].tuner != -1) {
1582
        }
1583
}
1584
 
1585
 
1586
/* ----------------------------------------------------------------------- */
1587
/* some hauppauge specific stuff                                           */
1588
 
1589
static struct HAUPPAUGE_TUNER
1590
{
1591
        int  id;
1592
        char *name;
1593
}
1594
hauppauge_tuner[] =
1595
{
1596
        { TUNER_ABSENT,        "" },
1597
        { TUNER_ABSENT,        "External" },
1598
        { TUNER_ABSENT,        "Unspecified" },
1599
        { TUNER_PHILIPS_PAL,   "Philips FI1216" },
1600
        { TUNER_PHILIPS_SECAM, "Philips FI1216MF" },
1601
        { TUNER_PHILIPS_NTSC,  "Philips FI1236" },
1602
        { TUNER_PHILIPS_PAL_I, "Philips FI1246" },
1603
        { TUNER_PHILIPS_PAL_DK,"Philips FI1256" },
1604
        { TUNER_PHILIPS_PAL,   "Philips FI1216 MK2" },
1605
        { TUNER_PHILIPS_SECAM, "Philips FI1216MF MK2" },
1606
        { TUNER_PHILIPS_NTSC,  "Philips FI1236 MK2" },
1607
        { TUNER_PHILIPS_PAL_I, "Philips FI1246 MK2" },
1608
        { TUNER_PHILIPS_PAL_DK,"Philips FI1256 MK2" },
1609
        { TUNER_TEMIC_NTSC,    "Temic 4032FY5" },
1610
        { TUNER_TEMIC_PAL,     "Temic 4002FH5" },
1611
        { TUNER_TEMIC_PAL_I,   "Temic 4062FY5" },
1612
        { TUNER_PHILIPS_PAL,   "Philips FR1216 MK2" },
1613
        { TUNER_PHILIPS_SECAM, "Philips FR1216MF MK2" },
1614
        { TUNER_PHILIPS_NTSC,  "Philips FR1236 MK2" },
1615
        { TUNER_PHILIPS_PAL_I, "Philips FR1246 MK2" },
1616
        { TUNER_PHILIPS_PAL_DK,"Philips FR1256 MK2" },
1617
        { TUNER_PHILIPS_PAL,   "Philips FM1216" },
1618
        { TUNER_PHILIPS_SECAM, "Philips FM1216MF" },
1619
        { TUNER_PHILIPS_NTSC,  "Philips FM1236" },
1620
        { TUNER_PHILIPS_PAL_I, "Philips FM1246" },
1621
        { TUNER_PHILIPS_PAL_DK,"Philips FM1256" },
1622
        { TUNER_TEMIC_4036FY5_NTSC, "Temic 4036FY5" },
1623
        { TUNER_ABSENT,        "Samsung TCPN9082D" },
1624
        { TUNER_ABSENT,        "Samsung TCPM9092P" },
1625
        { TUNER_TEMIC_4006FH5_PAL, "Temic 4006FH5" },
1626
        { TUNER_ABSENT,        "Samsung TCPN9085D" },
1627
        { TUNER_ABSENT,        "Samsung TCPB9085P" },
1628
        { TUNER_ABSENT,        "Samsung TCPL9091P" },
1629
        { TUNER_TEMIC_4039FR5_NTSC, "Temic 4039FR5" },
1630
        { TUNER_PHILIPS_FQ1216ME,   "Philips FQ1216 ME" },
1631
        { TUNER_TEMIC_4066FY5_PAL_I, "Temic 4066FY5" },
1632
        { TUNER_ABSENT,        "Philips TD1536" },
1633
        { TUNER_ABSENT,        "Philips TD1536D" },
1634
        { TUNER_PHILIPS_NTSC,  "Philips FMR1236" }, /* mono radio */
1635
        { TUNER_ABSENT,        "Philips FI1256MP" },
1636
        { TUNER_ABSENT,        "Samsung TCPQ9091P" },
1637
        { TUNER_TEMIC_4006FN5_MULTI_PAL, "Temic 4006FN5" },
1638
        { TUNER_TEMIC_4009FR5_PAL, "Temic 4009FR5" },
1639
        { TUNER_TEMIC_4046FM5,     "Temic 4046FM5" },
1640
        { TUNER_TEMIC_4009FN5_MULTI_PAL_FM, "Temic 4009FN5" },
1641
        { TUNER_ABSENT,        "Philips TD1536D_FH_44"},
1642
        { TUNER_LG_NTSC_FM,    "LG TP18NSR01F"},
1643
        { TUNER_LG_PAL_FM,     "LG TP18PSB01D"},
1644
        { TUNER_LG_PAL,        "LG TP18PSB11D"},       
1645
        { TUNER_LG_PAL_I_FM,   "LG TAPC-I001D"},
1646
        { TUNER_LG_PAL_I,      "LG TAPC-I701D"}
1647
};
1648
 
1649
static void hauppauge_eeprom(struct bttv *btv)
1650
{
1651
        int blk2,tuner,radio,model;
1652
 
1653
        if (eeprom_data[0] != 0x84 || eeprom_data[2] != 0)
1654
                printk(KERN_WARNING "bttv%d: Hauppauge eeprom: invalid\n",
1655
                       btv->nr);
1656
 
1657
        /* Block 2 starts after len+3 bytes header */
1658
        blk2 = eeprom_data[1] + 3;
1659
 
1660
        /* decode + use some config infos */
1661
        model = eeprom_data[12] << 8 | eeprom_data[11];
1662
        tuner = eeprom_data[9];
1663
        radio = eeprom_data[blk2-1] & 0x01;
1664
 
1665
        if (tuner < sizeof(hauppauge_tuner)/sizeof(struct HAUPPAUGE_TUNER))
1666
                btv->tuner_type = hauppauge_tuner[tuner].id;
1667
        if (radio)
1668
                btv->has_radio = 1;
1669
 
1670
        if (bttv_verbose)
1671
                printk(KERN_INFO "bttv%d: Hauppauge eeprom: model=%d, "
1672
                       "tuner=%s (%d), radio=%s\n",
1673
                       btv->nr, model, hauppauge_tuner[tuner].name,
1674
                       btv->tuner_type, radio ? "yes" : "no");
1675
}
1676
 
1677
static void osprey_eeprom(struct bttv *btv)
1678
{
1679
    int i = 0;
1680
    int detected_type = btv->type;
1681
    unsigned char *ee = eeprom_data;
1682
    unsigned long serial = 0;
1683
 
1684
    if (bttv_debug) {
1685
        printk(KERN_INFO "Osprey: EEPROM dump\n");
1686
        for(;i<256; i+= 16) {
1687
            cprintf("[info  ] Osprey 100:(%02X) %02X %02X %02X %02X %02X %02X %02X %02X -- %02X %02X %02X %02X %02X %02X %02X %02X\n",
1688
                    i,ee[i+ 0],ee[i+ 1],ee[i+ 2],ee[i+ 3],
1689
                      ee[i+ 4],ee[i+ 5],ee[i+ 6],ee[i+ 7],
1690
                      ee[i+ 8],ee[i+ 9],ee[i+10],ee[i+11],
1691
                      ee[i+12],ee[i+13],ee[i+14],ee[i+15] );
1692
        }
1693
    }
1694
 
1695
    if (btv->type == 0) {
1696
        /* this might be an antique...check for MMAC label in eeprom */
1697
        if ((ee[0]=='M') && (ee[1]=='M') && (ee[2]=='A') && (ee[3]=='C')) {
1698
            unsigned char checksum = 0;
1699
            /* that looks like an old card...verify checksum */
1700
            for (i =0; i<21; i++) checksum += ee[i];
1701
            if (checksum == ee[21]) {
1702
                btv->type = BTTV_OSPREY1x0_848;
1703
                for (i = 12; i < 21; i++) serial *= 10,serial += ee[i] - '0';
1704
            }
1705
        }
1706
    } else {
1707
        /* we know this is an osprey card, find a valid eeprom descriptor */
1708
        int offset = 4*16;
1709
 
1710
        for(; offset < 8*16; offset += 16) {
1711
            unsigned short checksum = 0;
1712
            /* verify the checksum */
1713
            for(i = 0; i<14; i++) checksum += ee[i+offset];
1714
            checksum = ~checksum;  /* no idea why */
1715
            if ((((checksum>>8) & 0x0FF) == ee[offset+14]) &&
1716
                ((checksum & 0x0FF) == ee[offset+15])) {
1717
                break;
1718
            }
1719
        }
1720
 
1721
        if (offset < 8*16) {
1722
            /* found a valid descriptor */
1723
            unsigned short type = (ee[offset+4]<<8) | (ee[offset+5]);
1724
 
1725
            switch(type) {
1726
                /* 848 based */
1727
                case 0x0004: {
1728
                    btv->type = BTTV_OSPREY1x0_848;
1729
                    break;
1730
                }
1731
                case 0x0005: {
1732
                    btv->type = BTTV_OSPREY101_848;
1733
                    break;
1734
                }
1735
                /* 878 based */
1736
                case 0x0012:
1737
                case 0x0013: {
1738
                    btv->type = BTTV_OSPREY1x0;
1739
                    break;
1740
                }
1741
                case 0x0014:
1742
                case 0x0015: {
1743
                    btv->type = BTTV_OSPREY1x1;
1744
                    break;
1745
                }
1746
                case 0x0016:
1747
                case 0x0017:
1748
                case 0x0020: {
1749
                    btv->type = BTTV_OSPREY1x1_SVID;
1750
                    break;
1751
                }
1752
                case 0x0018:
1753
                case 0x0019:
1754
                case 0x001E:
1755
                case 0x001F: {
1756
                    btv->type = BTTV_OSPREY2xx;
1757
                    break;
1758
                }
1759
                case 0x001A:
1760
                case 0x001B: {
1761
                    btv->type = BTTV_OSPREY2x0_SVID;
1762
                    break;
1763
                }
1764
                case 0x0060:
1765
                case 0x0070: {
1766
                    btv->type = BTTV_OSPREY2x0;
1767
                    //enable output on select control lines
1768
                    btwrite(0x000303, BT848_GPIO_OUT_EN);
1769
                    break;
1770
                }
1771
                default: {
1772
                    /* unknown...leave as generic, but get a serial # */
1773
                    break;
1774
                }
1775
            }
1776
 
1777
            serial =   (ee[offset+6] << 24)
1778
                     | (ee[offset+7] << 16)
1779
                     | (ee[offset+8] <<  8)
1780
                     | (ee[offset+9]);
1781
        }
1782
    }
1783
 
1784
    if ((btv->type != detected_type) || (serial != 0)){
1785
        /* reprint which card config we are using */
1786
        sprintf(btv->video_dev.name,"BT%d%s(%.23s)",
1787
                btv->id,
1788
                (btv->id==848 && btv->revision==0x12) ? "A" : "",
1789
                bttv_tvcards[btv->type].name);
1790
        printk(KERN_INFO "bttv%d: is now:%s [card=%d,%s] Serial#: %ld\n",
1791
               btv->nr,
1792
               btv->video_dev.name,
1793
               btv->type,
1794
               (card[btv->nr] >= 0 && card[btv->nr] < bttv_num_tvcards) ?
1795
               "insmod option" : "autodetected",
1796
               serial);
1797
    }
1798
}
1799
 
1800
 
1801
/* ----------------------------------------------------------------------- */
1802
/* AVermedia specific stuff, from  bktr_card.c                             */
1803
 
1804
int tuner_0_table[] = {
1805
        TUNER_PHILIPS_NTSC,  TUNER_PHILIPS_PAL,
1806
        TUNER_PHILIPS_PAL,   TUNER_PHILIPS_PAL,
1807
        TUNER_PHILIPS_PAL,   TUNER_PHILIPS_PAL,
1808
        TUNER_PHILIPS_SECAM, TUNER_PHILIPS_SECAM,
1809
        TUNER_PHILIPS_SECAM, TUNER_PHILIPS_PAL};
1810
#if 0
1811
int tuner_0_fm_table[] = {
1812
        PHILIPS_FR1236_NTSC,  PHILIPS_FR1216_PAL,
1813
        PHILIPS_FR1216_PAL,   PHILIPS_FR1216_PAL,
1814
        PHILIPS_FR1216_PAL,   PHILIPS_FR1216_PAL,
1815
        PHILIPS_FR1236_SECAM, PHILIPS_FR1236_SECAM,
1816
        PHILIPS_FR1236_SECAM, PHILIPS_FR1216_PAL};
1817
#endif
1818
 
1819
int tuner_1_table[] = {
1820
        TUNER_TEMIC_NTSC,  TUNER_TEMIC_PAL,
1821
        TUNER_TEMIC_PAL,   TUNER_TEMIC_PAL,
1822
        TUNER_TEMIC_PAL,   TUNER_TEMIC_PAL,
1823
        TUNER_TEMIC_4012FY5, TUNER_TEMIC_4012FY5, //TUNER_TEMIC_SECAM
1824
        TUNER_TEMIC_4012FY5, TUNER_TEMIC_PAL};
1825
 
1826
static void avermedia_eeprom(struct bttv *btv)
1827
{
1828
        int tuner_make,tuner_tv_fm,tuner_format,tuner=0,remote;
1829
 
1830
        tuner_make   = (eeprom_data[0x41] & 0x7);
1831
        tuner_tv_fm  = (eeprom_data[0x41] & 0x18) >> 3;
1832
        tuner_format = (eeprom_data[0x42] & 0xf0) >> 4;
1833
        remote       = (eeprom_data[0x42] & 0x01);
1834
 
1835
        if (tuner_make == 0 || tuner_make == 2)
1836
                if(tuner_format <=9)
1837
                        tuner = tuner_0_table[tuner_format];
1838
        if (tuner_make == 1)
1839
                if(tuner_format <=9)
1840
                        tuner = tuner_1_table[tuner_format];
1841
 
1842
        cprintf("[info  ] bttv%d: Avermedia eeprom[0x%02x%02x]: tuner=",
1843
                btv->nr,eeprom_data[0x41],eeprom_data[0x42]);
1844
        if(tuner) {
1845
                btv->tuner_type=tuner;
1846
                cprintf("%d",tuner);
1847
        } else
1848
                cprintf("Unknown type");
1849
        cprintf(" radio:%s remote control:%s\n",
1850
                tuner_tv_fm?"yes":"no",
1851
                remote?"yes":"no");
1852
}
1853
 
1854
/* used on Voodoo TV/FM (Voodoo 200), S0 wired to 0x10000 */
1855
void bttv_tda9880_setnorm(struct bttv *btv, int norm)
1856
{
1857
        // fix up our card entry
1858
        if(norm==VIDEO_MODE_NTSC) {
1859
                bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[0]=0x957fff;
1860
                bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[4]=0x957fff;
1861
                dprintk("bttv_tda9880_setnorm to NTSC\n");
1862
        }
1863
        else {
1864
                bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[0]=0x947fff;
1865
                bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[4]=0x947fff;
1866
                dprintk("bttv_tda9880_setnorm to PAL\n");
1867
        }
1868
        // set GPIO according
1869
        gpioaor(bttv_tvcards[btv->type].audiomux[btv->audio],
1870
              ~bttv_tvcards[btv->type].gpiomask);
1871
}
1872
 
1873
 
1874
/*
1875
 * reset/enable the MSP on some Hauppauge cards
1876
 * Thanks to Kyösti Mälkki (kmalkki@cc.hut.fi)!
1877
 *
1878
 * Hauppauge:  pin  5
1879
 * Voodoo:     pin 20
1880
 */
1881
static void boot_msp34xx(struct bttv *btv, int pin)
1882
{
1883
        int mask = (1 << pin);
1884
 
1885
        btor(mask, BT848_GPIO_OUT_EN);
1886
        gpioand(~mask);
1887
        udelay(2500);
1888
        gpioor(mask);
1889
        if (bttv_gpio)
1890
                bttv_gpio_tracking(btv,"msp34xx");
1891
 
1892
        if (bttv_verbose)
1893
                printk(KERN_INFO "bttv%d: Hauppauge/Voodoo msp34xx: reset line "
1894
                       "init [%d]\n", btv->nr, pin);
1895
}
1896
 
1897
 
1898
/* ----------------------------------------------------------------------- */
1899
/*  Imagenation L-Model PXC200 Framegrabber */
1900
/*  This is basically the same procedure as
1901
 *  used by Alessandro Rubini in his pxc200
1902
 *  driver, but using BTTV functions */
1903
 
1904
static void init_PXC200(struct bttv *btv)
1905
{
1906
        /* Initialise GPIO-connevted stuff */
1907
        btwrite(1<<13,BT848_GPIO_OUT_EN); /* Reset pin only */
1908
        gpiowrite(0);
1909
        udelay(3);
1910
        gpiowrite(1<<13);
1911
        /* GPIO inputs are pulled up, so no need to drive
1912
         * reset pin any longer */
1913
        btwrite(0,BT848_GPIO_OUT_EN);
1914
        if (bttv_gpio)
1915
                bttv_gpio_tracking(btv,"pxc200");
1916
 
1917
        /*  we could/should try and reset/control the AD pots? but
1918
            right now  we simply  turned off the crushing.  Without
1919
            this the AGC drifts drifts
1920
            remember the EN is reverse logic -->
1921
            setting BT848_ADC_AGC_EN disable the AGC
1922
            tboult@eecs.lehigh.edu
1923
        */
1924
        btwrite(BT848_ADC_RESERVED|BT848_ADC_AGC_EN, BT848_ADC);
1925
 
1926
        /*      Initialise MAX517 DAC */
1927
        printk(KERN_INFO "Setting DAC reference voltage level ...\n");
1928
        bttv_I2CWrite(btv,0x5E,0,0x80,1);
1929
 
1930
        /*      Initialise 12C508 PIC */
1931
        /*      The I2CWrite and I2CRead commmands are actually to the
1932
         *      same chips - but the R/W bit is included in the address
1933
         *      argument so the numbers are different */
1934
 
1935
        printk(KERN_INFO "PXC200 Initialised.\n");
1936
}
1937
 
1938
/* ----------------------------------------------------------------------- */
1939
/* Miro Pro radio stuff -- the tea5757 is connected to some GPIO ports     */
1940
/*
1941
 * Copyright (c) 1999 Csaba Halasz <qgehali@uni-miskolc.hu>
1942
 * This code is placed under the terms of the GNU General Public License
1943
 *
1944
 * Brutally hacked by Dan Sheridan <dan.sheridan@contact.org.uk> djs52 8/3/00
1945
 */
1946
 
1947
#if 0
1948
/* bus bits on the GPIO port */
1949
#define TEA_WE                  6
1950
#define TEA_DATA                9
1951
#define TEA_CLK                 8
1952
#define TEA_MOST                7
1953
#endif
1954
 
1955
#define BUS_LOW(bit)    gpioand(~(bit))
1956
#define BUS_HIGH(bit)   gpioor((bit))
1957
#define BUS_IN(bit)     (gpioread() & (bit))
1958
 
1959
/* TEA5757 register bits */
1960
#define TEA_FREQ                0:14
1961
#define TEA_BUFFER              15:15
1962
 
1963
#define TEA_SIGNAL_STRENGTH     16:17
1964
 
1965
#define TEA_PORT1               18:18
1966
#define TEA_PORT0               19:19
1967
 
1968
#define TEA_BAND                20:21
1969
#define TEA_BAND_FM             0
1970
#define TEA_BAND_MW             1
1971
#define TEA_BAND_LW             2
1972
#define TEA_BAND_SW             3
1973
 
1974
#define TEA_MONO                22:22
1975
#define TEA_ALLOW_STEREO        0
1976
#define TEA_FORCE_MONO          1
1977
 
1978
#define TEA_SEARCH_DIRECTION    23:23
1979
#define TEA_SEARCH_DOWN         0
1980
#define TEA_SEARCH_UP           1
1981
 
1982
#define TEA_STATUS              24:24
1983
#define TEA_STATUS_TUNED        0
1984
#define TEA_STATUS_SEARCHING    1
1985
 
1986
/* ----------------------------------------------------------------------- */
1987
/* winview                                                                 */
1988
 
1989
void winview_audio(struct bttv *btv, struct video_audio *v, int set)
1990
{
1991
        /* PT2254A programming Jon Tombs, jon@gte.esi.us.es */
1992
        int bits_out, loops, vol, data;
1993
 
1994
        if (!set) {
1995
                /* Fixed by Leandro Lucarella <luca@linuxmendoza.org.ar (07/31/01) */
1996
                v->flags |= VIDEO_AUDIO_VOLUME;
1997
                return;
1998
        }
1999
 
2000
        /* 32 levels logarithmic */
2001
        vol = 32 - ((v->volume>>11));
2002
        /* units */
2003
        bits_out = (PT2254_DBS_IN_2>>(vol%5));
2004
        /* tens */
2005
        bits_out |= (PT2254_DBS_IN_10>>(vol/5));
2006
        bits_out |= PT2254_L_CHANNEL | PT2254_R_CHANNEL;
2007
        data = gpioread();
2008
        data &= ~(WINVIEW_PT2254_CLK| WINVIEW_PT2254_DATA|
2009
                  WINVIEW_PT2254_STROBE);
2010
        for (loops = 17; loops >= 0 ; loops--) {
2011
                if (bits_out & (1<<loops))
2012
                        data |=  WINVIEW_PT2254_DATA;
2013
                else
2014
                        data &= ~WINVIEW_PT2254_DATA;
2015
                gpiowrite(data);
2016
                udelay(5);
2017
                data |= WINVIEW_PT2254_CLK;
2018
                gpiowrite(data);
2019
                udelay(5);
2020
                data &= ~WINVIEW_PT2254_CLK;
2021
                gpiowrite(data);
2022
        }
2023
        data |=  WINVIEW_PT2254_STROBE;
2024
        data &= ~WINVIEW_PT2254_DATA;
2025
        gpiowrite(data);
2026
        udelay(10);                    
2027
        data &= ~WINVIEW_PT2254_STROBE;
2028
        gpiowrite(data);
2029
}
2030
 
2031
/* ----------------------------------------------------------------------- */
2032
/* mono/stereo control for various cards (which don't use i2c chips but    */
2033
/* connect something to the GPIO pins                                      */
2034
 
2035
static void
2036
gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set)
2037
{
2038
        unsigned int con = 0;
2039
 
2040
        if (set) {
2041
                btor(0x300, BT848_GPIO_OUT_EN);
2042
                if (v->mode & VIDEO_SOUND_LANG1)
2043
                        con = 0x000;
2044
                if (v->mode & VIDEO_SOUND_LANG2)
2045
                        con = 0x300;
2046
                if (v->mode & VIDEO_SOUND_STEREO)
2047
                        con = 0x200;
2048
//              if (v->mode & VIDEO_SOUND_MONO)
2049
//                      con = 0x100;
2050
                gpioaor(con, ~0x300);
2051
        } else {
2052
                v->mode = VIDEO_SOUND_STEREO |
2053
                          VIDEO_SOUND_LANG1  | VIDEO_SOUND_LANG2;
2054
        }
2055
}
2056
 
2057
/*
2058
 * Mario Medina Nussbaum <medisoft@alohabbs.org.mx>
2059
 *  I discover that on BT848_GPIO_DATA address a byte 0xcce enable stereo,
2060
 *  0xdde enables mono and 0xccd enables sap
2061
 *
2062
 * Petr Vandrovec <VANDROVE@vc.cvut.cz>
2063
 *  P.S.: At least mask in line above is wrong - GPIO pins 3,2 select
2064
 *  input/output sound connection, so both must be set for output mode.
2065
 *
2066
 * Looks like it's needed only for the "tvphone", the "tvphone 98"
2067
 * handles this with a tda9840
2068
 *
2069
 */
2070
static void
2071
avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, int set)
2072
{
2073
        int val = 0;
2074
 
2075
        if (set) {
2076
                if (v->mode & VIDEO_SOUND_LANG1)   /* SAP */
2077
                        val = 0x02;
2078
                if (v->mode & VIDEO_SOUND_STEREO)
2079
                        val = 0x01;
2080
                if (val) {
2081
                        gpioaor(val, ~0x03);
2082
                        if (bttv_gpio)
2083
                                bttv_gpio_tracking(btv,"avermedia");
2084
                }
2085
        } else {
2086
                v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
2087
                        VIDEO_SOUND_LANG1;
2088
                return;
2089
        }
2090
}
2091
 
2092
/* Lifetec 9415 handling */
2093
static void
2094
lt9415_audio(struct bttv *btv, struct video_audio *v, int set)
2095
{
2096
        int val = 0;
2097
 
2098
        if (gpioread() & 0x4000) {
2099
                v->mode = VIDEO_SOUND_MONO;
2100
                return;
2101
        }
2102
 
2103
        if (set) {
2104
                if (v->mode & VIDEO_SOUND_LANG2)  /* A2 SAP */
2105
                        val = 0x0080;
2106
                if (v->mode & VIDEO_SOUND_STEREO) /* A2 stereo */
2107
                        val = 0x0880;
2108
                if ((v->mode & VIDEO_SOUND_LANG1) ||
2109
                    (v->mode & VIDEO_SOUND_MONO))
2110
                        val = 0;
2111
                gpioaor(val, ~0x0880);
2112
                if (bttv_gpio)
2113
                        bttv_gpio_tracking(btv,"lt9415");
2114
        } else {
2115
                /* autodetect doesn't work with this card :-( */
2116
                v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
2117
                        VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
2118
                return;
2119
        }
2120
}
2121
 
2122
 
2123
static void
2124
terratv_audio(struct bttv *btv, struct video_audio *v, int set)
2125
{
2126
        unsigned int con = 0;
2127
 
2128
        if (set) {
2129
                btor(0x180000, BT848_GPIO_OUT_EN);
2130
                if (v->mode & VIDEO_SOUND_LANG2)
2131
                        con = 0x080000;
2132
                if (v->mode & VIDEO_SOUND_STEREO)
2133
                        con = 0x180000;
2134
                gpioaor(con, ~0x180000);
2135
                if (bttv_gpio)
2136
                        bttv_gpio_tracking(btv,"terratv");
2137
        } else {
2138
                v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
2139
                        VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
2140
        }
2141
}
2142
 
2143
static void
2144
winfast2000_audio(struct bttv *btv, struct video_audio *v, int set)
2145
{
2146
        unsigned long val = 0;
2147
 
2148
        if (set) {
2149
                /*btor (0xc32000, BT848_GPIO_OUT_EN);*/
2150
                if (v->mode & VIDEO_SOUND_MONO)         /* Mono */
2151
                        val = 0x420000;
2152
                if (v->mode & VIDEO_SOUND_LANG1)        /* Mono */
2153
                        val = 0x420000;
2154
                if (v->mode & VIDEO_SOUND_LANG2)        /* SAP */
2155
                        val = 0x410000;
2156
                if (v->mode & VIDEO_SOUND_STEREO)       /* Stereo */
2157
                        val = 0x020000;
2158
                if (val) {
2159
                        gpioaor(val, ~0x430000);
2160
                        if (bttv_gpio)
2161
                                bttv_gpio_tracking(btv,"winfast2000");
2162
                }
2163
        } else {
2164
                v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
2165
                          VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
2166
        }
2167
}
2168
 
2169
/*
2170
 * Dariusz Kowalewski <darekk@automex.pl>
2171
 * sound control for Prolink PV-BT878P+9B (PixelView PlayTV Pro FM+NICAM
2172
 * revision 9B has on-board TDA9874A sound decoder).
2173
 */
2174
static void
2175
pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set)
2176
{
2177
        unsigned int val = 0;
2178
 
2179
        if (btv->radio)
2180
                return;
2181
 
2182
        if (set) {
2183
                if (v->mode & VIDEO_SOUND_MONO) {
2184
                        val = 0x01;
2185
                }
2186
                if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2))
2187
                    || (v->mode & VIDEO_SOUND_STEREO)) {
2188
                        val = 0x02;
2189
                }
2190
                if (val) {
2191
                        gpioaor(val, ~0x03);
2192
                        if (bttv_gpio)
2193
                                bttv_gpio_tracking(btv,"pvbt878p9b");
2194
                }
2195
        } else {
2196
                v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
2197
                        VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
2198
        }
2199
}
2200
 
2201
/*
2202
 * Dariusz Kowalewski <darekk@automex.pl>
2203
 * sound control for FlyVideo 2000S (with tda9874 decoder)
2204
 * based on pvbt878p9b_audio() - this is not tested, please fix!!!
2205
 */
2206
static void
2207
fv2000s_audio(struct bttv *btv, struct video_audio *v, int set)
2208
{
2209
        unsigned int val = 0xffff;
2210
 
2211
        if (btv->radio)
2212
                return;
2213
 
2214
        if (set) {
2215
                if (v->mode & VIDEO_SOUND_MONO) {
2216
                        val = 0x0000;
2217
                }
2218
                if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2))
2219
                    || (v->mode & VIDEO_SOUND_STEREO)) {
2220
                        val = 0x1080; //-dk-???: 0x0880, 0x0080, 0x1800 ...
2221
                }
2222
                if (val != 0xffff) {
2223
                        gpioaor(val, ~0x1800);
2224
                        if (bttv_gpio)
2225
                                bttv_gpio_tracking(btv,"fv2000s");
2226
                }
2227
        } else {
2228
                v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
2229
                        VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
2230
        }
2231
}
2232
 
2233
/*
2234
 * sound control for Canopus WinDVR PCI
2235
 * Masaki Suzuki <masaki@btree.org>
2236
 */
2237
static void
2238
windvr_audio(struct bttv *btv, struct video_audio *v, int set)
2239
{
2240
        unsigned long val = 0;
2241
 
2242
        if (set) {
2243
                if (v->mode & VIDEO_SOUND_MONO)
2244
                        val = 0x040000;
2245
                if (v->mode & VIDEO_SOUND_LANG1)
2246
                        val = 0;
2247
                if (v->mode & VIDEO_SOUND_LANG2)
2248
                        val = 0x100000;
2249
                if (v->mode & VIDEO_SOUND_STEREO)
2250
                        val = 0;
2251
                if (val) {
2252
                        gpioaor(val, ~0x140000);
2253
                        if (bttv_gpio)
2254
                                bttv_gpio_tracking(btv,"windvr");
2255
                }
2256
        } else {
2257
                v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
2258
                          VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
2259
        }
2260
}
2261
 
2262
/* RemoteVision MX (rv605) muxsel helper [Miguel Freitas]
2263
 *
2264
 * This is needed because rv605 don't use a normal multiplex, but a crosspoint
2265
 * switch instead (CD22M3494E). This IC can have multiple active connections
2266
 * between Xn (input) and Yn (output) pins. We need to clear any existing
2267
 * connection prior to establish a new one, pulsing the STROBE pin.
2268
 *
2269
 * The board hardwire Y0 (xpoint) to MUX1 and MUXOUT to Yin.
2270
 * GPIO pins are wired as:
2271
 *  GPIO[0:3] - AX[0:3] (xpoint) - P1[0:3] (microcontroler)
2272
 *  GPIO[4:6] - AY[0:2] (xpoint) - P1[4:6] (microcontroler)
2273
 *  GPIO[7]   - DATA (xpoint)    - P1[7] (microcontroler)
2274
 *  GPIO[8]   -                  - P3[5] (microcontroler)
2275
 *  GPIO[9]   - RESET (xpoint)   - P3[6] (microcontroler)
2276
 *  GPIO[10]  - STROBE (xpoint)  - P3[7] (microcontroler)
2277
 *  GPINTR    -                  - P3[4] (microcontroler)
2278
 *
2279
 * The microcontroler is a 80C32 like. It should be possible to change xpoint
2280
 * configuration either directly (as we are doing) or using the microcontroler
2281
 * which is also wired to I2C interface. I have no further info on the
2282
 * microcontroler features, one would need to disassembly the firmware.
2283
 * note: the vendor refused to give any information on this product, all
2284
 *       that stuff was found using a multimeter! :)
2285
 */
2286
static void rv605_muxsel(struct bttv *btv, unsigned int input)
2287
{
2288
        /* reset all conections */
2289
        gpioaor(0x200,~0x200);
2290
        udelay(1000);
2291
        gpioaor(0x000,~0x200);
2292
        udelay(1000);
2293
 
2294
        /* create a new conection */
2295
        gpioaor(0x080,~0x480);
2296
        gpioaor(0x480,~0x480);
2297
        udelay(1000);
2298
        gpioaor(0x080,~0x480);
2299
        udelay(1000);
2300
}
2301
 
2302
 
2303
/* ----------------------------------------------------------------------- */
2304
/* motherboard chipset specific stuff                                      */
2305
 
2306
void bttv_check_chipset(void)
2307
{
2308
        int pcipci_fail = 0;
2309
        struct pci_dev dev;
2310
        BYTE bus, dv;
2311
 
2312
        triton1 = 1;
2313
 
2314
        if (pci_device(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_496, 0, &bus, &dv)) pcipci_fail = 1;
2315
        if (pci_device(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5597, 0, &bus, &dv)) pcipci_fail = 1;
2316
        if (pci_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82437, 0, &bus, &dv)) triton1 = 1;
2317
        if (pci_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443BX_0, 0, &bus, &dv)) triton1 = 1;
2318
        if (pci_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C597_0, 0, &bus, &dv)) triton1 = 1;
2319
        if (pci_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C576, 0, &bus, &dv)) vsfx = 1;
2320
 
2321
        /* print warnings about any quirks found */
2322
        if (triton1)
2323
                printk(KERN_INFO "bttv: Host bridge needs ETBF enabled.\n");
2324
        if (vsfx)
2325
                printk(KERN_INFO "bttv: Host bridge needs VSFX enabled.\n");
2326
 
2327
        if (pcipci_fail) {
2328
                printk(KERN_WARNING "bttv: BT848 and your chipset may not work together.\n");
2329
                if (-1 == no_overlay) {
2330
                        printk(KERN_WARNING "bttv: going to disable overlay.\n");
2331
                        no_overlay = 1;
2332
                }
2333
        }
2334
 
2335
        if(pci_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82441, 0, &bus, &dv)) {
2336
                unsigned char b;
2337
                dev.bus->number = bus;
2338
                dev.devfn = dv;
2339
                pci_read_config_byte(&dev, 0x53, &b);
2340
                if (bttv_debug)
2341
                        printk(KERN_INFO "bttv: Host bridge: 82441FX Natoma, "
2342
                               "bufcon=0x%02x\n",b);
2343
        }
2344
 
2345
}
2346
 
2347
int bttv_handle_chipset(struct bttv *btv)
2348
{
2349
        unsigned char command;
2350
 
2351
        if (!triton1 && !vsfx)
2352
                return 0;
2353
 
2354
        if (bttv_verbose) {
2355
                if (triton1)
2356
                        printk(KERN_INFO "bttv%d: enabling ETBF (430FX/VP3 compatibilty)\n",btv->nr);
2357
                if (vsfx && btv->id >= 878)
2358
                        printk(KERN_INFO "bttv%d: enabling VSFX\n",btv->nr);
2359
        }
2360
 
2361
        if (btv->id < 878) {
2362
                /* bt848 (mis)uses a bit in the irq mask for etbf */
2363
                if (triton1)
2364
                        btv->triton1 = BT848_INT_ETBF;
2365
        } else {
2366
                /* bt878 has a bit in the pci config space for it */
2367
                pci_read_config_byte(btv->dev, BT878_DEVCTRL, &command);
2368
                if (triton1)
2369
                        command |= BT878_EN_TBFX;
2370
                if (vsfx)
2371
                        command |= BT878_EN_VSFX;
2372
                pci_write_config_byte(btv->dev, BT878_DEVCTRL, command);
2373
        }
2374
        return 0;
2375
}
2376