dib0700_devices.c 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564
  1. /* Linux driver for devices based on the DiBcom DiB0700 USB bridge
  2. *
  3. * This program is free software; you can redistribute it and/or modify it
  4. * under the terms of the GNU General Public License as published by the Free
  5. * Software Foundation, version 2.
  6. *
  7. * Copyright (C) 2005-7 DiBcom, SA
  8. */
  9. #include "dib0700.h"
  10. #include "dib3000mc.h"
  11. #include "dib7000m.h"
  12. #include "dib7000p.h"
  13. #include "mt2060.h"
  14. #include "mt2266.h"
  15. #include "tuner-xc2028.h"
  16. #include "xc5000.h"
  17. #include "s5h1411.h"
  18. #include "dib0070.h"
  19. static int force_lna_activation;
  20. module_param(force_lna_activation, int, 0644);
  21. MODULE_PARM_DESC(force_lna_activation, "force the activation of Low-Noise-Amplifyer(s) (LNA), "
  22. "if applicable for the device (default: 0=automatic/off).");
  23. struct dib0700_adapter_state {
  24. int (*set_param_save) (struct dvb_frontend *, struct dvb_frontend_parameters *);
  25. };
  26. /* Hauppauge Nova-T 500 (aka Bristol)
  27. * has a LNA on GPIO0 which is enabled by setting 1 */
  28. static struct mt2060_config bristol_mt2060_config[2] = {
  29. {
  30. .i2c_address = 0x60,
  31. .clock_out = 3,
  32. }, {
  33. .i2c_address = 0x61,
  34. }
  35. };
  36. static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config = {
  37. .band_caps = BAND_VHF | BAND_UHF,
  38. .setup = (1 << 8) | (5 << 5) | (0 << 4) | (0 << 3) | (0 << 2) | (2 << 0),
  39. .agc1_max = 42598,
  40. .agc1_min = 17694,
  41. .agc2_max = 45875,
  42. .agc2_min = 0,
  43. .agc1_pt1 = 0,
  44. .agc1_pt2 = 59,
  45. .agc1_slope1 = 0,
  46. .agc1_slope2 = 69,
  47. .agc2_pt1 = 0,
  48. .agc2_pt2 = 59,
  49. .agc2_slope1 = 111,
  50. .agc2_slope2 = 28,
  51. };
  52. static struct dib3000mc_config bristol_dib3000mc_config[2] = {
  53. { .agc = &bristol_dib3000p_mt2060_agc_config,
  54. .max_time = 0x196,
  55. .ln_adc_level = 0x1cc7,
  56. .output_mpeg2_in_188_bytes = 1,
  57. },
  58. { .agc = &bristol_dib3000p_mt2060_agc_config,
  59. .max_time = 0x196,
  60. .ln_adc_level = 0x1cc7,
  61. .output_mpeg2_in_188_bytes = 1,
  62. }
  63. };
  64. static int bristol_frontend_attach(struct dvb_usb_adapter *adap)
  65. {
  66. struct dib0700_state *st = adap->dev->priv;
  67. if (adap->id == 0) {
  68. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
  69. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
  70. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
  71. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10);
  72. if (force_lna_activation)
  73. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  74. else
  75. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
  76. if (dib3000mc_i2c_enumeration(&adap->dev->i2c_adap, 2, DEFAULT_DIB3000P_I2C_ADDRESS, bristol_dib3000mc_config) != 0) {
  77. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
  78. return -ENODEV;
  79. }
  80. }
  81. st->mt2060_if1[adap->id] = 1220;
  82. return (adap->fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap,
  83. (10 + adap->id) << 1, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0;
  84. }
  85. static int eeprom_read(struct i2c_adapter *adap,u8 adrs,u8 *pval)
  86. {
  87. struct i2c_msg msg[2] = {
  88. { .addr = 0x50, .flags = 0, .buf = &adrs, .len = 1 },
  89. { .addr = 0x50, .flags = I2C_M_RD, .buf = pval, .len = 1 },
  90. };
  91. if (i2c_transfer(adap, msg, 2) != 2) return -EREMOTEIO;
  92. return 0;
  93. }
  94. static int bristol_tuner_attach(struct dvb_usb_adapter *adap)
  95. {
  96. struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
  97. struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1);
  98. s8 a;
  99. int if1=1220;
  100. if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
  101. adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_500_2)) {
  102. if (!eeprom_read(prim_i2c,0x59 + adap->id,&a)) if1=1220+a;
  103. }
  104. return dvb_attach(mt2060_attach,adap->fe, tun_i2c,&bristol_mt2060_config[adap->id],
  105. if1) == NULL ? -ENODEV : 0;
  106. }
  107. /* STK7700D: Pinnacle/Terratec/Hauppauge Dual DVB-T Diversity */
  108. /* MT226x */
  109. static struct dibx000_agc_config stk7700d_7000p_mt2266_agc_config[2] = {
  110. {
  111. BAND_UHF, // band_caps
  112. /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=1, P_agc_inv_pwm2=1,
  113. * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
  114. (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), // setup
  115. 1130, // inv_gain
  116. 21, // time_stabiliz
  117. 0, // alpha_level
  118. 118, // thlock
  119. 0, // wbd_inv
  120. 3530, // wbd_ref
  121. 1, // wbd_sel
  122. 0, // wbd_alpha
  123. 65535, // agc1_max
  124. 33770, // agc1_min
  125. 65535, // agc2_max
  126. 23592, // agc2_min
  127. 0, // agc1_pt1
  128. 62, // agc1_pt2
  129. 255, // agc1_pt3
  130. 64, // agc1_slope1
  131. 64, // agc1_slope2
  132. 132, // agc2_pt1
  133. 192, // agc2_pt2
  134. 80, // agc2_slope1
  135. 80, // agc2_slope2
  136. 17, // alpha_mant
  137. 27, // alpha_exp
  138. 23, // beta_mant
  139. 51, // beta_exp
  140. 1, // perform_agc_softsplit
  141. }, {
  142. BAND_VHF | BAND_LBAND, // band_caps
  143. /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=1, P_agc_inv_pwm2=1,
  144. * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
  145. (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), // setup
  146. 2372, // inv_gain
  147. 21, // time_stabiliz
  148. 0, // alpha_level
  149. 118, // thlock
  150. 0, // wbd_inv
  151. 3530, // wbd_ref
  152. 1, // wbd_sel
  153. 0, // wbd_alpha
  154. 65535, // agc1_max
  155. 0, // agc1_min
  156. 65535, // agc2_max
  157. 23592, // agc2_min
  158. 0, // agc1_pt1
  159. 128, // agc1_pt2
  160. 128, // agc1_pt3
  161. 128, // agc1_slope1
  162. 0, // agc1_slope2
  163. 128, // agc2_pt1
  164. 253, // agc2_pt2
  165. 81, // agc2_slope1
  166. 0, // agc2_slope2
  167. 17, // alpha_mant
  168. 27, // alpha_exp
  169. 23, // beta_mant
  170. 51, // beta_exp
  171. 1, // perform_agc_softsplit
  172. }
  173. };
  174. static struct dibx000_bandwidth_config stk7700d_mt2266_pll_config = {
  175. 60000, 30000, // internal, sampling
  176. 1, 8, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass
  177. 0, 0, 1, 1, 2, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo
  178. (3 << 14) | (1 << 12) | (524 << 0), // sad_cfg: refsel, sel, freq_15k
  179. 0, // ifreq
  180. 20452225, // timf
  181. };
  182. static struct dib7000p_config stk7700d_dib7000p_mt2266_config[] = {
  183. { .output_mpeg2_in_188_bytes = 1,
  184. .hostbus_diversity = 1,
  185. .tuner_is_baseband = 1,
  186. .agc_config_count = 2,
  187. .agc = stk7700d_7000p_mt2266_agc_config,
  188. .bw = &stk7700d_mt2266_pll_config,
  189. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  190. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  191. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  192. },
  193. { .output_mpeg2_in_188_bytes = 1,
  194. .hostbus_diversity = 1,
  195. .tuner_is_baseband = 1,
  196. .agc_config_count = 2,
  197. .agc = stk7700d_7000p_mt2266_agc_config,
  198. .bw = &stk7700d_mt2266_pll_config,
  199. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  200. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  201. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  202. }
  203. };
  204. static struct mt2266_config stk7700d_mt2266_config[2] = {
  205. { .i2c_address = 0x60
  206. },
  207. { .i2c_address = 0x60
  208. }
  209. };
  210. static int stk7700P2_frontend_attach(struct dvb_usb_adapter *adap)
  211. {
  212. if (adap->id == 0) {
  213. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  214. msleep(10);
  215. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  216. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  217. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  218. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  219. msleep(10);
  220. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  221. msleep(10);
  222. dib7000p_i2c_enumeration(&adap->dev->i2c_adap,1,18,stk7700d_dib7000p_mt2266_config);
  223. }
  224. adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1),
  225. &stk7700d_dib7000p_mt2266_config[adap->id]);
  226. return adap->fe == NULL ? -ENODEV : 0;
  227. }
  228. static int stk7700d_frontend_attach(struct dvb_usb_adapter *adap)
  229. {
  230. if (adap->id == 0) {
  231. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  232. msleep(10);
  233. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  234. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  235. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  236. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  237. msleep(10);
  238. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  239. msleep(10);
  240. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  241. dib7000p_i2c_enumeration(&adap->dev->i2c_adap,2,18,stk7700d_dib7000p_mt2266_config);
  242. }
  243. adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1),
  244. &stk7700d_dib7000p_mt2266_config[adap->id]);
  245. return adap->fe == NULL ? -ENODEV : 0;
  246. }
  247. static int stk7700d_tuner_attach(struct dvb_usb_adapter *adap)
  248. {
  249. struct i2c_adapter *tun_i2c;
  250. tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
  251. return dvb_attach(mt2266_attach, adap->fe, tun_i2c,
  252. &stk7700d_mt2266_config[adap->id]) == NULL ? -ENODEV : 0;;
  253. }
  254. /* STK7700-PH: Digital/Analog Hybrid Tuner, e.h. Cinergy HT USB HE */
  255. static struct dibx000_agc_config xc3028_agc_config = {
  256. BAND_VHF | BAND_UHF, /* band_caps */
  257. /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0,
  258. * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
  259. * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
  260. (0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 << 8) |
  261. (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), /* setup */
  262. 712, /* inv_gain */
  263. 21, /* time_stabiliz */
  264. 0, /* alpha_level */
  265. 118, /* thlock */
  266. 0, /* wbd_inv */
  267. 2867, /* wbd_ref */
  268. 0, /* wbd_sel */
  269. 2, /* wbd_alpha */
  270. 0, /* agc1_max */
  271. 0, /* agc1_min */
  272. 39718, /* agc2_max */
  273. 9930, /* agc2_min */
  274. 0, /* agc1_pt1 */
  275. 0, /* agc1_pt2 */
  276. 0, /* agc1_pt3 */
  277. 0, /* agc1_slope1 */
  278. 0, /* agc1_slope2 */
  279. 0, /* agc2_pt1 */
  280. 128, /* agc2_pt2 */
  281. 29, /* agc2_slope1 */
  282. 29, /* agc2_slope2 */
  283. 17, /* alpha_mant */
  284. 27, /* alpha_exp */
  285. 23, /* beta_mant */
  286. 51, /* beta_exp */
  287. 1, /* perform_agc_softsplit */
  288. };
  289. /* PLL Configuration for COFDM BW_MHz = 8.00 with external clock = 30.00 */
  290. static struct dibx000_bandwidth_config xc3028_bw_config = {
  291. 60000, 30000, /* internal, sampling */
  292. 1, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */
  293. 0, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc,
  294. modulo */
  295. (3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */
  296. (1 << 25) | 5816102, /* ifreq = 5.200000 MHz */
  297. 20452225, /* timf */
  298. 30000000, /* xtal_hz */
  299. };
  300. static struct dib7000p_config stk7700ph_dib7700_xc3028_config = {
  301. .output_mpeg2_in_188_bytes = 1,
  302. .tuner_is_baseband = 1,
  303. .agc_config_count = 1,
  304. .agc = &xc3028_agc_config,
  305. .bw = &xc3028_bw_config,
  306. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  307. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  308. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  309. };
  310. static int stk7700ph_xc3028_callback(void *ptr, int command, int arg)
  311. {
  312. struct dvb_usb_adapter *adap = ptr;
  313. switch (command) {
  314. case XC2028_TUNER_RESET:
  315. /* Send the tuner in then out of reset */
  316. dib7000p_set_gpio(adap->fe, 8, 0, 0); msleep(10);
  317. dib7000p_set_gpio(adap->fe, 8, 0, 1);
  318. break;
  319. case XC2028_RESET_CLK:
  320. break;
  321. default:
  322. err("%s: unknown command %d, arg %d\n", __func__,
  323. command, arg);
  324. return -EINVAL;
  325. }
  326. return 0;
  327. }
  328. static struct xc2028_ctrl stk7700ph_xc3028_ctrl = {
  329. .fname = XC2028_DEFAULT_FIRMWARE,
  330. .max_len = 64,
  331. .demod = XC3028_FE_DIBCOM52,
  332. };
  333. static struct xc2028_config stk7700ph_xc3028_config = {
  334. .i2c_addr = 0x61,
  335. .callback = stk7700ph_xc3028_callback,
  336. .ctrl = &stk7700ph_xc3028_ctrl,
  337. };
  338. static int stk7700ph_frontend_attach(struct dvb_usb_adapter *adap)
  339. {
  340. struct usb_device_descriptor *desc = &adap->dev->udev->descriptor;
  341. if (desc->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
  342. desc->idProduct == cpu_to_le16(USB_PID_PINNACLE_EXPRESSCARD_320CX))
  343. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
  344. else
  345. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  346. msleep(20);
  347. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  348. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  349. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  350. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  351. msleep(10);
  352. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  353. msleep(20);
  354. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  355. msleep(10);
  356. dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
  357. &stk7700ph_dib7700_xc3028_config);
  358. adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
  359. &stk7700ph_dib7700_xc3028_config);
  360. return adap->fe == NULL ? -ENODEV : 0;
  361. }
  362. static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap)
  363. {
  364. struct i2c_adapter *tun_i2c;
  365. tun_i2c = dib7000p_get_i2c_master(adap->fe,
  366. DIBX000_I2C_INTERFACE_TUNER, 1);
  367. stk7700ph_xc3028_config.i2c_adap = tun_i2c;
  368. stk7700ph_xc3028_config.video_dev = adap;
  369. return dvb_attach(xc2028_attach, adap->fe, &stk7700ph_xc3028_config)
  370. == NULL ? -ENODEV : 0;
  371. }
  372. #define DEFAULT_RC_INTERVAL 150
  373. static u8 rc_request[] = { REQUEST_POLL_RC, 0 };
  374. /* Number of keypresses to ignore before start repeating */
  375. #define RC_REPEAT_DELAY 2
  376. static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
  377. {
  378. u8 key[4];
  379. int i;
  380. struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
  381. struct dib0700_state *st = d->priv;
  382. *event = 0;
  383. *state = REMOTE_NO_KEY_PRESSED;
  384. i=dib0700_ctrl_rd(d,rc_request,2,key,4);
  385. if (i<=0) {
  386. err("RC Query Failed");
  387. return -1;
  388. }
  389. /* losing half of KEY_0 events from Philipps rc5 remotes.. */
  390. if (key[0]==0 && key[1]==0 && key[2]==0 && key[3]==0) return 0;
  391. /* info("%d: %2X %2X %2X %2X",dvb_usb_dib0700_ir_proto,(int)key[3-2],(int)key[3-3],(int)key[3-1],(int)key[3]); */
  392. dib0700_rc_setup(d); /* reset ir sensor data to prevent false events */
  393. switch (dvb_usb_dib0700_ir_proto) {
  394. case 0: {
  395. /* NEC protocol sends repeat code as 0 0 0 FF */
  396. if ((key[3-2] == 0x00) && (key[3-3] == 0x00) &&
  397. (key[3] == 0xFF)) {
  398. st->rc_counter++;
  399. if (st->rc_counter > RC_REPEAT_DELAY) {
  400. *event = d->last_event;
  401. *state = REMOTE_KEY_PRESSED;
  402. st->rc_counter = RC_REPEAT_DELAY;
  403. }
  404. return 0;
  405. }
  406. for (i=0;i<d->props.rc_key_map_size; i++) {
  407. if (keymap[i].custom == key[3-2] && keymap[i].data == key[3-3]) {
  408. st->rc_counter = 0;
  409. *event = keymap[i].event;
  410. *state = REMOTE_KEY_PRESSED;
  411. d->last_event = keymap[i].event;
  412. return 0;
  413. }
  414. }
  415. break;
  416. }
  417. default: {
  418. /* RC-5 protocol changes toggle bit on new keypress */
  419. for (i = 0; i < d->props.rc_key_map_size; i++) {
  420. if (keymap[i].custom == key[3-2] && keymap[i].data == key[3-3]) {
  421. if (d->last_event == keymap[i].event &&
  422. key[3-1] == st->rc_toggle) {
  423. st->rc_counter++;
  424. /* prevents unwanted double hits */
  425. if (st->rc_counter > RC_REPEAT_DELAY) {
  426. *event = d->last_event;
  427. *state = REMOTE_KEY_PRESSED;
  428. st->rc_counter = RC_REPEAT_DELAY;
  429. }
  430. return 0;
  431. }
  432. st->rc_counter = 0;
  433. *event = keymap[i].event;
  434. *state = REMOTE_KEY_PRESSED;
  435. st->rc_toggle = key[3-1];
  436. d->last_event = keymap[i].event;
  437. return 0;
  438. }
  439. }
  440. break;
  441. }
  442. }
  443. err("Unknown remote controller key: %2X %2X %2X %2X", (int) key[3-2], (int) key[3-3], (int) key[3-1], (int) key[3]);
  444. d->last_event = 0;
  445. return 0;
  446. }
  447. static struct dvb_usb_rc_key dib0700_rc_keys[] = {
  448. /* Key codes for the tiny Pinnacle remote*/
  449. { 0x07, 0x00, KEY_MUTE },
  450. { 0x07, 0x01, KEY_MENU }, // Pinnacle logo
  451. { 0x07, 0x39, KEY_POWER },
  452. { 0x07, 0x03, KEY_VOLUMEUP },
  453. { 0x07, 0x09, KEY_VOLUMEDOWN },
  454. { 0x07, 0x06, KEY_CHANNELUP },
  455. { 0x07, 0x0c, KEY_CHANNELDOWN },
  456. { 0x07, 0x0f, KEY_1 },
  457. { 0x07, 0x15, KEY_2 },
  458. { 0x07, 0x10, KEY_3 },
  459. { 0x07, 0x18, KEY_4 },
  460. { 0x07, 0x1b, KEY_5 },
  461. { 0x07, 0x1e, KEY_6 },
  462. { 0x07, 0x11, KEY_7 },
  463. { 0x07, 0x21, KEY_8 },
  464. { 0x07, 0x12, KEY_9 },
  465. { 0x07, 0x27, KEY_0 },
  466. { 0x07, 0x24, KEY_SCREEN }, // 'Square' key
  467. { 0x07, 0x2a, KEY_TEXT }, // 'T' key
  468. { 0x07, 0x2d, KEY_REWIND },
  469. { 0x07, 0x30, KEY_PLAY },
  470. { 0x07, 0x33, KEY_FASTFORWARD },
  471. { 0x07, 0x36, KEY_RECORD },
  472. { 0x07, 0x3c, KEY_STOP },
  473. { 0x07, 0x3f, KEY_CANCEL }, // '?' key
  474. /* Key codes for the Terratec Cinergy DT XS Diversity, similar to cinergyT2.c */
  475. { 0xeb, 0x01, KEY_POWER },
  476. { 0xeb, 0x02, KEY_1 },
  477. { 0xeb, 0x03, KEY_2 },
  478. { 0xeb, 0x04, KEY_3 },
  479. { 0xeb, 0x05, KEY_4 },
  480. { 0xeb, 0x06, KEY_5 },
  481. { 0xeb, 0x07, KEY_6 },
  482. { 0xeb, 0x08, KEY_7 },
  483. { 0xeb, 0x09, KEY_8 },
  484. { 0xeb, 0x0a, KEY_9 },
  485. { 0xeb, 0x0b, KEY_VIDEO },
  486. { 0xeb, 0x0c, KEY_0 },
  487. { 0xeb, 0x0d, KEY_REFRESH },
  488. { 0xeb, 0x0f, KEY_EPG },
  489. { 0xeb, 0x10, KEY_UP },
  490. { 0xeb, 0x11, KEY_LEFT },
  491. { 0xeb, 0x12, KEY_OK },
  492. { 0xeb, 0x13, KEY_RIGHT },
  493. { 0xeb, 0x14, KEY_DOWN },
  494. { 0xeb, 0x16, KEY_INFO },
  495. { 0xeb, 0x17, KEY_RED },
  496. { 0xeb, 0x18, KEY_GREEN },
  497. { 0xeb, 0x19, KEY_YELLOW },
  498. { 0xeb, 0x1a, KEY_BLUE },
  499. { 0xeb, 0x1b, KEY_CHANNELUP },
  500. { 0xeb, 0x1c, KEY_VOLUMEUP },
  501. { 0xeb, 0x1d, KEY_MUTE },
  502. { 0xeb, 0x1e, KEY_VOLUMEDOWN },
  503. { 0xeb, 0x1f, KEY_CHANNELDOWN },
  504. { 0xeb, 0x40, KEY_PAUSE },
  505. { 0xeb, 0x41, KEY_HOME },
  506. { 0xeb, 0x42, KEY_MENU }, /* DVD Menu */
  507. { 0xeb, 0x43, KEY_SUBTITLE },
  508. { 0xeb, 0x44, KEY_TEXT }, /* Teletext */
  509. { 0xeb, 0x45, KEY_DELETE },
  510. { 0xeb, 0x46, KEY_TV },
  511. { 0xeb, 0x47, KEY_DVD },
  512. { 0xeb, 0x48, KEY_STOP },
  513. { 0xeb, 0x49, KEY_VIDEO },
  514. { 0xeb, 0x4a, KEY_AUDIO }, /* Music */
  515. { 0xeb, 0x4b, KEY_SCREEN }, /* Pic */
  516. { 0xeb, 0x4c, KEY_PLAY },
  517. { 0xeb, 0x4d, KEY_BACK },
  518. { 0xeb, 0x4e, KEY_REWIND },
  519. { 0xeb, 0x4f, KEY_FASTFORWARD },
  520. { 0xeb, 0x54, KEY_PREVIOUS },
  521. { 0xeb, 0x58, KEY_RECORD },
  522. { 0xeb, 0x5c, KEY_NEXT },
  523. /* Key codes for the Haupauge WinTV Nova-TD, copied from nova-t-usb2.c (Nova-T USB2) */
  524. { 0x1e, 0x00, KEY_0 },
  525. { 0x1e, 0x01, KEY_1 },
  526. { 0x1e, 0x02, KEY_2 },
  527. { 0x1e, 0x03, KEY_3 },
  528. { 0x1e, 0x04, KEY_4 },
  529. { 0x1e, 0x05, KEY_5 },
  530. { 0x1e, 0x06, KEY_6 },
  531. { 0x1e, 0x07, KEY_7 },
  532. { 0x1e, 0x08, KEY_8 },
  533. { 0x1e, 0x09, KEY_9 },
  534. { 0x1e, 0x0a, KEY_KPASTERISK },
  535. { 0x1e, 0x0b, KEY_RED },
  536. { 0x1e, 0x0c, KEY_RADIO },
  537. { 0x1e, 0x0d, KEY_MENU },
  538. { 0x1e, 0x0e, KEY_GRAVE }, /* # */
  539. { 0x1e, 0x0f, KEY_MUTE },
  540. { 0x1e, 0x10, KEY_VOLUMEUP },
  541. { 0x1e, 0x11, KEY_VOLUMEDOWN },
  542. { 0x1e, 0x12, KEY_CHANNEL },
  543. { 0x1e, 0x14, KEY_UP },
  544. { 0x1e, 0x15, KEY_DOWN },
  545. { 0x1e, 0x16, KEY_LEFT },
  546. { 0x1e, 0x17, KEY_RIGHT },
  547. { 0x1e, 0x18, KEY_VIDEO },
  548. { 0x1e, 0x19, KEY_AUDIO },
  549. { 0x1e, 0x1a, KEY_MEDIA },
  550. { 0x1e, 0x1b, KEY_EPG },
  551. { 0x1e, 0x1c, KEY_TV },
  552. { 0x1e, 0x1e, KEY_NEXT },
  553. { 0x1e, 0x1f, KEY_BACK },
  554. { 0x1e, 0x20, KEY_CHANNELUP },
  555. { 0x1e, 0x21, KEY_CHANNELDOWN },
  556. { 0x1e, 0x24, KEY_LAST }, /* Skip backwards */
  557. { 0x1e, 0x25, KEY_OK },
  558. { 0x1e, 0x29, KEY_BLUE},
  559. { 0x1e, 0x2e, KEY_GREEN },
  560. { 0x1e, 0x30, KEY_PAUSE },
  561. { 0x1e, 0x32, KEY_REWIND },
  562. { 0x1e, 0x34, KEY_FASTFORWARD },
  563. { 0x1e, 0x35, KEY_PLAY },
  564. { 0x1e, 0x36, KEY_STOP },
  565. { 0x1e, 0x37, KEY_RECORD },
  566. { 0x1e, 0x38, KEY_YELLOW },
  567. { 0x1e, 0x3b, KEY_GOTO },
  568. { 0x1e, 0x3d, KEY_POWER },
  569. /* Key codes for the Leadtek Winfast DTV Dongle */
  570. { 0x00, 0x42, KEY_POWER },
  571. { 0x07, 0x7c, KEY_TUNER },
  572. { 0x0f, 0x4e, KEY_PRINT }, /* PREVIEW */
  573. { 0x08, 0x40, KEY_SCREEN }, /* full screen toggle*/
  574. { 0x0f, 0x71, KEY_DOT }, /* frequency */
  575. { 0x07, 0x43, KEY_0 },
  576. { 0x0c, 0x41, KEY_1 },
  577. { 0x04, 0x43, KEY_2 },
  578. { 0x0b, 0x7f, KEY_3 },
  579. { 0x0e, 0x41, KEY_4 },
  580. { 0x06, 0x43, KEY_5 },
  581. { 0x09, 0x7f, KEY_6 },
  582. { 0x0d, 0x7e, KEY_7 },
  583. { 0x05, 0x7c, KEY_8 },
  584. { 0x0a, 0x40, KEY_9 },
  585. { 0x0e, 0x4e, KEY_CLEAR },
  586. { 0x04, 0x7c, KEY_CHANNEL }, /* show channel number */
  587. { 0x0f, 0x41, KEY_LAST }, /* recall */
  588. { 0x03, 0x42, KEY_MUTE },
  589. { 0x06, 0x4c, KEY_RESERVED }, /* PIP button*/
  590. { 0x01, 0x72, KEY_SHUFFLE }, /* SNAPSHOT */
  591. { 0x0c, 0x4e, KEY_PLAYPAUSE }, /* TIMESHIFT */
  592. { 0x0b, 0x70, KEY_RECORD },
  593. { 0x03, 0x7d, KEY_VOLUMEUP },
  594. { 0x01, 0x7d, KEY_VOLUMEDOWN },
  595. { 0x02, 0x42, KEY_CHANNELUP },
  596. { 0x00, 0x7d, KEY_CHANNELDOWN },
  597. };
  598. /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
  599. static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = {
  600. BAND_UHF | BAND_VHF, // band_caps
  601. /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
  602. * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
  603. (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), // setup
  604. 712, // inv_gain
  605. 41, // time_stabiliz
  606. 0, // alpha_level
  607. 118, // thlock
  608. 0, // wbd_inv
  609. 4095, // wbd_ref
  610. 0, // wbd_sel
  611. 0, // wbd_alpha
  612. 42598, // agc1_max
  613. 17694, // agc1_min
  614. 45875, // agc2_max
  615. 2621, // agc2_min
  616. 0, // agc1_pt1
  617. 76, // agc1_pt2
  618. 139, // agc1_pt3
  619. 52, // agc1_slope1
  620. 59, // agc1_slope2
  621. 107, // agc2_pt1
  622. 172, // agc2_pt2
  623. 57, // agc2_slope1
  624. 70, // agc2_slope2
  625. 21, // alpha_mant
  626. 25, // alpha_exp
  627. 28, // beta_mant
  628. 48, // beta_exp
  629. 1, // perform_agc_softsplit
  630. { 0, // split_min
  631. 107, // split_max
  632. 51800, // global_split_min
  633. 24700 // global_split_max
  634. },
  635. };
  636. static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config = {
  637. BAND_UHF | BAND_VHF,
  638. /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
  639. * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
  640. (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), // setup
  641. 712, // inv_gain
  642. 41, // time_stabiliz
  643. 0, // alpha_level
  644. 118, // thlock
  645. 0, // wbd_inv
  646. 4095, // wbd_ref
  647. 0, // wbd_sel
  648. 0, // wbd_alpha
  649. 42598, // agc1_max
  650. 16384, // agc1_min
  651. 42598, // agc2_max
  652. 0, // agc2_min
  653. 0, // agc1_pt1
  654. 137, // agc1_pt2
  655. 255, // agc1_pt3
  656. 0, // agc1_slope1
  657. 255, // agc1_slope2
  658. 0, // agc2_pt1
  659. 0, // agc2_pt2
  660. 0, // agc2_slope1
  661. 41, // agc2_slope2
  662. 15, // alpha_mant
  663. 25, // alpha_exp
  664. 28, // beta_mant
  665. 48, // beta_exp
  666. 0, // perform_agc_softsplit
  667. };
  668. static struct dibx000_bandwidth_config stk7700p_pll_config = {
  669. 60000, 30000, // internal, sampling
  670. 1, 8, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass
  671. 0, 0, 1, 1, 0, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo
  672. (3 << 14) | (1 << 12) | (524 << 0), // sad_cfg: refsel, sel, freq_15k
  673. 60258167, // ifreq
  674. 20452225, // timf
  675. 30000000, // xtal
  676. };
  677. static struct dib7000m_config stk7700p_dib7000m_config = {
  678. .dvbt_mode = 1,
  679. .output_mpeg2_in_188_bytes = 1,
  680. .quartz_direct = 1,
  681. .agc_config_count = 1,
  682. .agc = &stk7700p_7000m_mt2060_agc_config,
  683. .bw = &stk7700p_pll_config,
  684. .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
  685. .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
  686. .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
  687. };
  688. static struct dib7000p_config stk7700p_dib7000p_config = {
  689. .output_mpeg2_in_188_bytes = 1,
  690. .agc_config_count = 1,
  691. .agc = &stk7700p_7000p_mt2060_agc_config,
  692. .bw = &stk7700p_pll_config,
  693. .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
  694. .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
  695. .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
  696. };
  697. static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap)
  698. {
  699. struct dib0700_state *st = adap->dev->priv;
  700. /* unless there is no real power management in DVB - we leave the device on GPIO6 */
  701. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  702. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(50);
  703. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
  704. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  705. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
  706. dib0700_ctrl_clock(adap->dev, 72, 1);
  707. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100);
  708. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  709. st->mt2060_if1[0] = 1220;
  710. if (dib7000pc_detection(&adap->dev->i2c_adap)) {
  711. adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config);
  712. st->is_dib7000pc = 1;
  713. } else
  714. adap->fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config);
  715. return adap->fe == NULL ? -ENODEV : 0;
  716. }
  717. static struct mt2060_config stk7700p_mt2060_config = {
  718. 0x60
  719. };
  720. static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
  721. {
  722. struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
  723. struct dib0700_state *st = adap->dev->priv;
  724. struct i2c_adapter *tun_i2c;
  725. s8 a;
  726. int if1=1220;
  727. if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
  728. adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK)) {
  729. if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a;
  730. }
  731. if (st->is_dib7000pc)
  732. tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
  733. else
  734. tun_i2c = dib7000m_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
  735. return dvb_attach(mt2060_attach, adap->fe, tun_i2c, &stk7700p_mt2060_config,
  736. if1) == NULL ? -ENODEV : 0;
  737. }
  738. /* DIB7070 generic */
  739. static struct dibx000_agc_config dib7070_agc_config = {
  740. BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
  741. /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
  742. * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
  743. (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), // setup
  744. 600, // inv_gain
  745. 10, // time_stabiliz
  746. 0, // alpha_level
  747. 118, // thlock
  748. 0, // wbd_inv
  749. 3530, // wbd_ref
  750. 1, // wbd_sel
  751. 5, // wbd_alpha
  752. 65535, // agc1_max
  753. 0, // agc1_min
  754. 65535, // agc2_max
  755. 0, // agc2_min
  756. 0, // agc1_pt1
  757. 40, // agc1_pt2
  758. 183, // agc1_pt3
  759. 206, // agc1_slope1
  760. 255, // agc1_slope2
  761. 72, // agc2_pt1
  762. 152, // agc2_pt2
  763. 88, // agc2_slope1
  764. 90, // agc2_slope2
  765. 17, // alpha_mant
  766. 27, // alpha_exp
  767. 23, // beta_mant
  768. 51, // beta_exp
  769. 0, // perform_agc_softsplit
  770. };
  771. static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
  772. {
  773. return dib7000p_set_gpio(fe, 8, 0, !onoff);
  774. }
  775. static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
  776. {
  777. return dib7000p_set_gpio(fe, 9, 0, onoff);
  778. }
  779. static struct dib0070_config dib7070p_dib0070_config[2] = {
  780. {
  781. .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
  782. .reset = dib7070_tuner_reset,
  783. .sleep = dib7070_tuner_sleep,
  784. .clock_khz = 12000,
  785. .clock_pad_drive = 4
  786. }, {
  787. .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
  788. .reset = dib7070_tuner_reset,
  789. .sleep = dib7070_tuner_sleep,
  790. .clock_khz = 12000,
  791. }
  792. };
  793. static int dib7070_set_param_override(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
  794. {
  795. struct dvb_usb_adapter *adap = fe->dvb->priv;
  796. struct dib0700_adapter_state *state = adap->priv;
  797. u16 offset;
  798. u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
  799. switch (band) {
  800. case BAND_VHF: offset = 950; break;
  801. case BAND_UHF:
  802. default: offset = 550; break;
  803. }
  804. deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
  805. dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
  806. return state->set_param_save(fe, fep);
  807. }
  808. static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap)
  809. {
  810. struct dib0700_adapter_state *st = adap->priv;
  811. struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
  812. if (adap->id == 0) {
  813. if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL)
  814. return -ENODEV;
  815. } else {
  816. if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL)
  817. return -ENODEV;
  818. }
  819. st->set_param_save = adap->fe->ops.tuner_ops.set_params;
  820. adap->fe->ops.tuner_ops.set_params = dib7070_set_param_override;
  821. return 0;
  822. }
  823. static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
  824. 60000, 15000, // internal, sampling
  825. 1, 20, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass
  826. 0, 0, 1, 1, 2, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo
  827. (3 << 14) | (1 << 12) | (524 << 0), // sad_cfg: refsel, sel, freq_15k
  828. (0 << 25) | 0, // ifreq = 0.000000 MHz
  829. 20452225, // timf
  830. 12000000, // xtal_hz
  831. };
  832. static struct dib7000p_config dib7070p_dib7000p_config = {
  833. .output_mpeg2_in_188_bytes = 1,
  834. .agc_config_count = 1,
  835. .agc = &dib7070_agc_config,
  836. .bw = &dib7070_bw_config_12_mhz,
  837. .tuner_is_baseband = 1,
  838. .spur_protect = 1,
  839. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  840. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  841. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  842. .hostbus_diversity = 1,
  843. };
  844. /* STK7070P */
  845. static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)
  846. {
  847. struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
  848. if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
  849. p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
  850. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
  851. else
  852. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  853. msleep(10);
  854. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  855. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  856. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  857. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  858. dib0700_ctrl_clock(adap->dev, 72, 1);
  859. msleep(10);
  860. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  861. msleep(10);
  862. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  863. dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
  864. &dib7070p_dib7000p_config);
  865. adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
  866. &dib7070p_dib7000p_config);
  867. return adap->fe == NULL ? -ENODEV : 0;
  868. }
  869. /* STK7070PD */
  870. static struct dib7000p_config stk7070pd_dib7000p_config[2] = {
  871. {
  872. .output_mpeg2_in_188_bytes = 1,
  873. .agc_config_count = 1,
  874. .agc = &dib7070_agc_config,
  875. .bw = &dib7070_bw_config_12_mhz,
  876. .tuner_is_baseband = 1,
  877. .spur_protect = 1,
  878. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  879. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  880. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  881. .hostbus_diversity = 1,
  882. }, {
  883. .output_mpeg2_in_188_bytes = 1,
  884. .agc_config_count = 1,
  885. .agc = &dib7070_agc_config,
  886. .bw = &dib7070_bw_config_12_mhz,
  887. .tuner_is_baseband = 1,
  888. .spur_protect = 1,
  889. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  890. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  891. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  892. .hostbus_diversity = 1,
  893. }
  894. };
  895. static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap)
  896. {
  897. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  898. msleep(10);
  899. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  900. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  901. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  902. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  903. dib0700_ctrl_clock(adap->dev, 72, 1);
  904. msleep(10);
  905. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  906. msleep(10);
  907. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  908. dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18, stk7070pd_dib7000p_config);
  909. adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]);
  910. return adap->fe == NULL ? -ENODEV : 0;
  911. }
  912. static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap)
  913. {
  914. adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]);
  915. return adap->fe == NULL ? -ENODEV : 0;
  916. }
  917. /* S5H1411 */
  918. static struct s5h1411_config pinnacle_801e_config = {
  919. .output_mode = S5H1411_PARALLEL_OUTPUT,
  920. .gpio = S5H1411_GPIO_OFF,
  921. .mpeg_timing = S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK,
  922. .qam_if = S5H1411_IF_44000,
  923. .vsb_if = S5H1411_IF_44000,
  924. .inversion = S5H1411_INVERSION_OFF,
  925. .status_mode = S5H1411_DEMODLOCKING
  926. };
  927. /* Pinnacle PCTV HD Pro 801e GPIOs map:
  928. GPIO0 - currently unknown
  929. GPIO1 - xc5000 tuner reset
  930. GPIO2 - CX25843 sleep
  931. GPIO3 - currently unknown
  932. GPIO4 - currently unknown
  933. GPIO6 - currently unknown
  934. GPIO7 - currently unknown
  935. GPIO9 - currently unknown
  936. GPIO10 - CX25843 reset
  937. */
  938. static int s5h1411_frontend_attach(struct dvb_usb_adapter *adap)
  939. {
  940. struct dib0700_state *st = adap->dev->priv;
  941. /* Make use of the new i2c functions from FW 1.20 */
  942. st->fw_use_new_i2c_api = 1;
  943. /* The s5h1411 requires the dib0700 to not be in master mode */
  944. st->disable_streaming_master_mode = 1;
  945. /* All msleep values taken from Windows USB trace */
  946. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
  947. dib0700_set_gpio(adap->dev, GPIO3, GPIO_OUT, 0);
  948. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  949. msleep(400);
  950. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  951. msleep(60);
  952. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  953. msleep(30);
  954. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  955. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  956. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  957. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  958. dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 0);
  959. msleep(30);
  960. /* Put the CX25843 to sleep for now since we're in digital mode */
  961. dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
  962. /* GPIOs are initialized, do the attach */
  963. adap->fe = dvb_attach(s5h1411_attach, &pinnacle_801e_config,
  964. &adap->dev->i2c_adap);
  965. return adap->fe == NULL ? -ENODEV : 0;
  966. }
  967. int dib0700_xc5000_tuner_callback(void *priv, int command, int arg)
  968. {
  969. struct dvb_usb_adapter *adap = priv;
  970. /* Reset the tuner */
  971. dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0);
  972. msleep(330); /* from Windows USB trace */
  973. dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1);
  974. msleep(330); /* from Windows USB trace */
  975. return 0;
  976. }
  977. static struct xc5000_config s5h1411_xc5000_tunerconfig = {
  978. .i2c_address = 0x64,
  979. .if_khz = 5380,
  980. .tuner_callback = dib0700_xc5000_tuner_callback
  981. };
  982. static int xc5000_tuner_attach(struct dvb_usb_adapter *adap)
  983. {
  984. return dvb_attach(xc5000_attach, adap->fe, &adap->dev->i2c_adap,
  985. &s5h1411_xc5000_tunerconfig, adap)
  986. == NULL ? -ENODEV : 0;
  987. }
  988. /* DVB-USB and USB stuff follows */
  989. struct usb_device_id dib0700_usb_id_table[] = {
  990. /* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },
  991. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) },
  992. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },
  993. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },
  994. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },
  995. /* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },
  996. { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) },
  997. { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) },
  998. { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) },
  999. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) },
  1000. /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) },
  1001. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) },
  1002. { USB_DEVICE(USB_VID_TERRATEC,
  1003. USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) },
  1004. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) },
  1005. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) },
  1006. /* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) },
  1007. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) },
  1008. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) },
  1009. { USB_DEVICE(USB_VID_PINNACLE,
  1010. USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) },
  1011. { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) },
  1012. /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) },
  1013. { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) },
  1014. { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) },
  1015. { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) },
  1016. { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) },
  1017. /* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) },
  1018. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) },
  1019. { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) },
  1020. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) },
  1021. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) },
  1022. /* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) },
  1023. { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) },
  1024. { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) },
  1025. { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) },
  1026. { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) },
  1027. /* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) },
  1028. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) },
  1029. { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U8000) },
  1030. { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700PH) },
  1031. { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000H) },
  1032. /* 40 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E) },
  1033. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E_SE) },
  1034. { 0 } /* Terminating entry */
  1035. };
  1036. MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
  1037. #define DIB0700_DEFAULT_DEVICE_PROPERTIES \
  1038. .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
  1039. .usb_ctrl = DEVICE_SPECIFIC, \
  1040. .firmware = "dvb-usb-dib0700-1.20.fw", \
  1041. .download_firmware = dib0700_download_firmware, \
  1042. .no_reconnect = 1, \
  1043. .size_of_priv = sizeof(struct dib0700_state), \
  1044. .i2c_algo = &dib0700_i2c_algo, \
  1045. .identify_state = dib0700_identify_state
  1046. #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
  1047. .streaming_ctrl = dib0700_streaming_ctrl, \
  1048. .stream = { \
  1049. .type = USB_BULK, \
  1050. .count = 4, \
  1051. .endpoint = ep, \
  1052. .u = { \
  1053. .bulk = { \
  1054. .buffersize = 39480, \
  1055. } \
  1056. } \
  1057. }
  1058. struct dvb_usb_device_properties dib0700_devices[] = {
  1059. {
  1060. DIB0700_DEFAULT_DEVICE_PROPERTIES,
  1061. .num_adapters = 1,
  1062. .adapter = {
  1063. {
  1064. .frontend_attach = stk7700p_frontend_attach,
  1065. .tuner_attach = stk7700p_tuner_attach,
  1066. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  1067. },
  1068. },
  1069. .num_device_descs = 8,
  1070. .devices = {
  1071. { "DiBcom STK7700P reference design",
  1072. { &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] },
  1073. { NULL },
  1074. },
  1075. { "Hauppauge Nova-T Stick",
  1076. { &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL },
  1077. { NULL },
  1078. },
  1079. { "AVerMedia AVerTV DVB-T Volar",
  1080. { &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] },
  1081. { NULL },
  1082. },
  1083. { "Compro Videomate U500",
  1084. { &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] },
  1085. { NULL },
  1086. },
  1087. { "Uniwill STK7700P based (Hama and others)",
  1088. { &dib0700_usb_id_table[7], NULL },
  1089. { NULL },
  1090. },
  1091. { "Leadtek Winfast DTV Dongle (STK7700P based)",
  1092. { &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] },
  1093. { NULL },
  1094. },
  1095. { "AVerMedia AVerTV DVB-T Express",
  1096. { &dib0700_usb_id_table[20] },
  1097. { NULL },
  1098. },
  1099. { "Gigabyte U7000",
  1100. { &dib0700_usb_id_table[21], NULL },
  1101. { NULL },
  1102. }
  1103. },
  1104. .rc_interval = DEFAULT_RC_INTERVAL,
  1105. .rc_key_map = dib0700_rc_keys,
  1106. .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
  1107. .rc_query = dib0700_rc_query
  1108. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  1109. .num_adapters = 2,
  1110. .adapter = {
  1111. {
  1112. .frontend_attach = bristol_frontend_attach,
  1113. .tuner_attach = bristol_tuner_attach,
  1114. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  1115. }, {
  1116. .frontend_attach = bristol_frontend_attach,
  1117. .tuner_attach = bristol_tuner_attach,
  1118. DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
  1119. }
  1120. },
  1121. .num_device_descs = 1,
  1122. .devices = {
  1123. { "Hauppauge Nova-T 500 Dual DVB-T",
  1124. { &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL },
  1125. { NULL },
  1126. },
  1127. },
  1128. .rc_interval = DEFAULT_RC_INTERVAL,
  1129. .rc_key_map = dib0700_rc_keys,
  1130. .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
  1131. .rc_query = dib0700_rc_query
  1132. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  1133. .num_adapters = 2,
  1134. .adapter = {
  1135. {
  1136. .frontend_attach = stk7700d_frontend_attach,
  1137. .tuner_attach = stk7700d_tuner_attach,
  1138. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  1139. }, {
  1140. .frontend_attach = stk7700d_frontend_attach,
  1141. .tuner_attach = stk7700d_tuner_attach,
  1142. DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
  1143. }
  1144. },
  1145. .num_device_descs = 4,
  1146. .devices = {
  1147. { "Pinnacle PCTV 2000e",
  1148. { &dib0700_usb_id_table[11], NULL },
  1149. { NULL },
  1150. },
  1151. { "Terratec Cinergy DT XS Diversity",
  1152. { &dib0700_usb_id_table[12], NULL },
  1153. { NULL },
  1154. },
  1155. { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",
  1156. { &dib0700_usb_id_table[13], NULL },
  1157. { NULL },
  1158. },
  1159. { "DiBcom STK7700D reference design",
  1160. { &dib0700_usb_id_table[14], NULL },
  1161. { NULL },
  1162. }
  1163. },
  1164. .rc_interval = DEFAULT_RC_INTERVAL,
  1165. .rc_key_map = dib0700_rc_keys,
  1166. .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
  1167. .rc_query = dib0700_rc_query
  1168. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  1169. .num_adapters = 1,
  1170. .adapter = {
  1171. {
  1172. .frontend_attach = stk7700P2_frontend_attach,
  1173. .tuner_attach = stk7700d_tuner_attach,
  1174. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  1175. },
  1176. },
  1177. .num_device_descs = 2,
  1178. .devices = {
  1179. { "ASUS My Cinema U3000 Mini DVBT Tuner",
  1180. { &dib0700_usb_id_table[23], NULL },
  1181. { NULL },
  1182. },
  1183. { "Yuan EC372S",
  1184. { &dib0700_usb_id_table[31], NULL },
  1185. { NULL },
  1186. }
  1187. }
  1188. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  1189. .num_adapters = 1,
  1190. .adapter = {
  1191. {
  1192. .frontend_attach = stk7070p_frontend_attach,
  1193. .tuner_attach = dib7070p_tuner_attach,
  1194. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  1195. .size_of_priv = sizeof(struct dib0700_adapter_state),
  1196. },
  1197. },
  1198. .num_device_descs = 9,
  1199. .devices = {
  1200. { "DiBcom STK7070P reference design",
  1201. { &dib0700_usb_id_table[15], NULL },
  1202. { NULL },
  1203. },
  1204. { "Pinnacle PCTV DVB-T Flash Stick",
  1205. { &dib0700_usb_id_table[16], NULL },
  1206. { NULL },
  1207. },
  1208. { "Artec T14BR DVB-T",
  1209. { &dib0700_usb_id_table[22], NULL },
  1210. { NULL },
  1211. },
  1212. { "ASUS My Cinema U3100 Mini DVBT Tuner",
  1213. { &dib0700_usb_id_table[24], NULL },
  1214. { NULL },
  1215. },
  1216. { "Hauppauge Nova-T Stick",
  1217. { &dib0700_usb_id_table[25], NULL },
  1218. { NULL },
  1219. },
  1220. { "Hauppauge Nova-T MyTV.t",
  1221. { &dib0700_usb_id_table[26], NULL },
  1222. { NULL },
  1223. },
  1224. { "Pinnacle PCTV 72e",
  1225. { &dib0700_usb_id_table[29], NULL },
  1226. { NULL },
  1227. },
  1228. { "Pinnacle PCTV 73e",
  1229. { &dib0700_usb_id_table[30], NULL },
  1230. { NULL },
  1231. },
  1232. { "Terratec Cinergy T USB XXS",
  1233. { &dib0700_usb_id_table[33], NULL },
  1234. { NULL },
  1235. },
  1236. },
  1237. .rc_interval = DEFAULT_RC_INTERVAL,
  1238. .rc_key_map = dib0700_rc_keys,
  1239. .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
  1240. .rc_query = dib0700_rc_query
  1241. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  1242. .num_adapters = 2,
  1243. .adapter = {
  1244. {
  1245. .frontend_attach = stk7070pd_frontend_attach0,
  1246. .tuner_attach = dib7070p_tuner_attach,
  1247. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  1248. .size_of_priv = sizeof(struct dib0700_adapter_state),
  1249. }, {
  1250. .frontend_attach = stk7070pd_frontend_attach1,
  1251. .tuner_attach = dib7070p_tuner_attach,
  1252. DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
  1253. .size_of_priv = sizeof(struct dib0700_adapter_state),
  1254. }
  1255. },
  1256. .num_device_descs = 4,
  1257. .devices = {
  1258. { "DiBcom STK7070PD reference design",
  1259. { &dib0700_usb_id_table[17], NULL },
  1260. { NULL },
  1261. },
  1262. { "Pinnacle PCTV Dual DVB-T Diversity Stick",
  1263. { &dib0700_usb_id_table[18], NULL },
  1264. { NULL },
  1265. },
  1266. { "Hauppauge Nova-TD Stick (52009)",
  1267. { &dib0700_usb_id_table[35], NULL },
  1268. { NULL },
  1269. },
  1270. { "Hauppauge Nova-TD-500 (84xxx)",
  1271. { &dib0700_usb_id_table[36], NULL },
  1272. { NULL },
  1273. }
  1274. }
  1275. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  1276. .num_adapters = 1,
  1277. .adapter = {
  1278. {
  1279. .frontend_attach = stk7700ph_frontend_attach,
  1280. .tuner_attach = stk7700ph_tuner_attach,
  1281. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  1282. .size_of_priv = sizeof(struct
  1283. dib0700_adapter_state),
  1284. },
  1285. },
  1286. .num_device_descs = 5,
  1287. .devices = {
  1288. { "Terratec Cinergy HT USB XE",
  1289. { &dib0700_usb_id_table[27], NULL },
  1290. { NULL },
  1291. },
  1292. { "Pinnacle Expresscard 320cx",
  1293. { &dib0700_usb_id_table[28], NULL },
  1294. { NULL },
  1295. },
  1296. { "Terratec Cinergy HT Express",
  1297. { &dib0700_usb_id_table[32], NULL },
  1298. { NULL },
  1299. },
  1300. { "Gigabyte U8000-RH",
  1301. { &dib0700_usb_id_table[37], NULL },
  1302. { NULL },
  1303. },
  1304. { "YUAN High-Tech STK7700PH",
  1305. { &dib0700_usb_id_table[38], NULL },
  1306. { NULL },
  1307. },
  1308. { "Asus My Cinema-U3000Hybrid",
  1309. { &dib0700_usb_id_table[39], NULL },
  1310. { NULL },
  1311. },
  1312. },
  1313. .rc_interval = DEFAULT_RC_INTERVAL,
  1314. .rc_key_map = dib0700_rc_keys,
  1315. .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
  1316. .rc_query = dib0700_rc_query
  1317. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  1318. .num_adapters = 1,
  1319. .adapter = {
  1320. {
  1321. .frontend_attach = s5h1411_frontend_attach,
  1322. .tuner_attach = xc5000_tuner_attach,
  1323. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  1324. .size_of_priv = sizeof(struct
  1325. dib0700_adapter_state),
  1326. },
  1327. },
  1328. .num_device_descs = 2,
  1329. .devices = {
  1330. { "Pinnacle PCTV HD Pro USB Stick",
  1331. { &dib0700_usb_id_table[40], NULL },
  1332. { NULL },
  1333. },
  1334. { "Pinnacle PCTV HD USB Stick",
  1335. { &dib0700_usb_id_table[41], NULL },
  1336. { NULL },
  1337. },
  1338. },
  1339. .rc_interval = DEFAULT_RC_INTERVAL,
  1340. .rc_key_map = dib0700_rc_keys,
  1341. .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
  1342. .rc_query = dib0700_rc_query
  1343. },
  1344. };
  1345. int dib0700_device_count = ARRAY_SIZE(dib0700_devices);