cxusb.c 31 KB

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