cxusb.c 59 KB

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