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

📄 dvb-pll.c

📁 linux内核源码
💻 C
📖 第 1 页 / 共 2 页
字号:
/* * descriptions + helper functions for simple dvb plls. * * (c) 2004 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/module.h>#include <linux/dvb/frontend.h>#include <asm/types.h>#include "dvb-pll.h"struct dvb_pll_priv {	/* pll number */	int nr;	/* i2c details */	int pll_i2c_address;	struct i2c_adapter *i2c;	/* the PLL descriptor */	struct dvb_pll_desc *pll_desc;	/* cached frequency/bandwidth */	u32 frequency;	u32 bandwidth;};#define DVB_PLL_MAX 64static unsigned int dvb_pll_devcount;static int debug = 0;module_param(debug, int, 0644);MODULE_PARM_DESC(debug, "enable verbose debug messages");static unsigned int input[DVB_PLL_MAX] = { [ 0 ... (DVB_PLL_MAX-1) ] = 0 };module_param_array(input, int, NULL, 0644);MODULE_PARM_DESC(input,"specify rf input choice, 0 for autoselect (default)");static unsigned int id[DVB_PLL_MAX] =	{ [ 0 ... (DVB_PLL_MAX-1) ] = DVB_PLL_UNDEFINED };module_param_array(id, int, NULL, 0644);MODULE_PARM_DESC(id, "force pll id to use (DEBUG ONLY)");/* ----------------------------------------------------------- */struct dvb_pll_desc {	char *name;	u32  min;	u32  max;	u32  iffreq;	void (*set)(struct dvb_frontend *fe, u8 *buf,		    const struct dvb_frontend_parameters *params);	u8   *initdata;	u8   *sleepdata;	int  count;	struct {		u32 limit;		u32 stepsize;		u8  config;		u8  cb;	} entries[12];};/* ----------------------------------------------------------- *//* descriptions                                                *//* Set AGC TOP value to 103 dBuV:	0x80 = Control Byte	0x40 = 250 uA charge pump (irrelevant)	0x18 = Aux Byte to follow	0x06 = 64.5 kHz divider (irrelevant)	0x01 = Disable Vt (aka sleep)	0x00 = AGC Time constant 2s Iagc = 300 nA (vs 0x80 = 9 nA)	0x50 = AGC Take over point = 103 dBuV */static u8 tua603x_agc103[] = { 2, 0x80|0x40|0x18|0x06|0x01, 0x00|0x50 };/*	0x04 = 166.67 kHz divider	0x80 = AGC Time constant 50ms Iagc = 9 uA	0x20 = AGC Take over point = 112 dBuV */static u8 tua603x_agc112[] = { 2, 0x80|0x40|0x18|0x04|0x01, 0x80|0x20 };static struct dvb_pll_desc dvb_pll_thomson_dtt7579 = {	.name  = "Thomson dtt7579",	.min   = 177000000,	.max   = 858000000,	.iffreq= 36166667,	.sleepdata = (u8[]){ 2, 0xb4, 0x03 },	.count = 4,	.entries = {		{  443250000, 166667, 0xb4, 0x02 },		{  542000000, 166667, 0xb4, 0x08 },		{  771000000, 166667, 0xbc, 0x08 },		{  999999999, 166667, 0xf4, 0x08 },	},};static struct dvb_pll_desc dvb_pll_thomson_dtt7610 = {	.name  = "Thomson dtt7610",	.min   =  44000000,	.max   = 958000000,	.iffreq= 44000000,	.count = 3,	.entries = {		{ 157250000, 62500, 0x8e, 0x39 },		{ 454000000, 62500, 0x8e, 0x3a },		{ 999999999, 62500, 0x8e, 0x3c },	},};static void thomson_dtt759x_bw(struct dvb_frontend *fe, u8 *buf,			       const struct dvb_frontend_parameters *params){	if (BANDWIDTH_7_MHZ == params->u.ofdm.bandwidth)		buf[3] |= 0x10;}static struct dvb_pll_desc dvb_pll_thomson_dtt759x = {	.name  = "Thomson dtt759x",	.min   = 177000000,	.max   = 896000000,	.set   = thomson_dtt759x_bw,	.iffreq= 36166667,	.sleepdata = (u8[]){ 2, 0x84, 0x03 },	.count = 5,	.entries = {		{  264000000, 166667, 0xb4, 0x02 },		{  470000000, 166667, 0xbc, 0x02 },		{  735000000, 166667, 0xbc, 0x08 },		{  835000000, 166667, 0xf4, 0x08 },		{  999999999, 166667, 0xfc, 0x08 },	},};static struct dvb_pll_desc dvb_pll_lg_z201 = {	.name  = "LG z201",	.min   = 174000000,	.max   = 862000000,	.iffreq= 36166667,	.sleepdata = (u8[]){ 2, 0xbc, 0x03 },	.count = 5,	.entries = {		{  157500000, 166667, 0xbc, 0x01 },		{  443250000, 166667, 0xbc, 0x02 },		{  542000000, 166667, 0xbc, 0x04 },		{  830000000, 166667, 0xf4, 0x04 },		{  999999999, 166667, 0xfc, 0x04 },	},};static struct dvb_pll_desc dvb_pll_microtune_4042 = {	.name  = "Microtune 4042 FI5",	.min   =  57000000,	.max   = 858000000,	.iffreq= 44000000,	.count = 3,	.entries = {		{ 162000000, 62500, 0x8e, 0xa1 },		{ 457000000, 62500, 0x8e, 0x91 },		{ 999999999, 62500, 0x8e, 0x31 },	},};static struct dvb_pll_desc dvb_pll_thomson_dtt761x = {	/* DTT 7611 7611A 7612 7613 7613A 7614 7615 7615A */	.name  = "Thomson dtt761x",	.min   =  57000000,	.max   = 863000000,	.iffreq= 44000000,	.count = 3,	.initdata = tua603x_agc103,	.entries = {		{ 147000000, 62500, 0x8e, 0x39 },		{ 417000000, 62500, 0x8e, 0x3a },		{ 999999999, 62500, 0x8e, 0x3c },	},};static struct dvb_pll_desc dvb_pll_unknown_1 = {	.name  = "unknown 1", /* used by dntv live dvb-t */	.min   = 174000000,	.max   = 862000000,	.iffreq= 36166667,	.count = 9,	.entries = {		{  150000000, 166667, 0xb4, 0x01 },		{  173000000, 166667, 0xbc, 0x01 },		{  250000000, 166667, 0xb4, 0x02 },		{  400000000, 166667, 0xbc, 0x02 },		{  420000000, 166667, 0xf4, 0x02 },		{  470000000, 166667, 0xfc, 0x02 },		{  600000000, 166667, 0xbc, 0x08 },		{  730000000, 166667, 0xf4, 0x08 },		{  999999999, 166667, 0xfc, 0x08 },	},};/* Infineon TUA6010XS * used in Thomson Cable Tuner */static struct dvb_pll_desc dvb_pll_tua6010xs = {	.name  = "Infineon TUA6010XS",	.min   =  44250000,	.max   = 858000000,	.iffreq= 36125000,	.count = 3,	.entries = {		{  115750000, 62500, 0x8e, 0x03 },		{  403250000, 62500, 0x8e, 0x06 },		{  999999999, 62500, 0x8e, 0x85 },	},};/* Panasonic env57h1xd5 (some Philips PLL ?) */static struct dvb_pll_desc dvb_pll_env57h1xd5 = {	.name  = "Panasonic ENV57H1XD5",	.min   =  44250000,	.max   = 858000000,	.iffreq= 36125000,	.count = 4,	.entries = {		{  153000000, 166667, 0xc2, 0x41 },		{  470000000, 166667, 0xc2, 0x42 },		{  526000000, 166667, 0xc2, 0x84 },		{  999999999, 166667, 0xc2, 0xa4 },	},};/* Philips TDA6650/TDA6651 * used in Panasonic ENV77H11D5 */static void tda665x_bw(struct dvb_frontend *fe, u8 *buf,		       const struct dvb_frontend_parameters *params){	if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ)		buf[3] |= 0x08;}static struct dvb_pll_desc dvb_pll_tda665x = {	.name  = "Philips TDA6650/TDA6651",	.min   =  44250000,	.max   = 858000000,	.set   = tda665x_bw,	.iffreq= 36166667,	.initdata = (u8[]){ 4, 0x0b, 0xf5, 0x85, 0xab },	.count = 12,	.entries = {		{   93834000, 166667, 0xca, 0x61 /* 011 0 0 0  01 */ },		{  123834000, 166667, 0xca, 0xa1 /* 101 0 0 0  01 */ },		{  161000000, 166667, 0xca, 0xa1 /* 101 0 0 0  01 */ },		{  163834000, 166667, 0xca, 0xc2 /* 110 0 0 0  10 */ },		{  253834000, 166667, 0xca, 0x62 /* 011 0 0 0  10 */ },		{  383834000, 166667, 0xca, 0xa2 /* 101 0 0 0  10 */ },		{  443834000, 166667, 0xca, 0xc2 /* 110 0 0 0  10 */ },		{  444000000, 166667, 0xca, 0xc4 /* 110 0 0 1  00 */ },		{  583834000, 166667, 0xca, 0x64 /* 011 0 0 1  00 */ },		{  793834000, 166667, 0xca, 0xa4 /* 101 0 0 1  00 */ },		{  444834000, 166667, 0xca, 0xc4 /* 110 0 0 1  00 */ },		{  861000000, 166667, 0xca, 0xe4 /* 111 0 0 1  00 */ },	}};/* Infineon TUA6034 * used in LG TDTP E102P */static void tua6034_bw(struct dvb_frontend *fe, u8 *buf,		       const struct dvb_frontend_parameters *params){	if (BANDWIDTH_7_MHZ != params->u.ofdm.bandwidth)		buf[3] |= 0x08;}static struct dvb_pll_desc dvb_pll_tua6034 = {	.name  = "Infineon TUA6034",	.min   =  44250000,	.max   = 858000000,	.iffreq= 36166667,	.count = 3,	.set   = tua6034_bw,	.entries = {		{  174500000, 62500, 0xce, 0x01 },		{  230000000, 62500, 0xce, 0x02 },		{  999999999, 62500, 0xce, 0x04 },	},};/* Infineon TUA6034 * used in LG TDVS-H061F, LG TDVS-H062F and LG TDVS-H064F */static struct dvb_pll_desc dvb_pll_lg_tdvs_h06xf = {	.name  = "LG TDVS-H06xF",	.min   =  54000000,	.max   = 863000000,	.iffreq= 44000000,	.initdata = tua603x_agc103,	.count = 3,	.entries = {		{  165000000, 62500, 0xce, 0x01 },		{  450000000, 62500, 0xce, 0x02 },		{  999999999, 62500, 0xce, 0x04 },	},};/* Philips FMD1216ME * used in Medion Hybrid PCMCIA card and USB Box */static void fmd1216me_bw(struct dvb_frontend *fe, u8 *buf,			 const struct dvb_frontend_parameters *params){	if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ &&	    params->frequency >= 158870000)		buf[3] |= 0x08;}static struct dvb_pll_desc dvb_pll_fmd1216me = {	.name = "Philips FMD1216ME",	.min = 50870000,	.max = 858000000,	.iffreq= 36125000,	.set   = fmd1216me_bw,	.initdata = tua603x_agc112,	.sleepdata = (u8[]){ 4, 0x9c, 0x60, 0x85, 0x54 },	.count = 7,	.entries = {		{ 143870000, 166667, 0xbc, 0x41 },		{ 158870000, 166667, 0xf4, 0x41 },		{ 329870000, 166667, 0xbc, 0x42 },		{ 441870000, 166667, 0xf4, 0x42 },		{ 625870000, 166667, 0xbc, 0x44 },		{ 803870000, 166667, 0xf4, 0x44 },		{ 999999999, 166667, 0xfc, 0x44 },	}};/* ALPS TDED4 * used in Nebula-Cards and USB boxes */static void tded4_bw(struct dvb_frontend *fe, u8 *buf,		     const struct dvb_frontend_parameters *params){	if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ)		buf[3] |= 0x04;}static struct dvb_pll_desc dvb_pll_tded4 = {	.name = "ALPS TDED4",	.min = 47000000,	.max = 863000000,	.iffreq= 36166667,	.set   = tded4_bw,	.count = 4,	.entries = {		{ 153000000, 166667, 0x85, 0x01 },		{ 470000000, 166667, 0x85, 0x02 },		{ 823000000, 166667, 0x85, 0x08 },		{ 999999999, 166667, 0x85, 0x88 },	}};/* ALPS TDHU2 * used in AverTVHD MCE A180 */static struct dvb_pll_desc dvb_pll_tdhu2 = {	.name = "ALPS TDHU2",	.min = 54000000,	.max = 864000000,	.iffreq= 44000000,	.count = 4,	.entries = {		{ 162000000, 62500, 0x85, 0x01 },		{ 426000000, 62500, 0x85, 0x02 },		{ 782000000, 62500, 0x85, 0x08 },		{ 999999999, 62500, 0x85, 0x88 },	}};/* Philips TUV1236D * used in ATI HDTV Wonder */static void tuv1236d_rf(struct dvb_frontend *fe, u8 *buf,			const struct dvb_frontend_parameters *params){	struct dvb_pll_priv *priv = fe->tuner_priv;	unsigned int new_rf = input[priv->nr];	if ((new_rf == 0) || (new_rf > 2)) {		switch (params->u.vsb.modulation) {			case QAM_64:			case QAM_256:				new_rf = 1;				break;			case VSB_8:			default:				new_rf = 2;		}	}	switch (new_rf) {		case 1:			buf[3] |= 0x08;			break;		case 2:			buf[3] &= ~0x08;			break;		default:			printk(KERN_WARNING			       "%s: unhandled rf input selection: %d",			       __FUNCTION__, new_rf);	}}static struct dvb_pll_desc dvb_pll_tuv1236d = {	.name  = "Philips TUV1236D",	.min   =  54000000,	.max   = 864000000,	.iffreq= 44000000,	.set   = tuv1236d_rf,	.count = 3,	.entries = {		{ 157250000, 62500, 0xc6, 0x41 },

⌨️ 快捷键说明

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