dib0700_devices.c 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616
  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. static int dib0700_xc5000_tuner_callback(void *priv, int component,
  1005. int command, int arg)
  1006. {
  1007. struct dvb_usb_adapter *adap = priv;
  1008. if (command == XC5000_TUNER_RESET) {
  1009. /* Reset the tuner */
  1010. dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0);
  1011. msleep(330); /* from Windows USB trace */
  1012. dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1);
  1013. msleep(330); /* from Windows USB trace */
  1014. } else {
  1015. err("xc5000: unknown tuner callback command: %d\n", command);
  1016. return -EINVAL;
  1017. }
  1018. return 0;
  1019. }
  1020. static struct xc5000_config s5h1411_xc5000_tunerconfig = {
  1021. .i2c_address = 0x64,
  1022. .if_khz = 5380,
  1023. };
  1024. static int xc5000_tuner_attach(struct dvb_usb_adapter *adap)
  1025. {
  1026. /* FIXME: generalize & move to common area */
  1027. adap->fe->callback = dib0700_xc5000_tuner_callback;
  1028. return dvb_attach(xc5000_attach, adap->fe, &adap->dev->i2c_adap,
  1029. &s5h1411_xc5000_tunerconfig)
  1030. == NULL ? -ENODEV : 0;
  1031. }
  1032. /* DVB-USB and USB stuff follows */
  1033. struct usb_device_id dib0700_usb_id_table[] = {
  1034. /* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },
  1035. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) },
  1036. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },
  1037. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },
  1038. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },
  1039. /* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },
  1040. { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) },
  1041. { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) },
  1042. { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) },
  1043. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) },
  1044. /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) },
  1045. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) },
  1046. { USB_DEVICE(USB_VID_TERRATEC,
  1047. USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) },
  1048. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) },
  1049. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) },
  1050. /* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) },
  1051. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) },
  1052. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) },
  1053. { USB_DEVICE(USB_VID_PINNACLE,
  1054. USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) },
  1055. { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) },
  1056. /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) },
  1057. { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) },
  1058. { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) },
  1059. { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) },
  1060. { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) },
  1061. /* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) },
  1062. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) },
  1063. { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) },
  1064. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) },
  1065. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) },
  1066. /* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) },
  1067. { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) },
  1068. { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) },
  1069. { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) },
  1070. { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) },
  1071. /* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) },
  1072. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) },
  1073. { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U8000) },
  1074. { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700PH) },
  1075. { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000H) },
  1076. /* 40 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E) },
  1077. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E_SE) },
  1078. { 0 } /* Terminating entry */
  1079. };
  1080. MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
  1081. #define DIB0700_DEFAULT_DEVICE_PROPERTIES \
  1082. .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
  1083. .usb_ctrl = DEVICE_SPECIFIC, \
  1084. .firmware = "dvb-usb-dib0700-1.20.fw", \
  1085. .download_firmware = dib0700_download_firmware, \
  1086. .no_reconnect = 1, \
  1087. .size_of_priv = sizeof(struct dib0700_state), \
  1088. .i2c_algo = &dib0700_i2c_algo, \
  1089. .identify_state = dib0700_identify_state
  1090. #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
  1091. .streaming_ctrl = dib0700_streaming_ctrl, \
  1092. .stream = { \
  1093. .type = USB_BULK, \
  1094. .count = 4, \
  1095. .endpoint = ep, \
  1096. .u = { \
  1097. .bulk = { \
  1098. .buffersize = 39480, \
  1099. } \
  1100. } \
  1101. }
  1102. struct dvb_usb_device_properties dib0700_devices[] = {
  1103. {
  1104. DIB0700_DEFAULT_DEVICE_PROPERTIES,
  1105. .num_adapters = 1,
  1106. .adapter = {
  1107. {
  1108. .frontend_attach = stk7700p_frontend_attach,
  1109. .tuner_attach = stk7700p_tuner_attach,
  1110. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  1111. },
  1112. },
  1113. .num_device_descs = 8,
  1114. .devices = {
  1115. { "DiBcom STK7700P reference design",
  1116. { &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] },
  1117. { NULL },
  1118. },
  1119. { "Hauppauge Nova-T Stick",
  1120. { &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL },
  1121. { NULL },
  1122. },
  1123. { "AVerMedia AVerTV DVB-T Volar",
  1124. { &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] },
  1125. { NULL },
  1126. },
  1127. { "Compro Videomate U500",
  1128. { &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] },
  1129. { NULL },
  1130. },
  1131. { "Uniwill STK7700P based (Hama and others)",
  1132. { &dib0700_usb_id_table[7], NULL },
  1133. { NULL },
  1134. },
  1135. { "Leadtek Winfast DTV Dongle (STK7700P based)",
  1136. { &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] },
  1137. { NULL },
  1138. },
  1139. { "AVerMedia AVerTV DVB-T Express",
  1140. { &dib0700_usb_id_table[20] },
  1141. { NULL },
  1142. },
  1143. { "Gigabyte U7000",
  1144. { &dib0700_usb_id_table[21], NULL },
  1145. { NULL },
  1146. }
  1147. },
  1148. .rc_interval = DEFAULT_RC_INTERVAL,
  1149. .rc_key_map = dib0700_rc_keys,
  1150. .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
  1151. .rc_query = dib0700_rc_query
  1152. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  1153. .num_adapters = 2,
  1154. .adapter = {
  1155. {
  1156. .frontend_attach = bristol_frontend_attach,
  1157. .tuner_attach = bristol_tuner_attach,
  1158. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  1159. }, {
  1160. .frontend_attach = bristol_frontend_attach,
  1161. .tuner_attach = bristol_tuner_attach,
  1162. DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
  1163. }
  1164. },
  1165. .num_device_descs = 1,
  1166. .devices = {
  1167. { "Hauppauge Nova-T 500 Dual DVB-T",
  1168. { &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL },
  1169. { NULL },
  1170. },
  1171. },
  1172. .rc_interval = DEFAULT_RC_INTERVAL,
  1173. .rc_key_map = dib0700_rc_keys,
  1174. .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
  1175. .rc_query = dib0700_rc_query
  1176. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  1177. .num_adapters = 2,
  1178. .adapter = {
  1179. {
  1180. .frontend_attach = stk7700d_frontend_attach,
  1181. .tuner_attach = stk7700d_tuner_attach,
  1182. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  1183. }, {
  1184. .frontend_attach = stk7700d_frontend_attach,
  1185. .tuner_attach = stk7700d_tuner_attach,
  1186. DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
  1187. }
  1188. },
  1189. .num_device_descs = 4,
  1190. .devices = {
  1191. { "Pinnacle PCTV 2000e",
  1192. { &dib0700_usb_id_table[11], NULL },
  1193. { NULL },
  1194. },
  1195. { "Terratec Cinergy DT XS Diversity",
  1196. { &dib0700_usb_id_table[12], NULL },
  1197. { NULL },
  1198. },
  1199. { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",
  1200. { &dib0700_usb_id_table[13], NULL },
  1201. { NULL },
  1202. },
  1203. { "DiBcom STK7700D reference design",
  1204. { &dib0700_usb_id_table[14], NULL },
  1205. { NULL },
  1206. }
  1207. },
  1208. .rc_interval = DEFAULT_RC_INTERVAL,
  1209. .rc_key_map = dib0700_rc_keys,
  1210. .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
  1211. .rc_query = dib0700_rc_query
  1212. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  1213. .num_adapters = 1,
  1214. .adapter = {
  1215. {
  1216. .frontend_attach = stk7700P2_frontend_attach,
  1217. .tuner_attach = stk7700d_tuner_attach,
  1218. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  1219. },
  1220. },
  1221. .num_device_descs = 2,
  1222. .devices = {
  1223. { "ASUS My Cinema U3000 Mini DVBT Tuner",
  1224. { &dib0700_usb_id_table[23], NULL },
  1225. { NULL },
  1226. },
  1227. { "Yuan EC372S",
  1228. { &dib0700_usb_id_table[31], NULL },
  1229. { NULL },
  1230. }
  1231. },
  1232. .rc_interval = DEFAULT_RC_INTERVAL,
  1233. .rc_key_map = dib0700_rc_keys,
  1234. .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
  1235. .rc_query = dib0700_rc_query
  1236. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  1237. .num_adapters = 1,
  1238. .adapter = {
  1239. {
  1240. .frontend_attach = stk7070p_frontend_attach,
  1241. .tuner_attach = dib7070p_tuner_attach,
  1242. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  1243. .size_of_priv = sizeof(struct dib0700_adapter_state),
  1244. },
  1245. },
  1246. .num_device_descs = 9,
  1247. .devices = {
  1248. { "DiBcom STK7070P reference design",
  1249. { &dib0700_usb_id_table[15], NULL },
  1250. { NULL },
  1251. },
  1252. { "Pinnacle PCTV DVB-T Flash Stick",
  1253. { &dib0700_usb_id_table[16], NULL },
  1254. { NULL },
  1255. },
  1256. { "Artec T14BR DVB-T",
  1257. { &dib0700_usb_id_table[22], NULL },
  1258. { NULL },
  1259. },
  1260. { "ASUS My Cinema U3100 Mini DVBT Tuner",
  1261. { &dib0700_usb_id_table[24], NULL },
  1262. { NULL },
  1263. },
  1264. { "Hauppauge Nova-T Stick",
  1265. { &dib0700_usb_id_table[25], NULL },
  1266. { NULL },
  1267. },
  1268. { "Hauppauge Nova-T MyTV.t",
  1269. { &dib0700_usb_id_table[26], NULL },
  1270. { NULL },
  1271. },
  1272. { "Pinnacle PCTV 72e",
  1273. { &dib0700_usb_id_table[29], NULL },
  1274. { NULL },
  1275. },
  1276. { "Pinnacle PCTV 73e",
  1277. { &dib0700_usb_id_table[30], NULL },
  1278. { NULL },
  1279. },
  1280. { "Terratec Cinergy T USB XXS",
  1281. { &dib0700_usb_id_table[33], NULL },
  1282. { NULL },
  1283. },
  1284. },
  1285. .rc_interval = DEFAULT_RC_INTERVAL,
  1286. .rc_key_map = dib0700_rc_keys,
  1287. .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
  1288. .rc_query = dib0700_rc_query
  1289. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  1290. .num_adapters = 2,
  1291. .adapter = {
  1292. {
  1293. .frontend_attach = stk7070pd_frontend_attach0,
  1294. .tuner_attach = dib7070p_tuner_attach,
  1295. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  1296. .size_of_priv = sizeof(struct dib0700_adapter_state),
  1297. }, {
  1298. .frontend_attach = stk7070pd_frontend_attach1,
  1299. .tuner_attach = dib7070p_tuner_attach,
  1300. DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
  1301. .size_of_priv = sizeof(struct dib0700_adapter_state),
  1302. }
  1303. },
  1304. .num_device_descs = 4,
  1305. .devices = {
  1306. { "DiBcom STK7070PD reference design",
  1307. { &dib0700_usb_id_table[17], NULL },
  1308. { NULL },
  1309. },
  1310. { "Pinnacle PCTV Dual DVB-T Diversity Stick",
  1311. { &dib0700_usb_id_table[18], NULL },
  1312. { NULL },
  1313. },
  1314. { "Hauppauge Nova-TD Stick (52009)",
  1315. { &dib0700_usb_id_table[35], NULL },
  1316. { NULL },
  1317. },
  1318. { "Hauppauge Nova-TD-500 (84xxx)",
  1319. { &dib0700_usb_id_table[36], NULL },
  1320. { NULL },
  1321. }
  1322. }
  1323. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  1324. .num_adapters = 1,
  1325. .adapter = {
  1326. {
  1327. .frontend_attach = stk7700ph_frontend_attach,
  1328. .tuner_attach = stk7700ph_tuner_attach,
  1329. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  1330. .size_of_priv = sizeof(struct
  1331. dib0700_adapter_state),
  1332. },
  1333. },
  1334. .num_device_descs = 5,
  1335. .devices = {
  1336. { "Terratec Cinergy HT USB XE",
  1337. { &dib0700_usb_id_table[27], NULL },
  1338. { NULL },
  1339. },
  1340. { "Pinnacle Expresscard 320cx",
  1341. { &dib0700_usb_id_table[28], NULL },
  1342. { NULL },
  1343. },
  1344. { "Terratec Cinergy HT Express",
  1345. { &dib0700_usb_id_table[32], NULL },
  1346. { NULL },
  1347. },
  1348. { "Gigabyte U8000-RH",
  1349. { &dib0700_usb_id_table[37], NULL },
  1350. { NULL },
  1351. },
  1352. { "YUAN High-Tech STK7700PH",
  1353. { &dib0700_usb_id_table[38], NULL },
  1354. { NULL },
  1355. },
  1356. { "Asus My Cinema-U3000Hybrid",
  1357. { &dib0700_usb_id_table[39], NULL },
  1358. { NULL },
  1359. },
  1360. },
  1361. .rc_interval = DEFAULT_RC_INTERVAL,
  1362. .rc_key_map = dib0700_rc_keys,
  1363. .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
  1364. .rc_query = dib0700_rc_query
  1365. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  1366. .num_adapters = 1,
  1367. .adapter = {
  1368. {
  1369. .frontend_attach = s5h1411_frontend_attach,
  1370. .tuner_attach = xc5000_tuner_attach,
  1371. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  1372. .size_of_priv = sizeof(struct
  1373. dib0700_adapter_state),
  1374. },
  1375. },
  1376. .num_device_descs = 2,
  1377. .devices = {
  1378. { "Pinnacle PCTV HD Pro USB Stick",
  1379. { &dib0700_usb_id_table[40], NULL },
  1380. { NULL },
  1381. },
  1382. { "Pinnacle PCTV HD USB Stick",
  1383. { &dib0700_usb_id_table[41], NULL },
  1384. { NULL },
  1385. },
  1386. },
  1387. .rc_interval = DEFAULT_RC_INTERVAL,
  1388. .rc_key_map = dib0700_rc_keys,
  1389. .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
  1390. .rc_query = dib0700_rc_query
  1391. },
  1392. };
  1393. int dib0700_device_count = ARRAY_SIZE(dib0700_devices);