dib0700_devices.c 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161
  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 "dib0070.h"
  16. static int force_lna_activation;
  17. module_param(force_lna_activation, int, 0644);
  18. MODULE_PARM_DESC(force_lna_activation, "force the activation of Low-Noise-Amplifyer(s) (LNA), "
  19. "if applicable for the device (default: 0=automatic/off).");
  20. struct dib0700_adapter_state {
  21. int (*set_param_save) (struct dvb_frontend *, struct dvb_frontend_parameters *);
  22. };
  23. /* Hauppauge Nova-T 500 (aka Bristol)
  24. * has a LNA on GPIO0 which is enabled by setting 1 */
  25. static struct mt2060_config bristol_mt2060_config[2] = {
  26. {
  27. .i2c_address = 0x60,
  28. .clock_out = 3,
  29. }, {
  30. .i2c_address = 0x61,
  31. }
  32. };
  33. static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config = {
  34. .band_caps = BAND_VHF | BAND_UHF,
  35. .setup = (1 << 8) | (5 << 5) | (0 << 4) | (0 << 3) | (0 << 2) | (2 << 0),
  36. .agc1_max = 42598,
  37. .agc1_min = 17694,
  38. .agc2_max = 45875,
  39. .agc2_min = 0,
  40. .agc1_pt1 = 0,
  41. .agc1_pt2 = 59,
  42. .agc1_slope1 = 0,
  43. .agc1_slope2 = 69,
  44. .agc2_pt1 = 0,
  45. .agc2_pt2 = 59,
  46. .agc2_slope1 = 111,
  47. .agc2_slope2 = 28,
  48. };
  49. static struct dib3000mc_config bristol_dib3000mc_config[2] = {
  50. { .agc = &bristol_dib3000p_mt2060_agc_config,
  51. .max_time = 0x196,
  52. .ln_adc_level = 0x1cc7,
  53. .output_mpeg2_in_188_bytes = 1,
  54. },
  55. { .agc = &bristol_dib3000p_mt2060_agc_config,
  56. .max_time = 0x196,
  57. .ln_adc_level = 0x1cc7,
  58. .output_mpeg2_in_188_bytes = 1,
  59. }
  60. };
  61. static int bristol_frontend_attach(struct dvb_usb_adapter *adap)
  62. {
  63. struct dib0700_state *st = adap->dev->priv;
  64. if (adap->id == 0) {
  65. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
  66. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
  67. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
  68. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10);
  69. if (force_lna_activation)
  70. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  71. else
  72. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
  73. if (dib3000mc_i2c_enumeration(&adap->dev->i2c_adap, 2, DEFAULT_DIB3000P_I2C_ADDRESS, bristol_dib3000mc_config) != 0) {
  74. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
  75. return -ENODEV;
  76. }
  77. }
  78. st->mt2060_if1[adap->id] = 1220;
  79. return (adap->fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap,
  80. (10 + adap->id) << 1, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0;
  81. }
  82. static int eeprom_read(struct i2c_adapter *adap,u8 adrs,u8 *pval)
  83. {
  84. struct i2c_msg msg[2] = {
  85. { .addr = 0x50, .flags = 0, .buf = &adrs, .len = 1 },
  86. { .addr = 0x50, .flags = I2C_M_RD, .buf = pval, .len = 1 },
  87. };
  88. if (i2c_transfer(adap, msg, 2) != 2) return -EREMOTEIO;
  89. return 0;
  90. }
  91. static int bristol_tuner_attach(struct dvb_usb_adapter *adap)
  92. {
  93. struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
  94. struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1);
  95. s8 a;
  96. int if1=1220;
  97. if (adap->dev->udev->descriptor.idVendor == USB_VID_HAUPPAUGE &&
  98. adap->dev->udev->descriptor.idProduct == USB_PID_HAUPPAUGE_NOVA_T_500_2) {
  99. if (!eeprom_read(prim_i2c,0x59 + adap->id,&a)) if1=1220+a;
  100. }
  101. return dvb_attach(mt2060_attach,adap->fe, tun_i2c,&bristol_mt2060_config[adap->id],
  102. if1) == NULL ? -ENODEV : 0;
  103. }
  104. /* STK7700D: Pinnacle/Terratec/Hauppauge Dual DVB-T Diversity */
  105. /* MT226x */
  106. static struct dibx000_agc_config stk7700d_7000p_mt2266_agc_config[2] = {
  107. {
  108. BAND_UHF, // band_caps
  109. /* 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,
  110. * 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 */
  111. (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), // setup
  112. 1130, // inv_gain
  113. 21, // time_stabiliz
  114. 0, // alpha_level
  115. 118, // thlock
  116. 0, // wbd_inv
  117. 3530, // wbd_ref
  118. 1, // wbd_sel
  119. 0, // wbd_alpha
  120. 65535, // agc1_max
  121. 33770, // agc1_min
  122. 65535, // agc2_max
  123. 23592, // agc2_min
  124. 0, // agc1_pt1
  125. 62, // agc1_pt2
  126. 255, // agc1_pt3
  127. 64, // agc1_slope1
  128. 64, // agc1_slope2
  129. 132, // agc2_pt1
  130. 192, // agc2_pt2
  131. 80, // agc2_slope1
  132. 80, // agc2_slope2
  133. 17, // alpha_mant
  134. 27, // alpha_exp
  135. 23, // beta_mant
  136. 51, // beta_exp
  137. 1, // perform_agc_softsplit
  138. }, {
  139. BAND_VHF | BAND_LBAND, // band_caps
  140. /* 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,
  141. * 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 */
  142. (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), // setup
  143. 2372, // inv_gain
  144. 21, // time_stabiliz
  145. 0, // alpha_level
  146. 118, // thlock
  147. 0, // wbd_inv
  148. 3530, // wbd_ref
  149. 1, // wbd_sel
  150. 0, // wbd_alpha
  151. 65535, // agc1_max
  152. 0, // agc1_min
  153. 65535, // agc2_max
  154. 23592, // agc2_min
  155. 0, // agc1_pt1
  156. 128, // agc1_pt2
  157. 128, // agc1_pt3
  158. 128, // agc1_slope1
  159. 0, // agc1_slope2
  160. 128, // agc2_pt1
  161. 253, // agc2_pt2
  162. 81, // agc2_slope1
  163. 0, // agc2_slope2
  164. 17, // alpha_mant
  165. 27, // alpha_exp
  166. 23, // beta_mant
  167. 51, // beta_exp
  168. 1, // perform_agc_softsplit
  169. }
  170. };
  171. static struct dibx000_bandwidth_config stk7700d_mt2266_pll_config = {
  172. 60000, 30000, // internal, sampling
  173. 1, 8, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass
  174. 0, 0, 1, 1, 2, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo
  175. (3 << 14) | (1 << 12) | (524 << 0), // sad_cfg: refsel, sel, freq_15k
  176. 0, // ifreq
  177. 20452225, // timf
  178. };
  179. static struct dib7000p_config stk7700d_dib7000p_mt2266_config[] = {
  180. { .output_mpeg2_in_188_bytes = 1,
  181. .hostbus_diversity = 1,
  182. .tuner_is_baseband = 1,
  183. .agc_config_count = 2,
  184. .agc = stk7700d_7000p_mt2266_agc_config,
  185. .bw = &stk7700d_mt2266_pll_config,
  186. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  187. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  188. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  189. },
  190. { .output_mpeg2_in_188_bytes = 1,
  191. .hostbus_diversity = 1,
  192. .tuner_is_baseband = 1,
  193. .agc_config_count = 2,
  194. .agc = stk7700d_7000p_mt2266_agc_config,
  195. .bw = &stk7700d_mt2266_pll_config,
  196. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  197. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  198. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  199. }
  200. };
  201. static struct mt2266_config stk7700d_mt2266_config[2] = {
  202. { .i2c_address = 0x60
  203. },
  204. { .i2c_address = 0x60
  205. }
  206. };
  207. static int stk7700P2_frontend_attach(struct dvb_usb_adapter *adap)
  208. {
  209. if (adap->id == 0) {
  210. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  211. msleep(10);
  212. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  213. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  214. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  215. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  216. msleep(10);
  217. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  218. msleep(10);
  219. dib7000p_i2c_enumeration(&adap->dev->i2c_adap,1,18,stk7700d_dib7000p_mt2266_config);
  220. }
  221. adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1),
  222. &stk7700d_dib7000p_mt2266_config[adap->id]);
  223. return adap->fe == NULL ? -ENODEV : 0;
  224. }
  225. static int stk7700d_frontend_attach(struct dvb_usb_adapter *adap)
  226. {
  227. if (adap->id == 0) {
  228. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  229. msleep(10);
  230. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  231. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  232. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  233. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  234. msleep(10);
  235. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  236. msleep(10);
  237. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  238. dib7000p_i2c_enumeration(&adap->dev->i2c_adap,2,18,stk7700d_dib7000p_mt2266_config);
  239. }
  240. adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1),
  241. &stk7700d_dib7000p_mt2266_config[adap->id]);
  242. return adap->fe == NULL ? -ENODEV : 0;
  243. }
  244. static int stk7700d_tuner_attach(struct dvb_usb_adapter *adap)
  245. {
  246. struct i2c_adapter *tun_i2c;
  247. tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
  248. return dvb_attach(mt2266_attach, adap->fe, tun_i2c,
  249. &stk7700d_mt2266_config[adap->id]) == NULL ? -ENODEV : 0;;
  250. }
  251. #define DEFAULT_RC_INTERVAL 150
  252. static u8 rc_request[] = { REQUEST_POLL_RC, 0 };
  253. static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
  254. {
  255. u8 key[4];
  256. int i;
  257. struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
  258. struct dib0700_state *st = d->priv;
  259. *event = 0;
  260. *state = REMOTE_NO_KEY_PRESSED;
  261. i=dib0700_ctrl_rd(d,rc_request,2,key,4);
  262. if (i<=0) {
  263. err("RC Query Failed");
  264. return -1;
  265. }
  266. if (key[0]==0 && key[1]==0 && key[2]==0 && key[3]==0) return 0;
  267. if (key[3-1]!=st->rc_toggle) {
  268. for (i=0;i<d->props.rc_key_map_size; i++) {
  269. if (keymap[i].custom == key[3-2] && keymap[i].data == key[3-3]) {
  270. *event = keymap[i].event;
  271. *state = REMOTE_KEY_PRESSED;
  272. st->rc_toggle=key[3-1];
  273. return 0;
  274. }
  275. }
  276. err("Unknown remote controller key : %2X %2X",(int)key[3-2],(int)key[3-3]);
  277. }
  278. return 0;
  279. }
  280. static struct dvb_usb_rc_key dib0700_rc_keys[] = {
  281. /* Key codes for the tiny Pinnacle remote*/
  282. { 0x07, 0x00, KEY_MUTE },
  283. { 0x07, 0x01, KEY_MENU }, // Pinnacle logo
  284. { 0x07, 0x39, KEY_POWER },
  285. { 0x07, 0x03, KEY_VOLUMEUP },
  286. { 0x07, 0x09, KEY_VOLUMEDOWN },
  287. { 0x07, 0x06, KEY_CHANNELUP },
  288. { 0x07, 0x0c, KEY_CHANNELDOWN },
  289. { 0x07, 0x0f, KEY_1 },
  290. { 0x07, 0x15, KEY_2 },
  291. { 0x07, 0x10, KEY_3 },
  292. { 0x07, 0x18, KEY_4 },
  293. { 0x07, 0x1b, KEY_5 },
  294. { 0x07, 0x1e, KEY_6 },
  295. { 0x07, 0x11, KEY_7 },
  296. { 0x07, 0x21, KEY_8 },
  297. { 0x07, 0x12, KEY_9 },
  298. { 0x07, 0x27, KEY_0 },
  299. { 0x07, 0x24, KEY_SCREEN }, // 'Square' key
  300. { 0x07, 0x2a, KEY_TEXT }, // 'T' key
  301. { 0x07, 0x2d, KEY_REWIND },
  302. { 0x07, 0x30, KEY_PLAY },
  303. { 0x07, 0x33, KEY_FASTFORWARD },
  304. { 0x07, 0x36, KEY_RECORD },
  305. { 0x07, 0x3c, KEY_STOP },
  306. { 0x07, 0x3f, KEY_CANCEL }, // '?' key
  307. /* Key codes for the Terratec Cinergy DT XS Diversity, similar to cinergyT2.c */
  308. { 0xeb, 0x01, KEY_POWER },
  309. { 0xeb, 0x02, KEY_1 },
  310. { 0xeb, 0x03, KEY_2 },
  311. { 0xeb, 0x04, KEY_3 },
  312. { 0xeb, 0x05, KEY_4 },
  313. { 0xeb, 0x06, KEY_5 },
  314. { 0xeb, 0x07, KEY_6 },
  315. { 0xeb, 0x08, KEY_7 },
  316. { 0xeb, 0x09, KEY_8 },
  317. { 0xeb, 0x0a, KEY_9 },
  318. { 0xeb, 0x0b, KEY_VIDEO },
  319. { 0xeb, 0x0c, KEY_0 },
  320. { 0xeb, 0x0d, KEY_REFRESH },
  321. { 0xeb, 0x0f, KEY_EPG },
  322. { 0xeb, 0x10, KEY_UP },
  323. { 0xeb, 0x11, KEY_LEFT },
  324. { 0xeb, 0x12, KEY_OK },
  325. { 0xeb, 0x13, KEY_RIGHT },
  326. { 0xeb, 0x14, KEY_DOWN },
  327. { 0xeb, 0x16, KEY_INFO },
  328. { 0xeb, 0x17, KEY_RED },
  329. { 0xeb, 0x18, KEY_GREEN },
  330. { 0xeb, 0x19, KEY_YELLOW },
  331. { 0xeb, 0x1a, KEY_BLUE },
  332. { 0xeb, 0x1b, KEY_CHANNELUP },
  333. { 0xeb, 0x1c, KEY_VOLUMEUP },
  334. { 0xeb, 0x1d, KEY_MUTE },
  335. { 0xeb, 0x1e, KEY_VOLUMEDOWN },
  336. { 0xeb, 0x1f, KEY_CHANNELDOWN },
  337. { 0xeb, 0x40, KEY_PAUSE },
  338. { 0xeb, 0x41, KEY_HOME },
  339. { 0xeb, 0x42, KEY_MENU }, /* DVD Menu */
  340. { 0xeb, 0x43, KEY_SUBTITLE },
  341. { 0xeb, 0x44, KEY_TEXT }, /* Teletext */
  342. { 0xeb, 0x45, KEY_DELETE },
  343. { 0xeb, 0x46, KEY_TV },
  344. { 0xeb, 0x47, KEY_DVD },
  345. { 0xeb, 0x48, KEY_STOP },
  346. { 0xeb, 0x49, KEY_VIDEO },
  347. { 0xeb, 0x4a, KEY_AUDIO }, /* Music */
  348. { 0xeb, 0x4b, KEY_SCREEN }, /* Pic */
  349. { 0xeb, 0x4c, KEY_PLAY },
  350. { 0xeb, 0x4d, KEY_BACK },
  351. { 0xeb, 0x4e, KEY_REWIND },
  352. { 0xeb, 0x4f, KEY_FASTFORWARD },
  353. { 0xeb, 0x54, KEY_PREVIOUS },
  354. { 0xeb, 0x58, KEY_RECORD },
  355. { 0xeb, 0x5c, KEY_NEXT },
  356. /* Key codes for the Haupauge WinTV Nova-TD, copied from nova-t-usb2.c (Nova-T USB2) */
  357. { 0x1e, 0x00, KEY_0 },
  358. { 0x1e, 0x01, KEY_1 },
  359. { 0x1e, 0x02, KEY_2 },
  360. { 0x1e, 0x03, KEY_3 },
  361. { 0x1e, 0x04, KEY_4 },
  362. { 0x1e, 0x05, KEY_5 },
  363. { 0x1e, 0x06, KEY_6 },
  364. { 0x1e, 0x07, KEY_7 },
  365. { 0x1e, 0x08, KEY_8 },
  366. { 0x1e, 0x09, KEY_9 },
  367. { 0x1e, 0x0a, KEY_KPASTERISK },
  368. { 0x1e, 0x0b, KEY_RED },
  369. { 0x1e, 0x0c, KEY_RADIO },
  370. { 0x1e, 0x0d, KEY_MENU },
  371. { 0x1e, 0x0e, KEY_GRAVE }, /* # */
  372. { 0x1e, 0x0f, KEY_MUTE },
  373. { 0x1e, 0x10, KEY_VOLUMEUP },
  374. { 0x1e, 0x11, KEY_VOLUMEDOWN },
  375. { 0x1e, 0x12, KEY_CHANNEL },
  376. { 0x1e, 0x14, KEY_UP },
  377. { 0x1e, 0x15, KEY_DOWN },
  378. { 0x1e, 0x16, KEY_LEFT },
  379. { 0x1e, 0x17, KEY_RIGHT },
  380. { 0x1e, 0x18, KEY_VIDEO },
  381. { 0x1e, 0x19, KEY_AUDIO },
  382. { 0x1e, 0x1a, KEY_MEDIA },
  383. { 0x1e, 0x1b, KEY_EPG },
  384. { 0x1e, 0x1c, KEY_TV },
  385. { 0x1e, 0x1e, KEY_NEXT },
  386. { 0x1e, 0x1f, KEY_BACK },
  387. { 0x1e, 0x20, KEY_CHANNELUP },
  388. { 0x1e, 0x21, KEY_CHANNELDOWN },
  389. { 0x1e, 0x24, KEY_LAST }, /* Skip backwards */
  390. { 0x1e, 0x25, KEY_OK },
  391. { 0x1e, 0x29, KEY_BLUE},
  392. { 0x1e, 0x2e, KEY_GREEN },
  393. { 0x1e, 0x30, KEY_PAUSE },
  394. { 0x1e, 0x32, KEY_REWIND },
  395. { 0x1e, 0x34, KEY_FASTFORWARD },
  396. { 0x1e, 0x35, KEY_PLAY },
  397. { 0x1e, 0x36, KEY_STOP },
  398. { 0x1e, 0x37, KEY_RECORD },
  399. { 0x1e, 0x38, KEY_YELLOW },
  400. { 0x1e, 0x3b, KEY_GOTO },
  401. { 0x1e, 0x3d, KEY_POWER },
  402. /* Key codes for the Leadtek Winfast DTV Dongle */
  403. { 0x00, 0x42, KEY_POWER },
  404. { 0x07, 0x7c, KEY_TUNER },
  405. { 0x0f, 0x4e, KEY_PRINT }, /* PREVIEW */
  406. { 0x08, 0x40, KEY_SCREEN }, /* full screen toggle*/
  407. { 0x0f, 0x71, KEY_DOT }, /* frequency */
  408. { 0x07, 0x43, KEY_0 },
  409. { 0x0c, 0x41, KEY_1 },
  410. { 0x04, 0x43, KEY_2 },
  411. { 0x0b, 0x7f, KEY_3 },
  412. { 0x0e, 0x41, KEY_4 },
  413. { 0x06, 0x43, KEY_5 },
  414. { 0x09, 0x7f, KEY_6 },
  415. { 0x0d, 0x7e, KEY_7 },
  416. { 0x05, 0x7c, KEY_8 },
  417. { 0x0a, 0x40, KEY_9 },
  418. { 0x0e, 0x4e, KEY_CLEAR },
  419. { 0x04, 0x7c, KEY_CHANNEL }, /* show channel number */
  420. { 0x0f, 0x41, KEY_LAST }, /* recall */
  421. { 0x03, 0x42, KEY_MUTE },
  422. { 0x06, 0x4c, KEY_RESERVED }, /* PIP button*/
  423. { 0x01, 0x72, KEY_SHUFFLE }, /* SNAPSHOT */
  424. { 0x0c, 0x4e, KEY_PLAYPAUSE }, /* TIMESHIFT */
  425. { 0x0b, 0x70, KEY_RECORD },
  426. { 0x03, 0x7d, KEY_VOLUMEUP },
  427. { 0x01, 0x7d, KEY_VOLUMEDOWN },
  428. { 0x02, 0x42, KEY_CHANNELUP },
  429. { 0x00, 0x7d, KEY_CHANNELDOWN },
  430. };
  431. /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
  432. static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = {
  433. BAND_UHF | BAND_VHF, // band_caps
  434. /* 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,
  435. * 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 */
  436. (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), // setup
  437. 712, // inv_gain
  438. 41, // time_stabiliz
  439. 0, // alpha_level
  440. 118, // thlock
  441. 0, // wbd_inv
  442. 4095, // wbd_ref
  443. 0, // wbd_sel
  444. 0, // wbd_alpha
  445. 42598, // agc1_max
  446. 17694, // agc1_min
  447. 45875, // agc2_max
  448. 2621, // agc2_min
  449. 0, // agc1_pt1
  450. 76, // agc1_pt2
  451. 139, // agc1_pt3
  452. 52, // agc1_slope1
  453. 59, // agc1_slope2
  454. 107, // agc2_pt1
  455. 172, // agc2_pt2
  456. 57, // agc2_slope1
  457. 70, // agc2_slope2
  458. 21, // alpha_mant
  459. 25, // alpha_exp
  460. 28, // beta_mant
  461. 48, // beta_exp
  462. 1, // perform_agc_softsplit
  463. { 0, // split_min
  464. 107, // split_max
  465. 51800, // global_split_min
  466. 24700 // global_split_max
  467. },
  468. };
  469. static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config = {
  470. BAND_UHF | BAND_VHF,
  471. /* 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,
  472. * 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 */
  473. (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), // setup
  474. 712, // inv_gain
  475. 41, // time_stabiliz
  476. 0, // alpha_level
  477. 118, // thlock
  478. 0, // wbd_inv
  479. 4095, // wbd_ref
  480. 0, // wbd_sel
  481. 0, // wbd_alpha
  482. 42598, // agc1_max
  483. 16384, // agc1_min
  484. 42598, // agc2_max
  485. 0, // agc2_min
  486. 0, // agc1_pt1
  487. 137, // agc1_pt2
  488. 255, // agc1_pt3
  489. 0, // agc1_slope1
  490. 255, // agc1_slope2
  491. 0, // agc2_pt1
  492. 0, // agc2_pt2
  493. 0, // agc2_slope1
  494. 41, // agc2_slope2
  495. 15, // alpha_mant
  496. 25, // alpha_exp
  497. 28, // beta_mant
  498. 48, // beta_exp
  499. 0, // perform_agc_softsplit
  500. };
  501. static struct dibx000_bandwidth_config stk7700p_pll_config = {
  502. 60000, 30000, // internal, sampling
  503. 1, 8, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass
  504. 0, 0, 1, 1, 0, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo
  505. (3 << 14) | (1 << 12) | (524 << 0), // sad_cfg: refsel, sel, freq_15k
  506. 60258167, // ifreq
  507. 20452225, // timf
  508. 30000000, // xtal
  509. };
  510. static struct dib7000m_config stk7700p_dib7000m_config = {
  511. .dvbt_mode = 1,
  512. .output_mpeg2_in_188_bytes = 1,
  513. .quartz_direct = 1,
  514. .agc_config_count = 1,
  515. .agc = &stk7700p_7000m_mt2060_agc_config,
  516. .bw = &stk7700p_pll_config,
  517. .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
  518. .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
  519. .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
  520. };
  521. static struct dib7000p_config stk7700p_dib7000p_config = {
  522. .output_mpeg2_in_188_bytes = 1,
  523. .agc_config_count = 1,
  524. .agc = &stk7700p_7000p_mt2060_agc_config,
  525. .bw = &stk7700p_pll_config,
  526. .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
  527. .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
  528. .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
  529. };
  530. static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap)
  531. {
  532. struct dib0700_state *st = adap->dev->priv;
  533. /* unless there is no real power management in DVB - we leave the device on GPIO6 */
  534. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  535. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(50);
  536. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
  537. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  538. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
  539. dib0700_ctrl_clock(adap->dev, 72, 1);
  540. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100);
  541. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  542. st->mt2060_if1[0] = 1220;
  543. if (dib7000pc_detection(&adap->dev->i2c_adap)) {
  544. adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config);
  545. st->is_dib7000pc = 1;
  546. } else
  547. adap->fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config);
  548. return adap->fe == NULL ? -ENODEV : 0;
  549. }
  550. static struct mt2060_config stk7700p_mt2060_config = {
  551. 0x60
  552. };
  553. static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
  554. {
  555. struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
  556. struct dib0700_state *st = adap->dev->priv;
  557. struct i2c_adapter *tun_i2c;
  558. s8 a;
  559. int if1=1220;
  560. if (adap->dev->udev->descriptor.idVendor == USB_VID_HAUPPAUGE &&
  561. adap->dev->udev->descriptor.idProduct == USB_PID_HAUPPAUGE_NOVA_T_STICK) {
  562. if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a;
  563. }
  564. if (st->is_dib7000pc)
  565. tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
  566. else
  567. tun_i2c = dib7000m_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
  568. return dvb_attach(mt2060_attach, adap->fe, tun_i2c, &stk7700p_mt2060_config,
  569. if1) == NULL ? -ENODEV : 0;
  570. }
  571. /* DIB7070 generic */
  572. static struct dibx000_agc_config dib7070_agc_config = {
  573. BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
  574. /* 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,
  575. * 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 */
  576. (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), // setup
  577. 600, // inv_gain
  578. 10, // time_stabiliz
  579. 0, // alpha_level
  580. 118, // thlock
  581. 0, // wbd_inv
  582. 3530, // wbd_ref
  583. 1, // wbd_sel
  584. 5, // wbd_alpha
  585. 65535, // agc1_max
  586. 0, // agc1_min
  587. 65535, // agc2_max
  588. 0, // agc2_min
  589. 0, // agc1_pt1
  590. 40, // agc1_pt2
  591. 183, // agc1_pt3
  592. 206, // agc1_slope1
  593. 255, // agc1_slope2
  594. 72, // agc2_pt1
  595. 152, // agc2_pt2
  596. 88, // agc2_slope1
  597. 90, // agc2_slope2
  598. 17, // alpha_mant
  599. 27, // alpha_exp
  600. 23, // beta_mant
  601. 51, // beta_exp
  602. 0, // perform_agc_softsplit
  603. };
  604. static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
  605. {
  606. return dib7000p_set_gpio(fe, 8, 0, !onoff);
  607. }
  608. static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
  609. {
  610. return dib7000p_set_gpio(fe, 9, 0, onoff);
  611. }
  612. static struct dib0070_config dib7070p_dib0070_config[2] = {
  613. {
  614. .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
  615. .reset = dib7070_tuner_reset,
  616. .sleep = dib7070_tuner_sleep,
  617. .clock_khz = 12000,
  618. .clock_pad_drive = 4
  619. }, {
  620. .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
  621. .reset = dib7070_tuner_reset,
  622. .sleep = dib7070_tuner_sleep,
  623. .clock_khz = 12000,
  624. }
  625. };
  626. static int dib7070_set_param_override(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
  627. {
  628. struct dvb_usb_adapter *adap = fe->dvb->priv;
  629. struct dib0700_adapter_state *state = adap->priv;
  630. u16 offset;
  631. u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
  632. switch (band) {
  633. case BAND_VHF: offset = 950; break;
  634. case BAND_UHF:
  635. default: offset = 550; break;
  636. }
  637. deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
  638. dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
  639. return state->set_param_save(fe, fep);
  640. }
  641. static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap)
  642. {
  643. struct dib0700_adapter_state *st = adap->priv;
  644. struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
  645. if (adap->id == 0) {
  646. if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL)
  647. return -ENODEV;
  648. } else {
  649. if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL)
  650. return -ENODEV;
  651. }
  652. st->set_param_save = adap->fe->ops.tuner_ops.set_params;
  653. adap->fe->ops.tuner_ops.set_params = dib7070_set_param_override;
  654. return 0;
  655. }
  656. static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
  657. 60000, 15000, // internal, sampling
  658. 1, 20, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass
  659. 0, 0, 1, 1, 2, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo
  660. (3 << 14) | (1 << 12) | (524 << 0), // sad_cfg: refsel, sel, freq_15k
  661. (0 << 25) | 0, // ifreq = 0.000000 MHz
  662. 20452225, // timf
  663. 12000000, // xtal_hz
  664. };
  665. static struct dib7000p_config dib7070p_dib7000p_config = {
  666. .output_mpeg2_in_188_bytes = 1,
  667. .agc_config_count = 1,
  668. .agc = &dib7070_agc_config,
  669. .bw = &dib7070_bw_config_12_mhz,
  670. .tuner_is_baseband = 1,
  671. .spur_protect = 1,
  672. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  673. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  674. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  675. .hostbus_diversity = 1,
  676. };
  677. /* STK7070P */
  678. static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)
  679. {
  680. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  681. msleep(10);
  682. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  683. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  684. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  685. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  686. dib0700_ctrl_clock(adap->dev, 72, 1);
  687. msleep(10);
  688. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  689. msleep(10);
  690. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  691. dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, &dib7070p_dib7000p_config);
  692. adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &dib7070p_dib7000p_config);
  693. return adap->fe == NULL ? -ENODEV : 0;
  694. }
  695. /* STK7070PD */
  696. static struct dib7000p_config stk7070pd_dib7000p_config[2] = {
  697. {
  698. .output_mpeg2_in_188_bytes = 1,
  699. .agc_config_count = 1,
  700. .agc = &dib7070_agc_config,
  701. .bw = &dib7070_bw_config_12_mhz,
  702. .tuner_is_baseband = 1,
  703. .spur_protect = 1,
  704. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  705. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  706. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  707. .hostbus_diversity = 1,
  708. }, {
  709. .output_mpeg2_in_188_bytes = 1,
  710. .agc_config_count = 1,
  711. .agc = &dib7070_agc_config,
  712. .bw = &dib7070_bw_config_12_mhz,
  713. .tuner_is_baseband = 1,
  714. .spur_protect = 1,
  715. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  716. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  717. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  718. .hostbus_diversity = 1,
  719. }
  720. };
  721. static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap)
  722. {
  723. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  724. msleep(10);
  725. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  726. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  727. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  728. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  729. dib0700_ctrl_clock(adap->dev, 72, 1);
  730. msleep(10);
  731. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  732. msleep(10);
  733. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  734. dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18, stk7070pd_dib7000p_config);
  735. adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]);
  736. return adap->fe == NULL ? -ENODEV : 0;
  737. }
  738. static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap)
  739. {
  740. adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]);
  741. return adap->fe == NULL ? -ENODEV : 0;
  742. }
  743. /* DVB-USB and USB stuff follows */
  744. struct usb_device_id dib0700_usb_id_table[] = {
  745. /* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },
  746. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) },
  747. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },
  748. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },
  749. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },
  750. /* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },
  751. { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) },
  752. { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) },
  753. { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) },
  754. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) },
  755. /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) },
  756. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) },
  757. { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) },
  758. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) },
  759. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) },
  760. /* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) },
  761. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) },
  762. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) },
  763. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) },
  764. { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) },
  765. /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) },
  766. { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) },
  767. { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) },
  768. { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) },
  769. { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) },
  770. /* 25 */ { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) },
  771. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) },
  772. { 0 } /* Terminating entry */
  773. };
  774. MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
  775. #define DIB0700_DEFAULT_DEVICE_PROPERTIES \
  776. .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
  777. .usb_ctrl = DEVICE_SPECIFIC, \
  778. .firmware = "dvb-usb-dib0700-1.10.fw", \
  779. .download_firmware = dib0700_download_firmware, \
  780. .no_reconnect = 1, \
  781. .size_of_priv = sizeof(struct dib0700_state), \
  782. .i2c_algo = &dib0700_i2c_algo, \
  783. .identify_state = dib0700_identify_state
  784. #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
  785. .streaming_ctrl = dib0700_streaming_ctrl, \
  786. .stream = { \
  787. .type = USB_BULK, \
  788. .count = 4, \
  789. .endpoint = ep, \
  790. .u = { \
  791. .bulk = { \
  792. .buffersize = 39480, \
  793. } \
  794. } \
  795. }
  796. struct dvb_usb_device_properties dib0700_devices[] = {
  797. {
  798. DIB0700_DEFAULT_DEVICE_PROPERTIES,
  799. .num_adapters = 1,
  800. .adapter = {
  801. {
  802. .frontend_attach = stk7700p_frontend_attach,
  803. .tuner_attach = stk7700p_tuner_attach,
  804. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  805. },
  806. },
  807. .num_device_descs = 8,
  808. .devices = {
  809. { "DiBcom STK7700P reference design",
  810. { &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] },
  811. { NULL },
  812. },
  813. { "Hauppauge Nova-T Stick",
  814. { &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL },
  815. { NULL },
  816. },
  817. { "AVerMedia AVerTV DVB-T Volar",
  818. { &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] },
  819. { NULL },
  820. },
  821. { "Compro Videomate U500",
  822. { &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] },
  823. { NULL },
  824. },
  825. { "Uniwill STK7700P based (Hama and others)",
  826. { &dib0700_usb_id_table[7], NULL },
  827. { NULL },
  828. },
  829. { "Leadtek Winfast DTV Dongle (STK7700P based)",
  830. { &dib0700_usb_id_table[8], NULL },
  831. { NULL },
  832. },
  833. { "AVerMedia AVerTV DVB-T Express",
  834. { &dib0700_usb_id_table[20] },
  835. { NULL },
  836. },
  837. { "Gigabyte U7000",
  838. { &dib0700_usb_id_table[21], NULL },
  839. { NULL },
  840. }
  841. },
  842. .rc_interval = DEFAULT_RC_INTERVAL,
  843. .rc_key_map = dib0700_rc_keys,
  844. .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
  845. .rc_query = dib0700_rc_query
  846. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  847. .num_adapters = 2,
  848. .adapter = {
  849. {
  850. .frontend_attach = bristol_frontend_attach,
  851. .tuner_attach = bristol_tuner_attach,
  852. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  853. }, {
  854. .frontend_attach = bristol_frontend_attach,
  855. .tuner_attach = bristol_tuner_attach,
  856. DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
  857. }
  858. },
  859. .num_device_descs = 1,
  860. .devices = {
  861. { "Hauppauge Nova-T 500 Dual DVB-T",
  862. { &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL },
  863. { NULL },
  864. },
  865. },
  866. .rc_interval = DEFAULT_RC_INTERVAL,
  867. .rc_key_map = dib0700_rc_keys,
  868. .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
  869. .rc_query = dib0700_rc_query
  870. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  871. .num_adapters = 2,
  872. .adapter = {
  873. {
  874. .frontend_attach = stk7700d_frontend_attach,
  875. .tuner_attach = stk7700d_tuner_attach,
  876. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  877. }, {
  878. .frontend_attach = stk7700d_frontend_attach,
  879. .tuner_attach = stk7700d_tuner_attach,
  880. DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
  881. }
  882. },
  883. .num_device_descs = 4,
  884. .devices = {
  885. { "Pinnacle PCTV 2000e",
  886. { &dib0700_usb_id_table[11], NULL },
  887. { NULL },
  888. },
  889. { "Terratec Cinergy DT XS Diversity",
  890. { &dib0700_usb_id_table[12], NULL },
  891. { NULL },
  892. },
  893. { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",
  894. { &dib0700_usb_id_table[13], NULL },
  895. { NULL },
  896. },
  897. { "DiBcom STK7700D reference design",
  898. { &dib0700_usb_id_table[14], NULL },
  899. { NULL },
  900. }
  901. },
  902. .rc_interval = DEFAULT_RC_INTERVAL,
  903. .rc_key_map = dib0700_rc_keys,
  904. .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
  905. .rc_query = dib0700_rc_query
  906. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  907. .num_adapters = 1,
  908. .adapter = {
  909. {
  910. .frontend_attach = stk7700P2_frontend_attach,
  911. .tuner_attach = stk7700d_tuner_attach,
  912. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  913. },
  914. },
  915. .num_device_descs = 1,
  916. .devices = {
  917. { "ASUS My Cinema U3000 Mini DVBT Tuner",
  918. { &dib0700_usb_id_table[23], NULL },
  919. { NULL },
  920. },
  921. }
  922. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  923. .num_adapters = 1,
  924. .adapter = {
  925. {
  926. .frontend_attach = stk7070p_frontend_attach,
  927. .tuner_attach = dib7070p_tuner_attach,
  928. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  929. .size_of_priv = sizeof(struct dib0700_adapter_state),
  930. },
  931. },
  932. .num_device_descs = 6,
  933. .devices = {
  934. { "DiBcom STK7070P reference design",
  935. { &dib0700_usb_id_table[15], NULL },
  936. { NULL },
  937. },
  938. { "Pinnacle PCTV DVB-T Flash Stick",
  939. { &dib0700_usb_id_table[16], NULL },
  940. { NULL },
  941. },
  942. { "Artec T14BR DVB-T",
  943. { &dib0700_usb_id_table[22], NULL },
  944. { NULL },
  945. },
  946. { "ASUS My Cinema U3100 Mini DVBT Tuner",
  947. { &dib0700_usb_id_table[24], NULL },
  948. { NULL },
  949. },
  950. { "Hauppauge Nova-T Stick",
  951. { &dib0700_usb_id_table[25], NULL },
  952. { NULL },
  953. },
  954. { "Hauppauge Nova-T MyTV.t",
  955. { &dib0700_usb_id_table[26], NULL },
  956. { NULL },
  957. },
  958. },
  959. .rc_interval = DEFAULT_RC_INTERVAL,
  960. .rc_key_map = dib0700_rc_keys,
  961. .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
  962. .rc_query = dib0700_rc_query
  963. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  964. .num_adapters = 2,
  965. .adapter = {
  966. {
  967. .frontend_attach = stk7070pd_frontend_attach0,
  968. .tuner_attach = dib7070p_tuner_attach,
  969. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  970. .size_of_priv = sizeof(struct dib0700_adapter_state),
  971. }, {
  972. .frontend_attach = stk7070pd_frontend_attach1,
  973. .tuner_attach = dib7070p_tuner_attach,
  974. DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
  975. .size_of_priv = sizeof(struct dib0700_adapter_state),
  976. }
  977. },
  978. .num_device_descs = 2,
  979. .devices = {
  980. { "DiBcom STK7070PD reference design",
  981. { &dib0700_usb_id_table[17], NULL },
  982. { NULL },
  983. },
  984. { "Pinnacle PCTV Dual DVB-T Diversity Stick",
  985. { &dib0700_usb_id_table[18], NULL },
  986. { NULL },
  987. }
  988. }
  989. },
  990. };
  991. int dib0700_device_count = ARRAY_SIZE(dib0700_devices);