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

📄 saa7134-dvb.c

📁 linux 内核源代码
💻 C
📖 第 1 页 / 共 3 页
字号:
		return -EIO;	return 0;}/* ------------------------------------------------------------------ */static int philips_europa_tuner_init(struct dvb_frontend *fe){	struct saa7134_dev *dev = fe->dvb->priv;	static u8 msg[] = { 0x00, 0x40};	struct i2c_msg init_msg = {.addr = 0x43,.flags = 0,.buf = msg,.len = sizeof(msg) };	if (philips_td1316_tuner_init(fe))		return -EIO;	msleep(1);	if (i2c_transfer(&dev->i2c_adap, &init_msg, 1) != 1)		return -EIO;	return 0;}static int philips_europa_tuner_sleep(struct dvb_frontend *fe){	struct saa7134_dev *dev = fe->dvb->priv;	static u8 msg[] = { 0x00, 0x14 };	struct i2c_msg analog_msg = {.addr = 0x43,.flags = 0,.buf = msg,.len = sizeof(msg) };	if (philips_td1316_tuner_sleep(fe))		return -EIO;	/* switch the board to analog mode */	if (fe->ops.i2c_gate_ctrl)		fe->ops.i2c_gate_ctrl(fe, 1);	i2c_transfer(&dev->i2c_adap, &analog_msg, 1);	return 0;}static int philips_europa_demod_sleep(struct dvb_frontend *fe){	struct saa7134_dev *dev = fe->dvb->priv;	if (dev->original_demod_sleep)		dev->original_demod_sleep(fe);	fe->ops.i2c_gate_ctrl(fe, 1);	return 0;}static struct tda1004x_config philips_europa_config = {	.demod_address = 0x8,	.invert        = 0,	.invert_oclk   = 0,	.xtal_freq     = TDA10046_XTAL_4M,	.agc_config    = TDA10046_AGC_IFO_AUTO_POS,	.if_freq       = TDA10046_FREQ_052,	.tuner_address = 0x61,	.request_firmware = philips_tda1004x_request_firmware};/* ------------------------------------------------------------------ */static struct tda1004x_config medion_cardbus = {	.demod_address = 0x08,	.invert        = 1,	.invert_oclk   = 0,	.xtal_freq     = TDA10046_XTAL_16M,	.agc_config    = TDA10046_AGC_IFO_AUTO_NEG,	.if_freq       = TDA10046_FREQ_3613,	.tuner_address = 0x61,	.request_firmware = philips_tda1004x_request_firmware};/* ------------------------------------------------------------------ * tda 1004x based cards with philips silicon tuner */static void philips_tda827x_lna_gain(struct dvb_frontend *fe, int high){	struct saa7134_dev *dev = fe->dvb->priv;	struct tda1004x_state *state = fe->demodulator_priv;	u8 addr = state->config->i2c_gate;	u8 config = state->config->tuner_config;	u8 GP00_CF[] = {0x20, 0x01};	u8 GP00_LEV[] = {0x22, 0x00};	struct i2c_msg msg = {.addr = addr,.flags = 0,.buf = GP00_CF, .len = 2};	if (config) {		if (high) {			dprintk("setting LNA to high gain\n");		} else {			dprintk("setting LNA to low gain\n");		}	}	switch (config) {	case 0: /* no LNA */		break;	case 1: /* switch is GPIO 0 of tda8290 */	case 2:		/* turn Vsync off */		saa7134_set_gpio(dev, 22, 0);		GP00_LEV[1] = high ? 0 : 1;		if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) {			wprintk("could not access tda8290 at addr: 0x%02x\n",				addr << 1);			return;		}		msg.buf = GP00_LEV;		if (config == 2)			GP00_LEV[1] = high ? 1 : 0;		i2c_transfer(&dev->i2c_adap, &msg, 1);		break;	case 3: /* switch with GPIO of saa713x */		saa7134_set_gpio(dev, 22, high);		break;	}}static int tda8290_i2c_gate_ctrl( struct dvb_frontend* fe, int enable){	struct tda1004x_state *state = fe->demodulator_priv;	u8 addr = state->config->i2c_gate;	static u8 tda8290_close[] = { 0x21, 0xc0};	static u8 tda8290_open[]  = { 0x21, 0x80};	struct i2c_msg tda8290_msg = {.addr = addr,.flags = 0, .len = 2};	if (enable) {		tda8290_msg.buf = tda8290_close;	} else {		tda8290_msg.buf = tda8290_open;	}	if (i2c_transfer(state->i2c, &tda8290_msg, 1) != 1) {		struct saa7134_dev *dev = fe->dvb->priv;		wprintk("could not access tda8290 I2C gate\n");		return -EIO;	}	msleep(20);	return 0;}/* ------------------------------------------------------------------ */static int philips_tda827x_tuner_init(struct dvb_frontend *fe){	struct saa7134_dev *dev = fe->dvb->priv;	struct tda1004x_state *state = fe->demodulator_priv;	switch (state->config->antenna_switch) {	case 0: break;	case 1:	dprintk("setting GPIO21 to 0 (TV antenna?)\n");		saa7134_set_gpio(dev, 21, 0);		break;	case 2: dprintk("setting GPIO21 to 1 (Radio antenna?)\n");		saa7134_set_gpio(dev, 21, 1);		break;	}	return 0;}static int philips_tda827x_tuner_sleep(struct dvb_frontend *fe){	struct saa7134_dev *dev = fe->dvb->priv;	struct tda1004x_state *state = fe->demodulator_priv;	switch (state->config->antenna_switch) {	case 0: break;	case 1: dprintk("setting GPIO21 to 1 (Radio antenna?)\n");		saa7134_set_gpio(dev, 21, 1);		break;	case 2:	dprintk("setting GPIO21 to 0 (TV antenna?)\n");		saa7134_set_gpio(dev, 21, 0);		break;	}	return 0;}static struct tda827x_config tda827x_cfg = {	.lna_gain = philips_tda827x_lna_gain,	.init = philips_tda827x_tuner_init,	.sleep = philips_tda827x_tuner_sleep};static void configure_tda827x_fe(struct saa7134_dev *dev, struct tda1004x_config *tda_conf){	dev->dvb.frontend = dvb_attach(tda10046_attach, tda_conf, &dev->i2c_adap);	if (dev->dvb.frontend) {		if (tda_conf->i2c_gate)			dev->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl;		if (dvb_attach(tda827x_attach, dev->dvb.frontend, tda_conf->tuner_address,						&dev->i2c_adap,&tda827x_cfg) == NULL) {			wprintk("no tda827x tuner found at addr: %02x\n",				tda_conf->tuner_address);		}	}}/* ------------------------------------------------------------------ */static struct tda1004x_config tda827x_lifeview_config = {	.demod_address = 0x08,	.invert        = 1,	.invert_oclk   = 0,	.xtal_freq     = TDA10046_XTAL_16M,	.agc_config    = TDA10046_AGC_TDA827X,	.gpio_config   = TDA10046_GP11_I,	.if_freq       = TDA10046_FREQ_045,	.tuner_address = 0x60,	.request_firmware = philips_tda1004x_request_firmware};static struct tda1004x_config philips_tiger_config = {	.demod_address = 0x08,	.invert        = 1,	.invert_oclk   = 0,	.xtal_freq     = TDA10046_XTAL_16M,	.agc_config    = TDA10046_AGC_TDA827X,	.gpio_config   = TDA10046_GP11_I,	.if_freq       = TDA10046_FREQ_045,	.i2c_gate      = 0x4b,	.tuner_address = 0x61,	.tuner_config  = 0,	.antenna_switch= 1,	.request_firmware = philips_tda1004x_request_firmware};static struct tda1004x_config cinergy_ht_config = {	.demod_address = 0x08,	.invert        = 1,	.invert_oclk   = 0,	.xtal_freq     = TDA10046_XTAL_16M,	.agc_config    = TDA10046_AGC_TDA827X,	.gpio_config   = TDA10046_GP01_I,	.if_freq       = TDA10046_FREQ_045,	.i2c_gate      = 0x4b,	.tuner_address = 0x61,	.tuner_config  = 0,	.request_firmware = philips_tda1004x_request_firmware};static struct tda1004x_config cinergy_ht_pci_config = {	.demod_address = 0x08,	.invert        = 1,	.invert_oclk   = 0,	.xtal_freq     = TDA10046_XTAL_16M,	.agc_config    = TDA10046_AGC_TDA827X,	.gpio_config   = TDA10046_GP01_I,	.if_freq       = TDA10046_FREQ_045,	.i2c_gate      = 0x4b,	.tuner_address = 0x60,	.tuner_config  = 0,	.request_firmware = philips_tda1004x_request_firmware};static struct tda1004x_config philips_tiger_s_config = {	.demod_address = 0x08,	.invert        = 1,	.invert_oclk   = 0,	.xtal_freq     = TDA10046_XTAL_16M,	.agc_config    = TDA10046_AGC_TDA827X,	.gpio_config   = TDA10046_GP01_I,	.if_freq       = TDA10046_FREQ_045,	.i2c_gate      = 0x4b,	.tuner_address = 0x61,	.tuner_config  = 2,	.antenna_switch= 1,	.request_firmware = philips_tda1004x_request_firmware};static struct tda1004x_config pinnacle_pctv_310i_config = {	.demod_address = 0x08,	.invert        = 1,	.invert_oclk   = 0,	.xtal_freq     = TDA10046_XTAL_16M,	.agc_config    = TDA10046_AGC_TDA827X,	.gpio_config   = TDA10046_GP11_I,	.if_freq       = TDA10046_FREQ_045,	.i2c_gate      = 0x4b,	.tuner_address = 0x61,	.tuner_config  = 1,	.request_firmware = philips_tda1004x_request_firmware};static struct tda1004x_config hauppauge_hvr_1110_config = {	.demod_address = 0x08,	.invert        = 1,	.invert_oclk   = 0,	.xtal_freq     = TDA10046_XTAL_16M,	.agc_config    = TDA10046_AGC_TDA827X,	.gpio_config   = TDA10046_GP11_I,	.if_freq       = TDA10046_FREQ_045,	.i2c_gate      = 0x4b,	.tuner_address = 0x61,	.tuner_config  = 1,	.request_firmware = philips_tda1004x_request_firmware};static struct tda1004x_config asus_p7131_dual_config = {	.demod_address = 0x08,	.invert        = 1,	.invert_oclk   = 0,	.xtal_freq     = TDA10046_XTAL_16M,	.agc_config    = TDA10046_AGC_TDA827X,	.gpio_config   = TDA10046_GP11_I,	.if_freq       = TDA10046_FREQ_045,	.i2c_gate      = 0x4b,	.tuner_address = 0x61,	.tuner_config  = 0,	.antenna_switch= 2,	.request_firmware = philips_tda1004x_request_firmware};static struct tda1004x_config lifeview_trio_config = {	.demod_address = 0x09,	.invert        = 1,	.invert_oclk   = 0,	.xtal_freq     = TDA10046_XTAL_16M,	.agc_config    = TDA10046_AGC_TDA827X,	.gpio_config   = TDA10046_GP00_I,	.if_freq       = TDA10046_FREQ_045,	.tuner_address = 0x60,	.request_firmware = philips_tda1004x_request_firmware};static struct tda1004x_config tevion_dvbt220rf_config = {	.demod_address = 0x08,	.invert        = 1,	.invert_oclk   = 0,	.xtal_freq     = TDA10046_XTAL_16M,	.agc_config    = TDA10046_AGC_TDA827X,	.gpio_config   = TDA10046_GP11_I,	.if_freq       = TDA10046_FREQ_045,	.tuner_address = 0x60,	.request_firmware = philips_tda1004x_request_firmware};static struct tda1004x_config md8800_dvbt_config = {	.demod_address = 0x08,	.invert        = 1,	.invert_oclk   = 0,	.xtal_freq     = TDA10046_XTAL_16M,	.agc_config    = TDA10046_AGC_TDA827X,	.gpio_config   = TDA10046_GP01_I,	.if_freq       = TDA10046_FREQ_045,	.i2c_gate      = 0x4b,	.tuner_address = 0x60,	.tuner_config  = 0,	.request_firmware = philips_tda1004x_request_firmware};static struct tda1004x_config asus_p7131_4871_config = {	.demod_address = 0x08,	.invert        = 1,	.invert_oclk   = 0,	.xtal_freq     = TDA10046_XTAL_16M,	.agc_config    = TDA10046_AGC_TDA827X,	.gpio_config   = TDA10046_GP01_I,	.if_freq       = TDA10046_FREQ_045,	.i2c_gate      = 0x4b,	.tuner_address = 0x61,	.tuner_config  = 2,	.antenna_switch= 2,	.request_firmware = philips_tda1004x_request_firmware};static struct tda1004x_config asus_p7131_hybrid_lna_config = {	.demod_address = 0x08,	.invert        = 1,	.invert_oclk   = 0,	.xtal_freq     = TDA10046_XTAL_16M,	.agc_config    = TDA10046_AGC_TDA827X,

⌨️ 快捷键说明

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