cx88-cards.c

来自「trident tm5600的linux驱动」· C语言 代码 · 共 2,578 行 · 第 1/5 页

C
2,578
字号
/* * * device driver for Conexant 2388x based TV cards * card-specific stuff. * * (c) 2003 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] * *  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/init.h>#include <linux/module.h>#include <linux/pci.h>#include <linux/delay.h>#include "compat.h"#include "cx88.h"#include "tea5767.h"static unsigned int tuner[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };static unsigned int radio[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };static unsigned int card[]  = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };module_param_array(tuner, int, NULL, 0444);module_param_array(radio, int, NULL, 0444);module_param_array(card,  int, NULL, 0444);MODULE_PARM_DESC(tuner,"tuner type");MODULE_PARM_DESC(radio,"radio tuner type");MODULE_PARM_DESC(card,"card type");static unsigned int latency = UNSET;module_param(latency,int,0444);MODULE_PARM_DESC(latency,"pci latency timer");#define info_printk(core, fmt, arg...) \	printk(KERN_INFO "%s: " fmt, core->name , ## arg)#define warn_printk(core, fmt, arg...) \	printk(KERN_WARNING "%s: " fmt, core->name , ## arg)#define err_printk(core, fmt, arg...) \	printk(KERN_ERR "%s: " fmt, core->name , ## arg)/* ------------------------------------------------------------------ *//* board config info                                                  *//* If radio_type !=UNSET, radio_addr should be specified */static const struct cx88_board cx88_boards[] = {	[CX88_BOARD_UNKNOWN] = {		.name		= "UNKNOWN/GENERIC",		.tuner_type     = UNSET,		.radio_type     = UNSET,		.tuner_addr	= ADDR_UNSET,		.radio_addr	= ADDR_UNSET,		.input          = {{			.type   = CX88_VMUX_COMPOSITE1,			.vmux   = 0,		},{			.type   = CX88_VMUX_COMPOSITE2,			.vmux   = 1,		},{			.type   = CX88_VMUX_COMPOSITE3,			.vmux   = 2,		},{			.type   = CX88_VMUX_COMPOSITE4,			.vmux   = 3,		}},	},	[CX88_BOARD_HAUPPAUGE] = {		.name		= "Hauppauge WinTV 34xxx models",		.tuner_type     = UNSET,		.radio_type     = UNSET,		.tuner_addr	= ADDR_UNSET,		.radio_addr	= ADDR_UNSET,		.tda9887_conf   = TDA9887_PRESENT,		.input          = {{			.type   = CX88_VMUX_TELEVISION,			.vmux   = 0,			.gpio0  = 0xff00,  // internal decoder		},{			.type   = CX88_VMUX_DEBUG,			.vmux   = 0,			.gpio0  = 0xff01,  // mono from tuner chip		},{			.type   = CX88_VMUX_COMPOSITE1,			.vmux   = 1,			.gpio0  = 0xff02,		},{			.type   = CX88_VMUX_SVIDEO,			.vmux   = 2,			.gpio0  = 0xff02,		}},		.radio = {			.type   = CX88_RADIO,			.gpio0  = 0xff01,		},	},	[CX88_BOARD_GDI] = {		.name		= "GDI Black Gold",		.tuner_type     = UNSET,		.radio_type     = UNSET,		.tuner_addr	= ADDR_UNSET,		.radio_addr	= ADDR_UNSET,		.input          = {{			.type   = CX88_VMUX_TELEVISION,			.vmux   = 0,		},{			.type   = CX88_VMUX_SVIDEO,			.vmux   = 2,		}},	},	[CX88_BOARD_PIXELVIEW] = {		.name           = "PixelView",		.tuner_type     = TUNER_PHILIPS_PAL,		.radio_type     = UNSET,		.tuner_addr	= ADDR_UNSET,		.radio_addr	= ADDR_UNSET,		.input          = {{			.type   = CX88_VMUX_TELEVISION,			.vmux   = 0,			.gpio0  = 0xff00,  // internal decoder		},{			.type   = CX88_VMUX_COMPOSITE1,			.vmux   = 1,		},{			.type   = CX88_VMUX_SVIDEO,			.vmux   = 2,		}},		.radio = {			 .type  = CX88_RADIO,			 .gpio0 = 0xff10,		},	},	[CX88_BOARD_ATI_WONDER_PRO] = {		.name           = "ATI TV Wonder Pro",		.tuner_type     = TUNER_PHILIPS_4IN1,		.radio_type     = UNSET,		.tuner_addr	= ADDR_UNSET,		.radio_addr	= ADDR_UNSET,		.tda9887_conf   = TDA9887_PRESENT | TDA9887_INTERCARRIER,		.input          = {{			.type   = CX88_VMUX_TELEVISION,			.vmux   = 0,			.gpio0  = 0x03ff,		},{			.type   = CX88_VMUX_COMPOSITE1,			.vmux   = 1,			.gpio0  = 0x03fe,		},{			.type   = CX88_VMUX_SVIDEO,			.vmux   = 2,			.gpio0  = 0x03fe,		}},	},	[CX88_BOARD_WINFAST2000XP_EXPERT] = {		.name           = "Leadtek Winfast 2000XP Expert",		.tuner_type     = TUNER_PHILIPS_4IN1,		.radio_type     = UNSET,		.tuner_addr	= ADDR_UNSET,		.radio_addr	= ADDR_UNSET,		.tda9887_conf   = TDA9887_PRESENT,		.input          = {{			.type   = CX88_VMUX_TELEVISION,			.vmux   = 0,			.gpio0	= 0x00F5e700,			.gpio1  = 0x00003004,			.gpio2  = 0x00F5e700,			.gpio3  = 0x02000000,		},{			.type   = CX88_VMUX_COMPOSITE1,			.vmux   = 1,			.gpio0	= 0x00F5c700,			.gpio1  = 0x00003004,			.gpio2  = 0x00F5c700,			.gpio3  = 0x02000000,		},{			.type   = CX88_VMUX_SVIDEO,			.vmux   = 2,			.gpio0	= 0x00F5c700,			.gpio1  = 0x00003004,			.gpio2  = 0x00F5c700,			.gpio3  = 0x02000000,		}},		.radio = {			.type   = CX88_RADIO,			.gpio0	= 0x00F5d700,			.gpio1  = 0x00003004,			.gpio2  = 0x00F5d700,			.gpio3  = 0x02000000,		},	},	[CX88_BOARD_AVERTV_STUDIO_303] = {		.name           = "AverTV Studio 303 (M126)",		.tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,		.radio_type     = UNSET,		.tuner_addr	= ADDR_UNSET,		.radio_addr	= ADDR_UNSET,		.tda9887_conf   = TDA9887_PRESENT,		.input          = {{			.type   = CX88_VMUX_TELEVISION,			.vmux   = 0,			.gpio1  = 0xe09f,		},{			.type   = CX88_VMUX_COMPOSITE1,			.vmux   = 1,			.gpio1  = 0xe05f,		},{			.type   = CX88_VMUX_SVIDEO,			.vmux   = 2,			.gpio1  = 0xe05f,		}},		.radio = {			.gpio1  = 0xe0df,			.type   = CX88_RADIO,		},	},	[CX88_BOARD_MSI_TVANYWHERE_MASTER] = {		// added gpio values thanks to Michal		// values for PAL from DScaler		.name           = "MSI TV-@nywhere Master",		.tuner_type     = TUNER_MT2032,		.radio_type     = UNSET,		.tuner_addr	= ADDR_UNSET,		.radio_addr	= ADDR_UNSET,		.tda9887_conf	= TDA9887_PRESENT | TDA9887_INTERCARRIER_NTSC,		.input          = {{			.type   = CX88_VMUX_TELEVISION,			.vmux   = 0,			.gpio0  = 0x000040bf,			.gpio1  = 0x000080c0,			.gpio2  = 0x0000ff40,		},{			.type   = CX88_VMUX_COMPOSITE1,			.vmux   = 1,			.gpio0  = 0x000040bf,			.gpio1  = 0x000080c0,			.gpio2  = 0x0000ff40,		},{			.type   = CX88_VMUX_SVIDEO,			.vmux   = 2,			.gpio0  = 0x000040bf,			.gpio1  = 0x000080c0,			.gpio2  = 0x0000ff40,		}},		.radio = {			 .type   = CX88_RADIO,			 .vmux   = 3,			 .gpio0  = 0x000040bf,			 .gpio1  = 0x000080c0,			 .gpio2  = 0x0000ff20,		},	},	[CX88_BOARD_WINFAST_DV2000] = {		.name           = "Leadtek Winfast DV2000",		.tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,		.radio_type     = UNSET,		.tuner_addr	= ADDR_UNSET,		.radio_addr	= ADDR_UNSET,		.tda9887_conf   = TDA9887_PRESENT,		.input          = {{			.type   = CX88_VMUX_TELEVISION,			.vmux   = 0,			.gpio0  = 0x0035e700,			.gpio1  = 0x00003004,			.gpio2  = 0x0035e700,			.gpio3  = 0x02000000,		},{			.type   = CX88_VMUX_COMPOSITE1,			.vmux   = 1,			.gpio0  = 0x0035c700,			.gpio1  = 0x00003004,			.gpio2  = 0x0035c700,			.gpio3  = 0x02000000,		},{			.type   = CX88_VMUX_SVIDEO,			.vmux   = 2,			.gpio0  = 0x0035c700,			.gpio1  = 0x0035c700,			.gpio2  = 0x02000000,			.gpio3  = 0x02000000,		}},		.radio = {			.type   = CX88_RADIO,			.gpio0  = 0x0035d700,			.gpio1  = 0x00007004,			.gpio2  = 0x0035d700,			.gpio3  = 0x02000000,		},	},	[CX88_BOARD_LEADTEK_PVR2000] = {		// gpio values for PAL version from regspy by DScaler		.name           = "Leadtek PVR 2000",		.tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,		.radio_type     = UNSET,		.tuner_addr	= ADDR_UNSET,		.radio_addr	= ADDR_UNSET,		.tda9887_conf   = TDA9887_PRESENT,		.input          = {{			.type   = CX88_VMUX_TELEVISION,			.vmux   = 0,			.gpio0  = 0x0000bde2,			.audioroute = 1,		},{			.type   = CX88_VMUX_COMPOSITE1,			.vmux   = 1,			.gpio0  = 0x0000bde6,			.audioroute = 1,		},{			.type   = CX88_VMUX_SVIDEO,			.vmux   = 2,			.gpio0  = 0x0000bde6,			.audioroute = 1,		}},		.radio = {			.type   = CX88_RADIO,			.gpio0  = 0x0000bd62,			.audioroute = 1,		},		.mpeg           = CX88_MPEG_BLACKBIRD,	},	[CX88_BOARD_IODATA_GVVCP3PCI] = {		.name		= "IODATA GV-VCP3/PCI",		.tuner_type     = TUNER_ABSENT,		.radio_type     = UNSET,		.tuner_addr	= ADDR_UNSET,		.radio_addr	= ADDR_UNSET,		.input          = {{			.type   = CX88_VMUX_COMPOSITE1,			.vmux   = 0,		},{			.type   = CX88_VMUX_COMPOSITE2,			.vmux   = 1,		},{			.type   = CX88_VMUX_SVIDEO,			.vmux   = 2,		}},	},	[CX88_BOARD_PROLINK_PLAYTVPVR] = {		.name           = "Prolink PlayTV PVR",		.tuner_type     = TUNER_PHILIPS_FM1236_MK3,		.radio_type     = UNSET,		.tuner_addr	= ADDR_UNSET,		.radio_addr	= ADDR_UNSET,		.tda9887_conf	= TDA9887_PRESENT,		.input          = {{			.type   = CX88_VMUX_TELEVISION,			.vmux   = 0,			.gpio0  = 0xbff0,		},{			.type   = CX88_VMUX_COMPOSITE1,			.vmux   = 1,			.gpio0  = 0xbff3,		},{			.type   = CX88_VMUX_SVIDEO,			.vmux   = 2,			.gpio0  = 0xbff3,		}},		.radio = {			.type   = CX88_RADIO,			.gpio0  = 0xbff0,		},	},	[CX88_BOARD_ASUS_PVR_416] = {		.name		= "ASUS PVR-416",		.tuner_type     = TUNER_PHILIPS_FM1236_MK3,		.radio_type     = UNSET,		.tuner_addr	= ADDR_UNSET,		.radio_addr	= ADDR_UNSET,		.tda9887_conf   = TDA9887_PRESENT,		.input          = {{			.type   = CX88_VMUX_TELEVISION,			.vmux   = 0,			.gpio0  = 0x0000fde6,		},{			.type   = CX88_VMUX_SVIDEO,			.vmux   = 2,			.gpio0  = 0x0000fde6, // 0x0000fda6 L,R RCA audio in?			.audioroute = 1,		}},		.radio = {			.type   = CX88_RADIO,			.gpio0  = 0x0000fde2,		},		.mpeg           = CX88_MPEG_BLACKBIRD,	},	[CX88_BOARD_MSI_TVANYWHERE] = {		.name           = "MSI TV-@nywhere",		.tuner_type     = TUNER_MT2032,		.radio_type     = UNSET,		.tuner_addr	= ADDR_UNSET,		.radio_addr	= ADDR_UNSET,		.tda9887_conf   = TDA9887_PRESENT,		.input          = {{			.type   = CX88_VMUX_TELEVISION,			.vmux   = 0,			.gpio0  = 0x00000fbf,			.gpio2  = 0x0000fc08,		},{			.type   = CX88_VMUX_COMPOSITE1,			.vmux   = 1,			.gpio0  = 0x00000fbf,			.gpio2  = 0x0000fc68,		},{			.type   = CX88_VMUX_SVIDEO,			.vmux   = 2,			.gpio0  = 0x00000fbf,			.gpio2  = 0x0000fc68,		}},	},	[CX88_BOARD_KWORLD_DVB_T] = {		.name           = "KWorld/VStream XPert DVB-T",		.tuner_type     = TUNER_ABSENT,		.radio_type     = UNSET,		.tuner_addr	= ADDR_UNSET,		.radio_addr	= ADDR_UNSET,		.input          = {{			.type   = CX88_VMUX_COMPOSITE1,			.vmux   = 1,			.gpio0  = 0x0700,			.gpio2  = 0x0101,		},{			.type   = CX88_VMUX_SVIDEO,			.vmux   = 2,			.gpio0  = 0x0700,			.gpio2  = 0x0101,		}},		.mpeg           = CX88_MPEG_DVB,	},	[CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1] = {		.name           = "DViCO FusionHDTV DVB-T1",		.tuner_type     = TUNER_ABSENT, /* No analog tuner */		.radio_type     = UNSET,		.tuner_addr	= ADDR_UNSET,		.radio_addr	= ADDR_UNSET,		.input          = {{			.type   = CX88_VMUX_COMPOSITE1,			.vmux   = 1,			.gpio0  = 0x000027df,		},{			.type   = CX88_VMUX_SVIDEO,			.vmux   = 2,			.gpio0  = 0x000027df,		}},		.mpeg           = CX88_MPEG_DVB,	},	[CX88_BOARD_KWORLD_LTV883] = {		.name           = "KWorld LTV883RF",		.tuner_type     = TUNER_TNF_8831BGFF,		.radio_type     = UNSET,		.tuner_addr	= ADDR_UNSET,		.radio_addr	= ADDR_UNSET,		.input          = {{			.type   = CX88_VMUX_TELEVISION,			.vmux   = 0,			.gpio0  = 0x07f8,		},{			.type   = CX88_VMUX_DEBUG,			.vmux   = 0,			.gpio0  = 0x07f9,  // mono from tuner chip		},{			.type   = CX88_VMUX_COMPOSITE1,			.vmux   = 1,			.gpio0  = 0x000007fa,		},{			.type   = CX88_VMUX_SVIDEO,			.vmux   = 2,			.gpio0  = 0x000007fa,		}},		.radio = {			.type   = CX88_RADIO,			.gpio0  = 0x000007f8,		},	},	[CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q] = {		.name		= "DViCO FusionHDTV 3 Gold-Q",		.tuner_type     = TUNER_MICROTUNE_4042FI5,		.radio_type     = UNSET,		.tuner_addr	= ADDR_UNSET,		.radio_addr	= ADDR_UNSET,		/*		   GPIO[0] resets DT3302 DTV receiver		    0 - reset asserted		    1 - normal operation		   GPIO[1] mutes analog audio output connector		    0 - enable selected source		    1 - mute		   GPIO[2] selects source for analog audio output connector		    0 - analog audio input connector on tab		    1 - analog DAC output from CX23881 chip		   GPIO[3] selects RF input connector on tuner module		    0 - RF connector labeled CABLE		    1 - RF connector labeled ANT		   GPIO[4] selects high RF for QAM256 mode		    0 - normal RF		    1 - high RF		*/		.input          = {{			.type   = CX88_VMUX_TELEVISION,			.vmux   = 0,

⌨️ 快捷键说明

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