mxl111sf.c 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835
  1. /*
  2. * Copyright (C) 2010 Michael Krufky (mkrufky@kernellabs.com)
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms of the GNU General Public License as published by the Free
  6. * Software Foundation, version 2.
  7. *
  8. * see Documentation/dvb/README.dvb-usb for more information
  9. */
  10. #include <linux/vmalloc.h>
  11. #include <linux/i2c.h>
  12. #include "mxl111sf.h"
  13. #include "mxl111sf-reg.h"
  14. #include "mxl111sf-phy.h"
  15. #include "mxl111sf-i2c.h"
  16. #include "mxl111sf-gpio.h"
  17. #include "mxl111sf-demod.h"
  18. #include "mxl111sf-tuner.h"
  19. #include "lgdt3305.h"
  20. #include "lg2160.h"
  21. int dvb_usb_mxl111sf_debug;
  22. module_param_named(debug, dvb_usb_mxl111sf_debug, int, 0644);
  23. MODULE_PARM_DESC(debug, "set debugging level "
  24. "(1=info, 2=xfer, 4=i2c, 8=reg, 16=adv (or-able)).");
  25. int dvb_usb_mxl111sf_isoc;
  26. module_param_named(isoc, dvb_usb_mxl111sf_isoc, int, 0644);
  27. MODULE_PARM_DESC(isoc, "enable usb isoc xfer (0=bulk, 1=isoc).");
  28. int dvb_usb_mxl111sf_spi;
  29. module_param_named(spi, dvb_usb_mxl111sf_spi, int, 0644);
  30. MODULE_PARM_DESC(spi, "use spi rather than tp for data xfer (0=tp, 1=spi).");
  31. #define ANT_PATH_AUTO 0
  32. #define ANT_PATH_EXTERNAL 1
  33. #define ANT_PATH_INTERNAL 2
  34. int dvb_usb_mxl111sf_rfswitch =
  35. #if 0
  36. ANT_PATH_AUTO;
  37. #else
  38. ANT_PATH_EXTERNAL;
  39. #endif
  40. module_param_named(rfswitch, dvb_usb_mxl111sf_rfswitch, int, 0644);
  41. MODULE_PARM_DESC(rfswitch, "force rf switch position (0=auto, 1=ext, 2=int).");
  42. DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
  43. #define deb_info(args...) dprintk(dvb_usb_mxl111sf_debug, 0x13, args)
  44. #define deb_reg(args...) dprintk(dvb_usb_mxl111sf_debug, 0x08, args)
  45. #define deb_adv(args...) dprintk(dvb_usb_mxl111sf_debug, MXL_ADV_DBG, args)
  46. int mxl111sf_ctrl_msg(struct dvb_usb_device *d,
  47. u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen)
  48. {
  49. int wo = (rbuf == NULL || rlen == 0); /* write-only */
  50. int ret;
  51. u8 sndbuf[1+wlen];
  52. deb_adv("%s(wlen = %d, rlen = %d)\n", __func__, wlen, rlen);
  53. memset(sndbuf, 0, 1+wlen);
  54. sndbuf[0] = cmd;
  55. memcpy(&sndbuf[1], wbuf, wlen);
  56. ret = (wo) ? dvb_usb_generic_write(d, sndbuf, 1+wlen) :
  57. dvb_usb_generic_rw(d, sndbuf, 1+wlen, rbuf, rlen, 0);
  58. mxl_fail(ret);
  59. return ret;
  60. }
  61. /* ------------------------------------------------------------------------ */
  62. #define MXL_CMD_REG_READ 0xaa
  63. #define MXL_CMD_REG_WRITE 0x55
  64. int mxl111sf_read_reg(struct mxl111sf_state *state, u8 addr, u8 *data)
  65. {
  66. u8 buf[2];
  67. int ret;
  68. ret = mxl111sf_ctrl_msg(state->d, MXL_CMD_REG_READ, &addr, 1, buf, 2);
  69. if (mxl_fail(ret)) {
  70. mxl_debug("error reading reg: 0x%02x", addr);
  71. goto fail;
  72. }
  73. if (buf[0] == addr)
  74. *data = buf[1];
  75. else {
  76. err("invalid response reading reg: 0x%02x != 0x%02x, 0x%02x",
  77. addr, buf[0], buf[1]);
  78. ret = -EINVAL;
  79. }
  80. deb_reg("R: (0x%02x, 0x%02x)\n", addr, *data);
  81. fail:
  82. return ret;
  83. }
  84. int mxl111sf_write_reg(struct mxl111sf_state *state, u8 addr, u8 data)
  85. {
  86. u8 buf[] = { addr, data };
  87. int ret;
  88. deb_reg("W: (0x%02x, 0x%02x)\n", addr, data);
  89. ret = mxl111sf_ctrl_msg(state->d, MXL_CMD_REG_WRITE, buf, 2, NULL, 0);
  90. if (mxl_fail(ret))
  91. err("error writing reg: 0x%02x, val: 0x%02x", addr, data);
  92. return ret;
  93. }
  94. /* ------------------------------------------------------------------------ */
  95. int mxl111sf_write_reg_mask(struct mxl111sf_state *state,
  96. u8 addr, u8 mask, u8 data)
  97. {
  98. int ret;
  99. u8 val;
  100. if (mask != 0xff) {
  101. ret = mxl111sf_read_reg(state, addr, &val);
  102. #if 1
  103. /* dont know why this usually errors out on the first try */
  104. if (mxl_fail(ret))
  105. err("error writing addr: 0x%02x, mask: 0x%02x, "
  106. "data: 0x%02x, retrying...", addr, mask, data);
  107. ret = mxl111sf_read_reg(state, addr, &val);
  108. #endif
  109. if (mxl_fail(ret))
  110. goto fail;
  111. }
  112. val &= ~mask;
  113. val |= data;
  114. ret = mxl111sf_write_reg(state, addr, val);
  115. mxl_fail(ret);
  116. fail:
  117. return ret;
  118. }
  119. /* ------------------------------------------------------------------------ */
  120. int mxl111sf_ctrl_program_regs(struct mxl111sf_state *state,
  121. struct mxl111sf_reg_ctrl_info *ctrl_reg_info)
  122. {
  123. int i, ret = 0;
  124. for (i = 0; ctrl_reg_info[i].addr |
  125. ctrl_reg_info[i].mask |
  126. ctrl_reg_info[i].data; i++) {
  127. ret = mxl111sf_write_reg_mask(state,
  128. ctrl_reg_info[i].addr,
  129. ctrl_reg_info[i].mask,
  130. ctrl_reg_info[i].data);
  131. if (mxl_fail(ret)) {
  132. err("failed on reg #%d (0x%02x)", i,
  133. ctrl_reg_info[i].addr);
  134. break;
  135. }
  136. }
  137. return ret;
  138. }
  139. /* ------------------------------------------------------------------------ */
  140. static int mxl1x1sf_get_chip_info(struct mxl111sf_state *state)
  141. {
  142. int ret;
  143. u8 id, ver;
  144. char *mxl_chip, *mxl_rev;
  145. if ((state->chip_id) && (state->chip_ver))
  146. return 0;
  147. ret = mxl111sf_read_reg(state, CHIP_ID_REG, &id);
  148. if (mxl_fail(ret))
  149. goto fail;
  150. state->chip_id = id;
  151. ret = mxl111sf_read_reg(state, TOP_CHIP_REV_ID_REG, &ver);
  152. if (mxl_fail(ret))
  153. goto fail;
  154. state->chip_ver = ver;
  155. switch (id) {
  156. case 0x61:
  157. mxl_chip = "MxL101SF";
  158. break;
  159. case 0x63:
  160. mxl_chip = "MxL111SF";
  161. break;
  162. default:
  163. mxl_chip = "UNKNOWN MxL1X1";
  164. break;
  165. }
  166. switch (ver) {
  167. case 0x36:
  168. state->chip_rev = MXL111SF_V6;
  169. mxl_rev = "v6";
  170. break;
  171. case 0x08:
  172. state->chip_rev = MXL111SF_V8_100;
  173. mxl_rev = "v8_100";
  174. break;
  175. case 0x18:
  176. state->chip_rev = MXL111SF_V8_200;
  177. mxl_rev = "v8_200";
  178. break;
  179. default:
  180. state->chip_rev = 0;
  181. mxl_rev = "UNKNOWN REVISION";
  182. break;
  183. }
  184. info("%s detected, %s (0x%x)", mxl_chip, mxl_rev, ver);
  185. fail:
  186. return ret;
  187. }
  188. #define get_chip_info(state) \
  189. ({ \
  190. int ___ret; \
  191. ___ret = mxl1x1sf_get_chip_info(state); \
  192. if (mxl_fail(___ret)) { \
  193. mxl_debug("failed to get chip info" \
  194. " on first probe attempt"); \
  195. ___ret = mxl1x1sf_get_chip_info(state); \
  196. if (mxl_fail(___ret)) \
  197. err("failed to get chip info during probe"); \
  198. else \
  199. mxl_debug("probe needed a retry " \
  200. "in order to succeed."); \
  201. } \
  202. ___ret; \
  203. })
  204. /* ------------------------------------------------------------------------ */
  205. static int mxl111sf_power_ctrl(struct dvb_usb_device *d, int onoff)
  206. {
  207. /* power control depends on which adapter is being woken:
  208. * save this for init, instead, via mxl111sf_adap_fe_init */
  209. return 0;
  210. }
  211. static int mxl111sf_adap_fe_init(struct dvb_frontend *fe)
  212. {
  213. struct dvb_usb_adapter *adap = fe->dvb->priv;
  214. struct dvb_usb_device *d = adap->dev;
  215. struct mxl111sf_state *state = d->priv;
  216. struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe->id].priv;
  217. int err;
  218. /* exit if we didnt initialize the driver yet */
  219. if (!state->chip_id) {
  220. mxl_debug("driver not yet initialized, exit.");
  221. goto fail;
  222. }
  223. deb_info("%s()\n", __func__);
  224. mutex_lock(&state->fe_lock);
  225. state->alt_mode = adap_state->alt_mode;
  226. if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0)
  227. err("set interface failed");
  228. err = mxl1x1sf_soft_reset(state);
  229. mxl_fail(err);
  230. err = mxl111sf_init_tuner_demod(state);
  231. mxl_fail(err);
  232. err = mxl1x1sf_set_device_mode(state, adap_state->device_mode);
  233. mxl_fail(err);
  234. mxl111sf_enable_usb_output(state);
  235. mxl_fail(err);
  236. mxl1x1sf_top_master_ctrl(state, 1);
  237. mxl_fail(err);
  238. if ((MXL111SF_GPIO_MOD_DVBT != adap_state->gpio_mode) &&
  239. (state->chip_rev > MXL111SF_V6)) {
  240. mxl111sf_config_pin_mux_modes(state,
  241. PIN_MUX_TS_SPI_IN_MODE_1);
  242. mxl_fail(err);
  243. }
  244. err = mxl111sf_init_port_expander(state);
  245. if (!mxl_fail(err)) {
  246. state->gpio_mode = adap_state->gpio_mode;
  247. err = mxl111sf_gpio_mode_switch(state, state->gpio_mode);
  248. mxl_fail(err);
  249. #if 0
  250. err = fe->ops.init(fe);
  251. #endif
  252. msleep(100); /* add short delay after enabling
  253. * the demod before touching it */
  254. }
  255. return (adap_state->fe_init) ? adap_state->fe_init(fe) : 0;
  256. fail:
  257. return -ENODEV;
  258. }
  259. static int mxl111sf_adap_fe_sleep(struct dvb_frontend *fe)
  260. {
  261. struct dvb_usb_adapter *adap = fe->dvb->priv;
  262. struct dvb_usb_device *d = adap->dev;
  263. struct mxl111sf_state *state = d->priv;
  264. struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe->id].priv;
  265. int err;
  266. /* exit if we didnt initialize the driver yet */
  267. if (!state->chip_id) {
  268. mxl_debug("driver not yet initialized, exit.");
  269. goto fail;
  270. }
  271. deb_info("%s()\n", __func__);
  272. err = (adap_state->fe_sleep) ? adap_state->fe_sleep(fe) : 0;
  273. mutex_unlock(&state->fe_lock);
  274. return err;
  275. fail:
  276. return -ENODEV;
  277. }
  278. static int mxl111sf_ep6_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
  279. {
  280. struct dvb_usb_device *d = adap->dev;
  281. struct mxl111sf_state *state = d->priv;
  282. struct mxl111sf_adap_state *adap_state = adap->fe_adap[adap->active_fe].priv;
  283. int ret = 0;
  284. deb_info("%s(%d)\n", __func__, onoff);
  285. if (onoff) {
  286. ret = mxl111sf_enable_usb_output(state);
  287. mxl_fail(ret);
  288. ret = mxl111sf_config_mpeg_in(state, 1, 1,
  289. adap_state->ep6_clockphase,
  290. 0, 0);
  291. mxl_fail(ret);
  292. #if 0
  293. } else {
  294. ret = mxl111sf_disable_656_port(state);
  295. mxl_fail(ret);
  296. #endif
  297. }
  298. return ret;
  299. }
  300. static int mxl111sf_ep5_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
  301. {
  302. struct dvb_usb_device *d = adap->dev;
  303. struct mxl111sf_state *state = d->priv;
  304. int ret = 0;
  305. deb_info("%s(%d)\n", __func__, onoff);
  306. if (onoff) {
  307. ret = mxl111sf_enable_usb_output(state);
  308. mxl_fail(ret);
  309. ret = mxl111sf_init_i2s_port(state, 200);
  310. mxl_fail(ret);
  311. ret = mxl111sf_config_i2s(state, 0, 15);
  312. mxl_fail(ret);
  313. } else {
  314. ret = mxl111sf_disable_i2s_port(state);
  315. mxl_fail(ret);
  316. }
  317. if (state->chip_rev > MXL111SF_V6)
  318. ret = mxl111sf_config_spi(state, onoff);
  319. mxl_fail(ret);
  320. return ret;
  321. }
  322. static int mxl111sf_ep4_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
  323. {
  324. struct dvb_usb_device *d = adap->dev;
  325. struct mxl111sf_state *state = d->priv;
  326. int ret = 0;
  327. deb_info("%s(%d)\n", __func__, onoff);
  328. if (onoff) {
  329. ret = mxl111sf_enable_usb_output(state);
  330. mxl_fail(ret);
  331. }
  332. return ret;
  333. }
  334. /* ------------------------------------------------------------------------ */
  335. static struct lgdt3305_config hauppauge_lgdt3305_config = {
  336. .i2c_addr = 0xb2 >> 1,
  337. .mpeg_mode = LGDT3305_MPEG_SERIAL,
  338. .tpclk_edge = LGDT3305_TPCLK_RISING_EDGE,
  339. .tpvalid_polarity = LGDT3305_TP_VALID_HIGH,
  340. .deny_i2c_rptr = 1,
  341. .spectral_inversion = 0,
  342. .qam_if_khz = 6000,
  343. .vsb_if_khz = 6000,
  344. };
  345. static int mxl111sf_lgdt3305_frontend_attach(struct dvb_usb_adapter *adap)
  346. {
  347. struct dvb_usb_device *d = adap->dev;
  348. struct mxl111sf_state *state = d->priv;
  349. int fe_id = adap->num_frontends_initialized;
  350. struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe_id].priv;
  351. int ret;
  352. deb_adv("%s()\n", __func__);
  353. /* save a pointer to the dvb_usb_device in device state */
  354. state->d = d;
  355. adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1;
  356. state->alt_mode = adap_state->alt_mode;
  357. if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0)
  358. err("set interface failed");
  359. state->gpio_mode = MXL111SF_GPIO_MOD_ATSC;
  360. adap_state->gpio_mode = state->gpio_mode;
  361. adap_state->device_mode = MXL_TUNER_MODE;
  362. adap_state->ep6_clockphase = 1;
  363. ret = mxl1x1sf_soft_reset(state);
  364. if (mxl_fail(ret))
  365. goto fail;
  366. ret = mxl111sf_init_tuner_demod(state);
  367. if (mxl_fail(ret))
  368. goto fail;
  369. ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode);
  370. if (mxl_fail(ret))
  371. goto fail;
  372. ret = mxl111sf_enable_usb_output(state);
  373. if (mxl_fail(ret))
  374. goto fail;
  375. ret = mxl1x1sf_top_master_ctrl(state, 1);
  376. if (mxl_fail(ret))
  377. goto fail;
  378. ret = mxl111sf_init_port_expander(state);
  379. if (mxl_fail(ret))
  380. goto fail;
  381. ret = mxl111sf_gpio_mode_switch(state, state->gpio_mode);
  382. if (mxl_fail(ret))
  383. goto fail;
  384. adap->fe_adap[fe_id].fe = dvb_attach(lgdt3305_attach,
  385. &hauppauge_lgdt3305_config,
  386. &adap->dev->i2c_adap);
  387. if (adap->fe_adap[fe_id].fe) {
  388. adap_state->fe_init = adap->fe_adap[fe_id].fe->ops.init;
  389. adap->fe_adap[fe_id].fe->ops.init = mxl111sf_adap_fe_init;
  390. adap_state->fe_sleep = adap->fe_adap[fe_id].fe->ops.sleep;
  391. adap->fe_adap[fe_id].fe->ops.sleep = mxl111sf_adap_fe_sleep;
  392. return 0;
  393. }
  394. ret = -EIO;
  395. fail:
  396. return ret;
  397. }
  398. static struct lg2160_config hauppauge_lg2160_config = {
  399. .lg_chip = LG2160,
  400. .i2c_addr = 0x1c >> 1,
  401. .deny_i2c_rptr = 1,
  402. .spectral_inversion = 0,
  403. .if_khz = 6000,
  404. };
  405. static int mxl111sf_lg2160_frontend_attach(struct dvb_usb_adapter *adap)
  406. {
  407. struct dvb_usb_device *d = adap->dev;
  408. struct mxl111sf_state *state = d->priv;
  409. int fe_id = adap->num_frontends_initialized;
  410. struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe_id].priv;
  411. int ret;
  412. deb_adv("%s()\n", __func__);
  413. /* save a pointer to the dvb_usb_device in device state */
  414. state->d = d;
  415. adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1;
  416. state->alt_mode = adap_state->alt_mode;
  417. if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0)
  418. err("set interface failed");
  419. state->gpio_mode = MXL111SF_GPIO_MOD_MH;
  420. adap_state->gpio_mode = state->gpio_mode;
  421. adap_state->device_mode = MXL_TUNER_MODE;
  422. adap_state->ep6_clockphase = 1;
  423. ret = mxl1x1sf_soft_reset(state);
  424. if (mxl_fail(ret))
  425. goto fail;
  426. ret = mxl111sf_init_tuner_demod(state);
  427. if (mxl_fail(ret))
  428. goto fail;
  429. ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode);
  430. if (mxl_fail(ret))
  431. goto fail;
  432. ret = mxl111sf_enable_usb_output(state);
  433. if (mxl_fail(ret))
  434. goto fail;
  435. ret = mxl1x1sf_top_master_ctrl(state, 1);
  436. if (mxl_fail(ret))
  437. goto fail;
  438. ret = mxl111sf_init_port_expander(state);
  439. if (mxl_fail(ret))
  440. goto fail;
  441. ret = mxl111sf_gpio_mode_switch(state, state->gpio_mode);
  442. if (mxl_fail(ret))
  443. goto fail;
  444. ret = get_chip_info(state);
  445. if (mxl_fail(ret))
  446. goto fail;
  447. adap->fe_adap[fe_id].fe = dvb_attach(lg2160_attach,
  448. &hauppauge_lg2160_config,
  449. &adap->dev->i2c_adap);
  450. if (adap->fe_adap[fe_id].fe) {
  451. adap_state->fe_init = adap->fe_adap[fe_id].fe->ops.init;
  452. adap->fe_adap[fe_id].fe->ops.init = mxl111sf_adap_fe_init;
  453. adap_state->fe_sleep = adap->fe_adap[fe_id].fe->ops.sleep;
  454. adap->fe_adap[fe_id].fe->ops.sleep = mxl111sf_adap_fe_sleep;
  455. return 0;
  456. }
  457. ret = -EIO;
  458. fail:
  459. return ret;
  460. }
  461. static struct lg2160_config hauppauge_lg2161_1019_config = {
  462. .lg_chip = LG2161_1019,
  463. .i2c_addr = 0x1c >> 1,
  464. .deny_i2c_rptr = 1,
  465. .spectral_inversion = 0,
  466. .if_khz = 6000,
  467. .output_if = 2, /* LG2161_OIF_SPI_MAS */
  468. };
  469. static struct lg2160_config hauppauge_lg2161_1040_config = {
  470. .lg_chip = LG2161_1040,
  471. .i2c_addr = 0x1c >> 1,
  472. .deny_i2c_rptr = 1,
  473. .spectral_inversion = 0,
  474. .if_khz = 6000,
  475. .output_if = 4, /* LG2161_OIF_SPI_MAS */
  476. };
  477. static int mxl111sf_lg2161_frontend_attach(struct dvb_usb_adapter *adap)
  478. {
  479. struct dvb_usb_device *d = adap->dev;
  480. struct mxl111sf_state *state = d->priv;
  481. int fe_id = adap->num_frontends_initialized;
  482. struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe_id].priv;
  483. int ret;
  484. deb_adv("%s()\n", __func__);
  485. /* save a pointer to the dvb_usb_device in device state */
  486. state->d = d;
  487. adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1;
  488. state->alt_mode = adap_state->alt_mode;
  489. if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0)
  490. err("set interface failed");
  491. state->gpio_mode = MXL111SF_GPIO_MOD_MH;
  492. adap_state->gpio_mode = state->gpio_mode;
  493. adap_state->device_mode = MXL_TUNER_MODE;
  494. adap_state->ep6_clockphase = 1;
  495. ret = mxl1x1sf_soft_reset(state);
  496. if (mxl_fail(ret))
  497. goto fail;
  498. ret = mxl111sf_init_tuner_demod(state);
  499. if (mxl_fail(ret))
  500. goto fail;
  501. ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode);
  502. if (mxl_fail(ret))
  503. goto fail;
  504. ret = mxl111sf_enable_usb_output(state);
  505. if (mxl_fail(ret))
  506. goto fail;
  507. ret = mxl1x1sf_top_master_ctrl(state, 1);
  508. if (mxl_fail(ret))
  509. goto fail;
  510. ret = mxl111sf_init_port_expander(state);
  511. if (mxl_fail(ret))
  512. goto fail;
  513. ret = mxl111sf_gpio_mode_switch(state, state->gpio_mode);
  514. if (mxl_fail(ret))
  515. goto fail;
  516. ret = get_chip_info(state);
  517. if (mxl_fail(ret))
  518. goto fail;
  519. adap->fe_adap[fe_id].fe = dvb_attach(lg2160_attach,
  520. (MXL111SF_V8_200 == state->chip_rev) ?
  521. &hauppauge_lg2161_1040_config :
  522. &hauppauge_lg2161_1019_config,
  523. &adap->dev->i2c_adap);
  524. if (adap->fe_adap[fe_id].fe) {
  525. adap_state->fe_init = adap->fe_adap[fe_id].fe->ops.init;
  526. adap->fe_adap[fe_id].fe->ops.init = mxl111sf_adap_fe_init;
  527. adap_state->fe_sleep = adap->fe_adap[fe_id].fe->ops.sleep;
  528. adap->fe_adap[fe_id].fe->ops.sleep = mxl111sf_adap_fe_sleep;
  529. return 0;
  530. }
  531. ret = -EIO;
  532. fail:
  533. return ret;
  534. }
  535. static struct lg2160_config hauppauge_lg2161_1019_ep6_config = {
  536. .lg_chip = LG2161_1019,
  537. .i2c_addr = 0x1c >> 1,
  538. .deny_i2c_rptr = 1,
  539. .spectral_inversion = 0,
  540. .if_khz = 6000,
  541. .output_if = 1, /* LG2161_OIF_SERIAL_TS */
  542. };
  543. static struct lg2160_config hauppauge_lg2161_1040_ep6_config = {
  544. .lg_chip = LG2161_1040,
  545. .i2c_addr = 0x1c >> 1,
  546. .deny_i2c_rptr = 1,
  547. .spectral_inversion = 0,
  548. .if_khz = 6000,
  549. .output_if = 7, /* LG2161_OIF_SERIAL_TS */
  550. };
  551. static int mxl111sf_lg2161_ep6_frontend_attach(struct dvb_usb_adapter *adap)
  552. {
  553. struct dvb_usb_device *d = adap->dev;
  554. struct mxl111sf_state *state = d->priv;
  555. int fe_id = adap->num_frontends_initialized;
  556. struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe_id].priv;
  557. int ret;
  558. deb_adv("%s()\n", __func__);
  559. /* save a pointer to the dvb_usb_device in device state */
  560. state->d = d;
  561. adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1;
  562. state->alt_mode = adap_state->alt_mode;
  563. if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0)
  564. err("set interface failed");
  565. state->gpio_mode = MXL111SF_GPIO_MOD_MH;
  566. adap_state->gpio_mode = state->gpio_mode;
  567. adap_state->device_mode = MXL_TUNER_MODE;
  568. adap_state->ep6_clockphase = 0;
  569. ret = mxl1x1sf_soft_reset(state);
  570. if (mxl_fail(ret))
  571. goto fail;
  572. ret = mxl111sf_init_tuner_demod(state);
  573. if (mxl_fail(ret))
  574. goto fail;
  575. ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode);
  576. if (mxl_fail(ret))
  577. goto fail;
  578. ret = mxl111sf_enable_usb_output(state);
  579. if (mxl_fail(ret))
  580. goto fail;
  581. ret = mxl1x1sf_top_master_ctrl(state, 1);
  582. if (mxl_fail(ret))
  583. goto fail;
  584. ret = mxl111sf_init_port_expander(state);
  585. if (mxl_fail(ret))
  586. goto fail;
  587. ret = mxl111sf_gpio_mode_switch(state, state->gpio_mode);
  588. if (mxl_fail(ret))
  589. goto fail;
  590. ret = get_chip_info(state);
  591. if (mxl_fail(ret))
  592. goto fail;
  593. adap->fe_adap[fe_id].fe = dvb_attach(lg2160_attach,
  594. (MXL111SF_V8_200 == state->chip_rev) ?
  595. &hauppauge_lg2161_1040_ep6_config :
  596. &hauppauge_lg2161_1019_ep6_config,
  597. &adap->dev->i2c_adap);
  598. if (adap->fe_adap[fe_id].fe) {
  599. adap_state->fe_init = adap->fe_adap[fe_id].fe->ops.init;
  600. adap->fe_adap[fe_id].fe->ops.init = mxl111sf_adap_fe_init;
  601. adap_state->fe_sleep = adap->fe_adap[fe_id].fe->ops.sleep;
  602. adap->fe_adap[fe_id].fe->ops.sleep = mxl111sf_adap_fe_sleep;
  603. return 0;
  604. }
  605. ret = -EIO;
  606. fail:
  607. return ret;
  608. }
  609. static struct mxl111sf_demod_config mxl_demod_config = {
  610. .read_reg = mxl111sf_read_reg,
  611. .write_reg = mxl111sf_write_reg,
  612. .program_regs = mxl111sf_ctrl_program_regs,
  613. };
  614. static int mxl111sf_attach_demod(struct dvb_usb_adapter *adap)
  615. {
  616. struct dvb_usb_device *d = adap->dev;
  617. struct mxl111sf_state *state = d->priv;
  618. int fe_id = adap->num_frontends_initialized;
  619. struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe_id].priv;
  620. int ret;
  621. deb_adv("%s()\n", __func__);
  622. /* save a pointer to the dvb_usb_device in device state */
  623. state->d = d;
  624. adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 1 : 2;
  625. state->alt_mode = adap_state->alt_mode;
  626. if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0)
  627. err("set interface failed");
  628. state->gpio_mode = MXL111SF_GPIO_MOD_DVBT;
  629. adap_state->gpio_mode = state->gpio_mode;
  630. adap_state->device_mode = MXL_SOC_MODE;
  631. adap_state->ep6_clockphase = 1;
  632. ret = mxl1x1sf_soft_reset(state);
  633. if (mxl_fail(ret))
  634. goto fail;
  635. ret = mxl111sf_init_tuner_demod(state);
  636. if (mxl_fail(ret))
  637. goto fail;
  638. ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode);
  639. if (mxl_fail(ret))
  640. goto fail;
  641. ret = mxl111sf_enable_usb_output(state);
  642. if (mxl_fail(ret))
  643. goto fail;
  644. ret = mxl1x1sf_top_master_ctrl(state, 1);
  645. if (mxl_fail(ret))
  646. goto fail;
  647. /* dont care if this fails */
  648. mxl111sf_init_port_expander(state);
  649. adap->fe_adap[fe_id].fe = dvb_attach(mxl111sf_demod_attach, state,
  650. &mxl_demod_config);
  651. if (adap->fe_adap[fe_id].fe) {
  652. adap_state->fe_init = adap->fe_adap[fe_id].fe->ops.init;
  653. adap->fe_adap[fe_id].fe->ops.init = mxl111sf_adap_fe_init;
  654. adap_state->fe_sleep = adap->fe_adap[fe_id].fe->ops.sleep;
  655. adap->fe_adap[fe_id].fe->ops.sleep = mxl111sf_adap_fe_sleep;
  656. return 0;
  657. }
  658. ret = -EIO;
  659. fail:
  660. return ret;
  661. }
  662. static inline int mxl111sf_set_ant_path(struct mxl111sf_state *state,
  663. int antpath)
  664. {
  665. return mxl111sf_idac_config(state, 1, 1,
  666. (antpath == ANT_PATH_INTERNAL) ?
  667. 0x3f : 0x00, 0);
  668. }
  669. #define DbgAntHunt(x, pwr0, pwr1, pwr2, pwr3) \
  670. err("%s(%d) FINAL input set to %s rxPwr:%d|%d|%d|%d\n", \
  671. __func__, __LINE__, \
  672. (ANT_PATH_EXTERNAL == x) ? "EXTERNAL" : "INTERNAL", \
  673. pwr0, pwr1, pwr2, pwr3)
  674. #define ANT_HUNT_SLEEP 90
  675. #define ANT_EXT_TWEAK 0
  676. static int mxl111sf_ant_hunt(struct dvb_frontend *fe)
  677. {
  678. struct dvb_usb_adapter *adap = fe->dvb->priv;
  679. struct dvb_usb_device *d = adap->dev;
  680. struct mxl111sf_state *state = d->priv;
  681. int antctrl = dvb_usb_mxl111sf_rfswitch;
  682. u16 rxPwrA, rxPwr0, rxPwr1, rxPwr2;
  683. /* FIXME: must force EXTERNAL for QAM - done elsewhere */
  684. mxl111sf_set_ant_path(state, antctrl == ANT_PATH_AUTO ?
  685. ANT_PATH_EXTERNAL : antctrl);
  686. if (antctrl == ANT_PATH_AUTO) {
  687. #if 0
  688. msleep(ANT_HUNT_SLEEP);
  689. #endif
  690. fe->ops.tuner_ops.get_rf_strength(fe, &rxPwrA);
  691. mxl111sf_set_ant_path(state, ANT_PATH_EXTERNAL);
  692. msleep(ANT_HUNT_SLEEP);
  693. fe->ops.tuner_ops.get_rf_strength(fe, &rxPwr0);
  694. mxl111sf_set_ant_path(state, ANT_PATH_EXTERNAL);
  695. msleep(ANT_HUNT_SLEEP);
  696. fe->ops.tuner_ops.get_rf_strength(fe, &rxPwr1);
  697. mxl111sf_set_ant_path(state, ANT_PATH_INTERNAL);
  698. msleep(ANT_HUNT_SLEEP);
  699. fe->ops.tuner_ops.get_rf_strength(fe, &rxPwr2);
  700. if (rxPwr1+ANT_EXT_TWEAK >= rxPwr2) {
  701. /* return with EXTERNAL enabled */
  702. mxl111sf_set_ant_path(state, ANT_PATH_EXTERNAL);
  703. DbgAntHunt(ANT_PATH_EXTERNAL, rxPwrA,
  704. rxPwr0, rxPwr1, rxPwr2);
  705. } else {
  706. /* return with INTERNAL enabled */
  707. DbgAntHunt(ANT_PATH_INTERNAL, rxPwrA,
  708. rxPwr0, rxPwr1, rxPwr2);
  709. }
  710. }
  711. return 0;
  712. }
  713. static struct mxl111sf_tuner_config mxl_tuner_config = {
  714. .if_freq = MXL_IF_6_0, /* applies to external IF output, only */
  715. .invert_spectrum = 0,
  716. .read_reg = mxl111sf_read_reg,
  717. .write_reg = mxl111sf_write_reg,
  718. .program_regs = mxl111sf_ctrl_program_regs,
  719. .top_master_ctrl = mxl1x1sf_top_master_ctrl,
  720. .ant_hunt = mxl111sf_ant_hunt,
  721. };
  722. static int mxl111sf_attach_tuner(struct dvb_usb_adapter *adap)
  723. {
  724. struct dvb_usb_device *d = adap->dev;
  725. struct mxl111sf_state *state = d->priv;
  726. int fe_id = adap->num_frontends_initialized;
  727. deb_adv("%s()\n", __func__);
  728. if (NULL != dvb_attach(mxl111sf_tuner_attach,
  729. adap->fe_adap[fe_id].fe, state,
  730. &mxl_tuner_config))
  731. return 0;
  732. return -EIO;
  733. }
  734. static int mxl111sf_fe_ioctl_override(struct dvb_frontend *fe,
  735. unsigned int cmd, void *parg,
  736. unsigned int stage)
  737. {
  738. int err = 0;
  739. switch (stage) {
  740. case DVB_FE_IOCTL_PRE:
  741. switch (cmd) {
  742. case FE_READ_SIGNAL_STRENGTH:
  743. err = fe->ops.tuner_ops.get_rf_strength(fe, parg);
  744. /* If no error occurs, prevent dvb-core from handling
  745. * this IOCTL, otherwise return the error */
  746. if (0 == err)
  747. err = 1;
  748. break;
  749. }
  750. break;
  751. case DVB_FE_IOCTL_POST:
  752. /* no post-ioctl handling required */
  753. break;
  754. }
  755. return err;
  756. };
  757. static u32 mxl111sf_i2c_func(struct i2c_adapter *adapter)
  758. {
  759. return I2C_FUNC_I2C;
  760. }
  761. struct i2c_algorithm mxl111sf_i2c_algo = {
  762. .master_xfer = mxl111sf_i2c_xfer,
  763. .functionality = mxl111sf_i2c_func,
  764. #ifdef NEED_ALGO_CONTROL
  765. .algo_control = dummy_algo_control,
  766. #endif
  767. };
  768. static struct dvb_usb_device_properties mxl111sf_dvbt_bulk_properties;
  769. static struct dvb_usb_device_properties mxl111sf_dvbt_isoc_properties;
  770. static struct dvb_usb_device_properties mxl111sf_atsc_bulk_properties;
  771. static struct dvb_usb_device_properties mxl111sf_atsc_isoc_properties;
  772. static struct dvb_usb_device_properties mxl111sf_atsc_mh_bulk_properties;
  773. static struct dvb_usb_device_properties mxl111sf_atsc_mh_isoc_properties;
  774. static struct dvb_usb_device_properties mxl111sf_mh_bulk_properties;
  775. static struct dvb_usb_device_properties mxl111sf_mh_isoc_properties;
  776. static struct dvb_usb_device_properties mxl111sf_mercury_spi_bulk_properties;
  777. static struct dvb_usb_device_properties mxl111sf_mercury_spi_isoc_properties;
  778. static struct dvb_usb_device_properties mxl111sf_mercury_tp_bulk_properties;
  779. static struct dvb_usb_device_properties mxl111sf_mercury_tp_isoc_properties;
  780. static struct dvb_usb_device_properties mxl111sf_mercury_mh_spi_bulk_properties;
  781. static struct dvb_usb_device_properties mxl111sf_mercury_mh_spi_isoc_properties;
  782. static struct dvb_usb_device_properties mxl111sf_mercury_mh_tp_bulk_properties;
  783. static struct dvb_usb_device_properties mxl111sf_mercury_mh_tp_isoc_properties;
  784. static int mxl111sf_probe(struct usb_interface *intf,
  785. const struct usb_device_id *id)
  786. {
  787. struct dvb_usb_device *d = NULL;
  788. deb_adv("%s()\n", __func__);
  789. if (((dvb_usb_mxl111sf_isoc) &&
  790. (0 == dvb_usb_device_init(intf,
  791. &mxl111sf_dvbt_isoc_properties,
  792. THIS_MODULE, &d, adapter_nr) ||
  793. 0 == dvb_usb_device_init(intf,
  794. &mxl111sf_atsc_isoc_properties,
  795. THIS_MODULE, &d, adapter_nr) ||
  796. 0 == dvb_usb_device_init(intf,
  797. &mxl111sf_atsc_mh_isoc_properties,
  798. THIS_MODULE, &d, adapter_nr) ||
  799. 0 == dvb_usb_device_init(intf,
  800. &mxl111sf_mh_isoc_properties,
  801. THIS_MODULE, &d, adapter_nr) ||
  802. ((dvb_usb_mxl111sf_spi) &&
  803. (0 == dvb_usb_device_init(intf,
  804. &mxl111sf_mercury_spi_isoc_properties,
  805. THIS_MODULE, &d, adapter_nr) ||
  806. 0 == dvb_usb_device_init(intf,
  807. &mxl111sf_mercury_mh_spi_isoc_properties,
  808. THIS_MODULE, &d, adapter_nr))) ||
  809. 0 == dvb_usb_device_init(intf,
  810. &mxl111sf_mercury_tp_isoc_properties,
  811. THIS_MODULE, &d, adapter_nr) ||
  812. 0 == dvb_usb_device_init(intf,
  813. &mxl111sf_mercury_mh_tp_isoc_properties,
  814. THIS_MODULE, &d, adapter_nr))) ||
  815. 0 == dvb_usb_device_init(intf,
  816. &mxl111sf_dvbt_bulk_properties,
  817. THIS_MODULE, &d, adapter_nr) ||
  818. 0 == dvb_usb_device_init(intf,
  819. &mxl111sf_atsc_bulk_properties,
  820. THIS_MODULE, &d, adapter_nr) ||
  821. 0 == dvb_usb_device_init(intf,
  822. &mxl111sf_atsc_mh_bulk_properties,
  823. THIS_MODULE, &d, adapter_nr) ||
  824. 0 == dvb_usb_device_init(intf,
  825. &mxl111sf_mh_bulk_properties,
  826. THIS_MODULE, &d, adapter_nr) ||
  827. ((dvb_usb_mxl111sf_spi) &&
  828. (0 == dvb_usb_device_init(intf,
  829. &mxl111sf_mercury_spi_bulk_properties,
  830. THIS_MODULE, &d, adapter_nr) ||
  831. 0 == dvb_usb_device_init(intf,
  832. &mxl111sf_mercury_mh_spi_bulk_properties,
  833. THIS_MODULE, &d, adapter_nr))) ||
  834. 0 == dvb_usb_device_init(intf,
  835. &mxl111sf_mercury_tp_bulk_properties,
  836. THIS_MODULE, &d, adapter_nr) ||
  837. 0 == dvb_usb_device_init(intf,
  838. &mxl111sf_mercury_mh_tp_bulk_properties,
  839. THIS_MODULE, &d, adapter_nr) || 0) {
  840. struct mxl111sf_state *state = d->priv;
  841. static u8 eeprom[256];
  842. struct i2c_client c;
  843. int ret;
  844. ret = get_chip_info(state);
  845. if (mxl_fail(ret))
  846. err("failed to get chip info during probe");
  847. mutex_init(&state->fe_lock);
  848. if (state->chip_rev > MXL111SF_V6)
  849. mxl111sf_config_pin_mux_modes(state,
  850. PIN_MUX_TS_SPI_IN_MODE_1);
  851. c.adapter = &d->i2c_adap;
  852. c.addr = 0xa0 >> 1;
  853. ret = tveeprom_read(&c, eeprom, sizeof(eeprom));
  854. if (mxl_fail(ret))
  855. return 0;
  856. tveeprom_hauppauge_analog(&c, &state->tv,
  857. (0x84 == eeprom[0xa0]) ?
  858. eeprom + 0xa0 : eeprom + 0x80);
  859. #if 0
  860. switch (state->tv.model) {
  861. case 117001:
  862. case 126001:
  863. case 138001:
  864. break;
  865. default:
  866. printk(KERN_WARNING "%s: warning: "
  867. "unknown hauppauge model #%d\n",
  868. __func__, state->tv.model);
  869. }
  870. #endif
  871. return 0;
  872. }
  873. err("Your device is not yet supported by this driver. "
  874. "See kernellabs.com for more info");
  875. return -EINVAL;
  876. }
  877. static struct usb_device_id mxl111sf_table[] = {
  878. /* 0 */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc600) }, /* ATSC+ IR */
  879. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc601) }, /* ATSC */
  880. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc602) }, /* + */
  881. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc603) }, /* ATSC+ */
  882. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc604) }, /* DVBT */
  883. /* 5 */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc609) }, /* ATSC IR */
  884. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc60a) }, /* + IR */
  885. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc60b) }, /* ATSC+ IR */
  886. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc60c) }, /* DVBT IR */
  887. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc653) }, /* ATSC+ */
  888. /*10 */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc65b) }, /* ATSC+ IR */
  889. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb700) }, /* ATSC+ sw */
  890. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb701) }, /* ATSC sw */
  891. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb702) }, /* + sw */
  892. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb703) }, /* ATSC+ sw */
  893. /*15 */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb704) }, /* DVBT sw */
  894. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb753) }, /* ATSC+ sw */
  895. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb763) }, /* ATSC+ no */
  896. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb764) }, /* DVBT no */
  897. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd853) }, /* ATSC+ sw */
  898. /*20 */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd854) }, /* DVBT sw */
  899. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd863) }, /* ATSC+ no */
  900. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd864) }, /* DVBT no */
  901. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd8d3) }, /* ATSC+ sw */
  902. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd8d4) }, /* DVBT sw */
  903. /*25 */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd8e3) }, /* ATSC+ no */
  904. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd8e4) }, /* DVBT no */
  905. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd8ff) }, /* ATSC+ */
  906. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc612) }, /* + */
  907. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc613) }, /* ATSC+ */
  908. /*30 */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc61a) }, /* + IR */
  909. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc61b) }, /* ATSC+ IR */
  910. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb757) }, /* ATSC+DVBT sw */
  911. { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb767) }, /* ATSC+DVBT no */
  912. {} /* Terminating entry */
  913. };
  914. MODULE_DEVICE_TABLE(usb, mxl111sf_table);
  915. #define MXL111SF_EP4_BULK_STREAMING_CONFIG \
  916. .size_of_priv = sizeof(struct mxl111sf_adap_state), \
  917. .streaming_ctrl = mxl111sf_ep4_streaming_ctrl, \
  918. .stream = { \
  919. .type = USB_BULK, \
  920. .count = 5, \
  921. .endpoint = 0x04, \
  922. .u = { \
  923. .bulk = { \
  924. .buffersize = 8192, \
  925. } \
  926. } \
  927. }
  928. /* FIXME: works for v6 but not v8 silicon */
  929. #define MXL111SF_EP4_ISOC_STREAMING_CONFIG \
  930. .size_of_priv = sizeof(struct mxl111sf_adap_state), \
  931. .streaming_ctrl = mxl111sf_ep4_streaming_ctrl, \
  932. .stream = { \
  933. .type = USB_ISOC, \
  934. .count = 5, \
  935. .endpoint = 0x04, \
  936. .u = { \
  937. .isoc = { \
  938. .framesperurb = 96, \
  939. /* FIXME: v6 SILICON: */ \
  940. .framesize = 564, \
  941. .interval = 1, \
  942. } \
  943. } \
  944. }
  945. #define MXL111SF_EP5_BULK_STREAMING_CONFIG \
  946. .size_of_priv = sizeof(struct mxl111sf_adap_state), \
  947. .streaming_ctrl = mxl111sf_ep5_streaming_ctrl, \
  948. .stream = { \
  949. .type = USB_BULK, \
  950. .count = 5, \
  951. .endpoint = 0x05, \
  952. .u = { \
  953. .bulk = { \
  954. .buffersize = 8192, \
  955. } \
  956. } \
  957. }
  958. #define MXL111SF_EP5_ISOC_STREAMING_CONFIG \
  959. .size_of_priv = sizeof(struct mxl111sf_adap_state), \
  960. .streaming_ctrl = mxl111sf_ep5_streaming_ctrl, \
  961. .stream = { \
  962. .type = USB_ISOC, \
  963. .count = 5, \
  964. .endpoint = 0x05, \
  965. .u = { \
  966. .isoc = { \
  967. .framesperurb = 96, \
  968. .framesize = 200, \
  969. .interval = 1, \
  970. } \
  971. } \
  972. }
  973. #define MXL111SF_EP6_BULK_STREAMING_CONFIG \
  974. .size_of_priv = sizeof(struct mxl111sf_adap_state), \
  975. .streaming_ctrl = mxl111sf_ep6_streaming_ctrl, \
  976. .stream = { \
  977. .type = USB_BULK, \
  978. .count = 5, \
  979. .endpoint = 0x06, \
  980. .u = { \
  981. .bulk = { \
  982. .buffersize = 8192, \
  983. } \
  984. } \
  985. }
  986. /* FIXME */
  987. #define MXL111SF_EP6_ISOC_STREAMING_CONFIG \
  988. .size_of_priv = sizeof(struct mxl111sf_adap_state), \
  989. .streaming_ctrl = mxl111sf_ep6_streaming_ctrl, \
  990. .stream = { \
  991. .type = USB_ISOC, \
  992. .count = 5, \
  993. .endpoint = 0x06, \
  994. .u = { \
  995. .isoc = { \
  996. .framesperurb = 24, \
  997. .framesize = 3072, \
  998. .interval = 1, \
  999. } \
  1000. } \
  1001. }
  1002. #define MXL111SF_DEFAULT_DEVICE_PROPERTIES \
  1003. .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
  1004. .usb_ctrl = DEVICE_SPECIFIC, \
  1005. /* use usb alt setting 1 for EP4 ISOC transfer (dvb-t), \
  1006. EP6 BULK transfer (atsc/qam), \
  1007. use usb alt setting 2 for EP4 BULK transfer (dvb-t), \
  1008. EP6 ISOC transfer (atsc/qam), \
  1009. */ \
  1010. .power_ctrl = mxl111sf_power_ctrl, \
  1011. .i2c_algo = &mxl111sf_i2c_algo, \
  1012. .generic_bulk_ctrl_endpoint = MXL_EP2_REG_WRITE, \
  1013. .generic_bulk_ctrl_endpoint_response = MXL_EP1_REG_READ, \
  1014. .size_of_priv = sizeof(struct mxl111sf_state)
  1015. static struct dvb_usb_device_properties mxl111sf_dvbt_bulk_properties = {
  1016. MXL111SF_DEFAULT_DEVICE_PROPERTIES,
  1017. .num_adapters = 1,
  1018. .adapter = {
  1019. {
  1020. .fe_ioctl_override = mxl111sf_fe_ioctl_override,
  1021. .num_frontends = 1,
  1022. .fe = {{
  1023. .frontend_attach = mxl111sf_attach_demod,
  1024. .tuner_attach = mxl111sf_attach_tuner,
  1025. MXL111SF_EP4_BULK_STREAMING_CONFIG,
  1026. } },
  1027. },
  1028. },
  1029. .num_device_descs = 3,
  1030. .devices = {
  1031. { "Hauppauge 126xxx DVBT (bulk)",
  1032. { NULL },
  1033. { &mxl111sf_table[4], &mxl111sf_table[8],
  1034. NULL },
  1035. },
  1036. { "Hauppauge 117xxx DVBT (bulk)",
  1037. { NULL },
  1038. { &mxl111sf_table[15], &mxl111sf_table[18],
  1039. NULL },
  1040. },
  1041. { "Hauppauge 138xxx DVBT (bulk)",
  1042. { NULL },
  1043. { &mxl111sf_table[20], &mxl111sf_table[22],
  1044. &mxl111sf_table[24], &mxl111sf_table[26],
  1045. NULL },
  1046. },
  1047. }
  1048. };
  1049. static struct dvb_usb_device_properties mxl111sf_dvbt_isoc_properties = {
  1050. MXL111SF_DEFAULT_DEVICE_PROPERTIES,
  1051. .num_adapters = 1,
  1052. .adapter = {
  1053. {
  1054. .fe_ioctl_override = mxl111sf_fe_ioctl_override,
  1055. .num_frontends = 1,
  1056. .fe = {{
  1057. .frontend_attach = mxl111sf_attach_demod,
  1058. .tuner_attach = mxl111sf_attach_tuner,
  1059. MXL111SF_EP4_ISOC_STREAMING_CONFIG,
  1060. } },
  1061. },
  1062. },
  1063. .num_device_descs = 3,
  1064. .devices = {
  1065. { "Hauppauge 126xxx DVBT (isoc)",
  1066. { NULL },
  1067. { &mxl111sf_table[4], &mxl111sf_table[8],
  1068. NULL },
  1069. },
  1070. { "Hauppauge 117xxx DVBT (isoc)",
  1071. { NULL },
  1072. { &mxl111sf_table[15], &mxl111sf_table[18],
  1073. NULL },
  1074. },
  1075. { "Hauppauge 138xxx DVBT (isoc)",
  1076. { NULL },
  1077. { &mxl111sf_table[20], &mxl111sf_table[22],
  1078. &mxl111sf_table[24], &mxl111sf_table[26],
  1079. NULL },
  1080. },
  1081. }
  1082. };
  1083. static struct dvb_usb_device_properties mxl111sf_atsc_bulk_properties = {
  1084. MXL111SF_DEFAULT_DEVICE_PROPERTIES,
  1085. .num_adapters = 1,
  1086. .adapter = {
  1087. {
  1088. .fe_ioctl_override = mxl111sf_fe_ioctl_override,
  1089. .num_frontends = 1,
  1090. .fe = {{
  1091. .frontend_attach = mxl111sf_lgdt3305_frontend_attach,
  1092. .tuner_attach = mxl111sf_attach_tuner,
  1093. MXL111SF_EP6_BULK_STREAMING_CONFIG,
  1094. }},
  1095. },
  1096. },
  1097. .num_device_descs = 2,
  1098. .devices = {
  1099. { "Hauppauge 126xxx ATSC (bulk)",
  1100. { NULL },
  1101. { &mxl111sf_table[1], &mxl111sf_table[5],
  1102. NULL },
  1103. },
  1104. { "Hauppauge 117xxx ATSC (bulk)",
  1105. { NULL },
  1106. { &mxl111sf_table[12],
  1107. NULL },
  1108. },
  1109. }
  1110. };
  1111. static struct dvb_usb_device_properties mxl111sf_atsc_isoc_properties = {
  1112. MXL111SF_DEFAULT_DEVICE_PROPERTIES,
  1113. .num_adapters = 1,
  1114. .adapter = {
  1115. {
  1116. .fe_ioctl_override = mxl111sf_fe_ioctl_override,
  1117. .num_frontends = 1,
  1118. .fe = {{
  1119. .frontend_attach = mxl111sf_lgdt3305_frontend_attach,
  1120. .tuner_attach = mxl111sf_attach_tuner,
  1121. MXL111SF_EP6_ISOC_STREAMING_CONFIG,
  1122. }},
  1123. },
  1124. },
  1125. .num_device_descs = 2,
  1126. .devices = {
  1127. { "Hauppauge 126xxx ATSC (isoc)",
  1128. { NULL },
  1129. { &mxl111sf_table[1], &mxl111sf_table[5],
  1130. NULL },
  1131. },
  1132. { "Hauppauge 117xxx ATSC (isoc)",
  1133. { NULL },
  1134. { &mxl111sf_table[12],
  1135. NULL },
  1136. },
  1137. }
  1138. };
  1139. static struct dvb_usb_device_properties mxl111sf_mh_bulk_properties = {
  1140. MXL111SF_DEFAULT_DEVICE_PROPERTIES,
  1141. .num_adapters = 1,
  1142. .adapter = {
  1143. {
  1144. .fe_ioctl_override = mxl111sf_fe_ioctl_override,
  1145. .num_frontends = 1,
  1146. .fe = {{
  1147. .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
  1148. .frontend_attach = mxl111sf_lg2160_frontend_attach,
  1149. .tuner_attach = mxl111sf_attach_tuner,
  1150. MXL111SF_EP5_BULK_STREAMING_CONFIG,
  1151. }},
  1152. },
  1153. },
  1154. .num_device_descs = 2,
  1155. .devices = {
  1156. { "HCW 126xxx (bulk)",
  1157. { NULL },
  1158. { &mxl111sf_table[2], &mxl111sf_table[6],
  1159. NULL },
  1160. },
  1161. { "HCW 117xxx (bulk)",
  1162. { NULL },
  1163. { &mxl111sf_table[13],
  1164. NULL },
  1165. },
  1166. }
  1167. };
  1168. static struct dvb_usb_device_properties mxl111sf_mh_isoc_properties = {
  1169. MXL111SF_DEFAULT_DEVICE_PROPERTIES,
  1170. .num_adapters = 1,
  1171. .adapter = {
  1172. {
  1173. .fe_ioctl_override = mxl111sf_fe_ioctl_override,
  1174. .num_frontends = 1,
  1175. .fe = {{
  1176. .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
  1177. .frontend_attach = mxl111sf_lg2160_frontend_attach,
  1178. .tuner_attach = mxl111sf_attach_tuner,
  1179. MXL111SF_EP5_ISOC_STREAMING_CONFIG,
  1180. }},
  1181. },
  1182. },
  1183. .num_device_descs = 2,
  1184. .devices = {
  1185. { "HCW 126xxx (isoc)",
  1186. { NULL },
  1187. { &mxl111sf_table[2], &mxl111sf_table[6],
  1188. NULL },
  1189. },
  1190. { "HCW 117xxx (isoc)",
  1191. { NULL },
  1192. { &mxl111sf_table[13],
  1193. NULL },
  1194. },
  1195. }
  1196. };
  1197. static struct dvb_usb_device_properties mxl111sf_atsc_mh_bulk_properties = {
  1198. MXL111SF_DEFAULT_DEVICE_PROPERTIES,
  1199. .num_adapters = 1,
  1200. .adapter = {
  1201. {
  1202. .fe_ioctl_override = mxl111sf_fe_ioctl_override,
  1203. .num_frontends = 3,
  1204. .fe = {{
  1205. .frontend_attach = mxl111sf_lgdt3305_frontend_attach,
  1206. .tuner_attach = mxl111sf_attach_tuner,
  1207. MXL111SF_EP6_BULK_STREAMING_CONFIG,
  1208. },
  1209. {
  1210. .frontend_attach = mxl111sf_attach_demod,
  1211. .tuner_attach = mxl111sf_attach_tuner,
  1212. MXL111SF_EP4_BULK_STREAMING_CONFIG,
  1213. },
  1214. {
  1215. .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
  1216. .frontend_attach = mxl111sf_lg2160_frontend_attach,
  1217. .tuner_attach = mxl111sf_attach_tuner,
  1218. MXL111SF_EP5_BULK_STREAMING_CONFIG,
  1219. }},
  1220. },
  1221. },
  1222. .num_device_descs = 2,
  1223. .devices = {
  1224. { "Hauppauge 126xxx ATSC+ (bulk)",
  1225. { NULL },
  1226. { &mxl111sf_table[0], &mxl111sf_table[3],
  1227. &mxl111sf_table[7], &mxl111sf_table[9],
  1228. &mxl111sf_table[10], NULL },
  1229. },
  1230. { "Hauppauge 117xxx ATSC+ (bulk)",
  1231. { NULL },
  1232. { &mxl111sf_table[11], &mxl111sf_table[14],
  1233. &mxl111sf_table[16], &mxl111sf_table[17],
  1234. &mxl111sf_table[32], &mxl111sf_table[33],
  1235. NULL },
  1236. },
  1237. }
  1238. };
  1239. static struct dvb_usb_device_properties mxl111sf_atsc_mh_isoc_properties = {
  1240. MXL111SF_DEFAULT_DEVICE_PROPERTIES,
  1241. .num_adapters = 1,
  1242. .adapter = {
  1243. {
  1244. .fe_ioctl_override = mxl111sf_fe_ioctl_override,
  1245. .num_frontends = 3,
  1246. .fe = {{
  1247. .frontend_attach = mxl111sf_lgdt3305_frontend_attach,
  1248. .tuner_attach = mxl111sf_attach_tuner,
  1249. MXL111SF_EP6_ISOC_STREAMING_CONFIG,
  1250. },
  1251. {
  1252. .frontend_attach = mxl111sf_attach_demod,
  1253. .tuner_attach = mxl111sf_attach_tuner,
  1254. MXL111SF_EP4_ISOC_STREAMING_CONFIG,
  1255. },
  1256. {
  1257. .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
  1258. .frontend_attach = mxl111sf_lg2160_frontend_attach,
  1259. .tuner_attach = mxl111sf_attach_tuner,
  1260. MXL111SF_EP5_ISOC_STREAMING_CONFIG,
  1261. }},
  1262. },
  1263. },
  1264. .num_device_descs = 2,
  1265. .devices = {
  1266. { "Hauppauge 126xxx ATSC+ (isoc)",
  1267. { NULL },
  1268. { &mxl111sf_table[0], &mxl111sf_table[3],
  1269. &mxl111sf_table[7], &mxl111sf_table[9],
  1270. &mxl111sf_table[10], NULL },
  1271. },
  1272. { "Hauppauge 117xxx ATSC+ (isoc)",
  1273. { NULL },
  1274. { &mxl111sf_table[11], &mxl111sf_table[14],
  1275. &mxl111sf_table[16], &mxl111sf_table[17],
  1276. &mxl111sf_table[32], &mxl111sf_table[33],
  1277. NULL },
  1278. },
  1279. }
  1280. };
  1281. static struct dvb_usb_device_properties mxl111sf_mercury_spi_bulk_properties = {
  1282. MXL111SF_DEFAULT_DEVICE_PROPERTIES,
  1283. .num_adapters = 1,
  1284. .adapter = {
  1285. {
  1286. .fe_ioctl_override = mxl111sf_fe_ioctl_override,
  1287. .num_frontends = 3,
  1288. .fe = {{
  1289. .frontend_attach = mxl111sf_lgdt3305_frontend_attach,
  1290. .tuner_attach = mxl111sf_attach_tuner,
  1291. MXL111SF_EP6_BULK_STREAMING_CONFIG,
  1292. },
  1293. {
  1294. .frontend_attach = mxl111sf_attach_demod,
  1295. .tuner_attach = mxl111sf_attach_tuner,
  1296. MXL111SF_EP4_BULK_STREAMING_CONFIG,
  1297. },
  1298. {
  1299. .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
  1300. .frontend_attach = mxl111sf_lg2161_frontend_attach,
  1301. .tuner_attach = mxl111sf_attach_tuner,
  1302. MXL111SF_EP5_BULK_STREAMING_CONFIG,
  1303. }},
  1304. },
  1305. },
  1306. .num_device_descs = 2,
  1307. .devices = {
  1308. { "Hauppauge Mercury (spi-bulk)",
  1309. { NULL },
  1310. { &mxl111sf_table[19], &mxl111sf_table[21],
  1311. &mxl111sf_table[23], &mxl111sf_table[25],
  1312. NULL },
  1313. },
  1314. { "Hauppauge WinTV-Aero-M (spi-bulk)",
  1315. { NULL },
  1316. { &mxl111sf_table[29], &mxl111sf_table[31],
  1317. NULL },
  1318. },
  1319. }
  1320. };
  1321. static struct dvb_usb_device_properties mxl111sf_mercury_spi_isoc_properties = {
  1322. MXL111SF_DEFAULT_DEVICE_PROPERTIES,
  1323. .num_adapters = 1,
  1324. .adapter = {
  1325. {
  1326. .fe_ioctl_override = mxl111sf_fe_ioctl_override,
  1327. .num_frontends = 3,
  1328. .fe = {{
  1329. .frontend_attach = mxl111sf_lgdt3305_frontend_attach,
  1330. .tuner_attach = mxl111sf_attach_tuner,
  1331. MXL111SF_EP6_ISOC_STREAMING_CONFIG,
  1332. },
  1333. {
  1334. .frontend_attach = mxl111sf_attach_demod,
  1335. .tuner_attach = mxl111sf_attach_tuner,
  1336. MXL111SF_EP4_ISOC_STREAMING_CONFIG,
  1337. },
  1338. {
  1339. .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
  1340. .frontend_attach = mxl111sf_lg2161_frontend_attach,
  1341. .tuner_attach = mxl111sf_attach_tuner,
  1342. MXL111SF_EP5_ISOC_STREAMING_CONFIG,
  1343. }},
  1344. },
  1345. },
  1346. .num_device_descs = 2,
  1347. .devices = {
  1348. { "Hauppauge Mercury (spi-isoc)",
  1349. { NULL },
  1350. { &mxl111sf_table[19], &mxl111sf_table[21],
  1351. &mxl111sf_table[23], &mxl111sf_table[25],
  1352. NULL },
  1353. },
  1354. { "Hauppauge WinTV-Aero-M (spi-isoc)",
  1355. { NULL },
  1356. { &mxl111sf_table[29], &mxl111sf_table[31],
  1357. NULL },
  1358. },
  1359. }
  1360. };
  1361. static struct dvb_usb_device_properties mxl111sf_mercury_tp_bulk_properties = {
  1362. MXL111SF_DEFAULT_DEVICE_PROPERTIES,
  1363. .num_adapters = 1,
  1364. .adapter = {
  1365. {
  1366. .fe_ioctl_override = mxl111sf_fe_ioctl_override,
  1367. .num_frontends = 3,
  1368. .fe = {{
  1369. .frontend_attach = mxl111sf_lgdt3305_frontend_attach,
  1370. .tuner_attach = mxl111sf_attach_tuner,
  1371. MXL111SF_EP6_BULK_STREAMING_CONFIG,
  1372. },
  1373. {
  1374. .frontend_attach = mxl111sf_attach_demod,
  1375. .tuner_attach = mxl111sf_attach_tuner,
  1376. MXL111SF_EP4_BULK_STREAMING_CONFIG,
  1377. },
  1378. {
  1379. .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
  1380. .frontend_attach = mxl111sf_lg2161_ep6_frontend_attach,
  1381. .tuner_attach = mxl111sf_attach_tuner,
  1382. MXL111SF_EP6_BULK_STREAMING_CONFIG,
  1383. }},
  1384. },
  1385. },
  1386. .num_device_descs = 2,
  1387. .devices = {
  1388. { "Hauppauge Mercury (tp-bulk)",
  1389. { NULL },
  1390. { &mxl111sf_table[19], &mxl111sf_table[21],
  1391. &mxl111sf_table[23], &mxl111sf_table[25],
  1392. &mxl111sf_table[27], NULL },
  1393. },
  1394. { "Hauppauge WinTV-Aero-M",
  1395. { NULL },
  1396. { &mxl111sf_table[29], &mxl111sf_table[31],
  1397. NULL },
  1398. },
  1399. }
  1400. };
  1401. static struct dvb_usb_device_properties mxl111sf_mercury_tp_isoc_properties = {
  1402. MXL111SF_DEFAULT_DEVICE_PROPERTIES,
  1403. .num_adapters = 1,
  1404. .adapter = {
  1405. {
  1406. .fe_ioctl_override = mxl111sf_fe_ioctl_override,
  1407. .num_frontends = 3,
  1408. .fe = {{
  1409. .frontend_attach = mxl111sf_lgdt3305_frontend_attach,
  1410. .tuner_attach = mxl111sf_attach_tuner,
  1411. MXL111SF_EP6_ISOC_STREAMING_CONFIG,
  1412. },
  1413. {
  1414. .frontend_attach = mxl111sf_attach_demod,
  1415. .tuner_attach = mxl111sf_attach_tuner,
  1416. MXL111SF_EP4_ISOC_STREAMING_CONFIG,
  1417. },
  1418. {
  1419. .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
  1420. .frontend_attach = mxl111sf_lg2161_ep6_frontend_attach,
  1421. .tuner_attach = mxl111sf_attach_tuner,
  1422. MXL111SF_EP6_ISOC_STREAMING_CONFIG,
  1423. }},
  1424. },
  1425. },
  1426. .num_device_descs = 2,
  1427. .devices = {
  1428. { "Hauppauge Mercury (tp-isoc)",
  1429. { NULL },
  1430. { &mxl111sf_table[19], &mxl111sf_table[21],
  1431. &mxl111sf_table[23], &mxl111sf_table[25],
  1432. &mxl111sf_table[27], NULL },
  1433. },
  1434. { "Hauppauge WinTV-Aero-M (tp-isoc)",
  1435. { NULL },
  1436. { &mxl111sf_table[29], &mxl111sf_table[31],
  1437. NULL },
  1438. },
  1439. }
  1440. };
  1441. static
  1442. struct dvb_usb_device_properties mxl111sf_mercury_mh_tp_bulk_properties = {
  1443. MXL111SF_DEFAULT_DEVICE_PROPERTIES,
  1444. .num_adapters = 1,
  1445. .adapter = {
  1446. {
  1447. .fe_ioctl_override = mxl111sf_fe_ioctl_override,
  1448. .num_frontends = 2,
  1449. .fe = {{
  1450. .frontend_attach = mxl111sf_attach_demod,
  1451. .tuner_attach = mxl111sf_attach_tuner,
  1452. MXL111SF_EP4_BULK_STREAMING_CONFIG,
  1453. },
  1454. {
  1455. .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
  1456. .frontend_attach = mxl111sf_lg2161_ep6_frontend_attach,
  1457. .tuner_attach = mxl111sf_attach_tuner,
  1458. MXL111SF_EP6_BULK_STREAMING_CONFIG,
  1459. }},
  1460. },
  1461. },
  1462. .num_device_descs = 1,
  1463. .devices = {
  1464. { "Hauppauge 126xxx (tp-bulk)",
  1465. { NULL },
  1466. { &mxl111sf_table[28], &mxl111sf_table[30],
  1467. NULL },
  1468. },
  1469. }
  1470. };
  1471. static
  1472. struct dvb_usb_device_properties mxl111sf_mercury_mh_tp_isoc_properties = {
  1473. MXL111SF_DEFAULT_DEVICE_PROPERTIES,
  1474. .num_adapters = 1,
  1475. .adapter = {
  1476. {
  1477. .fe_ioctl_override = mxl111sf_fe_ioctl_override,
  1478. .num_frontends = 2,
  1479. .fe = {{
  1480. .frontend_attach = mxl111sf_attach_demod,
  1481. .tuner_attach = mxl111sf_attach_tuner,
  1482. MXL111SF_EP4_ISOC_STREAMING_CONFIG,
  1483. },
  1484. {
  1485. .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
  1486. .frontend_attach = mxl111sf_lg2161_ep6_frontend_attach,
  1487. .tuner_attach = mxl111sf_attach_tuner,
  1488. MXL111SF_EP6_ISOC_STREAMING_CONFIG,
  1489. }},
  1490. },
  1491. },
  1492. .num_device_descs = 1,
  1493. .devices = {
  1494. { "Hauppauge 126xxx (tp-isoc)",
  1495. { NULL },
  1496. { &mxl111sf_table[28], &mxl111sf_table[30],
  1497. NULL },
  1498. },
  1499. }
  1500. };
  1501. static
  1502. struct dvb_usb_device_properties mxl111sf_mercury_mh_spi_bulk_properties = {
  1503. MXL111SF_DEFAULT_DEVICE_PROPERTIES,
  1504. .num_adapters = 1,
  1505. .adapter = {
  1506. {
  1507. .fe_ioctl_override = mxl111sf_fe_ioctl_override,
  1508. .num_frontends = 2,
  1509. .fe = {{
  1510. .frontend_attach = mxl111sf_attach_demod,
  1511. .tuner_attach = mxl111sf_attach_tuner,
  1512. MXL111SF_EP4_BULK_STREAMING_CONFIG,
  1513. },
  1514. {
  1515. .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
  1516. .frontend_attach = mxl111sf_lg2161_frontend_attach,
  1517. .tuner_attach = mxl111sf_attach_tuner,
  1518. MXL111SF_EP5_BULK_STREAMING_CONFIG,
  1519. }},
  1520. },
  1521. },
  1522. .num_device_descs = 1,
  1523. .devices = {
  1524. { "Hauppauge 126xxx (spi-bulk)",
  1525. { NULL },
  1526. { &mxl111sf_table[28], &mxl111sf_table[30],
  1527. NULL },
  1528. },
  1529. }
  1530. };
  1531. static
  1532. struct dvb_usb_device_properties mxl111sf_mercury_mh_spi_isoc_properties = {
  1533. MXL111SF_DEFAULT_DEVICE_PROPERTIES,
  1534. .num_adapters = 1,
  1535. .adapter = {
  1536. {
  1537. .fe_ioctl_override = mxl111sf_fe_ioctl_override,
  1538. .num_frontends = 2,
  1539. .fe = {{
  1540. .frontend_attach = mxl111sf_attach_demod,
  1541. .tuner_attach = mxl111sf_attach_tuner,
  1542. MXL111SF_EP4_ISOC_STREAMING_CONFIG,
  1543. },
  1544. {
  1545. .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
  1546. .frontend_attach = mxl111sf_lg2161_frontend_attach,
  1547. .tuner_attach = mxl111sf_attach_tuner,
  1548. MXL111SF_EP5_ISOC_STREAMING_CONFIG,
  1549. }},
  1550. },
  1551. },
  1552. .num_device_descs = 1,
  1553. .devices = {
  1554. { "Hauppauge 126xxx (spi-isoc)",
  1555. { NULL },
  1556. { &mxl111sf_table[28], &mxl111sf_table[30],
  1557. NULL },
  1558. },
  1559. }
  1560. };
  1561. static struct usb_driver mxl111sf_driver = {
  1562. .name = "dvb_usb_mxl111sf",
  1563. .probe = mxl111sf_probe,
  1564. .disconnect = dvb_usb_device_exit,
  1565. .id_table = mxl111sf_table,
  1566. };
  1567. module_usb_driver(mxl111sf_driver);
  1568. MODULE_AUTHOR("Michael Krufky <mkrufky@kernellabs.com>");
  1569. MODULE_DESCRIPTION("Driver for MaxLinear MxL111SF");
  1570. MODULE_VERSION("1.0");
  1571. MODULE_LICENSE("GPL");
  1572. /*
  1573. * Local variables:
  1574. * c-basic-offset: 8
  1575. * End:
  1576. */