cxusb.c 32 KB

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