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

📄 bttv-cards.c

📁 microwindows移植到S3C44B0的源码
💻 C
📖 第 1 页 / 共 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) {		/* Fixed by Leandro Lucarella <luca@linuxmendoza.org.ar (07/31/01) */		v->flags |= 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_CHANNEL | PT2254_R_CHANNEL;	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 voidgvbctv3pci_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 voidavermedia_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;	}}/* Lifetec 9415 handling */static voidlt9415_audio(struct bttv *btv, struct video_audio *v, int set){        int val = 0;        if (btread(BT848_GPIO_DATA) & 0x4000) {		v->mode = VIDEO_SOUND_MONO;		return;	}        if (set) {                if (v->mode & VIDEO_SOUND_LANG2)  /* A2 SAP */                        val = 0x0080;		if (v->mode & VIDEO_SOUND_STEREO) /* A2 stereo */                        val = 0x0880;                if ((v->mode & VIDEO_SOUND_LANG1) ||		    (v->mode & VIDEO_SOUND_MONO))			val = 0;                btaor(val, ~0x0880, BT848_GPIO_DATA);                if (bttv_gpio)                        bttv_gpio_tracking(btv,"lt9415");        } else {		/* autodetect doesn't work with this card :-( */                v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |			VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;                return;        }}static voidterratv_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;	}}static voidwinfast2000_audio(struct bttv *btv, struct video_audio *v, int set){	unsigned long val = 0;	if (set) {		/*btor (0xc32000, BT848_GPIO_OUT_EN);*/		if (v->mode & VIDEO_SOUND_MONO)		/* Mono */			val = 0x420000;		if (v->mode & VIDEO_SOUND_LANG1)	/* Mono */			val = 0x420000;		if (v->mode & VIDEO_SOUND_LANG2)	/* SAP */			val = 0x410000;		if (v->mode & VIDEO_SOUND_STEREO)	/* Stereo */			val = 0x020000;		if (val) {			btaor(val, ~0x430000, BT848_GPIO_DATA);			if (bttv_gpio)				bttv_gpio_tracking(btv,"winfast2000");		}	} else {		v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |			  VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;	}}/* * Dariusz Kowalewski <darekk@automex.pl> * sound control for Prolink PV-BT878P+9B (PixelView PlayTV Pro FM+NICAM * revision 9B has on-board TDA9874A sound decoder). */static voidpvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set){	unsigned int val = 0;#if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0)	if (btv->radio_user)		return;#else	if (btv->radio)		return;#endif	if (set) {		if (v->mode & VIDEO_SOUND_MONO)	{			val = 0x01;		}		if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2))		    || (v->mode & VIDEO_SOUND_STEREO)) {			val = 0x02;		}		if (val) {			btaor(val, ~0x03, BT848_GPIO_DATA);			if (bttv_gpio)				bttv_gpio_tracking(btv,"pvbt878p9b");		}	} else {		v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |			VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;	}}/* * Dariusz Kowalewski <darekk@automex.pl> * sound control for FlyVideo 2000S (with tda9874 decoder)  * based on pvbt878p9b_audio() - this is not tested, please fix!!! */static voidfv2000s_audio(struct bttv *btv, struct video_audio *v, int set){	unsigned int val = 0xffff;#if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0)	if (btv->radio_user)		return;#else	if (btv->radio)		return;#endif	if (set) {		if (v->mode & VIDEO_SOUND_MONO)	{			val = 0x0000;		}		if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2))		    || (v->mode & VIDEO_SOUND_STEREO)) {			val = 0x1080; //-dk-???: 0x0880, 0x0080, 0x1800 ...		}		if (val != 0xffff) {			btaor(val, ~0x1800, BT848_GPIO_DATA);			if (bttv_gpio)				bttv_gpio_tracking(btv,"fv2000s");		}	} else {		v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |			VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;	}}/* * sound control for Canopus WinDVR PCI * Masaki Suzuki <masaki@btree.org> */static voidwindvr_audio(struct bttv *btv, struct video_audio *v, int set){        unsigned long val = 0;        if (set) {                if (v->mode & VIDEO_SOUND_MONO)                        val = 0x040000;                if (v->mode & VIDEO_SOUND_LANG1)                        val = 0;                if (v->mode & VIDEO_SOUND_LANG2)                        val = 0x100000;                if (v->mode & VIDEO_SOUND_STEREO)                        val = 0;                if (val) {                        btaor(val, ~0x140000, BT848_GPIO_DATA);                        if (bttv_gpio)                                bttv_gpio_tracking(btv,"windvr");                }        } else {                v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |                          VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;        }}/* RemoteVision MX (rv605) muxsel helper [Miguel Freitas] * * This is needed because rv605 don't use a normal multiplex, but a crosspoint * switch instead (CD22M3494E). This IC can have multiple active connections * between Xn (input) and Yn (output) pins. We need to clear any existing * connection prior to establish a new one, pulsing the STROBE pin. * * The board hardwire Y0 (xpoint) to MUX1 and MUXOUT to Yin. * GPIO pins are wired as: *  GPIO[0:3] - AX[0:3] (xpoint) - P1[0:3] (microcontroler) *  GPIO[4:6] - AY[0:2] (xpoint) - P1[4:6] (microcontroler) *  GPIO[7]   - DATA (xpoint)    - P1[7] (microcontroler) *  GPIO[8]   -                  - P3[5] (microcontroler) *  GPIO[9]   - RESET (xpoint)   - P3[6] (microcontroler) *  GPIO[10]  - STROBE (xpoint)  - P3[7] (microcontroler) *  GPINTR    -                  - P3[4] (microcontroler) * * The microcontroler is a 80C32 like. It should be possible to change xpoint * configuration either directly (as we are doing) or using the microcontroler * which is also wired to I2C interface. I have no further info on the * microcontroler features, one would need to disassembly the firmware. * note: the vendor refused to give any information on this product, all *       that stuff was found using a multimeter! :) */static void rv605_muxsel(struct bttv *btv, unsigned int input){	/* reset all conections */	btaor(0x200,~0x200, BT848_GPIO_DATA);	mdelay(1);	btaor(0x000,~0x200, BT848_GPIO_DATA);	mdelay(1);	/* create a new conection */	btaor(0x080,~0x480, BT848_GPIO_DATA);	btaor(0x480,~0x480, BT848_GPIO_DATA);	mdelay(1);	btaor(0x080,~0x480, BT848_GPIO_DATA);	mdelay(1);}/* ----------------------------------------------------------------------- *//* 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;	if (pci_pci_problems & PCIPCI_VSFX)		vsfx = 1;	/* print which chipset we have */	while ((dev = pci_find_class(PCI_CLASS_BRIDGE_HOST << 8,dev)))		printk(KERN_INFO "bttv: Host bridge is %s\n",dev->name);	/* print warnings about any quirks found */	if (triton1)		printk(KERN_INFO "bttv: Host bridge needs ETBF enabled.\n");	if (vsfx)		printk(KERN_INFO "bttv: Host bridge needs VSFX 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 && !vsfx)		return 0;	if (bttv_verbose) {		if (triton1)			printk("bttv%d: enabling ETBF (430FX/VP3 compatibilty)\n",btv->nr);		if (vsfx && btv->id >= 878)			printk("bttv%d: enabling VSFX\n",btv->nr);	}	if (btv->id < 878) {		/* bt848 (mis)uses a bit in the irq mask for etbf */		if (triton1)			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);		if (triton1)			command |= BT878_EN_TBFX;		if (vsfx)			command |= BT878_EN_VSFX;                pci_write_config_byte(btv->dev, BT878_DEVCTRL, command);        }	return 0;}/* * Local variables: * c-basic-offset: 8 * End: */

⌨️ 快捷键说明

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