18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/* DVB USB compliant linux driver for mobile DVB-T USB devices based on
38c2ecf20Sopenharmony_ci * reference designs made by DiBcom (http://www.dibcom.fr/) (DiB3000M-C/P)
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@posteo.de)
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * based on GPL code from DiBcom, which has
88c2ecf20Sopenharmony_ci * Copyright (C) 2004 Amaury Demol for DiBcom
98c2ecf20Sopenharmony_ci *
108c2ecf20Sopenharmony_ci * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information
118c2ecf20Sopenharmony_ci */
128c2ecf20Sopenharmony_ci#include "dibusb.h"
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ciDVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/* USB Driver stuff */
178c2ecf20Sopenharmony_cistatic struct dvb_usb_device_properties dibusb_mc_properties;
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_cistatic int dibusb_mc_probe(struct usb_interface *intf,
208c2ecf20Sopenharmony_ci		const struct usb_device_id *id)
218c2ecf20Sopenharmony_ci{
228c2ecf20Sopenharmony_ci	return dvb_usb_device_init(intf, &dibusb_mc_properties, THIS_MODULE,
238c2ecf20Sopenharmony_ci				   NULL, adapter_nr);
248c2ecf20Sopenharmony_ci}
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci/* do not change the order of the ID table */
278c2ecf20Sopenharmony_cistatic struct usb_device_id dibusb_dib3000mc_table [] = {
288c2ecf20Sopenharmony_ci/* 00 */	{ USB_DEVICE(USB_VID_DIBCOM,		USB_PID_DIBCOM_MOD3001_COLD) },
298c2ecf20Sopenharmony_ci/* 01 */	{ USB_DEVICE(USB_VID_DIBCOM,		USB_PID_DIBCOM_MOD3001_WARM) },
308c2ecf20Sopenharmony_ci/* 02 */	{ USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC,	USB_PID_ULTIMA_TVBOX_USB2_COLD) },
318c2ecf20Sopenharmony_ci/* 03 */	{ USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC,	USB_PID_ULTIMA_TVBOX_USB2_WARM) }, // ( ? )
328c2ecf20Sopenharmony_ci/* 04 */	{ USB_DEVICE(USB_VID_LITEON,		USB_PID_LITEON_DVB_T_COLD) },
338c2ecf20Sopenharmony_ci/* 05 */	{ USB_DEVICE(USB_VID_LITEON,		USB_PID_LITEON_DVB_T_WARM) },
348c2ecf20Sopenharmony_ci/* 06 */	{ USB_DEVICE(USB_VID_EMPIA,		USB_PID_DIGIVOX_MINI_SL_COLD) },
358c2ecf20Sopenharmony_ci/* 07 */	{ USB_DEVICE(USB_VID_EMPIA,		USB_PID_DIGIVOX_MINI_SL_WARM) },
368c2ecf20Sopenharmony_ci/* 08 */	{ USB_DEVICE(USB_VID_GRANDTEC,          USB_PID_GRANDTEC_DVBT_USB2_COLD) },
378c2ecf20Sopenharmony_ci/* 09 */	{ USB_DEVICE(USB_VID_GRANDTEC,          USB_PID_GRANDTEC_DVBT_USB2_WARM) },
388c2ecf20Sopenharmony_ci/* 10 */	{ USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC,	USB_PID_ARTEC_T14_COLD) },
398c2ecf20Sopenharmony_ci/* 11 */	{ USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC,	USB_PID_ARTEC_T14_WARM) },
408c2ecf20Sopenharmony_ci/* 12 */	{ USB_DEVICE(USB_VID_LEADTEK,		USB_PID_WINFAST_DTV_DONGLE_COLD) },
418c2ecf20Sopenharmony_ci/* 13 */	{ USB_DEVICE(USB_VID_LEADTEK,		USB_PID_WINFAST_DTV_DONGLE_WARM) },
428c2ecf20Sopenharmony_ci/* 14 */	{ USB_DEVICE(USB_VID_HUMAX_COEX,	USB_PID_DVB_T_USB_STICK_HIGH_SPEED_COLD) },
438c2ecf20Sopenharmony_ci/* 15 */	{ USB_DEVICE(USB_VID_HUMAX_COEX,	USB_PID_DVB_T_USB_STICK_HIGH_SPEED_WARM) },
448c2ecf20Sopenharmony_ci			{ }		/* Terminating entry */
458c2ecf20Sopenharmony_ci};
468c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE (usb, dibusb_dib3000mc_table);
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_cistatic struct dvb_usb_device_properties dibusb_mc_properties = {
498c2ecf20Sopenharmony_ci	.caps = DVB_USB_IS_AN_I2C_ADAPTER,
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci	.usb_ctrl = CYPRESS_FX2,
528c2ecf20Sopenharmony_ci	.firmware = "dvb-usb-dibusb-6.0.0.8.fw",
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci	.num_adapters = 1,
558c2ecf20Sopenharmony_ci	.adapter = {
568c2ecf20Sopenharmony_ci		{
578c2ecf20Sopenharmony_ci		.num_frontends = 1,
588c2ecf20Sopenharmony_ci		.fe = {{
598c2ecf20Sopenharmony_ci			.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
608c2ecf20Sopenharmony_ci			.pid_filter_count = 32,
618c2ecf20Sopenharmony_ci			.streaming_ctrl   = dibusb2_0_streaming_ctrl,
628c2ecf20Sopenharmony_ci			.pid_filter       = dibusb_pid_filter,
638c2ecf20Sopenharmony_ci			.pid_filter_ctrl  = dibusb_pid_filter_ctrl,
648c2ecf20Sopenharmony_ci			.frontend_attach  = dibusb_dib3000mc_frontend_attach,
658c2ecf20Sopenharmony_ci			.tuner_attach     = dibusb_dib3000mc_tuner_attach,
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci	/* parameter for the MPEG2-data transfer */
688c2ecf20Sopenharmony_ci			.stream = {
698c2ecf20Sopenharmony_ci				.type = USB_BULK,
708c2ecf20Sopenharmony_ci				.count = 8,
718c2ecf20Sopenharmony_ci				.endpoint = 0x06,
728c2ecf20Sopenharmony_ci				.u = {
738c2ecf20Sopenharmony_ci					.bulk = {
748c2ecf20Sopenharmony_ci						.buffersize = 4096,
758c2ecf20Sopenharmony_ci					}
768c2ecf20Sopenharmony_ci				}
778c2ecf20Sopenharmony_ci			},
788c2ecf20Sopenharmony_ci		}},
798c2ecf20Sopenharmony_ci			.size_of_priv     = sizeof(struct dibusb_state),
808c2ecf20Sopenharmony_ci		}
818c2ecf20Sopenharmony_ci	},
828c2ecf20Sopenharmony_ci	.power_ctrl       = dibusb2_0_power_ctrl,
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci	.rc.legacy = {
858c2ecf20Sopenharmony_ci		.rc_interval      = DEFAULT_RC_INTERVAL,
868c2ecf20Sopenharmony_ci		.rc_map_table     = rc_map_dibusb_table,
878c2ecf20Sopenharmony_ci		.rc_map_size      = 111, /* FIXME */
888c2ecf20Sopenharmony_ci		.rc_query         = dibusb_rc_query,
898c2ecf20Sopenharmony_ci	},
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci	.i2c_algo         = &dibusb_i2c_algo,
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci	.generic_bulk_ctrl_endpoint = 0x01,
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci	.num_device_descs = 8,
968c2ecf20Sopenharmony_ci	.devices = {
978c2ecf20Sopenharmony_ci		{   "DiBcom USB2.0 DVB-T reference design (MOD3000P)",
988c2ecf20Sopenharmony_ci			{ &dibusb_dib3000mc_table[0], NULL },
998c2ecf20Sopenharmony_ci			{ &dibusb_dib3000mc_table[1], NULL },
1008c2ecf20Sopenharmony_ci		},
1018c2ecf20Sopenharmony_ci		{   "Artec T1 USB2.0 TVBOX (please check the warm ID)",
1028c2ecf20Sopenharmony_ci			{ &dibusb_dib3000mc_table[2], NULL },
1038c2ecf20Sopenharmony_ci			{ &dibusb_dib3000mc_table[3], NULL },
1048c2ecf20Sopenharmony_ci		},
1058c2ecf20Sopenharmony_ci		{   "LITE-ON USB2.0 DVB-T Tuner",
1068c2ecf20Sopenharmony_ci		    /* Also rebranded as Intuix S800, Toshiba */
1078c2ecf20Sopenharmony_ci			{ &dibusb_dib3000mc_table[4], NULL },
1088c2ecf20Sopenharmony_ci			{ &dibusb_dib3000mc_table[5], NULL },
1098c2ecf20Sopenharmony_ci		},
1108c2ecf20Sopenharmony_ci		{   "MSI Digivox Mini SL",
1118c2ecf20Sopenharmony_ci			{ &dibusb_dib3000mc_table[6], NULL },
1128c2ecf20Sopenharmony_ci			{ &dibusb_dib3000mc_table[7], NULL },
1138c2ecf20Sopenharmony_ci		},
1148c2ecf20Sopenharmony_ci		{   "GRAND - USB2.0 DVB-T adapter",
1158c2ecf20Sopenharmony_ci			{ &dibusb_dib3000mc_table[8], NULL },
1168c2ecf20Sopenharmony_ci			{ &dibusb_dib3000mc_table[9], NULL },
1178c2ecf20Sopenharmony_ci		},
1188c2ecf20Sopenharmony_ci		{   "Artec T14 - USB2.0 DVB-T",
1198c2ecf20Sopenharmony_ci			{ &dibusb_dib3000mc_table[10], NULL },
1208c2ecf20Sopenharmony_ci			{ &dibusb_dib3000mc_table[11], NULL },
1218c2ecf20Sopenharmony_ci		},
1228c2ecf20Sopenharmony_ci		{   "Leadtek - USB2.0 Winfast DTV dongle",
1238c2ecf20Sopenharmony_ci			{ &dibusb_dib3000mc_table[12], NULL },
1248c2ecf20Sopenharmony_ci			{ &dibusb_dib3000mc_table[13], NULL },
1258c2ecf20Sopenharmony_ci		},
1268c2ecf20Sopenharmony_ci		{   "Humax/Coex DVB-T USB Stick 2.0 High Speed",
1278c2ecf20Sopenharmony_ci			{ &dibusb_dib3000mc_table[14], NULL },
1288c2ecf20Sopenharmony_ci			{ &dibusb_dib3000mc_table[15], NULL },
1298c2ecf20Sopenharmony_ci		},
1308c2ecf20Sopenharmony_ci		{ NULL },
1318c2ecf20Sopenharmony_ci	}
1328c2ecf20Sopenharmony_ci};
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_cistatic struct usb_driver dibusb_mc_driver = {
1358c2ecf20Sopenharmony_ci	.name		= "dvb_usb_dibusb_mc",
1368c2ecf20Sopenharmony_ci	.probe		= dibusb_mc_probe,
1378c2ecf20Sopenharmony_ci	.disconnect = dvb_usb_device_exit,
1388c2ecf20Sopenharmony_ci	.id_table	= dibusb_dib3000mc_table,
1398c2ecf20Sopenharmony_ci};
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_cimodule_usb_driver(dibusb_mc_driver);
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ciMODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@posteo.de>");
1448c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("Driver for DiBcom USB2.0 DVB-T (DiB3000M-C/P based) devices");
1458c2ecf20Sopenharmony_ciMODULE_VERSION("1.0");
1468c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL");
147