cxusb.c 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191
  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. .video_dev = adap->dev,
  441. .callback = dvico_bluebird_xc2028_callback,
  442. };
  443. static struct xc2028_ctrl ctl = {
  444. .type = XC2028_FIRM_NORMAL,
  445. .fname = "xc3028-dvico-au-01.fw",
  446. .max_len = 64,
  447. .scode_table = ZARLINK456,
  448. };
  449. fe = dvb_attach(xc2028_attach, adap->fe, &cfg);
  450. if (fe == NULL || fe->ops.tuner_ops.set_config == NULL)
  451. return -EIO;
  452. fe->ops.tuner_ops.set_config(fe, &ctl);
  453. return 0;
  454. }
  455. static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter *adap)
  456. {
  457. u8 b;
  458. if (usb_set_interface(adap->dev->udev, 0, 6) < 0)
  459. err("set interface failed");
  460. cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, &b, 1);
  461. if ((adap->fe = dvb_attach(cx22702_attach, &cxusb_cx22702_config,
  462. &adap->dev->i2c_adap)) != NULL)
  463. return 0;
  464. return -EIO;
  465. }
  466. static int cxusb_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap)
  467. {
  468. if (usb_set_interface(adap->dev->udev, 0, 7) < 0)
  469. err("set interface failed");
  470. cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
  471. if ((adap->fe = dvb_attach(lgdt330x_attach, &cxusb_lgdt3303_config,
  472. &adap->dev->i2c_adap)) != NULL)
  473. return 0;
  474. return -EIO;
  475. }
  476. static int cxusb_mt352_frontend_attach(struct dvb_usb_adapter *adap)
  477. {
  478. /* used in both lgz201 and th7579 */
  479. if (usb_set_interface(adap->dev->udev, 0, 0) < 0)
  480. err("set interface failed");
  481. cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
  482. if ((adap->fe = dvb_attach(mt352_attach, &cxusb_mt352_config,
  483. &adap->dev->i2c_adap)) != NULL)
  484. return 0;
  485. return -EIO;
  486. }
  487. static int cxusb_dee1601_frontend_attach(struct dvb_usb_adapter *adap)
  488. {
  489. if (usb_set_interface(adap->dev->udev, 0, 0) < 0)
  490. err("set interface failed");
  491. cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
  492. if (((adap->fe = dvb_attach(mt352_attach, &cxusb_dee1601_config,
  493. &adap->dev->i2c_adap)) != NULL) ||
  494. ((adap->fe = dvb_attach(zl10353_attach,
  495. &cxusb_zl10353_dee1601_config,
  496. &adap->dev->i2c_adap)) != NULL))
  497. return 0;
  498. return -EIO;
  499. }
  500. static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap)
  501. {
  502. u8 ircode[4];
  503. int i;
  504. struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD,
  505. .buf = ircode, .len = 4 };
  506. if (usb_set_interface(adap->dev->udev, 0, 1) < 0)
  507. err("set interface failed");
  508. cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
  509. /* reset the tuner and demodulator */
  510. cxusb_bluebird_gpio_rw(adap->dev, 0x04, 0);
  511. cxusb_bluebird_gpio_pulse(adap->dev, 0x01, 1);
  512. cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1);
  513. if ((adap->fe = dvb_attach(zl10353_attach,
  514. &cxusb_zl10353_xc3028_config,
  515. &adap->dev->i2c_adap)) == NULL)
  516. return -EIO;
  517. /* try to determine if there is no IR decoder on the I2C bus */
  518. for (i = 0; adap->dev->props.rc_key_map != NULL && i < 5; i++) {
  519. msleep(20);
  520. if (cxusb_i2c_xfer(&adap->dev->i2c_adap, &msg, 1) != 1)
  521. goto no_IR;
  522. if (ircode[0] == 0 && ircode[1] == 0)
  523. continue;
  524. if (ircode[2] + ircode[3] != 0xff) {
  525. no_IR:
  526. adap->dev->props.rc_key_map = NULL;
  527. info("No IR receiver detected on this device.");
  528. break;
  529. }
  530. }
  531. return 0;
  532. }
  533. static int cxusb_nano2_frontend_attach(struct dvb_usb_adapter *adap)
  534. {
  535. if (usb_set_interface(adap->dev->udev, 0, 1) < 0)
  536. err("set interface failed");
  537. cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
  538. /* reset the tuner and demodulator */
  539. cxusb_bluebird_gpio_rw(adap->dev, 0x04, 0);
  540. cxusb_bluebird_gpio_pulse(adap->dev, 0x01, 1);
  541. cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1);
  542. if ((adap->fe = dvb_attach(zl10353_attach,
  543. &cxusb_zl10353_xc3028_config,
  544. &adap->dev->i2c_adap)) != NULL)
  545. return 0;
  546. if ((adap->fe = dvb_attach(mt352_attach,
  547. &cxusb_mt352_xc3028_config,
  548. &adap->dev->i2c_adap)) != NULL)
  549. return 0;
  550. return -EIO;
  551. }
  552. /*
  553. * DViCO has shipped two devices with the same USB ID, but only one of them
  554. * needs a firmware download. Check the device class details to see if they
  555. * have non-default values to decide whether the device is actually cold or
  556. * not, and forget a match if it turns out we selected the wrong device.
  557. */
  558. static int bluebird_fx2_identify_state(struct usb_device *udev,
  559. struct dvb_usb_device_properties *props,
  560. struct dvb_usb_device_description **desc,
  561. int *cold)
  562. {
  563. int wascold = *cold;
  564. *cold = udev->descriptor.bDeviceClass == 0xff &&
  565. udev->descriptor.bDeviceSubClass == 0xff &&
  566. udev->descriptor.bDeviceProtocol == 0xff;
  567. if (*cold && !wascold)
  568. *desc = NULL;
  569. return 0;
  570. }
  571. /*
  572. * DViCO bluebird firmware needs the "warm" product ID to be patched into the
  573. * firmware file before download.
  574. */
  575. static const int dvico_firmware_id_offsets[] = { 6638, 3204 };
  576. static int bluebird_patch_dvico_firmware_download(struct usb_device *udev,
  577. const struct firmware *fw)
  578. {
  579. int pos;
  580. for (pos = 0; pos < ARRAY_SIZE(dvico_firmware_id_offsets); pos++) {
  581. int idoff = dvico_firmware_id_offsets[pos];
  582. if (fw->size < idoff + 4)
  583. continue;
  584. if (fw->data[idoff] == (USB_VID_DVICO & 0xff) &&
  585. fw->data[idoff + 1] == USB_VID_DVICO >> 8) {
  586. fw->data[idoff + 2] =
  587. le16_to_cpu(udev->descriptor.idProduct) + 1;
  588. fw->data[idoff + 3] =
  589. le16_to_cpu(udev->descriptor.idProduct) >> 8;
  590. return usb_cypress_load_firmware(udev, fw, CYPRESS_FX2);
  591. }
  592. }
  593. return -EINVAL;
  594. }
  595. /* DVB USB Driver stuff */
  596. static struct dvb_usb_device_properties cxusb_medion_properties;
  597. static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties;
  598. static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties;
  599. static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties;
  600. static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties;
  601. static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties;
  602. static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties;
  603. static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties;
  604. static int cxusb_probe(struct usb_interface *intf,
  605. const struct usb_device_id *id)
  606. {
  607. if (dvb_usb_device_init(intf,&cxusb_medion_properties,THIS_MODULE,NULL) == 0 ||
  608. dvb_usb_device_init(intf,&cxusb_bluebird_lgh064f_properties,THIS_MODULE,NULL) == 0 ||
  609. dvb_usb_device_init(intf,&cxusb_bluebird_dee1601_properties,THIS_MODULE,NULL) == 0 ||
  610. dvb_usb_device_init(intf,&cxusb_bluebird_lgz201_properties,THIS_MODULE,NULL) == 0 ||
  611. dvb_usb_device_init(intf,&cxusb_bluebird_dtt7579_properties,THIS_MODULE,NULL) == 0 ||
  612. dvb_usb_device_init(intf,&cxusb_bluebird_dualdig4_properties,THIS_MODULE,NULL) == 0 ||
  613. dvb_usb_device_init(intf,&cxusb_bluebird_nano2_properties,THIS_MODULE,NULL) == 0 ||
  614. dvb_usb_device_init(intf,&cxusb_bluebird_nano2_needsfirmware_properties,THIS_MODULE,NULL) == 0) {
  615. return 0;
  616. }
  617. return -EINVAL;
  618. }
  619. static struct usb_device_id cxusb_table [] = {
  620. { USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700) },
  621. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_COLD) },
  622. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_WARM) },
  623. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_COLD) },
  624. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_WARM) },
  625. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD) },
  626. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM) },
  627. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_COLD) },
  628. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_WARM) },
  629. { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD) },
  630. { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM) },
  631. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_COLD) },
  632. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_WARM) },
  633. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4) },
  634. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2) },
  635. { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM) },
  636. {} /* Terminating entry */
  637. };
  638. MODULE_DEVICE_TABLE (usb, cxusb_table);
  639. static struct dvb_usb_device_properties cxusb_medion_properties = {
  640. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  641. .usb_ctrl = CYPRESS_FX2,
  642. .size_of_priv = sizeof(struct cxusb_state),
  643. .num_adapters = 1,
  644. .adapter = {
  645. {
  646. .streaming_ctrl = cxusb_streaming_ctrl,
  647. .frontend_attach = cxusb_cx22702_frontend_attach,
  648. .tuner_attach = cxusb_fmd1216me_tuner_attach,
  649. /* parameter for the MPEG2-data transfer */
  650. .stream = {
  651. .type = USB_BULK,
  652. .count = 5,
  653. .endpoint = 0x02,
  654. .u = {
  655. .bulk = {
  656. .buffersize = 8192,
  657. }
  658. }
  659. },
  660. },
  661. },
  662. .power_ctrl = cxusb_power_ctrl,
  663. .i2c_algo = &cxusb_i2c_algo,
  664. .generic_bulk_ctrl_endpoint = 0x01,
  665. .num_device_descs = 1,
  666. .devices = {
  667. { "Medion MD95700 (MDUSBTV-HYBRID)",
  668. { NULL },
  669. { &cxusb_table[0], NULL },
  670. },
  671. }
  672. };
  673. static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties = {
  674. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  675. .usb_ctrl = DEVICE_SPECIFIC,
  676. .firmware = "dvb-usb-bluebird-01.fw",
  677. .download_firmware = bluebird_patch_dvico_firmware_download,
  678. /* use usb alt setting 0 for EP4 transfer (dvb-t),
  679. use usb alt setting 7 for EP2 transfer (atsc) */
  680. .size_of_priv = sizeof(struct cxusb_state),
  681. .num_adapters = 1,
  682. .adapter = {
  683. {
  684. .streaming_ctrl = cxusb_streaming_ctrl,
  685. .frontend_attach = cxusb_lgdt3303_frontend_attach,
  686. .tuner_attach = cxusb_lgh064f_tuner_attach,
  687. /* parameter for the MPEG2-data transfer */
  688. .stream = {
  689. .type = USB_BULK,
  690. .count = 5,
  691. .endpoint = 0x02,
  692. .u = {
  693. .bulk = {
  694. .buffersize = 8192,
  695. }
  696. }
  697. },
  698. },
  699. },
  700. .power_ctrl = cxusb_bluebird_power_ctrl,
  701. .i2c_algo = &cxusb_i2c_algo,
  702. .rc_interval = 100,
  703. .rc_key_map = dvico_portable_rc_keys,
  704. .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys),
  705. .rc_query = cxusb_rc_query,
  706. .generic_bulk_ctrl_endpoint = 0x01,
  707. .num_device_descs = 1,
  708. .devices = {
  709. { "DViCO FusionHDTV5 USB Gold",
  710. { &cxusb_table[1], NULL },
  711. { &cxusb_table[2], NULL },
  712. },
  713. }
  714. };
  715. static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties = {
  716. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  717. .usb_ctrl = DEVICE_SPECIFIC,
  718. .firmware = "dvb-usb-bluebird-01.fw",
  719. .download_firmware = bluebird_patch_dvico_firmware_download,
  720. /* use usb alt setting 0 for EP4 transfer (dvb-t),
  721. use usb alt setting 7 for EP2 transfer (atsc) */
  722. .size_of_priv = sizeof(struct cxusb_state),
  723. .num_adapters = 1,
  724. .adapter = {
  725. {
  726. .streaming_ctrl = cxusb_streaming_ctrl,
  727. .frontend_attach = cxusb_dee1601_frontend_attach,
  728. .tuner_attach = cxusb_dee1601_tuner_attach,
  729. /* parameter for the MPEG2-data transfer */
  730. .stream = {
  731. .type = USB_BULK,
  732. .count = 5,
  733. .endpoint = 0x04,
  734. .u = {
  735. .bulk = {
  736. .buffersize = 8192,
  737. }
  738. }
  739. },
  740. },
  741. },
  742. .power_ctrl = cxusb_bluebird_power_ctrl,
  743. .i2c_algo = &cxusb_i2c_algo,
  744. .rc_interval = 150,
  745. .rc_key_map = dvico_mce_rc_keys,
  746. .rc_key_map_size = ARRAY_SIZE(dvico_mce_rc_keys),
  747. .rc_query = cxusb_rc_query,
  748. .generic_bulk_ctrl_endpoint = 0x01,
  749. .num_device_descs = 3,
  750. .devices = {
  751. { "DViCO FusionHDTV DVB-T Dual USB",
  752. { &cxusb_table[3], NULL },
  753. { &cxusb_table[4], NULL },
  754. },
  755. { "DigitalNow DVB-T Dual USB",
  756. { &cxusb_table[9], NULL },
  757. { &cxusb_table[10], NULL },
  758. },
  759. { "DViCO FusionHDTV DVB-T Dual Digital 2",
  760. { &cxusb_table[11], NULL },
  761. { &cxusb_table[12], NULL },
  762. },
  763. }
  764. };
  765. static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = {
  766. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  767. .usb_ctrl = DEVICE_SPECIFIC,
  768. .firmware = "dvb-usb-bluebird-01.fw",
  769. .download_firmware = bluebird_patch_dvico_firmware_download,
  770. /* use usb alt setting 0 for EP4 transfer (dvb-t),
  771. use usb alt setting 7 for EP2 transfer (atsc) */
  772. .size_of_priv = sizeof(struct cxusb_state),
  773. .num_adapters = 2,
  774. .adapter = {
  775. {
  776. .streaming_ctrl = cxusb_streaming_ctrl,
  777. .frontend_attach = cxusb_mt352_frontend_attach,
  778. .tuner_attach = cxusb_lgz201_tuner_attach,
  779. /* parameter for the MPEG2-data transfer */
  780. .stream = {
  781. .type = USB_BULK,
  782. .count = 5,
  783. .endpoint = 0x04,
  784. .u = {
  785. .bulk = {
  786. .buffersize = 8192,
  787. }
  788. }
  789. },
  790. },
  791. },
  792. .power_ctrl = cxusb_bluebird_power_ctrl,
  793. .i2c_algo = &cxusb_i2c_algo,
  794. .rc_interval = 100,
  795. .rc_key_map = dvico_portable_rc_keys,
  796. .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys),
  797. .rc_query = cxusb_rc_query,
  798. .generic_bulk_ctrl_endpoint = 0x01,
  799. .num_device_descs = 1,
  800. .devices = {
  801. { "DViCO FusionHDTV DVB-T USB (LGZ201)",
  802. { &cxusb_table[5], NULL },
  803. { &cxusb_table[6], NULL },
  804. },
  805. }
  806. };
  807. static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = {
  808. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  809. .usb_ctrl = DEVICE_SPECIFIC,
  810. .firmware = "dvb-usb-bluebird-01.fw",
  811. .download_firmware = bluebird_patch_dvico_firmware_download,
  812. /* use usb alt setting 0 for EP4 transfer (dvb-t),
  813. use usb alt setting 7 for EP2 transfer (atsc) */
  814. .size_of_priv = sizeof(struct cxusb_state),
  815. .num_adapters = 1,
  816. .adapter = {
  817. {
  818. .streaming_ctrl = cxusb_streaming_ctrl,
  819. .frontend_attach = cxusb_mt352_frontend_attach,
  820. .tuner_attach = cxusb_dtt7579_tuner_attach,
  821. /* parameter for the MPEG2-data transfer */
  822. .stream = {
  823. .type = USB_BULK,
  824. .count = 5,
  825. .endpoint = 0x04,
  826. .u = {
  827. .bulk = {
  828. .buffersize = 8192,
  829. }
  830. }
  831. },
  832. },
  833. },
  834. .power_ctrl = cxusb_bluebird_power_ctrl,
  835. .i2c_algo = &cxusb_i2c_algo,
  836. .rc_interval = 100,
  837. .rc_key_map = dvico_portable_rc_keys,
  838. .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys),
  839. .rc_query = cxusb_rc_query,
  840. .generic_bulk_ctrl_endpoint = 0x01,
  841. .num_device_descs = 1,
  842. .devices = {
  843. { "DViCO FusionHDTV DVB-T USB (TH7579)",
  844. { &cxusb_table[7], NULL },
  845. { &cxusb_table[8], NULL },
  846. },
  847. }
  848. };
  849. static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties = {
  850. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  851. .usb_ctrl = CYPRESS_FX2,
  852. .size_of_priv = sizeof(struct cxusb_state),
  853. .num_adapters = 1,
  854. .adapter = {
  855. {
  856. .streaming_ctrl = cxusb_streaming_ctrl,
  857. .frontend_attach = cxusb_dualdig4_frontend_attach,
  858. .tuner_attach = cxusb_dvico_xc3028_tuner_attach,
  859. /* parameter for the MPEG2-data transfer */
  860. .stream = {
  861. .type = USB_BULK,
  862. .count = 5,
  863. .endpoint = 0x02,
  864. .u = {
  865. .bulk = {
  866. .buffersize = 8192,
  867. }
  868. }
  869. },
  870. },
  871. },
  872. .power_ctrl = cxusb_power_ctrl,
  873. .i2c_algo = &cxusb_i2c_algo,
  874. .generic_bulk_ctrl_endpoint = 0x01,
  875. .rc_interval = 100,
  876. .rc_key_map = dvico_mce_rc_keys,
  877. .rc_key_map_size = ARRAY_SIZE(dvico_mce_rc_keys),
  878. .rc_query = cxusb_bluebird2_rc_query,
  879. .num_device_descs = 1,
  880. .devices = {
  881. { "DViCO FusionHDTV DVB-T Dual Digital 4",
  882. { NULL },
  883. { &cxusb_table[13], NULL },
  884. },
  885. }
  886. };
  887. static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties = {
  888. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  889. .usb_ctrl = CYPRESS_FX2,
  890. .identify_state = bluebird_fx2_identify_state,
  891. .size_of_priv = sizeof(struct cxusb_state),
  892. .num_adapters = 1,
  893. .adapter = {
  894. {
  895. .streaming_ctrl = cxusb_streaming_ctrl,
  896. .frontend_attach = cxusb_nano2_frontend_attach,
  897. .tuner_attach = cxusb_dvico_xc3028_tuner_attach,
  898. /* parameter for the MPEG2-data transfer */
  899. .stream = {
  900. .type = USB_BULK,
  901. .count = 5,
  902. .endpoint = 0x02,
  903. .u = {
  904. .bulk = {
  905. .buffersize = 8192,
  906. }
  907. }
  908. },
  909. },
  910. },
  911. .power_ctrl = cxusb_nano2_power_ctrl,
  912. .i2c_algo = &cxusb_i2c_algo,
  913. .generic_bulk_ctrl_endpoint = 0x01,
  914. .rc_interval = 100,
  915. .rc_key_map = dvico_portable_rc_keys,
  916. .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys),
  917. .rc_query = cxusb_bluebird2_rc_query,
  918. .num_device_descs = 1,
  919. .devices = {
  920. { "DViCO FusionHDTV DVB-T NANO2",
  921. { NULL },
  922. { &cxusb_table[14], NULL },
  923. },
  924. }
  925. };
  926. static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties = {
  927. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  928. .usb_ctrl = DEVICE_SPECIFIC,
  929. .firmware = "dvb-usb-bluebird-02.fw",
  930. .download_firmware = bluebird_patch_dvico_firmware_download,
  931. .identify_state = bluebird_fx2_identify_state,
  932. .size_of_priv = sizeof(struct cxusb_state),
  933. .num_adapters = 1,
  934. .adapter = {
  935. {
  936. .streaming_ctrl = cxusb_streaming_ctrl,
  937. .frontend_attach = cxusb_nano2_frontend_attach,
  938. .tuner_attach = cxusb_dvico_xc3028_tuner_attach,
  939. /* parameter for the MPEG2-data transfer */
  940. .stream = {
  941. .type = USB_BULK,
  942. .count = 5,
  943. .endpoint = 0x02,
  944. .u = {
  945. .bulk = {
  946. .buffersize = 8192,
  947. }
  948. }
  949. },
  950. },
  951. },
  952. .power_ctrl = cxusb_nano2_power_ctrl,
  953. .i2c_algo = &cxusb_i2c_algo,
  954. .generic_bulk_ctrl_endpoint = 0x01,
  955. .rc_interval = 100,
  956. .rc_key_map = dvico_portable_rc_keys,
  957. .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys),
  958. .rc_query = cxusb_rc_query,
  959. .num_device_descs = 1,
  960. .devices = {
  961. { "DViCO FusionHDTV DVB-T NANO2 w/o firmware",
  962. { &cxusb_table[14], NULL },
  963. { &cxusb_table[15], NULL },
  964. },
  965. }
  966. };
  967. static struct usb_driver cxusb_driver = {
  968. .name = "dvb_usb_cxusb",
  969. .probe = cxusb_probe,
  970. .disconnect = dvb_usb_device_exit,
  971. .id_table = cxusb_table,
  972. };
  973. /* module stuff */
  974. static int __init cxusb_module_init(void)
  975. {
  976. int result;
  977. if ((result = usb_register(&cxusb_driver))) {
  978. err("usb_register failed. Error number %d",result);
  979. return result;
  980. }
  981. return 0;
  982. }
  983. static void __exit cxusb_module_exit(void)
  984. {
  985. /* deregister this driver from the USB subsystem */
  986. usb_deregister(&cxusb_driver);
  987. }
  988. module_init (cxusb_module_init);
  989. module_exit (cxusb_module_exit);
  990. MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
  991. MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>");
  992. MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
  993. MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design");
  994. MODULE_VERSION("1.0-alpha");
  995. MODULE_LICENSE("GPL");