⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bttv-cards.c

📁 一个2.4.21版本的嵌入式linux内核
💻 C
📖 第 1 页 / 共 5 页
字号:
	if(is_capture_only) 		tuner=4; // No tuner present 	printk(KERN_INFO "bttv%d: FlyVideo Radio=%s RemoteControl=%s Tuner=%d gpio=0x%06x\n", 	       btv->nr, has_radio? "yes":"no ", has_remote? "yes":"no ", tuner, gpio); 	printk(KERN_INFO "bttv%d: FlyVideo  LR90=%s tda9821/tda9820=%s capture_only=%s\n",		btv->nr, is_lr90?"yes":"no ", has_tda9820_tda9821?"yes":"no ", 		is_capture_only?"yes":"no ");	if(tuner!= -1) // only set if known tuner autodetected, else let insmod option through		btv->tuner_type = tuner;	btv->has_radio = has_radio;  	// LR90 Audio Routing is done by 2 hef4052, so Audio_Mask has 4 bits: 0x001c80        // LR26/LR50 only has 1 hef4052, Audio_Mask 0x000c00	// Audio options: from tuner, from tda9821/tda9821(mono,stereo,sap), from tda9874, ext., mute	if(has_tda9820_tda9821) btv->audio_hook = lt9415_audio;	//todo: if(has_tda9874) btv->audio_hook = fv2000s_audio;}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,1,0,0 };static void miro_pinnacle_gpio(struct bttv *btv){	int id,msp,gpio;	char *info;	btwrite(0,BT848_GPIO_OUT_EN);        gpio = btread(BT848_GPIO_DATA);	id   = ((gpio>>10) & 63) -1;	msp  = bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx");	if (id < 32) {		btv->tuner_type = miro_tunermap[id];		if (0 == (gpio & 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;		}		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");	} else {		/* new cards with microtune tuner */		id = 63 - id;		btv->has_radio = 0;		switch (id) {		case 1:			info = "PAL / mono";			break;		case 2:			info = "PAL+SECAM / stereo";			btv->has_radio = 1;			break;		case 3:			info = "NTSC / stereo";			btv->has_radio = 1;			break;		case 4:			info = "PAL+SECAM / mono";			break;		case 5:			info = "NTSC / mono";			break;		case 6:			info = "NTSC / stereo";			break;		default:			info = "oops: unknown card";			break;		}		if (-1 != msp)			btv->type = BTTV_PINNACLEPRO;		printk(KERN_INFO		       "bttv%d: pinnacle/mt: id=%d info=\"%s\" radio=%s\n",		       btv->nr, id, info, btv->has_radio ? "yes" : "no");		btv->tuner_type  = 33;		btv->pinnacle_id = id;	}}/* GPIO21   L: Buffer aktiv, H: Buffer inaktiv */#define LM1882_SYNC_DRIVE     0x200000Lstatic void init_ids_eagle(struct bttv *btv){	btwrite(0xFFFF37, BT848_GPIO_OUT_EN);	btwrite(0x000000, BT848_GPIO_REG_INP);		btwrite(0x200020, BT848_GPIO_DATA);		/* flash strobe inverter ?! */	btwrite(0x200024, BT848_GPIO_DATA);		/* switch sync drive off */	btor(LM1882_SYNC_DRIVE, BT848_GPIO_DATA);		/* set BT848 muxel to 2 */	btaor((2)<<5, ~(2<<5), BT848_IFORM);}/* Muxsel helper for the IDS Eagle. * the eagles does not use the standard muxsel-bits but * has its own multiplexer */static void eagle_muxsel(struct bttv *btv, unsigned int input){	btaor((2)<<5, ~(3<<5), BT848_IFORM);	btaor((bttv_tvcards[btv->type].muxsel[input&7]&3),	      ~3, BT848_GPIO_DATA);#if 0       /* svhs */       /* wake chroma ADC */       btand(~BT848_ADC_C_SLEEP, BT848_ADC);       /* set to YC video */       btor(BT848_CONTROL_COMP, BT848_E_CONTROL);       btor(BT848_CONTROL_COMP, BT848_O_CONTROL);#else       /* composite */       /* set chroma ADC to sleep */       btor(BT848_ADC_C_SLEEP, BT848_ADC);       /* set to composite video */       btand(~BT848_CONTROL_COMP, BT848_E_CONTROL);       btand(~BT848_CONTROL_COMP, BT848_O_CONTROL);#endif       /* switch sync drive off */       btor(LM1882_SYNC_DRIVE, BT848_GPIO_DATA);}/* ----------------------------------------------------------------------- *//* initialization part one -- before registering i2c bus */void __devinit bttv_init_card1(struct bttv *btv){	switch (btv->type) {	case BTTV_HAUPPAUGE:	case BTTV_HAUPPAUGE878:                boot_msp34xx(btv,5);		break;	case BTTV_VOODOOTV_FM:                boot_msp34xx(btv,20);		break;	case BTTV_AVERMEDIA98:		boot_msp34xx(btv,11);		break;	case BTTV_HAUPPAUGEPVR:		pvr_boot(btv);		break;	}}/* initialization part two -- after registering i2c bus */void __devinit bttv_init_card2(struct bttv *btv){        btv->tuner_type = -1;	if (BTTV_UNKNOWN == btv->type) {		bttv_readee(btv,eeprom_data,0xa0);		identify_by_eeprom(btv,eeprom_data);	}	switch (btv->type) {	case BTTV_MIRO:	case BTTV_MIROPRO:	case BTTV_PINNACLE:	case BTTV_PINNACLEPRO: 		/* miro/pinnacle */		miro_pinnacle_gpio(btv);		break;	case BTTV_FLYVIDEO_98:	case BTTV_MAXI:	case BTTV_LIFE_FLYKIT:	case BTTV_FLYVIDEO:	case BTTV_TYPHOON_TVIEW:	case BTTV_CHRONOS_VS2:	case BTTV_FLYVIDEO_98FM:	case BTTV_FLYVIDEO2000:	case BTTV_FLYVIDEO98EZ:	case BTTV_CONFERENCETV:	case BTTV_LIFETEC_9415:		flyvideo_gpio(btv);		break;	case BTTV_HAUPPAUGE:	case BTTV_HAUPPAUGE878:	case BTTV_HAUPPAUGEPVR:		/* pick up some config infos from the eeprom */		bttv_readee(btv,eeprom_data,0xa0);                hauppauge_eeprom(btv);		break;	case BTTV_AVERMEDIA98:	case BTTV_AVPHONE98:		bttv_readee(btv,eeprom_data,0xa0);		avermedia_eeprom(btv);		break;	case BTTV_PXC200:		init_PXC200(btv);		break;	case 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;		break;	case BTTV_VOBIS_BOOSTAR:	case BTTV_TERRATV:		terratec_active_radio_upgrade(btv);		break;	case BTTV_MAGICTVIEW061:		if (btv->cardid == 0x3002144f) {			btv->has_radio=1;			printk("bttv%d: radio detected by subsystem id (CPH05x)\n",btv->nr);		}		break;       case BTTV_STB2:                if (btv->cardid == 0x3060121a) {			/* Fix up entry for 3DFX VoodooTV 100,			   which is an OEM STB card variant. */			btv->has_radio=0;			btv->tuner_type=TUNER_TEMIC_NTSC;		}		break;	case BTTV_OSPREY1x0:	case BTTV_OSPREY1x0_848:	case BTTV_OSPREY101_848:	case BTTV_OSPREY1x1:	case BTTV_OSPREY1x1_SVID:	case BTTV_OSPREY2xx:	case BTTV_OSPREY2x0_SVID:	case BTTV_OSPREY2x0:	case BTTV_OSPREY500:	case BTTV_OSPREY540:	case BTTV_OSPREY2000:		bttv_readee(btv,eeprom_data,0xa0);                osprey_eeprom(btv);		break;	case BTTV_IDS_EAGLE:		init_ids_eagle(btv);		break;	case BTTV_MODTEC_205:		bttv_readee(btv,eeprom_data,0xa0);		modtec_eeprom(btv);		break;	}	/* 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;                }        }	btv->pll.pll_current = -1;	/* tuner configuration (from card list / autodetect / insmod option) */ 	if (UNSET != bttv_tvcards[btv->type].tuner_type)		if(UNSET == btv->tuner_type)                 	btv->tuner_type = bttv_tvcards[btv->type].tuner_type;	if (UNSET != tuner[btv->nr])		btv->tuner_type = tuner[btv->nr];	printk("bttv%d: using tuner=%d\n",btv->nr,btv->tuner_type);	if (btv->pinnacle_id != UNSET)		bttv_call_i2c_clients(btv,AUDC_CONFIG_PINNACLE,				      &btv->pinnacle_id);	if (btv->tuner_type != UNSET)		bttv_call_i2c_clients(btv,TUNER_SET_TYPE,&btv->tuner_type);	if (bttv_tvcards[btv->type].has_radio)		btv->has_radio=1;	if (bttv_tvcards[btv->type].audio_hook)		btv->audio_hook=bttv_tvcards[btv->type].audio_hook;	if (bttv_tvcards[btv->type].digital_mode == DIGITAL_MODE_CAMERA) {		/* detect Bt832 chip for quartzsight digital camera */		if ((bttv_I2CRead(btv, I2C_BT832_ALT1, "Bt832") >=0) ||		    (bttv_I2CRead(btv, I2C_BT832_ALT2, "Bt832") >=0))			boot_bt832(btv);	}	/* 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].msp34xx_alt &&	    bttv_I2CRead(btv, I2C_MSP3400_ALT, "MSP34xx (alternate address)") >=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_tvcards[btv->type].no_tda7432 && 	    bttv_I2CRead(btv, I2C_TDA7432, "TDA7432") >=0) {		if (autoload)			request_module("tda7432");	}	if (bttv_tvcards[btv->type].needs_tvaudio) {		if (autoload)			request_module("tvaudio");	}	/* tuner modules */	if (btv->pinnacle_id != UNSET) {		if (autoload)			request_module("tda9887");	}	if (btv->tuner_type != UNSET) {		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 TPI8NSR01F"},	{ TUNER_LG_PAL_FM,     "LG TPI8PSB01D"},	{ TUNER_LG_PAL,        "LG TPI8PSB11D"},		{ TUNER_LG_PAL_I_FM,   "LG TAPC-I001D"},	{ TUNER_LG_PAL_I,      "LG TAPC-I701D"}};static void modtec_eeprom(struct bttv *btv){	if( strncmp(&(eeprom_data[0x1e]),"Temic 4066 FY5",14) ==0) {		btv->tuner_type=TUNER_TEMIC_4066FY5_PAL_I;		printk("bttv Modtec: Tuner autodetected %s\n",		       &eeprom_data[0x1e]);	} else {		printk("bttv Modtec: Unknown TunerString:%s\n",		       &eeprom_data[0x1e]);	}}static void __devinit hauppauge_eeprom(struct bttv *btv){	unsigned int blk2,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -