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

📄 saa7134-dvb.c

📁 trident tm5600的linux驱动
💻 C
📖 第 1 页 / 共 3 页
字号:
					       &dev->i2c_adap);		if (fe0->dvb.frontend) {			dvb_attach(simple_tuner_attach, fe0->dvb.frontend,				   &dev->i2c_adap, 0x61,				   TUNER_PHILIPS_TD1316);		}		break;	case SAA7134_BOARD_AVERMEDIA_A16D:		dprintk("AverMedia A16D dvb setup\n");		fe0->dvb.frontend = dvb_attach(mt352_attach,						&avermedia_xc3028_mt352_dev,						&dev->i2c_adap);		attach_xc3028 = 1;		break;	case SAA7134_BOARD_MD7134:		fe0->dvb.frontend = dvb_attach(tda10046_attach,					       &medion_cardbus,					       &dev->i2c_adap);		if (fe0->dvb.frontend) {			dvb_attach(simple_tuner_attach, fe0->dvb.frontend,				   &dev->i2c_adap, medion_cardbus.tuner_address,				   TUNER_PHILIPS_FMD1216ME_MK3);		}		break;	case SAA7134_BOARD_PHILIPS_TOUGH:		fe0->dvb.frontend = dvb_attach(tda10046_attach,					       &philips_tu1216_60_config,					       &dev->i2c_adap);		if (fe0->dvb.frontend) {			fe0->dvb.frontend->ops.tuner_ops.init = philips_tu1216_init;			fe0->dvb.frontend->ops.tuner_ops.set_params = philips_tda6651_pll_set;		}		break;	case SAA7134_BOARD_FLYDVBTDUO:	case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS:		if (configure_tda827x_fe(dev, &tda827x_lifeview_config,					 &tda827x_cfg_0) < 0)			goto dettach_frontend;		break;	case SAA7134_BOARD_PHILIPS_EUROPA:	case SAA7134_BOARD_VIDEOMATE_DVBT_300:		fe0->dvb.frontend = dvb_attach(tda10046_attach,					       &philips_europa_config,					       &dev->i2c_adap);		if (fe0->dvb.frontend) {			dev->original_demod_sleep = fe0->dvb.frontend->ops.sleep;			fe0->dvb.frontend->ops.sleep = philips_europa_demod_sleep;			fe0->dvb.frontend->ops.tuner_ops.init = philips_europa_tuner_init;			fe0->dvb.frontend->ops.tuner_ops.sleep = philips_europa_tuner_sleep;			fe0->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params;		}		break;	case SAA7134_BOARD_VIDEOMATE_DVBT_200:		fe0->dvb.frontend = dvb_attach(tda10046_attach,					       &philips_tu1216_61_config,					       &dev->i2c_adap);		if (fe0->dvb.frontend) {			fe0->dvb.frontend->ops.tuner_ops.init = philips_tu1216_init;			fe0->dvb.frontend->ops.tuner_ops.set_params = philips_tda6651_pll_set;		}		break;	case SAA7134_BOARD_KWORLD_DVBT_210:		if (configure_tda827x_fe(dev, &kworld_dvb_t_210_config,					 &tda827x_cfg_2) < 0)			goto dettach_frontend;		break;	case SAA7134_BOARD_PHILIPS_TIGER:		if (configure_tda827x_fe(dev, &philips_tiger_config,					 &tda827x_cfg_0) < 0)			goto dettach_frontend;		break;	case SAA7134_BOARD_PINNACLE_PCTV_310i:		if (configure_tda827x_fe(dev, &pinnacle_pctv_310i_config,					 &tda827x_cfg_1) < 0)			goto dettach_frontend;		break;	case SAA7134_BOARD_HAUPPAUGE_HVR1110:		if (configure_tda827x_fe(dev, &hauppauge_hvr_1110_config,					 &tda827x_cfg_1) < 0)			goto dettach_frontend;		break;	case SAA7134_BOARD_ASUSTeK_P7131_DUAL:		if (configure_tda827x_fe(dev, &asus_p7131_dual_config,					 &tda827x_cfg_0) < 0)			goto dettach_frontend;		break;	case SAA7134_BOARD_FLYDVBT_LR301:		if (configure_tda827x_fe(dev, &tda827x_lifeview_config,					 &tda827x_cfg_0) < 0)			goto dettach_frontend;		break;	case SAA7134_BOARD_FLYDVB_TRIO:		if (!use_frontend) {	/* terrestrial */			if (configure_tda827x_fe(dev, &lifeview_trio_config,						 &tda827x_cfg_0) < 0)				goto dettach_frontend;		} else {  		/* satellite */			fe0->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap);			if (fe0->dvb.frontend) {				if (dvb_attach(tda826x_attach, fe0->dvb.frontend, 0x63,									&dev->i2c_adap, 0) == NULL) {					wprintk("%s: Lifeview Trio, No tda826x found!\n", __func__);					goto dettach_frontend;				}				if (dvb_attach(isl6421_attach, fe0->dvb.frontend, &dev->i2c_adap,										0x08, 0, 0) == NULL) {					wprintk("%s: Lifeview Trio, No ISL6421 found!\n", __func__);					goto dettach_frontend;				}			}		}		break;	case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331:	case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS:		fe0->dvb.frontend = dvb_attach(tda10046_attach,					       &ads_tech_duo_config,					       &dev->i2c_adap);		if (fe0->dvb.frontend) {			if (dvb_attach(tda827x_attach,fe0->dvb.frontend,				   ads_tech_duo_config.tuner_address, &dev->i2c_adap,								&ads_duo_cfg) == NULL) {				wprintk("no tda827x tuner found at addr: %02x\n",					ads_tech_duo_config.tuner_address);				goto dettach_frontend;			}		} else			wprintk("failed to attach tda10046\n");		break;	case SAA7134_BOARD_TEVION_DVBT_220RF:		if (configure_tda827x_fe(dev, &tevion_dvbt220rf_config,					 &tda827x_cfg_0) < 0)			goto dettach_frontend;		break;	case SAA7134_BOARD_MEDION_MD8800_QUADRO:		if (!use_frontend) {     /* terrestrial */			if (configure_tda827x_fe(dev, &md8800_dvbt_config,						 &tda827x_cfg_0) < 0)				goto dettach_frontend;		} else {        /* satellite */			fe0->dvb.frontend = dvb_attach(tda10086_attach,							&flydvbs, &dev->i2c_adap);			if (fe0->dvb.frontend) {				struct dvb_frontend *fe = fe0->dvb.frontend;				u8 dev_id = dev->eedata[2];				u8 data = 0xc4;				struct i2c_msg msg = {.addr = 0x08, .flags = 0, .len = 1};				if (dvb_attach(tda826x_attach, fe0->dvb.frontend,						0x60, &dev->i2c_adap, 0) == NULL) {					wprintk("%s: Medion Quadro, no tda826x "						"found !\n", __func__);					goto dettach_frontend;				}				if (dev_id != 0x08) {					/* we need to open the i2c gate (we know it exists) */					fe->ops.i2c_gate_ctrl(fe, 1);					if (dvb_attach(isl6405_attach, fe,							&dev->i2c_adap, 0x08, 0, 0) == NULL) {						wprintk("%s: Medion Quadro, no ISL6405 "							"found !\n", __func__);						goto dettach_frontend;					}					if (dev_id == 0x07) {						/* fire up the 2nd section of the LNB supply since						   we can't do this from the other section */						msg.buf = &data;						i2c_transfer(&dev->i2c_adap, &msg, 1);					}					fe->ops.i2c_gate_ctrl(fe, 0);					dev->original_set_voltage = fe->ops.set_voltage;					fe->ops.set_voltage = md8800_set_voltage;					dev->original_set_high_voltage = fe->ops.enable_high_lnb_voltage;					fe->ops.enable_high_lnb_voltage = md8800_set_high_voltage;				} else {					fe->ops.set_voltage = md8800_set_voltage2;					fe->ops.enable_high_lnb_voltage = md8800_set_high_voltage2;				}			}		}		break;	case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180:		fe0->dvb.frontend = dvb_attach(nxt200x_attach, &avertvhda180,					       &dev->i2c_adap);		if (fe0->dvb.frontend)			dvb_attach(dvb_pll_attach, fe0->dvb.frontend, 0x61,				   NULL, DVB_PLL_TDHU2);		break;	case SAA7134_BOARD_ADS_INSTANT_HDTV_PCI:	case SAA7134_BOARD_KWORLD_ATSC110:		fe0->dvb.frontend = dvb_attach(nxt200x_attach, &kworldatsc110,					       &dev->i2c_adap);		if (fe0->dvb.frontend)			dvb_attach(simple_tuner_attach, fe0->dvb.frontend,				   &dev->i2c_adap, 0x61,				   TUNER_PHILIPS_TUV1236D);		break;	case SAA7134_BOARD_FLYDVBS_LR300:		fe0->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs,					       &dev->i2c_adap);		if (fe0->dvb.frontend) {			if (dvb_attach(tda826x_attach, fe0->dvb.frontend, 0x60,				       &dev->i2c_adap, 0) == NULL) {				wprintk("%s: No tda826x found!\n", __func__);				goto dettach_frontend;			}			if (dvb_attach(isl6421_attach, fe0->dvb.frontend,				       &dev->i2c_adap, 0x08, 0, 0) == NULL) {				wprintk("%s: No ISL6421 found!\n", __func__);				goto dettach_frontend;			}		}		break;	case SAA7134_BOARD_ASUS_EUROPA2_HYBRID:		fe0->dvb.frontend = dvb_attach(tda10046_attach,					       &medion_cardbus,					       &dev->i2c_adap);		if (fe0->dvb.frontend) {			dev->original_demod_sleep = fe0->dvb.frontend->ops.sleep;			fe0->dvb.frontend->ops.sleep = philips_europa_demod_sleep;			dvb_attach(simple_tuner_attach, fe0->dvb.frontend,				   &dev->i2c_adap, medion_cardbus.tuner_address,				   TUNER_PHILIPS_FMD1216ME_MK3);		}		break;	case SAA7134_BOARD_VIDEOMATE_DVBT_200A:		fe0->dvb.frontend = dvb_attach(tda10046_attach,				&philips_europa_config,				&dev->i2c_adap);		if (fe0->dvb.frontend) {			fe0->dvb.frontend->ops.tuner_ops.init = philips_td1316_tuner_init;			fe0->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params;		}		break;	case SAA7134_BOARD_CINERGY_HT_PCMCIA:		if (configure_tda827x_fe(dev, &cinergy_ht_config,					 &tda827x_cfg_0) < 0)			goto dettach_frontend;		break;	case SAA7134_BOARD_CINERGY_HT_PCI:		if (configure_tda827x_fe(dev, &cinergy_ht_pci_config,					 &tda827x_cfg_0) < 0)			goto dettach_frontend;		break;	case SAA7134_BOARD_PHILIPS_TIGER_S:		if (configure_tda827x_fe(dev, &philips_tiger_s_config,					 &tda827x_cfg_2) < 0)			goto dettach_frontend;		break;	case SAA7134_BOARD_ASUS_P7131_4871:		if (configure_tda827x_fe(dev, &asus_p7131_4871_config,					 &tda827x_cfg_2) < 0)			goto dettach_frontend;		break;	case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA:		if (configure_tda827x_fe(dev, &asus_p7131_hybrid_lna_config,					 &tda827x_cfg_2) < 0)			goto dettach_frontend;		break;	case SAA7134_BOARD_AVERMEDIA_SUPER_007:		if (configure_tda827x_fe(dev, &avermedia_super_007_config,					 &tda827x_cfg_0) < 0)			goto dettach_frontend;		break;	case SAA7134_BOARD_TWINHAN_DTV_DVB_3056:		if (configure_tda827x_fe(dev, &twinhan_dtv_dvb_3056_config,					 &tda827x_cfg_2_sw42) < 0)			goto dettach_frontend;		break;	case SAA7134_BOARD_PHILIPS_SNAKE:		fe0->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs,						&dev->i2c_adap);		if (fe0->dvb.frontend) {			if (dvb_attach(tda826x_attach, fe0->dvb.frontend, 0x60,					&dev->i2c_adap, 0) == NULL) {				wprintk("%s: No tda826x found!\n", __func__);				goto dettach_frontend;			}			if (dvb_attach(lnbp21_attach, fe0->dvb.frontend,					&dev->i2c_adap, 0, 0) == NULL) {				wprintk("%s: No lnbp21 found!\n", __func__);				goto dettach_frontend;			}		}		break;	case SAA7134_BOARD_CREATIX_CTX953:		if (configure_tda827x_fe(dev, &md8800_dvbt_config,					 &tda827x_cfg_0) < 0)			goto dettach_frontend;		break;	case SAA7134_BOARD_MSI_TVANYWHERE_AD11:		if (configure_tda827x_fe(dev, &philips_tiger_s_config,					 &tda827x_cfg_2) < 0)			goto dettach_frontend;		break;	case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:		dprintk("AverMedia E506R dvb setup\n");		saa7134_set_gpio(dev, 25, 0);		msleep(10);		saa7134_set_gpio(dev, 25, 1);		fe0->dvb.frontend = dvb_attach(mt352_attach,						&avermedia_xc3028_mt352_dev,						&dev->i2c_adap);		attach_xc3028 = 1;		break;#if 0	/*FIXME: What frontend does Videomate T750 use? */	case SAA7134_BOARD_VIDEOMATE_T750:#endif	case SAA7134_BOARD_MD7134_BRIDGE_2:		fe0->dvb.frontend = dvb_attach(tda10086_attach,						&sd1878_4m, &dev->i2c_adap);		if (fe0->dvb.frontend) {			struct dvb_frontend *fe;			if (dvb_attach(dvb_pll_attach, fe0->dvb.frontend, 0x60,				  &dev->i2c_adap, DVB_PLL_PHILIPS_SD1878_TDA8261) == NULL) {				wprintk("%s: MD7134 DVB-S, no SD1878 "					"found !\n", __func__);				goto dettach_frontend;			}			/* we need to open the i2c gate (we know it exists) */			fe = fe0->dvb.frontend;			fe->ops.i2c_gate_ctrl(fe, 1);			if (dvb_attach(isl6405_attach, fe,					&dev->i2c_adap, 0x08, 0, 0) == NULL) {				wprintk("%s: MD7134 DVB-S, no ISL6405 "					"found !\n", __func__);				goto dettach_frontend;			}			fe->ops.i2c_gate_ctrl(fe, 0);			dev->original_set_voltage = fe->ops.set_voltage;			fe->ops.set_voltage = md8800_set_voltage;			dev->original_set_high_voltage = fe->ops.enable_high_lnb_voltage;			fe->ops.enable_high_lnb_voltage = md8800_set_high_voltage;		}		break;	case SAA7134_BOARD_AVERMEDIA_M103:		saa7134_set_gpio(dev, 25, 0);		msleep(10);		saa7134_set_gpio(dev, 25, 1);		fe0->dvb.frontend = dvb_attach(mt352_attach,						&avermedia_xc3028_mt352_dev,						&dev->i2c_adap);		attach_xc3028 = 1;		break;	case SAA7134_BOARD_ASUSTeK_TIGER_3IN1:		if (!use_frontend) {     /* terrestrial */			if (configure_tda827x_fe(dev, &asus_tiger_3in1_config,							&tda827x_cfg_2) < 0)				goto dettach_frontend;		} else {  		/* satellite */			fe0->dvb.frontend = dvb_attach(tda10086_attach,						&flydvbs, &dev->i2c_adap);			if (fe0->dvb.frontend) {				if (dvb_attach(tda826x_attach,						fe0->dvb.frontend, 0x60,						&dev->i2c_adap, 0) == NULL) {					wprintk("%s: Asus Tiger 3in1, no "						"tda826x found!\n", __func__);					goto dettach_frontend;				}				if (dvb_attach(lnbp21_attach, fe0->dvb.frontend,						&dev->i2c_adap, 0, 0) == NULL) {					wprintk("%s: Asus Tiger 3in1, no lnbp21"						" found!\n", __func__);					goto dettach_frontend;				}			}		}		break;	case SAA7134_BOARD_ASUSTeK_TIGER:		if (configure_tda827x_fe(dev, &philips_tiger_config,					 &tda827x_cfg_0) < 0)			goto dettach_frontend;		break;	default:		wprintk("Huh? unknown DVB card?\n");		break;	}	if (attach_xc3028) {		struct dvb_frontend *fe;		struct xc2028_config cfg = {			.i2c_adap  = &dev->i2c_adap,			.i2c_addr  = 0x61,		};		if (!fe0->dvb.frontend)			return -1;		fe = dvb_attach(xc2028_attach, fe0->dvb.frontend, &cfg);		if (!fe) {			printk(KERN_ERR "%s/2: xc3028 attach failed\n",			       dev->name);			goto dettach_frontend;		}	}	if (NULL == fe0->dvb.frontend) {		printk(KERN_ERR "%s/dvb: frontend initialization failed\n", dev->name);		return -1;	}	/* define general-purpose callback pointer */	fe0->dvb.frontend->callback = saa7134_tuner_callback;	/* register everything else */	ret = videobuf_dvb_register_bus(&dev->frontends, THIS_MODULE, dev,		&dev->pci->dev, adapter_nr, 0);	/* this sequence is necessary to make the tda1004x load its firmware	 * and to enter analog mode of hybrid boards	 */	if (!ret) {		if (fe0->dvb.frontend->ops.init)			fe0->dvb.frontend->ops.init(fe0->dvb.frontend);		if (fe0->dvb.frontend->ops.sleep)			fe0->dvb.frontend->ops.sleep(fe0->dvb.frontend);		if (fe0->dvb.frontend->ops.tuner_ops.sleep)			fe0->dvb.frontend->ops.tuner_ops.sleep(fe0->dvb.frontend);	}	return ret;dettach_frontend:	if (fe0->dvb.frontend)		dvb_frontend_detach(fe0->dvb.frontend);	fe0->dvb.frontend = NULL;	return -1;}static int dvb_fini(struct saa7134_dev *dev){	struct videobuf_dvb_frontend *fe0;	/* Get the first frontend */	fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1);	if (!fe0)		return -EINVAL;	/* FIXME: I suspect that this code is bogus, since the entry for	   Pinnacle 300I DVB-T PAL already defines the proper init to allow	   the detection of mt2032 (TDA9887_PORT2_INACTIVE)	 */	if (dev->board == SAA7134_BOARD_PINNACLE_300I_DVBT_PAL) {		struct v4l2_priv_tun_config tda9887_cfg;		static int on  = TDA9887_PRESENT | TDA9887_PORT2_INACTIVE;		tda9887_cfg.tuner = TUNER_TDA9887;		tda9887_cfg.priv  = &on;		/* otherwise we don't detect the tuner on next insmod */		saa7134_i2c_call_clients(dev, TUNER_SET_CONFIG, &tda9887_cfg);	} else if (dev->board == SAA7134_BOARD_MEDION_MD8800_QUADRO) {		if ((dev->eedata[2] == 0x07) && use_frontend) {			/* turn off the 2nd lnb supply */			u8 data = 0x80;			struct i2c_msg msg = {.addr = 0x08, .buf = &data, .flags = 0, .len = 1};			struct dvb_frontend *fe;			fe = fe0->dvb.frontend;			if (fe->ops.i2c_gate_ctrl) {				fe->ops.i2c_gate_ctrl(fe, 1);				i2c_transfer(&dev->i2c_adap, &msg, 1);				fe->ops.i2c_gate_ctrl(fe, 0);			}		}	}	if (fe0->dvb.frontend)		videobuf_dvb_unregister_bus(&dev->frontends);	return 0;}static struct saa7134_mpeg_ops dvb_ops = {	.type          = SAA7134_MPEG_DVB,	.init          = dvb_init,	.fini          = dvb_fini,};static int __init dvb_register(void){	return saa7134_ts_register(&dvb_ops);}static void __exit dvb_unregister(void){	saa7134_ts_unregister(&dvb_ops);}module_init(dvb_register);module_exit(dvb_unregister);/* ------------------------------------------------------------------ *//* * Local variables: * c-basic-offset: 8 * End: */

⌨️ 快捷键说明

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