dib0700_devices.c 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608
  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 component,
  311. int command, int arg)
  312. {
  313. struct dvb_usb_adapter *adap = ptr;
  314. switch (command) {
  315. case XC2028_TUNER_RESET:
  316. /* Send the tuner in then out of reset */
  317. dib7000p_set_gpio(adap->fe, 8, 0, 0); msleep(10);
  318. dib7000p_set_gpio(adap->fe, 8, 0, 1);
  319. break;
  320. case XC2028_RESET_CLK:
  321. break;
  322. default:
  323. err("%s: unknown command %d, arg %d\n", __func__,
  324. command, arg);
  325. return -EINVAL;
  326. }
  327. return 0;
  328. }
  329. static struct xc2028_ctrl stk7700ph_xc3028_ctrl = {
  330. .fname = XC2028_DEFAULT_FIRMWARE,
  331. .max_len = 64,
  332. .demod = XC3028_FE_DIBCOM52,
  333. };
  334. static struct xc2028_config stk7700ph_xc3028_config = {
  335. .i2c_addr = 0x61,
  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. /* FIXME: generalize & move to common area */
  369. adap->fe->callback = stk7700ph_xc3028_callback;
  370. return dvb_attach(xc2028_attach, adap->fe, &stk7700ph_xc3028_config)
  371. == NULL ? -ENODEV : 0;
  372. }
  373. #define DEFAULT_RC_INTERVAL 150
  374. static u8 rc_request[] = { REQUEST_POLL_RC, 0 };
  375. /* Number of keypresses to ignore before start repeating */
  376. #define RC_REPEAT_DELAY 2
  377. static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
  378. {
  379. u8 key[4];
  380. int i;
  381. struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
  382. struct dib0700_state *st = d->priv;
  383. *event = 0;
  384. *state = REMOTE_NO_KEY_PRESSED;
  385. i=dib0700_ctrl_rd(d,rc_request,2,key,4);
  386. if (i<=0) {
  387. err("RC Query Failed");
  388. return -1;
  389. }
  390. /* losing half of KEY_0 events from Philipps rc5 remotes.. */
  391. if (key[0]==0 && key[1]==0 && key[2]==0 && key[3]==0) return 0;
  392. /* 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]); */
  393. dib0700_rc_setup(d); /* reset ir sensor data to prevent false events */
  394. switch (dvb_usb_dib0700_ir_proto) {
  395. case 0: {
  396. /* NEC protocol sends repeat code as 0 0 0 FF */
  397. if ((key[3-2] == 0x00) && (key[3-3] == 0x00) &&
  398. (key[3] == 0xFF)) {
  399. st->rc_counter++;
  400. if (st->rc_counter > RC_REPEAT_DELAY) {
  401. *event = d->last_event;
  402. *state = REMOTE_KEY_PRESSED;
  403. st->rc_counter = RC_REPEAT_DELAY;
  404. }
  405. return 0;
  406. }
  407. for (i=0;i<d->props.rc_key_map_size; i++) {
  408. if (keymap[i].custom == key[3-2] && keymap[i].data == key[3-3]) {
  409. st->rc_counter = 0;
  410. *event = keymap[i].event;
  411. *state = REMOTE_KEY_PRESSED;
  412. d->last_event = keymap[i].event;
  413. return 0;
  414. }
  415. }
  416. break;
  417. }
  418. default: {
  419. /* RC-5 protocol changes toggle bit on new keypress */
  420. for (i = 0; i < d->props.rc_key_map_size; i++) {
  421. if (keymap[i].custom == key[3-2] && keymap[i].data == key[3-3]) {
  422. if (d->last_event == keymap[i].event &&
  423. key[3-1] == st->rc_toggle) {
  424. st->rc_counter++;
  425. /* prevents unwanted double hits */
  426. if (st->rc_counter > RC_REPEAT_DELAY) {
  427. *event = d->last_event;
  428. *state = REMOTE_KEY_PRESSED;
  429. st->rc_counter = RC_REPEAT_DELAY;
  430. }
  431. return 0;
  432. }
  433. st->rc_counter = 0;
  434. *event = keymap[i].event;
  435. *state = REMOTE_KEY_PRESSED;
  436. st->rc_toggle = key[3-1];
  437. d->last_event = keymap[i].event;
  438. return 0;
  439. }
  440. }
  441. break;
  442. }
  443. }
  444. err("Unknown remote controller key: %2X %2X %2X %2X", (int) key[3-2], (int) key[3-3], (int) key[3-1], (int) key[3]);
  445. d->last_event = 0;
  446. return 0;
  447. }
  448. static struct dvb_usb_rc_key dib0700_rc_keys[] = {
  449. /* Key codes for the tiny Pinnacle remote*/
  450. { 0x07, 0x00, KEY_MUTE },
  451. { 0x07, 0x01, KEY_MENU }, // Pinnacle logo
  452. { 0x07, 0x39, KEY_POWER },
  453. { 0x07, 0x03, KEY_VOLUMEUP },
  454. { 0x07, 0x09, KEY_VOLUMEDOWN },
  455. { 0x07, 0x06, KEY_CHANNELUP },
  456. { 0x07, 0x0c, KEY_CHANNELDOWN },
  457. { 0x07, 0x0f, KEY_1 },
  458. { 0x07, 0x15, KEY_2 },
  459. { 0x07, 0x10, KEY_3 },
  460. { 0x07, 0x18, KEY_4 },
  461. { 0x07, 0x1b, KEY_5 },
  462. { 0x07, 0x1e, KEY_6 },
  463. { 0x07, 0x11, KEY_7 },
  464. { 0x07, 0x21, KEY_8 },
  465. { 0x07, 0x12, KEY_9 },
  466. { 0x07, 0x27, KEY_0 },
  467. { 0x07, 0x24, KEY_SCREEN }, // 'Square' key
  468. { 0x07, 0x2a, KEY_TEXT }, // 'T' key
  469. { 0x07, 0x2d, KEY_REWIND },
  470. { 0x07, 0x30, KEY_PLAY },
  471. { 0x07, 0x33, KEY_FASTFORWARD },
  472. { 0x07, 0x36, KEY_RECORD },
  473. { 0x07, 0x3c, KEY_STOP },
  474. { 0x07, 0x3f, KEY_CANCEL }, // '?' key
  475. /* Key codes for the Terratec Cinergy DT XS Diversity, similar to cinergyT2.c */
  476. { 0xeb, 0x01, KEY_POWER },
  477. { 0xeb, 0x02, KEY_1 },
  478. { 0xeb, 0x03, KEY_2 },
  479. { 0xeb, 0x04, KEY_3 },
  480. { 0xeb, 0x05, KEY_4 },
  481. { 0xeb, 0x06, KEY_5 },
  482. { 0xeb, 0x07, KEY_6 },
  483. { 0xeb, 0x08, KEY_7 },
  484. { 0xeb, 0x09, KEY_8 },
  485. { 0xeb, 0x0a, KEY_9 },
  486. { 0xeb, 0x0b, KEY_VIDEO },
  487. { 0xeb, 0x0c, KEY_0 },
  488. { 0xeb, 0x0d, KEY_REFRESH },
  489. { 0xeb, 0x0f, KEY_EPG },
  490. { 0xeb, 0x10, KEY_UP },
  491. { 0xeb, 0x11, KEY_LEFT },
  492. { 0xeb, 0x12, KEY_OK },
  493. { 0xeb, 0x13, KEY_RIGHT },
  494. { 0xeb, 0x14, KEY_DOWN },
  495. { 0xeb, 0x16, KEY_INFO },
  496. { 0xeb, 0x17, KEY_RED },
  497. { 0xeb, 0x18, KEY_GREEN },
  498. { 0xeb, 0x19, KEY_YELLOW },
  499. { 0xeb, 0x1a, KEY_BLUE },
  500. { 0xeb, 0x1b, KEY_CHANNELUP },
  501. { 0xeb, 0x1c, KEY_VOLUMEUP },
  502. { 0xeb, 0x1d, KEY_MUTE },
  503. { 0xeb, 0x1e, KEY_VOLUMEDOWN },
  504. { 0xeb, 0x1f, KEY_CHANNELDOWN },
  505. { 0xeb, 0x40, KEY_PAUSE },
  506. { 0xeb, 0x41, KEY_HOME },
  507. { 0xeb, 0x42, KEY_MENU }, /* DVD Menu */
  508. { 0xeb, 0x43, KEY_SUBTITLE },
  509. { 0xeb, 0x44, KEY_TEXT }, /* Teletext */
  510. { 0xeb, 0x45, KEY_DELETE },
  511. { 0xeb, 0x46, KEY_TV },
  512. { 0xeb, 0x47, KEY_DVD },
  513. { 0xeb, 0x48, KEY_STOP },
  514. { 0xeb, 0x49, KEY_VIDEO },
  515. { 0xeb, 0x4a, KEY_AUDIO }, /* Music */
  516. { 0xeb, 0x4b, KEY_SCREEN }, /* Pic */
  517. { 0xeb, 0x4c, KEY_PLAY },
  518. { 0xeb, 0x4d, KEY_BACK },
  519. { 0xeb, 0x4e, KEY_REWIND },
  520. { 0xeb, 0x4f, KEY_FASTFORWARD },
  521. { 0xeb, 0x54, KEY_PREVIOUS },
  522. { 0xeb, 0x58, KEY_RECORD },
  523. { 0xeb, 0x5c, KEY_NEXT },
  524. /* Key codes for the Haupauge WinTV Nova-TD, copied from nova-t-usb2.c (Nova-T USB2) */
  525. { 0x1e, 0x00, KEY_0 },
  526. { 0x1e, 0x01, KEY_1 },
  527. { 0x1e, 0x02, KEY_2 },
  528. { 0x1e, 0x03, KEY_3 },
  529. { 0x1e, 0x04, KEY_4 },
  530. { 0x1e, 0x05, KEY_5 },
  531. { 0x1e, 0x06, KEY_6 },
  532. { 0x1e, 0x07, KEY_7 },
  533. { 0x1e, 0x08, KEY_8 },
  534. { 0x1e, 0x09, KEY_9 },
  535. { 0x1e, 0x0a, KEY_KPASTERISK },
  536. { 0x1e, 0x0b, KEY_RED },
  537. { 0x1e, 0x0c, KEY_RADIO },
  538. { 0x1e, 0x0d, KEY_MENU },
  539. { 0x1e, 0x0e, KEY_GRAVE }, /* # */
  540. { 0x1e, 0x0f, KEY_MUTE },
  541. { 0x1e, 0x10, KEY_VOLUMEUP },
  542. { 0x1e, 0x11, KEY_VOLUMEDOWN },
  543. { 0x1e, 0x12, KEY_CHANNEL },
  544. { 0x1e, 0x14, KEY_UP },
  545. { 0x1e, 0x15, KEY_DOWN },
  546. { 0x1e, 0x16, KEY_LEFT },
  547. { 0x1e, 0x17, KEY_RIGHT },
  548. { 0x1e, 0x18, KEY_VIDEO },
  549. { 0x1e, 0x19, KEY_AUDIO },
  550. { 0x1e, 0x1a, KEY_MEDIA },
  551. { 0x1e, 0x1b, KEY_EPG },
  552. { 0x1e, 0x1c, KEY_TV },
  553. { 0x1e, 0x1e, KEY_NEXT },
  554. { 0x1e, 0x1f, KEY_BACK },
  555. { 0x1e, 0x20, KEY_CHANNELUP },
  556. { 0x1e, 0x21, KEY_CHANNELDOWN },
  557. { 0x1e, 0x24, KEY_LAST }, /* Skip backwards */
  558. { 0x1e, 0x25, KEY_OK },
  559. { 0x1e, 0x29, KEY_BLUE},
  560. { 0x1e, 0x2e, KEY_GREEN },
  561. { 0x1e, 0x30, KEY_PAUSE },
  562. { 0x1e, 0x32, KEY_REWIND },
  563. { 0x1e, 0x34, KEY_FASTFORWARD },
  564. { 0x1e, 0x35, KEY_PLAY },
  565. { 0x1e, 0x36, KEY_STOP },
  566. { 0x1e, 0x37, KEY_RECORD },
  567. { 0x1e, 0x38, KEY_YELLOW },
  568. { 0x1e, 0x3b, KEY_GOTO },
  569. { 0x1e, 0x3d, KEY_POWER },
  570. /* Key codes for the Leadtek Winfast DTV Dongle */
  571. { 0x00, 0x42, KEY_POWER },
  572. { 0x07, 0x7c, KEY_TUNER },
  573. { 0x0f, 0x4e, KEY_PRINT }, /* PREVIEW */
  574. { 0x08, 0x40, KEY_SCREEN }, /* full screen toggle*/
  575. { 0x0f, 0x71, KEY_DOT }, /* frequency */
  576. { 0x07, 0x43, KEY_0 },
  577. { 0x0c, 0x41, KEY_1 },
  578. { 0x04, 0x43, KEY_2 },
  579. { 0x0b, 0x7f, KEY_3 },
  580. { 0x0e, 0x41, KEY_4 },
  581. { 0x06, 0x43, KEY_5 },
  582. { 0x09, 0x7f, KEY_6 },
  583. { 0x0d, 0x7e, KEY_7 },
  584. { 0x05, 0x7c, KEY_8 },
  585. { 0x0a, 0x40, KEY_9 },
  586. { 0x0e, 0x4e, KEY_CLEAR },
  587. { 0x04, 0x7c, KEY_CHANNEL }, /* show channel number */
  588. { 0x0f, 0x41, KEY_LAST }, /* recall */
  589. { 0x03, 0x42, KEY_MUTE },
  590. { 0x06, 0x4c, KEY_RESERVED }, /* PIP button*/
  591. { 0x01, 0x72, KEY_SHUFFLE }, /* SNAPSHOT */
  592. { 0x0c, 0x4e, KEY_PLAYPAUSE }, /* TIMESHIFT */
  593. { 0x0b, 0x70, KEY_RECORD },
  594. { 0x03, 0x7d, KEY_VOLUMEUP },
  595. { 0x01, 0x7d, KEY_VOLUMEDOWN },
  596. { 0x02, 0x42, KEY_CHANNELUP },
  597. { 0x00, 0x7d, KEY_CHANNELDOWN },
  598. /* Key codes for Nova-TD "credit card" remote control. */
  599. { 0x1d, 0x00, KEY_0 },
  600. { 0x1d, 0x01, KEY_1 },
  601. { 0x1d, 0x02, KEY_2 },
  602. { 0x1d, 0x03, KEY_3 },
  603. { 0x1d, 0x04, KEY_4 },
  604. { 0x1d, 0x05, KEY_5 },
  605. { 0x1d, 0x06, KEY_6 },
  606. { 0x1d, 0x07, KEY_7 },
  607. { 0x1d, 0x08, KEY_8 },
  608. { 0x1d, 0x09, KEY_9 },
  609. { 0x1d, 0x0a, KEY_TEXT },
  610. { 0x1d, 0x0d, KEY_MENU },
  611. { 0x1d, 0x0f, KEY_MUTE },
  612. { 0x1d, 0x10, KEY_VOLUMEUP },
  613. { 0x1d, 0x11, KEY_VOLUMEDOWN },
  614. { 0x1d, 0x12, KEY_CHANNEL },
  615. { 0x1d, 0x14, KEY_UP },
  616. { 0x1d, 0x15, KEY_DOWN },
  617. { 0x1d, 0x16, KEY_LEFT },
  618. { 0x1d, 0x17, KEY_RIGHT },
  619. { 0x1d, 0x1c, KEY_TV },
  620. { 0x1d, 0x1e, KEY_NEXT },
  621. { 0x1d, 0x1f, KEY_BACK },
  622. { 0x1d, 0x20, KEY_CHANNELUP },
  623. { 0x1d, 0x21, KEY_CHANNELDOWN },
  624. { 0x1d, 0x24, KEY_LAST },
  625. { 0x1d, 0x25, KEY_OK },
  626. { 0x1d, 0x30, KEY_PAUSE },
  627. { 0x1d, 0x32, KEY_REWIND },
  628. { 0x1d, 0x34, KEY_FASTFORWARD },
  629. { 0x1d, 0x35, KEY_PLAY },
  630. { 0x1d, 0x36, KEY_STOP },
  631. { 0x1d, 0x37, KEY_RECORD },
  632. { 0x1d, 0x3b, KEY_GOTO },
  633. { 0x1d, 0x3d, KEY_POWER },
  634. };
  635. /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
  636. static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = {
  637. BAND_UHF | BAND_VHF, // band_caps
  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. 17694, // agc1_min
  651. 45875, // agc2_max
  652. 2621, // agc2_min
  653. 0, // agc1_pt1
  654. 76, // agc1_pt2
  655. 139, // agc1_pt3
  656. 52, // agc1_slope1
  657. 59, // agc1_slope2
  658. 107, // agc2_pt1
  659. 172, // agc2_pt2
  660. 57, // agc2_slope1
  661. 70, // agc2_slope2
  662. 21, // alpha_mant
  663. 25, // alpha_exp
  664. 28, // beta_mant
  665. 48, // beta_exp
  666. 1, // perform_agc_softsplit
  667. { 0, // split_min
  668. 107, // split_max
  669. 51800, // global_split_min
  670. 24700 // global_split_max
  671. },
  672. };
  673. static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config = {
  674. BAND_UHF | BAND_VHF,
  675. /* 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,
  676. * 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 */
  677. (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), // setup
  678. 712, // inv_gain
  679. 41, // time_stabiliz
  680. 0, // alpha_level
  681. 118, // thlock
  682. 0, // wbd_inv
  683. 4095, // wbd_ref
  684. 0, // wbd_sel
  685. 0, // wbd_alpha
  686. 42598, // agc1_max
  687. 16384, // agc1_min
  688. 42598, // agc2_max
  689. 0, // agc2_min
  690. 0, // agc1_pt1
  691. 137, // agc1_pt2
  692. 255, // agc1_pt3
  693. 0, // agc1_slope1
  694. 255, // agc1_slope2
  695. 0, // agc2_pt1
  696. 0, // agc2_pt2
  697. 0, // agc2_slope1
  698. 41, // agc2_slope2
  699. 15, // alpha_mant
  700. 25, // alpha_exp
  701. 28, // beta_mant
  702. 48, // beta_exp
  703. 0, // perform_agc_softsplit
  704. };
  705. static struct dibx000_bandwidth_config stk7700p_pll_config = {
  706. 60000, 30000, // internal, sampling
  707. 1, 8, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass
  708. 0, 0, 1, 1, 0, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo
  709. (3 << 14) | (1 << 12) | (524 << 0), // sad_cfg: refsel, sel, freq_15k
  710. 60258167, // ifreq
  711. 20452225, // timf
  712. 30000000, // xtal
  713. };
  714. static struct dib7000m_config stk7700p_dib7000m_config = {
  715. .dvbt_mode = 1,
  716. .output_mpeg2_in_188_bytes = 1,
  717. .quartz_direct = 1,
  718. .agc_config_count = 1,
  719. .agc = &stk7700p_7000m_mt2060_agc_config,
  720. .bw = &stk7700p_pll_config,
  721. .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
  722. .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
  723. .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
  724. };
  725. static struct dib7000p_config stk7700p_dib7000p_config = {
  726. .output_mpeg2_in_188_bytes = 1,
  727. .agc_config_count = 1,
  728. .agc = &stk7700p_7000p_mt2060_agc_config,
  729. .bw = &stk7700p_pll_config,
  730. .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
  731. .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
  732. .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
  733. };
  734. static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap)
  735. {
  736. struct dib0700_state *st = adap->dev->priv;
  737. /* unless there is no real power management in DVB - we leave the device on GPIO6 */
  738. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  739. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(50);
  740. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
  741. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  742. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
  743. dib0700_ctrl_clock(adap->dev, 72, 1);
  744. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100);
  745. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  746. st->mt2060_if1[0] = 1220;
  747. if (dib7000pc_detection(&adap->dev->i2c_adap)) {
  748. adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config);
  749. st->is_dib7000pc = 1;
  750. } else
  751. adap->fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config);
  752. return adap->fe == NULL ? -ENODEV : 0;
  753. }
  754. static struct mt2060_config stk7700p_mt2060_config = {
  755. 0x60
  756. };
  757. static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
  758. {
  759. struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
  760. struct dib0700_state *st = adap->dev->priv;
  761. struct i2c_adapter *tun_i2c;
  762. s8 a;
  763. int if1=1220;
  764. if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
  765. adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK)) {
  766. if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a;
  767. }
  768. if (st->is_dib7000pc)
  769. tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
  770. else
  771. tun_i2c = dib7000m_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
  772. return dvb_attach(mt2060_attach, adap->fe, tun_i2c, &stk7700p_mt2060_config,
  773. if1) == NULL ? -ENODEV : 0;
  774. }
  775. /* DIB7070 generic */
  776. static struct dibx000_agc_config dib7070_agc_config = {
  777. BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
  778. /* 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,
  779. * 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 */
  780. (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), // setup
  781. 600, // inv_gain
  782. 10, // time_stabiliz
  783. 0, // alpha_level
  784. 118, // thlock
  785. 0, // wbd_inv
  786. 3530, // wbd_ref
  787. 1, // wbd_sel
  788. 5, // wbd_alpha
  789. 65535, // agc1_max
  790. 0, // agc1_min
  791. 65535, // agc2_max
  792. 0, // agc2_min
  793. 0, // agc1_pt1
  794. 40, // agc1_pt2
  795. 183, // agc1_pt3
  796. 206, // agc1_slope1
  797. 255, // agc1_slope2
  798. 72, // agc2_pt1
  799. 152, // agc2_pt2
  800. 88, // agc2_slope1
  801. 90, // agc2_slope2
  802. 17, // alpha_mant
  803. 27, // alpha_exp
  804. 23, // beta_mant
  805. 51, // beta_exp
  806. 0, // perform_agc_softsplit
  807. };
  808. static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
  809. {
  810. return dib7000p_set_gpio(fe, 8, 0, !onoff);
  811. }
  812. static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
  813. {
  814. return dib7000p_set_gpio(fe, 9, 0, onoff);
  815. }
  816. static struct dib0070_config dib7070p_dib0070_config[2] = {
  817. {
  818. .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
  819. .reset = dib7070_tuner_reset,
  820. .sleep = dib7070_tuner_sleep,
  821. .clock_khz = 12000,
  822. .clock_pad_drive = 4
  823. }, {
  824. .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
  825. .reset = dib7070_tuner_reset,
  826. .sleep = dib7070_tuner_sleep,
  827. .clock_khz = 12000,
  828. }
  829. };
  830. static int dib7070_set_param_override(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
  831. {
  832. struct dvb_usb_adapter *adap = fe->dvb->priv;
  833. struct dib0700_adapter_state *state = adap->priv;
  834. u16 offset;
  835. u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
  836. switch (band) {
  837. case BAND_VHF: offset = 950; break;
  838. case BAND_UHF:
  839. default: offset = 550; break;
  840. }
  841. deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
  842. dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
  843. return state->set_param_save(fe, fep);
  844. }
  845. static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap)
  846. {
  847. struct dib0700_adapter_state *st = adap->priv;
  848. struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
  849. if (adap->id == 0) {
  850. if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL)
  851. return -ENODEV;
  852. } else {
  853. if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL)
  854. return -ENODEV;
  855. }
  856. st->set_param_save = adap->fe->ops.tuner_ops.set_params;
  857. adap->fe->ops.tuner_ops.set_params = dib7070_set_param_override;
  858. return 0;
  859. }
  860. static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
  861. 60000, 15000, // internal, sampling
  862. 1, 20, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass
  863. 0, 0, 1, 1, 2, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo
  864. (3 << 14) | (1 << 12) | (524 << 0), // sad_cfg: refsel, sel, freq_15k
  865. (0 << 25) | 0, // ifreq = 0.000000 MHz
  866. 20452225, // timf
  867. 12000000, // xtal_hz
  868. };
  869. static struct dib7000p_config dib7070p_dib7000p_config = {
  870. .output_mpeg2_in_188_bytes = 1,
  871. .agc_config_count = 1,
  872. .agc = &dib7070_agc_config,
  873. .bw = &dib7070_bw_config_12_mhz,
  874. .tuner_is_baseband = 1,
  875. .spur_protect = 1,
  876. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  877. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  878. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  879. .hostbus_diversity = 1,
  880. };
  881. /* STK7070P */
  882. static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)
  883. {
  884. struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
  885. if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
  886. p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
  887. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
  888. else
  889. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  890. msleep(10);
  891. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  892. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  893. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  894. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  895. dib0700_ctrl_clock(adap->dev, 72, 1);
  896. msleep(10);
  897. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  898. msleep(10);
  899. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  900. dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
  901. &dib7070p_dib7000p_config);
  902. adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
  903. &dib7070p_dib7000p_config);
  904. return adap->fe == NULL ? -ENODEV : 0;
  905. }
  906. /* STK7070PD */
  907. static struct dib7000p_config stk7070pd_dib7000p_config[2] = {
  908. {
  909. .output_mpeg2_in_188_bytes = 1,
  910. .agc_config_count = 1,
  911. .agc = &dib7070_agc_config,
  912. .bw = &dib7070_bw_config_12_mhz,
  913. .tuner_is_baseband = 1,
  914. .spur_protect = 1,
  915. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  916. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  917. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  918. .hostbus_diversity = 1,
  919. }, {
  920. .output_mpeg2_in_188_bytes = 1,
  921. .agc_config_count = 1,
  922. .agc = &dib7070_agc_config,
  923. .bw = &dib7070_bw_config_12_mhz,
  924. .tuner_is_baseband = 1,
  925. .spur_protect = 1,
  926. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  927. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  928. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  929. .hostbus_diversity = 1,
  930. }
  931. };
  932. static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap)
  933. {
  934. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  935. msleep(10);
  936. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  937. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  938. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  939. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  940. dib0700_ctrl_clock(adap->dev, 72, 1);
  941. msleep(10);
  942. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  943. msleep(10);
  944. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  945. dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18, stk7070pd_dib7000p_config);
  946. adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]);
  947. return adap->fe == NULL ? -ENODEV : 0;
  948. }
  949. static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap)
  950. {
  951. adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]);
  952. return adap->fe == NULL ? -ENODEV : 0;
  953. }
  954. /* S5H1411 */
  955. static struct s5h1411_config pinnacle_801e_config = {
  956. .output_mode = S5H1411_PARALLEL_OUTPUT,
  957. .gpio = S5H1411_GPIO_OFF,
  958. .mpeg_timing = S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK,
  959. .qam_if = S5H1411_IF_44000,
  960. .vsb_if = S5H1411_IF_44000,
  961. .inversion = S5H1411_INVERSION_OFF,
  962. .status_mode = S5H1411_DEMODLOCKING
  963. };
  964. /* Pinnacle PCTV HD Pro 801e GPIOs map:
  965. GPIO0 - currently unknown
  966. GPIO1 - xc5000 tuner reset
  967. GPIO2 - CX25843 sleep
  968. GPIO3 - currently unknown
  969. GPIO4 - currently unknown
  970. GPIO6 - currently unknown
  971. GPIO7 - currently unknown
  972. GPIO9 - currently unknown
  973. GPIO10 - CX25843 reset
  974. */
  975. static int s5h1411_frontend_attach(struct dvb_usb_adapter *adap)
  976. {
  977. struct dib0700_state *st = adap->dev->priv;
  978. /* Make use of the new i2c functions from FW 1.20 */
  979. st->fw_use_new_i2c_api = 1;
  980. /* The s5h1411 requires the dib0700 to not be in master mode */
  981. st->disable_streaming_master_mode = 1;
  982. /* All msleep values taken from Windows USB trace */
  983. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
  984. dib0700_set_gpio(adap->dev, GPIO3, GPIO_OUT, 0);
  985. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  986. msleep(400);
  987. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  988. msleep(60);
  989. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  990. msleep(30);
  991. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  992. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  993. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  994. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  995. dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 0);
  996. msleep(30);
  997. /* Put the CX25843 to sleep for now since we're in digital mode */
  998. dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
  999. /* GPIOs are initialized, do the attach */
  1000. adap->fe = dvb_attach(s5h1411_attach, &pinnacle_801e_config,
  1001. &adap->dev->i2c_adap);
  1002. return adap->fe == NULL ? -ENODEV : 0;
  1003. }
  1004. int dib0700_xc5000_tuner_callback(void *priv, int command, int arg)
  1005. {
  1006. struct dvb_usb_adapter *adap = priv;
  1007. /* Reset the tuner */
  1008. dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0);
  1009. msleep(330); /* from Windows USB trace */
  1010. dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1);
  1011. msleep(330); /* from Windows USB trace */
  1012. return 0;
  1013. }
  1014. static struct xc5000_config s5h1411_xc5000_tunerconfig = {
  1015. .i2c_address = 0x64,
  1016. .if_khz = 5380,
  1017. .tuner_callback = dib0700_xc5000_tuner_callback
  1018. };
  1019. static int xc5000_tuner_attach(struct dvb_usb_adapter *adap)
  1020. {
  1021. return dvb_attach(xc5000_attach, adap->fe, &adap->dev->i2c_adap,
  1022. &s5h1411_xc5000_tunerconfig, adap)
  1023. == NULL ? -ENODEV : 0;
  1024. }
  1025. /* DVB-USB and USB stuff follows */
  1026. struct usb_device_id dib0700_usb_id_table[] = {
  1027. /* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },
  1028. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) },
  1029. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },
  1030. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },
  1031. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },
  1032. /* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },
  1033. { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) },
  1034. { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) },
  1035. { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) },
  1036. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) },
  1037. /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) },
  1038. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) },
  1039. { USB_DEVICE(USB_VID_TERRATEC,
  1040. USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) },
  1041. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) },
  1042. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) },
  1043. /* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) },
  1044. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) },
  1045. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) },
  1046. { USB_DEVICE(USB_VID_PINNACLE,
  1047. USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) },
  1048. { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) },
  1049. /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) },
  1050. { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) },
  1051. { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) },
  1052. { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) },
  1053. { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) },
  1054. /* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) },
  1055. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) },
  1056. { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) },
  1057. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) },
  1058. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) },
  1059. /* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) },
  1060. { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) },
  1061. { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) },
  1062. { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) },
  1063. { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) },
  1064. /* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) },
  1065. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) },
  1066. { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U8000) },
  1067. { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700PH) },
  1068. { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000H) },
  1069. /* 40 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E) },
  1070. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E_SE) },
  1071. { 0 } /* Terminating entry */
  1072. };
  1073. MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
  1074. #define DIB0700_DEFAULT_DEVICE_PROPERTIES \
  1075. .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
  1076. .usb_ctrl = DEVICE_SPECIFIC, \
  1077. .firmware = "dvb-usb-dib0700-1.20.fw", \
  1078. .download_firmware = dib0700_download_firmware, \
  1079. .no_reconnect = 1, \
  1080. .size_of_priv = sizeof(struct dib0700_state), \
  1081. .i2c_algo = &dib0700_i2c_algo, \
  1082. .identify_state = dib0700_identify_state
  1083. #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
  1084. .streaming_ctrl = dib0700_streaming_ctrl, \
  1085. .stream = { \
  1086. .type = USB_BULK, \
  1087. .count = 4, \
  1088. .endpoint = ep, \
  1089. .u = { \
  1090. .bulk = { \
  1091. .buffersize = 39480, \
  1092. } \
  1093. } \
  1094. }
  1095. struct dvb_usb_device_properties dib0700_devices[] = {
  1096. {
  1097. DIB0700_DEFAULT_DEVICE_PROPERTIES,
  1098. .num_adapters = 1,
  1099. .adapter = {
  1100. {
  1101. .frontend_attach = stk7700p_frontend_attach,
  1102. .tuner_attach = stk7700p_tuner_attach,
  1103. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  1104. },
  1105. },
  1106. .num_device_descs = 8,
  1107. .devices = {
  1108. { "DiBcom STK7700P reference design",
  1109. { &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] },
  1110. { NULL },
  1111. },
  1112. { "Hauppauge Nova-T Stick",
  1113. { &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL },
  1114. { NULL },
  1115. },
  1116. { "AVerMedia AVerTV DVB-T Volar",
  1117. { &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] },
  1118. { NULL },
  1119. },
  1120. { "Compro Videomate U500",
  1121. { &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] },
  1122. { NULL },
  1123. },
  1124. { "Uniwill STK7700P based (Hama and others)",
  1125. { &dib0700_usb_id_table[7], NULL },
  1126. { NULL },
  1127. },
  1128. { "Leadtek Winfast DTV Dongle (STK7700P based)",
  1129. { &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] },
  1130. { NULL },
  1131. },
  1132. { "AVerMedia AVerTV DVB-T Express",
  1133. { &dib0700_usb_id_table[20] },
  1134. { NULL },
  1135. },
  1136. { "Gigabyte U7000",
  1137. { &dib0700_usb_id_table[21], NULL },
  1138. { NULL },
  1139. }
  1140. },
  1141. .rc_interval = DEFAULT_RC_INTERVAL,
  1142. .rc_key_map = dib0700_rc_keys,
  1143. .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
  1144. .rc_query = dib0700_rc_query
  1145. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  1146. .num_adapters = 2,
  1147. .adapter = {
  1148. {
  1149. .frontend_attach = bristol_frontend_attach,
  1150. .tuner_attach = bristol_tuner_attach,
  1151. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  1152. }, {
  1153. .frontend_attach = bristol_frontend_attach,
  1154. .tuner_attach = bristol_tuner_attach,
  1155. DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
  1156. }
  1157. },
  1158. .num_device_descs = 1,
  1159. .devices = {
  1160. { "Hauppauge Nova-T 500 Dual DVB-T",
  1161. { &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL },
  1162. { NULL },
  1163. },
  1164. },
  1165. .rc_interval = DEFAULT_RC_INTERVAL,
  1166. .rc_key_map = dib0700_rc_keys,
  1167. .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
  1168. .rc_query = dib0700_rc_query
  1169. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  1170. .num_adapters = 2,
  1171. .adapter = {
  1172. {
  1173. .frontend_attach = stk7700d_frontend_attach,
  1174. .tuner_attach = stk7700d_tuner_attach,
  1175. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  1176. }, {
  1177. .frontend_attach = stk7700d_frontend_attach,
  1178. .tuner_attach = stk7700d_tuner_attach,
  1179. DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
  1180. }
  1181. },
  1182. .num_device_descs = 4,
  1183. .devices = {
  1184. { "Pinnacle PCTV 2000e",
  1185. { &dib0700_usb_id_table[11], NULL },
  1186. { NULL },
  1187. },
  1188. { "Terratec Cinergy DT XS Diversity",
  1189. { &dib0700_usb_id_table[12], NULL },
  1190. { NULL },
  1191. },
  1192. { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",
  1193. { &dib0700_usb_id_table[13], NULL },
  1194. { NULL },
  1195. },
  1196. { "DiBcom STK7700D reference design",
  1197. { &dib0700_usb_id_table[14], NULL },
  1198. { NULL },
  1199. }
  1200. },
  1201. .rc_interval = DEFAULT_RC_INTERVAL,
  1202. .rc_key_map = dib0700_rc_keys,
  1203. .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
  1204. .rc_query = dib0700_rc_query
  1205. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  1206. .num_adapters = 1,
  1207. .adapter = {
  1208. {
  1209. .frontend_attach = stk7700P2_frontend_attach,
  1210. .tuner_attach = stk7700d_tuner_attach,
  1211. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  1212. },
  1213. },
  1214. .num_device_descs = 2,
  1215. .devices = {
  1216. { "ASUS My Cinema U3000 Mini DVBT Tuner",
  1217. { &dib0700_usb_id_table[23], NULL },
  1218. { NULL },
  1219. },
  1220. { "Yuan EC372S",
  1221. { &dib0700_usb_id_table[31], NULL },
  1222. { NULL },
  1223. }
  1224. },
  1225. .rc_interval = DEFAULT_RC_INTERVAL,
  1226. .rc_key_map = dib0700_rc_keys,
  1227. .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
  1228. .rc_query = dib0700_rc_query
  1229. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  1230. .num_adapters = 1,
  1231. .adapter = {
  1232. {
  1233. .frontend_attach = stk7070p_frontend_attach,
  1234. .tuner_attach = dib7070p_tuner_attach,
  1235. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  1236. .size_of_priv = sizeof(struct dib0700_adapter_state),
  1237. },
  1238. },
  1239. .num_device_descs = 9,
  1240. .devices = {
  1241. { "DiBcom STK7070P reference design",
  1242. { &dib0700_usb_id_table[15], NULL },
  1243. { NULL },
  1244. },
  1245. { "Pinnacle PCTV DVB-T Flash Stick",
  1246. { &dib0700_usb_id_table[16], NULL },
  1247. { NULL },
  1248. },
  1249. { "Artec T14BR DVB-T",
  1250. { &dib0700_usb_id_table[22], NULL },
  1251. { NULL },
  1252. },
  1253. { "ASUS My Cinema U3100 Mini DVBT Tuner",
  1254. { &dib0700_usb_id_table[24], NULL },
  1255. { NULL },
  1256. },
  1257. { "Hauppauge Nova-T Stick",
  1258. { &dib0700_usb_id_table[25], NULL },
  1259. { NULL },
  1260. },
  1261. { "Hauppauge Nova-T MyTV.t",
  1262. { &dib0700_usb_id_table[26], NULL },
  1263. { NULL },
  1264. },
  1265. { "Pinnacle PCTV 72e",
  1266. { &dib0700_usb_id_table[29], NULL },
  1267. { NULL },
  1268. },
  1269. { "Pinnacle PCTV 73e",
  1270. { &dib0700_usb_id_table[30], NULL },
  1271. { NULL },
  1272. },
  1273. { "Terratec Cinergy T USB XXS",
  1274. { &dib0700_usb_id_table[33], NULL },
  1275. { NULL },
  1276. },
  1277. },
  1278. .rc_interval = DEFAULT_RC_INTERVAL,
  1279. .rc_key_map = dib0700_rc_keys,
  1280. .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
  1281. .rc_query = dib0700_rc_query
  1282. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  1283. .num_adapters = 2,
  1284. .adapter = {
  1285. {
  1286. .frontend_attach = stk7070pd_frontend_attach0,
  1287. .tuner_attach = dib7070p_tuner_attach,
  1288. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  1289. .size_of_priv = sizeof(struct dib0700_adapter_state),
  1290. }, {
  1291. .frontend_attach = stk7070pd_frontend_attach1,
  1292. .tuner_attach = dib7070p_tuner_attach,
  1293. DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
  1294. .size_of_priv = sizeof(struct dib0700_adapter_state),
  1295. }
  1296. },
  1297. .num_device_descs = 4,
  1298. .devices = {
  1299. { "DiBcom STK7070PD reference design",
  1300. { &dib0700_usb_id_table[17], NULL },
  1301. { NULL },
  1302. },
  1303. { "Pinnacle PCTV Dual DVB-T Diversity Stick",
  1304. { &dib0700_usb_id_table[18], NULL },
  1305. { NULL },
  1306. },
  1307. { "Hauppauge Nova-TD Stick (52009)",
  1308. { &dib0700_usb_id_table[35], NULL },
  1309. { NULL },
  1310. },
  1311. { "Hauppauge Nova-TD-500 (84xxx)",
  1312. { &dib0700_usb_id_table[36], NULL },
  1313. { NULL },
  1314. }
  1315. }
  1316. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  1317. .num_adapters = 1,
  1318. .adapter = {
  1319. {
  1320. .frontend_attach = stk7700ph_frontend_attach,
  1321. .tuner_attach = stk7700ph_tuner_attach,
  1322. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  1323. .size_of_priv = sizeof(struct
  1324. dib0700_adapter_state),
  1325. },
  1326. },
  1327. .num_device_descs = 5,
  1328. .devices = {
  1329. { "Terratec Cinergy HT USB XE",
  1330. { &dib0700_usb_id_table[27], NULL },
  1331. { NULL },
  1332. },
  1333. { "Pinnacle Expresscard 320cx",
  1334. { &dib0700_usb_id_table[28], NULL },
  1335. { NULL },
  1336. },
  1337. { "Terratec Cinergy HT Express",
  1338. { &dib0700_usb_id_table[32], NULL },
  1339. { NULL },
  1340. },
  1341. { "Gigabyte U8000-RH",
  1342. { &dib0700_usb_id_table[37], NULL },
  1343. { NULL },
  1344. },
  1345. { "YUAN High-Tech STK7700PH",
  1346. { &dib0700_usb_id_table[38], NULL },
  1347. { NULL },
  1348. },
  1349. { "Asus My Cinema-U3000Hybrid",
  1350. { &dib0700_usb_id_table[39], NULL },
  1351. { NULL },
  1352. },
  1353. },
  1354. .rc_interval = DEFAULT_RC_INTERVAL,
  1355. .rc_key_map = dib0700_rc_keys,
  1356. .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
  1357. .rc_query = dib0700_rc_query
  1358. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  1359. .num_adapters = 1,
  1360. .adapter = {
  1361. {
  1362. .frontend_attach = s5h1411_frontend_attach,
  1363. .tuner_attach = xc5000_tuner_attach,
  1364. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  1365. .size_of_priv = sizeof(struct
  1366. dib0700_adapter_state),
  1367. },
  1368. },
  1369. .num_device_descs = 2,
  1370. .devices = {
  1371. { "Pinnacle PCTV HD Pro USB Stick",
  1372. { &dib0700_usb_id_table[40], NULL },
  1373. { NULL },
  1374. },
  1375. { "Pinnacle PCTV HD USB Stick",
  1376. { &dib0700_usb_id_table[41], NULL },
  1377. { NULL },
  1378. },
  1379. },
  1380. .rc_interval = DEFAULT_RC_INTERVAL,
  1381. .rc_key_map = dib0700_rc_keys,
  1382. .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
  1383. .rc_query = dib0700_rc_query
  1384. },
  1385. };
  1386. int dib0700_device_count = ARRAY_SIZE(dib0700_devices);