cxusb.c 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787
  1. /* DVB USB compliant linux driver for Conexant USB reference design.
  2. *
  3. * The Conexant reference design I saw on their website was only for analogue
  4. * capturing (using the cx25842). The box I took to write this driver (reverse
  5. * engineered) is the one labeled Medion MD95700. In addition to the cx25842
  6. * for analogue capturing it also has a cx22702 DVB-T demodulator on the main
  7. * board. Besides it has a atiremote (X10) and a USB2.0 hub onboard.
  8. *
  9. * Maybe it is a little bit premature to call this driver cxusb, but I assume
  10. * the USB protocol is identical or at least inherited from the reference
  11. * design, so it can be reused for the "analogue-only" device (if it will
  12. * appear at all).
  13. *
  14. * TODO: Use the cx25840-driver for the analogue part
  15. *
  16. * Copyright (C) 2005 Patrick Boettcher (patrick.boettcher@desy.de)
  17. * Copyright (C) 2005 Michael Krufky (mkrufky@m1k.net)
  18. * Copyright (C) 2006 Chris Pascoe (c.pascoe@itee.uq.edu.au)
  19. *
  20. * This program is free software; you can redistribute it and/or modify it
  21. * under the terms of the GNU General Public License as published by the Free
  22. * Software Foundation, version 2.
  23. *
  24. * see Documentation/dvb/README.dvb-usb for more information
  25. */
  26. #include "cxusb.h"
  27. #include "cx22702.h"
  28. #include "lgdt330x.h"
  29. #include "mt352.h"
  30. #include "mt352_priv.h"
  31. /* debug */
  32. int dvb_usb_cxusb_debug;
  33. module_param_named(debug,dvb_usb_cxusb_debug, int, 0644);
  34. MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
  35. static int cxusb_ctrl_msg(struct dvb_usb_device *d,
  36. u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen)
  37. {
  38. int wo = (rbuf == NULL || rlen == 0); /* write-only */
  39. u8 sndbuf[1+wlen];
  40. memset(sndbuf,0,1+wlen);
  41. sndbuf[0] = cmd;
  42. memcpy(&sndbuf[1],wbuf,wlen);
  43. if (wo)
  44. dvb_usb_generic_write(d,sndbuf,1+wlen);
  45. else
  46. dvb_usb_generic_rw(d,sndbuf,1+wlen,rbuf,rlen,0);
  47. return 0;
  48. }
  49. /* GPIO */
  50. static void cxusb_gpio_tuner(struct dvb_usb_device *d, int onoff)
  51. {
  52. struct cxusb_state *st = d->priv;
  53. u8 o[2],i;
  54. if (st->gpio_write_state[GPIO_TUNER] == onoff)
  55. return;
  56. o[0] = GPIO_TUNER;
  57. o[1] = onoff;
  58. cxusb_ctrl_msg(d,CMD_GPIO_WRITE,o,2,&i,1);
  59. if (i != 0x01)
  60. deb_info("gpio_write failed.\n");
  61. st->gpio_write_state[GPIO_TUNER] = onoff;
  62. }
  63. /* I2C */
  64. static int cxusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num)
  65. {
  66. struct dvb_usb_device *d = i2c_get_adapdata(adap);
  67. int i;
  68. if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
  69. return -EAGAIN;
  70. if (num > 2)
  71. warn("more than two i2c messages at a time is not handled yet. TODO.");
  72. for (i = 0; i < num; i++) {
  73. if (d->udev->descriptor.idVendor == USB_VID_MEDION)
  74. switch (msg[i].addr) {
  75. case 0x63:
  76. cxusb_gpio_tuner(d,0);
  77. break;
  78. default:
  79. cxusb_gpio_tuner(d,1);
  80. break;
  81. }
  82. /* read request */
  83. if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) {
  84. u8 obuf[3+msg[i].len], ibuf[1+msg[i+1].len];
  85. obuf[0] = msg[i].len;
  86. obuf[1] = msg[i+1].len;
  87. obuf[2] = msg[i].addr;
  88. memcpy(&obuf[3],msg[i].buf,msg[i].len);
  89. if (cxusb_ctrl_msg(d, CMD_I2C_READ,
  90. obuf, 3+msg[i].len,
  91. ibuf, 1+msg[i+1].len) < 0)
  92. break;
  93. if (ibuf[0] != 0x08)
  94. deb_i2c("i2c read may have failed\n");
  95. memcpy(msg[i+1].buf,&ibuf[1],msg[i+1].len);
  96. i++;
  97. } else { /* write */
  98. u8 obuf[2+msg[i].len], ibuf;
  99. obuf[0] = msg[i].addr;
  100. obuf[1] = msg[i].len;
  101. memcpy(&obuf[2],msg[i].buf,msg[i].len);
  102. if (cxusb_ctrl_msg(d,CMD_I2C_WRITE, obuf, 2+msg[i].len, &ibuf,1) < 0)
  103. break;
  104. if (ibuf != 0x08)
  105. deb_i2c("i2c write may have failed\n");
  106. }
  107. }
  108. mutex_unlock(&d->i2c_mutex);
  109. return i;
  110. }
  111. static u32 cxusb_i2c_func(struct i2c_adapter *adapter)
  112. {
  113. return I2C_FUNC_I2C;
  114. }
  115. static struct i2c_algorithm cxusb_i2c_algo = {
  116. .master_xfer = cxusb_i2c_xfer,
  117. .functionality = cxusb_i2c_func,
  118. };
  119. static int cxusb_power_ctrl(struct dvb_usb_device *d, int onoff)
  120. {
  121. u8 b = 0;
  122. if (onoff)
  123. return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0);
  124. else
  125. return cxusb_ctrl_msg(d, CMD_POWER_OFF, &b, 1, NULL, 0);
  126. }
  127. static int cxusb_bluebird_power_ctrl(struct dvb_usb_device *d, int onoff)
  128. {
  129. u8 b = 0;
  130. if (onoff)
  131. return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0);
  132. else
  133. return 0;
  134. }
  135. static int cxusb_streaming_ctrl(struct dvb_usb_device *d, int onoff)
  136. {
  137. u8 buf[2] = { 0x03, 0x00 };
  138. if (onoff)
  139. cxusb_ctrl_msg(d,CMD_STREAMING_ON, buf, 2, NULL, 0);
  140. else
  141. cxusb_ctrl_msg(d,CMD_STREAMING_OFF, NULL, 0, NULL, 0);
  142. return 0;
  143. }
  144. static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
  145. {
  146. struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
  147. u8 ircode[4];
  148. int i;
  149. cxusb_ctrl_msg(d, CMD_GET_IR_CODE, NULL, 0, ircode, 4);
  150. *event = 0;
  151. *state = REMOTE_NO_KEY_PRESSED;
  152. for (i = 0; i < d->props.rc_key_map_size; i++) {
  153. if (keymap[i].custom == ircode[2] &&
  154. keymap[i].data == ircode[3]) {
  155. *event = keymap[i].event;
  156. *state = REMOTE_KEY_PRESSED;
  157. return 0;
  158. }
  159. }
  160. return 0;
  161. }
  162. static struct dvb_usb_rc_key dvico_mce_rc_keys[] = {
  163. { 0xfe, 0x02, KEY_TV },
  164. { 0xfe, 0x0e, KEY_MP3 },
  165. { 0xfe, 0x1a, KEY_DVD },
  166. { 0xfe, 0x1e, KEY_FAVORITES },
  167. { 0xfe, 0x16, KEY_SETUP },
  168. { 0xfe, 0x46, KEY_POWER2 },
  169. { 0xfe, 0x0a, KEY_EPG },
  170. { 0xfe, 0x49, KEY_BACK },
  171. { 0xfe, 0x4d, KEY_MENU },
  172. { 0xfe, 0x51, KEY_UP },
  173. { 0xfe, 0x5b, KEY_LEFT },
  174. { 0xfe, 0x5f, KEY_RIGHT },
  175. { 0xfe, 0x53, KEY_DOWN },
  176. { 0xfe, 0x5e, KEY_OK },
  177. { 0xfe, 0x59, KEY_INFO },
  178. { 0xfe, 0x55, KEY_TAB },
  179. { 0xfe, 0x0f, KEY_PREVIOUSSONG },/* Replay */
  180. { 0xfe, 0x12, KEY_NEXTSONG }, /* Skip */
  181. { 0xfe, 0x42, KEY_ENTER }, /* Windows/Start */
  182. { 0xfe, 0x15, KEY_VOLUMEUP },
  183. { 0xfe, 0x05, KEY_VOLUMEDOWN },
  184. { 0xfe, 0x11, KEY_CHANNELUP },
  185. { 0xfe, 0x09, KEY_CHANNELDOWN },
  186. { 0xfe, 0x52, KEY_CAMERA },
  187. { 0xfe, 0x5a, KEY_TUNER }, /* Live */
  188. { 0xfe, 0x19, KEY_OPEN },
  189. { 0xfe, 0x0b, KEY_1 },
  190. { 0xfe, 0x17, KEY_2 },
  191. { 0xfe, 0x1b, KEY_3 },
  192. { 0xfe, 0x07, KEY_4 },
  193. { 0xfe, 0x50, KEY_5 },
  194. { 0xfe, 0x54, KEY_6 },
  195. { 0xfe, 0x48, KEY_7 },
  196. { 0xfe, 0x4c, KEY_8 },
  197. { 0xfe, 0x58, KEY_9 },
  198. { 0xfe, 0x13, KEY_ANGLE }, /* Aspect */
  199. { 0xfe, 0x03, KEY_0 },
  200. { 0xfe, 0x1f, KEY_ZOOM },
  201. { 0xfe, 0x43, KEY_REWIND },
  202. { 0xfe, 0x47, KEY_PLAYPAUSE },
  203. { 0xfe, 0x4f, KEY_FASTFORWARD },
  204. { 0xfe, 0x57, KEY_MUTE },
  205. { 0xfe, 0x0d, KEY_STOP },
  206. { 0xfe, 0x01, KEY_RECORD },
  207. { 0xfe, 0x4e, KEY_POWER },
  208. };
  209. static struct dvb_usb_rc_key dvico_portable_rc_keys[] = {
  210. { 0xfc, 0x02, KEY_SETUP }, /* Profile */
  211. { 0xfc, 0x43, KEY_POWER2 },
  212. { 0xfc, 0x06, KEY_EPG },
  213. { 0xfc, 0x5a, KEY_BACK },
  214. { 0xfc, 0x05, KEY_MENU },
  215. { 0xfc, 0x47, KEY_INFO },
  216. { 0xfc, 0x01, KEY_TAB },
  217. { 0xfc, 0x42, KEY_PREVIOUSSONG },/* Replay */
  218. { 0xfc, 0x49, KEY_VOLUMEUP },
  219. { 0xfc, 0x09, KEY_VOLUMEDOWN },
  220. { 0xfc, 0x54, KEY_CHANNELUP },
  221. { 0xfc, 0x0b, KEY_CHANNELDOWN },
  222. { 0xfc, 0x16, KEY_CAMERA },
  223. { 0xfc, 0x40, KEY_TUNER }, /* ATV/DTV */
  224. { 0xfc, 0x45, KEY_OPEN },
  225. { 0xfc, 0x19, KEY_1 },
  226. { 0xfc, 0x18, KEY_2 },
  227. { 0xfc, 0x1b, KEY_3 },
  228. { 0xfc, 0x1a, KEY_4 },
  229. { 0xfc, 0x58, KEY_5 },
  230. { 0xfc, 0x59, KEY_6 },
  231. { 0xfc, 0x15, KEY_7 },
  232. { 0xfc, 0x14, KEY_8 },
  233. { 0xfc, 0x17, KEY_9 },
  234. { 0xfc, 0x44, KEY_ANGLE }, /* Aspect */
  235. { 0xfc, 0x55, KEY_0 },
  236. { 0xfc, 0x07, KEY_ZOOM },
  237. { 0xfc, 0x0a, KEY_REWIND },
  238. { 0xfc, 0x08, KEY_PLAYPAUSE },
  239. { 0xfc, 0x4b, KEY_FASTFORWARD },
  240. { 0xfc, 0x5b, KEY_MUTE },
  241. { 0xfc, 0x04, KEY_STOP },
  242. { 0xfc, 0x56, KEY_RECORD },
  243. { 0xfc, 0x57, KEY_POWER },
  244. { 0xfc, 0x41, KEY_UNKNOWN }, /* INPUT */
  245. { 0xfc, 0x00, KEY_UNKNOWN }, /* HD */
  246. };
  247. static int cxusb_dee1601_demod_init(struct dvb_frontend* fe)
  248. {
  249. static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x28 };
  250. static u8 reset [] = { RESET, 0x80 };
  251. static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
  252. static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 };
  253. static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 };
  254. static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
  255. mt352_write(fe, clock_config, sizeof(clock_config));
  256. udelay(200);
  257. mt352_write(fe, reset, sizeof(reset));
  258. mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
  259. mt352_write(fe, agc_cfg, sizeof(agc_cfg));
  260. mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg));
  261. mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
  262. return 0;
  263. }
  264. static int cxusb_mt352_demod_init(struct dvb_frontend* fe)
  265. { /* used in both lgz201 and th7579 */
  266. static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x29 };
  267. static u8 reset [] = { RESET, 0x80 };
  268. static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
  269. static u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 };
  270. static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 };
  271. static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
  272. mt352_write(fe, clock_config, sizeof(clock_config));
  273. udelay(200);
  274. mt352_write(fe, reset, sizeof(reset));
  275. mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
  276. mt352_write(fe, agc_cfg, sizeof(agc_cfg));
  277. mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg));
  278. mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
  279. return 0;
  280. }
  281. static int cxusb_lgh064f_pll_set_i2c(struct dvb_frontend *fe,
  282. struct dvb_frontend_parameters *fep)
  283. {
  284. struct dvb_usb_device *d = fe->dvb->priv;
  285. int ret = 0;
  286. u8 b[5];
  287. struct i2c_msg msg = { .addr = d->pll_addr, .flags = 0,
  288. .buf = &b[1], .len = 4 };
  289. dvb_usb_pll_set(fe,fep,b);
  290. if (i2c_transfer (&d->i2c_adap, &msg, 1) != 1) {
  291. err("tuner i2c write failed for pll_set.");
  292. ret = -EREMOTEIO;
  293. }
  294. msleep(1);
  295. /* Set the Auxiliary Byte. */
  296. b[3] &= ~0x20;
  297. b[3] |= 0x18;
  298. b[4] = 0x50;
  299. if (i2c_transfer(&d->i2c_adap, &msg, 1) != 1) {
  300. err("tuner i2c write failed writing auxiliary byte.");
  301. ret = -EREMOTEIO;
  302. }
  303. msleep(1);
  304. return ret;
  305. }
  306. static struct cx22702_config cxusb_cx22702_config = {
  307. .demod_address = 0x63,
  308. .output_mode = CX22702_PARALLEL_OUTPUT,
  309. .pll_init = dvb_usb_pll_init_i2c,
  310. .pll_set = dvb_usb_pll_set_i2c,
  311. };
  312. static struct lgdt330x_config cxusb_lgdt3303_config = {
  313. .demod_address = 0x0e,
  314. .demod_chip = LGDT3303,
  315. .pll_set = cxusb_lgh064f_pll_set_i2c,
  316. };
  317. static struct mt352_config cxusb_dee1601_config = {
  318. .demod_address = 0x0f,
  319. .demod_init = cxusb_dee1601_demod_init,
  320. .pll_set = dvb_usb_pll_set,
  321. };
  322. static struct mt352_config cxusb_mt352_config = {
  323. /* used in both lgz201 and th7579 */
  324. .demod_address = 0x0f,
  325. .demod_init = cxusb_mt352_demod_init,
  326. .pll_set = dvb_usb_pll_set,
  327. };
  328. /* Callbacks for DVB USB */
  329. static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_device *d)
  330. {
  331. u8 bpll[4] = { 0x0b, 0xdc, 0x9c, 0xa0 };
  332. d->pll_addr = 0x61;
  333. memcpy(d->pll_init, bpll, 4);
  334. d->pll_desc = &dvb_pll_fmd1216me;
  335. return 0;
  336. }
  337. static int cxusb_lgh064f_tuner_attach(struct dvb_usb_device *d)
  338. {
  339. d->pll_addr = 0x61;
  340. d->pll_desc = &dvb_pll_tdvs_tua6034;
  341. return 0;
  342. }
  343. static int cxusb_dee1601_tuner_attach(struct dvb_usb_device *d)
  344. {
  345. d->pll_addr = 0x61;
  346. d->pll_desc = &dvb_pll_thomson_dtt7579;
  347. return 0;
  348. }
  349. static int cxusb_lgz201_tuner_attach(struct dvb_usb_device *d)
  350. {
  351. d->pll_addr = 0x61;
  352. d->pll_desc = &dvb_pll_lg_z201;
  353. return 0;
  354. }
  355. static int cxusb_dtt7579_tuner_attach(struct dvb_usb_device *d)
  356. {
  357. d->pll_addr = 0x60;
  358. d->pll_desc = &dvb_pll_thomson_dtt7579;
  359. return 0;
  360. }
  361. static int cxusb_cx22702_frontend_attach(struct dvb_usb_device *d)
  362. {
  363. u8 b;
  364. if (usb_set_interface(d->udev,0,6) < 0)
  365. err("set interface failed");
  366. cxusb_ctrl_msg(d,CMD_DIGITAL, NULL, 0, &b, 1);
  367. if ((d->fe = cx22702_attach(&cxusb_cx22702_config, &d->i2c_adap)) != NULL)
  368. return 0;
  369. return -EIO;
  370. }
  371. static int cxusb_lgdt3303_frontend_attach(struct dvb_usb_device *d)
  372. {
  373. if (usb_set_interface(d->udev,0,7) < 0)
  374. err("set interface failed");
  375. cxusb_ctrl_msg(d,CMD_DIGITAL, NULL, 0, NULL, 0);
  376. if ((d->fe = lgdt330x_attach(&cxusb_lgdt3303_config, &d->i2c_adap)) != NULL)
  377. return 0;
  378. return -EIO;
  379. }
  380. static int cxusb_mt352_frontend_attach(struct dvb_usb_device *d)
  381. { /* used in both lgz201 and th7579 */
  382. if (usb_set_interface(d->udev,0,0) < 0)
  383. err("set interface failed");
  384. cxusb_ctrl_msg(d,CMD_DIGITAL, NULL, 0, NULL, 0);
  385. if ((d->fe = mt352_attach(&cxusb_mt352_config, &d->i2c_adap)) != NULL)
  386. return 0;
  387. return -EIO;
  388. }
  389. static int cxusb_dee1601_frontend_attach(struct dvb_usb_device *d)
  390. {
  391. if (usb_set_interface(d->udev,0,0) < 0)
  392. err("set interface failed");
  393. cxusb_ctrl_msg(d,CMD_DIGITAL, NULL, 0, NULL, 0);
  394. if ((d->fe = mt352_attach(&cxusb_dee1601_config, &d->i2c_adap)) != NULL)
  395. return 0;
  396. return -EIO;
  397. }
  398. /*
  399. * DViCO bluebird firmware needs the "warm" product ID to be patched into the
  400. * firmware file before download.
  401. */
  402. #define BLUEBIRD_01_ID_OFFSET 6638
  403. static int bluebird_patch_dvico_firmware_download(struct usb_device *udev, const struct firmware *fw)
  404. {
  405. if (fw->size < BLUEBIRD_01_ID_OFFSET + 4)
  406. return -EINVAL;
  407. if (fw->data[BLUEBIRD_01_ID_OFFSET] == (USB_VID_DVICO & 0xff) &&
  408. fw->data[BLUEBIRD_01_ID_OFFSET + 1] == USB_VID_DVICO >> 8) {
  409. fw->data[BLUEBIRD_01_ID_OFFSET + 2] = udev->descriptor.idProduct + 1;
  410. fw->data[BLUEBIRD_01_ID_OFFSET + 3] = udev->descriptor.idProduct >> 8;
  411. return usb_cypress_load_firmware(udev,fw,CYPRESS_FX2);
  412. }
  413. return -EINVAL;
  414. }
  415. /* DVB USB Driver stuff */
  416. static struct dvb_usb_properties cxusb_medion_properties;
  417. static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties;
  418. static struct dvb_usb_properties cxusb_bluebird_dee1601_properties;
  419. static struct dvb_usb_properties cxusb_bluebird_lgz201_properties;
  420. static struct dvb_usb_properties cxusb_bluebird_dtt7579_properties;
  421. static int cxusb_probe(struct usb_interface *intf,
  422. const struct usb_device_id *id)
  423. {
  424. if (dvb_usb_device_init(intf,&cxusb_medion_properties,THIS_MODULE,NULL) == 0 ||
  425. dvb_usb_device_init(intf,&cxusb_bluebird_lgh064f_properties,THIS_MODULE,NULL) == 0 ||
  426. dvb_usb_device_init(intf,&cxusb_bluebird_dee1601_properties,THIS_MODULE,NULL) == 0 ||
  427. dvb_usb_device_init(intf,&cxusb_bluebird_lgz201_properties,THIS_MODULE,NULL) == 0 ||
  428. dvb_usb_device_init(intf,&cxusb_bluebird_dtt7579_properties,THIS_MODULE,NULL) == 0) {
  429. return 0;
  430. }
  431. return -EINVAL;
  432. }
  433. static struct usb_device_id cxusb_table [] = {
  434. { USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700) },
  435. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_COLD) },
  436. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_WARM) },
  437. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DEE1601_COLD) },
  438. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DEE1601_WARM) },
  439. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD) },
  440. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM) },
  441. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_COLD) },
  442. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_WARM) },
  443. { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DEE1601_COLD) },
  444. { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DEE1601_WARM) },
  445. {} /* Terminating entry */
  446. };
  447. MODULE_DEVICE_TABLE (usb, cxusb_table);
  448. static struct dvb_usb_properties cxusb_medion_properties = {
  449. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  450. .usb_ctrl = CYPRESS_FX2,
  451. .size_of_priv = sizeof(struct cxusb_state),
  452. .streaming_ctrl = cxusb_streaming_ctrl,
  453. .power_ctrl = cxusb_power_ctrl,
  454. .frontend_attach = cxusb_cx22702_frontend_attach,
  455. .tuner_attach = cxusb_fmd1216me_tuner_attach,
  456. .i2c_algo = &cxusb_i2c_algo,
  457. .generic_bulk_ctrl_endpoint = 0x01,
  458. /* parameter for the MPEG2-data transfer */
  459. .urb = {
  460. .type = DVB_USB_BULK,
  461. .count = 5,
  462. .endpoint = 0x02,
  463. .u = {
  464. .bulk = {
  465. .buffersize = 8192,
  466. }
  467. }
  468. },
  469. .num_device_descs = 1,
  470. .devices = {
  471. { "Medion MD95700 (MDUSBTV-HYBRID)",
  472. { NULL },
  473. { &cxusb_table[0], NULL },
  474. },
  475. }
  476. };
  477. static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties = {
  478. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  479. .usb_ctrl = DEVICE_SPECIFIC,
  480. .firmware = "dvb-usb-bluebird-01.fw",
  481. .download_firmware = bluebird_patch_dvico_firmware_download,
  482. /* use usb alt setting 0 for EP4 transfer (dvb-t),
  483. use usb alt setting 7 for EP2 transfer (atsc) */
  484. .size_of_priv = sizeof(struct cxusb_state),
  485. .streaming_ctrl = cxusb_streaming_ctrl,
  486. .power_ctrl = cxusb_bluebird_power_ctrl,
  487. .frontend_attach = cxusb_lgdt3303_frontend_attach,
  488. .tuner_attach = cxusb_lgh064f_tuner_attach,
  489. .i2c_algo = &cxusb_i2c_algo,
  490. .rc_interval = 100,
  491. .rc_key_map = dvico_portable_rc_keys,
  492. .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys),
  493. .rc_query = cxusb_rc_query,
  494. .generic_bulk_ctrl_endpoint = 0x01,
  495. /* parameter for the MPEG2-data transfer */
  496. .urb = {
  497. .type = DVB_USB_BULK,
  498. .count = 5,
  499. .endpoint = 0x02,
  500. .u = {
  501. .bulk = {
  502. .buffersize = 8192,
  503. }
  504. }
  505. },
  506. .num_device_descs = 1,
  507. .devices = {
  508. { "DViCO FusionHDTV5 USB Gold",
  509. { &cxusb_table[1], NULL },
  510. { &cxusb_table[2], NULL },
  511. },
  512. }
  513. };
  514. static struct dvb_usb_properties cxusb_bluebird_dee1601_properties = {
  515. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  516. .usb_ctrl = DEVICE_SPECIFIC,
  517. .firmware = "dvb-usb-bluebird-01.fw",
  518. .download_firmware = bluebird_patch_dvico_firmware_download,
  519. /* use usb alt setting 0 for EP4 transfer (dvb-t),
  520. use usb alt setting 7 for EP2 transfer (atsc) */
  521. .size_of_priv = sizeof(struct cxusb_state),
  522. .streaming_ctrl = cxusb_streaming_ctrl,
  523. .power_ctrl = cxusb_bluebird_power_ctrl,
  524. .frontend_attach = cxusb_dee1601_frontend_attach,
  525. .tuner_attach = cxusb_dee1601_tuner_attach,
  526. .i2c_algo = &cxusb_i2c_algo,
  527. .rc_interval = 150,
  528. .rc_key_map = dvico_mce_rc_keys,
  529. .rc_key_map_size = ARRAY_SIZE(dvico_mce_rc_keys),
  530. .rc_query = cxusb_rc_query,
  531. .generic_bulk_ctrl_endpoint = 0x01,
  532. /* parameter for the MPEG2-data transfer */
  533. .urb = {
  534. .type = DVB_USB_BULK,
  535. .count = 5,
  536. .endpoint = 0x04,
  537. .u = {
  538. .bulk = {
  539. .buffersize = 8192,
  540. }
  541. }
  542. },
  543. .num_device_descs = 2,
  544. .devices = {
  545. { "DViCO FusionHDTV DVB-T Dual USB",
  546. { &cxusb_table[3], NULL },
  547. { &cxusb_table[4], NULL },
  548. },
  549. { "DigitalNow DVB-T Dual USB",
  550. { &cxusb_table[9], NULL },
  551. { &cxusb_table[10], NULL },
  552. },
  553. }
  554. };
  555. static struct dvb_usb_properties cxusb_bluebird_lgz201_properties = {
  556. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  557. .usb_ctrl = DEVICE_SPECIFIC,
  558. .firmware = "dvb-usb-bluebird-01.fw",
  559. .download_firmware = bluebird_patch_dvico_firmware_download,
  560. /* use usb alt setting 0 for EP4 transfer (dvb-t),
  561. use usb alt setting 7 for EP2 transfer (atsc) */
  562. .size_of_priv = sizeof(struct cxusb_state),
  563. .streaming_ctrl = cxusb_streaming_ctrl,
  564. .power_ctrl = cxusb_bluebird_power_ctrl,
  565. .frontend_attach = cxusb_mt352_frontend_attach,
  566. .tuner_attach = cxusb_lgz201_tuner_attach,
  567. .i2c_algo = &cxusb_i2c_algo,
  568. .rc_interval = 100,
  569. .rc_key_map = dvico_portable_rc_keys,
  570. .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys),
  571. .rc_query = cxusb_rc_query,
  572. .generic_bulk_ctrl_endpoint = 0x01,
  573. /* parameter for the MPEG2-data transfer */
  574. .urb = {
  575. .type = DVB_USB_BULK,
  576. .count = 5,
  577. .endpoint = 0x04,
  578. .u = {
  579. .bulk = {
  580. .buffersize = 8192,
  581. }
  582. }
  583. },
  584. .num_device_descs = 1,
  585. .devices = {
  586. { "DViCO FusionHDTV DVB-T USB (LGZ201)",
  587. { &cxusb_table[5], NULL },
  588. { &cxusb_table[6], NULL },
  589. },
  590. }
  591. };
  592. static struct dvb_usb_properties cxusb_bluebird_dtt7579_properties = {
  593. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  594. .usb_ctrl = DEVICE_SPECIFIC,
  595. .firmware = "dvb-usb-bluebird-01.fw",
  596. .download_firmware = bluebird_patch_dvico_firmware_download,
  597. /* use usb alt setting 0 for EP4 transfer (dvb-t),
  598. use usb alt setting 7 for EP2 transfer (atsc) */
  599. .size_of_priv = sizeof(struct cxusb_state),
  600. .streaming_ctrl = cxusb_streaming_ctrl,
  601. .power_ctrl = cxusb_bluebird_power_ctrl,
  602. .frontend_attach = cxusb_mt352_frontend_attach,
  603. .tuner_attach = cxusb_dtt7579_tuner_attach,
  604. .i2c_algo = &cxusb_i2c_algo,
  605. .rc_interval = 100,
  606. .rc_key_map = dvico_portable_rc_keys,
  607. .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys),
  608. .rc_query = cxusb_rc_query,
  609. .generic_bulk_ctrl_endpoint = 0x01,
  610. /* parameter for the MPEG2-data transfer */
  611. .urb = {
  612. .type = DVB_USB_BULK,
  613. .count = 5,
  614. .endpoint = 0x04,
  615. .u = {
  616. .bulk = {
  617. .buffersize = 8192,
  618. }
  619. }
  620. },
  621. .num_device_descs = 1,
  622. .devices = {
  623. { "DViCO FusionHDTV DVB-T USB (TH7579)",
  624. { &cxusb_table[7], NULL },
  625. { &cxusb_table[8], NULL },
  626. },
  627. }
  628. };
  629. static struct usb_driver cxusb_driver = {
  630. .name = "dvb_usb_cxusb",
  631. .probe = cxusb_probe,
  632. .disconnect = dvb_usb_device_exit,
  633. .id_table = cxusb_table,
  634. };
  635. /* module stuff */
  636. static int __init cxusb_module_init(void)
  637. {
  638. int result;
  639. if ((result = usb_register(&cxusb_driver))) {
  640. err("usb_register failed. Error number %d",result);
  641. return result;
  642. }
  643. return 0;
  644. }
  645. static void __exit cxusb_module_exit(void)
  646. {
  647. /* deregister this driver from the USB subsystem */
  648. usb_deregister(&cxusb_driver);
  649. }
  650. module_init (cxusb_module_init);
  651. module_exit (cxusb_module_exit);
  652. MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
  653. MODULE_AUTHOR("Michael Krufky <mkrufky@m1k.net>");
  654. MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
  655. MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design");
  656. MODULE_VERSION("1.0-alpha");
  657. MODULE_LICENSE("GPL");