xref: /linux/drivers/media/usb/dvb-usb/dibusb-mc.c (revision 8e07e0e3964ca4e23ce7b68e2096fe660a888942)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /* DVB USB compliant linux driver for mobile DVB-T USB devices based on
3  * reference designs made by DiBcom (http://www.dibcom.fr/) (DiB3000M-C/P)
4  *
5  * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@posteo.de)
6  *
7  * based on GPL code from DiBcom, which has
8  * Copyright (C) 2004 Amaury Demol for DiBcom
9  *
10  * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information
11  */
12 #include "dibusb.h"
13 
14 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
15 
16 /* USB Driver stuff */
17 static struct dvb_usb_device_properties dibusb_mc_properties;
18 
19 static int dibusb_mc_probe(struct usb_interface *intf,
20 		const struct usb_device_id *id)
21 {
22 	return dvb_usb_device_init(intf, &dibusb_mc_properties, THIS_MODULE,
23 				   NULL, adapter_nr);
24 }
25 
26 /* do not change the order of the ID table */
27 enum {
28 	DIBCOM_MOD3001_COLD,
29 	DIBCOM_MOD3001_WARM,
30 	ULTIMA_TVBOX_USB2_COLD,
31 	ULTIMA_TVBOX_USB2_WARM,
32 	LITEON_DVB_T_COLD,
33 	LITEON_DVB_T_WARM,
34 	EMPIA_DIGIVOX_MINI_SL_COLD,
35 	EMPIA_DIGIVOX_MINI_SL_WARM,
36 	GRANDTEC_DVBT_USB2_COLD,
37 	GRANDTEC_DVBT_USB2_WARM,
38 	ULTIMA_ARTEC_T14_COLD,
39 	ULTIMA_ARTEC_T14_WARM,
40 	LEADTEK_WINFAST_DTV_DONGLE_COLD,
41 	LEADTEK_WINFAST_DTV_DONGLE_WARM,
42 	HUMAX_DVB_T_STICK_HIGH_SPEED_COLD,
43 	HUMAX_DVB_T_STICK_HIGH_SPEED_WARM,
44 };
45 
46 static struct usb_device_id dibusb_dib3000mc_table[] = {
47 	DVB_USB_DEV(DIBCOM, DIBCOM_MOD3001_COLD),
48 	DVB_USB_DEV(DIBCOM, DIBCOM_MOD3001_WARM),
49 	DVB_USB_DEV(ULTIMA_ELECTRONIC, ULTIMA_TVBOX_USB2_COLD),
50 	DVB_USB_DEV(ULTIMA_ELECTRONIC, ULTIMA_TVBOX_USB2_WARM),
51 	DVB_USB_DEV(LITEON, LITEON_DVB_T_COLD),
52 	DVB_USB_DEV(LITEON, LITEON_DVB_T_WARM),
53 	DVB_USB_DEV(EMPIA, EMPIA_DIGIVOX_MINI_SL_COLD),
54 	DVB_USB_DEV(EMPIA, EMPIA_DIGIVOX_MINI_SL_WARM),
55 	DVB_USB_DEV(GRANDTEC, GRANDTEC_DVBT_USB2_COLD),
56 	DVB_USB_DEV(GRANDTEC, GRANDTEC_DVBT_USB2_WARM),
57 	DVB_USB_DEV(ULTIMA_ELECTRONIC, ULTIMA_ARTEC_T14_COLD),
58 	DVB_USB_DEV(ULTIMA_ELECTRONIC, ULTIMA_ARTEC_T14_WARM),
59 	DVB_USB_DEV(LEADTEK, LEADTEK_WINFAST_DTV_DONGLE_COLD),
60 	DVB_USB_DEV(LEADTEK, LEADTEK_WINFAST_DTV_DONGLE_WARM),
61 	DVB_USB_DEV(HUMAX_COEX, HUMAX_DVB_T_STICK_HIGH_SPEED_COLD),
62 	DVB_USB_DEV(HUMAX_COEX, HUMAX_DVB_T_STICK_HIGH_SPEED_WARM),
63 	{ }
64 };
65 
66 MODULE_DEVICE_TABLE (usb, dibusb_dib3000mc_table);
67 
68 static struct dvb_usb_device_properties dibusb_mc_properties = {
69 	.caps = DVB_USB_IS_AN_I2C_ADAPTER,
70 
71 	.usb_ctrl = CYPRESS_FX2,
72 	.firmware = "dvb-usb-dibusb-6.0.0.8.fw",
73 
74 	.num_adapters = 1,
75 	.adapter = {
76 		{
77 		.num_frontends = 1,
78 		.fe = {{
79 			.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
80 			.pid_filter_count = 32,
81 			.streaming_ctrl   = dibusb2_0_streaming_ctrl,
82 			.pid_filter       = dibusb_pid_filter,
83 			.pid_filter_ctrl  = dibusb_pid_filter_ctrl,
84 			.frontend_attach  = dibusb_dib3000mc_frontend_attach,
85 			.tuner_attach     = dibusb_dib3000mc_tuner_attach,
86 
87 	/* parameter for the MPEG2-data transfer */
88 			.stream = {
89 				.type = USB_BULK,
90 				.count = 8,
91 				.endpoint = 0x06,
92 				.u = {
93 					.bulk = {
94 						.buffersize = 4096,
95 					}
96 				}
97 			},
98 		}},
99 			.size_of_priv     = sizeof(struct dibusb_state),
100 		}
101 	},
102 	.power_ctrl       = dibusb2_0_power_ctrl,
103 
104 	.rc.legacy = {
105 		.rc_interval      = DEFAULT_RC_INTERVAL,
106 		.rc_map_table     = rc_map_dibusb_table,
107 		.rc_map_size      = 111, /* FIXME */
108 		.rc_query         = dibusb_rc_query,
109 	},
110 
111 	.i2c_algo         = &dibusb_i2c_algo,
112 
113 	.generic_bulk_ctrl_endpoint = 0x01,
114 
115 	.num_device_descs = 8,
116 	.devices = {
117 		{   "DiBcom USB2.0 DVB-T reference design (MOD3000P)",
118 			{ &dibusb_dib3000mc_table[DIBCOM_MOD3001_COLD], NULL },
119 			{ &dibusb_dib3000mc_table[DIBCOM_MOD3001_WARM], NULL },
120 		},
121 		{   "Artec T1 USB2.0 TVBOX (please check the warm ID)",
122 			{ &dibusb_dib3000mc_table[ULTIMA_TVBOX_USB2_COLD], NULL },
123 			{ &dibusb_dib3000mc_table[ULTIMA_TVBOX_USB2_WARM], NULL },
124 		},
125 		{   "LITE-ON USB2.0 DVB-T Tuner",
126 		    /* Also rebranded as Intuix S800, Toshiba */
127 			{ &dibusb_dib3000mc_table[LITEON_DVB_T_COLD], NULL },
128 			{ &dibusb_dib3000mc_table[LITEON_DVB_T_WARM], NULL },
129 		},
130 		{   "MSI Digivox Mini SL",
131 			{ &dibusb_dib3000mc_table[EMPIA_DIGIVOX_MINI_SL_COLD], NULL },
132 			{ &dibusb_dib3000mc_table[EMPIA_DIGIVOX_MINI_SL_WARM], NULL },
133 		},
134 		{   "GRAND - USB2.0 DVB-T adapter",
135 			{ &dibusb_dib3000mc_table[GRANDTEC_DVBT_USB2_COLD], NULL },
136 			{ &dibusb_dib3000mc_table[GRANDTEC_DVBT_USB2_WARM], NULL },
137 		},
138 		{   "Artec T14 - USB2.0 DVB-T",
139 			{ &dibusb_dib3000mc_table[ULTIMA_ARTEC_T14_COLD], NULL },
140 			{ &dibusb_dib3000mc_table[ULTIMA_ARTEC_T14_WARM], NULL },
141 		},
142 		{   "Leadtek - USB2.0 Winfast DTV dongle",
143 			{ &dibusb_dib3000mc_table[LEADTEK_WINFAST_DTV_DONGLE_COLD], NULL },
144 			{ &dibusb_dib3000mc_table[LEADTEK_WINFAST_DTV_DONGLE_WARM], NULL },
145 		},
146 		{   "Humax/Coex DVB-T USB Stick 2.0 High Speed",
147 			{ &dibusb_dib3000mc_table[HUMAX_DVB_T_STICK_HIGH_SPEED_COLD], NULL },
148 			{ &dibusb_dib3000mc_table[HUMAX_DVB_T_STICK_HIGH_SPEED_WARM], NULL },
149 		},
150 		{ NULL },
151 	}
152 };
153 
154 static struct usb_driver dibusb_mc_driver = {
155 	.name		= "dvb_usb_dibusb_mc",
156 	.probe		= dibusb_mc_probe,
157 	.disconnect = dvb_usb_device_exit,
158 	.id_table	= dibusb_dib3000mc_table,
159 };
160 
161 module_usb_driver(dibusb_mc_driver);
162 
163 MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@posteo.de>");
164 MODULE_DESCRIPTION("Driver for DiBcom USB2.0 DVB-T (DiB3000M-C/P based) devices");
165 MODULE_VERSION("1.0");
166 MODULE_LICENSE("GPL");
167