cxusb.c 58 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322
  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 <linux/slab.h>
  29. #include "cxusb.h"
  30. #include "cx22702.h"
  31. #include "lgdt330x.h"
  32. #include "mt352.h"
  33. #include "mt352_priv.h"
  34. #include "zl10353.h"
  35. #include "tuner-xc2028.h"
  36. #include "tuner-simple.h"
  37. #include "mxl5005s.h"
  38. #include "max2165.h"
  39. #include "dib7000p.h"
  40. #include "dib0070.h"
  41. #include "lgs8gxx.h"
  42. #include "atbm8830.h"
  43. #include "si2168.h"
  44. #include "si2157.h"
  45. /* Max transfer size done by I2C transfer functions */
  46. #define MAX_XFER_SIZE 80
  47. /* debug */
  48. static int dvb_usb_cxusb_debug;
  49. module_param_named(debug, dvb_usb_cxusb_debug, int, 0644);
  50. MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
  51. DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
  52. #define deb_info(args...) dprintk(dvb_usb_cxusb_debug, 0x03, args)
  53. #define deb_i2c(args...) dprintk(dvb_usb_cxusb_debug, 0x02, args)
  54. static int cxusb_ctrl_msg(struct dvb_usb_device *d,
  55. u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen)
  56. {
  57. int wo = (rbuf == NULL || rlen == 0); /* write-only */
  58. u8 sndbuf[MAX_XFER_SIZE];
  59. if (1 + wlen > sizeof(sndbuf)) {
  60. warn("i2c wr: len=%d is too big!\n",
  61. wlen);
  62. return -EOPNOTSUPP;
  63. }
  64. memset(sndbuf, 0, 1+wlen);
  65. sndbuf[0] = cmd;
  66. memcpy(&sndbuf[1], wbuf, wlen);
  67. if (wo)
  68. return dvb_usb_generic_write(d, sndbuf, 1+wlen);
  69. else
  70. return dvb_usb_generic_rw(d, sndbuf, 1+wlen, rbuf, rlen, 0);
  71. }
  72. /* GPIO */
  73. static void cxusb_gpio_tuner(struct dvb_usb_device *d, int onoff)
  74. {
  75. struct cxusb_state *st = d->priv;
  76. u8 o[2], i;
  77. if (st->gpio_write_state[GPIO_TUNER] == onoff)
  78. return;
  79. o[0] = GPIO_TUNER;
  80. o[1] = onoff;
  81. cxusb_ctrl_msg(d, CMD_GPIO_WRITE, o, 2, &i, 1);
  82. if (i != 0x01)
  83. deb_info("gpio_write failed.\n");
  84. st->gpio_write_state[GPIO_TUNER] = onoff;
  85. }
  86. static int cxusb_bluebird_gpio_rw(struct dvb_usb_device *d, u8 changemask,
  87. u8 newval)
  88. {
  89. u8 o[2], gpio_state;
  90. int rc;
  91. o[0] = 0xff & ~changemask; /* mask of bits to keep */
  92. o[1] = newval & changemask; /* new values for bits */
  93. rc = cxusb_ctrl_msg(d, CMD_BLUEBIRD_GPIO_RW, o, 2, &gpio_state, 1);
  94. if (rc < 0 || (gpio_state & changemask) != (newval & changemask))
  95. deb_info("bluebird_gpio_write failed.\n");
  96. return rc < 0 ? rc : gpio_state;
  97. }
  98. static void cxusb_bluebird_gpio_pulse(struct dvb_usb_device *d, u8 pin, int low)
  99. {
  100. cxusb_bluebird_gpio_rw(d, pin, low ? 0 : pin);
  101. msleep(5);
  102. cxusb_bluebird_gpio_rw(d, pin, low ? pin : 0);
  103. }
  104. static void cxusb_nano2_led(struct dvb_usb_device *d, int onoff)
  105. {
  106. cxusb_bluebird_gpio_rw(d, 0x40, onoff ? 0 : 0x40);
  107. }
  108. static int cxusb_d680_dmb_gpio_tuner(struct dvb_usb_device *d,
  109. u8 addr, int onoff)
  110. {
  111. u8 o[2] = {addr, onoff};
  112. u8 i;
  113. int rc;
  114. rc = cxusb_ctrl_msg(d, CMD_GPIO_WRITE, o, 2, &i, 1);
  115. if (rc < 0)
  116. return rc;
  117. if (i == 0x01)
  118. return 0;
  119. else {
  120. deb_info("gpio_write failed.\n");
  121. return -EIO;
  122. }
  123. }
  124. /* I2C */
  125. static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
  126. int num)
  127. {
  128. struct dvb_usb_device *d = i2c_get_adapdata(adap);
  129. int ret;
  130. int i;
  131. if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
  132. return -EAGAIN;
  133. for (i = 0; i < num; i++) {
  134. if (le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_MEDION)
  135. switch (msg[i].addr) {
  136. case 0x63:
  137. cxusb_gpio_tuner(d, 0);
  138. break;
  139. default:
  140. cxusb_gpio_tuner(d, 1);
  141. break;
  142. }
  143. if (msg[i].flags & I2C_M_RD) {
  144. /* read only */
  145. u8 obuf[3], ibuf[MAX_XFER_SIZE];
  146. if (1 + msg[i].len > sizeof(ibuf)) {
  147. warn("i2c rd: len=%d is too big!\n",
  148. msg[i].len);
  149. ret = -EOPNOTSUPP;
  150. goto unlock;
  151. }
  152. obuf[0] = 0;
  153. obuf[1] = msg[i].len;
  154. obuf[2] = msg[i].addr;
  155. if (cxusb_ctrl_msg(d, CMD_I2C_READ,
  156. obuf, 3,
  157. ibuf, 1+msg[i].len) < 0) {
  158. warn("i2c read failed");
  159. break;
  160. }
  161. memcpy(msg[i].buf, &ibuf[1], msg[i].len);
  162. } else if (i+1 < num && (msg[i+1].flags & I2C_M_RD) &&
  163. msg[i].addr == msg[i+1].addr) {
  164. /* write to then read from same address */
  165. u8 obuf[MAX_XFER_SIZE], ibuf[MAX_XFER_SIZE];
  166. if (3 + msg[i].len > sizeof(obuf)) {
  167. warn("i2c wr: len=%d is too big!\n",
  168. msg[i].len);
  169. ret = -EOPNOTSUPP;
  170. goto unlock;
  171. }
  172. if (1 + msg[i + 1].len > sizeof(ibuf)) {
  173. warn("i2c rd: len=%d is too big!\n",
  174. msg[i + 1].len);
  175. ret = -EOPNOTSUPP;
  176. goto unlock;
  177. }
  178. obuf[0] = msg[i].len;
  179. obuf[1] = msg[i+1].len;
  180. obuf[2] = msg[i].addr;
  181. memcpy(&obuf[3], msg[i].buf, msg[i].len);
  182. if (cxusb_ctrl_msg(d, CMD_I2C_READ,
  183. obuf, 3+msg[i].len,
  184. ibuf, 1+msg[i+1].len) < 0)
  185. break;
  186. if (ibuf[0] != 0x08)
  187. deb_i2c("i2c read may have failed\n");
  188. memcpy(msg[i+1].buf, &ibuf[1], msg[i+1].len);
  189. i++;
  190. } else {
  191. /* write only */
  192. u8 obuf[MAX_XFER_SIZE], ibuf;
  193. if (2 + msg[i].len > sizeof(obuf)) {
  194. warn("i2c wr: len=%d is too big!\n",
  195. msg[i].len);
  196. ret = -EOPNOTSUPP;
  197. goto unlock;
  198. }
  199. obuf[0] = msg[i].addr;
  200. obuf[1] = msg[i].len;
  201. memcpy(&obuf[2], msg[i].buf, msg[i].len);
  202. if (cxusb_ctrl_msg(d, CMD_I2C_WRITE, obuf,
  203. 2+msg[i].len, &ibuf,1) < 0)
  204. break;
  205. if (ibuf != 0x08)
  206. deb_i2c("i2c write may have failed\n");
  207. }
  208. }
  209. if (i == num)
  210. ret = num;
  211. else
  212. ret = -EREMOTEIO;
  213. unlock:
  214. mutex_unlock(&d->i2c_mutex);
  215. return ret;
  216. }
  217. static u32 cxusb_i2c_func(struct i2c_adapter *adapter)
  218. {
  219. return I2C_FUNC_I2C;
  220. }
  221. static struct i2c_algorithm cxusb_i2c_algo = {
  222. .master_xfer = cxusb_i2c_xfer,
  223. .functionality = cxusb_i2c_func,
  224. };
  225. static int cxusb_power_ctrl(struct dvb_usb_device *d, int onoff)
  226. {
  227. u8 b = 0;
  228. if (onoff)
  229. return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0);
  230. else
  231. return cxusb_ctrl_msg(d, CMD_POWER_OFF, &b, 1, NULL, 0);
  232. }
  233. static int cxusb_aver_power_ctrl(struct dvb_usb_device *d, int onoff)
  234. {
  235. int ret;
  236. if (!onoff)
  237. return cxusb_ctrl_msg(d, CMD_POWER_OFF, NULL, 0, NULL, 0);
  238. if (d->state == DVB_USB_STATE_INIT &&
  239. usb_set_interface(d->udev, 0, 0) < 0)
  240. err("set interface failed");
  241. do {} while (!(ret = cxusb_ctrl_msg(d, CMD_POWER_ON, NULL, 0, NULL, 0)) &&
  242. !(ret = cxusb_ctrl_msg(d, 0x15, NULL, 0, NULL, 0)) &&
  243. !(ret = cxusb_ctrl_msg(d, 0x17, NULL, 0, NULL, 0)) && 0);
  244. if (!ret) {
  245. /* FIXME: We don't know why, but we need to configure the
  246. * lgdt3303 with the register settings below on resume */
  247. int i;
  248. u8 buf, bufs[] = {
  249. 0x0e, 0x2, 0x00, 0x7f,
  250. 0x0e, 0x2, 0x02, 0xfe,
  251. 0x0e, 0x2, 0x02, 0x01,
  252. 0x0e, 0x2, 0x00, 0x03,
  253. 0x0e, 0x2, 0x0d, 0x40,
  254. 0x0e, 0x2, 0x0e, 0x87,
  255. 0x0e, 0x2, 0x0f, 0x8e,
  256. 0x0e, 0x2, 0x10, 0x01,
  257. 0x0e, 0x2, 0x14, 0xd7,
  258. 0x0e, 0x2, 0x47, 0x88,
  259. };
  260. msleep(20);
  261. for (i = 0; i < sizeof(bufs)/sizeof(u8); i += 4/sizeof(u8)) {
  262. ret = cxusb_ctrl_msg(d, CMD_I2C_WRITE,
  263. bufs+i, 4, &buf, 1);
  264. if (ret)
  265. break;
  266. if (buf != 0x8)
  267. return -EREMOTEIO;
  268. }
  269. }
  270. return ret;
  271. }
  272. static int cxusb_bluebird_power_ctrl(struct dvb_usb_device *d, int onoff)
  273. {
  274. u8 b = 0;
  275. if (onoff)
  276. return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0);
  277. else
  278. return 0;
  279. }
  280. static int cxusb_nano2_power_ctrl(struct dvb_usb_device *d, int onoff)
  281. {
  282. int rc = 0;
  283. rc = cxusb_power_ctrl(d, onoff);
  284. if (!onoff)
  285. cxusb_nano2_led(d, 0);
  286. return rc;
  287. }
  288. static int cxusb_d680_dmb_power_ctrl(struct dvb_usb_device *d, int onoff)
  289. {
  290. int ret;
  291. u8 b;
  292. ret = cxusb_power_ctrl(d, onoff);
  293. if (!onoff)
  294. return ret;
  295. msleep(128);
  296. cxusb_ctrl_msg(d, CMD_DIGITAL, NULL, 0, &b, 1);
  297. msleep(100);
  298. return ret;
  299. }
  300. static int cxusb_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
  301. {
  302. u8 buf[2] = { 0x03, 0x00 };
  303. if (onoff)
  304. cxusb_ctrl_msg(adap->dev, CMD_STREAMING_ON, buf, 2, NULL, 0);
  305. else
  306. cxusb_ctrl_msg(adap->dev, CMD_STREAMING_OFF, NULL, 0, NULL, 0);
  307. return 0;
  308. }
  309. static int cxusb_aver_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
  310. {
  311. if (onoff)
  312. cxusb_ctrl_msg(adap->dev, CMD_AVER_STREAM_ON, NULL, 0, NULL, 0);
  313. else
  314. cxusb_ctrl_msg(adap->dev, CMD_AVER_STREAM_OFF,
  315. NULL, 0, NULL, 0);
  316. return 0;
  317. }
  318. static void cxusb_d680_dmb_drain_message(struct dvb_usb_device *d)
  319. {
  320. int ep = d->props.generic_bulk_ctrl_endpoint;
  321. const int timeout = 100;
  322. const int junk_len = 32;
  323. u8 *junk;
  324. int rd_count;
  325. /* Discard remaining data in video pipe */
  326. junk = kmalloc(junk_len, GFP_KERNEL);
  327. if (!junk)
  328. return;
  329. while (1) {
  330. if (usb_bulk_msg(d->udev,
  331. usb_rcvbulkpipe(d->udev, ep),
  332. junk, junk_len, &rd_count, timeout) < 0)
  333. break;
  334. if (!rd_count)
  335. break;
  336. }
  337. kfree(junk);
  338. }
  339. static void cxusb_d680_dmb_drain_video(struct dvb_usb_device *d)
  340. {
  341. struct usb_data_stream_properties *p = &d->props.adapter[0].fe[0].stream;
  342. const int timeout = 100;
  343. const int junk_len = p->u.bulk.buffersize;
  344. u8 *junk;
  345. int rd_count;
  346. /* Discard remaining data in video pipe */
  347. junk = kmalloc(junk_len, GFP_KERNEL);
  348. if (!junk)
  349. return;
  350. while (1) {
  351. if (usb_bulk_msg(d->udev,
  352. usb_rcvbulkpipe(d->udev, p->endpoint),
  353. junk, junk_len, &rd_count, timeout) < 0)
  354. break;
  355. if (!rd_count)
  356. break;
  357. }
  358. kfree(junk);
  359. }
  360. static int cxusb_d680_dmb_streaming_ctrl(
  361. struct dvb_usb_adapter *adap, int onoff)
  362. {
  363. if (onoff) {
  364. u8 buf[2] = { 0x03, 0x00 };
  365. cxusb_d680_dmb_drain_video(adap->dev);
  366. return cxusb_ctrl_msg(adap->dev, CMD_STREAMING_ON,
  367. buf, sizeof(buf), NULL, 0);
  368. } else {
  369. int ret = cxusb_ctrl_msg(adap->dev,
  370. CMD_STREAMING_OFF, NULL, 0, NULL, 0);
  371. return ret;
  372. }
  373. }
  374. static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
  375. {
  376. struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table;
  377. u8 ircode[4];
  378. int i;
  379. cxusb_ctrl_msg(d, CMD_GET_IR_CODE, NULL, 0, ircode, 4);
  380. *event = 0;
  381. *state = REMOTE_NO_KEY_PRESSED;
  382. for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) {
  383. if (rc5_custom(&keymap[i]) == ircode[2] &&
  384. rc5_data(&keymap[i]) == ircode[3]) {
  385. *event = keymap[i].keycode;
  386. *state = REMOTE_KEY_PRESSED;
  387. return 0;
  388. }
  389. }
  390. return 0;
  391. }
  392. static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d, u32 *event,
  393. int *state)
  394. {
  395. struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table;
  396. u8 ircode[4];
  397. int i;
  398. struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD,
  399. .buf = ircode, .len = 4 };
  400. *event = 0;
  401. *state = REMOTE_NO_KEY_PRESSED;
  402. if (cxusb_i2c_xfer(&d->i2c_adap, &msg, 1) != 1)
  403. return 0;
  404. for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) {
  405. if (rc5_custom(&keymap[i]) == ircode[1] &&
  406. rc5_data(&keymap[i]) == ircode[2]) {
  407. *event = keymap[i].keycode;
  408. *state = REMOTE_KEY_PRESSED;
  409. return 0;
  410. }
  411. }
  412. return 0;
  413. }
  414. static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d, u32 *event,
  415. int *state)
  416. {
  417. struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table;
  418. u8 ircode[2];
  419. int i;
  420. *event = 0;
  421. *state = REMOTE_NO_KEY_PRESSED;
  422. if (cxusb_ctrl_msg(d, 0x10, NULL, 0, ircode, 2) < 0)
  423. return 0;
  424. for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) {
  425. if (rc5_custom(&keymap[i]) == ircode[0] &&
  426. rc5_data(&keymap[i]) == ircode[1]) {
  427. *event = keymap[i].keycode;
  428. *state = REMOTE_KEY_PRESSED;
  429. return 0;
  430. }
  431. }
  432. return 0;
  433. }
  434. static struct rc_map_table rc_map_dvico_mce_table[] = {
  435. { 0xfe02, KEY_TV },
  436. { 0xfe0e, KEY_MP3 },
  437. { 0xfe1a, KEY_DVD },
  438. { 0xfe1e, KEY_FAVORITES },
  439. { 0xfe16, KEY_SETUP },
  440. { 0xfe46, KEY_POWER2 },
  441. { 0xfe0a, KEY_EPG },
  442. { 0xfe49, KEY_BACK },
  443. { 0xfe4d, KEY_MENU },
  444. { 0xfe51, KEY_UP },
  445. { 0xfe5b, KEY_LEFT },
  446. { 0xfe5f, KEY_RIGHT },
  447. { 0xfe53, KEY_DOWN },
  448. { 0xfe5e, KEY_OK },
  449. { 0xfe59, KEY_INFO },
  450. { 0xfe55, KEY_TAB },
  451. { 0xfe0f, KEY_PREVIOUSSONG },/* Replay */
  452. { 0xfe12, KEY_NEXTSONG }, /* Skip */
  453. { 0xfe42, KEY_ENTER }, /* Windows/Start */
  454. { 0xfe15, KEY_VOLUMEUP },
  455. { 0xfe05, KEY_VOLUMEDOWN },
  456. { 0xfe11, KEY_CHANNELUP },
  457. { 0xfe09, KEY_CHANNELDOWN },
  458. { 0xfe52, KEY_CAMERA },
  459. { 0xfe5a, KEY_TUNER }, /* Live */
  460. { 0xfe19, KEY_OPEN },
  461. { 0xfe0b, KEY_1 },
  462. { 0xfe17, KEY_2 },
  463. { 0xfe1b, KEY_3 },
  464. { 0xfe07, KEY_4 },
  465. { 0xfe50, KEY_5 },
  466. { 0xfe54, KEY_6 },
  467. { 0xfe48, KEY_7 },
  468. { 0xfe4c, KEY_8 },
  469. { 0xfe58, KEY_9 },
  470. { 0xfe13, KEY_ANGLE }, /* Aspect */
  471. { 0xfe03, KEY_0 },
  472. { 0xfe1f, KEY_ZOOM },
  473. { 0xfe43, KEY_REWIND },
  474. { 0xfe47, KEY_PLAYPAUSE },
  475. { 0xfe4f, KEY_FASTFORWARD },
  476. { 0xfe57, KEY_MUTE },
  477. { 0xfe0d, KEY_STOP },
  478. { 0xfe01, KEY_RECORD },
  479. { 0xfe4e, KEY_POWER },
  480. };
  481. static struct rc_map_table rc_map_dvico_portable_table[] = {
  482. { 0xfc02, KEY_SETUP }, /* Profile */
  483. { 0xfc43, KEY_POWER2 },
  484. { 0xfc06, KEY_EPG },
  485. { 0xfc5a, KEY_BACK },
  486. { 0xfc05, KEY_MENU },
  487. { 0xfc47, KEY_INFO },
  488. { 0xfc01, KEY_TAB },
  489. { 0xfc42, KEY_PREVIOUSSONG },/* Replay */
  490. { 0xfc49, KEY_VOLUMEUP },
  491. { 0xfc09, KEY_VOLUMEDOWN },
  492. { 0xfc54, KEY_CHANNELUP },
  493. { 0xfc0b, KEY_CHANNELDOWN },
  494. { 0xfc16, KEY_CAMERA },
  495. { 0xfc40, KEY_TUNER }, /* ATV/DTV */
  496. { 0xfc45, KEY_OPEN },
  497. { 0xfc19, KEY_1 },
  498. { 0xfc18, KEY_2 },
  499. { 0xfc1b, KEY_3 },
  500. { 0xfc1a, KEY_4 },
  501. { 0xfc58, KEY_5 },
  502. { 0xfc59, KEY_6 },
  503. { 0xfc15, KEY_7 },
  504. { 0xfc14, KEY_8 },
  505. { 0xfc17, KEY_9 },
  506. { 0xfc44, KEY_ANGLE }, /* Aspect */
  507. { 0xfc55, KEY_0 },
  508. { 0xfc07, KEY_ZOOM },
  509. { 0xfc0a, KEY_REWIND },
  510. { 0xfc08, KEY_PLAYPAUSE },
  511. { 0xfc4b, KEY_FASTFORWARD },
  512. { 0xfc5b, KEY_MUTE },
  513. { 0xfc04, KEY_STOP },
  514. { 0xfc56, KEY_RECORD },
  515. { 0xfc57, KEY_POWER },
  516. { 0xfc41, KEY_UNKNOWN }, /* INPUT */
  517. { 0xfc00, KEY_UNKNOWN }, /* HD */
  518. };
  519. static struct rc_map_table rc_map_d680_dmb_table[] = {
  520. { 0x0038, KEY_UNKNOWN }, /* TV/AV */
  521. { 0x080c, KEY_ZOOM },
  522. { 0x0800, KEY_0 },
  523. { 0x0001, KEY_1 },
  524. { 0x0802, KEY_2 },
  525. { 0x0003, KEY_3 },
  526. { 0x0804, KEY_4 },
  527. { 0x0005, KEY_5 },
  528. { 0x0806, KEY_6 },
  529. { 0x0007, KEY_7 },
  530. { 0x0808, KEY_8 },
  531. { 0x0009, KEY_9 },
  532. { 0x000a, KEY_MUTE },
  533. { 0x0829, KEY_BACK },
  534. { 0x0012, KEY_CHANNELUP },
  535. { 0x0813, KEY_CHANNELDOWN },
  536. { 0x002b, KEY_VOLUMEUP },
  537. { 0x082c, KEY_VOLUMEDOWN },
  538. { 0x0020, KEY_UP },
  539. { 0x0821, KEY_DOWN },
  540. { 0x0011, KEY_LEFT },
  541. { 0x0810, KEY_RIGHT },
  542. { 0x000d, KEY_OK },
  543. { 0x081f, KEY_RECORD },
  544. { 0x0017, KEY_PLAYPAUSE },
  545. { 0x0816, KEY_PLAYPAUSE },
  546. { 0x000b, KEY_STOP },
  547. { 0x0827, KEY_FASTFORWARD },
  548. { 0x0026, KEY_REWIND },
  549. { 0x081e, KEY_UNKNOWN }, /* Time Shift */
  550. { 0x000e, KEY_UNKNOWN }, /* Snapshot */
  551. { 0x082d, KEY_UNKNOWN }, /* Mouse Cursor */
  552. { 0x000f, KEY_UNKNOWN }, /* Minimize/Maximize */
  553. { 0x0814, KEY_UNKNOWN }, /* Shuffle */
  554. { 0x0025, KEY_POWER },
  555. };
  556. static int cxusb_dee1601_demod_init(struct dvb_frontend* fe)
  557. {
  558. static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x28 };
  559. static u8 reset [] = { RESET, 0x80 };
  560. static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
  561. static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 };
  562. static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 };
  563. static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
  564. mt352_write(fe, clock_config, sizeof(clock_config));
  565. udelay(200);
  566. mt352_write(fe, reset, sizeof(reset));
  567. mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
  568. mt352_write(fe, agc_cfg, sizeof(agc_cfg));
  569. mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg));
  570. mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
  571. return 0;
  572. }
  573. static int cxusb_mt352_demod_init(struct dvb_frontend* fe)
  574. { /* used in both lgz201 and th7579 */
  575. static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x29 };
  576. static u8 reset [] = { RESET, 0x80 };
  577. static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
  578. static u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 };
  579. static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 };
  580. static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
  581. mt352_write(fe, clock_config, sizeof(clock_config));
  582. udelay(200);
  583. mt352_write(fe, reset, sizeof(reset));
  584. mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
  585. mt352_write(fe, agc_cfg, sizeof(agc_cfg));
  586. mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg));
  587. mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
  588. return 0;
  589. }
  590. static struct cx22702_config cxusb_cx22702_config = {
  591. .demod_address = 0x63,
  592. .output_mode = CX22702_PARALLEL_OUTPUT,
  593. };
  594. static struct lgdt330x_config cxusb_lgdt3303_config = {
  595. .demod_address = 0x0e,
  596. .demod_chip = LGDT3303,
  597. };
  598. static struct lgdt330x_config cxusb_aver_lgdt3303_config = {
  599. .demod_address = 0x0e,
  600. .demod_chip = LGDT3303,
  601. .clock_polarity_flip = 2,
  602. };
  603. static struct mt352_config cxusb_dee1601_config = {
  604. .demod_address = 0x0f,
  605. .demod_init = cxusb_dee1601_demod_init,
  606. };
  607. static struct zl10353_config cxusb_zl10353_dee1601_config = {
  608. .demod_address = 0x0f,
  609. .parallel_ts = 1,
  610. };
  611. static struct mt352_config cxusb_mt352_config = {
  612. /* used in both lgz201 and th7579 */
  613. .demod_address = 0x0f,
  614. .demod_init = cxusb_mt352_demod_init,
  615. };
  616. static struct zl10353_config cxusb_zl10353_xc3028_config = {
  617. .demod_address = 0x0f,
  618. .if2 = 45600,
  619. .no_tuner = 1,
  620. .parallel_ts = 1,
  621. };
  622. static struct zl10353_config cxusb_zl10353_xc3028_config_no_i2c_gate = {
  623. .demod_address = 0x0f,
  624. .if2 = 45600,
  625. .no_tuner = 1,
  626. .parallel_ts = 1,
  627. .disable_i2c_gate_ctrl = 1,
  628. };
  629. static struct mt352_config cxusb_mt352_xc3028_config = {
  630. .demod_address = 0x0f,
  631. .if2 = 4560,
  632. .no_tuner = 1,
  633. .demod_init = cxusb_mt352_demod_init,
  634. };
  635. /* FIXME: needs tweaking */
  636. static struct mxl5005s_config aver_a868r_tuner = {
  637. .i2c_address = 0x63,
  638. .if_freq = 6000000UL,
  639. .xtal_freq = CRYSTAL_FREQ_16000000HZ,
  640. .agc_mode = MXL_SINGLE_AGC,
  641. .tracking_filter = MXL_TF_C,
  642. .rssi_enable = MXL_RSSI_ENABLE,
  643. .cap_select = MXL_CAP_SEL_ENABLE,
  644. .div_out = MXL_DIV_OUT_4,
  645. .clock_out = MXL_CLOCK_OUT_DISABLE,
  646. .output_load = MXL5005S_IF_OUTPUT_LOAD_200_OHM,
  647. .top = MXL5005S_TOP_25P2,
  648. .mod_mode = MXL_DIGITAL_MODE,
  649. .if_mode = MXL_ZERO_IF,
  650. .AgcMasterByte = 0x00,
  651. };
  652. /* FIXME: needs tweaking */
  653. static struct mxl5005s_config d680_dmb_tuner = {
  654. .i2c_address = 0x63,
  655. .if_freq = 36125000UL,
  656. .xtal_freq = CRYSTAL_FREQ_16000000HZ,
  657. .agc_mode = MXL_SINGLE_AGC,
  658. .tracking_filter = MXL_TF_C,
  659. .rssi_enable = MXL_RSSI_ENABLE,
  660. .cap_select = MXL_CAP_SEL_ENABLE,
  661. .div_out = MXL_DIV_OUT_4,
  662. .clock_out = MXL_CLOCK_OUT_DISABLE,
  663. .output_load = MXL5005S_IF_OUTPUT_LOAD_200_OHM,
  664. .top = MXL5005S_TOP_25P2,
  665. .mod_mode = MXL_DIGITAL_MODE,
  666. .if_mode = MXL_ZERO_IF,
  667. .AgcMasterByte = 0x00,
  668. };
  669. static struct max2165_config mygica_d689_max2165_cfg = {
  670. .i2c_address = 0x60,
  671. .osc_clk = 20
  672. };
  673. /* Callbacks for DVB USB */
  674. static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap)
  675. {
  676. dvb_attach(simple_tuner_attach, adap->fe_adap[0].fe,
  677. &adap->dev->i2c_adap, 0x61,
  678. TUNER_PHILIPS_FMD1216ME_MK3);
  679. return 0;
  680. }
  681. static int cxusb_dee1601_tuner_attach(struct dvb_usb_adapter *adap)
  682. {
  683. dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x61,
  684. NULL, DVB_PLL_THOMSON_DTT7579);
  685. return 0;
  686. }
  687. static int cxusb_lgz201_tuner_attach(struct dvb_usb_adapter *adap)
  688. {
  689. dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x61, NULL, DVB_PLL_LG_Z201);
  690. return 0;
  691. }
  692. static int cxusb_dtt7579_tuner_attach(struct dvb_usb_adapter *adap)
  693. {
  694. dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60,
  695. NULL, DVB_PLL_THOMSON_DTT7579);
  696. return 0;
  697. }
  698. static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter *adap)
  699. {
  700. dvb_attach(simple_tuner_attach, adap->fe_adap[0].fe,
  701. &adap->dev->i2c_adap, 0x61, TUNER_LG_TDVS_H06XF);
  702. return 0;
  703. }
  704. static int dvico_bluebird_xc2028_callback(void *ptr, int component,
  705. int command, int arg)
  706. {
  707. struct dvb_usb_adapter *adap = ptr;
  708. struct dvb_usb_device *d = adap->dev;
  709. switch (command) {
  710. case XC2028_TUNER_RESET:
  711. deb_info("%s: XC2028_TUNER_RESET %d\n", __func__, arg);
  712. cxusb_bluebird_gpio_pulse(d, 0x01, 1);
  713. break;
  714. case XC2028_RESET_CLK:
  715. deb_info("%s: XC2028_RESET_CLK %d\n", __func__, arg);
  716. break;
  717. default:
  718. deb_info("%s: unknown command %d, arg %d\n", __func__,
  719. command, arg);
  720. return -EINVAL;
  721. }
  722. return 0;
  723. }
  724. static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap)
  725. {
  726. struct dvb_frontend *fe;
  727. struct xc2028_config cfg = {
  728. .i2c_adap = &adap->dev->i2c_adap,
  729. .i2c_addr = 0x61,
  730. };
  731. static struct xc2028_ctrl ctl = {
  732. .fname = XC2028_DEFAULT_FIRMWARE,
  733. .max_len = 64,
  734. .demod = XC3028_FE_ZARLINK456,
  735. };
  736. /* FIXME: generalize & move to common area */
  737. adap->fe_adap[0].fe->callback = dvico_bluebird_xc2028_callback;
  738. fe = dvb_attach(xc2028_attach, adap->fe_adap[0].fe, &cfg);
  739. if (fe == NULL || fe->ops.tuner_ops.set_config == NULL)
  740. return -EIO;
  741. fe->ops.tuner_ops.set_config(fe, &ctl);
  742. return 0;
  743. }
  744. static int cxusb_mxl5003s_tuner_attach(struct dvb_usb_adapter *adap)
  745. {
  746. dvb_attach(mxl5005s_attach, adap->fe_adap[0].fe,
  747. &adap->dev->i2c_adap, &aver_a868r_tuner);
  748. return 0;
  749. }
  750. static int cxusb_d680_dmb_tuner_attach(struct dvb_usb_adapter *adap)
  751. {
  752. struct dvb_frontend *fe;
  753. fe = dvb_attach(mxl5005s_attach, adap->fe_adap[0].fe,
  754. &adap->dev->i2c_adap, &d680_dmb_tuner);
  755. return (fe == NULL) ? -EIO : 0;
  756. }
  757. static int cxusb_mygica_d689_tuner_attach(struct dvb_usb_adapter *adap)
  758. {
  759. struct dvb_frontend *fe;
  760. fe = dvb_attach(max2165_attach, adap->fe_adap[0].fe,
  761. &adap->dev->i2c_adap, &mygica_d689_max2165_cfg);
  762. return (fe == NULL) ? -EIO : 0;
  763. }
  764. static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter *adap)
  765. {
  766. u8 b;
  767. if (usb_set_interface(adap->dev->udev, 0, 6) < 0)
  768. err("set interface failed");
  769. cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, &b, 1);
  770. adap->fe_adap[0].fe = dvb_attach(cx22702_attach, &cxusb_cx22702_config,
  771. &adap->dev->i2c_adap);
  772. if ((adap->fe_adap[0].fe) != NULL)
  773. return 0;
  774. return -EIO;
  775. }
  776. static int cxusb_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap)
  777. {
  778. if (usb_set_interface(adap->dev->udev, 0, 7) < 0)
  779. err("set interface failed");
  780. cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
  781. adap->fe_adap[0].fe = dvb_attach(lgdt330x_attach,
  782. &cxusb_lgdt3303_config,
  783. &adap->dev->i2c_adap);
  784. if ((adap->fe_adap[0].fe) != NULL)
  785. return 0;
  786. return -EIO;
  787. }
  788. static int cxusb_aver_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap)
  789. {
  790. adap->fe_adap[0].fe = dvb_attach(lgdt330x_attach, &cxusb_aver_lgdt3303_config,
  791. &adap->dev->i2c_adap);
  792. if (adap->fe_adap[0].fe != NULL)
  793. return 0;
  794. return -EIO;
  795. }
  796. static int cxusb_mt352_frontend_attach(struct dvb_usb_adapter *adap)
  797. {
  798. /* used in both lgz201 and th7579 */
  799. if (usb_set_interface(adap->dev->udev, 0, 0) < 0)
  800. err("set interface failed");
  801. cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
  802. adap->fe_adap[0].fe = dvb_attach(mt352_attach, &cxusb_mt352_config,
  803. &adap->dev->i2c_adap);
  804. if ((adap->fe_adap[0].fe) != NULL)
  805. return 0;
  806. return -EIO;
  807. }
  808. static int cxusb_dee1601_frontend_attach(struct dvb_usb_adapter *adap)
  809. {
  810. if (usb_set_interface(adap->dev->udev, 0, 0) < 0)
  811. err("set interface failed");
  812. cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
  813. adap->fe_adap[0].fe = dvb_attach(mt352_attach, &cxusb_dee1601_config,
  814. &adap->dev->i2c_adap);
  815. if ((adap->fe_adap[0].fe) != NULL)
  816. return 0;
  817. adap->fe_adap[0].fe = dvb_attach(zl10353_attach,
  818. &cxusb_zl10353_dee1601_config,
  819. &adap->dev->i2c_adap);
  820. if ((adap->fe_adap[0].fe) != NULL)
  821. return 0;
  822. return -EIO;
  823. }
  824. static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap)
  825. {
  826. u8 ircode[4];
  827. int i;
  828. struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD,
  829. .buf = ircode, .len = 4 };
  830. if (usb_set_interface(adap->dev->udev, 0, 1) < 0)
  831. err("set interface failed");
  832. cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
  833. /* reset the tuner and demodulator */
  834. cxusb_bluebird_gpio_rw(adap->dev, 0x04, 0);
  835. cxusb_bluebird_gpio_pulse(adap->dev, 0x01, 1);
  836. cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1);
  837. adap->fe_adap[0].fe =
  838. dvb_attach(zl10353_attach,
  839. &cxusb_zl10353_xc3028_config_no_i2c_gate,
  840. &adap->dev->i2c_adap);
  841. if ((adap->fe_adap[0].fe) == NULL)
  842. return -EIO;
  843. /* try to determine if there is no IR decoder on the I2C bus */
  844. for (i = 0; adap->dev->props.rc.legacy.rc_map_table != NULL && i < 5; i++) {
  845. msleep(20);
  846. if (cxusb_i2c_xfer(&adap->dev->i2c_adap, &msg, 1) != 1)
  847. goto no_IR;
  848. if (ircode[0] == 0 && ircode[1] == 0)
  849. continue;
  850. if (ircode[2] + ircode[3] != 0xff) {
  851. no_IR:
  852. adap->dev->props.rc.legacy.rc_map_table = NULL;
  853. info("No IR receiver detected on this device.");
  854. break;
  855. }
  856. }
  857. return 0;
  858. }
  859. static struct dibx000_agc_config dib7070_agc_config = {
  860. .band_caps = BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
  861. /*
  862. * P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5,
  863. * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
  864. * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0
  865. */
  866. .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) |
  867. (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
  868. .inv_gain = 600,
  869. .time_stabiliz = 10,
  870. .alpha_level = 0,
  871. .thlock = 118,
  872. .wbd_inv = 0,
  873. .wbd_ref = 3530,
  874. .wbd_sel = 1,
  875. .wbd_alpha = 5,
  876. .agc1_max = 65535,
  877. .agc1_min = 0,
  878. .agc2_max = 65535,
  879. .agc2_min = 0,
  880. .agc1_pt1 = 0,
  881. .agc1_pt2 = 40,
  882. .agc1_pt3 = 183,
  883. .agc1_slope1 = 206,
  884. .agc1_slope2 = 255,
  885. .agc2_pt1 = 72,
  886. .agc2_pt2 = 152,
  887. .agc2_slope1 = 88,
  888. .agc2_slope2 = 90,
  889. .alpha_mant = 17,
  890. .alpha_exp = 27,
  891. .beta_mant = 23,
  892. .beta_exp = 51,
  893. .perform_agc_softsplit = 0,
  894. };
  895. static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
  896. .internal = 60000,
  897. .sampling = 15000,
  898. .pll_prediv = 1,
  899. .pll_ratio = 20,
  900. .pll_range = 3,
  901. .pll_reset = 1,
  902. .pll_bypass = 0,
  903. .enable_refdiv = 0,
  904. .bypclk_div = 0,
  905. .IO_CLK_en_core = 1,
  906. .ADClkSrc = 1,
  907. .modulo = 2,
  908. /* refsel, sel, freq_15k */
  909. .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0),
  910. .ifreq = (0 << 25) | 0,
  911. .timf = 20452225,
  912. .xtal_hz = 12000000,
  913. };
  914. static struct dib7000p_config cxusb_dualdig4_rev2_config = {
  915. .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
  916. .output_mpeg2_in_188_bytes = 1,
  917. .agc_config_count = 1,
  918. .agc = &dib7070_agc_config,
  919. .bw = &dib7070_bw_config_12_mhz,
  920. .tuner_is_baseband = 1,
  921. .spur_protect = 1,
  922. .gpio_dir = 0xfcef,
  923. .gpio_val = 0x0110,
  924. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  925. .hostbus_diversity = 1,
  926. };
  927. struct dib0700_adapter_state {
  928. int (*set_param_save)(struct dvb_frontend *);
  929. struct dib7000p_ops dib7000p_ops;
  930. };
  931. static int cxusb_dualdig4_rev2_frontend_attach(struct dvb_usb_adapter *adap)
  932. {
  933. struct dib0700_adapter_state *state = adap->priv;
  934. if (usb_set_interface(adap->dev->udev, 0, 1) < 0)
  935. err("set interface failed");
  936. cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
  937. cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1);
  938. if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
  939. return -ENODEV;
  940. if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
  941. &cxusb_dualdig4_rev2_config) < 0) {
  942. printk(KERN_WARNING "Unable to enumerate dib7000p\n");
  943. return -ENODEV;
  944. }
  945. adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80,
  946. &cxusb_dualdig4_rev2_config);
  947. if (adap->fe_adap[0].fe == NULL)
  948. return -EIO;
  949. return 0;
  950. }
  951. static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
  952. {
  953. struct dvb_usb_adapter *adap = fe->dvb->priv;
  954. struct dib0700_adapter_state *state = adap->priv;
  955. return state->dib7000p_ops.set_gpio(fe, 8, 0, !onoff);
  956. }
  957. static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
  958. {
  959. return 0;
  960. }
  961. static struct dib0070_config dib7070p_dib0070_config = {
  962. .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
  963. .reset = dib7070_tuner_reset,
  964. .sleep = dib7070_tuner_sleep,
  965. .clock_khz = 12000,
  966. };
  967. static int dib7070_set_param_override(struct dvb_frontend *fe)
  968. {
  969. struct dtv_frontend_properties *p = &fe->dtv_property_cache;
  970. struct dvb_usb_adapter *adap = fe->dvb->priv;
  971. struct dib0700_adapter_state *state = adap->priv;
  972. u16 offset;
  973. u8 band = BAND_OF_FREQUENCY(p->frequency/1000);
  974. switch (band) {
  975. case BAND_VHF: offset = 950; break;
  976. default:
  977. case BAND_UHF: offset = 550; break;
  978. }
  979. state->dib7000p_ops.set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
  980. return state->set_param_save(fe);
  981. }
  982. static int cxusb_dualdig4_rev2_tuner_attach(struct dvb_usb_adapter *adap)
  983. {
  984. struct dib0700_adapter_state *st = adap->priv;
  985. struct i2c_adapter *tun_i2c;
  986. /*
  987. * No need to call dvb7000p_attach here, as it was called
  988. * already, as frontend_attach method is called first, and
  989. * tuner_attach is only called on sucess.
  990. */
  991. tun_i2c = st->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe,
  992. DIBX000_I2C_INTERFACE_TUNER, 1);
  993. if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c,
  994. &dib7070p_dib0070_config) == NULL)
  995. return -ENODEV;
  996. st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
  997. adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7070_set_param_override;
  998. return 0;
  999. }
  1000. static int cxusb_nano2_frontend_attach(struct dvb_usb_adapter *adap)
  1001. {
  1002. if (usb_set_interface(adap->dev->udev, 0, 1) < 0)
  1003. err("set interface failed");
  1004. cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
  1005. /* reset the tuner and demodulator */
  1006. cxusb_bluebird_gpio_rw(adap->dev, 0x04, 0);
  1007. cxusb_bluebird_gpio_pulse(adap->dev, 0x01, 1);
  1008. cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1);
  1009. adap->fe_adap[0].fe = dvb_attach(zl10353_attach,
  1010. &cxusb_zl10353_xc3028_config,
  1011. &adap->dev->i2c_adap);
  1012. if ((adap->fe_adap[0].fe) != NULL)
  1013. return 0;
  1014. adap->fe_adap[0].fe = dvb_attach(mt352_attach,
  1015. &cxusb_mt352_xc3028_config,
  1016. &adap->dev->i2c_adap);
  1017. if ((adap->fe_adap[0].fe) != NULL)
  1018. return 0;
  1019. return -EIO;
  1020. }
  1021. static struct lgs8gxx_config d680_lgs8gl5_cfg = {
  1022. .prod = LGS8GXX_PROD_LGS8GL5,
  1023. .demod_address = 0x19,
  1024. .serial_ts = 0,
  1025. .ts_clk_pol = 0,
  1026. .ts_clk_gated = 1,
  1027. .if_clk_freq = 30400, /* 30.4 MHz */
  1028. .if_freq = 5725, /* 5.725 MHz */
  1029. .if_neg_center = 0,
  1030. .ext_adc = 0,
  1031. .adc_signed = 0,
  1032. .if_neg_edge = 0,
  1033. };
  1034. static int cxusb_d680_dmb_frontend_attach(struct dvb_usb_adapter *adap)
  1035. {
  1036. struct dvb_usb_device *d = adap->dev;
  1037. int n;
  1038. /* Select required USB configuration */
  1039. if (usb_set_interface(d->udev, 0, 0) < 0)
  1040. err("set interface failed");
  1041. /* Unblock all USB pipes */
  1042. usb_clear_halt(d->udev,
  1043. usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
  1044. usb_clear_halt(d->udev,
  1045. usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
  1046. usb_clear_halt(d->udev,
  1047. usb_rcvbulkpipe(d->udev, d->props.adapter[0].fe[0].stream.endpoint));
  1048. /* Drain USB pipes to avoid hang after reboot */
  1049. for (n = 0; n < 5; n++) {
  1050. cxusb_d680_dmb_drain_message(d);
  1051. cxusb_d680_dmb_drain_video(d);
  1052. msleep(200);
  1053. }
  1054. /* Reset the tuner */
  1055. if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 0) < 0) {
  1056. err("clear tuner gpio failed");
  1057. return -EIO;
  1058. }
  1059. msleep(100);
  1060. if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 1) < 0) {
  1061. err("set tuner gpio failed");
  1062. return -EIO;
  1063. }
  1064. msleep(100);
  1065. /* Attach frontend */
  1066. adap->fe_adap[0].fe = dvb_attach(lgs8gxx_attach, &d680_lgs8gl5_cfg, &d->i2c_adap);
  1067. if (adap->fe_adap[0].fe == NULL)
  1068. return -EIO;
  1069. return 0;
  1070. }
  1071. static struct atbm8830_config mygica_d689_atbm8830_cfg = {
  1072. .prod = ATBM8830_PROD_8830,
  1073. .demod_address = 0x40,
  1074. .serial_ts = 0,
  1075. .ts_sampling_edge = 1,
  1076. .ts_clk_gated = 0,
  1077. .osc_clk_freq = 30400, /* in kHz */
  1078. .if_freq = 0, /* zero IF */
  1079. .zif_swap_iq = 1,
  1080. .agc_min = 0x2E,
  1081. .agc_max = 0x90,
  1082. .agc_hold_loop = 0,
  1083. };
  1084. static int cxusb_mygica_d689_frontend_attach(struct dvb_usb_adapter *adap)
  1085. {
  1086. struct dvb_usb_device *d = adap->dev;
  1087. /* Select required USB configuration */
  1088. if (usb_set_interface(d->udev, 0, 0) < 0)
  1089. err("set interface failed");
  1090. /* Unblock all USB pipes */
  1091. usb_clear_halt(d->udev,
  1092. usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
  1093. usb_clear_halt(d->udev,
  1094. usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
  1095. usb_clear_halt(d->udev,
  1096. usb_rcvbulkpipe(d->udev, d->props.adapter[0].fe[0].stream.endpoint));
  1097. /* Reset the tuner */
  1098. if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 0) < 0) {
  1099. err("clear tuner gpio failed");
  1100. return -EIO;
  1101. }
  1102. msleep(100);
  1103. if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 1) < 0) {
  1104. err("set tuner gpio failed");
  1105. return -EIO;
  1106. }
  1107. msleep(100);
  1108. /* Attach frontend */
  1109. adap->fe_adap[0].fe = dvb_attach(atbm8830_attach, &mygica_d689_atbm8830_cfg,
  1110. &d->i2c_adap);
  1111. if (adap->fe_adap[0].fe == NULL)
  1112. return -EIO;
  1113. return 0;
  1114. }
  1115. static int cxusb_mygica_t230_frontend_attach(struct dvb_usb_adapter *adap)
  1116. {
  1117. struct dvb_usb_device *d = adap->dev;
  1118. struct cxusb_state *st = d->priv;
  1119. struct i2c_adapter *adapter;
  1120. struct i2c_client *client_demod;
  1121. struct i2c_client *client_tuner;
  1122. struct i2c_board_info info;
  1123. struct si2168_config si2168_config;
  1124. struct si2157_config si2157_config;
  1125. /* Select required USB configuration */
  1126. if (usb_set_interface(d->udev, 0, 0) < 0)
  1127. err("set interface failed");
  1128. /* Unblock all USB pipes */
  1129. usb_clear_halt(d->udev,
  1130. usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
  1131. usb_clear_halt(d->udev,
  1132. usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
  1133. usb_clear_halt(d->udev,
  1134. usb_rcvbulkpipe(d->udev, d->props.adapter[0].fe[0].stream.endpoint));
  1135. /* attach frontend */
  1136. si2168_config.i2c_adapter = &adapter;
  1137. si2168_config.fe = &adap->fe_adap[0].fe;
  1138. si2168_config.ts_mode = SI2168_TS_PARALLEL;
  1139. si2168_config.ts_clock_inv = 1;
  1140. memset(&info, 0, sizeof(struct i2c_board_info));
  1141. strlcpy(info.type, "si2168", I2C_NAME_SIZE);
  1142. info.addr = 0x64;
  1143. info.platform_data = &si2168_config;
  1144. request_module(info.type);
  1145. client_demod = i2c_new_device(&d->i2c_adap, &info);
  1146. if (client_demod == NULL || client_demod->dev.driver == NULL)
  1147. return -ENODEV;
  1148. if (!try_module_get(client_demod->dev.driver->owner)) {
  1149. i2c_unregister_device(client_demod);
  1150. return -ENODEV;
  1151. }
  1152. st->i2c_client_demod = client_demod;
  1153. /* attach tuner */
  1154. memset(&si2157_config, 0, sizeof(si2157_config));
  1155. si2157_config.fe = adap->fe_adap[0].fe;
  1156. si2157_config.if_port = 1;
  1157. memset(&info, 0, sizeof(struct i2c_board_info));
  1158. strlcpy(info.type, "si2157", I2C_NAME_SIZE);
  1159. info.addr = 0x60;
  1160. info.platform_data = &si2157_config;
  1161. request_module(info.type);
  1162. client_tuner = i2c_new_device(adapter, &info);
  1163. if (client_tuner == NULL || client_tuner->dev.driver == NULL) {
  1164. module_put(client_demod->dev.driver->owner);
  1165. i2c_unregister_device(client_demod);
  1166. return -ENODEV;
  1167. }
  1168. if (!try_module_get(client_tuner->dev.driver->owner)) {
  1169. i2c_unregister_device(client_tuner);
  1170. module_put(client_demod->dev.driver->owner);
  1171. i2c_unregister_device(client_demod);
  1172. return -ENODEV;
  1173. }
  1174. st->i2c_client_tuner = client_tuner;
  1175. return 0;
  1176. }
  1177. /*
  1178. * DViCO has shipped two devices with the same USB ID, but only one of them
  1179. * needs a firmware download. Check the device class details to see if they
  1180. * have non-default values to decide whether the device is actually cold or
  1181. * not, and forget a match if it turns out we selected the wrong device.
  1182. */
  1183. static int bluebird_fx2_identify_state(struct usb_device *udev,
  1184. struct dvb_usb_device_properties *props,
  1185. struct dvb_usb_device_description **desc,
  1186. int *cold)
  1187. {
  1188. int wascold = *cold;
  1189. *cold = udev->descriptor.bDeviceClass == 0xff &&
  1190. udev->descriptor.bDeviceSubClass == 0xff &&
  1191. udev->descriptor.bDeviceProtocol == 0xff;
  1192. if (*cold && !wascold)
  1193. *desc = NULL;
  1194. return 0;
  1195. }
  1196. /*
  1197. * DViCO bluebird firmware needs the "warm" product ID to be patched into the
  1198. * firmware file before download.
  1199. */
  1200. static const int dvico_firmware_id_offsets[] = { 6638, 3204 };
  1201. static int bluebird_patch_dvico_firmware_download(struct usb_device *udev,
  1202. const struct firmware *fw)
  1203. {
  1204. int pos;
  1205. for (pos = 0; pos < ARRAY_SIZE(dvico_firmware_id_offsets); pos++) {
  1206. int idoff = dvico_firmware_id_offsets[pos];
  1207. if (fw->size < idoff + 4)
  1208. continue;
  1209. if (fw->data[idoff] == (USB_VID_DVICO & 0xff) &&
  1210. fw->data[idoff + 1] == USB_VID_DVICO >> 8) {
  1211. struct firmware new_fw;
  1212. u8 *new_fw_data = vmalloc(fw->size);
  1213. int ret;
  1214. if (!new_fw_data)
  1215. return -ENOMEM;
  1216. memcpy(new_fw_data, fw->data, fw->size);
  1217. new_fw.size = fw->size;
  1218. new_fw.data = new_fw_data;
  1219. new_fw_data[idoff + 2] =
  1220. le16_to_cpu(udev->descriptor.idProduct) + 1;
  1221. new_fw_data[idoff + 3] =
  1222. le16_to_cpu(udev->descriptor.idProduct) >> 8;
  1223. ret = usb_cypress_load_firmware(udev, &new_fw,
  1224. CYPRESS_FX2);
  1225. vfree(new_fw_data);
  1226. return ret;
  1227. }
  1228. }
  1229. return -EINVAL;
  1230. }
  1231. /* DVB USB Driver stuff */
  1232. static struct dvb_usb_device_properties cxusb_medion_properties;
  1233. static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties;
  1234. static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties;
  1235. static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties;
  1236. static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties;
  1237. static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties;
  1238. static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties;
  1239. static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties;
  1240. static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties;
  1241. static struct dvb_usb_device_properties cxusb_aver_a868r_properties;
  1242. static struct dvb_usb_device_properties cxusb_d680_dmb_properties;
  1243. static struct dvb_usb_device_properties cxusb_mygica_d689_properties;
  1244. static struct dvb_usb_device_properties cxusb_mygica_t230_properties;
  1245. static int cxusb_probe(struct usb_interface *intf,
  1246. const struct usb_device_id *id)
  1247. {
  1248. if (0 == dvb_usb_device_init(intf, &cxusb_medion_properties,
  1249. THIS_MODULE, NULL, adapter_nr) ||
  1250. 0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgh064f_properties,
  1251. THIS_MODULE, NULL, adapter_nr) ||
  1252. 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dee1601_properties,
  1253. THIS_MODULE, NULL, adapter_nr) ||
  1254. 0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgz201_properties,
  1255. THIS_MODULE, NULL, adapter_nr) ||
  1256. 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dtt7579_properties,
  1257. THIS_MODULE, NULL, adapter_nr) ||
  1258. 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dualdig4_properties,
  1259. THIS_MODULE, NULL, adapter_nr) ||
  1260. 0 == dvb_usb_device_init(intf, &cxusb_bluebird_nano2_properties,
  1261. THIS_MODULE, NULL, adapter_nr) ||
  1262. 0 == dvb_usb_device_init(intf,
  1263. &cxusb_bluebird_nano2_needsfirmware_properties,
  1264. THIS_MODULE, NULL, adapter_nr) ||
  1265. 0 == dvb_usb_device_init(intf, &cxusb_aver_a868r_properties,
  1266. THIS_MODULE, NULL, adapter_nr) ||
  1267. 0 == dvb_usb_device_init(intf,
  1268. &cxusb_bluebird_dualdig4_rev2_properties,
  1269. THIS_MODULE, NULL, adapter_nr) ||
  1270. 0 == dvb_usb_device_init(intf, &cxusb_d680_dmb_properties,
  1271. THIS_MODULE, NULL, adapter_nr) ||
  1272. 0 == dvb_usb_device_init(intf, &cxusb_mygica_d689_properties,
  1273. THIS_MODULE, NULL, adapter_nr) ||
  1274. 0 == dvb_usb_device_init(intf, &cxusb_mygica_t230_properties,
  1275. THIS_MODULE, NULL, adapter_nr) ||
  1276. 0)
  1277. return 0;
  1278. return -EINVAL;
  1279. }
  1280. static void cxusb_disconnect(struct usb_interface *intf)
  1281. {
  1282. struct dvb_usb_device *d = usb_get_intfdata(intf);
  1283. struct cxusb_state *st = d->priv;
  1284. struct i2c_client *client;
  1285. /* remove I2C client for tuner */
  1286. client = st->i2c_client_tuner;
  1287. if (client) {
  1288. module_put(client->dev.driver->owner);
  1289. i2c_unregister_device(client);
  1290. }
  1291. /* remove I2C client for demodulator */
  1292. client = st->i2c_client_demod;
  1293. if (client) {
  1294. module_put(client->dev.driver->owner);
  1295. i2c_unregister_device(client);
  1296. }
  1297. dvb_usb_device_exit(intf);
  1298. }
  1299. enum cxusb_table_index {
  1300. MEDION_MD95700,
  1301. DVICO_BLUEBIRD_LG064F_COLD,
  1302. DVICO_BLUEBIRD_LG064F_WARM,
  1303. DVICO_BLUEBIRD_DUAL_1_COLD,
  1304. DVICO_BLUEBIRD_DUAL_1_WARM,
  1305. DVICO_BLUEBIRD_LGZ201_COLD,
  1306. DVICO_BLUEBIRD_LGZ201_WARM,
  1307. DVICO_BLUEBIRD_TH7579_COLD,
  1308. DVICO_BLUEBIRD_TH7579_WARM,
  1309. DIGITALNOW_BLUEBIRD_DUAL_1_COLD,
  1310. DIGITALNOW_BLUEBIRD_DUAL_1_WARM,
  1311. DVICO_BLUEBIRD_DUAL_2_COLD,
  1312. DVICO_BLUEBIRD_DUAL_2_WARM,
  1313. DVICO_BLUEBIRD_DUAL_4,
  1314. DVICO_BLUEBIRD_DVB_T_NANO_2,
  1315. DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM,
  1316. AVERMEDIA_VOLAR_A868R,
  1317. DVICO_BLUEBIRD_DUAL_4_REV_2,
  1318. CONEXANT_D680_DMB,
  1319. MYGICA_D689,
  1320. MYGICA_T230,
  1321. NR__cxusb_table_index
  1322. };
  1323. static struct usb_device_id cxusb_table[NR__cxusb_table_index + 1] = {
  1324. [MEDION_MD95700] = {
  1325. USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700)
  1326. },
  1327. [DVICO_BLUEBIRD_LG064F_COLD] = {
  1328. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_COLD)
  1329. },
  1330. [DVICO_BLUEBIRD_LG064F_WARM] = {
  1331. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_WARM)
  1332. },
  1333. [DVICO_BLUEBIRD_DUAL_1_COLD] = {
  1334. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_COLD)
  1335. },
  1336. [DVICO_BLUEBIRD_DUAL_1_WARM] = {
  1337. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_WARM)
  1338. },
  1339. [DVICO_BLUEBIRD_LGZ201_COLD] = {
  1340. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD)
  1341. },
  1342. [DVICO_BLUEBIRD_LGZ201_WARM] = {
  1343. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM)
  1344. },
  1345. [DVICO_BLUEBIRD_TH7579_COLD] = {
  1346. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_COLD)
  1347. },
  1348. [DVICO_BLUEBIRD_TH7579_WARM] = {
  1349. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_WARM)
  1350. },
  1351. [DIGITALNOW_BLUEBIRD_DUAL_1_COLD] = {
  1352. USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD)
  1353. },
  1354. [DIGITALNOW_BLUEBIRD_DUAL_1_WARM] = {
  1355. USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM)
  1356. },
  1357. [DVICO_BLUEBIRD_DUAL_2_COLD] = {
  1358. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_COLD)
  1359. },
  1360. [DVICO_BLUEBIRD_DUAL_2_WARM] = {
  1361. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_WARM)
  1362. },
  1363. [DVICO_BLUEBIRD_DUAL_4] = {
  1364. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4)
  1365. },
  1366. [DVICO_BLUEBIRD_DVB_T_NANO_2] = {
  1367. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2)
  1368. },
  1369. [DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM] = {
  1370. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM)
  1371. },
  1372. [AVERMEDIA_VOLAR_A868R] = {
  1373. USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_A868R)
  1374. },
  1375. [DVICO_BLUEBIRD_DUAL_4_REV_2] = {
  1376. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4_REV_2)
  1377. },
  1378. [CONEXANT_D680_DMB] = {
  1379. USB_DEVICE(USB_VID_CONEXANT, USB_PID_CONEXANT_D680_DMB)
  1380. },
  1381. [MYGICA_D689] = {
  1382. USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_D689)
  1383. },
  1384. [MYGICA_T230] = {
  1385. USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230)
  1386. },
  1387. {} /* Terminating entry */
  1388. };
  1389. MODULE_DEVICE_TABLE (usb, cxusb_table);
  1390. static struct dvb_usb_device_properties cxusb_medion_properties = {
  1391. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1392. .usb_ctrl = CYPRESS_FX2,
  1393. .size_of_priv = sizeof(struct cxusb_state),
  1394. .num_adapters = 1,
  1395. .adapter = {
  1396. {
  1397. .num_frontends = 1,
  1398. .fe = {{
  1399. .streaming_ctrl = cxusb_streaming_ctrl,
  1400. .frontend_attach = cxusb_cx22702_frontend_attach,
  1401. .tuner_attach = cxusb_fmd1216me_tuner_attach,
  1402. /* parameter for the MPEG2-data transfer */
  1403. .stream = {
  1404. .type = USB_BULK,
  1405. .count = 5,
  1406. .endpoint = 0x02,
  1407. .u = {
  1408. .bulk = {
  1409. .buffersize = 8192,
  1410. }
  1411. }
  1412. },
  1413. }},
  1414. },
  1415. },
  1416. .power_ctrl = cxusb_power_ctrl,
  1417. .i2c_algo = &cxusb_i2c_algo,
  1418. .generic_bulk_ctrl_endpoint = 0x01,
  1419. .num_device_descs = 1,
  1420. .devices = {
  1421. { "Medion MD95700 (MDUSBTV-HYBRID)",
  1422. { NULL },
  1423. { &cxusb_table[MEDION_MD95700], NULL },
  1424. },
  1425. }
  1426. };
  1427. static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties = {
  1428. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1429. .usb_ctrl = DEVICE_SPECIFIC,
  1430. .firmware = "dvb-usb-bluebird-01.fw",
  1431. .download_firmware = bluebird_patch_dvico_firmware_download,
  1432. /* use usb alt setting 0 for EP4 transfer (dvb-t),
  1433. use usb alt setting 7 for EP2 transfer (atsc) */
  1434. .size_of_priv = sizeof(struct cxusb_state),
  1435. .num_adapters = 1,
  1436. .adapter = {
  1437. {
  1438. .num_frontends = 1,
  1439. .fe = {{
  1440. .streaming_ctrl = cxusb_streaming_ctrl,
  1441. .frontend_attach = cxusb_lgdt3303_frontend_attach,
  1442. .tuner_attach = cxusb_lgh064f_tuner_attach,
  1443. /* parameter for the MPEG2-data transfer */
  1444. .stream = {
  1445. .type = USB_BULK,
  1446. .count = 5,
  1447. .endpoint = 0x02,
  1448. .u = {
  1449. .bulk = {
  1450. .buffersize = 8192,
  1451. }
  1452. }
  1453. },
  1454. }},
  1455. },
  1456. },
  1457. .power_ctrl = cxusb_bluebird_power_ctrl,
  1458. .i2c_algo = &cxusb_i2c_algo,
  1459. .rc.legacy = {
  1460. .rc_interval = 100,
  1461. .rc_map_table = rc_map_dvico_portable_table,
  1462. .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table),
  1463. .rc_query = cxusb_rc_query,
  1464. },
  1465. .generic_bulk_ctrl_endpoint = 0x01,
  1466. .num_device_descs = 1,
  1467. .devices = {
  1468. { "DViCO FusionHDTV5 USB Gold",
  1469. { &cxusb_table[DVICO_BLUEBIRD_LG064F_COLD], NULL },
  1470. { &cxusb_table[DVICO_BLUEBIRD_LG064F_WARM], NULL },
  1471. },
  1472. }
  1473. };
  1474. static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties = {
  1475. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1476. .usb_ctrl = DEVICE_SPECIFIC,
  1477. .firmware = "dvb-usb-bluebird-01.fw",
  1478. .download_firmware = bluebird_patch_dvico_firmware_download,
  1479. /* use usb alt setting 0 for EP4 transfer (dvb-t),
  1480. use usb alt setting 7 for EP2 transfer (atsc) */
  1481. .size_of_priv = sizeof(struct cxusb_state),
  1482. .num_adapters = 1,
  1483. .adapter = {
  1484. {
  1485. .num_frontends = 1,
  1486. .fe = {{
  1487. .streaming_ctrl = cxusb_streaming_ctrl,
  1488. .frontend_attach = cxusb_dee1601_frontend_attach,
  1489. .tuner_attach = cxusb_dee1601_tuner_attach,
  1490. /* parameter for the MPEG2-data transfer */
  1491. .stream = {
  1492. .type = USB_BULK,
  1493. .count = 5,
  1494. .endpoint = 0x04,
  1495. .u = {
  1496. .bulk = {
  1497. .buffersize = 8192,
  1498. }
  1499. }
  1500. },
  1501. }},
  1502. },
  1503. },
  1504. .power_ctrl = cxusb_bluebird_power_ctrl,
  1505. .i2c_algo = &cxusb_i2c_algo,
  1506. .rc.legacy = {
  1507. .rc_interval = 150,
  1508. .rc_map_table = rc_map_dvico_mce_table,
  1509. .rc_map_size = ARRAY_SIZE(rc_map_dvico_mce_table),
  1510. .rc_query = cxusb_rc_query,
  1511. },
  1512. .generic_bulk_ctrl_endpoint = 0x01,
  1513. .num_device_descs = 3,
  1514. .devices = {
  1515. { "DViCO FusionHDTV DVB-T Dual USB",
  1516. { &cxusb_table[DVICO_BLUEBIRD_DUAL_1_COLD], NULL },
  1517. { &cxusb_table[DVICO_BLUEBIRD_DUAL_1_WARM], NULL },
  1518. },
  1519. { "DigitalNow DVB-T Dual USB",
  1520. { &cxusb_table[DIGITALNOW_BLUEBIRD_DUAL_1_COLD], NULL },
  1521. { &cxusb_table[DIGITALNOW_BLUEBIRD_DUAL_1_WARM], NULL },
  1522. },
  1523. { "DViCO FusionHDTV DVB-T Dual Digital 2",
  1524. { &cxusb_table[DVICO_BLUEBIRD_DUAL_2_COLD], NULL },
  1525. { &cxusb_table[DVICO_BLUEBIRD_DUAL_2_WARM], NULL },
  1526. },
  1527. }
  1528. };
  1529. static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = {
  1530. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1531. .usb_ctrl = DEVICE_SPECIFIC,
  1532. .firmware = "dvb-usb-bluebird-01.fw",
  1533. .download_firmware = bluebird_patch_dvico_firmware_download,
  1534. /* use usb alt setting 0 for EP4 transfer (dvb-t),
  1535. use usb alt setting 7 for EP2 transfer (atsc) */
  1536. .size_of_priv = sizeof(struct cxusb_state),
  1537. .num_adapters = 2,
  1538. .adapter = {
  1539. {
  1540. .num_frontends = 1,
  1541. .fe = {{
  1542. .streaming_ctrl = cxusb_streaming_ctrl,
  1543. .frontend_attach = cxusb_mt352_frontend_attach,
  1544. .tuner_attach = cxusb_lgz201_tuner_attach,
  1545. /* parameter for the MPEG2-data transfer */
  1546. .stream = {
  1547. .type = USB_BULK,
  1548. .count = 5,
  1549. .endpoint = 0x04,
  1550. .u = {
  1551. .bulk = {
  1552. .buffersize = 8192,
  1553. }
  1554. }
  1555. },
  1556. }},
  1557. },
  1558. },
  1559. .power_ctrl = cxusb_bluebird_power_ctrl,
  1560. .i2c_algo = &cxusb_i2c_algo,
  1561. .rc.legacy = {
  1562. .rc_interval = 100,
  1563. .rc_map_table = rc_map_dvico_portable_table,
  1564. .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table),
  1565. .rc_query = cxusb_rc_query,
  1566. },
  1567. .generic_bulk_ctrl_endpoint = 0x01,
  1568. .num_device_descs = 1,
  1569. .devices = {
  1570. { "DViCO FusionHDTV DVB-T USB (LGZ201)",
  1571. { &cxusb_table[DVICO_BLUEBIRD_LGZ201_COLD], NULL },
  1572. { &cxusb_table[DVICO_BLUEBIRD_LGZ201_WARM], NULL },
  1573. },
  1574. }
  1575. };
  1576. static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = {
  1577. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1578. .usb_ctrl = DEVICE_SPECIFIC,
  1579. .firmware = "dvb-usb-bluebird-01.fw",
  1580. .download_firmware = bluebird_patch_dvico_firmware_download,
  1581. /* use usb alt setting 0 for EP4 transfer (dvb-t),
  1582. use usb alt setting 7 for EP2 transfer (atsc) */
  1583. .size_of_priv = sizeof(struct cxusb_state),
  1584. .num_adapters = 1,
  1585. .adapter = {
  1586. {
  1587. .num_frontends = 1,
  1588. .fe = {{
  1589. .streaming_ctrl = cxusb_streaming_ctrl,
  1590. .frontend_attach = cxusb_mt352_frontend_attach,
  1591. .tuner_attach = cxusb_dtt7579_tuner_attach,
  1592. /* parameter for the MPEG2-data transfer */
  1593. .stream = {
  1594. .type = USB_BULK,
  1595. .count = 5,
  1596. .endpoint = 0x04,
  1597. .u = {
  1598. .bulk = {
  1599. .buffersize = 8192,
  1600. }
  1601. }
  1602. },
  1603. }},
  1604. },
  1605. },
  1606. .power_ctrl = cxusb_bluebird_power_ctrl,
  1607. .i2c_algo = &cxusb_i2c_algo,
  1608. .rc.legacy = {
  1609. .rc_interval = 100,
  1610. .rc_map_table = rc_map_dvico_portable_table,
  1611. .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table),
  1612. .rc_query = cxusb_rc_query,
  1613. },
  1614. .generic_bulk_ctrl_endpoint = 0x01,
  1615. .num_device_descs = 1,
  1616. .devices = {
  1617. { "DViCO FusionHDTV DVB-T USB (TH7579)",
  1618. { &cxusb_table[DVICO_BLUEBIRD_TH7579_COLD], NULL },
  1619. { &cxusb_table[DVICO_BLUEBIRD_TH7579_WARM], NULL },
  1620. },
  1621. }
  1622. };
  1623. static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties = {
  1624. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1625. .usb_ctrl = CYPRESS_FX2,
  1626. .size_of_priv = sizeof(struct cxusb_state),
  1627. .num_adapters = 1,
  1628. .adapter = {
  1629. {
  1630. .num_frontends = 1,
  1631. .fe = {{
  1632. .streaming_ctrl = cxusb_streaming_ctrl,
  1633. .frontend_attach = cxusb_dualdig4_frontend_attach,
  1634. .tuner_attach = cxusb_dvico_xc3028_tuner_attach,
  1635. /* parameter for the MPEG2-data transfer */
  1636. .stream = {
  1637. .type = USB_BULK,
  1638. .count = 5,
  1639. .endpoint = 0x02,
  1640. .u = {
  1641. .bulk = {
  1642. .buffersize = 8192,
  1643. }
  1644. }
  1645. },
  1646. }},
  1647. },
  1648. },
  1649. .power_ctrl = cxusb_power_ctrl,
  1650. .i2c_algo = &cxusb_i2c_algo,
  1651. .generic_bulk_ctrl_endpoint = 0x01,
  1652. .rc.legacy = {
  1653. .rc_interval = 100,
  1654. .rc_map_table = rc_map_dvico_mce_table,
  1655. .rc_map_size = ARRAY_SIZE(rc_map_dvico_mce_table),
  1656. .rc_query = cxusb_bluebird2_rc_query,
  1657. },
  1658. .num_device_descs = 1,
  1659. .devices = {
  1660. { "DViCO FusionHDTV DVB-T Dual Digital 4",
  1661. { NULL },
  1662. { &cxusb_table[DVICO_BLUEBIRD_DUAL_4], NULL },
  1663. },
  1664. }
  1665. };
  1666. static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties = {
  1667. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1668. .usb_ctrl = CYPRESS_FX2,
  1669. .identify_state = bluebird_fx2_identify_state,
  1670. .size_of_priv = sizeof(struct cxusb_state),
  1671. .num_adapters = 1,
  1672. .adapter = {
  1673. {
  1674. .num_frontends = 1,
  1675. .fe = {{
  1676. .streaming_ctrl = cxusb_streaming_ctrl,
  1677. .frontend_attach = cxusb_nano2_frontend_attach,
  1678. .tuner_attach = cxusb_dvico_xc3028_tuner_attach,
  1679. /* parameter for the MPEG2-data transfer */
  1680. .stream = {
  1681. .type = USB_BULK,
  1682. .count = 5,
  1683. .endpoint = 0x02,
  1684. .u = {
  1685. .bulk = {
  1686. .buffersize = 8192,
  1687. }
  1688. }
  1689. },
  1690. }},
  1691. },
  1692. },
  1693. .power_ctrl = cxusb_nano2_power_ctrl,
  1694. .i2c_algo = &cxusb_i2c_algo,
  1695. .generic_bulk_ctrl_endpoint = 0x01,
  1696. .rc.legacy = {
  1697. .rc_interval = 100,
  1698. .rc_map_table = rc_map_dvico_portable_table,
  1699. .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table),
  1700. .rc_query = cxusb_bluebird2_rc_query,
  1701. },
  1702. .num_device_descs = 1,
  1703. .devices = {
  1704. { "DViCO FusionHDTV DVB-T NANO2",
  1705. { NULL },
  1706. { &cxusb_table[DVICO_BLUEBIRD_DVB_T_NANO_2], NULL },
  1707. },
  1708. }
  1709. };
  1710. static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties = {
  1711. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1712. .usb_ctrl = DEVICE_SPECIFIC,
  1713. .firmware = "dvb-usb-bluebird-02.fw",
  1714. .download_firmware = bluebird_patch_dvico_firmware_download,
  1715. .identify_state = bluebird_fx2_identify_state,
  1716. .size_of_priv = sizeof(struct cxusb_state),
  1717. .num_adapters = 1,
  1718. .adapter = {
  1719. {
  1720. .num_frontends = 1,
  1721. .fe = {{
  1722. .streaming_ctrl = cxusb_streaming_ctrl,
  1723. .frontend_attach = cxusb_nano2_frontend_attach,
  1724. .tuner_attach = cxusb_dvico_xc3028_tuner_attach,
  1725. /* parameter for the MPEG2-data transfer */
  1726. .stream = {
  1727. .type = USB_BULK,
  1728. .count = 5,
  1729. .endpoint = 0x02,
  1730. .u = {
  1731. .bulk = {
  1732. .buffersize = 8192,
  1733. }
  1734. }
  1735. },
  1736. }},
  1737. },
  1738. },
  1739. .power_ctrl = cxusb_nano2_power_ctrl,
  1740. .i2c_algo = &cxusb_i2c_algo,
  1741. .generic_bulk_ctrl_endpoint = 0x01,
  1742. .rc.legacy = {
  1743. .rc_interval = 100,
  1744. .rc_map_table = rc_map_dvico_portable_table,
  1745. .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table),
  1746. .rc_query = cxusb_rc_query,
  1747. },
  1748. .num_device_descs = 1,
  1749. .devices = {
  1750. { "DViCO FusionHDTV DVB-T NANO2 w/o firmware",
  1751. { &cxusb_table[DVICO_BLUEBIRD_DVB_T_NANO_2], NULL },
  1752. { &cxusb_table[DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM], NULL },
  1753. },
  1754. }
  1755. };
  1756. static struct dvb_usb_device_properties cxusb_aver_a868r_properties = {
  1757. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1758. .usb_ctrl = CYPRESS_FX2,
  1759. .size_of_priv = sizeof(struct cxusb_state),
  1760. .num_adapters = 1,
  1761. .adapter = {
  1762. {
  1763. .num_frontends = 1,
  1764. .fe = {{
  1765. .streaming_ctrl = cxusb_aver_streaming_ctrl,
  1766. .frontend_attach = cxusb_aver_lgdt3303_frontend_attach,
  1767. .tuner_attach = cxusb_mxl5003s_tuner_attach,
  1768. /* parameter for the MPEG2-data transfer */
  1769. .stream = {
  1770. .type = USB_BULK,
  1771. .count = 5,
  1772. .endpoint = 0x04,
  1773. .u = {
  1774. .bulk = {
  1775. .buffersize = 8192,
  1776. }
  1777. }
  1778. },
  1779. }},
  1780. },
  1781. },
  1782. .power_ctrl = cxusb_aver_power_ctrl,
  1783. .i2c_algo = &cxusb_i2c_algo,
  1784. .generic_bulk_ctrl_endpoint = 0x01,
  1785. .num_device_descs = 1,
  1786. .devices = {
  1787. { "AVerMedia AVerTVHD Volar (A868R)",
  1788. { NULL },
  1789. { &cxusb_table[AVERMEDIA_VOLAR_A868R], NULL },
  1790. },
  1791. }
  1792. };
  1793. static
  1794. struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties = {
  1795. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1796. .usb_ctrl = CYPRESS_FX2,
  1797. .size_of_priv = sizeof(struct cxusb_state),
  1798. .num_adapters = 1,
  1799. .adapter = {
  1800. {
  1801. .size_of_priv = sizeof(struct dib0700_adapter_state),
  1802. .num_frontends = 1,
  1803. .fe = {{
  1804. .streaming_ctrl = cxusb_streaming_ctrl,
  1805. .frontend_attach = cxusb_dualdig4_rev2_frontend_attach,
  1806. .tuner_attach = cxusb_dualdig4_rev2_tuner_attach,
  1807. /* parameter for the MPEG2-data transfer */
  1808. .stream = {
  1809. .type = USB_BULK,
  1810. .count = 7,
  1811. .endpoint = 0x02,
  1812. .u = {
  1813. .bulk = {
  1814. .buffersize = 4096,
  1815. }
  1816. }
  1817. },
  1818. }},
  1819. },
  1820. },
  1821. .power_ctrl = cxusb_bluebird_power_ctrl,
  1822. .i2c_algo = &cxusb_i2c_algo,
  1823. .generic_bulk_ctrl_endpoint = 0x01,
  1824. .rc.legacy = {
  1825. .rc_interval = 100,
  1826. .rc_map_table = rc_map_dvico_mce_table,
  1827. .rc_map_size = ARRAY_SIZE(rc_map_dvico_mce_table),
  1828. .rc_query = cxusb_rc_query,
  1829. },
  1830. .num_device_descs = 1,
  1831. .devices = {
  1832. { "DViCO FusionHDTV DVB-T Dual Digital 4 (rev 2)",
  1833. { NULL },
  1834. { &cxusb_table[DVICO_BLUEBIRD_DUAL_4_REV_2], NULL },
  1835. },
  1836. }
  1837. };
  1838. static struct dvb_usb_device_properties cxusb_d680_dmb_properties = {
  1839. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1840. .usb_ctrl = CYPRESS_FX2,
  1841. .size_of_priv = sizeof(struct cxusb_state),
  1842. .num_adapters = 1,
  1843. .adapter = {
  1844. {
  1845. .num_frontends = 1,
  1846. .fe = {{
  1847. .streaming_ctrl = cxusb_d680_dmb_streaming_ctrl,
  1848. .frontend_attach = cxusb_d680_dmb_frontend_attach,
  1849. .tuner_attach = cxusb_d680_dmb_tuner_attach,
  1850. /* parameter for the MPEG2-data transfer */
  1851. .stream = {
  1852. .type = USB_BULK,
  1853. .count = 5,
  1854. .endpoint = 0x02,
  1855. .u = {
  1856. .bulk = {
  1857. .buffersize = 8192,
  1858. }
  1859. }
  1860. },
  1861. }},
  1862. },
  1863. },
  1864. .power_ctrl = cxusb_d680_dmb_power_ctrl,
  1865. .i2c_algo = &cxusb_i2c_algo,
  1866. .generic_bulk_ctrl_endpoint = 0x01,
  1867. .rc.legacy = {
  1868. .rc_interval = 100,
  1869. .rc_map_table = rc_map_d680_dmb_table,
  1870. .rc_map_size = ARRAY_SIZE(rc_map_d680_dmb_table),
  1871. .rc_query = cxusb_d680_dmb_rc_query,
  1872. },
  1873. .num_device_descs = 1,
  1874. .devices = {
  1875. {
  1876. "Conexant DMB-TH Stick",
  1877. { NULL },
  1878. { &cxusb_table[CONEXANT_D680_DMB], NULL },
  1879. },
  1880. }
  1881. };
  1882. static struct dvb_usb_device_properties cxusb_mygica_d689_properties = {
  1883. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1884. .usb_ctrl = CYPRESS_FX2,
  1885. .size_of_priv = sizeof(struct cxusb_state),
  1886. .num_adapters = 1,
  1887. .adapter = {
  1888. {
  1889. .num_frontends = 1,
  1890. .fe = {{
  1891. .streaming_ctrl = cxusb_d680_dmb_streaming_ctrl,
  1892. .frontend_attach = cxusb_mygica_d689_frontend_attach,
  1893. .tuner_attach = cxusb_mygica_d689_tuner_attach,
  1894. /* parameter for the MPEG2-data transfer */
  1895. .stream = {
  1896. .type = USB_BULK,
  1897. .count = 5,
  1898. .endpoint = 0x02,
  1899. .u = {
  1900. .bulk = {
  1901. .buffersize = 8192,
  1902. }
  1903. }
  1904. },
  1905. }},
  1906. },
  1907. },
  1908. .power_ctrl = cxusb_d680_dmb_power_ctrl,
  1909. .i2c_algo = &cxusb_i2c_algo,
  1910. .generic_bulk_ctrl_endpoint = 0x01,
  1911. .rc.legacy = {
  1912. .rc_interval = 100,
  1913. .rc_map_table = rc_map_d680_dmb_table,
  1914. .rc_map_size = ARRAY_SIZE(rc_map_d680_dmb_table),
  1915. .rc_query = cxusb_d680_dmb_rc_query,
  1916. },
  1917. .num_device_descs = 1,
  1918. .devices = {
  1919. {
  1920. "Mygica D689 DMB-TH",
  1921. { NULL },
  1922. { &cxusb_table[MYGICA_D689], NULL },
  1923. },
  1924. }
  1925. };
  1926. static struct dvb_usb_device_properties cxusb_mygica_t230_properties = {
  1927. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1928. .usb_ctrl = CYPRESS_FX2,
  1929. .size_of_priv = sizeof(struct cxusb_state),
  1930. .num_adapters = 1,
  1931. .adapter = {
  1932. {
  1933. .num_frontends = 1,
  1934. .fe = {{
  1935. .streaming_ctrl = cxusb_streaming_ctrl,
  1936. .frontend_attach = cxusb_mygica_t230_frontend_attach,
  1937. /* parameter for the MPEG2-data transfer */
  1938. .stream = {
  1939. .type = USB_BULK,
  1940. .count = 5,
  1941. .endpoint = 0x02,
  1942. .u = {
  1943. .bulk = {
  1944. .buffersize = 8192,
  1945. }
  1946. }
  1947. },
  1948. } },
  1949. },
  1950. },
  1951. .power_ctrl = cxusb_d680_dmb_power_ctrl,
  1952. .i2c_algo = &cxusb_i2c_algo,
  1953. .generic_bulk_ctrl_endpoint = 0x01,
  1954. .rc.legacy = {
  1955. .rc_interval = 100,
  1956. .rc_map_table = rc_map_d680_dmb_table,
  1957. .rc_map_size = ARRAY_SIZE(rc_map_d680_dmb_table),
  1958. .rc_query = cxusb_d680_dmb_rc_query,
  1959. },
  1960. .num_device_descs = 1,
  1961. .devices = {
  1962. {
  1963. "Mygica T230 DVB-T/T2/C",
  1964. { NULL },
  1965. { &cxusb_table[MYGICA_T230], NULL },
  1966. },
  1967. }
  1968. };
  1969. static struct usb_driver cxusb_driver = {
  1970. .name = "dvb_usb_cxusb",
  1971. .probe = cxusb_probe,
  1972. .disconnect = cxusb_disconnect,
  1973. .id_table = cxusb_table,
  1974. };
  1975. module_usb_driver(cxusb_driver);
  1976. MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
  1977. MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>");
  1978. MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
  1979. MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design");
  1980. MODULE_VERSION("1.0-alpha");
  1981. MODULE_LICENSE("GPL");