cxusb.c 58 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321
  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. memset(&info, 0, sizeof(struct i2c_board_info));
  1157. strlcpy(info.type, "si2157", I2C_NAME_SIZE);
  1158. info.addr = 0x60;
  1159. info.platform_data = &si2157_config;
  1160. request_module(info.type);
  1161. client_tuner = i2c_new_device(adapter, &info);
  1162. if (client_tuner == NULL || client_tuner->dev.driver == NULL) {
  1163. module_put(client_demod->dev.driver->owner);
  1164. i2c_unregister_device(client_demod);
  1165. return -ENODEV;
  1166. }
  1167. if (!try_module_get(client_tuner->dev.driver->owner)) {
  1168. i2c_unregister_device(client_tuner);
  1169. module_put(client_demod->dev.driver->owner);
  1170. i2c_unregister_device(client_demod);
  1171. return -ENODEV;
  1172. }
  1173. st->i2c_client_tuner = client_tuner;
  1174. return 0;
  1175. }
  1176. /*
  1177. * DViCO has shipped two devices with the same USB ID, but only one of them
  1178. * needs a firmware download. Check the device class details to see if they
  1179. * have non-default values to decide whether the device is actually cold or
  1180. * not, and forget a match if it turns out we selected the wrong device.
  1181. */
  1182. static int bluebird_fx2_identify_state(struct usb_device *udev,
  1183. struct dvb_usb_device_properties *props,
  1184. struct dvb_usb_device_description **desc,
  1185. int *cold)
  1186. {
  1187. int wascold = *cold;
  1188. *cold = udev->descriptor.bDeviceClass == 0xff &&
  1189. udev->descriptor.bDeviceSubClass == 0xff &&
  1190. udev->descriptor.bDeviceProtocol == 0xff;
  1191. if (*cold && !wascold)
  1192. *desc = NULL;
  1193. return 0;
  1194. }
  1195. /*
  1196. * DViCO bluebird firmware needs the "warm" product ID to be patched into the
  1197. * firmware file before download.
  1198. */
  1199. static const int dvico_firmware_id_offsets[] = { 6638, 3204 };
  1200. static int bluebird_patch_dvico_firmware_download(struct usb_device *udev,
  1201. const struct firmware *fw)
  1202. {
  1203. int pos;
  1204. for (pos = 0; pos < ARRAY_SIZE(dvico_firmware_id_offsets); pos++) {
  1205. int idoff = dvico_firmware_id_offsets[pos];
  1206. if (fw->size < idoff + 4)
  1207. continue;
  1208. if (fw->data[idoff] == (USB_VID_DVICO & 0xff) &&
  1209. fw->data[idoff + 1] == USB_VID_DVICO >> 8) {
  1210. struct firmware new_fw;
  1211. u8 *new_fw_data = vmalloc(fw->size);
  1212. int ret;
  1213. if (!new_fw_data)
  1214. return -ENOMEM;
  1215. memcpy(new_fw_data, fw->data, fw->size);
  1216. new_fw.size = fw->size;
  1217. new_fw.data = new_fw_data;
  1218. new_fw_data[idoff + 2] =
  1219. le16_to_cpu(udev->descriptor.idProduct) + 1;
  1220. new_fw_data[idoff + 3] =
  1221. le16_to_cpu(udev->descriptor.idProduct) >> 8;
  1222. ret = usb_cypress_load_firmware(udev, &new_fw,
  1223. CYPRESS_FX2);
  1224. vfree(new_fw_data);
  1225. return ret;
  1226. }
  1227. }
  1228. return -EINVAL;
  1229. }
  1230. /* DVB USB Driver stuff */
  1231. static struct dvb_usb_device_properties cxusb_medion_properties;
  1232. static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties;
  1233. static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties;
  1234. static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties;
  1235. static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties;
  1236. static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties;
  1237. static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties;
  1238. static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties;
  1239. static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties;
  1240. static struct dvb_usb_device_properties cxusb_aver_a868r_properties;
  1241. static struct dvb_usb_device_properties cxusb_d680_dmb_properties;
  1242. static struct dvb_usb_device_properties cxusb_mygica_d689_properties;
  1243. static struct dvb_usb_device_properties cxusb_mygica_t230_properties;
  1244. static int cxusb_probe(struct usb_interface *intf,
  1245. const struct usb_device_id *id)
  1246. {
  1247. if (0 == dvb_usb_device_init(intf, &cxusb_medion_properties,
  1248. THIS_MODULE, NULL, adapter_nr) ||
  1249. 0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgh064f_properties,
  1250. THIS_MODULE, NULL, adapter_nr) ||
  1251. 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dee1601_properties,
  1252. THIS_MODULE, NULL, adapter_nr) ||
  1253. 0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgz201_properties,
  1254. THIS_MODULE, NULL, adapter_nr) ||
  1255. 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dtt7579_properties,
  1256. THIS_MODULE, NULL, adapter_nr) ||
  1257. 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dualdig4_properties,
  1258. THIS_MODULE, NULL, adapter_nr) ||
  1259. 0 == dvb_usb_device_init(intf, &cxusb_bluebird_nano2_properties,
  1260. THIS_MODULE, NULL, adapter_nr) ||
  1261. 0 == dvb_usb_device_init(intf,
  1262. &cxusb_bluebird_nano2_needsfirmware_properties,
  1263. THIS_MODULE, NULL, adapter_nr) ||
  1264. 0 == dvb_usb_device_init(intf, &cxusb_aver_a868r_properties,
  1265. THIS_MODULE, NULL, adapter_nr) ||
  1266. 0 == dvb_usb_device_init(intf,
  1267. &cxusb_bluebird_dualdig4_rev2_properties,
  1268. THIS_MODULE, NULL, adapter_nr) ||
  1269. 0 == dvb_usb_device_init(intf, &cxusb_d680_dmb_properties,
  1270. THIS_MODULE, NULL, adapter_nr) ||
  1271. 0 == dvb_usb_device_init(intf, &cxusb_mygica_d689_properties,
  1272. THIS_MODULE, NULL, adapter_nr) ||
  1273. 0 == dvb_usb_device_init(intf, &cxusb_mygica_t230_properties,
  1274. THIS_MODULE, NULL, adapter_nr) ||
  1275. 0)
  1276. return 0;
  1277. return -EINVAL;
  1278. }
  1279. static void cxusb_disconnect(struct usb_interface *intf)
  1280. {
  1281. struct dvb_usb_device *d = usb_get_intfdata(intf);
  1282. struct cxusb_state *st = d->priv;
  1283. struct i2c_client *client;
  1284. /* remove I2C client for tuner */
  1285. client = st->i2c_client_tuner;
  1286. if (client) {
  1287. module_put(client->dev.driver->owner);
  1288. i2c_unregister_device(client);
  1289. }
  1290. /* remove I2C client for demodulator */
  1291. client = st->i2c_client_demod;
  1292. if (client) {
  1293. module_put(client->dev.driver->owner);
  1294. i2c_unregister_device(client);
  1295. }
  1296. dvb_usb_device_exit(intf);
  1297. }
  1298. enum cxusb_table_index {
  1299. MEDION_MD95700,
  1300. DVICO_BLUEBIRD_LG064F_COLD,
  1301. DVICO_BLUEBIRD_LG064F_WARM,
  1302. DVICO_BLUEBIRD_DUAL_1_COLD,
  1303. DVICO_BLUEBIRD_DUAL_1_WARM,
  1304. DVICO_BLUEBIRD_LGZ201_COLD,
  1305. DVICO_BLUEBIRD_LGZ201_WARM,
  1306. DVICO_BLUEBIRD_TH7579_COLD,
  1307. DVICO_BLUEBIRD_TH7579_WARM,
  1308. DIGITALNOW_BLUEBIRD_DUAL_1_COLD,
  1309. DIGITALNOW_BLUEBIRD_DUAL_1_WARM,
  1310. DVICO_BLUEBIRD_DUAL_2_COLD,
  1311. DVICO_BLUEBIRD_DUAL_2_WARM,
  1312. DVICO_BLUEBIRD_DUAL_4,
  1313. DVICO_BLUEBIRD_DVB_T_NANO_2,
  1314. DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM,
  1315. AVERMEDIA_VOLAR_A868R,
  1316. DVICO_BLUEBIRD_DUAL_4_REV_2,
  1317. CONEXANT_D680_DMB,
  1318. MYGICA_D689,
  1319. MYGICA_T230,
  1320. NR__cxusb_table_index
  1321. };
  1322. static struct usb_device_id cxusb_table[NR__cxusb_table_index + 1] = {
  1323. [MEDION_MD95700] = {
  1324. USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700)
  1325. },
  1326. [DVICO_BLUEBIRD_LG064F_COLD] = {
  1327. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_COLD)
  1328. },
  1329. [DVICO_BLUEBIRD_LG064F_WARM] = {
  1330. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_WARM)
  1331. },
  1332. [DVICO_BLUEBIRD_DUAL_1_COLD] = {
  1333. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_COLD)
  1334. },
  1335. [DVICO_BLUEBIRD_DUAL_1_WARM] = {
  1336. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_WARM)
  1337. },
  1338. [DVICO_BLUEBIRD_LGZ201_COLD] = {
  1339. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD)
  1340. },
  1341. [DVICO_BLUEBIRD_LGZ201_WARM] = {
  1342. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM)
  1343. },
  1344. [DVICO_BLUEBIRD_TH7579_COLD] = {
  1345. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_COLD)
  1346. },
  1347. [DVICO_BLUEBIRD_TH7579_WARM] = {
  1348. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_WARM)
  1349. },
  1350. [DIGITALNOW_BLUEBIRD_DUAL_1_COLD] = {
  1351. USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD)
  1352. },
  1353. [DIGITALNOW_BLUEBIRD_DUAL_1_WARM] = {
  1354. USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM)
  1355. },
  1356. [DVICO_BLUEBIRD_DUAL_2_COLD] = {
  1357. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_COLD)
  1358. },
  1359. [DVICO_BLUEBIRD_DUAL_2_WARM] = {
  1360. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_WARM)
  1361. },
  1362. [DVICO_BLUEBIRD_DUAL_4] = {
  1363. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4)
  1364. },
  1365. [DVICO_BLUEBIRD_DVB_T_NANO_2] = {
  1366. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2)
  1367. },
  1368. [DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM] = {
  1369. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM)
  1370. },
  1371. [AVERMEDIA_VOLAR_A868R] = {
  1372. USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_A868R)
  1373. },
  1374. [DVICO_BLUEBIRD_DUAL_4_REV_2] = {
  1375. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4_REV_2)
  1376. },
  1377. [CONEXANT_D680_DMB] = {
  1378. USB_DEVICE(USB_VID_CONEXANT, USB_PID_CONEXANT_D680_DMB)
  1379. },
  1380. [MYGICA_D689] = {
  1381. USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_D689)
  1382. },
  1383. [MYGICA_T230] = {
  1384. USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230)
  1385. },
  1386. {} /* Terminating entry */
  1387. };
  1388. MODULE_DEVICE_TABLE (usb, cxusb_table);
  1389. static struct dvb_usb_device_properties cxusb_medion_properties = {
  1390. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1391. .usb_ctrl = CYPRESS_FX2,
  1392. .size_of_priv = sizeof(struct cxusb_state),
  1393. .num_adapters = 1,
  1394. .adapter = {
  1395. {
  1396. .num_frontends = 1,
  1397. .fe = {{
  1398. .streaming_ctrl = cxusb_streaming_ctrl,
  1399. .frontend_attach = cxusb_cx22702_frontend_attach,
  1400. .tuner_attach = cxusb_fmd1216me_tuner_attach,
  1401. /* parameter for the MPEG2-data transfer */
  1402. .stream = {
  1403. .type = USB_BULK,
  1404. .count = 5,
  1405. .endpoint = 0x02,
  1406. .u = {
  1407. .bulk = {
  1408. .buffersize = 8192,
  1409. }
  1410. }
  1411. },
  1412. }},
  1413. },
  1414. },
  1415. .power_ctrl = cxusb_power_ctrl,
  1416. .i2c_algo = &cxusb_i2c_algo,
  1417. .generic_bulk_ctrl_endpoint = 0x01,
  1418. .num_device_descs = 1,
  1419. .devices = {
  1420. { "Medion MD95700 (MDUSBTV-HYBRID)",
  1421. { NULL },
  1422. { &cxusb_table[MEDION_MD95700], NULL },
  1423. },
  1424. }
  1425. };
  1426. static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties = {
  1427. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1428. .usb_ctrl = DEVICE_SPECIFIC,
  1429. .firmware = "dvb-usb-bluebird-01.fw",
  1430. .download_firmware = bluebird_patch_dvico_firmware_download,
  1431. /* use usb alt setting 0 for EP4 transfer (dvb-t),
  1432. use usb alt setting 7 for EP2 transfer (atsc) */
  1433. .size_of_priv = sizeof(struct cxusb_state),
  1434. .num_adapters = 1,
  1435. .adapter = {
  1436. {
  1437. .num_frontends = 1,
  1438. .fe = {{
  1439. .streaming_ctrl = cxusb_streaming_ctrl,
  1440. .frontend_attach = cxusb_lgdt3303_frontend_attach,
  1441. .tuner_attach = cxusb_lgh064f_tuner_attach,
  1442. /* parameter for the MPEG2-data transfer */
  1443. .stream = {
  1444. .type = USB_BULK,
  1445. .count = 5,
  1446. .endpoint = 0x02,
  1447. .u = {
  1448. .bulk = {
  1449. .buffersize = 8192,
  1450. }
  1451. }
  1452. },
  1453. }},
  1454. },
  1455. },
  1456. .power_ctrl = cxusb_bluebird_power_ctrl,
  1457. .i2c_algo = &cxusb_i2c_algo,
  1458. .rc.legacy = {
  1459. .rc_interval = 100,
  1460. .rc_map_table = rc_map_dvico_portable_table,
  1461. .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table),
  1462. .rc_query = cxusb_rc_query,
  1463. },
  1464. .generic_bulk_ctrl_endpoint = 0x01,
  1465. .num_device_descs = 1,
  1466. .devices = {
  1467. { "DViCO FusionHDTV5 USB Gold",
  1468. { &cxusb_table[DVICO_BLUEBIRD_LG064F_COLD], NULL },
  1469. { &cxusb_table[DVICO_BLUEBIRD_LG064F_WARM], NULL },
  1470. },
  1471. }
  1472. };
  1473. static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties = {
  1474. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1475. .usb_ctrl = DEVICE_SPECIFIC,
  1476. .firmware = "dvb-usb-bluebird-01.fw",
  1477. .download_firmware = bluebird_patch_dvico_firmware_download,
  1478. /* use usb alt setting 0 for EP4 transfer (dvb-t),
  1479. use usb alt setting 7 for EP2 transfer (atsc) */
  1480. .size_of_priv = sizeof(struct cxusb_state),
  1481. .num_adapters = 1,
  1482. .adapter = {
  1483. {
  1484. .num_frontends = 1,
  1485. .fe = {{
  1486. .streaming_ctrl = cxusb_streaming_ctrl,
  1487. .frontend_attach = cxusb_dee1601_frontend_attach,
  1488. .tuner_attach = cxusb_dee1601_tuner_attach,
  1489. /* parameter for the MPEG2-data transfer */
  1490. .stream = {
  1491. .type = USB_BULK,
  1492. .count = 5,
  1493. .endpoint = 0x04,
  1494. .u = {
  1495. .bulk = {
  1496. .buffersize = 8192,
  1497. }
  1498. }
  1499. },
  1500. }},
  1501. },
  1502. },
  1503. .power_ctrl = cxusb_bluebird_power_ctrl,
  1504. .i2c_algo = &cxusb_i2c_algo,
  1505. .rc.legacy = {
  1506. .rc_interval = 150,
  1507. .rc_map_table = rc_map_dvico_mce_table,
  1508. .rc_map_size = ARRAY_SIZE(rc_map_dvico_mce_table),
  1509. .rc_query = cxusb_rc_query,
  1510. },
  1511. .generic_bulk_ctrl_endpoint = 0x01,
  1512. .num_device_descs = 3,
  1513. .devices = {
  1514. { "DViCO FusionHDTV DVB-T Dual USB",
  1515. { &cxusb_table[DVICO_BLUEBIRD_DUAL_1_COLD], NULL },
  1516. { &cxusb_table[DVICO_BLUEBIRD_DUAL_1_WARM], NULL },
  1517. },
  1518. { "DigitalNow DVB-T Dual USB",
  1519. { &cxusb_table[DIGITALNOW_BLUEBIRD_DUAL_1_COLD], NULL },
  1520. { &cxusb_table[DIGITALNOW_BLUEBIRD_DUAL_1_WARM], NULL },
  1521. },
  1522. { "DViCO FusionHDTV DVB-T Dual Digital 2",
  1523. { &cxusb_table[DVICO_BLUEBIRD_DUAL_2_COLD], NULL },
  1524. { &cxusb_table[DVICO_BLUEBIRD_DUAL_2_WARM], NULL },
  1525. },
  1526. }
  1527. };
  1528. static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = {
  1529. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1530. .usb_ctrl = DEVICE_SPECIFIC,
  1531. .firmware = "dvb-usb-bluebird-01.fw",
  1532. .download_firmware = bluebird_patch_dvico_firmware_download,
  1533. /* use usb alt setting 0 for EP4 transfer (dvb-t),
  1534. use usb alt setting 7 for EP2 transfer (atsc) */
  1535. .size_of_priv = sizeof(struct cxusb_state),
  1536. .num_adapters = 2,
  1537. .adapter = {
  1538. {
  1539. .num_frontends = 1,
  1540. .fe = {{
  1541. .streaming_ctrl = cxusb_streaming_ctrl,
  1542. .frontend_attach = cxusb_mt352_frontend_attach,
  1543. .tuner_attach = cxusb_lgz201_tuner_attach,
  1544. /* parameter for the MPEG2-data transfer */
  1545. .stream = {
  1546. .type = USB_BULK,
  1547. .count = 5,
  1548. .endpoint = 0x04,
  1549. .u = {
  1550. .bulk = {
  1551. .buffersize = 8192,
  1552. }
  1553. }
  1554. },
  1555. }},
  1556. },
  1557. },
  1558. .power_ctrl = cxusb_bluebird_power_ctrl,
  1559. .i2c_algo = &cxusb_i2c_algo,
  1560. .rc.legacy = {
  1561. .rc_interval = 100,
  1562. .rc_map_table = rc_map_dvico_portable_table,
  1563. .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table),
  1564. .rc_query = cxusb_rc_query,
  1565. },
  1566. .generic_bulk_ctrl_endpoint = 0x01,
  1567. .num_device_descs = 1,
  1568. .devices = {
  1569. { "DViCO FusionHDTV DVB-T USB (LGZ201)",
  1570. { &cxusb_table[DVICO_BLUEBIRD_LGZ201_COLD], NULL },
  1571. { &cxusb_table[DVICO_BLUEBIRD_LGZ201_WARM], NULL },
  1572. },
  1573. }
  1574. };
  1575. static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = {
  1576. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1577. .usb_ctrl = DEVICE_SPECIFIC,
  1578. .firmware = "dvb-usb-bluebird-01.fw",
  1579. .download_firmware = bluebird_patch_dvico_firmware_download,
  1580. /* use usb alt setting 0 for EP4 transfer (dvb-t),
  1581. use usb alt setting 7 for EP2 transfer (atsc) */
  1582. .size_of_priv = sizeof(struct cxusb_state),
  1583. .num_adapters = 1,
  1584. .adapter = {
  1585. {
  1586. .num_frontends = 1,
  1587. .fe = {{
  1588. .streaming_ctrl = cxusb_streaming_ctrl,
  1589. .frontend_attach = cxusb_mt352_frontend_attach,
  1590. .tuner_attach = cxusb_dtt7579_tuner_attach,
  1591. /* parameter for the MPEG2-data transfer */
  1592. .stream = {
  1593. .type = USB_BULK,
  1594. .count = 5,
  1595. .endpoint = 0x04,
  1596. .u = {
  1597. .bulk = {
  1598. .buffersize = 8192,
  1599. }
  1600. }
  1601. },
  1602. }},
  1603. },
  1604. },
  1605. .power_ctrl = cxusb_bluebird_power_ctrl,
  1606. .i2c_algo = &cxusb_i2c_algo,
  1607. .rc.legacy = {
  1608. .rc_interval = 100,
  1609. .rc_map_table = rc_map_dvico_portable_table,
  1610. .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table),
  1611. .rc_query = cxusb_rc_query,
  1612. },
  1613. .generic_bulk_ctrl_endpoint = 0x01,
  1614. .num_device_descs = 1,
  1615. .devices = {
  1616. { "DViCO FusionHDTV DVB-T USB (TH7579)",
  1617. { &cxusb_table[DVICO_BLUEBIRD_TH7579_COLD], NULL },
  1618. { &cxusb_table[DVICO_BLUEBIRD_TH7579_WARM], NULL },
  1619. },
  1620. }
  1621. };
  1622. static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties = {
  1623. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1624. .usb_ctrl = CYPRESS_FX2,
  1625. .size_of_priv = sizeof(struct cxusb_state),
  1626. .num_adapters = 1,
  1627. .adapter = {
  1628. {
  1629. .num_frontends = 1,
  1630. .fe = {{
  1631. .streaming_ctrl = cxusb_streaming_ctrl,
  1632. .frontend_attach = cxusb_dualdig4_frontend_attach,
  1633. .tuner_attach = cxusb_dvico_xc3028_tuner_attach,
  1634. /* parameter for the MPEG2-data transfer */
  1635. .stream = {
  1636. .type = USB_BULK,
  1637. .count = 5,
  1638. .endpoint = 0x02,
  1639. .u = {
  1640. .bulk = {
  1641. .buffersize = 8192,
  1642. }
  1643. }
  1644. },
  1645. }},
  1646. },
  1647. },
  1648. .power_ctrl = cxusb_power_ctrl,
  1649. .i2c_algo = &cxusb_i2c_algo,
  1650. .generic_bulk_ctrl_endpoint = 0x01,
  1651. .rc.legacy = {
  1652. .rc_interval = 100,
  1653. .rc_map_table = rc_map_dvico_mce_table,
  1654. .rc_map_size = ARRAY_SIZE(rc_map_dvico_mce_table),
  1655. .rc_query = cxusb_bluebird2_rc_query,
  1656. },
  1657. .num_device_descs = 1,
  1658. .devices = {
  1659. { "DViCO FusionHDTV DVB-T Dual Digital 4",
  1660. { NULL },
  1661. { &cxusb_table[DVICO_BLUEBIRD_DUAL_4], NULL },
  1662. },
  1663. }
  1664. };
  1665. static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties = {
  1666. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1667. .usb_ctrl = CYPRESS_FX2,
  1668. .identify_state = bluebird_fx2_identify_state,
  1669. .size_of_priv = sizeof(struct cxusb_state),
  1670. .num_adapters = 1,
  1671. .adapter = {
  1672. {
  1673. .num_frontends = 1,
  1674. .fe = {{
  1675. .streaming_ctrl = cxusb_streaming_ctrl,
  1676. .frontend_attach = cxusb_nano2_frontend_attach,
  1677. .tuner_attach = cxusb_dvico_xc3028_tuner_attach,
  1678. /* parameter for the MPEG2-data transfer */
  1679. .stream = {
  1680. .type = USB_BULK,
  1681. .count = 5,
  1682. .endpoint = 0x02,
  1683. .u = {
  1684. .bulk = {
  1685. .buffersize = 8192,
  1686. }
  1687. }
  1688. },
  1689. }},
  1690. },
  1691. },
  1692. .power_ctrl = cxusb_nano2_power_ctrl,
  1693. .i2c_algo = &cxusb_i2c_algo,
  1694. .generic_bulk_ctrl_endpoint = 0x01,
  1695. .rc.legacy = {
  1696. .rc_interval = 100,
  1697. .rc_map_table = rc_map_dvico_portable_table,
  1698. .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table),
  1699. .rc_query = cxusb_bluebird2_rc_query,
  1700. },
  1701. .num_device_descs = 1,
  1702. .devices = {
  1703. { "DViCO FusionHDTV DVB-T NANO2",
  1704. { NULL },
  1705. { &cxusb_table[DVICO_BLUEBIRD_DVB_T_NANO_2], NULL },
  1706. },
  1707. }
  1708. };
  1709. static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties = {
  1710. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1711. .usb_ctrl = DEVICE_SPECIFIC,
  1712. .firmware = "dvb-usb-bluebird-02.fw",
  1713. .download_firmware = bluebird_patch_dvico_firmware_download,
  1714. .identify_state = bluebird_fx2_identify_state,
  1715. .size_of_priv = sizeof(struct cxusb_state),
  1716. .num_adapters = 1,
  1717. .adapter = {
  1718. {
  1719. .num_frontends = 1,
  1720. .fe = {{
  1721. .streaming_ctrl = cxusb_streaming_ctrl,
  1722. .frontend_attach = cxusb_nano2_frontend_attach,
  1723. .tuner_attach = cxusb_dvico_xc3028_tuner_attach,
  1724. /* parameter for the MPEG2-data transfer */
  1725. .stream = {
  1726. .type = USB_BULK,
  1727. .count = 5,
  1728. .endpoint = 0x02,
  1729. .u = {
  1730. .bulk = {
  1731. .buffersize = 8192,
  1732. }
  1733. }
  1734. },
  1735. }},
  1736. },
  1737. },
  1738. .power_ctrl = cxusb_nano2_power_ctrl,
  1739. .i2c_algo = &cxusb_i2c_algo,
  1740. .generic_bulk_ctrl_endpoint = 0x01,
  1741. .rc.legacy = {
  1742. .rc_interval = 100,
  1743. .rc_map_table = rc_map_dvico_portable_table,
  1744. .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table),
  1745. .rc_query = cxusb_rc_query,
  1746. },
  1747. .num_device_descs = 1,
  1748. .devices = {
  1749. { "DViCO FusionHDTV DVB-T NANO2 w/o firmware",
  1750. { &cxusb_table[DVICO_BLUEBIRD_DVB_T_NANO_2], NULL },
  1751. { &cxusb_table[DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM], NULL },
  1752. },
  1753. }
  1754. };
  1755. static struct dvb_usb_device_properties cxusb_aver_a868r_properties = {
  1756. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1757. .usb_ctrl = CYPRESS_FX2,
  1758. .size_of_priv = sizeof(struct cxusb_state),
  1759. .num_adapters = 1,
  1760. .adapter = {
  1761. {
  1762. .num_frontends = 1,
  1763. .fe = {{
  1764. .streaming_ctrl = cxusb_aver_streaming_ctrl,
  1765. .frontend_attach = cxusb_aver_lgdt3303_frontend_attach,
  1766. .tuner_attach = cxusb_mxl5003s_tuner_attach,
  1767. /* parameter for the MPEG2-data transfer */
  1768. .stream = {
  1769. .type = USB_BULK,
  1770. .count = 5,
  1771. .endpoint = 0x04,
  1772. .u = {
  1773. .bulk = {
  1774. .buffersize = 8192,
  1775. }
  1776. }
  1777. },
  1778. }},
  1779. },
  1780. },
  1781. .power_ctrl = cxusb_aver_power_ctrl,
  1782. .i2c_algo = &cxusb_i2c_algo,
  1783. .generic_bulk_ctrl_endpoint = 0x01,
  1784. .num_device_descs = 1,
  1785. .devices = {
  1786. { "AVerMedia AVerTVHD Volar (A868R)",
  1787. { NULL },
  1788. { &cxusb_table[AVERMEDIA_VOLAR_A868R], NULL },
  1789. },
  1790. }
  1791. };
  1792. static
  1793. struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties = {
  1794. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1795. .usb_ctrl = CYPRESS_FX2,
  1796. .size_of_priv = sizeof(struct cxusb_state),
  1797. .num_adapters = 1,
  1798. .adapter = {
  1799. {
  1800. .size_of_priv = sizeof(struct dib0700_adapter_state),
  1801. .num_frontends = 1,
  1802. .fe = {{
  1803. .streaming_ctrl = cxusb_streaming_ctrl,
  1804. .frontend_attach = cxusb_dualdig4_rev2_frontend_attach,
  1805. .tuner_attach = cxusb_dualdig4_rev2_tuner_attach,
  1806. /* parameter for the MPEG2-data transfer */
  1807. .stream = {
  1808. .type = USB_BULK,
  1809. .count = 7,
  1810. .endpoint = 0x02,
  1811. .u = {
  1812. .bulk = {
  1813. .buffersize = 4096,
  1814. }
  1815. }
  1816. },
  1817. }},
  1818. },
  1819. },
  1820. .power_ctrl = cxusb_bluebird_power_ctrl,
  1821. .i2c_algo = &cxusb_i2c_algo,
  1822. .generic_bulk_ctrl_endpoint = 0x01,
  1823. .rc.legacy = {
  1824. .rc_interval = 100,
  1825. .rc_map_table = rc_map_dvico_mce_table,
  1826. .rc_map_size = ARRAY_SIZE(rc_map_dvico_mce_table),
  1827. .rc_query = cxusb_rc_query,
  1828. },
  1829. .num_device_descs = 1,
  1830. .devices = {
  1831. { "DViCO FusionHDTV DVB-T Dual Digital 4 (rev 2)",
  1832. { NULL },
  1833. { &cxusb_table[DVICO_BLUEBIRD_DUAL_4_REV_2], NULL },
  1834. },
  1835. }
  1836. };
  1837. static struct dvb_usb_device_properties cxusb_d680_dmb_properties = {
  1838. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1839. .usb_ctrl = CYPRESS_FX2,
  1840. .size_of_priv = sizeof(struct cxusb_state),
  1841. .num_adapters = 1,
  1842. .adapter = {
  1843. {
  1844. .num_frontends = 1,
  1845. .fe = {{
  1846. .streaming_ctrl = cxusb_d680_dmb_streaming_ctrl,
  1847. .frontend_attach = cxusb_d680_dmb_frontend_attach,
  1848. .tuner_attach = cxusb_d680_dmb_tuner_attach,
  1849. /* parameter for the MPEG2-data transfer */
  1850. .stream = {
  1851. .type = USB_BULK,
  1852. .count = 5,
  1853. .endpoint = 0x02,
  1854. .u = {
  1855. .bulk = {
  1856. .buffersize = 8192,
  1857. }
  1858. }
  1859. },
  1860. }},
  1861. },
  1862. },
  1863. .power_ctrl = cxusb_d680_dmb_power_ctrl,
  1864. .i2c_algo = &cxusb_i2c_algo,
  1865. .generic_bulk_ctrl_endpoint = 0x01,
  1866. .rc.legacy = {
  1867. .rc_interval = 100,
  1868. .rc_map_table = rc_map_d680_dmb_table,
  1869. .rc_map_size = ARRAY_SIZE(rc_map_d680_dmb_table),
  1870. .rc_query = cxusb_d680_dmb_rc_query,
  1871. },
  1872. .num_device_descs = 1,
  1873. .devices = {
  1874. {
  1875. "Conexant DMB-TH Stick",
  1876. { NULL },
  1877. { &cxusb_table[CONEXANT_D680_DMB], NULL },
  1878. },
  1879. }
  1880. };
  1881. static struct dvb_usb_device_properties cxusb_mygica_d689_properties = {
  1882. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1883. .usb_ctrl = CYPRESS_FX2,
  1884. .size_of_priv = sizeof(struct cxusb_state),
  1885. .num_adapters = 1,
  1886. .adapter = {
  1887. {
  1888. .num_frontends = 1,
  1889. .fe = {{
  1890. .streaming_ctrl = cxusb_d680_dmb_streaming_ctrl,
  1891. .frontend_attach = cxusb_mygica_d689_frontend_attach,
  1892. .tuner_attach = cxusb_mygica_d689_tuner_attach,
  1893. /* parameter for the MPEG2-data transfer */
  1894. .stream = {
  1895. .type = USB_BULK,
  1896. .count = 5,
  1897. .endpoint = 0x02,
  1898. .u = {
  1899. .bulk = {
  1900. .buffersize = 8192,
  1901. }
  1902. }
  1903. },
  1904. }},
  1905. },
  1906. },
  1907. .power_ctrl = cxusb_d680_dmb_power_ctrl,
  1908. .i2c_algo = &cxusb_i2c_algo,
  1909. .generic_bulk_ctrl_endpoint = 0x01,
  1910. .rc.legacy = {
  1911. .rc_interval = 100,
  1912. .rc_map_table = rc_map_d680_dmb_table,
  1913. .rc_map_size = ARRAY_SIZE(rc_map_d680_dmb_table),
  1914. .rc_query = cxusb_d680_dmb_rc_query,
  1915. },
  1916. .num_device_descs = 1,
  1917. .devices = {
  1918. {
  1919. "Mygica D689 DMB-TH",
  1920. { NULL },
  1921. { &cxusb_table[MYGICA_D689], NULL },
  1922. },
  1923. }
  1924. };
  1925. static struct dvb_usb_device_properties cxusb_mygica_t230_properties = {
  1926. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1927. .usb_ctrl = CYPRESS_FX2,
  1928. .size_of_priv = sizeof(struct cxusb_state),
  1929. .num_adapters = 1,
  1930. .adapter = {
  1931. {
  1932. .num_frontends = 1,
  1933. .fe = {{
  1934. .streaming_ctrl = cxusb_streaming_ctrl,
  1935. .frontend_attach = cxusb_mygica_t230_frontend_attach,
  1936. /* parameter for the MPEG2-data transfer */
  1937. .stream = {
  1938. .type = USB_BULK,
  1939. .count = 5,
  1940. .endpoint = 0x02,
  1941. .u = {
  1942. .bulk = {
  1943. .buffersize = 8192,
  1944. }
  1945. }
  1946. },
  1947. } },
  1948. },
  1949. },
  1950. .power_ctrl = cxusb_d680_dmb_power_ctrl,
  1951. .i2c_algo = &cxusb_i2c_algo,
  1952. .generic_bulk_ctrl_endpoint = 0x01,
  1953. .rc.legacy = {
  1954. .rc_interval = 100,
  1955. .rc_map_table = rc_map_d680_dmb_table,
  1956. .rc_map_size = ARRAY_SIZE(rc_map_d680_dmb_table),
  1957. .rc_query = cxusb_d680_dmb_rc_query,
  1958. },
  1959. .num_device_descs = 1,
  1960. .devices = {
  1961. {
  1962. "Mygica T230 DVB-T/T2/C",
  1963. { NULL },
  1964. { &cxusb_table[MYGICA_T230], NULL },
  1965. },
  1966. }
  1967. };
  1968. static struct usb_driver cxusb_driver = {
  1969. .name = "dvb_usb_cxusb",
  1970. .probe = cxusb_probe,
  1971. .disconnect = cxusb_disconnect,
  1972. .id_table = cxusb_table,
  1973. };
  1974. module_usb_driver(cxusb_driver);
  1975. MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
  1976. MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>");
  1977. MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
  1978. MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design");
  1979. MODULE_VERSION("1.0-alpha");
  1980. MODULE_LICENSE("GPL");