cxusb.c 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335
  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 int cxusb_read_status(struct dvb_frontend *fe,
  321. enum fe_status *status)
  322. {
  323. struct dvb_usb_adapter *adap = (struct dvb_usb_adapter *)fe->dvb->priv;
  324. struct cxusb_state *state = (struct cxusb_state *)adap->dev->priv;
  325. int ret;
  326. ret = state->fe_read_status(fe, status);
  327. /* it need resync slave fifo when signal change from unlock to lock.*/
  328. if ((*status & FE_HAS_LOCK) && (!state->last_lock)) {
  329. mutex_lock(&state->stream_mutex);
  330. cxusb_streaming_ctrl(adap, 1);
  331. mutex_unlock(&state->stream_mutex);
  332. }
  333. state->last_lock = (*status & FE_HAS_LOCK) ? 1 : 0;
  334. return ret;
  335. }
  336. static void cxusb_d680_dmb_drain_message(struct dvb_usb_device *d)
  337. {
  338. int ep = d->props.generic_bulk_ctrl_endpoint;
  339. const int timeout = 100;
  340. const int junk_len = 32;
  341. u8 *junk;
  342. int rd_count;
  343. /* Discard remaining data in video pipe */
  344. junk = kmalloc(junk_len, GFP_KERNEL);
  345. if (!junk)
  346. return;
  347. while (1) {
  348. if (usb_bulk_msg(d->udev,
  349. usb_rcvbulkpipe(d->udev, ep),
  350. junk, junk_len, &rd_count, timeout) < 0)
  351. break;
  352. if (!rd_count)
  353. break;
  354. }
  355. kfree(junk);
  356. }
  357. static void cxusb_d680_dmb_drain_video(struct dvb_usb_device *d)
  358. {
  359. struct usb_data_stream_properties *p = &d->props.adapter[0].fe[0].stream;
  360. const int timeout = 100;
  361. const int junk_len = p->u.bulk.buffersize;
  362. u8 *junk;
  363. int rd_count;
  364. /* Discard remaining data in video pipe */
  365. junk = kmalloc(junk_len, GFP_KERNEL);
  366. if (!junk)
  367. return;
  368. while (1) {
  369. if (usb_bulk_msg(d->udev,
  370. usb_rcvbulkpipe(d->udev, p->endpoint),
  371. junk, junk_len, &rd_count, timeout) < 0)
  372. break;
  373. if (!rd_count)
  374. break;
  375. }
  376. kfree(junk);
  377. }
  378. static int cxusb_d680_dmb_streaming_ctrl(
  379. struct dvb_usb_adapter *adap, int onoff)
  380. {
  381. if (onoff) {
  382. u8 buf[2] = { 0x03, 0x00 };
  383. cxusb_d680_dmb_drain_video(adap->dev);
  384. return cxusb_ctrl_msg(adap->dev, CMD_STREAMING_ON,
  385. buf, sizeof(buf), NULL, 0);
  386. } else {
  387. int ret = cxusb_ctrl_msg(adap->dev,
  388. CMD_STREAMING_OFF, NULL, 0, NULL, 0);
  389. return ret;
  390. }
  391. }
  392. static int cxusb_rc_query(struct dvb_usb_device *d)
  393. {
  394. u8 ircode[4];
  395. cxusb_ctrl_msg(d, CMD_GET_IR_CODE, NULL, 0, ircode, 4);
  396. if (ircode[2] || ircode[3])
  397. rc_keydown(d->rc_dev, RC_TYPE_NEC,
  398. RC_SCANCODE_NEC(~ircode[2] & 0xff, ircode[3]), 0);
  399. return 0;
  400. }
  401. static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d)
  402. {
  403. u8 ircode[4];
  404. struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD,
  405. .buf = ircode, .len = 4 };
  406. if (cxusb_i2c_xfer(&d->i2c_adap, &msg, 1) != 1)
  407. return 0;
  408. if (ircode[1] || ircode[2])
  409. rc_keydown(d->rc_dev, RC_TYPE_NEC,
  410. RC_SCANCODE_NEC(~ircode[1] & 0xff, ircode[2]), 0);
  411. return 0;
  412. }
  413. static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d)
  414. {
  415. u8 ircode[2];
  416. if (cxusb_ctrl_msg(d, 0x10, NULL, 0, ircode, 2) < 0)
  417. return 0;
  418. if (ircode[0] || ircode[1])
  419. rc_keydown(d->rc_dev, RC_TYPE_UNKNOWN,
  420. RC_SCANCODE_RC5(ircode[0], ircode[1]), 0);
  421. return 0;
  422. }
  423. static int cxusb_dee1601_demod_init(struct dvb_frontend* fe)
  424. {
  425. static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x28 };
  426. static u8 reset [] = { RESET, 0x80 };
  427. static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
  428. static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 };
  429. static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 };
  430. static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
  431. mt352_write(fe, clock_config, sizeof(clock_config));
  432. udelay(200);
  433. mt352_write(fe, reset, sizeof(reset));
  434. mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
  435. mt352_write(fe, agc_cfg, sizeof(agc_cfg));
  436. mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg));
  437. mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
  438. return 0;
  439. }
  440. static int cxusb_mt352_demod_init(struct dvb_frontend* fe)
  441. { /* used in both lgz201 and th7579 */
  442. static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x29 };
  443. static u8 reset [] = { RESET, 0x80 };
  444. static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
  445. static u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 };
  446. static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 };
  447. static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
  448. mt352_write(fe, clock_config, sizeof(clock_config));
  449. udelay(200);
  450. mt352_write(fe, reset, sizeof(reset));
  451. mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
  452. mt352_write(fe, agc_cfg, sizeof(agc_cfg));
  453. mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg));
  454. mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
  455. return 0;
  456. }
  457. static struct cx22702_config cxusb_cx22702_config = {
  458. .demod_address = 0x63,
  459. .output_mode = CX22702_PARALLEL_OUTPUT,
  460. };
  461. static struct lgdt330x_config cxusb_lgdt3303_config = {
  462. .demod_address = 0x0e,
  463. .demod_chip = LGDT3303,
  464. };
  465. static struct lgdt330x_config cxusb_aver_lgdt3303_config = {
  466. .demod_address = 0x0e,
  467. .demod_chip = LGDT3303,
  468. .clock_polarity_flip = 2,
  469. };
  470. static struct mt352_config cxusb_dee1601_config = {
  471. .demod_address = 0x0f,
  472. .demod_init = cxusb_dee1601_demod_init,
  473. };
  474. static struct zl10353_config cxusb_zl10353_dee1601_config = {
  475. .demod_address = 0x0f,
  476. .parallel_ts = 1,
  477. };
  478. static struct mt352_config cxusb_mt352_config = {
  479. /* used in both lgz201 and th7579 */
  480. .demod_address = 0x0f,
  481. .demod_init = cxusb_mt352_demod_init,
  482. };
  483. static struct zl10353_config cxusb_zl10353_xc3028_config = {
  484. .demod_address = 0x0f,
  485. .if2 = 45600,
  486. .no_tuner = 1,
  487. .parallel_ts = 1,
  488. };
  489. static struct zl10353_config cxusb_zl10353_xc3028_config_no_i2c_gate = {
  490. .demod_address = 0x0f,
  491. .if2 = 45600,
  492. .no_tuner = 1,
  493. .parallel_ts = 1,
  494. .disable_i2c_gate_ctrl = 1,
  495. };
  496. static struct mt352_config cxusb_mt352_xc3028_config = {
  497. .demod_address = 0x0f,
  498. .if2 = 4560,
  499. .no_tuner = 1,
  500. .demod_init = cxusb_mt352_demod_init,
  501. };
  502. /* FIXME: needs tweaking */
  503. static struct mxl5005s_config aver_a868r_tuner = {
  504. .i2c_address = 0x63,
  505. .if_freq = 6000000UL,
  506. .xtal_freq = CRYSTAL_FREQ_16000000HZ,
  507. .agc_mode = MXL_SINGLE_AGC,
  508. .tracking_filter = MXL_TF_C,
  509. .rssi_enable = MXL_RSSI_ENABLE,
  510. .cap_select = MXL_CAP_SEL_ENABLE,
  511. .div_out = MXL_DIV_OUT_4,
  512. .clock_out = MXL_CLOCK_OUT_DISABLE,
  513. .output_load = MXL5005S_IF_OUTPUT_LOAD_200_OHM,
  514. .top = MXL5005S_TOP_25P2,
  515. .mod_mode = MXL_DIGITAL_MODE,
  516. .if_mode = MXL_ZERO_IF,
  517. .AgcMasterByte = 0x00,
  518. };
  519. /* FIXME: needs tweaking */
  520. static struct mxl5005s_config d680_dmb_tuner = {
  521. .i2c_address = 0x63,
  522. .if_freq = 36125000UL,
  523. .xtal_freq = CRYSTAL_FREQ_16000000HZ,
  524. .agc_mode = MXL_SINGLE_AGC,
  525. .tracking_filter = MXL_TF_C,
  526. .rssi_enable = MXL_RSSI_ENABLE,
  527. .cap_select = MXL_CAP_SEL_ENABLE,
  528. .div_out = MXL_DIV_OUT_4,
  529. .clock_out = MXL_CLOCK_OUT_DISABLE,
  530. .output_load = MXL5005S_IF_OUTPUT_LOAD_200_OHM,
  531. .top = MXL5005S_TOP_25P2,
  532. .mod_mode = MXL_DIGITAL_MODE,
  533. .if_mode = MXL_ZERO_IF,
  534. .AgcMasterByte = 0x00,
  535. };
  536. static struct max2165_config mygica_d689_max2165_cfg = {
  537. .i2c_address = 0x60,
  538. .osc_clk = 20
  539. };
  540. /* Callbacks for DVB USB */
  541. static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap)
  542. {
  543. dvb_attach(simple_tuner_attach, adap->fe_adap[0].fe,
  544. &adap->dev->i2c_adap, 0x61,
  545. TUNER_PHILIPS_FMD1216ME_MK3);
  546. return 0;
  547. }
  548. static int cxusb_dee1601_tuner_attach(struct dvb_usb_adapter *adap)
  549. {
  550. dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x61,
  551. NULL, DVB_PLL_THOMSON_DTT7579);
  552. return 0;
  553. }
  554. static int cxusb_lgz201_tuner_attach(struct dvb_usb_adapter *adap)
  555. {
  556. dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x61, NULL, DVB_PLL_LG_Z201);
  557. return 0;
  558. }
  559. static int cxusb_dtt7579_tuner_attach(struct dvb_usb_adapter *adap)
  560. {
  561. dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60,
  562. NULL, DVB_PLL_THOMSON_DTT7579);
  563. return 0;
  564. }
  565. static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter *adap)
  566. {
  567. dvb_attach(simple_tuner_attach, adap->fe_adap[0].fe,
  568. &adap->dev->i2c_adap, 0x61, TUNER_LG_TDVS_H06XF);
  569. return 0;
  570. }
  571. static int dvico_bluebird_xc2028_callback(void *ptr, int component,
  572. int command, int arg)
  573. {
  574. struct dvb_usb_adapter *adap = ptr;
  575. struct dvb_usb_device *d = adap->dev;
  576. switch (command) {
  577. case XC2028_TUNER_RESET:
  578. deb_info("%s: XC2028_TUNER_RESET %d\n", __func__, arg);
  579. cxusb_bluebird_gpio_pulse(d, 0x01, 1);
  580. break;
  581. case XC2028_RESET_CLK:
  582. deb_info("%s: XC2028_RESET_CLK %d\n", __func__, arg);
  583. break;
  584. default:
  585. deb_info("%s: unknown command %d, arg %d\n", __func__,
  586. command, arg);
  587. return -EINVAL;
  588. }
  589. return 0;
  590. }
  591. static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap)
  592. {
  593. struct dvb_frontend *fe;
  594. struct xc2028_config cfg = {
  595. .i2c_adap = &adap->dev->i2c_adap,
  596. .i2c_addr = 0x61,
  597. };
  598. static struct xc2028_ctrl ctl = {
  599. .fname = XC2028_DEFAULT_FIRMWARE,
  600. .max_len = 64,
  601. .demod = XC3028_FE_ZARLINK456,
  602. };
  603. /* FIXME: generalize & move to common area */
  604. adap->fe_adap[0].fe->callback = dvico_bluebird_xc2028_callback;
  605. fe = dvb_attach(xc2028_attach, adap->fe_adap[0].fe, &cfg);
  606. if (fe == NULL || fe->ops.tuner_ops.set_config == NULL)
  607. return -EIO;
  608. fe->ops.tuner_ops.set_config(fe, &ctl);
  609. return 0;
  610. }
  611. static int cxusb_mxl5003s_tuner_attach(struct dvb_usb_adapter *adap)
  612. {
  613. dvb_attach(mxl5005s_attach, adap->fe_adap[0].fe,
  614. &adap->dev->i2c_adap, &aver_a868r_tuner);
  615. return 0;
  616. }
  617. static int cxusb_d680_dmb_tuner_attach(struct dvb_usb_adapter *adap)
  618. {
  619. struct dvb_frontend *fe;
  620. fe = dvb_attach(mxl5005s_attach, adap->fe_adap[0].fe,
  621. &adap->dev->i2c_adap, &d680_dmb_tuner);
  622. return (fe == NULL) ? -EIO : 0;
  623. }
  624. static int cxusb_mygica_d689_tuner_attach(struct dvb_usb_adapter *adap)
  625. {
  626. struct dvb_frontend *fe;
  627. fe = dvb_attach(max2165_attach, adap->fe_adap[0].fe,
  628. &adap->dev->i2c_adap, &mygica_d689_max2165_cfg);
  629. return (fe == NULL) ? -EIO : 0;
  630. }
  631. static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter *adap)
  632. {
  633. u8 b;
  634. if (usb_set_interface(adap->dev->udev, 0, 6) < 0)
  635. err("set interface failed");
  636. cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, &b, 1);
  637. adap->fe_adap[0].fe = dvb_attach(cx22702_attach, &cxusb_cx22702_config,
  638. &adap->dev->i2c_adap);
  639. if ((adap->fe_adap[0].fe) != NULL)
  640. return 0;
  641. return -EIO;
  642. }
  643. static int cxusb_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap)
  644. {
  645. if (usb_set_interface(adap->dev->udev, 0, 7) < 0)
  646. err("set interface failed");
  647. cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
  648. adap->fe_adap[0].fe = dvb_attach(lgdt330x_attach,
  649. &cxusb_lgdt3303_config,
  650. &adap->dev->i2c_adap);
  651. if ((adap->fe_adap[0].fe) != NULL)
  652. return 0;
  653. return -EIO;
  654. }
  655. static int cxusb_aver_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap)
  656. {
  657. adap->fe_adap[0].fe = dvb_attach(lgdt330x_attach, &cxusb_aver_lgdt3303_config,
  658. &adap->dev->i2c_adap);
  659. if (adap->fe_adap[0].fe != NULL)
  660. return 0;
  661. return -EIO;
  662. }
  663. static int cxusb_mt352_frontend_attach(struct dvb_usb_adapter *adap)
  664. {
  665. /* used in both lgz201 and th7579 */
  666. if (usb_set_interface(adap->dev->udev, 0, 0) < 0)
  667. err("set interface failed");
  668. cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
  669. adap->fe_adap[0].fe = dvb_attach(mt352_attach, &cxusb_mt352_config,
  670. &adap->dev->i2c_adap);
  671. if ((adap->fe_adap[0].fe) != NULL)
  672. return 0;
  673. return -EIO;
  674. }
  675. static int cxusb_dee1601_frontend_attach(struct dvb_usb_adapter *adap)
  676. {
  677. if (usb_set_interface(adap->dev->udev, 0, 0) < 0)
  678. err("set interface failed");
  679. cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
  680. adap->fe_adap[0].fe = dvb_attach(mt352_attach, &cxusb_dee1601_config,
  681. &adap->dev->i2c_adap);
  682. if ((adap->fe_adap[0].fe) != NULL)
  683. return 0;
  684. adap->fe_adap[0].fe = dvb_attach(zl10353_attach,
  685. &cxusb_zl10353_dee1601_config,
  686. &adap->dev->i2c_adap);
  687. if ((adap->fe_adap[0].fe) != NULL)
  688. return 0;
  689. return -EIO;
  690. }
  691. static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap)
  692. {
  693. u8 ircode[4];
  694. int i;
  695. struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD,
  696. .buf = ircode, .len = 4 };
  697. if (usb_set_interface(adap->dev->udev, 0, 1) < 0)
  698. err("set interface failed");
  699. cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
  700. /* reset the tuner and demodulator */
  701. cxusb_bluebird_gpio_rw(adap->dev, 0x04, 0);
  702. cxusb_bluebird_gpio_pulse(adap->dev, 0x01, 1);
  703. cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1);
  704. adap->fe_adap[0].fe =
  705. dvb_attach(zl10353_attach,
  706. &cxusb_zl10353_xc3028_config_no_i2c_gate,
  707. &adap->dev->i2c_adap);
  708. if ((adap->fe_adap[0].fe) == NULL)
  709. return -EIO;
  710. /* try to determine if there is no IR decoder on the I2C bus */
  711. for (i = 0; adap->dev->props.rc.core.rc_codes && i < 5; i++) {
  712. msleep(20);
  713. if (cxusb_i2c_xfer(&adap->dev->i2c_adap, &msg, 1) != 1)
  714. goto no_IR;
  715. if (ircode[0] == 0 && ircode[1] == 0)
  716. continue;
  717. if (ircode[2] + ircode[3] != 0xff) {
  718. no_IR:
  719. adap->dev->props.rc.core.rc_codes = NULL;
  720. info("No IR receiver detected on this device.");
  721. break;
  722. }
  723. }
  724. return 0;
  725. }
  726. static struct dibx000_agc_config dib7070_agc_config = {
  727. .band_caps = BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
  728. /*
  729. * P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5,
  730. * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
  731. * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0
  732. */
  733. .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) |
  734. (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
  735. .inv_gain = 600,
  736. .time_stabiliz = 10,
  737. .alpha_level = 0,
  738. .thlock = 118,
  739. .wbd_inv = 0,
  740. .wbd_ref = 3530,
  741. .wbd_sel = 1,
  742. .wbd_alpha = 5,
  743. .agc1_max = 65535,
  744. .agc1_min = 0,
  745. .agc2_max = 65535,
  746. .agc2_min = 0,
  747. .agc1_pt1 = 0,
  748. .agc1_pt2 = 40,
  749. .agc1_pt3 = 183,
  750. .agc1_slope1 = 206,
  751. .agc1_slope2 = 255,
  752. .agc2_pt1 = 72,
  753. .agc2_pt2 = 152,
  754. .agc2_slope1 = 88,
  755. .agc2_slope2 = 90,
  756. .alpha_mant = 17,
  757. .alpha_exp = 27,
  758. .beta_mant = 23,
  759. .beta_exp = 51,
  760. .perform_agc_softsplit = 0,
  761. };
  762. static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
  763. .internal = 60000,
  764. .sampling = 15000,
  765. .pll_prediv = 1,
  766. .pll_ratio = 20,
  767. .pll_range = 3,
  768. .pll_reset = 1,
  769. .pll_bypass = 0,
  770. .enable_refdiv = 0,
  771. .bypclk_div = 0,
  772. .IO_CLK_en_core = 1,
  773. .ADClkSrc = 1,
  774. .modulo = 2,
  775. /* refsel, sel, freq_15k */
  776. .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0),
  777. .ifreq = (0 << 25) | 0,
  778. .timf = 20452225,
  779. .xtal_hz = 12000000,
  780. };
  781. static struct dib7000p_config cxusb_dualdig4_rev2_config = {
  782. .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
  783. .output_mpeg2_in_188_bytes = 1,
  784. .agc_config_count = 1,
  785. .agc = &dib7070_agc_config,
  786. .bw = &dib7070_bw_config_12_mhz,
  787. .tuner_is_baseband = 1,
  788. .spur_protect = 1,
  789. .gpio_dir = 0xfcef,
  790. .gpio_val = 0x0110,
  791. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  792. .hostbus_diversity = 1,
  793. };
  794. struct dib0700_adapter_state {
  795. int (*set_param_save)(struct dvb_frontend *);
  796. struct dib7000p_ops dib7000p_ops;
  797. };
  798. static int cxusb_dualdig4_rev2_frontend_attach(struct dvb_usb_adapter *adap)
  799. {
  800. struct dib0700_adapter_state *state = adap->priv;
  801. if (usb_set_interface(adap->dev->udev, 0, 1) < 0)
  802. err("set interface failed");
  803. cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
  804. cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1);
  805. if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
  806. return -ENODEV;
  807. if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
  808. &cxusb_dualdig4_rev2_config) < 0) {
  809. printk(KERN_WARNING "Unable to enumerate dib7000p\n");
  810. return -ENODEV;
  811. }
  812. adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80,
  813. &cxusb_dualdig4_rev2_config);
  814. if (adap->fe_adap[0].fe == NULL)
  815. return -EIO;
  816. return 0;
  817. }
  818. static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
  819. {
  820. struct dvb_usb_adapter *adap = fe->dvb->priv;
  821. struct dib0700_adapter_state *state = adap->priv;
  822. return state->dib7000p_ops.set_gpio(fe, 8, 0, !onoff);
  823. }
  824. static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
  825. {
  826. return 0;
  827. }
  828. static struct dib0070_config dib7070p_dib0070_config = {
  829. .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
  830. .reset = dib7070_tuner_reset,
  831. .sleep = dib7070_tuner_sleep,
  832. .clock_khz = 12000,
  833. };
  834. static int dib7070_set_param_override(struct dvb_frontend *fe)
  835. {
  836. struct dtv_frontend_properties *p = &fe->dtv_property_cache;
  837. struct dvb_usb_adapter *adap = fe->dvb->priv;
  838. struct dib0700_adapter_state *state = adap->priv;
  839. u16 offset;
  840. u8 band = BAND_OF_FREQUENCY(p->frequency/1000);
  841. switch (band) {
  842. case BAND_VHF: offset = 950; break;
  843. default:
  844. case BAND_UHF: offset = 550; break;
  845. }
  846. state->dib7000p_ops.set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
  847. return state->set_param_save(fe);
  848. }
  849. static int cxusb_dualdig4_rev2_tuner_attach(struct dvb_usb_adapter *adap)
  850. {
  851. struct dib0700_adapter_state *st = adap->priv;
  852. struct i2c_adapter *tun_i2c;
  853. /*
  854. * No need to call dvb7000p_attach here, as it was called
  855. * already, as frontend_attach method is called first, and
  856. * tuner_attach is only called on sucess.
  857. */
  858. tun_i2c = st->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe,
  859. DIBX000_I2C_INTERFACE_TUNER, 1);
  860. if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c,
  861. &dib7070p_dib0070_config) == NULL)
  862. return -ENODEV;
  863. st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
  864. adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7070_set_param_override;
  865. return 0;
  866. }
  867. static int cxusb_nano2_frontend_attach(struct dvb_usb_adapter *adap)
  868. {
  869. if (usb_set_interface(adap->dev->udev, 0, 1) < 0)
  870. err("set interface failed");
  871. cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
  872. /* reset the tuner and demodulator */
  873. cxusb_bluebird_gpio_rw(adap->dev, 0x04, 0);
  874. cxusb_bluebird_gpio_pulse(adap->dev, 0x01, 1);
  875. cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1);
  876. adap->fe_adap[0].fe = dvb_attach(zl10353_attach,
  877. &cxusb_zl10353_xc3028_config,
  878. &adap->dev->i2c_adap);
  879. if ((adap->fe_adap[0].fe) != NULL)
  880. return 0;
  881. adap->fe_adap[0].fe = dvb_attach(mt352_attach,
  882. &cxusb_mt352_xc3028_config,
  883. &adap->dev->i2c_adap);
  884. if ((adap->fe_adap[0].fe) != NULL)
  885. return 0;
  886. return -EIO;
  887. }
  888. static struct lgs8gxx_config d680_lgs8gl5_cfg = {
  889. .prod = LGS8GXX_PROD_LGS8GL5,
  890. .demod_address = 0x19,
  891. .serial_ts = 0,
  892. .ts_clk_pol = 0,
  893. .ts_clk_gated = 1,
  894. .if_clk_freq = 30400, /* 30.4 MHz */
  895. .if_freq = 5725, /* 5.725 MHz */
  896. .if_neg_center = 0,
  897. .ext_adc = 0,
  898. .adc_signed = 0,
  899. .if_neg_edge = 0,
  900. };
  901. static int cxusb_d680_dmb_frontend_attach(struct dvb_usb_adapter *adap)
  902. {
  903. struct dvb_usb_device *d = adap->dev;
  904. int n;
  905. /* Select required USB configuration */
  906. if (usb_set_interface(d->udev, 0, 0) < 0)
  907. err("set interface failed");
  908. /* Unblock all USB pipes */
  909. usb_clear_halt(d->udev,
  910. usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
  911. usb_clear_halt(d->udev,
  912. usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
  913. usb_clear_halt(d->udev,
  914. usb_rcvbulkpipe(d->udev, d->props.adapter[0].fe[0].stream.endpoint));
  915. /* Drain USB pipes to avoid hang after reboot */
  916. for (n = 0; n < 5; n++) {
  917. cxusb_d680_dmb_drain_message(d);
  918. cxusb_d680_dmb_drain_video(d);
  919. msleep(200);
  920. }
  921. /* Reset the tuner */
  922. if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 0) < 0) {
  923. err("clear tuner gpio failed");
  924. return -EIO;
  925. }
  926. msleep(100);
  927. if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 1) < 0) {
  928. err("set tuner gpio failed");
  929. return -EIO;
  930. }
  931. msleep(100);
  932. /* Attach frontend */
  933. adap->fe_adap[0].fe = dvb_attach(lgs8gxx_attach, &d680_lgs8gl5_cfg, &d->i2c_adap);
  934. if (adap->fe_adap[0].fe == NULL)
  935. return -EIO;
  936. return 0;
  937. }
  938. static struct atbm8830_config mygica_d689_atbm8830_cfg = {
  939. .prod = ATBM8830_PROD_8830,
  940. .demod_address = 0x40,
  941. .serial_ts = 0,
  942. .ts_sampling_edge = 1,
  943. .ts_clk_gated = 0,
  944. .osc_clk_freq = 30400, /* in kHz */
  945. .if_freq = 0, /* zero IF */
  946. .zif_swap_iq = 1,
  947. .agc_min = 0x2E,
  948. .agc_max = 0x90,
  949. .agc_hold_loop = 0,
  950. };
  951. static int cxusb_mygica_d689_frontend_attach(struct dvb_usb_adapter *adap)
  952. {
  953. struct dvb_usb_device *d = adap->dev;
  954. /* Select required USB configuration */
  955. if (usb_set_interface(d->udev, 0, 0) < 0)
  956. err("set interface failed");
  957. /* Unblock all USB pipes */
  958. usb_clear_halt(d->udev,
  959. usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
  960. usb_clear_halt(d->udev,
  961. usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
  962. usb_clear_halt(d->udev,
  963. usb_rcvbulkpipe(d->udev, d->props.adapter[0].fe[0].stream.endpoint));
  964. /* Reset the tuner */
  965. if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 0) < 0) {
  966. err("clear tuner gpio failed");
  967. return -EIO;
  968. }
  969. msleep(100);
  970. if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 1) < 0) {
  971. err("set tuner gpio failed");
  972. return -EIO;
  973. }
  974. msleep(100);
  975. /* Attach frontend */
  976. adap->fe_adap[0].fe = dvb_attach(atbm8830_attach, &mygica_d689_atbm8830_cfg,
  977. &d->i2c_adap);
  978. if (adap->fe_adap[0].fe == NULL)
  979. return -EIO;
  980. return 0;
  981. }
  982. static int cxusb_mygica_t230_frontend_attach(struct dvb_usb_adapter *adap)
  983. {
  984. struct dvb_usb_device *d = adap->dev;
  985. struct cxusb_state *st = d->priv;
  986. struct i2c_adapter *adapter;
  987. struct i2c_client *client_demod;
  988. struct i2c_client *client_tuner;
  989. struct i2c_board_info info;
  990. struct si2168_config si2168_config;
  991. struct si2157_config si2157_config;
  992. /* Select required USB configuration */
  993. if (usb_set_interface(d->udev, 0, 0) < 0)
  994. err("set interface failed");
  995. /* Unblock all USB pipes */
  996. usb_clear_halt(d->udev,
  997. usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
  998. usb_clear_halt(d->udev,
  999. usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
  1000. usb_clear_halt(d->udev,
  1001. usb_rcvbulkpipe(d->udev, d->props.adapter[0].fe[0].stream.endpoint));
  1002. /* attach frontend */
  1003. si2168_config.i2c_adapter = &adapter;
  1004. si2168_config.fe = &adap->fe_adap[0].fe;
  1005. si2168_config.ts_mode = SI2168_TS_PARALLEL;
  1006. si2168_config.ts_clock_inv = 1;
  1007. memset(&info, 0, sizeof(struct i2c_board_info));
  1008. strlcpy(info.type, "si2168", I2C_NAME_SIZE);
  1009. info.addr = 0x64;
  1010. info.platform_data = &si2168_config;
  1011. request_module(info.type);
  1012. client_demod = i2c_new_device(&d->i2c_adap, &info);
  1013. if (client_demod == NULL || client_demod->dev.driver == NULL)
  1014. return -ENODEV;
  1015. if (!try_module_get(client_demod->dev.driver->owner)) {
  1016. i2c_unregister_device(client_demod);
  1017. return -ENODEV;
  1018. }
  1019. st->i2c_client_demod = client_demod;
  1020. /* attach tuner */
  1021. memset(&si2157_config, 0, sizeof(si2157_config));
  1022. si2157_config.fe = adap->fe_adap[0].fe;
  1023. si2157_config.if_port = 1;
  1024. memset(&info, 0, sizeof(struct i2c_board_info));
  1025. strlcpy(info.type, "si2157", I2C_NAME_SIZE);
  1026. info.addr = 0x60;
  1027. info.platform_data = &si2157_config;
  1028. request_module(info.type);
  1029. client_tuner = i2c_new_device(adapter, &info);
  1030. if (client_tuner == NULL || client_tuner->dev.driver == NULL) {
  1031. module_put(client_demod->dev.driver->owner);
  1032. i2c_unregister_device(client_demod);
  1033. return -ENODEV;
  1034. }
  1035. if (!try_module_get(client_tuner->dev.driver->owner)) {
  1036. i2c_unregister_device(client_tuner);
  1037. module_put(client_demod->dev.driver->owner);
  1038. i2c_unregister_device(client_demod);
  1039. return -ENODEV;
  1040. }
  1041. st->i2c_client_tuner = client_tuner;
  1042. /* hook fe: need to resync the slave fifo when signal locks. */
  1043. mutex_init(&st->stream_mutex);
  1044. st->last_lock = 0;
  1045. st->fe_read_status = adap->fe_adap[0].fe->ops.read_status;
  1046. adap->fe_adap[0].fe->ops.read_status = cxusb_read_status;
  1047. return 0;
  1048. }
  1049. static int cxusb_mygica_t230c_frontend_attach(struct dvb_usb_adapter *adap)
  1050. {
  1051. struct dvb_usb_device *d = adap->dev;
  1052. struct cxusb_state *st = d->priv;
  1053. struct i2c_adapter *adapter;
  1054. struct i2c_client *client_demod;
  1055. struct i2c_client *client_tuner;
  1056. struct i2c_board_info info;
  1057. struct si2168_config si2168_config;
  1058. struct si2157_config si2157_config;
  1059. /* Select required USB configuration */
  1060. if (usb_set_interface(d->udev, 0, 0) < 0)
  1061. err("set interface failed");
  1062. /* Unblock all USB pipes */
  1063. usb_clear_halt(d->udev,
  1064. usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
  1065. usb_clear_halt(d->udev,
  1066. usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
  1067. usb_clear_halt(d->udev,
  1068. usb_rcvbulkpipe(d->udev, d->props.adapter[0].fe[0].stream.endpoint));
  1069. /* attach frontend */
  1070. memset(&si2168_config, 0, sizeof(si2168_config));
  1071. si2168_config.i2c_adapter = &adapter;
  1072. si2168_config.fe = &adap->fe_adap[0].fe;
  1073. si2168_config.ts_mode = SI2168_TS_PARALLEL;
  1074. si2168_config.ts_clock_inv = 1;
  1075. memset(&info, 0, sizeof(struct i2c_board_info));
  1076. strlcpy(info.type, "si2168", I2C_NAME_SIZE);
  1077. info.addr = 0x64;
  1078. info.platform_data = &si2168_config;
  1079. request_module(info.type);
  1080. client_demod = i2c_new_device(&d->i2c_adap, &info);
  1081. if (client_demod == NULL || client_demod->dev.driver == NULL)
  1082. return -ENODEV;
  1083. if (!try_module_get(client_demod->dev.driver->owner)) {
  1084. i2c_unregister_device(client_demod);
  1085. return -ENODEV;
  1086. }
  1087. /* attach tuner */
  1088. memset(&si2157_config, 0, sizeof(si2157_config));
  1089. si2157_config.fe = adap->fe_adap[0].fe;
  1090. memset(&info, 0, sizeof(struct i2c_board_info));
  1091. strlcpy(info.type, "si2141", I2C_NAME_SIZE);
  1092. info.addr = 0x60;
  1093. info.platform_data = &si2157_config;
  1094. request_module("si2157");
  1095. client_tuner = i2c_new_device(adapter, &info);
  1096. if (client_tuner == NULL || client_tuner->dev.driver == NULL) {
  1097. module_put(client_demod->dev.driver->owner);
  1098. i2c_unregister_device(client_demod);
  1099. return -ENODEV;
  1100. }
  1101. if (!try_module_get(client_tuner->dev.driver->owner)) {
  1102. i2c_unregister_device(client_tuner);
  1103. module_put(client_demod->dev.driver->owner);
  1104. i2c_unregister_device(client_demod);
  1105. return -ENODEV;
  1106. }
  1107. st->i2c_client_demod = client_demod;
  1108. st->i2c_client_tuner = client_tuner;
  1109. /* hook fe: need to resync the slave fifo when signal locks. */
  1110. mutex_init(&st->stream_mutex);
  1111. st->last_lock = 0;
  1112. st->fe_read_status = adap->fe_adap[0].fe->ops.read_status;
  1113. adap->fe_adap[0].fe->ops.read_status = cxusb_read_status;
  1114. return 0;
  1115. }
  1116. /*
  1117. * DViCO has shipped two devices with the same USB ID, but only one of them
  1118. * needs a firmware download. Check the device class details to see if they
  1119. * have non-default values to decide whether the device is actually cold or
  1120. * not, and forget a match if it turns out we selected the wrong device.
  1121. */
  1122. static int bluebird_fx2_identify_state(struct usb_device *udev,
  1123. struct dvb_usb_device_properties *props,
  1124. struct dvb_usb_device_description **desc,
  1125. int *cold)
  1126. {
  1127. int wascold = *cold;
  1128. *cold = udev->descriptor.bDeviceClass == 0xff &&
  1129. udev->descriptor.bDeviceSubClass == 0xff &&
  1130. udev->descriptor.bDeviceProtocol == 0xff;
  1131. if (*cold && !wascold)
  1132. *desc = NULL;
  1133. return 0;
  1134. }
  1135. /*
  1136. * DViCO bluebird firmware needs the "warm" product ID to be patched into the
  1137. * firmware file before download.
  1138. */
  1139. static const int dvico_firmware_id_offsets[] = { 6638, 3204 };
  1140. static int bluebird_patch_dvico_firmware_download(struct usb_device *udev,
  1141. const struct firmware *fw)
  1142. {
  1143. int pos;
  1144. for (pos = 0; pos < ARRAY_SIZE(dvico_firmware_id_offsets); pos++) {
  1145. int idoff = dvico_firmware_id_offsets[pos];
  1146. if (fw->size < idoff + 4)
  1147. continue;
  1148. if (fw->data[idoff] == (USB_VID_DVICO & 0xff) &&
  1149. fw->data[idoff + 1] == USB_VID_DVICO >> 8) {
  1150. struct firmware new_fw;
  1151. u8 *new_fw_data = vmalloc(fw->size);
  1152. int ret;
  1153. if (!new_fw_data)
  1154. return -ENOMEM;
  1155. memcpy(new_fw_data, fw->data, fw->size);
  1156. new_fw.size = fw->size;
  1157. new_fw.data = new_fw_data;
  1158. new_fw_data[idoff + 2] =
  1159. le16_to_cpu(udev->descriptor.idProduct) + 1;
  1160. new_fw_data[idoff + 3] =
  1161. le16_to_cpu(udev->descriptor.idProduct) >> 8;
  1162. ret = usb_cypress_load_firmware(udev, &new_fw,
  1163. CYPRESS_FX2);
  1164. vfree(new_fw_data);
  1165. return ret;
  1166. }
  1167. }
  1168. return -EINVAL;
  1169. }
  1170. /* DVB USB Driver stuff */
  1171. static struct dvb_usb_device_properties cxusb_medion_properties;
  1172. static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties;
  1173. static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties;
  1174. static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties;
  1175. static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties;
  1176. static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties;
  1177. static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties;
  1178. static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties;
  1179. static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties;
  1180. static struct dvb_usb_device_properties cxusb_aver_a868r_properties;
  1181. static struct dvb_usb_device_properties cxusb_d680_dmb_properties;
  1182. static struct dvb_usb_device_properties cxusb_mygica_d689_properties;
  1183. static struct dvb_usb_device_properties cxusb_mygica_t230_properties;
  1184. static struct dvb_usb_device_properties cxusb_mygica_t230c_properties;
  1185. static int cxusb_probe(struct usb_interface *intf,
  1186. const struct usb_device_id *id)
  1187. {
  1188. if (0 == dvb_usb_device_init(intf, &cxusb_medion_properties,
  1189. THIS_MODULE, NULL, adapter_nr) ||
  1190. 0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgh064f_properties,
  1191. THIS_MODULE, NULL, adapter_nr) ||
  1192. 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dee1601_properties,
  1193. THIS_MODULE, NULL, adapter_nr) ||
  1194. 0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgz201_properties,
  1195. THIS_MODULE, NULL, adapter_nr) ||
  1196. 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dtt7579_properties,
  1197. THIS_MODULE, NULL, adapter_nr) ||
  1198. 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dualdig4_properties,
  1199. THIS_MODULE, NULL, adapter_nr) ||
  1200. 0 == dvb_usb_device_init(intf, &cxusb_bluebird_nano2_properties,
  1201. THIS_MODULE, NULL, adapter_nr) ||
  1202. 0 == dvb_usb_device_init(intf,
  1203. &cxusb_bluebird_nano2_needsfirmware_properties,
  1204. THIS_MODULE, NULL, adapter_nr) ||
  1205. 0 == dvb_usb_device_init(intf, &cxusb_aver_a868r_properties,
  1206. THIS_MODULE, NULL, adapter_nr) ||
  1207. 0 == dvb_usb_device_init(intf,
  1208. &cxusb_bluebird_dualdig4_rev2_properties,
  1209. THIS_MODULE, NULL, adapter_nr) ||
  1210. 0 == dvb_usb_device_init(intf, &cxusb_d680_dmb_properties,
  1211. THIS_MODULE, NULL, adapter_nr) ||
  1212. 0 == dvb_usb_device_init(intf, &cxusb_mygica_d689_properties,
  1213. THIS_MODULE, NULL, adapter_nr) ||
  1214. 0 == dvb_usb_device_init(intf, &cxusb_mygica_t230_properties,
  1215. THIS_MODULE, NULL, adapter_nr) ||
  1216. 0 == dvb_usb_device_init(intf, &cxusb_mygica_t230c_properties,
  1217. THIS_MODULE, NULL, adapter_nr) ||
  1218. 0)
  1219. return 0;
  1220. return -EINVAL;
  1221. }
  1222. static void cxusb_disconnect(struct usb_interface *intf)
  1223. {
  1224. struct dvb_usb_device *d = usb_get_intfdata(intf);
  1225. struct cxusb_state *st = d->priv;
  1226. struct i2c_client *client;
  1227. /* remove I2C client for tuner */
  1228. client = st->i2c_client_tuner;
  1229. if (client) {
  1230. module_put(client->dev.driver->owner);
  1231. i2c_unregister_device(client);
  1232. }
  1233. /* remove I2C client for demodulator */
  1234. client = st->i2c_client_demod;
  1235. if (client) {
  1236. module_put(client->dev.driver->owner);
  1237. i2c_unregister_device(client);
  1238. }
  1239. dvb_usb_device_exit(intf);
  1240. }
  1241. enum cxusb_table_index {
  1242. MEDION_MD95700,
  1243. DVICO_BLUEBIRD_LG064F_COLD,
  1244. DVICO_BLUEBIRD_LG064F_WARM,
  1245. DVICO_BLUEBIRD_DUAL_1_COLD,
  1246. DVICO_BLUEBIRD_DUAL_1_WARM,
  1247. DVICO_BLUEBIRD_LGZ201_COLD,
  1248. DVICO_BLUEBIRD_LGZ201_WARM,
  1249. DVICO_BLUEBIRD_TH7579_COLD,
  1250. DVICO_BLUEBIRD_TH7579_WARM,
  1251. DIGITALNOW_BLUEBIRD_DUAL_1_COLD,
  1252. DIGITALNOW_BLUEBIRD_DUAL_1_WARM,
  1253. DVICO_BLUEBIRD_DUAL_2_COLD,
  1254. DVICO_BLUEBIRD_DUAL_2_WARM,
  1255. DVICO_BLUEBIRD_DUAL_4,
  1256. DVICO_BLUEBIRD_DVB_T_NANO_2,
  1257. DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM,
  1258. AVERMEDIA_VOLAR_A868R,
  1259. DVICO_BLUEBIRD_DUAL_4_REV_2,
  1260. CONEXANT_D680_DMB,
  1261. MYGICA_D689,
  1262. MYGICA_T230,
  1263. MYGICA_T230C,
  1264. NR__cxusb_table_index
  1265. };
  1266. static struct usb_device_id cxusb_table[NR__cxusb_table_index + 1] = {
  1267. [MEDION_MD95700] = {
  1268. USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700)
  1269. },
  1270. [DVICO_BLUEBIRD_LG064F_COLD] = {
  1271. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_COLD)
  1272. },
  1273. [DVICO_BLUEBIRD_LG064F_WARM] = {
  1274. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_WARM)
  1275. },
  1276. [DVICO_BLUEBIRD_DUAL_1_COLD] = {
  1277. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_COLD)
  1278. },
  1279. [DVICO_BLUEBIRD_DUAL_1_WARM] = {
  1280. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_WARM)
  1281. },
  1282. [DVICO_BLUEBIRD_LGZ201_COLD] = {
  1283. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD)
  1284. },
  1285. [DVICO_BLUEBIRD_LGZ201_WARM] = {
  1286. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM)
  1287. },
  1288. [DVICO_BLUEBIRD_TH7579_COLD] = {
  1289. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_COLD)
  1290. },
  1291. [DVICO_BLUEBIRD_TH7579_WARM] = {
  1292. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_WARM)
  1293. },
  1294. [DIGITALNOW_BLUEBIRD_DUAL_1_COLD] = {
  1295. USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD)
  1296. },
  1297. [DIGITALNOW_BLUEBIRD_DUAL_1_WARM] = {
  1298. USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM)
  1299. },
  1300. [DVICO_BLUEBIRD_DUAL_2_COLD] = {
  1301. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_COLD)
  1302. },
  1303. [DVICO_BLUEBIRD_DUAL_2_WARM] = {
  1304. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_WARM)
  1305. },
  1306. [DVICO_BLUEBIRD_DUAL_4] = {
  1307. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4)
  1308. },
  1309. [DVICO_BLUEBIRD_DVB_T_NANO_2] = {
  1310. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2)
  1311. },
  1312. [DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM] = {
  1313. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM)
  1314. },
  1315. [AVERMEDIA_VOLAR_A868R] = {
  1316. USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_A868R)
  1317. },
  1318. [DVICO_BLUEBIRD_DUAL_4_REV_2] = {
  1319. USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4_REV_2)
  1320. },
  1321. [CONEXANT_D680_DMB] = {
  1322. USB_DEVICE(USB_VID_CONEXANT, USB_PID_CONEXANT_D680_DMB)
  1323. },
  1324. [MYGICA_D689] = {
  1325. USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_D689)
  1326. },
  1327. [MYGICA_T230] = {
  1328. USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230)
  1329. },
  1330. [MYGICA_T230C] = {
  1331. USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230+1)
  1332. },
  1333. {} /* Terminating entry */
  1334. };
  1335. MODULE_DEVICE_TABLE (usb, cxusb_table);
  1336. static struct dvb_usb_device_properties cxusb_medion_properties = {
  1337. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1338. .usb_ctrl = CYPRESS_FX2,
  1339. .size_of_priv = sizeof(struct cxusb_state),
  1340. .num_adapters = 1,
  1341. .adapter = {
  1342. {
  1343. .num_frontends = 1,
  1344. .fe = {{
  1345. .streaming_ctrl = cxusb_streaming_ctrl,
  1346. .frontend_attach = cxusb_cx22702_frontend_attach,
  1347. .tuner_attach = cxusb_fmd1216me_tuner_attach,
  1348. /* parameter for the MPEG2-data transfer */
  1349. .stream = {
  1350. .type = USB_BULK,
  1351. .count = 5,
  1352. .endpoint = 0x02,
  1353. .u = {
  1354. .bulk = {
  1355. .buffersize = 8192,
  1356. }
  1357. }
  1358. },
  1359. }},
  1360. },
  1361. },
  1362. .power_ctrl = cxusb_power_ctrl,
  1363. .i2c_algo = &cxusb_i2c_algo,
  1364. .generic_bulk_ctrl_endpoint = 0x01,
  1365. .num_device_descs = 1,
  1366. .devices = {
  1367. { "Medion MD95700 (MDUSBTV-HYBRID)",
  1368. { NULL },
  1369. { &cxusb_table[MEDION_MD95700], NULL },
  1370. },
  1371. }
  1372. };
  1373. static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties = {
  1374. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1375. .usb_ctrl = DEVICE_SPECIFIC,
  1376. .firmware = "dvb-usb-bluebird-01.fw",
  1377. .download_firmware = bluebird_patch_dvico_firmware_download,
  1378. /* use usb alt setting 0 for EP4 transfer (dvb-t),
  1379. use usb alt setting 7 for EP2 transfer (atsc) */
  1380. .size_of_priv = sizeof(struct cxusb_state),
  1381. .num_adapters = 1,
  1382. .adapter = {
  1383. {
  1384. .num_frontends = 1,
  1385. .fe = {{
  1386. .streaming_ctrl = cxusb_streaming_ctrl,
  1387. .frontend_attach = cxusb_lgdt3303_frontend_attach,
  1388. .tuner_attach = cxusb_lgh064f_tuner_attach,
  1389. /* parameter for the MPEG2-data transfer */
  1390. .stream = {
  1391. .type = USB_BULK,
  1392. .count = 5,
  1393. .endpoint = 0x02,
  1394. .u = {
  1395. .bulk = {
  1396. .buffersize = 8192,
  1397. }
  1398. }
  1399. },
  1400. }},
  1401. },
  1402. },
  1403. .power_ctrl = cxusb_bluebird_power_ctrl,
  1404. .i2c_algo = &cxusb_i2c_algo,
  1405. .rc.core = {
  1406. .rc_interval = 100,
  1407. .rc_codes = RC_MAP_DVICO_PORTABLE,
  1408. .module_name = KBUILD_MODNAME,
  1409. .rc_query = cxusb_rc_query,
  1410. .allowed_protos = RC_BIT_NEC,
  1411. },
  1412. .generic_bulk_ctrl_endpoint = 0x01,
  1413. .num_device_descs = 1,
  1414. .devices = {
  1415. { "DViCO FusionHDTV5 USB Gold",
  1416. { &cxusb_table[DVICO_BLUEBIRD_LG064F_COLD], NULL },
  1417. { &cxusb_table[DVICO_BLUEBIRD_LG064F_WARM], NULL },
  1418. },
  1419. }
  1420. };
  1421. static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties = {
  1422. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1423. .usb_ctrl = DEVICE_SPECIFIC,
  1424. .firmware = "dvb-usb-bluebird-01.fw",
  1425. .download_firmware = bluebird_patch_dvico_firmware_download,
  1426. /* use usb alt setting 0 for EP4 transfer (dvb-t),
  1427. use usb alt setting 7 for EP2 transfer (atsc) */
  1428. .size_of_priv = sizeof(struct cxusb_state),
  1429. .num_adapters = 1,
  1430. .adapter = {
  1431. {
  1432. .num_frontends = 1,
  1433. .fe = {{
  1434. .streaming_ctrl = cxusb_streaming_ctrl,
  1435. .frontend_attach = cxusb_dee1601_frontend_attach,
  1436. .tuner_attach = cxusb_dee1601_tuner_attach,
  1437. /* parameter for the MPEG2-data transfer */
  1438. .stream = {
  1439. .type = USB_BULK,
  1440. .count = 5,
  1441. .endpoint = 0x04,
  1442. .u = {
  1443. .bulk = {
  1444. .buffersize = 8192,
  1445. }
  1446. }
  1447. },
  1448. }},
  1449. },
  1450. },
  1451. .power_ctrl = cxusb_bluebird_power_ctrl,
  1452. .i2c_algo = &cxusb_i2c_algo,
  1453. .rc.core = {
  1454. .rc_interval = 100,
  1455. .rc_codes = RC_MAP_DVICO_MCE,
  1456. .module_name = KBUILD_MODNAME,
  1457. .rc_query = cxusb_rc_query,
  1458. .allowed_protos = RC_BIT_NEC,
  1459. },
  1460. .generic_bulk_ctrl_endpoint = 0x01,
  1461. .num_device_descs = 3,
  1462. .devices = {
  1463. { "DViCO FusionHDTV DVB-T Dual USB",
  1464. { &cxusb_table[DVICO_BLUEBIRD_DUAL_1_COLD], NULL },
  1465. { &cxusb_table[DVICO_BLUEBIRD_DUAL_1_WARM], NULL },
  1466. },
  1467. { "DigitalNow DVB-T Dual USB",
  1468. { &cxusb_table[DIGITALNOW_BLUEBIRD_DUAL_1_COLD], NULL },
  1469. { &cxusb_table[DIGITALNOW_BLUEBIRD_DUAL_1_WARM], NULL },
  1470. },
  1471. { "DViCO FusionHDTV DVB-T Dual Digital 2",
  1472. { &cxusb_table[DVICO_BLUEBIRD_DUAL_2_COLD], NULL },
  1473. { &cxusb_table[DVICO_BLUEBIRD_DUAL_2_WARM], NULL },
  1474. },
  1475. }
  1476. };
  1477. static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = {
  1478. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1479. .usb_ctrl = DEVICE_SPECIFIC,
  1480. .firmware = "dvb-usb-bluebird-01.fw",
  1481. .download_firmware = bluebird_patch_dvico_firmware_download,
  1482. /* use usb alt setting 0 for EP4 transfer (dvb-t),
  1483. use usb alt setting 7 for EP2 transfer (atsc) */
  1484. .size_of_priv = sizeof(struct cxusb_state),
  1485. .num_adapters = 2,
  1486. .adapter = {
  1487. {
  1488. .num_frontends = 1,
  1489. .fe = {{
  1490. .streaming_ctrl = cxusb_streaming_ctrl,
  1491. .frontend_attach = cxusb_mt352_frontend_attach,
  1492. .tuner_attach = cxusb_lgz201_tuner_attach,
  1493. /* parameter for the MPEG2-data transfer */
  1494. .stream = {
  1495. .type = USB_BULK,
  1496. .count = 5,
  1497. .endpoint = 0x04,
  1498. .u = {
  1499. .bulk = {
  1500. .buffersize = 8192,
  1501. }
  1502. }
  1503. },
  1504. }},
  1505. },
  1506. },
  1507. .power_ctrl = cxusb_bluebird_power_ctrl,
  1508. .i2c_algo = &cxusb_i2c_algo,
  1509. .rc.core = {
  1510. .rc_interval = 100,
  1511. .rc_codes = RC_MAP_DVICO_PORTABLE,
  1512. .module_name = KBUILD_MODNAME,
  1513. .rc_query = cxusb_rc_query,
  1514. .allowed_protos = RC_BIT_NEC,
  1515. },
  1516. .generic_bulk_ctrl_endpoint = 0x01,
  1517. .num_device_descs = 1,
  1518. .devices = {
  1519. { "DViCO FusionHDTV DVB-T USB (LGZ201)",
  1520. { &cxusb_table[DVICO_BLUEBIRD_LGZ201_COLD], NULL },
  1521. { &cxusb_table[DVICO_BLUEBIRD_LGZ201_WARM], NULL },
  1522. },
  1523. }
  1524. };
  1525. static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = {
  1526. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1527. .usb_ctrl = DEVICE_SPECIFIC,
  1528. .firmware = "dvb-usb-bluebird-01.fw",
  1529. .download_firmware = bluebird_patch_dvico_firmware_download,
  1530. /* use usb alt setting 0 for EP4 transfer (dvb-t),
  1531. use usb alt setting 7 for EP2 transfer (atsc) */
  1532. .size_of_priv = sizeof(struct cxusb_state),
  1533. .num_adapters = 1,
  1534. .adapter = {
  1535. {
  1536. .num_frontends = 1,
  1537. .fe = {{
  1538. .streaming_ctrl = cxusb_streaming_ctrl,
  1539. .frontend_attach = cxusb_mt352_frontend_attach,
  1540. .tuner_attach = cxusb_dtt7579_tuner_attach,
  1541. /* parameter for the MPEG2-data transfer */
  1542. .stream = {
  1543. .type = USB_BULK,
  1544. .count = 5,
  1545. .endpoint = 0x04,
  1546. .u = {
  1547. .bulk = {
  1548. .buffersize = 8192,
  1549. }
  1550. }
  1551. },
  1552. }},
  1553. },
  1554. },
  1555. .power_ctrl = cxusb_bluebird_power_ctrl,
  1556. .i2c_algo = &cxusb_i2c_algo,
  1557. .rc.core = {
  1558. .rc_interval = 100,
  1559. .rc_codes = RC_MAP_DVICO_PORTABLE,
  1560. .module_name = KBUILD_MODNAME,
  1561. .rc_query = cxusb_rc_query,
  1562. .allowed_protos = RC_BIT_NEC,
  1563. },
  1564. .generic_bulk_ctrl_endpoint = 0x01,
  1565. .num_device_descs = 1,
  1566. .devices = {
  1567. { "DViCO FusionHDTV DVB-T USB (TH7579)",
  1568. { &cxusb_table[DVICO_BLUEBIRD_TH7579_COLD], NULL },
  1569. { &cxusb_table[DVICO_BLUEBIRD_TH7579_WARM], NULL },
  1570. },
  1571. }
  1572. };
  1573. static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties = {
  1574. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1575. .usb_ctrl = CYPRESS_FX2,
  1576. .size_of_priv = sizeof(struct cxusb_state),
  1577. .num_adapters = 1,
  1578. .adapter = {
  1579. {
  1580. .num_frontends = 1,
  1581. .fe = {{
  1582. .streaming_ctrl = cxusb_streaming_ctrl,
  1583. .frontend_attach = cxusb_dualdig4_frontend_attach,
  1584. .tuner_attach = cxusb_dvico_xc3028_tuner_attach,
  1585. /* parameter for the MPEG2-data transfer */
  1586. .stream = {
  1587. .type = USB_BULK,
  1588. .count = 5,
  1589. .endpoint = 0x02,
  1590. .u = {
  1591. .bulk = {
  1592. .buffersize = 8192,
  1593. }
  1594. }
  1595. },
  1596. }},
  1597. },
  1598. },
  1599. .power_ctrl = cxusb_power_ctrl,
  1600. .i2c_algo = &cxusb_i2c_algo,
  1601. .generic_bulk_ctrl_endpoint = 0x01,
  1602. .rc.core = {
  1603. .rc_interval = 100,
  1604. .rc_codes = RC_MAP_DVICO_MCE,
  1605. .module_name = KBUILD_MODNAME,
  1606. .rc_query = cxusb_bluebird2_rc_query,
  1607. .allowed_protos = RC_BIT_NEC,
  1608. },
  1609. .num_device_descs = 1,
  1610. .devices = {
  1611. { "DViCO FusionHDTV DVB-T Dual Digital 4",
  1612. { NULL },
  1613. { &cxusb_table[DVICO_BLUEBIRD_DUAL_4], NULL },
  1614. },
  1615. }
  1616. };
  1617. static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties = {
  1618. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1619. .usb_ctrl = CYPRESS_FX2,
  1620. .identify_state = bluebird_fx2_identify_state,
  1621. .size_of_priv = sizeof(struct cxusb_state),
  1622. .num_adapters = 1,
  1623. .adapter = {
  1624. {
  1625. .num_frontends = 1,
  1626. .fe = {{
  1627. .streaming_ctrl = cxusb_streaming_ctrl,
  1628. .frontend_attach = cxusb_nano2_frontend_attach,
  1629. .tuner_attach = cxusb_dvico_xc3028_tuner_attach,
  1630. /* parameter for the MPEG2-data transfer */
  1631. .stream = {
  1632. .type = USB_BULK,
  1633. .count = 5,
  1634. .endpoint = 0x02,
  1635. .u = {
  1636. .bulk = {
  1637. .buffersize = 8192,
  1638. }
  1639. }
  1640. },
  1641. }},
  1642. },
  1643. },
  1644. .power_ctrl = cxusb_nano2_power_ctrl,
  1645. .i2c_algo = &cxusb_i2c_algo,
  1646. .generic_bulk_ctrl_endpoint = 0x01,
  1647. .rc.core = {
  1648. .rc_interval = 100,
  1649. .rc_codes = RC_MAP_DVICO_PORTABLE,
  1650. .module_name = KBUILD_MODNAME,
  1651. .rc_query = cxusb_bluebird2_rc_query,
  1652. .allowed_protos = RC_BIT_NEC,
  1653. },
  1654. .num_device_descs = 1,
  1655. .devices = {
  1656. { "DViCO FusionHDTV DVB-T NANO2",
  1657. { NULL },
  1658. { &cxusb_table[DVICO_BLUEBIRD_DVB_T_NANO_2], NULL },
  1659. },
  1660. }
  1661. };
  1662. static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties = {
  1663. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1664. .usb_ctrl = DEVICE_SPECIFIC,
  1665. .firmware = "dvb-usb-bluebird-02.fw",
  1666. .download_firmware = bluebird_patch_dvico_firmware_download,
  1667. .identify_state = bluebird_fx2_identify_state,
  1668. .size_of_priv = sizeof(struct cxusb_state),
  1669. .num_adapters = 1,
  1670. .adapter = {
  1671. {
  1672. .num_frontends = 1,
  1673. .fe = {{
  1674. .streaming_ctrl = cxusb_streaming_ctrl,
  1675. .frontend_attach = cxusb_nano2_frontend_attach,
  1676. .tuner_attach = cxusb_dvico_xc3028_tuner_attach,
  1677. /* parameter for the MPEG2-data transfer */
  1678. .stream = {
  1679. .type = USB_BULK,
  1680. .count = 5,
  1681. .endpoint = 0x02,
  1682. .u = {
  1683. .bulk = {
  1684. .buffersize = 8192,
  1685. }
  1686. }
  1687. },
  1688. }},
  1689. },
  1690. },
  1691. .power_ctrl = cxusb_nano2_power_ctrl,
  1692. .i2c_algo = &cxusb_i2c_algo,
  1693. .generic_bulk_ctrl_endpoint = 0x01,
  1694. .rc.core = {
  1695. .rc_interval = 100,
  1696. .rc_codes = RC_MAP_DVICO_PORTABLE,
  1697. .module_name = KBUILD_MODNAME,
  1698. .rc_query = cxusb_rc_query,
  1699. .allowed_protos = RC_BIT_NEC,
  1700. },
  1701. .num_device_descs = 1,
  1702. .devices = {
  1703. { "DViCO FusionHDTV DVB-T NANO2 w/o firmware",
  1704. { &cxusb_table[DVICO_BLUEBIRD_DVB_T_NANO_2], NULL },
  1705. { &cxusb_table[DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM], NULL },
  1706. },
  1707. }
  1708. };
  1709. static struct dvb_usb_device_properties cxusb_aver_a868r_properties = {
  1710. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1711. .usb_ctrl = CYPRESS_FX2,
  1712. .size_of_priv = sizeof(struct cxusb_state),
  1713. .num_adapters = 1,
  1714. .adapter = {
  1715. {
  1716. .num_frontends = 1,
  1717. .fe = {{
  1718. .streaming_ctrl = cxusb_aver_streaming_ctrl,
  1719. .frontend_attach = cxusb_aver_lgdt3303_frontend_attach,
  1720. .tuner_attach = cxusb_mxl5003s_tuner_attach,
  1721. /* parameter for the MPEG2-data transfer */
  1722. .stream = {
  1723. .type = USB_BULK,
  1724. .count = 5,
  1725. .endpoint = 0x04,
  1726. .u = {
  1727. .bulk = {
  1728. .buffersize = 8192,
  1729. }
  1730. }
  1731. },
  1732. }},
  1733. },
  1734. },
  1735. .power_ctrl = cxusb_aver_power_ctrl,
  1736. .i2c_algo = &cxusb_i2c_algo,
  1737. .generic_bulk_ctrl_endpoint = 0x01,
  1738. .num_device_descs = 1,
  1739. .devices = {
  1740. { "AVerMedia AVerTVHD Volar (A868R)",
  1741. { NULL },
  1742. { &cxusb_table[AVERMEDIA_VOLAR_A868R], NULL },
  1743. },
  1744. }
  1745. };
  1746. static
  1747. struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties = {
  1748. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1749. .usb_ctrl = CYPRESS_FX2,
  1750. .size_of_priv = sizeof(struct cxusb_state),
  1751. .num_adapters = 1,
  1752. .adapter = {
  1753. {
  1754. .size_of_priv = sizeof(struct dib0700_adapter_state),
  1755. .num_frontends = 1,
  1756. .fe = {{
  1757. .streaming_ctrl = cxusb_streaming_ctrl,
  1758. .frontend_attach = cxusb_dualdig4_rev2_frontend_attach,
  1759. .tuner_attach = cxusb_dualdig4_rev2_tuner_attach,
  1760. /* parameter for the MPEG2-data transfer */
  1761. .stream = {
  1762. .type = USB_BULK,
  1763. .count = 7,
  1764. .endpoint = 0x02,
  1765. .u = {
  1766. .bulk = {
  1767. .buffersize = 4096,
  1768. }
  1769. }
  1770. },
  1771. }},
  1772. },
  1773. },
  1774. .power_ctrl = cxusb_bluebird_power_ctrl,
  1775. .i2c_algo = &cxusb_i2c_algo,
  1776. .generic_bulk_ctrl_endpoint = 0x01,
  1777. .rc.core = {
  1778. .rc_interval = 100,
  1779. .rc_codes = RC_MAP_DVICO_MCE,
  1780. .module_name = KBUILD_MODNAME,
  1781. .rc_query = cxusb_rc_query,
  1782. .allowed_protos = RC_BIT_NEC,
  1783. },
  1784. .num_device_descs = 1,
  1785. .devices = {
  1786. { "DViCO FusionHDTV DVB-T Dual Digital 4 (rev 2)",
  1787. { NULL },
  1788. { &cxusb_table[DVICO_BLUEBIRD_DUAL_4_REV_2], NULL },
  1789. },
  1790. }
  1791. };
  1792. static struct dvb_usb_device_properties cxusb_d680_dmb_properties = {
  1793. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1794. .usb_ctrl = CYPRESS_FX2,
  1795. .size_of_priv = sizeof(struct cxusb_state),
  1796. .num_adapters = 1,
  1797. .adapter = {
  1798. {
  1799. .num_frontends = 1,
  1800. .fe = {{
  1801. .streaming_ctrl = cxusb_d680_dmb_streaming_ctrl,
  1802. .frontend_attach = cxusb_d680_dmb_frontend_attach,
  1803. .tuner_attach = cxusb_d680_dmb_tuner_attach,
  1804. /* parameter for the MPEG2-data transfer */
  1805. .stream = {
  1806. .type = USB_BULK,
  1807. .count = 5,
  1808. .endpoint = 0x02,
  1809. .u = {
  1810. .bulk = {
  1811. .buffersize = 8192,
  1812. }
  1813. }
  1814. },
  1815. }},
  1816. },
  1817. },
  1818. .power_ctrl = cxusb_d680_dmb_power_ctrl,
  1819. .i2c_algo = &cxusb_i2c_algo,
  1820. .generic_bulk_ctrl_endpoint = 0x01,
  1821. .rc.core = {
  1822. .rc_interval = 100,
  1823. .rc_codes = RC_MAP_D680_DMB,
  1824. .module_name = KBUILD_MODNAME,
  1825. .rc_query = cxusb_d680_dmb_rc_query,
  1826. .allowed_protos = RC_BIT_UNKNOWN,
  1827. },
  1828. .num_device_descs = 1,
  1829. .devices = {
  1830. {
  1831. "Conexant DMB-TH Stick",
  1832. { NULL },
  1833. { &cxusb_table[CONEXANT_D680_DMB], NULL },
  1834. },
  1835. }
  1836. };
  1837. static struct dvb_usb_device_properties cxusb_mygica_d689_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_mygica_d689_frontend_attach,
  1848. .tuner_attach = cxusb_mygica_d689_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.core = {
  1867. .rc_interval = 100,
  1868. .rc_codes = RC_MAP_D680_DMB,
  1869. .module_name = KBUILD_MODNAME,
  1870. .rc_query = cxusb_d680_dmb_rc_query,
  1871. .allowed_protos = RC_BIT_UNKNOWN,
  1872. },
  1873. .num_device_descs = 1,
  1874. .devices = {
  1875. {
  1876. "Mygica D689 DMB-TH",
  1877. { NULL },
  1878. { &cxusb_table[MYGICA_D689], NULL },
  1879. },
  1880. }
  1881. };
  1882. static struct dvb_usb_device_properties cxusb_mygica_t230_properties = {
  1883. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1884. .usb_ctrl = CYPRESS_FX2,
  1885. .size_of_priv = sizeof(struct cxusb_state),
  1886. .num_adapters = 1,
  1887. .adapter = {
  1888. {
  1889. .num_frontends = 1,
  1890. .fe = {{
  1891. .streaming_ctrl = cxusb_streaming_ctrl,
  1892. .frontend_attach = cxusb_mygica_t230_frontend_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.core = {
  1911. .rc_interval = 100,
  1912. .rc_codes = RC_MAP_TOTAL_MEDIA_IN_HAND_02,
  1913. .module_name = KBUILD_MODNAME,
  1914. .rc_query = cxusb_d680_dmb_rc_query,
  1915. .allowed_protos = RC_BIT_UNKNOWN,
  1916. },
  1917. .num_device_descs = 1,
  1918. .devices = {
  1919. {
  1920. "Mygica T230 DVB-T/T2/C",
  1921. { NULL },
  1922. { &cxusb_table[MYGICA_T230], NULL },
  1923. },
  1924. }
  1925. };
  1926. static struct dvb_usb_device_properties cxusb_mygica_t230c_properties = {
  1927. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  1928. .usb_ctrl = CYPRESS_FX2,
  1929. .size_of_priv = sizeof(struct cxusb_state),
  1930. .num_adapters = 1,
  1931. .adapter = {
  1932. {
  1933. .num_frontends = 1,
  1934. .fe = {{
  1935. .streaming_ctrl = cxusb_streaming_ctrl,
  1936. .frontend_attach = cxusb_mygica_t230c_frontend_attach,
  1937. /* parameter for the MPEG2-data transfer */
  1938. .stream = {
  1939. .type = USB_BULK,
  1940. .count = 5,
  1941. .endpoint = 0x02,
  1942. .u = {
  1943. .bulk = {
  1944. .buffersize = 8192,
  1945. }
  1946. }
  1947. },
  1948. } },
  1949. },
  1950. },
  1951. .power_ctrl = cxusb_d680_dmb_power_ctrl,
  1952. .i2c_algo = &cxusb_i2c_algo,
  1953. .generic_bulk_ctrl_endpoint = 0x01,
  1954. .rc.core = {
  1955. .rc_interval = 100,
  1956. .rc_codes = RC_MAP_TOTAL_MEDIA_IN_HAND_02,
  1957. .module_name = KBUILD_MODNAME,
  1958. .rc_query = cxusb_d680_dmb_rc_query,
  1959. .allowed_protos = RC_BIT_UNKNOWN,
  1960. },
  1961. .num_device_descs = 1,
  1962. .devices = {
  1963. {
  1964. "Mygica T230C DVB-T/T2/C",
  1965. { NULL },
  1966. { &cxusb_table[MYGICA_T230C], NULL },
  1967. },
  1968. }
  1969. };
  1970. static struct usb_driver cxusb_driver = {
  1971. .name = "dvb_usb_cxusb",
  1972. .probe = cxusb_probe,
  1973. .disconnect = cxusb_disconnect,
  1974. .id_table = cxusb_table,
  1975. };
  1976. module_usb_driver(cxusb_driver);
  1977. MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@posteo.de>");
  1978. MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>");
  1979. MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
  1980. MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design");
  1981. MODULE_VERSION("1.0-alpha");
  1982. MODULE_LICENSE("GPL");