Subversion Repositories shark

Rev

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