cxusb.c 21 KB

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