1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
|
/*
bttv-cards.c
this file has configuration informations - card-specific stuff
like the big tvcards array for the most part
Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de)
& Marcus Metzler (mocm@thp.uni-koeln.de)
(c) 1999-2001 Gerd Knorr <kraxel@goldbach.in-berlin.de>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define __NO_VERSION__ 1
#include <linux/version.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/kmod.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <asm/io.h>
#include "bttvp.h"
#include "tuner.h"
/* fwd decl */
static void hauppauge_eeprom(struct bttv *btv);
static void init_PXC200(struct bttv *btv);
#if 0
static void init_tea5757(struct bttv *btv);
#endif
static void winview_audio(struct bttv *btv, struct video_audio *v, int set);
static void avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v,
int set);
static void terratv_audio(struct bttv *btv, struct video_audio *v, int set);
static void gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set);
/* config variables */
static int triton1=0;
int no_overlay=-1;
static unsigned int card[4] = { -1, -1, -1, -1 };
static unsigned int pll[4] = { -1, -1, -1, -1 };
static unsigned int tuner[4] = { -1, -1, -1, -1 };
#ifdef MODULE
static unsigned int autoload = 1;
#else
static unsigned int autoload = 0;
#endif
static unsigned int gpiomask = -1;
static unsigned int audioall = -1;
static unsigned int audiomux[5] = { -1, -1, -1, -1, -1 };
/* insmod options */
MODULE_PARM(triton1,"i");
MODULE_PARM(no_overlay,"i");
MODULE_PARM(card,"1-4i");
MODULE_PARM_DESC(card,"specify TV/grabber card model, see CARDLIST file for a list");
MODULE_PARM(pll,"1-4i");
MODULE_PARM_DESC(pll,"specify installed crystal (0=none, 28=28 MHz, 35=35 MHz)");
MODULE_PARM(tuner,"1-4i");
MODULE_PARM_DESC(tuner,"specify installed tuner type");
MODULE_PARM(autoload,"i");
MODULE_PARM_DESC(autoload,"automatically load i2c modules like tuner.o, default is 1 (yes)");
MODULE_PARM(gpiomask,"i");
MODULE_PARM(audioall,"i");
MODULE_PARM(audiomux,"1-5i");
/* kernel args */
#ifndef MODULE
static int __init p_card(char *str) { return bttv_parse(str,BTTV_MAX,card); }
static int __init p_pll(char *str) { return bttv_parse(str,BTTV_MAX,pll); }
static int __init p_tuner(char *str) { return bttv_parse(str,BTTV_MAX,tuner); }
__setup("bttv.card=", p_card);
__setup("bttv.pll=", p_pll);
__setup("bttv.tuner=", p_tuner);
int __init bttv_parse(char *str, int max, int *vals)
{
int i,number,res = 2;
for (i = 0; res == 2 && i < max; i++) {
res = get_option(&str,&number);
if (res)
vals[i] = number;
}
return 1;
}
#endif
/* ----------------------------------------------------------------------- */
/* list of card IDs for bt878+ cards */
static struct CARD {
unsigned id;
int cardnr;
char *name;
} cards[] __devinitdata = {
{ 0x00011002, BTTV_HAUPPAUGE878, "ATI TV Wonder" },
{ 0x00011461, BTTV_AVPHONE98, "AVerMedia TVPhone98" },
{ 0x00021461, BTTV_AVERMEDIA98, "Avermedia TVCapture 98" },
{ 0x00031002, BTTV_HAUPPAUGE878, "ATI TV Wonder/VE" },
{ 0x00031461, BTTV_AVPHONE98, "AVerMedia TVPhone98" },
{ 0x00041461, BTTV_AVERMEDIA98, "AVerMedia TVCapture 98" },
{ 0x010114c7, 16 /* FIXME */, "Modular Technology PCTV" },
{ 0x10b42636, BTTV_HAUPPAUGE878, "STB ???" },
{ 0x1118153b, BTTV_TERRATVALUE, "Terratec TV Value" },
{ 0x1123153b, BTTV_TERRATVRADIO, "Terratec TV/Radio+" },
{ 0x1200bd11, BTTV_PINNACLE, "Pinnacle PCTV" },
{ 0x13eb0070, BTTV_HAUPPAUGE878, "Hauppauge WinTV" },
{ 0x18501851, BTTV_CHRONOS_VS2, "Chronos Video Shuttle II" },
{ 0x18521852, BTTV_TYPHOON_TVIEW, "Typhoon TView TV/FM Tuner" },
{ 0x217d6606, BTTV_WINFAST2000, "Leadtek WinFast TV 2000" },
{ 0x263610b4, BTTV_STB2, "STB TV PCI FM, P/N 6000704" },
{ 0x3000121a, 0/* no entry yet */,"VoodooTV 200" },
{ 0x3000144f, BTTV_MAGICTVIEW063, "TView 99 (CPH063)" },
{ 0x300014ff, BTTV_MAGICTVIEW061, "TView 99 (CPH061)" },
{ 0x3002144f, BTTV_MAGICTVIEW061, "Askey Magic TView" },
{ 0x300214ff, BTTV_PHOEBE_TVMAS, "Phoebe TV Master" },
{ 0x39000070, BTTV_HAUPPAUGE878, "Hauppauge WinTV-D" },
{ 0x400a15b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV" },
{ 0x400d15b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
{ 0x401015b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
{ 0x402010fc, BTTV_GVBCTV3PCI, "I-O Data Co. GV-BCV3/PCI" },
{ 0xff000070, BTTV_HAUPPAUGE878, "Osprey-100" },
{ 0xff010070, BTTV_HAUPPAUGE878, "Osprey-200" },
#if 0 /* probably wrong */
{ 0x14610002, BTTV_AVERMEDIA98, "Avermedia TVCapture 98" },
{ 0x6606217d, BTTV_WINFAST2000, "Leadtek WinFast TV 2000" },
#endif
{ 0, -1, NULL }
};
/* ----------------------------------------------------------------------- */
/* array with description for bt848 / bt878 tv/grabber cards */
struct tvcard bttv_tvcards[] = {
{
/* ---- card 0x00 ---------------------------------- */
name: " *** UNKNOWN *** ",
video_inputs: 4,
audio_inputs: 1,
tuner: 0,
svhs: 2,
muxsel: { 2, 3, 1, 0},
tuner_type: -1,
},{
name: "MIRO PCTV",
video_inputs: 4,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 15,
muxsel: { 2, 3, 1, 1},
audiomux: { 2, 0, 0, 0, 10},
needs_tvaudio: 1,
tuner_type: -1,
},{
name: "Hauppauge old",
video_inputs: 4,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 7,
muxsel: { 2, 3, 1, 1},
audiomux: { 0, 1, 2, 3, 4},
needs_tvaudio: 1,
tuner_type: -1,
},{
name: "STB",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 7,
muxsel: { 2, 3, 1, 1},
audiomux: { 4, 0, 2, 3, 1},
no_msp34xx: 1,
needs_tvaudio: 1,
tuner_type: -1,
},{
/* ---- card 0x04 ---------------------------------- */
name: "Intel",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: -1,
gpiomask: 7,
muxsel: { 2, 3, 1, 1},
audiomux: { 0, 1, 2, 3, 4},
needs_tvaudio: 1,
tuner_type: -1,
},{
name: "Diamond DTV2000",
video_inputs: 4,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 3,
muxsel: { 2, 3, 1, 0},
audiomux: { 0, 1, 0, 1, 3},
needs_tvaudio: 1,
tuner_type: -1,
},{
name: "AVerMedia TVPhone",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 3,
/* old
gpiomask: 15,
audiomux: {12, 4,11,11, 0},
*/
muxsel: { 2, 3, 1, 1},
gpiomask: 0x0f,
audiomux: { 0x04, 0x04, 0x08, 0x04, 0},
needs_tvaudio: 1,
tuner_type: -1,
audio_hook: avermedia_tvphone_audio,
},{
name: "MATRIX-Vision MV-Delta",
video_inputs: 5,
audio_inputs: 1,
tuner: -1,
svhs: 3,
gpiomask: 0,
muxsel: { 2, 3, 1, 0, 0},
audiomux: {0 },
needs_tvaudio: 1,
tuner_type: -1,
},{
/* ---- card 0x08 ---------------------------------- */
name: "Fly Video II",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 0xc00,
muxsel: { 2, 3, 1, 1},
audiomux: { 0, 0xc00, 0x800, 0x400, 0xc00, 0},
needs_tvaudio: 1,
tuner_type: -1,
},{
name: "TurboTV",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 3,
muxsel: { 2, 3, 1, 1},
audiomux: { 1, 1, 2, 3, 0},
needs_tvaudio: 1,
tuner_type: -1,
},{
name: "Hauppauge new (bt878)",
video_inputs: 4,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 7,
muxsel: { 2, 0, 1, 1},
audiomux: { 0, 1, 2, 3, 4},
needs_tvaudio: 1,
pll: PLL_28,
tuner_type: -1,
},{
name: "MIRO PCTV pro",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 0x3000f,
muxsel: { 2, 3, 1, 1},
audiomux: { 1,0x10001, 0, 0,10},
needs_tvaudio: 1,
tuner_type: -1,
},{
/* ---- card 0x0c ---------------------------------- */
name: "ADS Technologies Channel Surfer TV",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 15,
muxsel: { 2, 3, 1, 1},
audiomux: { 13, 14, 11, 7, 0, 0},
needs_tvaudio: 1,
tuner_type: -1,
},{
name: "AVerMedia TVCapture 98",
video_inputs: 3,
audio_inputs: 4,
tuner: 0,
svhs: 2,
gpiomask: 15,
muxsel: { 2, 3, 1, 1},
audiomux: { 13, 14, 11, 7, 0, 0},
needs_tvaudio: 1,
pll: PLL_28,
tuner_type: 5,
},{
name: "Aimslab VHX",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 7,
muxsel: { 2, 3, 1, 1},
audiomux: { 0, 1, 2, 3, 4},
needs_tvaudio: 1,
tuner_type: -1,
},{
name: "Zoltrix TV-Max",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 15,
muxsel: { 2, 3, 1, 1},
audiomux: {0 , 0, 1 , 0, 10},
needs_tvaudio: 1,
tuner_type: -1,
},{
/* ---- card 0x10 ---------------------------------- */
name: "Pixelview PlayTV (bt878)",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 0x01fe00,
muxsel: { 2, 3, 1, 1},
audiomux: { 0x01c000, 0, 0x018000, 0x014000, 0x002000, 0 },
needs_tvaudio: 1,
pll: PLL_28,
tuner_type: -1,
},{
name: "Leadtek WinView 601",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 0x8300f8,
muxsel: { 2, 3, 1, 1,0},
audiomux: { 0x4fa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007},
needs_tvaudio: 1,
tuner_type: -1,
audio_hook: winview_audio,
},{
name: "AVEC Intercapture",
video_inputs: 3,
audio_inputs: 2,
tuner: 0,
svhs: 2,
gpiomask: 0,
muxsel: {2, 3, 1, 1},
audiomux: {1, 0, 0, 0, 0},
needs_tvaudio: 1,
tuner_type: -1,
},{
name: "LifeView FlyKit w/o Tuner",
video_inputs: 3,
audio_inputs: 1,
tuner: -1,
svhs: -1,
gpiomask: 0x8dff00,
muxsel: { 2, 3, 1, 1},
audiomux: { 0 },
no_msp34xx: 1,
tuner_type: -1,
},{
/* ---- card 0x14 ---------------------------------- */
name: "CEI Raffles Card",
video_inputs: 3,
audio_inputs: 3,
tuner: 0,
svhs: 2,
muxsel: {2, 3, 1, 1},
tuner_type: -1,
},{
name: "Lucky Star Image World ConferenceTV",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 0x00fffe07,
muxsel: { 2, 3, 1, 1},
audiomux: { 131072, 1, 1638400, 3, 4},
needs_tvaudio: 1,
pll: PLL_28,
tuner_type: TUNER_PHILIPS_PAL_I,
},{
name: "Phoebe Tv Master + FM",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 0xc00,
muxsel: { 2, 3, 1, 1},
audiomux: {0, 1, 0x800, 0x400, 0xc00, 0},
needs_tvaudio: 1,
tuner_type: -1,
},{
name: "Modular Technology MM205 PCTV, bt878",
video_inputs: 2,
audio_inputs: 1,
tuner: 0,
svhs: -1,
gpiomask: 7,
muxsel: { 2, 3 },
audiomux: { 0, 0, 0, 0, 0 },
no_msp34xx: 1,
pll: PLL_28,
tuner_type: TUNER_ALPS_TSBB5_PAL_I,
},{
/* ---- card 0x18 ---------------------------------- */
name: "Askey/Typhoon/Anubis Magic TView CPH051/061 (bt878)",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 0xe00,
muxsel: { 2, 3, 1, 1},
audiomux: {0x400, 0x400, 0x400, 0x400, 0},
needs_tvaudio: 1,
pll: PLL_28,
tuner_type: -1,
},{
name: "Terratec/Vobis TV-Boostar",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 16777215,
muxsel: { 2, 3, 1, 1},
audiomux: { 131072, 1, 1638400, 3,4},
needs_tvaudio: 1,
tuner_type: -1,
},{
name: "Newer Hauppauge WinCam (bt878)",
video_inputs: 4,
audio_inputs: 1,
tuner: 0,
svhs: 3,
gpiomask: 7,
muxsel: { 2, 0, 1, 1},
audiomux: { 0, 1, 2, 3, 4},
needs_tvaudio: 1,
tuner_type: -1,
},{
name: "MAXI TV Video PCI2",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 0xffff,
muxsel: { 2, 3, 1, 1},
audiomux: { 0, 1, 2, 3, 0xc00},
needs_tvaudio: 1,
tuner_type: TUNER_PHILIPS_SECAM,
},{
/* ---- card 0x1c ---------------------------------- */
name: "Terratec TerraTV+",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 0x70000,
muxsel: { 2, 3, 1, 1},
audiomux: { 0x20000, 0x30000, 0x10000, 0x00000, 0x40000},
needs_tvaudio: 1,
tuner_type: -1,
audio_hook: terratv_audio,
},{
/* Jannik Fritsch <jannik@techfak.uni-bielefeld.de> */
name: "Imagenation PXC200",
video_inputs: 5,
audio_inputs: 1,
tuner: -1,
svhs: 1, /* was: 4 */
gpiomask: 0,
muxsel: { 2, 3, 1, 0, 0},
audiomux: { 0 },
needs_tvaudio: 1,
tuner_type: -1,
},{
name: "FlyVideo 98",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 0x8dfe00,
muxsel: {2, 3, 1, 1},
audiomux: { 0, 0x8dff00, 0x8df700, 0x8de700, 0x8dff00, 0 },
needs_tvaudio: 1,
tuner_type: -1,
},{
name: "iProTV",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 1,
muxsel: { 2, 3, 1, 1},
audiomux: { 1, 0, 0, 0, 0 },
tuner_type: -1,
},{
/* ---- card 0x20 ---------------------------------- */
name: "Intel Create and Share PCI",
video_inputs: 4,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 7,
muxsel: { 2, 3, 1, 1},
audiomux: { 4, 4, 4, 4, 4},
needs_tvaudio: 1,
tuner_type: -1,
},{
name: "Terratec TerraTValue",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 0xffff00,
muxsel: { 2, 3, 1, 1},
audiomux: { 0x500, 0, 0x300, 0x900, 0x900},
needs_tvaudio: 1,
pll: PLL_28,
tuner_type: TUNER_PHILIPS_PAL,
},{
name: "Leadtek WinFast 2000",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 0xfff000,
muxsel: { 2, 3, 1, 1,0},
audiomux: { 0x621000,0x6ddf07,0x621100,0x620000,0xE210000,0x620000},
needs_tvaudio: 1,
pll: PLL_28,
tuner_type: -1,
},{
name: "Chronos Video Shuttle II",
video_inputs: 3,
audio_inputs: 3,
tuner: 0,
svhs: 2,
gpiomask: 0x1800,
muxsel: { 2, 3, 1, 1},
audiomux: { 0, 0, 0x1000, 0x1000, 0x0800},
needs_tvaudio: 1,
pll: PLL_28,
tuner_type: -1,
},{
/* ---- card 0x24 ---------------------------------- */
name: "Typhoon TView TV/FM Tuner",
video_inputs: 3,
audio_inputs: 3,
tuner: 0,
svhs: 2,
gpiomask: 0x1800,
muxsel: { 2, 3, 1, 1},
audiomux: { 0, 0x800, 0, 0, 0x1800, 0 },
needs_tvaudio: 1,
pll: PLL_28,
tuner_type: -1,
},{
name: "PixelView PlayTV pro",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 0xff,
muxsel: { 2, 3, 1, 1 },
audiomux: { 0x21, 0x20, 0x24, 0x2c, 0x29, 0x29 },
no_msp34xx: 1,
pll: PLL_28,
tuner_type: -1,
},{
name: "TView99 CPH063",
video_inputs: 4,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 0x551e00,
muxsel: { 2, 3, 1, 0},
audiomux: { 0x551400, 0x551200, 0, 0, 0, 0x551200 },
needs_tvaudio: 1,
pll: PLL_28,
tuner_type: -1,
},{
name: "Pinnacle PCTV Studio/Rave",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 0x03000F,
muxsel: { 2, 3, 1, 1},
audiomux: { 2, 0, 0, 0, 1},
needs_tvaudio: 1,
pll: PLL_28,
tuner_type: -1,
},{
/* ---- card 0x28 ---------------------------------- */
name: "STB2",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 7,
muxsel: { 2, 3, 1, 1},
audiomux: { 4, 0, 2, 3, 1},
no_msp34xx: 1,
needs_tvaudio: 1,
tuner_type: -1,
},{
name: "AVerMedia TVPhone 98",
video_inputs: 3,
audio_inputs: 4,
tuner: 0,
svhs: 2,
gpiomask: 12,
muxsel: { 2, 3, 1, 1},
audiomux: { 13, 4, 11, 7, 0, 0},
needs_tvaudio: 1,
pll: PLL_28,
tuner_type: 5,
},{
name: "ProVideo PV951", /* pic16c54 */
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 0,
muxsel: { 2, 3, 1, 1},
audiomux: { 0, 0, 0, 0, 0},
no_msp34xx: 1,
pll: PLL_28,
tuner_type: 1,
},{
name: "Little OnAir TV",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 0xe00b,
muxsel: {2, 3, 1, 1},
audiomux: {0xff9ff6, 0xff9ff6, 0xff1ff7, 0, 0xff3ffc},
no_msp34xx: 1,
tuner_type: -1,
},{
/* ---- card 0x2c ---------------------------------- */
name: "Sigma TVII-FM",
video_inputs: 2,
audio_inputs: 1,
tuner: 0,
svhs: -1,
gpiomask: 3,
muxsel: {2, 3, 1, 1},
audiomux: {1, 1, 0, 2, 3},
no_msp34xx: 1,
pll: PLL_NONE,
tuner_type: -1,
},{
name: "MATRIX-Vision MV-Delta 2",
video_inputs: 5,
audio_inputs: 1,
tuner: -1,
svhs: 3,
gpiomask: 0,
muxsel: { 2, 3, 1, 0, 0},
audiomux: {0 },
no_msp34xx: 1,
pll: PLL_28,
tuner_type: -1,
},{
name: "Zoltrix Genie TV/FM",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 0xbcf03f,
muxsel: { 2, 3, 1, 1},
audiomux: { 0xbc803f, 0xbc903f, 0xbcb03f, 0, 0xbcb03f},
no_msp34xx: 1,
pll: PLL_28,
tuner_type: 21,
},{
name: "Terratec TV/Radio+",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 0x1f0000,
muxsel: { 2, 3, 1, 1},
audiomux: { 0xe2ffff, 0xebffff, 0, 0, 0xe0ffff, 0xe2ffff },
no_msp34xx: 1,
pll: PLL_35,
tuner_type: 1,
},{
/* ---- card 0x30 ---------------------------------- */
name: "Dynalink Magic TView ",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 15,
muxsel: { 2, 3, 1, 1},
audiomux: {2,0,0,0,1},
needs_tvaudio: 1,
pll: PLL_28,
tuner_type: -1,
},{
name: "GV-BCTV3",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 0x010f00,
muxsel: {2, 3, 0, 0},
audiomux: {0x10000, 0, 0x10000, 0, 0, 0},
no_msp34xx: 1,
pll: PLL_28,
tuner_type: TUNER_ALPS_TSHC6_NTSC,
audio_hook: gvbctv3pci_audio,
},{
name: "Prolink PV-BT878P+4E (PixelView PlayTV PAK)",
video_inputs: 4,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 0xAA0000,
muxsel: { 2,3,1,1 },
audiomux: { 0x20000, 0, 0x80000, 0x80000, 0xa8000, 0x46000 },
no_msp34xx: 1,
pll: PLL_28,
tuner_type: TUNER_PHILIPS_PAL_I,
},{
name: "Eagle Wireless Capricorn2 (bt878A)",
video_inputs: 4,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 7,
muxsel: { 2, 0, 1, 1},
audiomux: { 0, 1, 2, 3, 4},
pll: PLL_28,
tuner_type: -1 /* TUNER_ALPS_TMDH2_NTSC */,
},{
/* ---- card 0x34 ---------------------------------- */
/* David Härdeman <david@2gen.com> */
name: "Pinnacle PCTV Studio Pro",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 0x03000F,
muxsel: { 2, 3, 1, 1},
audiomux: { 1, 0x10001, 0, 0, 10},
needs_tvaudio: 1,
pll: PLL_28,
tuner_type: -1,
},{
/* Claas Langbehn <claas@bigfoot.com>,
Sven Grothklags <sven@upb.de> */
name: "Typhoon TView RDS / FM Stereo",
video_inputs: 3,
audio_inputs: 3,
tuner: 0,
svhs: 2,
gpiomask: 0x1c,
muxsel: { 2, 3, 1, 1},
audiomux: { 0, 0, 0x10, 8, 4 },
needs_tvaudio: 1,
pll: PLL_28,
tuner_type: TUNER_PHILIPS_PAL_I,
},{
/* Tim Röstermundt <rosterm@uni-muenster.de>
in de.comp.os.unix.linux.hardware:
options bttv card=0 pll=1 radio=1 gpiomask=0x18e0
audiomux=0x44c71f,0x44d71f,0,0x44d71f,0x44dfff
options tuner type=5 */
name: "Livetec 9415 TV",
video_inputs: 4,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 0x18e0,
muxsel: { 2, 3, 1, 1},
audiomux: { 0x0000,0x0800,0x1000,0x1000,0x18e0 },
pll: PLL_28,
tuner_type: TUNER_PHILIPS_PAL,
},{
/* Miguel Angel Alvarez <maacruz@navegalia.com> */
name: "BESTBUY Easy TV",
video_inputs: 4,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 0xF,
muxsel: { 2, 3, 1, 0},
audiomux: { 2, 0, 0, 0, 10},
needs_tvaudio: 0,
pll: PLL_28,
tuner_type: TUNER_TEMIC_PAL_I,
},{
/* ---- card 0x38 ---------------------------------- */
/* Gordon Heydon <gjheydon@bigfoot.com */
name: "FlyVideo '98/FM",
video_inputs: 3,
audio_inputs: 3,
tuner: 0,
svhs: 2,
gpiomask: 0x1800,
muxsel: { 2, 3, 1, 1},
audiomux: { 0, 0x800, 0, 0, 0x1800, 0 },
needs_tvaudio: 1,
pll: PLL_28,
tuner_type: -1,
},{
/* This is the ultimate cheapo capture card
* just a BT848A on a small PCB!
* Steve Hosgood <steve@equiinet.com> */
name: "GrandTec 'Grand Video Capture'",
video_inputs: 2,
audio_inputs: 0,
tuner: -1,
svhs: 1,
gpiomask: 0,
muxsel: { 3, 1 },
audiomux: { 0 },
needs_tvaudio: 0,
no_msp34xx: 1,
pll: PLL_35,
tuner_type: -1,
},{
/* Daniel Herrington <daniel.herrington@home.com> */
name: "Phoebe TV Master Only (No FM)",
video_inputs: 3,
audio_inputs: 1,
tuner: 0,
svhs: 2,
gpiomask: 0x0e00,
muxsel: { 2, 3, 1, 1},
audiomux: { 0x400, 0x400, 0x400, 0x400, 0x800, 0x400 },
needs_tvaudio: 1,
pll: PLL_NONE,
tuner_type: TUNER_TEMIC_4036FY5_NTSC,
}};
const int bttv_num_tvcards = (sizeof(bttv_tvcards)/sizeof(struct tvcard));
/* ----------------------------------------------------------------------- */
static unsigned char eeprom_data[256];
/*
* identify card
*/
void __devinit bttv_idcard(struct bttv *btv)
{
unsigned int gpiobits;
int i,type;
unsigned short tmp;
/* read PCI subsystem ID */
pci_read_config_word(btv->dev, PCI_SUBSYSTEM_ID, &tmp);
btv->cardid = tmp << 16;
pci_read_config_word(btv->dev, PCI_SUBSYSTEM_VENDOR_ID, &tmp);
btv->cardid |= tmp;
if (0 != btv->cardid && 0xffffffff != btv->cardid) {
/* look for the card */
for (type = -1, i = 0; cards[i].id != 0; i++)
if (cards[i].id == btv->cardid)
type = i;
if (type != -1) {
/* found it */
printk(KERN_INFO "bttv%d: subsystem: %04x:%04x => %s => card=%d\n",
btv->nr, btv->cardid & 0xffff, btv->cardid >> 16,
cards[type].name,cards[type].cardnr);
btv->type = cards[type].cardnr;
} else {
/* 404 */
printk(KERN_INFO "bttv%d: subsystem: %04x:%04x (UNKNOWN)\n",
btv->nr, btv->cardid&0xffff, btv->cardid>>16);
printk(KERN_DEBUG "please mail id, board name and "
"the correct card= insmod option to "
"kraxel@goldbach.in-berlin.de\n");
}
}
/* let the user override the autodetected type */
if (card[btv->nr] >= 0 && card[btv->nr] < bttv_num_tvcards)
btv->type=card[btv->nr];
/* print which card config we are using */
sprintf(btv->video_dev.name,"BT%d%s(%.23s)",
btv->id,
(btv->id==848 && btv->revision==0x12) ? "A" : "",
bttv_tvcards[btv->type].name);
printk(KERN_INFO "bttv%d: model: %s [%s]\n",btv->nr,btv->video_dev.name,
(card[btv->nr] >= 0 && card[btv->nr] < bttv_num_tvcards) ?
"insmod option" : "autodetected");
/* overwrite gpio stuff ?? */
if (-1 == audioall && -1 == audiomux[0])
return;
if (-1 != audiomux[0]) {
gpiobits = 0;
for (i = 0; i < 5; i++) {
bttv_tvcards[btv->type].audiomux[i] = audiomux[i];
gpiobits |= audiomux[i];
}
} else {
gpiobits = audioall;
for (i = 0; i < 5; i++) {
bttv_tvcards[btv->type].audiomux[i] = audioall;
}
}
bttv_tvcards[btv->type].gpiomask = (-1 != gpiomask) ? gpiomask : gpiobits;
printk(KERN_INFO "bttv%d: gpio config override: mask=0x%x, mux=",
btv->nr,bttv_tvcards[btv->type].gpiomask);
for (i = 0; i < 5; i++) {
printk("%s0x%x", i ? "," : "", bttv_tvcards[btv->type].audiomux[i]);
}
printk("\n");
}
/*
* (most) board specific initialisations goes here
*/
int miro_tunermap[] = { 0,6,2,3, 4,5,6,0, 3,0,4,5, 5,2,16,1,
14,2,17,1, 4,1,4,3, 1,2,16,1, 4,4,4,4 };
int miro_fmtuner[] = { 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1,
1,1,1,1, 1,1,1,0, 0,0,0,0, 0,0,0,0 };
void __devinit bttv_init_card(struct bttv *btv)
{
/* miro/pinnacle */
if (btv->type == BTTV_MIRO ||
btv->type == BTTV_MIROPRO ||
btv->type == BTTV_PINNACLE ||
btv->type == BTTV_PINNACLEPRO) {
int id,msp;
id = ((btread(BT848_GPIO_DATA)>>10) & 31) -1;
msp = bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx");
btv->tuner_type = miro_tunermap[id];
if (0 == (btread(BT848_GPIO_DATA) & 0x20)) {
btv->has_radio = 1;
if (!miro_fmtuner[id]) {
btv->has_matchbox = 1;
btv->mbox_we = (1<<6);
btv->mbox_most = (1<<7);
btv->mbox_clk = (1<<8);
btv->mbox_data = (1<<9);
btv->mbox_mask = (1<<6)|(1<<7)|(1<<8)|(1<<9);
}
} else {
btv->has_radio = 0;
}
if (-1 != msp) {
if (btv->type == BTTV_MIRO)
btv->type = BTTV_MIROPRO;
if (btv->type == BTTV_PINNACLE)
btv->type = BTTV_PINNACLEPRO;
}
if (bttv_verbose)
printk("bttv%d: miro: id=%d tuner=%d radio=%s stereo=%s\n",
btv->nr, id+1, btv->tuner_type,
!btv->has_radio ? "no" :
(btv->has_matchbox ? "matchbox" : "fmtuner"),
(-1 == msp) ? "no" : "yes");
#if 0
if (btv->has_matchbox) {
if (bttv_verbose)
printk(KERN_INFO "Initializing TEA5757...\n");
init_tea5757(btv);
}
#endif
}
if (btv->type == BTTV_HAUPPAUGE || btv->type == BTTV_HAUPPAUGE878) {
/* pick up some config infos from the eeprom */
bttv_readee(btv,eeprom_data,0xa0);
hauppauge_eeprom(btv);
}
if (btv->type == BTTV_PXC200)
init_PXC200(btv);
if (btv->type == BTTV_VHX) {
btv->has_radio = 1;
btv->has_matchbox = 1;
btv->mbox_we = 0x20;
btv->mbox_most = 0;
btv->mbox_clk = 0x08;
btv->mbox_data = 0x10;
btv->mbox_mask = 0x38;
}
/* pll configuration */
if (!(btv->id==848 && btv->revision==0x11)) {
/* defaults from card list */
if (PLL_28 == bttv_tvcards[btv->type].pll) {
btv->pll.pll_ifreq=28636363;
btv->pll.pll_crystal=BT848_IFORM_XT0;
}
if (PLL_35 == bttv_tvcards[btv->type].pll) {
btv->pll.pll_ifreq=35468950;
btv->pll.pll_crystal=BT848_IFORM_XT1;
}
/* insmod options can override */
switch (pll[btv->nr]) {
case 0: /* none */
btv->pll.pll_crystal = 0;
btv->pll.pll_ifreq = 0;
btv->pll.pll_ofreq = 0;
break;
case 1: /* 28 MHz */
case 28:
btv->pll.pll_ifreq = 28636363;
btv->pll.pll_ofreq = 0;
btv->pll.pll_crystal = BT848_IFORM_XT0;
break;
case 2: /* 35 MHz */
case 35:
btv->pll.pll_ifreq = 35468950;
btv->pll.pll_ofreq = 0;
btv->pll.pll_crystal = BT848_IFORM_XT1;
break;
}
}
/* tuner configuration (from card list / insmod option) */
if (-1 != bttv_tvcards[btv->type].tuner_type)
btv->tuner_type = bttv_tvcards[btv->type].tuner_type;
if (-1 != tuner[btv->nr])
btv->tuner_type = tuner[btv->nr];
if (btv->tuner_type != -1)
bttv_call_i2c_clients(btv,TUNER_SET_TYPE,&btv->tuner_type);
/* try to detect audio/fader chips */
if (!bttv_tvcards[btv->type].no_msp34xx &&
bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx") >=0) {
if (autoload)
request_module("msp3400");
}
if (bttv_I2CRead(btv, I2C_TDA9875, "TDA9875") >=0) {
if (autoload)
request_module("tda9875");
}
if (bttv_I2CRead(btv, I2C_TDA7432, "TDA7432") >=0) {
if (autoload)
request_module("tda7432");
}
if (bttv_tvcards[btv->type].needs_tvaudio) {
if (autoload)
request_module("tvaudio");
}
if (bttv_tvcards[btv->type].tuner != -1) {
if (autoload)
request_module("tuner");
}
}
/* ----------------------------------------------------------------------- */
/* some hauppauge specific stuff */
static struct HAUPPAUGE_TUNER
{
int id;
char *name;
}
hauppauge_tuner[] __devinitdata =
{
{ TUNER_ABSENT, "" },
{ TUNER_ABSENT, "External" },
{ TUNER_ABSENT, "Unspecified" },
{ TUNER_PHILIPS_PAL, "Philips FI1216" },
{ TUNER_PHILIPS_SECAM, "Philips FI1216MF" },
{ TUNER_PHILIPS_NTSC, "Philips FI1236" },
{ TUNER_PHILIPS_PAL_I, "Philips FI1246" },
{ TUNER_PHILIPS_PAL_DK,"Philips FI1256" },
{ TUNER_PHILIPS_PAL, "Philips FI1216 MK2" },
{ TUNER_PHILIPS_SECAM, "Philips FI1216MF MK2" },
{ TUNER_PHILIPS_NTSC, "Philips FI1236 MK2" },
{ TUNER_PHILIPS_PAL_I, "Philips FI1246 MK2" },
{ TUNER_PHILIPS_PAL_DK,"Philips FI1256 MK2" },
{ TUNER_TEMIC_NTSC, "Temic 4032FY5" },
{ TUNER_TEMIC_PAL, "Temic 4002FH5" },
{ TUNER_TEMIC_PAL_I, "Temic 4062FY5" },
{ TUNER_PHILIPS_PAL, "Philips FR1216 MK2" },
{ TUNER_PHILIPS_SECAM, "Philips FR1216MF MK2" },
{ TUNER_PHILIPS_NTSC, "Philips FR1236 MK2" },
{ TUNER_PHILIPS_PAL_I, "Philips FR1246 MK2" },
{ TUNER_PHILIPS_PAL_DK,"Philips FR1256 MK2" },
{ TUNER_PHILIPS_PAL, "Philips FM1216" },
{ TUNER_PHILIPS_SECAM, "Philips FM1216MF" },
{ TUNER_PHILIPS_NTSC, "Philips FM1236" },
{ TUNER_PHILIPS_PAL_I, "Philips FM1246" },
{ TUNER_PHILIPS_PAL_DK,"Philips FM1256" },
{ TUNER_TEMIC_4036FY5_NTSC, "Temic 4036FY5" },
{ TUNER_ABSENT, "Samsung TCPN9082D" },
{ TUNER_ABSENT, "Samsung TCPM9092P" },
{ TUNER_TEMIC_4006FH5_PAL, "Temic 4006FH5" },
{ TUNER_ABSENT, "Samsung TCPN9085D" },
{ TUNER_ABSENT, "Samsung TCPB9085P" },
{ TUNER_ABSENT, "Samsung TCPL9091P" },
{ TUNER_TEMIC_4039FR5_NTSC, "Temic 4039FR5" },
{ TUNER_PHILIPS_FQ1216ME, "Philips FQ1216 ME" },
{ TUNER_TEMIC_4066FY5_PAL_I, "Temic 4066FY5" },
{ TUNER_ABSENT, "Philips TD1536" },
{ TUNER_ABSENT, "Philips TD1536D" },
{ TUNER_ABSENT, "Philips FMR1236" },
{ TUNER_ABSENT, "Philips FI1256MP" },
{ TUNER_ABSENT, "Samsung TCPQ9091P" },
{ TUNER_TEMIC_4006FN5_MULTI_PAL, "Temic 4006FN5" },
{ TUNER_TEMIC_4009FR5_PAL, "Temic 4009FR5" },
{ TUNER_TEMIC_4046FM5, "Temic 4046FM5" },
{ TUNER_ABSENT, "Temic 4009FN5" },
{ TUNER_ABSENT, "Philips TD1536D_FH_44"},
{ TUNER_ABSENT, "LG TP18NSR01F"},
{ TUNER_ABSENT, "LG TP18PSB01D"},
{ TUNER_ABSENT, "LG TP18PSB11D"},
{ TUNER_ABSENT, "LG TAPC_l001D"},
{ TUNER_ABSENT, "LG TAPC_l701D"}
};
static void __devinit hauppauge_eeprom(struct bttv *btv)
{
int blk2,tuner,radio,model;
if (eeprom_data[0] != 0x84 || eeprom_data[2] != 0)
printk("bttv%d: Hauppauge eeprom: invalid\n",btv->nr);
/* Block 2 starts after len+3 bytes header */
blk2 = eeprom_data[1] + 3;
/* decode + use some config infos */
model = eeprom_data[12] << 8 | eeprom_data[11];
tuner = eeprom_data[9];
radio = eeprom_data[blk2-1] & 0x01;
if (tuner < sizeof(hauppauge_tuner)/sizeof(struct HAUPPAUGE_TUNER))
btv->tuner_type = hauppauge_tuner[tuner].id;
if (radio)
btv->has_radio = 1;
if (bttv_verbose)
printk("bttv%d: Hauppauge eeprom: model=%d, tuner=%s (%d), radio=%s\n",
btv->nr, model, hauppauge_tuner[tuner].name,
btv->tuner_type, radio ? "yes" : "no");
}
void __devinit bttv_hauppauge_boot_msp34xx(struct bttv *btv)
{
/* reset/enable the MSP on some Hauppauge cards */
/* Thanks to Kyösti Mälkki (kmalkki@cc.hut.fi)! */
btaor(32, ~32, BT848_GPIO_OUT_EN);
btaor(0, ~32, BT848_GPIO_DATA);
udelay(2500);
btaor(32, ~32, BT848_GPIO_DATA);
if (bttv_gpio)
bttv_gpio_tracking(btv,"msp34xx");
if (bttv_verbose)
printk("bttv%d: Hauppauge msp34xx: reset line init\n",btv->nr);
}
/* ----------------------------------------------------------------------- */
/* Imagenation L-Model PXC200 Framegrabber */
/* This is basically the same procedure as
* used by Alessandro Rubini in his pxc200
* driver, but using BTTV functions */
static void __devinit init_PXC200(struct bttv *btv)
{
static const int vals[] = { 0x08, 0x09, 0x0a, 0x0b, 0x0d, 0x0d,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
0x00 };
int i,tmp;
/* Initialise GPIO-connevted stuff */
btwrite(1<<13,BT848_GPIO_OUT_EN); /* Reset pin only */
btwrite(0,BT848_GPIO_DATA);
udelay(3);
btwrite(1<<13,BT848_GPIO_DATA);
/* GPIO inputs are pulled up, so no need to drive
* reset pin any longer */
btwrite(0,BT848_GPIO_OUT_EN);
if (bttv_gpio)
bttv_gpio_tracking(btv,"pxc200");
/* we could/should try and reset/control the AD pots? but
right now we simply turned off the crushing. Without
this the AGC drifts drifts
remember the EN is reverse logic -->
setting BT848_ADC_AGC_EN disable the AGC
tboult@eecs.lehigh.edu
*/
btwrite(BT848_ADC_RESERVED|BT848_ADC_AGC_EN, BT848_ADC);
/* Initialise MAX517 DAC */
printk(KERN_INFO "Setting DAC reference voltage level ...\n");
bttv_I2CWrite(btv,0x5E,0,0x80,1);
/* Initialise 12C508 PIC */
/* The I2CWrite and I2CRead commmands are actually to the
* same chips - but the R/W bit is included in the address
* argument so the numbers are different */
printk(KERN_INFO "Initialising 12C508 PIC chip ...\n");
for (i = 0; i < sizeof(vals)/sizeof(int); i++) {
tmp=bttv_I2CWrite(btv,0x1E,vals[i],0,1);
printk(KERN_INFO "I2C Write(0x08) = %i\nI2C Read () = %x\n\n",
tmp,bttv_I2CRead(btv,0x1F,NULL));
}
printk(KERN_INFO "PXC200 Initialised.\n");
}
/* ----------------------------------------------------------------------- */
/* Miro Pro radio stuff -- the tea5757 is connected to some GPIO ports */
/*
* Copyright (c) 1999 Csaba Halasz <qgehali@uni-miskolc.hu>
* This code is placed under the terms of the GNU General Public License
*
* Brutally hacked by Dan Sheridan <dan.sheridan@contact.org.uk> djs52 8/3/00
*/
#if 0
/* bus bits on the GPIO port */
#define TEA_WE 6
#define TEA_DATA 9
#define TEA_CLK 8
#define TEA_MOST 7
#endif
#define BUS_LOW(bit) btand(~(bit), BT848_GPIO_DATA)
#define BUS_HIGH(bit) btor((bit), BT848_GPIO_DATA)
#define BUS_IN(bit) (btread(BT848_GPIO_DATA) & (bit))
/* TEA5757 register bits */
#define TEA_FREQ 0:14
#define TEA_BUFFER 15:15
#define TEA_SIGNAL_STRENGTH 16:17
#define TEA_PORT1 18:18
#define TEA_PORT0 19:19
#define TEA_BAND 20:21
#define TEA_BAND_FM 0
#define TEA_BAND_MW 1
#define TEA_BAND_LW 2
#define TEA_BAND_SW 3
#define TEA_MONO 22:22
#define TEA_ALLOW_STEREO 0
#define TEA_FORCE_MONO 1
#define TEA_SEARCH_DIRECTION 23:23
#define TEA_SEARCH_DOWN 0
#define TEA_SEARCH_UP 1
#define TEA_STATUS 24:24
#define TEA_STATUS_TUNED 0
#define TEA_STATUS_SEARCHING 1
/* Low-level stuff */
static int tea5757_read(struct bttv *btv)
{
int value = 0;
long timeout;
int i;
/* better safe than sorry */
btaor((btv->mbox_clk | btv->mbox_we),
~btv->mbox_mask, BT848_GPIO_OUT_EN);
if (bttv_gpio)
bttv_gpio_tracking(btv,"tea5757 read");
BUS_LOW(btv->mbox_we);
BUS_LOW(btv->mbox_clk);
udelay(10);
for(timeout = jiffies + 10 * HZ;
BUS_IN(btv->mbox_data) && time_before(jiffies, timeout);
schedule()); /* 10 s */
if (BUS_IN(btv->mbox_data)) {
printk("bttv%d: tea5757: read timeout\n",btv->nr);
return -1;
}
for(timeout = jiffies + HZ/5;
BUS_IN(btv->mbox_data) == 1 && time_before(jiffies, timeout);
schedule()); /* 0.2 s */
dprintk("bttv%d: tea5757:",btv->nr);
for(i = 0; i < 24; i++)
{
udelay(5);
BUS_HIGH(btv->mbox_clk);
udelay(5);
dprintk("%c",(BUS_IN(btv->mbox_most) == 0)?'T':'-');
BUS_LOW(btv->mbox_clk);
value <<= 1;
value |= (BUS_IN(btv->mbox_data) == 0)?0:1; /* MSB first */
dprintk("%c", (BUS_IN(btv->mbox_most) == 0)?'S':'M');
}
dprintk("\nbttv%d: tea5757: read 0x%X\n", btv->nr, value);
return value;
}
static int tea5757_write(struct bttv *btv, int value)
{
int i;
int reg = value;
btaor(btv->mbox_clk | btv->mbox_we | btv->mbox_data,
~btv->mbox_mask, BT848_GPIO_OUT_EN);
if (bttv_gpio)
bttv_gpio_tracking(btv,"tea5757 write");
dprintk("bttv%d: tea5757: write 0x%X\n", btv->nr, value);
BUS_LOW(btv->mbox_clk);
BUS_HIGH(btv->mbox_we);
for(i = 0; i < 25; i++)
{
if (reg & 0x1000000)
BUS_HIGH(btv->mbox_data);
else
BUS_LOW(btv->mbox_data);
reg <<= 1;
BUS_HIGH(btv->mbox_clk);
udelay(10);
BUS_LOW(btv->mbox_clk);
udelay(10);
}
BUS_LOW(btv->mbox_we); /* unmute !!! */
return 0;
}
void tea5757_set_freq(struct bttv *btv, unsigned short freq)
{
tea5757_write(btv, 5 * freq + 0x358); /* add 10.7MHz (see docs) */
if (bttv_debug)
tea5757_read(btv);
}
/* ----------------------------------------------------------------------- */
/* winview */
void winview_audio(struct bttv *btv, struct video_audio *v, int set)
{
/* PT2254A programming Jon Tombs, jon@gte.esi.us.es */
int bits_out, loops, vol, data;
if (!set) {
v->mode |= VIDEO_AUDIO_VOLUME;
return;
}
/* 32 levels logarithmic */
vol = 32 - ((v->volume>>11));
/* units */
bits_out = (PT2254_DBS_IN_2>>(vol%5));
/* tens */
bits_out |= (PT2254_DBS_IN_10>>(vol/5));
bits_out |= PT2254_L_CHANEL | PT2254_R_CHANEL;
data = btread(BT848_GPIO_DATA);
data &= ~(WINVIEW_PT2254_CLK| WINVIEW_PT2254_DATA|
WINVIEW_PT2254_STROBE);
for (loops = 17; loops >= 0 ; loops--) {
if (bits_out & (1<<loops))
data |= WINVIEW_PT2254_DATA;
else
data &= ~WINVIEW_PT2254_DATA;
btwrite(data, BT848_GPIO_DATA);
udelay(5);
data |= WINVIEW_PT2254_CLK;
btwrite(data, BT848_GPIO_DATA);
udelay(5);
data &= ~WINVIEW_PT2254_CLK;
btwrite(data, BT848_GPIO_DATA);
}
data |= WINVIEW_PT2254_STROBE;
data &= ~WINVIEW_PT2254_DATA;
btwrite(data, BT848_GPIO_DATA);
udelay(10);
data &= ~WINVIEW_PT2254_STROBE;
btwrite(data, BT848_GPIO_DATA);
}
/* ----------------------------------------------------------------------- */
/* mono/stereo control for various cards (which don't use i2c chips but */
/* connect something to the GPIO pins */
static void
gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set)
{
unsigned int con = 0;
if (set) {
btor(0x300, BT848_GPIO_OUT_EN);
if (v->mode & VIDEO_SOUND_LANG1)
con = 0x000;
if (v->mode & VIDEO_SOUND_LANG2)
con = 0x300;
if (v->mode & VIDEO_SOUND_STEREO)
con = 0x200;
// if (v->mode & VIDEO_SOUND_MONO)
// con = 0x100;
btaor(con, ~0x300, BT848_GPIO_DATA);
} else {
v->mode = VIDEO_SOUND_STEREO |
VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
}
}
/*
* Mario Medina Nussbaum <medisoft@alohabbs.org.mx>
* I discover that on BT848_GPIO_DATA address a byte 0xcce enable stereo,
* 0xdde enables mono and 0xccd enables sap
*
* Petr Vandrovec <VANDROVE@vc.cvut.cz>
* P.S.: At least mask in line above is wrong - GPIO pins 3,2 select
* input/output sound connection, so both must be set for output mode.
*
* Looks like it's needed only for the "tvphone", the "tvphone 98"
* handles this with a tda9840
*
*/
static void
avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, int set)
{
int val = 0;
if (set) {
if (v->mode & VIDEO_SOUND_LANG1) /* SAP */
val = 0x02;
if (v->mode & VIDEO_SOUND_STEREO)
val = 0x01;
if (val) {
btaor(val, ~0x03, BT848_GPIO_DATA);
if (bttv_gpio)
bttv_gpio_tracking(btv,"avermedia");
}
} else {
v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
VIDEO_SOUND_LANG1;
return;
}
}
static void
terratv_audio(struct bttv *btv, struct video_audio *v, int set)
{
unsigned int con = 0;
if (set) {
btor(0x180000, BT848_GPIO_OUT_EN);
if (v->mode & VIDEO_SOUND_LANG2)
con = 0x080000;
if (v->mode & VIDEO_SOUND_STEREO)
con = 0x180000;
btaor(con, ~0x180000, BT848_GPIO_DATA);
if (bttv_gpio)
bttv_gpio_tracking(btv,"terratv");
} else {
v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
}
}
/* ----------------------------------------------------------------------- */
/* motherboard chipset specific stuff */
void __devinit bttv_check_chipset(void)
{
int pcipci_fail = 0;
struct pci_dev *dev = NULL;
/* for 2.4.x we'll use the pci quirks (drivers/pci/quirks.c) */
if (pci_pci_problems & PCIPCI_FAIL)
pcipci_fail = 1;
if (pci_pci_problems & (PCIPCI_TRITON|PCIPCI_NATOMA|PCIPCI_VIAETBF))
triton1 = 1;
/* print warnings about quirks found */
if (triton1)
printk(KERN_INFO "bttv: Host bridge needs ETBF enabled.\n");
if (pcipci_fail) {
printk(KERN_WARNING "bttv: BT848 and your chipset may not work together.\n");
if (-1 == no_overlay) {
printk(KERN_WARNING "bttv: going to disable overlay.\n");
no_overlay = 1;
}
}
while ((dev = pci_find_device(PCI_VENDOR_ID_INTEL,
PCI_DEVICE_ID_INTEL_82441, dev))) {
unsigned char b;
pci_read_config_byte(dev, 0x53, &b);
if (bttv_debug)
printk(KERN_INFO "bttv: Host bridge: 82441FX Natoma, "
"bufcon=0x%02x\n",b);
}
}
int __devinit bttv_handle_chipset(struct bttv *btv)
{
unsigned char command;
if (!triton1)
return 0;
if (bttv_verbose)
printk("bttv%d: enabling 430FX/VP3 compatibilty\n",btv->nr);
if (btv->id < 878) {
/* bt848 (mis)uses a bit in the irq mask */
btv->triton1 = BT848_INT_ETBF;
} else {
/* bt878 has a bit in the pci config space for it */
pci_read_config_byte(btv->dev, BT878_DEVCTRL, &command);
command |= BT878_EN_TBFX;
pci_write_config_byte(btv->dev, BT878_DEVCTRL, command);
pci_read_config_byte(btv->dev, BT878_DEVCTRL, &command);
if (!(command&BT878_EN_TBFX)) {
printk("bttv: 430FX compatibility could not be enabled\n");
return -1;
}
}
return 0;
}
/*
* Local variables:
* c-basic-offset: 8
* End:
*/
|