cxusb.c 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189
  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, 2007 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. #include "tuner-xc2028.h"
  33. #include "tuner-xc2028-types.h"
  34. /* debug */
  35. static int dvb_usb_cxusb_debug;
  36. module_param_named(debug, dvb_usb_cxusb_debug, int, 0644);
  37. MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
  38. #define deb_info(args...) dprintk(dvb_usb_cxusb_debug,0x01,args)
  39. #define deb_i2c(args...) if (d->udev->descriptor.idVendor == USB_VID_MEDION) \
  40. dprintk(dvb_usb_cxusb_debug,0x01,args)
  41. static int cxusb_ctrl_msg(struct dvb_usb_device *d,
  42. u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen)
  43. {
  44. int wo = (rbuf == NULL || rlen == 0); /* write-only */
  45. u8 sndbuf[1+wlen];
  46. memset(sndbuf, 0, 1+wlen);
  47. sndbuf[0] = cmd;
  48. memcpy(&sndbuf[1], wbuf, wlen);
  49. if (wo)
  50. return dvb_usb_generic_write(d, sndbuf, 1+wlen);
  51. else
  52. return dvb_usb_generic_rw(d, sndbuf, 1+wlen, rbuf, rlen, 0);
  53. }
  54. /* GPIO */
  55. static void cxusb_gpio_tuner(struct dvb_usb_device *d, int onoff)
  56. {
  57. struct cxusb_state *st = d->priv;
  58. u8 o[2], i;
  59. if (st->gpio_write_state[GPIO_TUNER] == onoff)
  60. return;
  61. o[0] = GPIO_TUNER;
  62. o[1] = onoff;
  63. cxusb_ctrl_msg(d, CMD_GPIO_WRITE, o, 2, &i, 1);
  64. if (i != 0x01)
  65. deb_info("gpio_write failed.\n");
  66. st->gpio_write_state[GPIO_TUNER] = onoff;
  67. }
  68. static int cxusb_bluebird_gpio_rw(struct dvb_usb_device *d, u8 changemask,
  69. u8 newval)
  70. {
  71. u8 o[2], gpio_state;
  72. int rc;
  73. o[0] = 0xff & ~changemask; /* mask of bits to keep */
  74. o[1] = newval & changemask; /* new values for bits */
  75. rc = cxusb_ctrl_msg(d, CMD_BLUEBIRD_GPIO_RW, o, 2, &gpio_state, 1);
  76. if (rc < 0 || (gpio_state & changemask) != (newval & changemask))
  77. deb_info("bluebird_gpio_write failed.\n");
  78. return rc < 0 ? rc : gpio_state;
  79. }
  80. static void cxusb_bluebird_gpio_pulse(struct dvb_usb_device *d, u8 pin, int low)
  81. {
  82. cxusb_bluebird_gpio_rw(d, pin, low ? 0 : pin);
  83. msleep(5);
  84. cxusb_bluebird_gpio_rw(d, pin, low ? pin : 0);
  85. }
  86. static void cxusb_nano2_led(struct dvb_usb_device *d, int onoff)
  87. {
  88. cxusb_bluebird_gpio_rw(d, 0x40, onoff ? 0 : 0x40);
  89. }
  90. /* I2C */
  91. static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
  92. int num)
  93. {
  94. struct dvb_usb_device *d = i2c_get_adapdata(adap);
  95. int i;
  96. if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
  97. return -EAGAIN;
  98. for (i = 0; i < num; i++) {
  99. if (d->udev->descriptor.idVendor == USB_VID_MEDION)
  100. switch (msg[i].addr) {
  101. case 0x63:
  102. cxusb_gpio_tuner(d, 0);
  103. break;
  104. default:
  105. cxusb_gpio_tuner(d, 1);
  106. break;
  107. }
  108. if (msg[i].flags & I2C_M_RD) {
  109. /* read only */
  110. u8 obuf[3], ibuf[1+msg[i].len];
  111. obuf[0] = 0;
  112. obuf[1] = msg[i].len;
  113. obuf[2] = msg[i].addr;
  114. if (cxusb_ctrl_msg(d, CMD_I2C_READ,
  115. obuf, 3,
  116. ibuf, 1+msg[i].len) < 0) {
  117. warn("i2c read failed");
  118. break;
  119. }
  120. memcpy(msg[i].buf, &ibuf[1], msg[i].len);
  121. } else if (i+1 < num && (msg[i+1].flags & I2C_M_RD) &&
  122. msg[i].addr == msg[i+1].addr) {
  123. /* write to then read from same address */
  124. u8 obuf[3+msg[i].len], ibuf[1+msg[i+1].len];
  125. obuf[0] = msg[i].len;
  126. obuf[1] = msg[i+1].len;
  127. obuf[2] = msg[i].addr;
  128. memcpy(&obuf[3], msg[i].buf, msg[i].len);
  129. if (cxusb_ctrl_msg(d, CMD_I2C_READ,
  130. obuf, 3+msg[i].len,
  131. ibuf, 1+msg[i+1].len) < 0)
  132. break;
  133. if (ibuf[0] != 0x08)
  134. deb_i2c("i2c read may have failed\n");
  135. memcpy(msg[i+1].buf, &ibuf[1], msg[i+1].len);
  136. i++;
  137. } else {
  138. /* write only */
  139. u8 obuf[2+msg[i].len], ibuf;
  140. obuf[0] = msg[i].addr;
  141. obuf[1] = msg[i].len;
  142. memcpy(&obuf[2], msg[i].buf, msg[i].len);
  143. if (cxusb_ctrl_msg(d, CMD_I2C_WRITE, obuf,
  144. 2+msg[i].len, &ibuf,1) < 0)
  145. break;
  146. if (ibuf != 0x08)
  147. deb_i2c("i2c write may have failed\n");
  148. }
  149. }
  150. mutex_unlock(&d->i2c_mutex);
  151. return i == num ? num : -EREMOTEIO;
  152. }
  153. static u32 cxusb_i2c_func(struct i2c_adapter *adapter)
  154. {
  155. return I2C_FUNC_I2C;
  156. }
  157. static struct i2c_algorithm cxusb_i2c_algo = {
  158. .master_xfer = cxusb_i2c_xfer,
  159. .functionality = cxusb_i2c_func,
  160. };
  161. static int cxusb_power_ctrl(struct dvb_usb_device *d, int onoff)
  162. {
  163. u8 b = 0;
  164. if (onoff)
  165. return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0);
  166. else
  167. return cxusb_ctrl_msg(d, CMD_POWER_OFF, &b, 1, NULL, 0);
  168. }
  169. static int cxusb_bluebird_power_ctrl(struct dvb_usb_device *d, int onoff)
  170. {
  171. u8 b = 0;
  172. if (onoff)
  173. return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0);
  174. else
  175. return 0;
  176. }
  177. static int cxusb_nano2_power_ctrl(struct dvb_usb_device *d, int onoff)
  178. {
  179. int rc = 0;
  180. rc = cxusb_power_ctrl(d, onoff);
  181. if (!onoff)
  182. cxusb_nano2_led(d, 0);
  183. return rc;
  184. }
  185. static int cxusb_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
  186. {
  187. u8 buf[2] = { 0x03, 0x00 };
  188. if (onoff)
  189. cxusb_ctrl_msg(adap->dev, CMD_STREAMING_ON, buf, 2, NULL, 0);
  190. else
  191. cxusb_ctrl_msg(adap->dev, CMD_STREAMING_OFF, NULL, 0, NULL, 0);
  192. return 0;
  193. }
  194. static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
  195. {
  196. struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
  197. u8 ircode[4];
  198. int i;
  199. cxusb_ctrl_msg(d, CMD_GET_IR_CODE, NULL, 0, ircode, 4);
  200. *event = 0;
  201. *state = REMOTE_NO_KEY_PRESSED;
  202. for (i = 0; i < d->props.rc_key_map_size; i++) {
  203. if (keymap[i].custom == ircode[2] &&
  204. keymap[i].data == ircode[3]) {
  205. *event = keymap[i].event;
  206. *state = REMOTE_KEY_PRESSED;
  207. return 0;
  208. }
  209. }
  210. return 0;
  211. }
  212. static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d, u32 *event,
  213. int *state)
  214. {
  215. struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
  216. u8 ircode[4];
  217. int i;
  218. struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD,
  219. .buf = ircode, .len = 4 };
  220. *event = 0;
  221. *state = REMOTE_NO_KEY_PRESSED;
  222. if (cxusb_i2c_xfer(&d->i2c_adap, &msg, 1) != 1)
  223. return 0;
  224. for (i = 0; i < d->props.rc_key_map_size; i++) {
  225. if (keymap[i].custom == ircode[1] &&
  226. keymap[i].data == ircode[2]) {
  227. *event = keymap[i].event;
  228. *state = REMOTE_KEY_PRESSED;
  229. return 0;
  230. }
  231. }
  232. return 0;
  233. }
  234. static struct dvb_usb_rc_key dvico_mce_rc_keys[] = {
  235. { 0xfe, 0x02, KEY_TV },
  236. { 0xfe, 0x0e, KEY_MP3 },
  237. { 0xfe, 0x1a, KEY_DVD },
  238. { 0xfe, 0x1e, KEY_FAVORITES },
  239. { 0xfe, 0x16, KEY_SETUP },
  240. { 0xfe, 0x46, KEY_POWER2 },
  241. { 0xfe, 0x0a, KEY_EPG },
  242. { 0xfe, 0x49, KEY_BACK },
  243. { 0xfe, 0x4d, KEY_MENU },
  244. { 0xfe, 0x51, KEY_UP },
  245. { 0xfe, 0x5b, KEY_LEFT },
  246. { 0xfe, 0x5f, KEY_RIGHT },
  247. { 0xfe, 0x53, KEY_DOWN },
  248. { 0xfe, 0x5e, KEY_OK },
  249. { 0xfe, 0x59, KEY_INFO },
  250. { 0xfe, 0x55, KEY_TAB },
  251. { 0xfe, 0x0f, KEY_PREVIOUSSONG },/* Replay */
  252. { 0xfe, 0x12, KEY_NEXTSONG }, /* Skip */
  253. { 0xfe, 0x42, KEY_ENTER }, /* Windows/Start */
  254. { 0xfe, 0x15, KEY_VOLUMEUP },
  255. { 0xfe, 0x05, KEY_VOLUMEDOWN },
  256. { 0xfe, 0x11, KEY_CHANNELUP },
  257. { 0xfe, 0x09, KEY_CHANNELDOWN },
  258. { 0xfe, 0x52, KEY_CAMERA },
  259. { 0xfe, 0x5a, KEY_TUNER }, /* Live */
  260. { 0xfe, 0x19, KEY_OPEN },
  261. { 0xfe, 0x0b, KEY_1 },
  262. { 0xfe, 0x17, KEY_2 },
  263. { 0xfe, 0x1b, KEY_3 },
  264. { 0xfe, 0x07, KEY_4 },
  265. { 0xfe, 0x50, KEY_5 },
  266. { 0xfe, 0x54, KEY_6 },
  267. { 0xfe, 0x48, KEY_7 },
  268. { 0xfe, 0x4c, KEY_8 },
  269. { 0xfe, 0x58, KEY_9 },
  270. { 0xfe, 0x13, KEY_ANGLE }, /* Aspect */
  271. { 0xfe, 0x03, KEY_0 },
  272. { 0xfe, 0x1f, KEY_ZOOM },
  273. { 0xfe, 0x43, KEY_REWIND },
  274. { 0xfe, 0x47, KEY_PLAYPAUSE },
  275. { 0xfe, 0x4f, KEY_FASTFORWARD },
  276. { 0xfe, 0x57, KEY_MUTE },
  277. { 0xfe, 0x0d, KEY_STOP },
  278. { 0xfe, 0x01, KEY_RECORD },
  279. { 0xfe, 0x4e, KEY_POWER },
  280. };
  281. static struct dvb_usb_rc_key dvico_portable_rc_keys[] = {
  282. { 0xfc, 0x02, KEY_SETUP }, /* Profile */
  283. { 0xfc, 0x43, KEY_POWER2 },
  284. { 0xfc, 0x06, KEY_EPG },
  285. { 0xfc, 0x5a, KEY_BACK },
  286. { 0xfc, 0x05, KEY_MENU },
  287. { 0xfc, 0x47, KEY_INFO },
  288. { 0xfc, 0x01, KEY_TAB },
  289. { 0xfc, 0x42, KEY_PREVIOUSSONG },/* Replay */
  290. { 0xfc, 0x49, KEY_VOLUMEUP },
  291. { 0xfc, 0x09, KEY_VOLUMEDOWN },
  292. { 0xfc, 0x54, KEY_CHANNELUP },
  293. { 0xfc, 0x0b, KEY_CHANNELDOWN },
  294. { 0xfc, 0x16, KEY_CAMERA },
  295. { 0xfc, 0x40, KEY_TUNER }, /* ATV/DTV */
  296. { 0xfc, 0x45, KEY_OPEN },
  297. { 0xfc, 0x19, KEY_1 },
  298. { 0xfc, 0x18, KEY_2 },
  299. { 0xfc, 0x1b, KEY_3 },
  300. { 0xfc, 0x1a, KEY_4 },
  301. { 0xfc, 0x58, KEY_5 },
  302. { 0xfc, 0x59, KEY_6 },
  303. { 0xfc, 0x15, KEY_7 },
  304. { 0xfc, 0x14, KEY_8 },
  305. { 0xfc, 0x17, KEY_9 },
  306. { 0xfc, 0x44, KEY_ANGLE }, /* Aspect */
  307. { 0xfc, 0x55, KEY_0 },
  308. { 0xfc, 0x07, KEY_ZOOM },
  309. { 0xfc, 0x0a, KEY_REWIND },
  310. { 0xfc, 0x08, KEY_PLAYPAUSE },
  311. { 0xfc, 0x4b, KEY_FASTFORWARD },
  312. { 0xfc, 0x5b, KEY_MUTE },
  313. { 0xfc, 0x04, KEY_STOP },
  314. { 0xfc, 0x56, KEY_RECORD },
  315. { 0xfc, 0x57, KEY_POWER },
  316. { 0xfc, 0x41, KEY_UNKNOWN }, /* INPUT */
  317. { 0xfc, 0x00, KEY_UNKNOWN }, /* HD */
  318. };
  319. static int cxusb_dee1601_demod_init(struct dvb_frontend* fe)
  320. {
  321. static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x28 };
  322. static u8 reset [] = { RESET, 0x80 };
  323. static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
  324. static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 };
  325. static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 };
  326. static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
  327. mt352_write(fe, clock_config, sizeof(clock_config));
  328. udelay(200);
  329. mt352_write(fe, reset, sizeof(reset));
  330. mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
  331. mt352_write(fe, agc_cfg, sizeof(agc_cfg));
  332. mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg));
  333. mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
  334. return 0;
  335. }
  336. static int cxusb_mt352_demod_init(struct dvb_frontend* fe)
  337. { /* used in both lgz201 and th7579 */
  338. static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x29 };
  339. static u8 reset [] = { RESET, 0x80 };
  340. static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
  341. static u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 };
  342. static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 };
  343. static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
  344. mt352_write(fe, clock_config, sizeof(clock_config));
  345. udelay(200);
  346. mt352_write(fe, reset, sizeof(reset));
  347. mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
  348. mt352_write(fe, agc_cfg, sizeof(agc_cfg));
  349. mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg));
  350. mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
  351. return 0;
  352. }
  353. static struct cx22702_config cxusb_cx22702_config = {
  354. .demod_address = 0x63,
  355. .output_mode = CX22702_PARALLEL_OUTPUT,
  356. };
  357. static struct lgdt330x_config cxusb_lgdt3303_config = {
  358. .demod_address = 0x0e,
  359. .demod_chip = LGDT3303,
  360. };
  361. static struct mt352_config cxusb_dee1601_config = {
  362. .demod_address = 0x0f,
  363. .demod_init = cxusb_dee1601_demod_init,
  364. };
  365. static struct zl10353_config cxusb_zl10353_dee1601_config = {
  366. .demod_address = 0x0f,
  367. .parallel_ts = 1,
  368. };
  369. static struct mt352_config cxusb_mt352_config = {
  370. /* used in both lgz201 and th7579 */
  371. .demod_address = 0x0f,
  372. .demod_init = cxusb_mt352_demod_init,
  373. };
  374. static struct zl10353_config cxusb_zl10353_xc3028_config = {
  375. .demod_address = 0x0f,
  376. .if2 = 45600,
  377. .no_tuner = 1,
  378. .parallel_ts = 1,
  379. };
  380. static struct mt352_config cxusb_mt352_xc3028_config = {
  381. .demod_address = 0x0f,
  382. .if2 = 4560,
  383. .no_tuner = 1,
  384. .demod_init = cxusb_mt352_demod_init,
  385. };
  386. /* Callbacks for DVB USB */
  387. static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap)
  388. {
  389. dvb_attach(dvb_pll_attach, adap->fe, 0x61, &adap->dev->i2c_adap,
  390. DVB_PLL_FMD1216ME);
  391. return 0;
  392. }
  393. static int cxusb_dee1601_tuner_attach(struct dvb_usb_adapter *adap)
  394. {
  395. dvb_attach(dvb_pll_attach, adap->fe, 0x61,
  396. NULL, DVB_PLL_THOMSON_DTT7579);
  397. return 0;
  398. }
  399. static int cxusb_lgz201_tuner_attach(struct dvb_usb_adapter *adap)
  400. {
  401. dvb_attach(dvb_pll_attach, adap->fe, 0x61, NULL, DVB_PLL_LG_Z201);
  402. return 0;
  403. }
  404. static int cxusb_dtt7579_tuner_attach(struct dvb_usb_adapter *adap)
  405. {
  406. dvb_attach(dvb_pll_attach, adap->fe, 0x60,
  407. NULL, DVB_PLL_THOMSON_DTT7579);
  408. return 0;
  409. }
  410. static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter *adap)
  411. {
  412. dvb_attach(dvb_pll_attach, adap->fe, 0x61, &adap->dev->i2c_adap,
  413. DVB_PLL_LG_TDVS_H06XF);
  414. return 0;
  415. }
  416. static int dvico_bluebird_xc2028_callback(void *ptr, int command, int arg)
  417. {
  418. struct dvb_usb_device *d = ptr;
  419. switch (command) {
  420. case XC2028_TUNER_RESET:
  421. deb_info("%s: XC2028_TUNER_RESET %d\n", __FUNCTION__, arg);
  422. cxusb_bluebird_gpio_pulse(d, 0x01, 1);
  423. break;
  424. case XC2028_RESET_CLK:
  425. deb_info("%s: XC2028_RESET_CLK %d\n", __FUNCTION__, arg);
  426. break;
  427. default:
  428. deb_info("%s: unknown command %d, arg %d\n", __FUNCTION__,
  429. command, arg);
  430. return -EINVAL;
  431. }
  432. return 0;
  433. }
  434. static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap)
  435. {
  436. struct dvb_frontend *fe;
  437. struct xc2028_config cfg = {
  438. .i2c_adap = &adap->dev->i2c_adap,
  439. .i2c_addr = 0x61,
  440. .callback = dvico_bluebird_xc2028_callback,
  441. };
  442. static struct xc2028_ctrl ctl = {
  443. .fname = "xc3028-dvico-au-01.fw",
  444. .max_len = 64,
  445. .scode_table = ZARLINK456,
  446. };
  447. fe = dvb_attach(xc2028_attach, adap->fe, &cfg);
  448. if (fe == NULL || fe->ops.tuner_ops.set_config == NULL)
  449. return -EIO;
  450. fe->ops.tuner_ops.set_config(fe, &ctl);
  451. return 0;
  452. }
  453. static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter *adap)
  454. {
  455. u8 b;
  456. if (usb_set_interface(adap->dev->udev, 0, 6) < 0)
  457. err("set interface failed");
  458. cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, &b, 1);
  459. if ((adap->fe = dvb_attach(cx22702_attach, &cxusb_cx22702_config,
  460. &adap->dev->i2c_adap)) != NULL)
  461. return 0;
  462. return -EIO;
  463. }
  464. static int cxusb_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap)
  465. {
  466. if (usb_set_interface(adap->dev->udev, 0, 7) < 0)
  467. err("set interface failed");
  468. cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
  469. if ((adap->fe = dvb_attach(lgdt330x_attach, &cxusb_lgdt3303_config,
  470. &adap->dev->i2c_adap)) != NULL)
  471. return 0;
  472. return -EIO;
  473. }
  474. static int cxusb_mt352_frontend_attach(struct dvb_usb_adapter *adap)
  475. {
  476. /* used in both lgz201 and th7579 */
  477. if (usb_set_interface(adap->dev->udev, 0, 0) < 0)
  478. err("set interface failed");
  479. cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
  480. if ((adap->fe = dvb_attach(mt352_attach, &cxusb_mt352_config,
  481. &adap->dev->i2c_adap)) != NULL)
  482. return 0;
  483. return -EIO;
  484. }
  485. static int cxusb_dee1601_frontend_attach(struct dvb_usb_adapter *adap)
  486. {
  487. if (usb_set_interface(adap->dev->udev, 0, 0) < 0)
  488. err("set interface failed");
  489. cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
  490. if (((adap->fe = dvb_attach(mt352_attach, &cxusb_dee1601_config,
  491. &adap->dev->i2c_adap)) != NULL) ||
  492. ((adap->fe = dvb_attach(zl10353_attach,
  493. &cxusb_zl10353_dee1601_config,
  494. &adap->dev->i2c_adap)) != NULL))
  495. return 0;
  496. return -EIO;
  497. }
  498. static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap)
  499. {
  500. u8 ircode[4];
  501. int i;
  502. struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD,
  503. .buf = ircode, .len = 4 };
  504. if (usb_set_interface(adap->dev->udev, 0, 1) < 0)
  505. err("set interface failed");
  506. cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
  507. /* reset the tuner and demodulator */
  508. cxusb_bluebird_gpio_rw(adap->dev, 0x04, 0);
  509. cxusb_bluebird_gpio_pulse(adap->dev, 0x01, 1);
  510. cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1);
  511. if ((adap->fe = dvb_attach(zl10353_attach,
  512. &cxusb_zl10353_xc3028_config,
  513. &adap->dev->i2c_adap)) == NULL)
  514. return -EIO;
  515. /* try to determine if there is no IR decoder on the I2C bus */
  516. for (i = 0; adap->dev->props.rc_key_map != NULL && i < 5; i++) {
  517. msleep(20);
  518. if (cxusb_i2c_xfer(&adap->dev->i2c_adap, &msg, 1) != 1)
  519. goto no_IR;
  520. if (ircode[0] == 0 && ircode[1] == 0)
  521. continue;
  522. if (ircode[2] + ircode[3] != 0xff) {
  523. no_IR:
  524. adap->dev->props.rc_key_map = NULL;
  525. info("No IR receiver detected on this device.");
  526. break;
  527. }
  528. }
  529. return 0;
  530. }
  531. static int cxusb_nano2_frontend_attach(struct dvb_usb_adapter *adap)
  532. {
  533. if (usb_set_interface(adap->dev->udev, 0, 1) < 0)
  534. err("set interface failed");
  535. cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
  536. /* reset the tuner and demodulator */
  537. cxusb_bluebird_gpio_rw(adap->dev, 0x04, 0);
  538. cxusb_bluebird_gpio_pulse(adap->dev, 0x01, 1);
  539. cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1);
  540. if ((adap->fe = dvb_attach(zl10353_attach,
  541. &cxusb_zl10353_xc3028_config,
  542. &adap->dev->i2c_adap)) != NULL)
  543. return 0;
  544. if ((adap->fe = dvb_attach(mt352_attach,
  545. &cxusb_mt352_xc3028_config,
  546. &adap->dev->i2c_adap)) != NULL)
  547. return 0;
  548. return -EIO;
  549. }
  550. /*
  551. * DViCO has shipped two devices with the same USB ID, but only one of them
  552. * needs a firmware download. Check the device class details to see if they
  553. * have non-default values to decide whether the device is actually cold or
  554. * not, and forget a match if it turns out we selected the wrong device.
  555. */
  556. static int bluebird_fx2_identify_state(struct usb_device *udev,
  557. struct dvb_usb_device_properties *props,
  558. struct dvb_usb_device_description **desc,
  559. int *cold)
  560. {
  561. int wascold = *cold;
  562. *cold = udev->descriptor.bDeviceClass == 0xff &&
  563. udev->descriptor.bDeviceSubClass == 0xff &&
  564. udev->descriptor.bDeviceProtocol == 0xff;
  565. if (*cold && !wascold)
  566. *desc = NULL;
  567. return 0;
  568. }
  569. /*
  570. * DViCO bluebird firmware needs the "warm" product ID to be patched into the
  571. * firmware file before download.
  572. */
  573. static const int dvico_firmware_id_offsets[] = { 6638, 3204 };
  574. static int bluebird_patch_dvico_firmware_download(struct usb_device *udev,
  575. const struct firmware *fw)
  576. {
  577. int pos;
  578. for (pos = 0; pos < ARRAY_SIZE(dvico_firmware_id_offsets); pos++) {
  579. int idoff = dvico_firmware_id_offsets[pos];
  580. if (fw->size < idoff + 4)
  581. continue;
  582. if (fw->data[idoff] == (USB_VID_DVICO & 0xff) &&
  583. fw->data[idoff + 1] == USB_VID_DVICO >> 8) {
  584. fw->data[idoff + 2] =
  585. le16_to_cpu(udev->descriptor.idProduct) + 1;
  586. fw->data[idoff + 3] =
  587. le16_to_cpu(udev->descriptor.idProduct) >> 8;
  588. return usb_cypress_load_firmware(udev, fw, CYPRESS_FX2);
  589. }
  590. }
  591. return -EINVAL;
  592. }
  593. /* DVB USB Driver stuff */
  594. static struct dvb_usb_device_properties cxusb_medion_properties;
  595. static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties;
  596. static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties;
  597. static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties;
  598. static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties;
  599. static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties;
  600. static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties;
  601. static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties;
  602. static int cxusb_probe(struct usb_interface *intf,
  603. const struct usb_device_id *id)
  604. {
  605. if (dvb_usb_device_init(intf,&cxusb_medion_properties,THIS_MODULE,NULL) == 0 ||
  606. dvb_usb_device_init(intf,&cxusb_bluebird_lgh064f_properties,THIS_MODULE,NULL) == 0 ||
  607. dvb_usb_device_init(intf,&cxusb_bluebird_dee1601_properties,THIS_MODULE,NULL) == 0 ||
  608. dvb_usb_device_init(intf,&cxusb_bluebird_lgz201_properties,THIS_MODULE,NULL) == 0 ||
  609. dvb_usb_device_init(intf,&cxusb_bluebird_dtt7579_properties,THIS_MODULE,NULL) == 0 ||
  610. dvb_usb_device_init(intf,&cxusb_bluebird_dualdig4_properties,THIS_MODULE,NULL) == 0 ||
  611. dvb_usb_device_init(intf,&cxusb_bluebird_nano2_properties,THIS_MODULE,NULL) == 0 ||
  612. dvb_usb_device_init(intf,&cxusb_bluebird_nano2_needsfirmware_properties,THIS_MODULE,NULL) == 0) {
  613. return 0;
  614. }
  615. return -EINVAL;
  616. }
  617. static struct usb_device_id cxusb_table [] = {
  618. { USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700) },
  619. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_COLD) },
  620. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_WARM) },
  621. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_COLD) },
  622. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_WARM) },
  623. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD) },
  624. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM) },
  625. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_COLD) },
  626. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_WARM) },
  627. { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD) },
  628. { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM) },
  629. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_COLD) },
  630. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_WARM) },
  631. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4) },
  632. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2) },
  633. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM) },
  634. {} /* Terminating entry */
  635. };
  636. MODULE_DEVICE_TABLE (usb, cxusb_table);
  637. static struct dvb_usb_device_properties cxusb_medion_properties = {
  638. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  639. .usb_ctrl = CYPRESS_FX2,
  640. .size_of_priv = sizeof(struct cxusb_state),
  641. .num_adapters = 1,
  642. .adapter = {
  643. {
  644. .streaming_ctrl = cxusb_streaming_ctrl,
  645. .frontend_attach = cxusb_cx22702_frontend_attach,
  646. .tuner_attach = cxusb_fmd1216me_tuner_attach,
  647. /* parameter for the MPEG2-data transfer */
  648. .stream = {
  649. .type = USB_BULK,
  650. .count = 5,
  651. .endpoint = 0x02,
  652. .u = {
  653. .bulk = {
  654. .buffersize = 8192,
  655. }
  656. }
  657. },
  658. },
  659. },
  660. .power_ctrl = cxusb_power_ctrl,
  661. .i2c_algo = &cxusb_i2c_algo,
  662. .generic_bulk_ctrl_endpoint = 0x01,
  663. .num_device_descs = 1,
  664. .devices = {
  665. { "Medion MD95700 (MDUSBTV-HYBRID)",
  666. { NULL },
  667. { &cxusb_table[0], NULL },
  668. },
  669. }
  670. };
  671. static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties = {
  672. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  673. .usb_ctrl = DEVICE_SPECIFIC,
  674. .firmware = "dvb-usb-bluebird-01.fw",
  675. .download_firmware = bluebird_patch_dvico_firmware_download,
  676. /* use usb alt setting 0 for EP4 transfer (dvb-t),
  677. use usb alt setting 7 for EP2 transfer (atsc) */
  678. .size_of_priv = sizeof(struct cxusb_state),
  679. .num_adapters = 1,
  680. .adapter = {
  681. {
  682. .streaming_ctrl = cxusb_streaming_ctrl,
  683. .frontend_attach = cxusb_lgdt3303_frontend_attach,
  684. .tuner_attach = cxusb_lgh064f_tuner_attach,
  685. /* parameter for the MPEG2-data transfer */
  686. .stream = {
  687. .type = USB_BULK,
  688. .count = 5,
  689. .endpoint = 0x02,
  690. .u = {
  691. .bulk = {
  692. .buffersize = 8192,
  693. }
  694. }
  695. },
  696. },
  697. },
  698. .power_ctrl = cxusb_bluebird_power_ctrl,
  699. .i2c_algo = &cxusb_i2c_algo,
  700. .rc_interval = 100,
  701. .rc_key_map = dvico_portable_rc_keys,
  702. .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys),
  703. .rc_query = cxusb_rc_query,
  704. .generic_bulk_ctrl_endpoint = 0x01,
  705. .num_device_descs = 1,
  706. .devices = {
  707. { "DViCO FusionHDTV5 USB Gold",
  708. { &cxusb_table[1], NULL },
  709. { &cxusb_table[2], NULL },
  710. },
  711. }
  712. };
  713. static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties = {
  714. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  715. .usb_ctrl = DEVICE_SPECIFIC,
  716. .firmware = "dvb-usb-bluebird-01.fw",
  717. .download_firmware = bluebird_patch_dvico_firmware_download,
  718. /* use usb alt setting 0 for EP4 transfer (dvb-t),
  719. use usb alt setting 7 for EP2 transfer (atsc) */
  720. .size_of_priv = sizeof(struct cxusb_state),
  721. .num_adapters = 1,
  722. .adapter = {
  723. {
  724. .streaming_ctrl = cxusb_streaming_ctrl,
  725. .frontend_attach = cxusb_dee1601_frontend_attach,
  726. .tuner_attach = cxusb_dee1601_tuner_attach,
  727. /* parameter for the MPEG2-data transfer */
  728. .stream = {
  729. .type = USB_BULK,
  730. .count = 5,
  731. .endpoint = 0x04,
  732. .u = {
  733. .bulk = {
  734. .buffersize = 8192,
  735. }
  736. }
  737. },
  738. },
  739. },
  740. .power_ctrl = cxusb_bluebird_power_ctrl,
  741. .i2c_algo = &cxusb_i2c_algo,
  742. .rc_interval = 150,
  743. .rc_key_map = dvico_mce_rc_keys,
  744. .rc_key_map_size = ARRAY_SIZE(dvico_mce_rc_keys),
  745. .rc_query = cxusb_rc_query,
  746. .generic_bulk_ctrl_endpoint = 0x01,
  747. .num_device_descs = 3,
  748. .devices = {
  749. { "DViCO FusionHDTV DVB-T Dual USB",
  750. { &cxusb_table[3], NULL },
  751. { &cxusb_table[4], NULL },
  752. },
  753. { "DigitalNow DVB-T Dual USB",
  754. { &cxusb_table[9], NULL },
  755. { &cxusb_table[10], NULL },
  756. },
  757. { "DViCO FusionHDTV DVB-T Dual Digital 2",
  758. { &cxusb_table[11], NULL },
  759. { &cxusb_table[12], NULL },
  760. },
  761. }
  762. };
  763. static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = {
  764. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  765. .usb_ctrl = DEVICE_SPECIFIC,
  766. .firmware = "dvb-usb-bluebird-01.fw",
  767. .download_firmware = bluebird_patch_dvico_firmware_download,
  768. /* use usb alt setting 0 for EP4 transfer (dvb-t),
  769. use usb alt setting 7 for EP2 transfer (atsc) */
  770. .size_of_priv = sizeof(struct cxusb_state),
  771. .num_adapters = 2,
  772. .adapter = {
  773. {
  774. .streaming_ctrl = cxusb_streaming_ctrl,
  775. .frontend_attach = cxusb_mt352_frontend_attach,
  776. .tuner_attach = cxusb_lgz201_tuner_attach,
  777. /* parameter for the MPEG2-data transfer */
  778. .stream = {
  779. .type = USB_BULK,
  780. .count = 5,
  781. .endpoint = 0x04,
  782. .u = {
  783. .bulk = {
  784. .buffersize = 8192,
  785. }
  786. }
  787. },
  788. },
  789. },
  790. .power_ctrl = cxusb_bluebird_power_ctrl,
  791. .i2c_algo = &cxusb_i2c_algo,
  792. .rc_interval = 100,
  793. .rc_key_map = dvico_portable_rc_keys,
  794. .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys),
  795. .rc_query = cxusb_rc_query,
  796. .generic_bulk_ctrl_endpoint = 0x01,
  797. .num_device_descs = 1,
  798. .devices = {
  799. { "DViCO FusionHDTV DVB-T USB (LGZ201)",
  800. { &cxusb_table[5], NULL },
  801. { &cxusb_table[6], NULL },
  802. },
  803. }
  804. };
  805. static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = {
  806. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  807. .usb_ctrl = DEVICE_SPECIFIC,
  808. .firmware = "dvb-usb-bluebird-01.fw",
  809. .download_firmware = bluebird_patch_dvico_firmware_download,
  810. /* use usb alt setting 0 for EP4 transfer (dvb-t),
  811. use usb alt setting 7 for EP2 transfer (atsc) */
  812. .size_of_priv = sizeof(struct cxusb_state),
  813. .num_adapters = 1,
  814. .adapter = {
  815. {
  816. .streaming_ctrl = cxusb_streaming_ctrl,
  817. .frontend_attach = cxusb_mt352_frontend_attach,
  818. .tuner_attach = cxusb_dtt7579_tuner_attach,
  819. /* parameter for the MPEG2-data transfer */
  820. .stream = {
  821. .type = USB_BULK,
  822. .count = 5,
  823. .endpoint = 0x04,
  824. .u = {
  825. .bulk = {
  826. .buffersize = 8192,
  827. }
  828. }
  829. },
  830. },
  831. },
  832. .power_ctrl = cxusb_bluebird_power_ctrl,
  833. .i2c_algo = &cxusb_i2c_algo,
  834. .rc_interval = 100,
  835. .rc_key_map = dvico_portable_rc_keys,
  836. .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys),
  837. .rc_query = cxusb_rc_query,
  838. .generic_bulk_ctrl_endpoint = 0x01,
  839. .num_device_descs = 1,
  840. .devices = {
  841. { "DViCO FusionHDTV DVB-T USB (TH7579)",
  842. { &cxusb_table[7], NULL },
  843. { &cxusb_table[8], NULL },
  844. },
  845. }
  846. };
  847. static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties = {
  848. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  849. .usb_ctrl = CYPRESS_FX2,
  850. .size_of_priv = sizeof(struct cxusb_state),
  851. .num_adapters = 1,
  852. .adapter = {
  853. {
  854. .streaming_ctrl = cxusb_streaming_ctrl,
  855. .frontend_attach = cxusb_dualdig4_frontend_attach,
  856. .tuner_attach = cxusb_dvico_xc3028_tuner_attach,
  857. /* parameter for the MPEG2-data transfer */
  858. .stream = {
  859. .type = USB_BULK,
  860. .count = 5,
  861. .endpoint = 0x02,
  862. .u = {
  863. .bulk = {
  864. .buffersize = 8192,
  865. }
  866. }
  867. },
  868. },
  869. },
  870. .power_ctrl = cxusb_power_ctrl,
  871. .i2c_algo = &cxusb_i2c_algo,
  872. .generic_bulk_ctrl_endpoint = 0x01,
  873. .rc_interval = 100,
  874. .rc_key_map = dvico_mce_rc_keys,
  875. .rc_key_map_size = ARRAY_SIZE(dvico_mce_rc_keys),
  876. .rc_query = cxusb_bluebird2_rc_query,
  877. .num_device_descs = 1,
  878. .devices = {
  879. { "DViCO FusionHDTV DVB-T Dual Digital 4",
  880. { NULL },
  881. { &cxusb_table[13], NULL },
  882. },
  883. }
  884. };
  885. static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties = {
  886. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  887. .usb_ctrl = CYPRESS_FX2,
  888. .identify_state = bluebird_fx2_identify_state,
  889. .size_of_priv = sizeof(struct cxusb_state),
  890. .num_adapters = 1,
  891. .adapter = {
  892. {
  893. .streaming_ctrl = cxusb_streaming_ctrl,
  894. .frontend_attach = cxusb_nano2_frontend_attach,
  895. .tuner_attach = cxusb_dvico_xc3028_tuner_attach,
  896. /* parameter for the MPEG2-data transfer */
  897. .stream = {
  898. .type = USB_BULK,
  899. .count = 5,
  900. .endpoint = 0x02,
  901. .u = {
  902. .bulk = {
  903. .buffersize = 8192,
  904. }
  905. }
  906. },
  907. },
  908. },
  909. .power_ctrl = cxusb_nano2_power_ctrl,
  910. .i2c_algo = &cxusb_i2c_algo,
  911. .generic_bulk_ctrl_endpoint = 0x01,
  912. .rc_interval = 100,
  913. .rc_key_map = dvico_portable_rc_keys,
  914. .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys),
  915. .rc_query = cxusb_bluebird2_rc_query,
  916. .num_device_descs = 1,
  917. .devices = {
  918. { "DViCO FusionHDTV DVB-T NANO2",
  919. { NULL },
  920. { &cxusb_table[14], NULL },
  921. },
  922. }
  923. };
  924. static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties = {
  925. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  926. .usb_ctrl = DEVICE_SPECIFIC,
  927. .firmware = "dvb-usb-bluebird-02.fw",
  928. .download_firmware = bluebird_patch_dvico_firmware_download,
  929. .identify_state = bluebird_fx2_identify_state,
  930. .size_of_priv = sizeof(struct cxusb_state),
  931. .num_adapters = 1,
  932. .adapter = {
  933. {
  934. .streaming_ctrl = cxusb_streaming_ctrl,
  935. .frontend_attach = cxusb_nano2_frontend_attach,
  936. .tuner_attach = cxusb_dvico_xc3028_tuner_attach,
  937. /* parameter for the MPEG2-data transfer */
  938. .stream = {
  939. .type = USB_BULK,
  940. .count = 5,
  941. .endpoint = 0x02,
  942. .u = {
  943. .bulk = {
  944. .buffersize = 8192,
  945. }
  946. }
  947. },
  948. },
  949. },
  950. .power_ctrl = cxusb_nano2_power_ctrl,
  951. .i2c_algo = &cxusb_i2c_algo,
  952. .generic_bulk_ctrl_endpoint = 0x01,
  953. .rc_interval = 100,
  954. .rc_key_map = dvico_portable_rc_keys,
  955. .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys),
  956. .rc_query = cxusb_rc_query,
  957. .num_device_descs = 1,
  958. .devices = {
  959. { "DViCO FusionHDTV DVB-T NANO2 w/o firmware",
  960. { &cxusb_table[14], NULL },
  961. { &cxusb_table[15], NULL },
  962. },
  963. }
  964. };
  965. static struct usb_driver cxusb_driver = {
  966. .name = "dvb_usb_cxusb",
  967. .probe = cxusb_probe,
  968. .disconnect = dvb_usb_device_exit,
  969. .id_table = cxusb_table,
  970. };
  971. /* module stuff */
  972. static int __init cxusb_module_init(void)
  973. {
  974. int result;
  975. if ((result = usb_register(&cxusb_driver))) {
  976. err("usb_register failed. Error number %d",result);
  977. return result;
  978. }
  979. return 0;
  980. }
  981. static void __exit cxusb_module_exit(void)
  982. {
  983. /* deregister this driver from the USB subsystem */
  984. usb_deregister(&cxusb_driver);
  985. }
  986. module_init (cxusb_module_init);
  987. module_exit (cxusb_module_exit);
  988. MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
  989. MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>");
  990. MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
  991. MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design");
  992. MODULE_VERSION("1.0-alpha");
  993. MODULE_LICENSE("GPL");