📄 bttv-cards.c
字号:
svhs: 2, gpiomask: 0x18e0, muxsel: { 2, 3, 0, 1}, audiomux: { 0,0x18e0,0x1000,0x1000,0x1080, 0x1080 }, needs_tvaudio: 1, pll: PLL_28, tuner_type: 5,},{ name: "Terratec TValueRadio", video_inputs: 3, audio_inputs: 1, tuner: 0, svhs: 2, gpiomask: 0xffff00, muxsel: { 2, 3, 1, 1}, audiomux: { 0x500, 0x500, 0x300, 0x900, 0x900}, needs_tvaudio: 1, pll: PLL_28, tuner_type: TUNER_PHILIPS_PAL, has_radio: 1,},{ /* TANAKA Kei <peg00625@nifty.com> */ name: "GV-BCTV4/PCI", 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_SHARP_2U5JF5540_NTSC, audio_hook: gvbctv3pci_audio,},{/* ---- card 0x44 ---------------------------------- */ name: "3Dfx VoodooTV FM (Euro), VoodooTV 200 (USA)", // try "insmod msp3400 simple=0" if you have // sound problems with this card. video_inputs: 4, audio_inputs: 1, tuner: 0, svhs: -1, gpiomask: 0x4f8a00, // 0x100000: 1=MSP enabled (0=disable again) // 0x010000: somehow influences tuner picture quality (?) audiomux: {0x947fff, 0x987fff,0x947fff,0x947fff}, //tvtuner, radio, external,internal,mute,stereo muxsel: { 2, 3 ,0 ,1}, /* tuner, Composit, SVid, Composit-on-Svid-adapter*/ tuner_type: TUNER_MT2032, pll: PLL_28, has_radio: 1,},{ /* Philip Blundell <pb@nexus.co.uk> */ name: "Active Imaging AIMMS", video_inputs: 1, audio_inputs: 0, tuner: -1, tuner_type: -1, pll: PLL_28, muxsel: { 2 }, gpiomask: 0},{ /* Tomasz Pyra <hellfire@sedez.iq.pl> */ name: "PV-BT878P+", video_inputs: 3, audio_inputs: 4, tuner: 0, svhs: 2, gpiomask: 15, muxsel: { 2, 3, 1, 1}, audiomux: { 0, 0, 11, 7, 13, 0}, needs_tvaudio: 1, pll: PLL_28, tuner_type: 25,},{ name: "Flyvideo 98EZ (capture only)", video_inputs: 4, audio_inputs: 0, tuner: -1, svhs: 2, muxsel: { 2, 3, 1, 1}, // AV1, AV2, SVHS, CVid adapter on SVHS pll: PLL_28, no_msp34xx: 1,},{/* ---- card 0x48 ---------------------------------- */ /* Dariusz Kowalewski <darekk@automex.pl> */ name: "Prolink PV-BT878P+9B (PlayTV Pro rev.9B FM+NICAM)", video_inputs: 3, audio_inputs: 1, tuner: 0, svhs: 2, gpiomask: 0x3f, muxsel: { 2, 3, 0, 1 }, audiomux: { 0x01, 0x00, 0x03, 0x03, 0x09, 0x02 }, needs_tvaudio: 1, no_msp34xx: 1, no_tda9875: 1, pll: PLL_28, tuner_type: -1, audio_hook: pvbt878p9b_audio, has_radio: 1,}};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: detected: %s [card=%d], " "PCI subsystem ID is %04x:%04x\n", btv->nr,cards[type].name,cards[type].cardnr, btv->cardid & 0xffff, btv->cardid >> 16); 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@bytesex.org\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: using: %s [card=%d,%s]\n",btv->nr, btv->video_dev.name,btv->type, (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(KERN_INFO "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_AVERMEDIA98 || btv->type == BTTV_AVPHONE98) { bttv_readee(btv,eeprom_data,0xa0); avermedia_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; } if (btv->type == BTTV_LIFETEC_9415) { if (btread(BT848_GPIO_DATA) & 0x4000) printk("bttv%d: lifetec: tv mono/fm stereo card\n", btv->nr); else printk("bttv%d: lifetec: stereo(TDA9821) card\n",btv->nr); } if (btv->type == BTTV_MAGICTVIEW061) { if(btv->cardid == 0x4002144f) { btv->has_radio=1; printk("bttv%d: radio detected by subsystem id (CPH05x)\n",btv->nr); } } /* 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); if (bttv_tvcards[btv->type].has_radio) btv->has_radio=1; /* 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_tvcards[btv->type].no_tda9875 && 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_PHILIPS_NTSC, "Philips FMR1236" }, /* mono radio */ { 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_TEMIC_4009FN5_MULTI_PAL_FM, "Temic 4009FN5" }, { TUNER_ABSENT, "Philips TD1536D_FH_44"}, { TUNER_LG_NTSC_FM, "LG TP18NSR01F"}, { TUNER_LG_PAL_FM, "LG TP18PSB01D"}, { TUNER_LG_PAL, "LG TP18PSB11D"}, { TUNER_LG_PAL_I_FM, "LG TAPC-I001D"}, { TUNER_LG_PAL_I, "LG TAPC-I701D"}};static void __devinit hauppauge_eeprom(struct bttv *btv){ int blk2,tuner,radio,model; if (eeprom_data[0] != 0x84 || eeprom_data[2] != 0) printk(KERN_WARNING "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(KERN_INFO "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");}// AVermedia specific stuff...// from bktr_card.cint tuner_0_table[] = { TUNER_PHILIPS_NTSC, TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL, TUNER_PHILIPS_SECAM, TUNER_PHILIPS_SECAM, TUNER_PHILIPS_SECAM, TUNER_PHILIPS_PAL};/*int tuner_0_fm_table[] = { PHILIPS_FR1236_NTSC, PHILIPS_FR1216_PAL, PHILIPS_FR1216_PAL, PHILIPS_FR1216_PAL, PHILIPS_FR1216_PAL, PHILIPS_FR1216_PAL, PHILIPS_FR1236_SECAM, PHILIPS_FR1236_SECAM, PHILIPS_FR1236_SECAM, PHILIPS_FR1216_PAL};*/int tuner_1_table[] = { TUNER_TEMIC_NTSC, TUNER_TEMIC_PAL, TUNER_TEMIC_PAL, TUNER_TEMIC_PAL, TUNER_TEMIC_PAL, TUNER_TEMIC_PAL, TUNER_TEMIC_4012FY5, TUNER_TEMIC_4012FY5, //TUNER_TEMIC_SECAM TUNER_TEMIC_4012FY5, TUNER_TEMIC_PAL};static void __devinit avermedia_eeprom(struct bttv *btv){ int tuner_make,tuner_tv_fm,tuner_format,tuner=0; tuner_make = (eeprom_data[0x41] & 0x7); tuner_tv_fm = (eeprom_data[0x41] & 0x18) >> 3; tuner_format = (eeprom_data[0x42] & 0xf0) >> 4; if (tuner_make == 0 || tuner_make == 2) if(tuner_format <=9) tuner = tuner_0_table[tuner_format]; if (tuner_make == 1) if(tuner_format <=9) tuner = tuner_1_table[tuner_format]; printk(KERN_INFO "bttv%d: Avermedia eeprom[0x%02x%02x]: tuner=", btv->nr,eeprom_data[0x41],eeprom_data[0x42]); if(tuner) { btv->tuner_type=tuner; printk("%d\n",tuner); } else printk("Unknown type\n");}/* * reset/enable the MSP on some Hauppauge cards * Thanks to Ky鰏ti M鋖kki (kmalkki@cc.hut.fi)! * * Hauppauge: pin 5
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -