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

📄 m920x.c

📁 linux内核源码
💻 C
📖 第 1 页 / 共 2 页
字号:
	.xtal_freq = TDA10046_XTAL_16M,	.if_freq = TDA10046_FREQ_045,	.agc_config = TDA10046_AGC_TDA827X,	.gpio_config = TDA10046_GPTRI,	.request_firmware = NULL, /* uses firmware EEPROM */};/* tuner configurations */static struct qt1010_config m920x_qt1010_config = {	.i2c_address = 0x62};/* Callbacks for DVB USB */static int m920x_mt352_frontend_attach(struct dvb_usb_adapter *adap){	deb("%s\n",__FUNCTION__);	if ((adap->fe = dvb_attach(mt352_attach,				   &m920x_mt352_config,				   &adap->dev->i2c_adap)) == NULL)		return -EIO;	return 0;}static int m920x_tda10046_08_frontend_attach(struct dvb_usb_adapter *adap){	deb("%s\n",__FUNCTION__);	if ((adap->fe = dvb_attach(tda10046_attach,				   &m920x_tda10046_08_config,				   &adap->dev->i2c_adap)) == NULL)		return -EIO;	return 0;}static int m920x_tda10046_0b_frontend_attach(struct dvb_usb_adapter *adap){	deb("%s\n",__FUNCTION__);	if ((adap->fe = dvb_attach(tda10046_attach,				   &m920x_tda10046_0b_config,				   &adap->dev->i2c_adap)) == NULL)		return -EIO;	return 0;}static int m920x_qt1010_tuner_attach(struct dvb_usb_adapter *adap){	deb("%s\n",__FUNCTION__);	if (dvb_attach(qt1010_attach, adap->fe, &adap->dev->i2c_adap, &m920x_qt1010_config) == NULL)		return -ENODEV;	return 0;}static int m920x_tda8275_60_tuner_attach(struct dvb_usb_adapter *adap){	deb("%s\n",__FUNCTION__);	if (dvb_attach(tda827x_attach, adap->fe, 0x60, &adap->dev->i2c_adap, NULL) == NULL)		return -ENODEV;	return 0;}static int m920x_tda8275_61_tuner_attach(struct dvb_usb_adapter *adap){	deb("%s\n",__FUNCTION__);	if (dvb_attach(tda827x_attach, adap->fe, 0x61, &adap->dev->i2c_adap, NULL) == NULL)		return -ENODEV;	return 0;}/* device-specific initialization */static struct m920x_inits megasky_rc_init [] = {	{ M9206_RC_INIT2, 0xa8 },	{ M9206_RC_INIT1, 0x51 },	{ } /* terminating entry */};static struct m920x_inits tvwalkertwin_rc_init [] = {	{ M9206_RC_INIT2, 0x00 },	{ M9206_RC_INIT1, 0xef },	{ 0xff28,         0x00 },	{ 0xff23,         0x00 },	{ 0xff21,         0x30 },	{ } /* terminating entry */};/* ir keymaps */static struct dvb_usb_rc_key megasky_rc_keys [] = {	{ 0x0, 0x12, KEY_POWER },	{ 0x0, 0x1e, KEY_CYCLEWINDOWS }, /* min/max */	{ 0x0, 0x02, KEY_CHANNELUP },	{ 0x0, 0x05, KEY_CHANNELDOWN },	{ 0x0, 0x03, KEY_VOLUMEUP },	{ 0x0, 0x06, KEY_VOLUMEDOWN },	{ 0x0, 0x04, KEY_MUTE },	{ 0x0, 0x07, KEY_OK }, /* TS */	{ 0x0, 0x08, KEY_STOP },	{ 0x0, 0x09, KEY_MENU }, /* swap */	{ 0x0, 0x0a, KEY_REWIND },	{ 0x0, 0x1b, KEY_PAUSE },	{ 0x0, 0x1f, KEY_FASTFORWARD },	{ 0x0, 0x0c, KEY_RECORD },	{ 0x0, 0x0d, KEY_CAMERA }, /* screenshot */	{ 0x0, 0x0e, KEY_COFFEE }, /* "MTS" */};static struct dvb_usb_rc_key tvwalkertwin_rc_keys [] = {	{ 0x0, 0x01, KEY_ZOOM }, /* Full Screen */	{ 0x0, 0x02, KEY_CAMERA }, /* snapshot */	{ 0x0, 0x03, KEY_MUTE },	{ 0x0, 0x04, KEY_REWIND },	{ 0x0, 0x05, KEY_PLAYPAUSE }, /* Play/Pause */	{ 0x0, 0x06, KEY_FASTFORWARD },	{ 0x0, 0x07, KEY_RECORD },	{ 0x0, 0x08, KEY_STOP },	{ 0x0, 0x09, KEY_TIME }, /* Timeshift */	{ 0x0, 0x0c, KEY_COFFEE }, /* Recall */	{ 0x0, 0x0e, KEY_CHANNELUP },	{ 0x0, 0x12, KEY_POWER },	{ 0x0, 0x15, KEY_MENU }, /* source */	{ 0x0, 0x18, KEY_CYCLEWINDOWS }, /* TWIN PIP */	{ 0x0, 0x1a, KEY_CHANNELDOWN },	{ 0x0, 0x1b, KEY_VOLUMEDOWN },	{ 0x0, 0x1e, KEY_VOLUMEUP },};/* DVB USB Driver stuff */static struct dvb_usb_device_properties megasky_properties;static struct dvb_usb_device_properties digivox_mini_ii_properties;static struct dvb_usb_device_properties tvwalkertwin_properties;static struct dvb_usb_device_properties dposh_properties;static int m920x_probe(struct usb_interface *intf,		       const struct usb_device_id *id){	struct dvb_usb_device *d = NULL;	int ret;	struct m920x_inits *rc_init_seq = NULL;	int bInterfaceNumber = intf->cur_altsetting->desc.bInterfaceNumber;	deb("Probing for m920x device at interface %d\n", bInterfaceNumber);	if (bInterfaceNumber == 0) {		/* Single-tuner device, or first interface on		 * multi-tuner device		 */		if ((ret = dvb_usb_device_init(intf, &megasky_properties,					       THIS_MODULE, &d)) == 0) {			rc_init_seq = megasky_rc_init;			goto found;		}		if ((ret = dvb_usb_device_init(intf, &digivox_mini_ii_properties,					       THIS_MODULE, &d)) == 0) {			/* No remote control, so no rc_init_seq */			goto found;		}		/* This configures both tuners on the TV Walker Twin */		if ((ret = dvb_usb_device_init(intf, &tvwalkertwin_properties,					       THIS_MODULE, &d)) == 0) {			rc_init_seq = tvwalkertwin_rc_init;			goto found;		}		if ((ret = dvb_usb_device_init(intf, &dposh_properties,					       THIS_MODULE, &d)) == 0) {			/* Remote controller not supported yet. */			goto found;		}		return ret;	} else {		/* Another interface on a multi-tuner device */		/* The LifeView TV Walker Twin gets here, but struct		 * tvwalkertwin_properties already configured both		 * tuners, so there is nothing for us to do here		 */	} found:	if ((ret = m920x_init_ep(intf)) < 0)		return ret;	if (d && (ret = m920x_init(d, rc_init_seq)) != 0)		return ret;	return ret;}static struct usb_device_id m920x_table [] = {		{ USB_DEVICE(USB_VID_MSI, USB_PID_MSI_MEGASKY580) },		{ USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC,			     USB_PID_MSI_DIGI_VOX_MINI_II) },		{ USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC,			     USB_PID_LIFEVIEW_TV_WALKER_TWIN_COLD) },		{ USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC,			     USB_PID_LIFEVIEW_TV_WALKER_TWIN_WARM) },		{ USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_COLD) },		{ USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_WARM) },		{ }		/* Terminating entry */};MODULE_DEVICE_TABLE (usb, m920x_table);static struct dvb_usb_device_properties megasky_properties = {	.caps = DVB_USB_IS_AN_I2C_ADAPTER,	.usb_ctrl = DEVICE_SPECIFIC,	.firmware = "dvb-usb-megasky-02.fw",	.download_firmware = m920x_firmware_download,	.rc_interval      = 100,	.rc_key_map       = megasky_rc_keys,	.rc_key_map_size  = ARRAY_SIZE(megasky_rc_keys),	.rc_query         = m920x_rc_query,	.size_of_priv     = sizeof(struct m920x_state),	.identify_state   = m920x_identify_state,	.num_adapters = 1,	.adapter = {{		.caps = DVB_USB_ADAP_HAS_PID_FILTER |			DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,		.pid_filter_count = 8,		.pid_filter       = m920x_pid_filter,		.pid_filter_ctrl  = m920x_pid_filter_ctrl,		.frontend_attach  = m920x_mt352_frontend_attach,		.tuner_attach     = m920x_qt1010_tuner_attach,		.stream = {			.type = USB_BULK,			.count = 8,			.endpoint = 0x81,			.u = {				.bulk = {					.buffersize = 512,				}			}		},	}},	.i2c_algo         = &m920x_i2c_algo,	.num_device_descs = 1,	.devices = {		{   "MSI Mega Sky 580 DVB-T USB2.0",			{ &m920x_table[0], NULL },			{ NULL },		}	}};static struct dvb_usb_device_properties digivox_mini_ii_properties = {	.caps = DVB_USB_IS_AN_I2C_ADAPTER,	.usb_ctrl = DEVICE_SPECIFIC,	.firmware = "dvb-usb-digivox-02.fw",	.download_firmware = m920x_firmware_download,	.size_of_priv     = sizeof(struct m920x_state),	.identify_state   = m920x_identify_state,	.num_adapters = 1,	.adapter = {{		.caps = DVB_USB_ADAP_HAS_PID_FILTER |			DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,		.pid_filter_count = 8,		.pid_filter       = m920x_pid_filter,		.pid_filter_ctrl  = m920x_pid_filter_ctrl,		.frontend_attach  = m920x_tda10046_08_frontend_attach,		.tuner_attach     = m920x_tda8275_60_tuner_attach,		.stream = {			.type = USB_BULK,			.count = 8,			.endpoint = 0x81,			.u = {				.bulk = {					.buffersize = 0x4000,				}			}		},	}},	.i2c_algo         = &m920x_i2c_algo,	.num_device_descs = 1,	.devices = {		{   "MSI DIGI VOX mini II DVB-T USB2.0",			{ &m920x_table[1], NULL },			{ NULL },		},	}};/* LifeView TV Walker Twin support by Nick Andrew <nick@nick-andrew.net> * * LifeView TV Walker Twin has 1 x M9206, 2 x TDA10046, 2 x TDA8275A * TDA10046 #0 is located at i2c address 0x08 * TDA10046 #1 is located at i2c address 0x0b * TDA8275A #0 is located at i2c address 0x60 * TDA8275A #1 is located at i2c address 0x61 */static struct dvb_usb_device_properties tvwalkertwin_properties = {	.caps = DVB_USB_IS_AN_I2C_ADAPTER,	.usb_ctrl = DEVICE_SPECIFIC,	.firmware = "dvb-usb-tvwalkert.fw",	.download_firmware = m920x_firmware_download,	.rc_interval      = 100,	.rc_key_map       = tvwalkertwin_rc_keys,	.rc_key_map_size  = ARRAY_SIZE(tvwalkertwin_rc_keys),	.rc_query         = m920x_rc_query,	.size_of_priv     = sizeof(struct m920x_state),	.identify_state   = m920x_identify_state,	.num_adapters = 2,	.adapter = {{		.caps = DVB_USB_ADAP_HAS_PID_FILTER |			DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,		.pid_filter_count = 8,		.pid_filter       = m920x_pid_filter,		.pid_filter_ctrl  = m920x_pid_filter_ctrl,		.frontend_attach  = m920x_tda10046_08_frontend_attach,		.tuner_attach     = m920x_tda8275_60_tuner_attach,		.stream = {			.type = USB_BULK,			.count = 8,			.endpoint = 0x81,			.u = {				 .bulk = {					 .buffersize = 512,				 }			}		}},{		.caps = DVB_USB_ADAP_HAS_PID_FILTER |			DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,		.pid_filter_count = 8,		.pid_filter       = m920x_pid_filter,		.pid_filter_ctrl  = m920x_pid_filter_ctrl,		.frontend_attach  = m920x_tda10046_0b_frontend_attach,		.tuner_attach     = m920x_tda8275_61_tuner_attach,		.stream = {			.type = USB_BULK,			.count = 8,			.endpoint = 0x82,			.u = {				 .bulk = {					 .buffersize = 512,				 }			}		},	}},	.i2c_algo         = &m920x_i2c_algo,	.num_device_descs = 1,	.devices = {		{   .name = "LifeView TV Walker Twin DVB-T USB2.0",		    .cold_ids = { &m920x_table[2], NULL },		    .warm_ids = { &m920x_table[3], NULL },		},	}};static struct dvb_usb_device_properties dposh_properties = {	.caps = DVB_USB_IS_AN_I2C_ADAPTER,	.usb_ctrl = DEVICE_SPECIFIC,	.firmware = "dvb-usb-dposh-01.fw",	.download_firmware = m920x_firmware_download,	.size_of_priv     = sizeof(struct m920x_state),	.identify_state   = m920x_identify_state,	.num_adapters = 1,	.adapter = {{		/* Hardware pid filters don't work with this device/firmware */		.frontend_attach  = m920x_mt352_frontend_attach,		.tuner_attach     = m920x_qt1010_tuner_attach,		.stream = {			.type = USB_BULK,			.count = 8,			.endpoint = 0x81,			.u = {				 .bulk = {					 .buffersize = 512,				 }			}		},	}},	.i2c_algo         = &m920x_i2c_algo,	.num_device_descs = 1,	.devices = {		 {   .name = "Dposh DVB-T USB2.0",		     .cold_ids = { &m920x_table[4], NULL },		     .warm_ids = { &m920x_table[5], NULL },		 },	 }};static struct usb_driver m920x_driver = {	.name		= "dvb_usb_m920x",	.probe		= m920x_probe,	.disconnect	= dvb_usb_device_exit,	.id_table	= m920x_table,};/* module stuff */static int __init m920x_module_init(void){	int ret;	if ((ret = usb_register(&m920x_driver))) {		err("usb_register failed. Error number %d", ret);		return ret;	}	return 0;}static void __exit m920x_module_exit(void){	/* deregister this driver from the USB subsystem */	usb_deregister(&m920x_driver);}module_init (m920x_module_init);module_exit (m920x_module_exit);MODULE_AUTHOR("Aapo Tahkola <aet@rasterburn.org>");MODULE_DESCRIPTION("DVB Driver for ULI M920x");MODULE_VERSION("0.1");MODULE_LICENSE("GPL");/* * Local variables: * c-basic-offset: 8 */

⌨️ 快捷键说明

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