cxusb.c 58 KB

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