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

📄 bttv-cards.c

📁 这是一个市场上常见电视卡的驱动程序源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
/*
    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.

*/

#include <linux/config.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/kmod.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/vmalloc.h>
#ifdef CONFIG_FW_LOADER
# include <linux/firmware.h>
#endif

#include <asm/io.h>

#include "bttvp.h"
#include "bt832.h"

/* fwd decl */
static void boot_msp34xx(struct bttv *btv, int pin);
static void boot_bt832(struct bttv *btv);
static void hauppauge_eeprom(struct bttv *btv);
static void avermedia_eeprom(struct bttv *btv);
static void osprey_eeprom(struct bttv *btv);
static void modtec_eeprom(struct bttv *btv);
static void init_PXC200(struct bttv *btv);

static void winview_audio(struct bttv *btv, struct video_audio *v, int set);
static void lt9415_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 avermedia_tv_stereo_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);
static void winfast2000_audio(struct bttv *btv, struct video_audio *v, int set);
static void pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set);
static void fv2000s_audio(struct bttv *btv, struct video_audio *v, int set);
static void windvr_audio(struct bttv *btv, struct video_audio *v, int set);
static void adtvk503_audio(struct bttv *btv, struct video_audio *v, int set);
static void rv605_muxsel(struct bttv *btv, unsigned int input);
static void eagle_muxsel(struct bttv *btv, unsigned int input);
static void xguard_muxsel(struct bttv *btv, unsigned int input);
static void ivc120_muxsel(struct bttv *btv, unsigned int input);

static int terratec_active_radio_upgrade(struct bttv *btv);
static int tea5757_read(struct bttv *btv);
static int tea5757_write(struct bttv *btv, int value);
static void identify_by_eeprom(struct bttv *btv,
			       unsigned char eeprom_data[256]);

/* config variables */
static unsigned int triton1=0;
static unsigned int vsfx=0;
static unsigned int latency = UNSET;
unsigned int no_overlay=-1;

static unsigned int card[BTTV_MAX]   = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
static unsigned int pll[BTTV_MAX]    = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
static unsigned int tuner[BTTV_MAX]  = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
static unsigned int svhs[BTTV_MAX]   = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
static unsigned int remote[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
#ifdef MODULE
static unsigned int autoload = 1;
#else
static unsigned int autoload = 0;
#endif
static unsigned int gpiomask = UNSET;
static unsigned int audioall = UNSET;
static unsigned int audiomux[5] = { [ 0 ... 4 ] = UNSET };

/* insmod options */
MODULE_PARM(triton1,"i");
MODULE_PARM_DESC(triton1,"set ETBF pci config bit "
		 "[enable bug compatibility for triton1 + others]");
MODULE_PARM(vsfx,"i");
MODULE_PARM_DESC(vsfx,"set VSFX pci config bit "
		 "[yet another chipset flaw workaround]");
MODULE_PARM(no_overlay,"i");
MODULE_PARM(latency,"i");
MODULE_PARM_DESC(latency,"pci latency timer");
MODULE_PARM(card,"1-" __stringify(BTTV_MAX) "i");
MODULE_PARM_DESC(card,"specify TV/grabber card model, see CARDLIST file for a list");
MODULE_PARM(pll,"1-" __stringify(BTTV_MAX) "i");
MODULE_PARM_DESC(pll,"specify installed crystal (0=none, 28=28 MHz, 35=35 MHz)");
MODULE_PARM(tuner,"1-" __stringify(BTTV_MAX) "i");
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(svhs,"1-" __stringify(BTTV_MAX) "i");
MODULE_PARM(remote,"1-" __stringify(BTTV_MAX) "i");

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 = {
	{ 0x13eb0070, BTTV_HAUPPAUGE878,  "Hauppauge WinTV" },
	{ 0x39000070, BTTV_HAUPPAUGE878,  "Hauppauge WinTV-D" },
	{ 0x45000070, BTTV_HAUPPAUGEPVR,  "Hauppauge WinTV/PVR" },
	{ 0xff000070, BTTV_OSPREY1x0,     "Osprey-100" },
	{ 0xff010070, BTTV_OSPREY2x0_SVID,"Osprey-200" },
	{ 0xff020070, BTTV_OSPREY500,     "Osprey-500" },
	{ 0xff030070, BTTV_OSPREY2000,    "Osprey-2000" },
	{ 0xff040070, BTTV_OSPREY540,     "Osprey-540" },

	{ 0x00011002, BTTV_ATI_TVWONDER,  "ATI TV Wonder" },
	{ 0x00031002, BTTV_ATI_TVWONDERVE,"ATI TV Wonder/VE" },

	{ 0x6606107d, BTTV_WINFAST2000,   "Leadtek WinFast TV 2000" },
	{ 0x6607107d, BTTV_WINFASTVC100,  "Leadtek WinFast VC 100" },
	{ 0x263610b4, BTTV_STB2,          "STB TV PCI FM, Gateway P/N 6000704" },
	{ 0x264510b4, BTTV_STB2,          "STB TV PCI FM, Gateway P/N 6000704" },
 	{ 0x402010fc, BTTV_GVBCTV3PCI,    "I-O Data Co. GV-BCTV3/PCI" },
	{ 0x405010fc, BTTV_GVBCTV4PCI,    "I-O Data Co. GV-BCTV4/PCI" },
	{ 0x407010fc, BTTV_GVBCTV5PCI,    "I-O Data Co. GV-BCTV5/PCI" },
 	{ 0xd01810fc, BTTV_GVBCTV3PCI,    "I-O Data Co. GV-BCTV3/PCI" },

	{ 0x001211bd, BTTV_PINNACLE,      "Pinnacle PCTV" },
	{ 0x001c11bd, BTTV_PINNACLESAT,   "Pinnacle PCTV Sat" },
	// some cards ship with byteswapped IDs ...
	{ 0x1200bd11, BTTV_PINNACLE,      "Pinnacle PCTV [bswap]" },
	{ 0xff00bd11, BTTV_PINNACLE,      "Pinnacle PCTV [bswap]" },

	{ 0x3000121a, BTTV_VOODOOTV_FM,   "3Dfx VoodooTV FM/ VoodooTV 200" },
	{ 0x3060121a, BTTV_STB2,	  "3Dfx VoodooTV 100/ STB OEM" },
	
	{ 0x3000144f, BTTV_MAGICTVIEW063, "(Askey Magic/others) TView99 CPH06x" },
	{ 0x3002144f, BTTV_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH05x" },
	{ 0x3005144f, BTTV_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH061/06L (T1/LC)" },
	{ 0x5000144f, BTTV_MAGICTVIEW061, "Askey CPH050" },
	{ 0x300014ff, BTTV_MAGICTVIEW061, "TView 99 (CPH061)" },
	{ 0x300214ff, BTTV_PHOEBE_TVMAS,  "Phoebe TV Master (CPH060)" },

	{ 0x00011461, BTTV_AVPHONE98,     "AVerMedia TVPhone98" },
	{ 0x00021461, BTTV_AVERMEDIA98,   "AVermedia TVCapture 98" },
	{ 0x00031461, BTTV_AVPHONE98,     "AVerMedia TVPhone98" },
	{ 0x00041461, BTTV_AVERMEDIA98,   "AVerMedia TVCapture 98" },
	{ 0x03001461, BTTV_AVERMEDIA98,   "VDOMATE TV TUNER CARD" },

	{ 0x1117153b, BTTV_TERRATVALUE,   "Terratec TValue (Philips PAL B/G)" },
	{ 0x1118153b, BTTV_TERRATVALUE,   "Terratec TValue (Temic PAL B/G)" },
	{ 0x1119153b, BTTV_TERRATVALUE,   "Terratec TValue (Philips PAL I)" },
	{ 0x111a153b, BTTV_TERRATVALUE,   "Terratec TValue (Temic PAL I)" },
 
	{ 0x1123153b, BTTV_TERRATVRADIO,  "Terratec TV Radio+" },
	{ 0x1127153b, BTTV_TERRATV,       "Terratec TV+ (V1.05)"    },
	// clashes with FlyVideo
	//{ 0x18521852, BTTV_TERRATV,     "Terratec TV+ (V1.10)"    },
	{ 0x1134153b, BTTV_TERRATVALUE,   "Terratec TValue (LR102)" },
	{ 0x1135153b, BTTV_TERRATVALUER,  "Terratec TValue Radio" }, // LR102
	{ 0x5018153b, BTTV_TERRATVALUE,   "Terratec TValue" }, // ??

	{ 0x400015b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV" },
	{ 0x400a15b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV" },
	{ 0x400d15b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
	{ 0x401015b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
	{ 0x401615b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },

	{ 0x1430aa00, BTTV_PV143,         "Provideo PV143A" },
	{ 0x1431aa00, BTTV_PV143,         "Provideo PV143B" },
	{ 0x1432aa00, BTTV_PV143,         "Provideo PV143C" },
	{ 0x1433aa00, BTTV_PV143,         "Provideo PV143D" },

	{ 0x1460aa00, BTTV_PV150,         "Provideo PV150A-1" },
	{ 0x1461aa01, BTTV_PV150,         "Provideo PV150A-2" },
	{ 0x1462aa02, BTTV_PV150,         "Provideo PV150A-3" },
	{ 0x1463aa03, BTTV_PV150,         "Provideo PV150A-4" },

	{ 0x1464aa04, BTTV_PV150,         "Provideo PV150B-1" },
	{ 0x1465aa05, BTTV_PV150,         "Provideo PV150B-2" },
	{ 0x1466aa06, BTTV_PV150,         "Provideo PV150B-3" },
	{ 0x1467aa07, BTTV_PV150,         "Provideo PV150B-4" },

	{ 0xa132ff00, BTTV_IVC100,        "IVC-100"  },
	{ 0xa1550000, BTTV_IVC200,        "IVC-200"  },
	{ 0xa1550001, BTTV_IVC200,        "IVC-200"  },
	{ 0xa1550002, BTTV_IVC200,        "IVC-200"  },
	{ 0xa1550003, BTTV_IVC200,        "IVC-200"  },	
	{ 0xa1550100, BTTV_IVC200,        "IVC-200G" },
	{ 0xa1550101, BTTV_IVC200,        "IVC-200G" },
	{ 0xa1550102, BTTV_IVC200,        "IVC-200G" },
	{ 0xa1550103, BTTV_IVC200,        "IVC-200G" },
	{ 0xa182ff00, BTTV_IVC120,        "IVC-120G" },
	{ 0xa182ff01, BTTV_IVC120,        "IVC-120G" },
	{ 0xa182ff02, BTTV_IVC120,        "IVC-120G" },
	{ 0xa182ff03, BTTV_IVC120,        "IVC-120G" },
	{ 0xa182ff04, BTTV_IVC120,        "IVC-120G" },
	{ 0xa182ff05, BTTV_IVC120,        "IVC-120G" },
	{ 0xa182ff06, BTTV_IVC120,        "IVC-120G" },
	{ 0xa182ff07, BTTV_IVC120,        "IVC-120G" },
	{ 0xa182ff08, BTTV_IVC120,        "IVC-120G" },
	{ 0xa182ff09, BTTV_IVC120,        "IVC-120G" },
	{ 0xa182ff0a, BTTV_IVC120,        "IVC-120G" },
	{ 0xa182ff0b, BTTV_IVC120,        "IVC-120G" },
	{ 0xa182ff0c, BTTV_IVC120,        "IVC-120G" },
	{ 0xa182ff0d, BTTV_IVC120,        "IVC-120G" },
	{ 0xa182ff0e, BTTV_IVC120,        "IVC-120G" },
	{ 0xa182ff0f, BTTV_IVC120,        "IVC-120G" },
	
	{ 0x41424344, BTTV_GRANDTEC,      "GrandTec Multi Capture" },
	{ 0x01020304, BTTV_XGUARD,        "Grandtec Grand X-Guard" },
	
    	{ 0x010115cb, BTTV_GMV1,          "AG GMV1" },
	{ 0x010114c7, BTTV_MODTEC_205,    "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV" },
	{ 0x18501851, BTTV_CHRONOS_VS2,   "FlyVideo 98 (LR50)/ Chronos Video Shuttle II" },
	{ 0x18511851, BTTV_FLYVIDEO98EZ,  "FlyVideo 98EZ (LR51)/ CyberMail AV" },
	{ 0x18521852, BTTV_TYPHOON_TVIEW, "FlyVideo 98FM (LR50)/ Typhoon TView TV/FM Tuner" },
	{ 0x41a0a051, BTTV_FLYVIDEO_98FM, "Lifeview FlyVideo 98 LR50 Rev Q" },
	{ 0x10b42636, BTTV_HAUPPAUGE878,  "STB ???" },
	{ 0x217d6606, BTTV_WINFAST2000,   "Leadtek WinFast TV 2000" },
	{ 0xfff6f6ff, BTTV_WINFAST2000,   "Leadtek WinFast TV 2000" },
	{ 0x03116000, BTTV_SENSORAY311,   "Sensoray 311" },
	{ 0x00790e11, BTTV_WINDVR,        "Canopus WinDVR PCI" },
	{ 0xa0fca1a0, BTTV_ZOLTRIX,       "Face to Face Tvmax" },
	{ 0x20007063, BTTV_PC_HDTV,       "pcHDTV HD-2000 TV"},

	// likely broken, vendor id doesn't match the other magic views ...
	//{ 0xa0fca04f, BTTV_MAGICTVIEW063, "Guillemot Maxi TV Video 3" },
	
	// DVB cards (using pci function .1 for mpeg data xfer)
	{ 0x01010071, BTTV_NEBULA_DIGITV, "Nebula Electronics DigiTV" },
	{ 0x002611bd, BTTV_TWINHAN_DST,   "Pinnacle PCTV SAT CI" },
	{ 0x00011822, BTTV_TWINHAN_DST,   "Twinhan VisionPlus DVB-T" },
	
	{ 0, -1, NULL }
};

/* ----------------------------------------------------------------------- */
/* array with description for bt848 / bt878 tv/grabber cards               */

struct tvcard bttv_tvcards[] = {
{
/* ---- card 0x00 ---------------------------------- */
	.name		= " *** UNKNOWN/GENERIC *** ",
	.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 (bt848)",
	.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, Gateway P/N 6000699 (bt848)",
	.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     = TUNER_PHILIPS_NTSC,
	.pll            = PLL_28,
	.has_radio      = 1,
},{

/* ---- card 0x04 ---------------------------------- */
	.name		= "Intel Create and Share PCI/ Smart Video Recorder III",
	.video_inputs	= 4,
	.audio_inputs	= 0,
	.tuner		= -1,
	.svhs		= 2,
	.gpiomask	= 0,
	.muxsel		= { 2, 3, 1, 1},
	.audiomux	= { 0 },
	.needs_tvaudio	= 0,
	.tuner_type	= 4,
},{
	.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,
	.muxsel		= { 2, 3, 1, 1},
	.gpiomask	= 0x0f,
	.audiomux	= { 0x0c, 0x04, 0x08, 0x04, 0},
	/*                0x04 for some cards ?? */
	.needs_tvaudio	= 1,
	.tuner_type	= -1,
	.audio_hook	= avermedia_tvphone_audio,
	.has_remote     = 1,
},{
	.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		= "Lifeview FlyVideo II (Bt848) LR26 / MAXI TV Video PCI2 LR26",
	.video_inputs	= 4,
	.audio_inputs	= 1,
	.tuner		= 0,
	.svhs		= 2,
	.gpiomask	= 0xc00,
	.muxsel		= { 2, 3, 1, 1},
	.audiomux	= { 0, 0xc00, 0x800, 0x400, 0xc00, 0},
	.needs_tvaudio	= 1,
	.pll		= PLL_28,
	.tuner_type	= -1,
},{
	.name		= "IMS/IXmicro 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	= 0,
	.pll		= PLL_28,
	.tuner_type	= TUNER_TEMIC_PAL,
},{
	.name		= "Hauppauge (bt878)",
	.video_inputs	= 4,
	.audio_inputs	= 1,
	.tuner		= 0,
	.svhs		= 2,
	.gpiomask	= 0x0f, /* old: 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",

⌨️ 快捷键说明

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