cxusb.c 21 KB

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