cxusb.c 31 KB

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