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

📄 cxusb.c

📁 trident tm5600的linux驱动
💻 C
📖 第 1 页 / 共 4 页
字号:
	{ 0xfe, 0x1e, KEY_FAVORITES },	{ 0xfe, 0x16, KEY_SETUP },	{ 0xfe, 0x46, KEY_POWER2 },	{ 0xfe, 0x0a, KEY_EPG },	{ 0xfe, 0x49, KEY_BACK },	{ 0xfe, 0x4d, KEY_MENU },	{ 0xfe, 0x51, KEY_UP },	{ 0xfe, 0x5b, KEY_LEFT },	{ 0xfe, 0x5f, KEY_RIGHT },	{ 0xfe, 0x53, KEY_DOWN },	{ 0xfe, 0x5e, KEY_OK },	{ 0xfe, 0x59, KEY_INFO },	{ 0xfe, 0x55, KEY_TAB },	{ 0xfe, 0x0f, KEY_PREVIOUSSONG },/* Replay */	{ 0xfe, 0x12, KEY_NEXTSONG },	/* Skip */	{ 0xfe, 0x42, KEY_ENTER	 },	/* Windows/Start */	{ 0xfe, 0x15, KEY_VOLUMEUP },	{ 0xfe, 0x05, KEY_VOLUMEDOWN },	{ 0xfe, 0x11, KEY_CHANNELUP },	{ 0xfe, 0x09, KEY_CHANNELDOWN },	{ 0xfe, 0x52, KEY_CAMERA },	{ 0xfe, 0x5a, KEY_TUNER },	/* Live */	{ 0xfe, 0x19, KEY_OPEN },	{ 0xfe, 0x0b, KEY_1 },	{ 0xfe, 0x17, KEY_2 },	{ 0xfe, 0x1b, KEY_3 },	{ 0xfe, 0x07, KEY_4 },	{ 0xfe, 0x50, KEY_5 },	{ 0xfe, 0x54, KEY_6 },	{ 0xfe, 0x48, KEY_7 },	{ 0xfe, 0x4c, KEY_8 },	{ 0xfe, 0x58, KEY_9 },	{ 0xfe, 0x13, KEY_ANGLE },	/* Aspect */	{ 0xfe, 0x03, KEY_0 },	{ 0xfe, 0x1f, KEY_ZOOM },	{ 0xfe, 0x43, KEY_REWIND },	{ 0xfe, 0x47, KEY_PLAYPAUSE },	{ 0xfe, 0x4f, KEY_FASTFORWARD },	{ 0xfe, 0x57, KEY_MUTE },	{ 0xfe, 0x0d, KEY_STOP },	{ 0xfe, 0x01, KEY_RECORD },	{ 0xfe, 0x4e, KEY_POWER },};static struct dvb_usb_rc_key dvico_portable_rc_keys[] = {	{ 0xfc, 0x02, KEY_SETUP },       /* Profile */	{ 0xfc, 0x43, KEY_POWER2 },	{ 0xfc, 0x06, KEY_EPG },	{ 0xfc, 0x5a, KEY_BACK },	{ 0xfc, 0x05, KEY_MENU },	{ 0xfc, 0x47, KEY_INFO },	{ 0xfc, 0x01, KEY_TAB },	{ 0xfc, 0x42, KEY_PREVIOUSSONG },/* Replay */	{ 0xfc, 0x49, KEY_VOLUMEUP },	{ 0xfc, 0x09, KEY_VOLUMEDOWN },	{ 0xfc, 0x54, KEY_CHANNELUP },	{ 0xfc, 0x0b, KEY_CHANNELDOWN },	{ 0xfc, 0x16, KEY_CAMERA },	{ 0xfc, 0x40, KEY_TUNER },	/* ATV/DTV */	{ 0xfc, 0x45, KEY_OPEN },	{ 0xfc, 0x19, KEY_1 },	{ 0xfc, 0x18, KEY_2 },	{ 0xfc, 0x1b, KEY_3 },	{ 0xfc, 0x1a, KEY_4 },	{ 0xfc, 0x58, KEY_5 },	{ 0xfc, 0x59, KEY_6 },	{ 0xfc, 0x15, KEY_7 },	{ 0xfc, 0x14, KEY_8 },	{ 0xfc, 0x17, KEY_9 },	{ 0xfc, 0x44, KEY_ANGLE },	/* Aspect */	{ 0xfc, 0x55, KEY_0 },	{ 0xfc, 0x07, KEY_ZOOM },	{ 0xfc, 0x0a, KEY_REWIND },	{ 0xfc, 0x08, KEY_PLAYPAUSE },	{ 0xfc, 0x4b, KEY_FASTFORWARD },	{ 0xfc, 0x5b, KEY_MUTE },	{ 0xfc, 0x04, KEY_STOP },	{ 0xfc, 0x56, KEY_RECORD },	{ 0xfc, 0x57, KEY_POWER },	{ 0xfc, 0x41, KEY_UNKNOWN },    /* INPUT */	{ 0xfc, 0x00, KEY_UNKNOWN },    /* HD */};static struct dvb_usb_rc_key d680_dmb_rc_keys[] = {	{ 0x00, 0x38, KEY_UNKNOWN },	/* TV/AV */	{ 0x08, 0x0c, KEY_ZOOM },	{ 0x08, 0x00, KEY_0 },	{ 0x00, 0x01, KEY_1 },	{ 0x08, 0x02, KEY_2 },	{ 0x00, 0x03, KEY_3 },	{ 0x08, 0x04, KEY_4 },	{ 0x00, 0x05, KEY_5 },	{ 0x08, 0x06, KEY_6 },	{ 0x00, 0x07, KEY_7 },	{ 0x08, 0x08, KEY_8 },	{ 0x00, 0x09, KEY_9 },	{ 0x00, 0x0a, KEY_MUTE },	{ 0x08, 0x29, KEY_BACK },	{ 0x00, 0x12, KEY_CHANNELUP },	{ 0x08, 0x13, KEY_CHANNELDOWN },	{ 0x00, 0x2b, KEY_VOLUMEUP },	{ 0x08, 0x2c, KEY_VOLUMEDOWN },	{ 0x00, 0x20, KEY_UP },	{ 0x08, 0x21, KEY_DOWN },	{ 0x00, 0x11, KEY_LEFT },	{ 0x08, 0x10, KEY_RIGHT },	{ 0x00, 0x0d, KEY_OK },	{ 0x08, 0x1f, KEY_RECORD },	{ 0x00, 0x17, KEY_PLAYPAUSE },	{ 0x08, 0x16, KEY_PLAYPAUSE },	{ 0x00, 0x0b, KEY_STOP },	{ 0x08, 0x27, KEY_FASTFORWARD },	{ 0x00, 0x26, KEY_REWIND },	{ 0x08, 0x1e, KEY_UNKNOWN },    /* Time Shift */	{ 0x00, 0x0e, KEY_UNKNOWN },    /* Snapshot */	{ 0x08, 0x2d, KEY_UNKNOWN },    /* Mouse Cursor */	{ 0x00, 0x0f, KEY_UNKNOWN },    /* Minimize/Maximize */	{ 0x08, 0x14, KEY_UNKNOWN },    /* Shuffle */	{ 0x00, 0x25, KEY_POWER },};static int cxusb_dee1601_demod_init(struct dvb_frontend* fe){	static u8 clock_config []  = { CLOCK_CTL,  0x38, 0x28 };	static u8 reset []         = { RESET,      0x80 };	static u8 adc_ctl_1_cfg [] = { ADC_CTL_1,  0x40 };	static u8 agc_cfg []       = { AGC_TARGET, 0x28, 0x20 };	static u8 gpp_ctl_cfg []   = { GPP_CTL,    0x33 };	static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };	mt352_write(fe, clock_config,   sizeof(clock_config));	udelay(200);	mt352_write(fe, reset,          sizeof(reset));	mt352_write(fe, adc_ctl_1_cfg,  sizeof(adc_ctl_1_cfg));	mt352_write(fe, agc_cfg,        sizeof(agc_cfg));	mt352_write(fe, gpp_ctl_cfg,    sizeof(gpp_ctl_cfg));	mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));	return 0;}static int cxusb_mt352_demod_init(struct dvb_frontend* fe){	/* used in both lgz201 and th7579 */	static u8 clock_config []  = { CLOCK_CTL,  0x38, 0x29 };	static u8 reset []         = { RESET,      0x80 };	static u8 adc_ctl_1_cfg [] = { ADC_CTL_1,  0x40 };	static u8 agc_cfg []       = { AGC_TARGET, 0x24, 0x20 };	static u8 gpp_ctl_cfg []   = { GPP_CTL,    0x33 };	static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };	mt352_write(fe, clock_config,   sizeof(clock_config));	udelay(200);	mt352_write(fe, reset,          sizeof(reset));	mt352_write(fe, adc_ctl_1_cfg,  sizeof(adc_ctl_1_cfg));	mt352_write(fe, agc_cfg,        sizeof(agc_cfg));	mt352_write(fe, gpp_ctl_cfg,    sizeof(gpp_ctl_cfg));	mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));	return 0;}static struct cx22702_config cxusb_cx22702_config = {	.demod_address = 0x63,	.output_mode = CX22702_PARALLEL_OUTPUT,};static struct lgdt330x_config cxusb_lgdt3303_config = {	.demod_address = 0x0e,	.demod_chip    = LGDT3303,};static struct lgdt330x_config cxusb_aver_lgdt3303_config = {	.demod_address       = 0x0e,	.demod_chip          = LGDT3303,	.clock_polarity_flip = 2,};static struct mt352_config cxusb_dee1601_config = {	.demod_address = 0x0f,	.demod_init    = cxusb_dee1601_demod_init,};static struct zl10353_config cxusb_zl10353_dee1601_config = {	.demod_address = 0x0f,	.parallel_ts = 1,};static struct mt352_config cxusb_mt352_config = {	/* used in both lgz201 and th7579 */	.demod_address = 0x0f,	.demod_init    = cxusb_mt352_demod_init,};static struct zl10353_config cxusb_zl10353_xc3028_config = {	.demod_address = 0x0f,	.if2 = 45600,	.no_tuner = 1,	.parallel_ts = 1,};static struct mt352_config cxusb_mt352_xc3028_config = {	.demod_address = 0x0f,	.if2 = 4560,	.no_tuner = 1,	.demod_init = cxusb_mt352_demod_init,};/* FIXME: needs tweaking */static struct mxl5005s_config aver_a868r_tuner = {	.i2c_address     = 0x63,	.if_freq         = 6000000UL,	.xtal_freq       = CRYSTAL_FREQ_16000000HZ,	.agc_mode        = MXL_SINGLE_AGC,	.tracking_filter = MXL_TF_C,	.rssi_enable     = MXL_RSSI_ENABLE,	.cap_select      = MXL_CAP_SEL_ENABLE,	.div_out         = MXL_DIV_OUT_4,	.clock_out       = MXL_CLOCK_OUT_DISABLE,	.output_load     = MXL5005S_IF_OUTPUT_LOAD_200_OHM,	.top		 = MXL5005S_TOP_25P2,	.mod_mode        = MXL_DIGITAL_MODE,	.if_mode         = MXL_ZERO_IF,	.AgcMasterByte   = 0x00,};/* FIXME: needs tweaking */static struct mxl5005s_config d680_dmb_tuner = {	.i2c_address     = 0x63,	.if_freq         = 36125000UL,	.xtal_freq       = CRYSTAL_FREQ_16000000HZ,	.agc_mode        = MXL_SINGLE_AGC,	.tracking_filter = MXL_TF_C,	.rssi_enable     = MXL_RSSI_ENABLE,	.cap_select      = MXL_CAP_SEL_ENABLE,	.div_out         = MXL_DIV_OUT_4,	.clock_out       = MXL_CLOCK_OUT_DISABLE,	.output_load     = MXL5005S_IF_OUTPUT_LOAD_200_OHM,	.top		 = MXL5005S_TOP_25P2,	.mod_mode        = MXL_DIGITAL_MODE,	.if_mode         = MXL_ZERO_IF,	.AgcMasterByte   = 0x00,};/* Callbacks for DVB USB */static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap){	dvb_attach(simple_tuner_attach, adap->fe,		   &adap->dev->i2c_adap, 0x61,		   TUNER_PHILIPS_FMD1216ME_MK3);	return 0;}static int cxusb_dee1601_tuner_attach(struct dvb_usb_adapter *adap){	dvb_attach(dvb_pll_attach, adap->fe, 0x61,		   NULL, DVB_PLL_THOMSON_DTT7579);	return 0;}static int cxusb_lgz201_tuner_attach(struct dvb_usb_adapter *adap){	dvb_attach(dvb_pll_attach, adap->fe, 0x61, NULL, DVB_PLL_LG_Z201);	return 0;}static int cxusb_dtt7579_tuner_attach(struct dvb_usb_adapter *adap){	dvb_attach(dvb_pll_attach, adap->fe, 0x60,		   NULL, DVB_PLL_THOMSON_DTT7579);	return 0;}static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter *adap){	dvb_attach(simple_tuner_attach, adap->fe,		   &adap->dev->i2c_adap, 0x61, TUNER_LG_TDVS_H06XF);	return 0;}static int dvico_bluebird_xc2028_callback(void *ptr, int component,					  int command, int arg){	struct dvb_usb_adapter *adap = ptr;	struct dvb_usb_device *d = adap->dev;	switch (command) {	case XC2028_TUNER_RESET:		deb_info("%s: XC2028_TUNER_RESET %d\n", __func__, arg);		cxusb_bluebird_gpio_pulse(d, 0x01, 1);		break;	case XC2028_RESET_CLK:		deb_info("%s: XC2028_RESET_CLK %d\n", __func__, arg);		break;	default:		deb_info("%s: unknown command %d, arg %d\n", __func__,			 command, arg);		return -EINVAL;	}	return 0;}static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap){	struct dvb_frontend	 *fe;	struct xc2028_config	  cfg = {		.i2c_adap  = &adap->dev->i2c_adap,		.i2c_addr  = 0x61,	};	static struct xc2028_ctrl ctl = {		.fname       = XC2028_DEFAULT_FIRMWARE,		.max_len     = 64,		.demod       = XC3028_FE_ZARLINK456,	};	/* FIXME: generalize & move to common area */	adap->fe->callback = dvico_bluebird_xc2028_callback;	fe = dvb_attach(xc2028_attach, adap->fe, &cfg);	if (fe == NULL || fe->ops.tuner_ops.set_config == NULL)		return -EIO;	fe->ops.tuner_ops.set_config(fe, &ctl);	return 0;}static int cxusb_mxl5003s_tuner_attach(struct dvb_usb_adapter *adap){	dvb_attach(mxl5005s_attach, adap->fe,		   &adap->dev->i2c_adap, &aver_a868r_tuner);	return 0;}static int cxusb_d680_dmb_tuner_attach(struct dvb_usb_adapter *adap){	struct dvb_frontend *fe;	fe = dvb_attach(mxl5005s_attach, adap->fe,			&adap->dev->i2c_adap, &d680_dmb_tuner);	return (fe == NULL) ? -EIO : 0;}static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter *adap){	u8 b;	if (usb_set_interface(adap->dev->udev, 0, 6) < 0)		err("set interface failed");	cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, &b, 1);	if ((adap->fe = dvb_attach(cx22702_attach, &cxusb_cx22702_config,				   &adap->dev->i2c_adap)) != NULL)		return 0;	return -EIO;}static int cxusb_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap){	if (usb_set_interface(adap->dev->udev, 0, 7) < 0)		err("set interface failed");	cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);	if ((adap->fe = dvb_attach(lgdt330x_attach, &cxusb_lgdt3303_config,				   &adap->dev->i2c_adap)) != NULL)		return 0;	return -EIO;}static int cxusb_aver_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap){	adap->fe = dvb_attach(lgdt330x_attach, &cxusb_aver_lgdt3303_config,			      &adap->dev->i2c_adap);	if (adap->fe != NULL)		return 0;	return -EIO;}static int cxusb_mt352_frontend_attach(struct dvb_usb_adapter *adap){	/* used in both lgz201 and th7579 */	if (usb_set_interface(adap->dev->udev, 0, 0) < 0)		err("set interface failed");	cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);	if ((adap->fe = dvb_attach(mt352_attach, &cxusb_mt352_config,				   &adap->dev->i2c_adap)) != NULL)		return 0;	return -EIO;}static int cxusb_dee1601_frontend_attach(struct dvb_usb_adapter *adap){	if (usb_set_interface(adap->dev->udev, 0, 0) < 0)		err("set interface failed");	cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);	if (((adap->fe = dvb_attach(mt352_attach, &cxusb_dee1601_config,				    &adap->dev->i2c_adap)) != NULL) ||		((adap->fe = dvb_attach(zl10353_attach,					&cxusb_zl10353_dee1601_config,					&adap->dev->i2c_adap)) != NULL))		return 0;	return -EIO;}static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap){	u8 ircode[4];	int i;	struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD,			       .buf = ircode, .len = 4 };	if (usb_set_interface(adap->dev->udev, 0, 1) < 0)		err("set interface failed");	cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);	/* reset the tuner and demodulator */	cxusb_bluebird_gpio_rw(adap->dev, 0x04, 0);	cxusb_bluebird_gpio_pulse(adap->dev, 0x01, 1);	cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1);	if ((adap->fe = dvb_attach(zl10353_attach,				   &cxusb_zl10353_xc3028_config,				   &adap->dev->i2c_adap)) == NULL)		return -EIO;	/* try to determine if there is no IR decoder on the I2C bus */	for (i = 0; adap->dev->props.rc_key_map != NULL && i < 5; i++) {		msleep(20);		if (cxusb_i2c_xfer(&adap->dev->i2c_adap, &msg, 1) != 1)			goto no_IR;		if (ircode[0] == 0 && ircode[1] == 0)			continue;		if (ircode[2] + ircode[3] != 0xff) {no_IR:			adap->dev->props.rc_key_map = NULL;			info("No IR receiver detected on this device.");			break;		}	}	return 0;}static struct dibx000_agc_config dib7070_agc_config = {	.band_caps = BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,	/*	 * P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5,	 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,	 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0	 */	.setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) |		 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),

⌨️ 快捷键说明

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