dib0700_devices.c 108 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039
  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-9 DiBcom, SA et al
  8. */
  9. #include "dib0700.h"
  10. #include "dib3000mc.h"
  11. #include "dib7000m.h"
  12. #include "dib7000p.h"
  13. #include "dib8000.h"
  14. #include "dib9000.h"
  15. #include "mt2060.h"
  16. #include "mt2266.h"
  17. #include "tuner-xc2028.h"
  18. #include "xc5000.h"
  19. #include "xc4000.h"
  20. #include "s5h1411.h"
  21. #include "dib0070.h"
  22. #include "dib0090.h"
  23. #include "lgdt3305.h"
  24. #include "mxl5007t.h"
  25. static int force_lna_activation;
  26. module_param(force_lna_activation, int, 0644);
  27. MODULE_PARM_DESC(force_lna_activation, "force the activation of Low-Noise-Amplifyer(s) (LNA), "
  28. "if applicable for the device (default: 0=automatic/off).");
  29. struct dib0700_adapter_state {
  30. int (*set_param_save) (struct dvb_frontend *, struct dvb_frontend_parameters *);
  31. const struct firmware *frontend_firmware;
  32. };
  33. /* Hauppauge Nova-T 500 (aka Bristol)
  34. * has a LNA on GPIO0 which is enabled by setting 1 */
  35. static struct mt2060_config bristol_mt2060_config[2] = {
  36. {
  37. .i2c_address = 0x60,
  38. .clock_out = 3,
  39. }, {
  40. .i2c_address = 0x61,
  41. }
  42. };
  43. static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config = {
  44. .band_caps = BAND_VHF | BAND_UHF,
  45. .setup = (1 << 8) | (5 << 5) | (0 << 4) | (0 << 3) | (0 << 2) | (2 << 0),
  46. .agc1_max = 42598,
  47. .agc1_min = 17694,
  48. .agc2_max = 45875,
  49. .agc2_min = 0,
  50. .agc1_pt1 = 0,
  51. .agc1_pt2 = 59,
  52. .agc1_slope1 = 0,
  53. .agc1_slope2 = 69,
  54. .agc2_pt1 = 0,
  55. .agc2_pt2 = 59,
  56. .agc2_slope1 = 111,
  57. .agc2_slope2 = 28,
  58. };
  59. static struct dib3000mc_config bristol_dib3000mc_config[2] = {
  60. { .agc = &bristol_dib3000p_mt2060_agc_config,
  61. .max_time = 0x196,
  62. .ln_adc_level = 0x1cc7,
  63. .output_mpeg2_in_188_bytes = 1,
  64. },
  65. { .agc = &bristol_dib3000p_mt2060_agc_config,
  66. .max_time = 0x196,
  67. .ln_adc_level = 0x1cc7,
  68. .output_mpeg2_in_188_bytes = 1,
  69. }
  70. };
  71. static int bristol_frontend_attach(struct dvb_usb_adapter *adap)
  72. {
  73. struct dib0700_state *st = adap->dev->priv;
  74. if (adap->id == 0) {
  75. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
  76. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
  77. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
  78. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10);
  79. if (force_lna_activation)
  80. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  81. else
  82. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
  83. if (dib3000mc_i2c_enumeration(&adap->dev->i2c_adap, 2, DEFAULT_DIB3000P_I2C_ADDRESS, bristol_dib3000mc_config) != 0) {
  84. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
  85. return -ENODEV;
  86. }
  87. }
  88. st->mt2060_if1[adap->id] = 1220;
  89. return (adap->fe_adap[0].fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap,
  90. (10 + adap->id) << 1, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0;
  91. }
  92. static int eeprom_read(struct i2c_adapter *adap,u8 adrs,u8 *pval)
  93. {
  94. struct i2c_msg msg[2] = {
  95. { .addr = 0x50, .flags = 0, .buf = &adrs, .len = 1 },
  96. { .addr = 0x50, .flags = I2C_M_RD, .buf = pval, .len = 1 },
  97. };
  98. if (i2c_transfer(adap, msg, 2) != 2) return -EREMOTEIO;
  99. return 0;
  100. }
  101. static int bristol_tuner_attach(struct dvb_usb_adapter *adap)
  102. {
  103. struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
  104. struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe_adap[0].fe, 1);
  105. s8 a;
  106. int if1=1220;
  107. if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
  108. adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_500_2)) {
  109. if (!eeprom_read(prim_i2c,0x59 + adap->id,&a)) if1=1220+a;
  110. }
  111. return dvb_attach(mt2060_attach, adap->fe_adap[0].fe, tun_i2c,
  112. &bristol_mt2060_config[adap->id], if1) == NULL ?
  113. -ENODEV : 0;
  114. }
  115. /* STK7700D: Pinnacle/Terratec/Hauppauge Dual DVB-T Diversity */
  116. /* MT226x */
  117. static struct dibx000_agc_config stk7700d_7000p_mt2266_agc_config[2] = {
  118. {
  119. BAND_UHF,
  120. /* 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,
  121. * 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 */
  122. (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8)
  123. | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
  124. 1130,
  125. 21,
  126. 0,
  127. 118,
  128. 0,
  129. 3530,
  130. 1,
  131. 0,
  132. 65535,
  133. 33770,
  134. 65535,
  135. 23592,
  136. 0,
  137. 62,
  138. 255,
  139. 64,
  140. 64,
  141. 132,
  142. 192,
  143. 80,
  144. 80,
  145. 17,
  146. 27,
  147. 23,
  148. 51,
  149. 1,
  150. }, {
  151. BAND_VHF | BAND_LBAND,
  152. /* 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,
  153. * 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 */
  154. (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8)
  155. | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
  156. 2372,
  157. 21,
  158. 0,
  159. 118,
  160. 0,
  161. 3530,
  162. 1,
  163. 0,
  164. 65535,
  165. 0,
  166. 65535,
  167. 23592,
  168. 0,
  169. 128,
  170. 128,
  171. 128,
  172. 0,
  173. 128,
  174. 253,
  175. 81,
  176. 0,
  177. 17,
  178. 27,
  179. 23,
  180. 51,
  181. 1,
  182. }
  183. };
  184. static struct dibx000_bandwidth_config stk7700d_mt2266_pll_config = {
  185. 60000, 30000,
  186. 1, 8, 3, 1, 0,
  187. 0, 0, 1, 1, 2,
  188. (3 << 14) | (1 << 12) | (524 << 0),
  189. 0,
  190. 20452225,
  191. };
  192. static struct dib7000p_config stk7700d_dib7000p_mt2266_config[] = {
  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. { .output_mpeg2_in_188_bytes = 1,
  204. .hostbus_diversity = 1,
  205. .tuner_is_baseband = 1,
  206. .agc_config_count = 2,
  207. .agc = stk7700d_7000p_mt2266_agc_config,
  208. .bw = &stk7700d_mt2266_pll_config,
  209. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  210. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  211. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  212. }
  213. };
  214. static struct mt2266_config stk7700d_mt2266_config[2] = {
  215. { .i2c_address = 0x60
  216. },
  217. { .i2c_address = 0x60
  218. }
  219. };
  220. static int stk7700P2_frontend_attach(struct dvb_usb_adapter *adap)
  221. {
  222. if (adap->id == 0) {
  223. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  224. msleep(10);
  225. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  226. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  227. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  228. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  229. msleep(10);
  230. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  231. msleep(10);
  232. if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
  233. stk7700d_dib7000p_mt2266_config)
  234. != 0) {
  235. err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
  236. return -ENODEV;
  237. }
  238. }
  239. adap->fe_adap[0].fe =
  240. dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,
  241. 0x80 + (adap->id << 1),
  242. &stk7700d_dib7000p_mt2266_config[adap->id]);
  243. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  244. }
  245. static int stk7700d_frontend_attach(struct dvb_usb_adapter *adap)
  246. {
  247. if (adap->id == 0) {
  248. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  249. msleep(10);
  250. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  251. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  252. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  253. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  254. msleep(10);
  255. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  256. msleep(10);
  257. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  258. if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
  259. stk7700d_dib7000p_mt2266_config)
  260. != 0) {
  261. err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
  262. return -ENODEV;
  263. }
  264. }
  265. adap->fe_adap[0].fe =
  266. dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,
  267. 0x80 + (adap->id << 1),
  268. &stk7700d_dib7000p_mt2266_config[adap->id]);
  269. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  270. }
  271. static int stk7700d_tuner_attach(struct dvb_usb_adapter *adap)
  272. {
  273. struct i2c_adapter *tun_i2c;
  274. tun_i2c = dib7000p_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
  275. return dvb_attach(mt2266_attach, adap->fe_adap[0].fe, tun_i2c,
  276. &stk7700d_mt2266_config[adap->id]) == NULL ? -ENODEV : 0;
  277. }
  278. /* STK7700-PH: Digital/Analog Hybrid Tuner, e.h. Cinergy HT USB HE */
  279. static struct dibx000_agc_config xc3028_agc_config = {
  280. BAND_VHF | BAND_UHF, /* band_caps */
  281. /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0,
  282. * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
  283. * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
  284. (0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 << 8) |
  285. (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), /* setup */
  286. 712, /* inv_gain */
  287. 21, /* time_stabiliz */
  288. 0, /* alpha_level */
  289. 118, /* thlock */
  290. 0, /* wbd_inv */
  291. 2867, /* wbd_ref */
  292. 0, /* wbd_sel */
  293. 2, /* wbd_alpha */
  294. 0, /* agc1_max */
  295. 0, /* agc1_min */
  296. 39718, /* agc2_max */
  297. 9930, /* agc2_min */
  298. 0, /* agc1_pt1 */
  299. 0, /* agc1_pt2 */
  300. 0, /* agc1_pt3 */
  301. 0, /* agc1_slope1 */
  302. 0, /* agc1_slope2 */
  303. 0, /* agc2_pt1 */
  304. 128, /* agc2_pt2 */
  305. 29, /* agc2_slope1 */
  306. 29, /* agc2_slope2 */
  307. 17, /* alpha_mant */
  308. 27, /* alpha_exp */
  309. 23, /* beta_mant */
  310. 51, /* beta_exp */
  311. 1, /* perform_agc_softsplit */
  312. };
  313. /* PLL Configuration for COFDM BW_MHz = 8.00 with external clock = 30.00 */
  314. static struct dibx000_bandwidth_config xc3028_bw_config = {
  315. 60000, 30000, /* internal, sampling */
  316. 1, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */
  317. 0, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc,
  318. modulo */
  319. (3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */
  320. (1 << 25) | 5816102, /* ifreq = 5.200000 MHz */
  321. 20452225, /* timf */
  322. 30000000, /* xtal_hz */
  323. };
  324. static struct dib7000p_config stk7700ph_dib7700_xc3028_config = {
  325. .output_mpeg2_in_188_bytes = 1,
  326. .tuner_is_baseband = 1,
  327. .agc_config_count = 1,
  328. .agc = &xc3028_agc_config,
  329. .bw = &xc3028_bw_config,
  330. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  331. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  332. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  333. };
  334. static int stk7700ph_xc3028_callback(void *ptr, int component,
  335. int command, int arg)
  336. {
  337. struct dvb_usb_adapter *adap = ptr;
  338. switch (command) {
  339. case XC2028_TUNER_RESET:
  340. /* Send the tuner in then out of reset */
  341. dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 0); msleep(10);
  342. dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
  343. break;
  344. case XC2028_RESET_CLK:
  345. break;
  346. default:
  347. err("%s: unknown command %d, arg %d\n", __func__,
  348. command, arg);
  349. return -EINVAL;
  350. }
  351. return 0;
  352. }
  353. static struct xc2028_ctrl stk7700ph_xc3028_ctrl = {
  354. .fname = XC2028_DEFAULT_FIRMWARE,
  355. .max_len = 64,
  356. .demod = XC3028_FE_DIBCOM52,
  357. };
  358. static struct xc2028_config stk7700ph_xc3028_config = {
  359. .i2c_addr = 0x61,
  360. .ctrl = &stk7700ph_xc3028_ctrl,
  361. };
  362. static int stk7700ph_frontend_attach(struct dvb_usb_adapter *adap)
  363. {
  364. struct usb_device_descriptor *desc = &adap->dev->udev->descriptor;
  365. if (desc->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
  366. desc->idProduct == cpu_to_le16(USB_PID_PINNACLE_EXPRESSCARD_320CX))
  367. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
  368. else
  369. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  370. msleep(20);
  371. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  372. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  373. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  374. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  375. msleep(10);
  376. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  377. msleep(20);
  378. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  379. msleep(10);
  380. if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
  381. &stk7700ph_dib7700_xc3028_config) != 0) {
  382. err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
  383. __func__);
  384. return -ENODEV;
  385. }
  386. adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
  387. &stk7700ph_dib7700_xc3028_config);
  388. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  389. }
  390. static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap)
  391. {
  392. struct i2c_adapter *tun_i2c;
  393. tun_i2c = dib7000p_get_i2c_master(adap->fe_adap[0].fe,
  394. DIBX000_I2C_INTERFACE_TUNER, 1);
  395. stk7700ph_xc3028_config.i2c_adap = tun_i2c;
  396. /* FIXME: generalize & move to common area */
  397. adap->fe_adap[0].fe->callback = stk7700ph_xc3028_callback;
  398. return dvb_attach(xc2028_attach, adap->fe_adap[0].fe, &stk7700ph_xc3028_config)
  399. == NULL ? -ENODEV : 0;
  400. }
  401. #define DEFAULT_RC_INTERVAL 50
  402. static u8 rc_request[] = { REQUEST_POLL_RC, 0 };
  403. /* Number of keypresses to ignore before start repeating */
  404. #define RC_REPEAT_DELAY 6
  405. /*
  406. * This function is used only when firmware is < 1.20 version. Newer
  407. * firmwares use bulk mode, with functions implemented at dib0700_core,
  408. * at dib0700_rc_urb_completion()
  409. */
  410. static int dib0700_rc_query_old_firmware(struct dvb_usb_device *d)
  411. {
  412. u8 key[4];
  413. u32 keycode;
  414. u8 toggle;
  415. int i;
  416. struct dib0700_state *st = d->priv;
  417. if (st->fw_version >= 0x10200) {
  418. /* For 1.20 firmware , We need to keep the RC polling
  419. callback so we can reuse the input device setup in
  420. dvb-usb-remote.c. However, the actual work is being done
  421. in the bulk URB completion handler. */
  422. return 0;
  423. }
  424. i = dib0700_ctrl_rd(d, rc_request, 2, key, 4);
  425. if (i <= 0) {
  426. err("RC Query Failed");
  427. return -1;
  428. }
  429. /* losing half of KEY_0 events from Philipps rc5 remotes.. */
  430. if (key[0] == 0 && key[1] == 0 && key[2] == 0 && key[3] == 0)
  431. return 0;
  432. /* 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]); */
  433. dib0700_rc_setup(d); /* reset ir sensor data to prevent false events */
  434. d->last_event = 0;
  435. switch (d->props.rc.core.protocol) {
  436. case RC_TYPE_NEC:
  437. /* NEC protocol sends repeat code as 0 0 0 FF */
  438. if ((key[3-2] == 0x00) && (key[3-3] == 0x00) &&
  439. (key[3] == 0xff))
  440. keycode = d->last_event;
  441. else {
  442. keycode = key[3-2] << 8 | key[3-3];
  443. d->last_event = keycode;
  444. }
  445. rc_keydown(d->rc_dev, keycode, 0);
  446. break;
  447. default:
  448. /* RC-5 protocol changes toggle bit on new keypress */
  449. keycode = key[3-2] << 8 | key[3-3];
  450. toggle = key[3-1];
  451. rc_keydown(d->rc_dev, keycode, toggle);
  452. break;
  453. }
  454. return 0;
  455. }
  456. /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
  457. static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = {
  458. BAND_UHF | BAND_VHF,
  459. /* 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,
  460. * 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 */
  461. (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
  462. | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
  463. 712,
  464. 41,
  465. 0,
  466. 118,
  467. 0,
  468. 4095,
  469. 0,
  470. 0,
  471. 42598,
  472. 17694,
  473. 45875,
  474. 2621,
  475. 0,
  476. 76,
  477. 139,
  478. 52,
  479. 59,
  480. 107,
  481. 172,
  482. 57,
  483. 70,
  484. 21,
  485. 25,
  486. 28,
  487. 48,
  488. 1,
  489. { 0,
  490. 107,
  491. 51800,
  492. 24700
  493. },
  494. };
  495. static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config = {
  496. BAND_UHF | BAND_VHF,
  497. /* 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,
  498. * 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 */
  499. (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
  500. | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
  501. 712,
  502. 41,
  503. 0,
  504. 118,
  505. 0,
  506. 4095,
  507. 0,
  508. 0,
  509. 42598,
  510. 16384,
  511. 42598,
  512. 0,
  513. 0,
  514. 137,
  515. 255,
  516. 0,
  517. 255,
  518. 0,
  519. 0,
  520. 0,
  521. 41,
  522. 15,
  523. 25,
  524. 28,
  525. 48,
  526. 0,
  527. };
  528. static struct dibx000_bandwidth_config stk7700p_pll_config = {
  529. 60000, 30000,
  530. 1, 8, 3, 1, 0,
  531. 0, 0, 1, 1, 0,
  532. (3 << 14) | (1 << 12) | (524 << 0),
  533. 60258167,
  534. 20452225,
  535. 30000000,
  536. };
  537. static struct dib7000m_config stk7700p_dib7000m_config = {
  538. .dvbt_mode = 1,
  539. .output_mpeg2_in_188_bytes = 1,
  540. .quartz_direct = 1,
  541. .agc_config_count = 1,
  542. .agc = &stk7700p_7000m_mt2060_agc_config,
  543. .bw = &stk7700p_pll_config,
  544. .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
  545. .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
  546. .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
  547. };
  548. static struct dib7000p_config stk7700p_dib7000p_config = {
  549. .output_mpeg2_in_188_bytes = 1,
  550. .agc_config_count = 1,
  551. .agc = &stk7700p_7000p_mt2060_agc_config,
  552. .bw = &stk7700p_pll_config,
  553. .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
  554. .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
  555. .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
  556. };
  557. static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap)
  558. {
  559. struct dib0700_state *st = adap->dev->priv;
  560. /* unless there is no real power management in DVB - we leave the device on GPIO6 */
  561. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  562. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(50);
  563. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
  564. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  565. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
  566. dib0700_ctrl_clock(adap->dev, 72, 1);
  567. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100);
  568. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  569. st->mt2060_if1[0] = 1220;
  570. if (dib7000pc_detection(&adap->dev->i2c_adap)) {
  571. adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config);
  572. st->is_dib7000pc = 1;
  573. } else
  574. adap->fe_adap[0].fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config);
  575. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  576. }
  577. static struct mt2060_config stk7700p_mt2060_config = {
  578. 0x60
  579. };
  580. static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
  581. {
  582. struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
  583. struct dib0700_state *st = adap->dev->priv;
  584. struct i2c_adapter *tun_i2c;
  585. s8 a;
  586. int if1=1220;
  587. if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
  588. adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK)) {
  589. if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a;
  590. }
  591. if (st->is_dib7000pc)
  592. tun_i2c = dib7000p_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
  593. else
  594. tun_i2c = dib7000m_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
  595. return dvb_attach(mt2060_attach, adap->fe_adap[0].fe, tun_i2c, &stk7700p_mt2060_config,
  596. if1) == NULL ? -ENODEV : 0;
  597. }
  598. /* DIB7070 generic */
  599. static struct dibx000_agc_config dib7070_agc_config = {
  600. BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
  601. /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
  602. * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
  603. (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
  604. | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
  605. 600,
  606. 10,
  607. 0,
  608. 118,
  609. 0,
  610. 3530,
  611. 1,
  612. 5,
  613. 65535,
  614. 0,
  615. 65535,
  616. 0,
  617. 0,
  618. 40,
  619. 183,
  620. 206,
  621. 255,
  622. 72,
  623. 152,
  624. 88,
  625. 90,
  626. 17,
  627. 27,
  628. 23,
  629. 51,
  630. 0,
  631. };
  632. static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
  633. {
  634. deb_info("reset: %d", onoff);
  635. return dib7000p_set_gpio(fe, 8, 0, !onoff);
  636. }
  637. static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
  638. {
  639. deb_info("sleep: %d", onoff);
  640. return dib7000p_set_gpio(fe, 9, 0, onoff);
  641. }
  642. static struct dib0070_config dib7070p_dib0070_config[2] = {
  643. {
  644. .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
  645. .reset = dib7070_tuner_reset,
  646. .sleep = dib7070_tuner_sleep,
  647. .clock_khz = 12000,
  648. .clock_pad_drive = 4,
  649. .charge_pump = 2,
  650. }, {
  651. .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
  652. .reset = dib7070_tuner_reset,
  653. .sleep = dib7070_tuner_sleep,
  654. .clock_khz = 12000,
  655. .charge_pump = 2,
  656. }
  657. };
  658. static struct dib0070_config dib7770p_dib0070_config = {
  659. .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
  660. .reset = dib7070_tuner_reset,
  661. .sleep = dib7070_tuner_sleep,
  662. .clock_khz = 12000,
  663. .clock_pad_drive = 0,
  664. .flip_chip = 1,
  665. .charge_pump = 2,
  666. };
  667. static int dib7070_set_param_override(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
  668. {
  669. struct dvb_usb_adapter *adap = fe->dvb->priv;
  670. struct dib0700_adapter_state *state = adap->priv;
  671. u16 offset;
  672. u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
  673. switch (band) {
  674. case BAND_VHF: offset = 950; break;
  675. case BAND_UHF:
  676. default: offset = 550; break;
  677. }
  678. deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
  679. dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
  680. return state->set_param_save(fe, fep);
  681. }
  682. static int dib7770_set_param_override(struct dvb_frontend *fe,
  683. struct dvb_frontend_parameters *fep)
  684. {
  685. struct dvb_usb_adapter *adap = fe->dvb->priv;
  686. struct dib0700_adapter_state *state = adap->priv;
  687. u16 offset;
  688. u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
  689. switch (band) {
  690. case BAND_VHF:
  691. dib7000p_set_gpio(fe, 0, 0, 1);
  692. offset = 850;
  693. break;
  694. case BAND_UHF:
  695. default:
  696. dib7000p_set_gpio(fe, 0, 0, 0);
  697. offset = 250;
  698. break;
  699. }
  700. deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
  701. dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
  702. return state->set_param_save(fe, fep);
  703. }
  704. static int dib7770p_tuner_attach(struct dvb_usb_adapter *adap)
  705. {
  706. struct dib0700_adapter_state *st = adap->priv;
  707. struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe_adap[0].fe,
  708. DIBX000_I2C_INTERFACE_TUNER, 1);
  709. if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c,
  710. &dib7770p_dib0070_config) == NULL)
  711. return -ENODEV;
  712. st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
  713. adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7770_set_param_override;
  714. return 0;
  715. }
  716. static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap)
  717. {
  718. struct dib0700_adapter_state *st = adap->priv;
  719. struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
  720. if (adap->id == 0) {
  721. if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL)
  722. return -ENODEV;
  723. } else {
  724. if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL)
  725. return -ENODEV;
  726. }
  727. st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
  728. adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7070_set_param_override;
  729. return 0;
  730. }
  731. static int stk7700p_pid_filter(struct dvb_usb_adapter *adapter, int index,
  732. u16 pid, int onoff)
  733. {
  734. struct dib0700_state *st = adapter->dev->priv;
  735. if (st->is_dib7000pc)
  736. return dib7000p_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
  737. return dib7000m_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
  738. }
  739. static int stk7700p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
  740. {
  741. struct dib0700_state *st = adapter->dev->priv;
  742. if (st->is_dib7000pc)
  743. return dib7000p_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
  744. return dib7000m_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
  745. }
  746. static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
  747. {
  748. return dib7000p_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
  749. }
  750. static int stk70x0p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
  751. {
  752. return dib7000p_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
  753. }
  754. static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
  755. 60000, 15000,
  756. 1, 20, 3, 1, 0,
  757. 0, 0, 1, 1, 2,
  758. (3 << 14) | (1 << 12) | (524 << 0),
  759. (0 << 25) | 0,
  760. 20452225,
  761. 12000000,
  762. };
  763. static struct dib7000p_config dib7070p_dib7000p_config = {
  764. .output_mpeg2_in_188_bytes = 1,
  765. .agc_config_count = 1,
  766. .agc = &dib7070_agc_config,
  767. .bw = &dib7070_bw_config_12_mhz,
  768. .tuner_is_baseband = 1,
  769. .spur_protect = 1,
  770. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  771. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  772. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  773. .hostbus_diversity = 1,
  774. };
  775. /* STK7070P */
  776. static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)
  777. {
  778. struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
  779. if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
  780. p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
  781. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
  782. else
  783. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  784. msleep(10);
  785. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  786. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  787. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  788. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  789. dib0700_ctrl_clock(adap->dev, 72, 1);
  790. msleep(10);
  791. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  792. msleep(10);
  793. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  794. if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
  795. &dib7070p_dib7000p_config) != 0) {
  796. err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
  797. __func__);
  798. return -ENODEV;
  799. }
  800. adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
  801. &dib7070p_dib7000p_config);
  802. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  803. }
  804. /* STK7770P */
  805. static struct dib7000p_config dib7770p_dib7000p_config = {
  806. .output_mpeg2_in_188_bytes = 1,
  807. .agc_config_count = 1,
  808. .agc = &dib7070_agc_config,
  809. .bw = &dib7070_bw_config_12_mhz,
  810. .tuner_is_baseband = 1,
  811. .spur_protect = 1,
  812. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  813. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  814. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  815. .hostbus_diversity = 1,
  816. .enable_current_mirror = 1,
  817. .disable_sample_and_hold = 0,
  818. };
  819. static int stk7770p_frontend_attach(struct dvb_usb_adapter *adap)
  820. {
  821. struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
  822. if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
  823. p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
  824. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
  825. else
  826. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  827. msleep(10);
  828. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  829. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  830. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  831. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  832. dib0700_ctrl_clock(adap->dev, 72, 1);
  833. msleep(10);
  834. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  835. msleep(10);
  836. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  837. if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
  838. &dib7770p_dib7000p_config) != 0) {
  839. err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
  840. __func__);
  841. return -ENODEV;
  842. }
  843. adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
  844. &dib7770p_dib7000p_config);
  845. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  846. }
  847. /* DIB807x generic */
  848. static struct dibx000_agc_config dib807x_agc_config[2] = {
  849. {
  850. BAND_VHF,
  851. /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
  852. * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
  853. * P_agc_inv_pwm2=0,P_agc_inh_dc_rv_est=0,
  854. * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
  855. * P_agc_write=0 */
  856. (0 << 15) | (0 << 14) | (7 << 11) | (0 << 10) | (0 << 9) |
  857. (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
  858. (0 << 0), /* setup*/
  859. 600, /* inv_gain*/
  860. 10, /* time_stabiliz*/
  861. 0, /* alpha_level*/
  862. 118, /* thlock*/
  863. 0, /* wbd_inv*/
  864. 3530, /* wbd_ref*/
  865. 1, /* wbd_sel*/
  866. 5, /* wbd_alpha*/
  867. 65535, /* agc1_max*/
  868. 0, /* agc1_min*/
  869. 65535, /* agc2_max*/
  870. 0, /* agc2_min*/
  871. 0, /* agc1_pt1*/
  872. 40, /* agc1_pt2*/
  873. 183, /* agc1_pt3*/
  874. 206, /* agc1_slope1*/
  875. 255, /* agc1_slope2*/
  876. 72, /* agc2_pt1*/
  877. 152, /* agc2_pt2*/
  878. 88, /* agc2_slope1*/
  879. 90, /* agc2_slope2*/
  880. 17, /* alpha_mant*/
  881. 27, /* alpha_exp*/
  882. 23, /* beta_mant*/
  883. 51, /* beta_exp*/
  884. 0, /* perform_agc_softsplit*/
  885. }, {
  886. BAND_UHF,
  887. /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
  888. * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
  889. * P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
  890. * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
  891. * P_agc_write=0 */
  892. (0 << 15) | (0 << 14) | (1 << 11) | (0 << 10) | (0 << 9) |
  893. (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
  894. (0 << 0), /* setup */
  895. 600, /* inv_gain*/
  896. 10, /* time_stabiliz*/
  897. 0, /* alpha_level*/
  898. 118, /* thlock*/
  899. 0, /* wbd_inv*/
  900. 3530, /* wbd_ref*/
  901. 1, /* wbd_sel*/
  902. 5, /* wbd_alpha*/
  903. 65535, /* agc1_max*/
  904. 0, /* agc1_min*/
  905. 65535, /* agc2_max*/
  906. 0, /* agc2_min*/
  907. 0, /* agc1_pt1*/
  908. 40, /* agc1_pt2*/
  909. 183, /* agc1_pt3*/
  910. 206, /* agc1_slope1*/
  911. 255, /* agc1_slope2*/
  912. 72, /* agc2_pt1*/
  913. 152, /* agc2_pt2*/
  914. 88, /* agc2_slope1*/
  915. 90, /* agc2_slope2*/
  916. 17, /* alpha_mant*/
  917. 27, /* alpha_exp*/
  918. 23, /* beta_mant*/
  919. 51, /* beta_exp*/
  920. 0, /* perform_agc_softsplit*/
  921. }
  922. };
  923. static struct dibx000_bandwidth_config dib807x_bw_config_12_mhz = {
  924. 60000, 15000, /* internal, sampling*/
  925. 1, 20, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass*/
  926. 0, 0, 1, 1, 2, /* misc: refdiv, bypclk_div, IO_CLK_en_core,
  927. ADClkSrc, modulo */
  928. (3 << 14) | (1 << 12) | (599 << 0), /* sad_cfg: refsel, sel, freq_15k*/
  929. (0 << 25) | 0, /* ifreq = 0.000000 MHz*/
  930. 18179755, /* timf*/
  931. 12000000, /* xtal_hz*/
  932. };
  933. static struct dib8000_config dib807x_dib8000_config[2] = {
  934. {
  935. .output_mpeg2_in_188_bytes = 1,
  936. .agc_config_count = 2,
  937. .agc = dib807x_agc_config,
  938. .pll = &dib807x_bw_config_12_mhz,
  939. .tuner_is_baseband = 1,
  940. .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
  941. .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
  942. .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
  943. .hostbus_diversity = 1,
  944. .div_cfg = 1,
  945. .agc_control = &dib0070_ctrl_agc_filter,
  946. .output_mode = OUTMODE_MPEG2_FIFO,
  947. .drives = 0x2d98,
  948. }, {
  949. .output_mpeg2_in_188_bytes = 1,
  950. .agc_config_count = 2,
  951. .agc = dib807x_agc_config,
  952. .pll = &dib807x_bw_config_12_mhz,
  953. .tuner_is_baseband = 1,
  954. .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
  955. .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
  956. .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
  957. .hostbus_diversity = 1,
  958. .agc_control = &dib0070_ctrl_agc_filter,
  959. .output_mode = OUTMODE_MPEG2_FIFO,
  960. .drives = 0x2d98,
  961. }
  962. };
  963. static int dib80xx_tuner_reset(struct dvb_frontend *fe, int onoff)
  964. {
  965. return dib8000_set_gpio(fe, 5, 0, !onoff);
  966. }
  967. static int dib80xx_tuner_sleep(struct dvb_frontend *fe, int onoff)
  968. {
  969. return dib8000_set_gpio(fe, 0, 0, onoff);
  970. }
  971. static const struct dib0070_wbd_gain_cfg dib8070_wbd_gain_cfg[] = {
  972. { 240, 7},
  973. { 0xffff, 6},
  974. };
  975. static struct dib0070_config dib807x_dib0070_config[2] = {
  976. {
  977. .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
  978. .reset = dib80xx_tuner_reset,
  979. .sleep = dib80xx_tuner_sleep,
  980. .clock_khz = 12000,
  981. .clock_pad_drive = 4,
  982. .vga_filter = 1,
  983. .force_crystal_mode = 1,
  984. .enable_third_order_filter = 1,
  985. .charge_pump = 0,
  986. .wbd_gain = dib8070_wbd_gain_cfg,
  987. .osc_buffer_state = 0,
  988. .freq_offset_khz_uhf = -100,
  989. .freq_offset_khz_vhf = -100,
  990. }, {
  991. .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
  992. .reset = dib80xx_tuner_reset,
  993. .sleep = dib80xx_tuner_sleep,
  994. .clock_khz = 12000,
  995. .clock_pad_drive = 2,
  996. .vga_filter = 1,
  997. .force_crystal_mode = 1,
  998. .enable_third_order_filter = 1,
  999. .charge_pump = 0,
  1000. .wbd_gain = dib8070_wbd_gain_cfg,
  1001. .osc_buffer_state = 0,
  1002. .freq_offset_khz_uhf = -25,
  1003. .freq_offset_khz_vhf = -25,
  1004. }
  1005. };
  1006. static int dib807x_set_param_override(struct dvb_frontend *fe,
  1007. struct dvb_frontend_parameters *fep)
  1008. {
  1009. struct dvb_usb_adapter *adap = fe->dvb->priv;
  1010. struct dib0700_adapter_state *state = adap->priv;
  1011. u16 offset = dib0070_wbd_offset(fe);
  1012. u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
  1013. switch (band) {
  1014. case BAND_VHF:
  1015. offset += 750;
  1016. break;
  1017. case BAND_UHF: /* fall-thru wanted */
  1018. default:
  1019. offset += 250; break;
  1020. }
  1021. deb_info("WBD for DiB8000: %d\n", offset);
  1022. dib8000_set_wbd_ref(fe, offset);
  1023. return state->set_param_save(fe, fep);
  1024. }
  1025. static int dib807x_tuner_attach(struct dvb_usb_adapter *adap)
  1026. {
  1027. struct dib0700_adapter_state *st = adap->priv;
  1028. struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe_adap[0].fe,
  1029. DIBX000_I2C_INTERFACE_TUNER, 1);
  1030. if (adap->id == 0) {
  1031. if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c,
  1032. &dib807x_dib0070_config[0]) == NULL)
  1033. return -ENODEV;
  1034. } else {
  1035. if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c,
  1036. &dib807x_dib0070_config[1]) == NULL)
  1037. return -ENODEV;
  1038. }
  1039. st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
  1040. adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib807x_set_param_override;
  1041. return 0;
  1042. }
  1043. static int stk80xx_pid_filter(struct dvb_usb_adapter *adapter, int index,
  1044. u16 pid, int onoff)
  1045. {
  1046. return dib8000_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
  1047. }
  1048. static int stk80xx_pid_filter_ctrl(struct dvb_usb_adapter *adapter,
  1049. int onoff)
  1050. {
  1051. return dib8000_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
  1052. }
  1053. /* STK807x */
  1054. static int stk807x_frontend_attach(struct dvb_usb_adapter *adap)
  1055. {
  1056. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  1057. msleep(10);
  1058. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  1059. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  1060. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  1061. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  1062. dib0700_ctrl_clock(adap->dev, 72, 1);
  1063. msleep(10);
  1064. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  1065. msleep(10);
  1066. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  1067. dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
  1068. 0x80);
  1069. adap->fe_adap[0].fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
  1070. &dib807x_dib8000_config[0]);
  1071. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  1072. }
  1073. /* STK807xPVR */
  1074. static int stk807xpvr_frontend_attach0(struct dvb_usb_adapter *adap)
  1075. {
  1076. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
  1077. msleep(30);
  1078. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  1079. msleep(500);
  1080. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  1081. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  1082. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  1083. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  1084. dib0700_ctrl_clock(adap->dev, 72, 1);
  1085. msleep(10);
  1086. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  1087. msleep(10);
  1088. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  1089. /* initialize IC 0 */
  1090. dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x22, 0x80);
  1091. adap->fe_adap[0].fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
  1092. &dib807x_dib8000_config[0]);
  1093. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  1094. }
  1095. static int stk807xpvr_frontend_attach1(struct dvb_usb_adapter *adap)
  1096. {
  1097. /* initialize IC 1 */
  1098. dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x12, 0x82);
  1099. adap->fe_adap[0].fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x82,
  1100. &dib807x_dib8000_config[1]);
  1101. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  1102. }
  1103. /* STK8096GP */
  1104. struct dibx000_agc_config dib8090_agc_config[2] = {
  1105. {
  1106. BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
  1107. /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
  1108. * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
  1109. * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
  1110. (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
  1111. | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
  1112. 787,
  1113. 10,
  1114. 0,
  1115. 118,
  1116. 0,
  1117. 3530,
  1118. 1,
  1119. 5,
  1120. 65535,
  1121. 0,
  1122. 65535,
  1123. 0,
  1124. 0,
  1125. 32,
  1126. 114,
  1127. 143,
  1128. 144,
  1129. 114,
  1130. 227,
  1131. 116,
  1132. 117,
  1133. 28,
  1134. 26,
  1135. 31,
  1136. 51,
  1137. 0,
  1138. },
  1139. {
  1140. BAND_CBAND,
  1141. /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
  1142. * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
  1143. * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
  1144. (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
  1145. | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
  1146. 787,
  1147. 10,
  1148. 0,
  1149. 118,
  1150. 0,
  1151. 3530,
  1152. 1,
  1153. 5,
  1154. 0,
  1155. 0,
  1156. 65535,
  1157. 0,
  1158. 0,
  1159. 32,
  1160. 114,
  1161. 143,
  1162. 144,
  1163. 114,
  1164. 227,
  1165. 116,
  1166. 117,
  1167. 28,
  1168. 26,
  1169. 31,
  1170. 51,
  1171. 0,
  1172. }
  1173. };
  1174. static struct dibx000_bandwidth_config dib8090_pll_config_12mhz = {
  1175. 54000, 13500,
  1176. 1, 18, 3, 1, 0,
  1177. 0, 0, 1, 1, 2,
  1178. (3 << 14) | (1 << 12) | (599 << 0),
  1179. (0 << 25) | 0,
  1180. 20199727,
  1181. 12000000,
  1182. };
  1183. static int dib8090_get_adc_power(struct dvb_frontend *fe)
  1184. {
  1185. return dib8000_get_adc_power(fe, 1);
  1186. }
  1187. static struct dib8000_config dib809x_dib8000_config[2] = {
  1188. {
  1189. .output_mpeg2_in_188_bytes = 1,
  1190. .agc_config_count = 2,
  1191. .agc = dib8090_agc_config,
  1192. .agc_control = dib0090_dcc_freq,
  1193. .pll = &dib8090_pll_config_12mhz,
  1194. .tuner_is_baseband = 1,
  1195. .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
  1196. .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
  1197. .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
  1198. .hostbus_diversity = 1,
  1199. .div_cfg = 0x31,
  1200. .output_mode = OUTMODE_MPEG2_FIFO,
  1201. .drives = 0x2d98,
  1202. .diversity_delay = 48,
  1203. .refclksel = 3,
  1204. }, {
  1205. .output_mpeg2_in_188_bytes = 1,
  1206. .agc_config_count = 2,
  1207. .agc = dib8090_agc_config,
  1208. .agc_control = dib0090_dcc_freq,
  1209. .pll = &dib8090_pll_config_12mhz,
  1210. .tuner_is_baseband = 1,
  1211. .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
  1212. .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
  1213. .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
  1214. .hostbus_diversity = 1,
  1215. .div_cfg = 0x31,
  1216. .output_mode = OUTMODE_DIVERSITY,
  1217. .drives = 0x2d08,
  1218. .diversity_delay = 1,
  1219. .refclksel = 3,
  1220. }
  1221. };
  1222. static struct dib0090_wbd_slope dib8090_wbd_table[] = {
  1223. /* max freq ; cold slope ; cold offset ; warm slope ; warm offset ; wbd gain */
  1224. { 120, 0, 500, 0, 500, 4 }, /* CBAND */
  1225. { 170, 0, 450, 0, 450, 4 }, /* CBAND */
  1226. { 380, 48, 373, 28, 259, 6 }, /* VHF */
  1227. { 860, 34, 700, 36, 616, 6 }, /* high UHF */
  1228. { 0xFFFF, 34, 700, 36, 616, 6 }, /* default */
  1229. };
  1230. static struct dib0090_config dib809x_dib0090_config = {
  1231. .io.pll_bypass = 1,
  1232. .io.pll_range = 1,
  1233. .io.pll_prediv = 1,
  1234. .io.pll_loopdiv = 20,
  1235. .io.adc_clock_ratio = 8,
  1236. .io.pll_int_loop_filt = 0,
  1237. .io.clock_khz = 12000,
  1238. .reset = dib80xx_tuner_reset,
  1239. .sleep = dib80xx_tuner_sleep,
  1240. .clkouttobamse = 1,
  1241. .analog_output = 1,
  1242. .i2c_address = DEFAULT_DIB0090_I2C_ADDRESS,
  1243. .use_pwm_agc = 1,
  1244. .clkoutdrive = 1,
  1245. .get_adc_power = dib8090_get_adc_power,
  1246. .freq_offset_khz_uhf = -63,
  1247. .freq_offset_khz_vhf = -143,
  1248. .wbd = dib8090_wbd_table,
  1249. .fref_clock_ratio = 6,
  1250. };
  1251. static int dib8096_set_param_override(struct dvb_frontend *fe,
  1252. struct dvb_frontend_parameters *fep)
  1253. {
  1254. struct dvb_usb_adapter *adap = fe->dvb->priv;
  1255. struct dib0700_adapter_state *state = adap->priv;
  1256. u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
  1257. u16 target;
  1258. int ret = 0;
  1259. enum frontend_tune_state tune_state = CT_SHUTDOWN;
  1260. u16 ltgain, rf_gain_limit;
  1261. ret = state->set_param_save(fe, fep);
  1262. if (ret < 0)
  1263. return ret;
  1264. target = (dib0090_get_wbd_offset(fe) * 8 * 18 / 33 + 1) / 2;
  1265. dib8000_set_wbd_ref(fe, target);
  1266. if (band == BAND_CBAND) {
  1267. deb_info("tuning in CBAND - soft-AGC startup\n");
  1268. dib0090_set_tune_state(fe, CT_AGC_START);
  1269. do {
  1270. ret = dib0090_gain_control(fe);
  1271. msleep(ret);
  1272. tune_state = dib0090_get_tune_state(fe);
  1273. if (tune_state == CT_AGC_STEP_0)
  1274. dib8000_set_gpio(fe, 6, 0, 1);
  1275. else if (tune_state == CT_AGC_STEP_1) {
  1276. dib0090_get_current_gain(fe, NULL, NULL, &rf_gain_limit, &ltgain);
  1277. if (rf_gain_limit == 0)
  1278. dib8000_set_gpio(fe, 6, 0, 0);
  1279. }
  1280. } while (tune_state < CT_AGC_STOP);
  1281. dib0090_pwm_gain_reset(fe);
  1282. dib8000_pwm_agc_reset(fe);
  1283. dib8000_set_tune_state(fe, CT_DEMOD_START);
  1284. } else {
  1285. deb_info("not tuning in CBAND - standard AGC startup\n");
  1286. dib0090_pwm_gain_reset(fe);
  1287. }
  1288. return 0;
  1289. }
  1290. static int dib809x_tuner_attach(struct dvb_usb_adapter *adap)
  1291. {
  1292. struct dib0700_adapter_state *st = adap->priv;
  1293. struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
  1294. if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &dib809x_dib0090_config) == NULL)
  1295. return -ENODEV;
  1296. st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
  1297. adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096_set_param_override;
  1298. return 0;
  1299. }
  1300. static int stk809x_frontend_attach(struct dvb_usb_adapter *adap)
  1301. {
  1302. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  1303. msleep(10);
  1304. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  1305. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  1306. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  1307. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  1308. dib0700_ctrl_clock(adap->dev, 72, 1);
  1309. msleep(10);
  1310. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  1311. msleep(10);
  1312. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  1313. dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, 0x80);
  1314. adap->fe_adap[0].fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]);
  1315. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  1316. }
  1317. static int nim8096md_tuner_attach(struct dvb_usb_adapter *adap)
  1318. {
  1319. struct dib0700_adapter_state *st = adap->priv;
  1320. struct i2c_adapter *tun_i2c;
  1321. struct dvb_frontend *fe_slave = dib8000_get_slave_frontend(adap->fe_adap[0].fe, 1);
  1322. if (fe_slave) {
  1323. tun_i2c = dib8000_get_i2c_master(fe_slave, DIBX000_I2C_INTERFACE_TUNER, 1);
  1324. if (dvb_attach(dib0090_register, fe_slave, tun_i2c, &dib809x_dib0090_config) == NULL)
  1325. return -ENODEV;
  1326. fe_slave->dvb = adap->fe_adap[0].fe->dvb;
  1327. fe_slave->ops.tuner_ops.set_params = dib8096_set_param_override;
  1328. }
  1329. tun_i2c = dib8000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
  1330. if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &dib809x_dib0090_config) == NULL)
  1331. return -ENODEV;
  1332. st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
  1333. adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096_set_param_override;
  1334. return 0;
  1335. }
  1336. static int nim8096md_frontend_attach(struct dvb_usb_adapter *adap)
  1337. {
  1338. struct dvb_frontend *fe_slave;
  1339. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
  1340. msleep(20);
  1341. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  1342. msleep(1000);
  1343. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  1344. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  1345. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  1346. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  1347. dib0700_ctrl_clock(adap->dev, 72, 1);
  1348. msleep(20);
  1349. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  1350. msleep(20);
  1351. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  1352. dib8000_i2c_enumeration(&adap->dev->i2c_adap, 2, 18, 0x80);
  1353. adap->fe_adap[0].fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]);
  1354. if (adap->fe_adap[0].fe == NULL)
  1355. return -ENODEV;
  1356. fe_slave = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x82, &dib809x_dib8000_config[1]);
  1357. dib8000_set_slave_frontend(adap->fe_adap[0].fe, fe_slave);
  1358. return fe_slave == NULL ? -ENODEV : 0;
  1359. }
  1360. /* STK9090M */
  1361. static int dib90x0_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
  1362. {
  1363. return dib9000_fw_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
  1364. }
  1365. static int dib90x0_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
  1366. {
  1367. return dib9000_fw_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
  1368. }
  1369. static int dib90x0_tuner_reset(struct dvb_frontend *fe, int onoff)
  1370. {
  1371. return dib9000_set_gpio(fe, 5, 0, !onoff);
  1372. }
  1373. static int dib90x0_tuner_sleep(struct dvb_frontend *fe, int onoff)
  1374. {
  1375. return dib9000_set_gpio(fe, 0, 0, onoff);
  1376. }
  1377. static int dib01x0_pmu_update(struct i2c_adapter *i2c, u16 *data, u8 len)
  1378. {
  1379. u8 wb[4] = { 0xc >> 8, 0xc & 0xff, 0, 0 };
  1380. u8 rb[2];
  1381. struct i2c_msg msg[2] = {
  1382. {.addr = 0x1e >> 1, .flags = 0, .buf = wb, .len = 2},
  1383. {.addr = 0x1e >> 1, .flags = I2C_M_RD, .buf = rb, .len = 2},
  1384. };
  1385. u8 index_data;
  1386. dibx000_i2c_set_speed(i2c, 250);
  1387. if (i2c_transfer(i2c, msg, 2) != 2)
  1388. return -EIO;
  1389. switch (rb[0] << 8 | rb[1]) {
  1390. case 0:
  1391. deb_info("Found DiB0170 rev1: This version of DiB0170 is not supported any longer.\n");
  1392. return -EIO;
  1393. case 1:
  1394. deb_info("Found DiB0170 rev2");
  1395. break;
  1396. case 2:
  1397. deb_info("Found DiB0190 rev2");
  1398. break;
  1399. default:
  1400. deb_info("DiB01x0 not found");
  1401. return -EIO;
  1402. }
  1403. for (index_data = 0; index_data < len; index_data += 2) {
  1404. wb[2] = (data[index_data + 1] >> 8) & 0xff;
  1405. wb[3] = (data[index_data + 1]) & 0xff;
  1406. if (data[index_data] == 0) {
  1407. wb[0] = (data[index_data] >> 8) & 0xff;
  1408. wb[1] = (data[index_data]) & 0xff;
  1409. msg[0].len = 2;
  1410. if (i2c_transfer(i2c, msg, 2) != 2)
  1411. return -EIO;
  1412. wb[2] |= rb[0];
  1413. wb[3] |= rb[1] & ~(3 << 4);
  1414. }
  1415. wb[0] = (data[index_data] >> 8)&0xff;
  1416. wb[1] = (data[index_data])&0xff;
  1417. msg[0].len = 4;
  1418. if (i2c_transfer(i2c, &msg[0], 1) != 1)
  1419. return -EIO;
  1420. }
  1421. return 0;
  1422. }
  1423. static struct dib9000_config stk9090m_config = {
  1424. .output_mpeg2_in_188_bytes = 1,
  1425. .output_mode = OUTMODE_MPEG2_FIFO,
  1426. .vcxo_timer = 279620,
  1427. .timing_frequency = 20452225,
  1428. .demod_clock_khz = 60000,
  1429. .xtal_clock_khz = 30000,
  1430. .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
  1431. .subband = {
  1432. 2,
  1433. {
  1434. { 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0008 } }, /* GPIO 3 to 1 for VHF */
  1435. { 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0000 } }, /* GPIO 3 to 0 for UHF */
  1436. { 0 },
  1437. },
  1438. },
  1439. .gpio_function = {
  1440. { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 },
  1441. { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 },
  1442. },
  1443. };
  1444. static struct dib9000_config nim9090md_config[2] = {
  1445. {
  1446. .output_mpeg2_in_188_bytes = 1,
  1447. .output_mode = OUTMODE_MPEG2_FIFO,
  1448. .vcxo_timer = 279620,
  1449. .timing_frequency = 20452225,
  1450. .demod_clock_khz = 60000,
  1451. .xtal_clock_khz = 30000,
  1452. .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
  1453. }, {
  1454. .output_mpeg2_in_188_bytes = 1,
  1455. .output_mode = OUTMODE_DIVERSITY,
  1456. .vcxo_timer = 279620,
  1457. .timing_frequency = 20452225,
  1458. .demod_clock_khz = 60000,
  1459. .xtal_clock_khz = 30000,
  1460. .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
  1461. .subband = {
  1462. 2,
  1463. {
  1464. { 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0006 } }, /* GPIO 1 and 2 to 1 for VHF */
  1465. { 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0000 } }, /* GPIO 1 and 2 to 0 for UHF */
  1466. { 0 },
  1467. },
  1468. },
  1469. .gpio_function = {
  1470. { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 },
  1471. { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 },
  1472. },
  1473. }
  1474. };
  1475. static struct dib0090_config dib9090_dib0090_config = {
  1476. .io.pll_bypass = 0,
  1477. .io.pll_range = 1,
  1478. .io.pll_prediv = 1,
  1479. .io.pll_loopdiv = 8,
  1480. .io.adc_clock_ratio = 8,
  1481. .io.pll_int_loop_filt = 0,
  1482. .io.clock_khz = 30000,
  1483. .reset = dib90x0_tuner_reset,
  1484. .sleep = dib90x0_tuner_sleep,
  1485. .clkouttobamse = 0,
  1486. .analog_output = 0,
  1487. .use_pwm_agc = 0,
  1488. .clkoutdrive = 0,
  1489. .freq_offset_khz_uhf = 0,
  1490. .freq_offset_khz_vhf = 0,
  1491. };
  1492. static struct dib0090_config nim9090md_dib0090_config[2] = {
  1493. {
  1494. .io.pll_bypass = 0,
  1495. .io.pll_range = 1,
  1496. .io.pll_prediv = 1,
  1497. .io.pll_loopdiv = 8,
  1498. .io.adc_clock_ratio = 8,
  1499. .io.pll_int_loop_filt = 0,
  1500. .io.clock_khz = 30000,
  1501. .reset = dib90x0_tuner_reset,
  1502. .sleep = dib90x0_tuner_sleep,
  1503. .clkouttobamse = 1,
  1504. .analog_output = 0,
  1505. .use_pwm_agc = 0,
  1506. .clkoutdrive = 0,
  1507. .freq_offset_khz_uhf = 0,
  1508. .freq_offset_khz_vhf = 0,
  1509. }, {
  1510. .io.pll_bypass = 0,
  1511. .io.pll_range = 1,
  1512. .io.pll_prediv = 1,
  1513. .io.pll_loopdiv = 8,
  1514. .io.adc_clock_ratio = 8,
  1515. .io.pll_int_loop_filt = 0,
  1516. .io.clock_khz = 30000,
  1517. .reset = dib90x0_tuner_reset,
  1518. .sleep = dib90x0_tuner_sleep,
  1519. .clkouttobamse = 0,
  1520. .analog_output = 0,
  1521. .use_pwm_agc = 0,
  1522. .clkoutdrive = 0,
  1523. .freq_offset_khz_uhf = 0,
  1524. .freq_offset_khz_vhf = 0,
  1525. }
  1526. };
  1527. static int stk9090m_frontend_attach(struct dvb_usb_adapter *adap)
  1528. {
  1529. struct dib0700_adapter_state *state = adap->priv;
  1530. struct dib0700_state *st = adap->dev->priv;
  1531. u32 fw_version;
  1532. /* Make use of the new i2c functions from FW 1.20 */
  1533. dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL);
  1534. if (fw_version >= 0x10200)
  1535. st->fw_use_new_i2c_api = 1;
  1536. dib0700_set_i2c_speed(adap->dev, 340);
  1537. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  1538. msleep(20);
  1539. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  1540. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  1541. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  1542. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  1543. dib0700_ctrl_clock(adap->dev, 72, 1);
  1544. msleep(20);
  1545. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  1546. msleep(20);
  1547. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  1548. dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, 0x80);
  1549. if (request_firmware(&state->frontend_firmware, "dib9090.fw", &adap->dev->udev->dev)) {
  1550. deb_info("%s: Upload failed. (file not found?)\n", __func__);
  1551. return -ENODEV;
  1552. } else {
  1553. deb_info("%s: firmware read %Zu bytes.\n", __func__, state->frontend_firmware->size);
  1554. }
  1555. stk9090m_config.microcode_B_fe_size = state->frontend_firmware->size;
  1556. stk9090m_config.microcode_B_fe_buffer = state->frontend_firmware->data;
  1557. adap->fe_adap[0].fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &stk9090m_config);
  1558. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  1559. }
  1560. static int dib9090_tuner_attach(struct dvb_usb_adapter *adap)
  1561. {
  1562. struct dib0700_adapter_state *state = adap->priv;
  1563. struct i2c_adapter *i2c = dib9000_get_tuner_interface(adap->fe_adap[0].fe);
  1564. u16 data_dib190[10] = {
  1565. 1, 0x1374,
  1566. 2, 0x01a2,
  1567. 7, 0x0020,
  1568. 0, 0x00ef,
  1569. 8, 0x0486,
  1570. };
  1571. if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &dib9090_dib0090_config) == NULL)
  1572. return -ENODEV;
  1573. i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);
  1574. if (dib01x0_pmu_update(i2c, data_dib190, 10) != 0)
  1575. return -ENODEV;
  1576. dib0700_set_i2c_speed(adap->dev, 2000);
  1577. if (dib9000_firmware_post_pll_init(adap->fe_adap[0].fe) < 0)
  1578. return -ENODEV;
  1579. release_firmware(state->frontend_firmware);
  1580. return 0;
  1581. }
  1582. static int nim9090md_frontend_attach(struct dvb_usb_adapter *adap)
  1583. {
  1584. struct dib0700_adapter_state *state = adap->priv;
  1585. struct dib0700_state *st = adap->dev->priv;
  1586. struct i2c_adapter *i2c;
  1587. struct dvb_frontend *fe_slave;
  1588. u32 fw_version;
  1589. /* Make use of the new i2c functions from FW 1.20 */
  1590. dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL);
  1591. if (fw_version >= 0x10200)
  1592. st->fw_use_new_i2c_api = 1;
  1593. dib0700_set_i2c_speed(adap->dev, 340);
  1594. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  1595. msleep(20);
  1596. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  1597. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  1598. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  1599. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  1600. dib0700_ctrl_clock(adap->dev, 72, 1);
  1601. msleep(20);
  1602. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  1603. msleep(20);
  1604. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  1605. if (request_firmware(&state->frontend_firmware, "dib9090.fw", &adap->dev->udev->dev)) {
  1606. deb_info("%s: Upload failed. (file not found?)\n", __func__);
  1607. return -EIO;
  1608. } else {
  1609. deb_info("%s: firmware read %Zu bytes.\n", __func__, state->frontend_firmware->size);
  1610. }
  1611. nim9090md_config[0].microcode_B_fe_size = state->frontend_firmware->size;
  1612. nim9090md_config[0].microcode_B_fe_buffer = state->frontend_firmware->data;
  1613. nim9090md_config[1].microcode_B_fe_size = state->frontend_firmware->size;
  1614. nim9090md_config[1].microcode_B_fe_buffer = state->frontend_firmware->data;
  1615. dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, 0x80);
  1616. adap->fe_adap[0].fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &nim9090md_config[0]);
  1617. if (adap->fe_adap[0].fe == NULL)
  1618. return -ENODEV;
  1619. i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_3_4, 0);
  1620. dib9000_i2c_enumeration(i2c, 1, 0x12, 0x82);
  1621. fe_slave = dvb_attach(dib9000_attach, i2c, 0x82, &nim9090md_config[1]);
  1622. dib9000_set_slave_frontend(adap->fe_adap[0].fe, fe_slave);
  1623. return fe_slave == NULL ? -ENODEV : 0;
  1624. }
  1625. static int nim9090md_tuner_attach(struct dvb_usb_adapter *adap)
  1626. {
  1627. struct dib0700_adapter_state *state = adap->priv;
  1628. struct i2c_adapter *i2c;
  1629. struct dvb_frontend *fe_slave;
  1630. u16 data_dib190[10] = {
  1631. 1, 0x5374,
  1632. 2, 0x01ae,
  1633. 7, 0x0020,
  1634. 0, 0x00ef,
  1635. 8, 0x0406,
  1636. };
  1637. i2c = dib9000_get_tuner_interface(adap->fe_adap[0].fe);
  1638. if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &nim9090md_dib0090_config[0]) == NULL)
  1639. return -ENODEV;
  1640. i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);
  1641. if (dib01x0_pmu_update(i2c, data_dib190, 10) < 0)
  1642. return -ENODEV;
  1643. dib0700_set_i2c_speed(adap->dev, 2000);
  1644. if (dib9000_firmware_post_pll_init(adap->fe_adap[0].fe) < 0)
  1645. return -ENODEV;
  1646. fe_slave = dib9000_get_slave_frontend(adap->fe_adap[0].fe, 1);
  1647. if (fe_slave != NULL) {
  1648. i2c = dib9000_get_component_bus_interface(adap->fe_adap[0].fe);
  1649. dib9000_set_i2c_adapter(fe_slave, i2c);
  1650. i2c = dib9000_get_tuner_interface(fe_slave);
  1651. if (dvb_attach(dib0090_fw_register, fe_slave, i2c, &nim9090md_dib0090_config[1]) == NULL)
  1652. return -ENODEV;
  1653. fe_slave->dvb = adap->fe_adap[0].fe->dvb;
  1654. dib9000_fw_set_component_bus_speed(adap->fe_adap[0].fe, 2000);
  1655. if (dib9000_firmware_post_pll_init(fe_slave) < 0)
  1656. return -ENODEV;
  1657. }
  1658. release_firmware(state->frontend_firmware);
  1659. return 0;
  1660. }
  1661. /* NIM7090 */
  1662. struct dib7090p_best_adc {
  1663. u32 timf;
  1664. u32 pll_loopdiv;
  1665. u32 pll_prediv;
  1666. };
  1667. static int dib7090p_get_best_sampling(struct dvb_frontend *fe , struct dib7090p_best_adc *adc)
  1668. {
  1669. u8 spur = 0, prediv = 0, loopdiv = 0, min_prediv = 1, max_prediv = 1;
  1670. u16 xtal = 12000;
  1671. u32 fcp_min = 1900; /* PLL Minimum Frequency comparator KHz */
  1672. u32 fcp_max = 20000; /* PLL Maximum Frequency comparator KHz */
  1673. u32 fdem_max = 76000;
  1674. u32 fdem_min = 69500;
  1675. u32 fcp = 0, fs = 0, fdem = 0;
  1676. u32 harmonic_id = 0;
  1677. adc->pll_loopdiv = loopdiv;
  1678. adc->pll_prediv = prediv;
  1679. adc->timf = 0;
  1680. deb_info("bandwidth = %d fdem_min =%d", fe->dtv_property_cache.bandwidth_hz, fdem_min);
  1681. /* Find Min and Max prediv */
  1682. while ((xtal/max_prediv) >= fcp_min)
  1683. max_prediv++;
  1684. max_prediv--;
  1685. min_prediv = max_prediv;
  1686. while ((xtal/min_prediv) <= fcp_max) {
  1687. min_prediv--;
  1688. if (min_prediv == 1)
  1689. break;
  1690. }
  1691. deb_info("MIN prediv = %d : MAX prediv = %d", min_prediv, max_prediv);
  1692. min_prediv = 2;
  1693. for (prediv = min_prediv ; prediv < max_prediv; prediv++) {
  1694. fcp = xtal / prediv;
  1695. if (fcp > fcp_min && fcp < fcp_max) {
  1696. for (loopdiv = 1 ; loopdiv < 64 ; loopdiv++) {
  1697. fdem = ((xtal/prediv) * loopdiv);
  1698. fs = fdem / 4;
  1699. /* test min/max system restrictions */
  1700. if ((fdem >= fdem_min) && (fdem <= fdem_max) && (fs >= fe->dtv_property_cache.bandwidth_hz/1000)) {
  1701. spur = 0;
  1702. /* test fs harmonics positions */
  1703. for (harmonic_id = (fe->dtv_property_cache.frequency / (1000*fs)) ; harmonic_id <= ((fe->dtv_property_cache.frequency / (1000*fs))+1) ; harmonic_id++) {
  1704. if (((fs*harmonic_id) >= ((fe->dtv_property_cache.frequency/1000) - (fe->dtv_property_cache.bandwidth_hz/2000))) && ((fs*harmonic_id) <= ((fe->dtv_property_cache.frequency/1000) + (fe->dtv_property_cache.bandwidth_hz/2000)))) {
  1705. spur = 1;
  1706. break;
  1707. }
  1708. }
  1709. if (!spur) {
  1710. adc->pll_loopdiv = loopdiv;
  1711. adc->pll_prediv = prediv;
  1712. adc->timf = 2396745143UL/fdem*(1 << 9);
  1713. adc->timf += ((2396745143UL%fdem) << 9)/fdem;
  1714. deb_info("loopdiv=%i prediv=%i timf=%i", loopdiv, prediv, adc->timf);
  1715. break;
  1716. }
  1717. }
  1718. }
  1719. }
  1720. if (!spur)
  1721. break;
  1722. }
  1723. if (adc->pll_loopdiv == 0 && adc->pll_prediv == 0)
  1724. return -EINVAL;
  1725. else
  1726. return 0;
  1727. }
  1728. static int dib7090_agc_startup(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
  1729. {
  1730. struct dvb_usb_adapter *adap = fe->dvb->priv;
  1731. struct dib0700_adapter_state *state = adap->priv;
  1732. struct dibx000_bandwidth_config pll;
  1733. u16 target;
  1734. struct dib7090p_best_adc adc;
  1735. int ret;
  1736. ret = state->set_param_save(fe, fep);
  1737. if (ret < 0)
  1738. return ret;
  1739. memset(&pll, 0, sizeof(struct dibx000_bandwidth_config));
  1740. dib0090_pwm_gain_reset(fe);
  1741. target = (dib0090_get_wbd_offset(fe) * 8 + 1) / 2;
  1742. dib7000p_set_wbd_ref(fe, target);
  1743. if (dib7090p_get_best_sampling(fe, &adc) == 0) {
  1744. pll.pll_ratio = adc.pll_loopdiv;
  1745. pll.pll_prediv = adc.pll_prediv;
  1746. dib7000p_update_pll(fe, &pll);
  1747. dib7000p_ctrl_timf(fe, DEMOD_TIMF_SET, adc.timf);
  1748. }
  1749. return 0;
  1750. }
  1751. static int dib7090_agc_restart(struct dvb_frontend *fe, u8 restart)
  1752. {
  1753. deb_info("AGC restart callback: %d", restart);
  1754. if (restart == 0) /* before AGC startup */
  1755. dib0090_set_dc_servo(fe, 1);
  1756. return 0;
  1757. }
  1758. static struct dib0090_wbd_slope dib7090_wbd_table[] = {
  1759. { 380, 81, 850, 64, 540, 4},
  1760. { 860, 51, 866, 21, 375, 4},
  1761. {1700, 0, 250, 0, 100, 6},
  1762. {2600, 0, 250, 0, 100, 6},
  1763. { 0xFFFF, 0, 0, 0, 0, 0},
  1764. };
  1765. struct dibx000_agc_config dib7090_agc_config[2] = {
  1766. {
  1767. .band_caps = BAND_UHF,
  1768. /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
  1769. * 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 */
  1770. .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
  1771. .inv_gain = 687,
  1772. .time_stabiliz = 10,
  1773. .alpha_level = 0,
  1774. .thlock = 118,
  1775. .wbd_inv = 0,
  1776. .wbd_ref = 1200,
  1777. .wbd_sel = 3,
  1778. .wbd_alpha = 5,
  1779. .agc1_max = 65535,
  1780. .agc1_min = 0,
  1781. .agc2_max = 65535,
  1782. .agc2_min = 0,
  1783. .agc1_pt1 = 0,
  1784. .agc1_pt2 = 32,
  1785. .agc1_pt3 = 114,
  1786. .agc1_slope1 = 143,
  1787. .agc1_slope2 = 144,
  1788. .agc2_pt1 = 114,
  1789. .agc2_pt2 = 227,
  1790. .agc2_slope1 = 116,
  1791. .agc2_slope2 = 117,
  1792. .alpha_mant = 18,
  1793. .alpha_exp = 0,
  1794. .beta_mant = 20,
  1795. .beta_exp = 59,
  1796. .perform_agc_softsplit = 0,
  1797. } , {
  1798. .band_caps = BAND_FM | BAND_VHF | BAND_CBAND,
  1799. /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
  1800. * 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 */
  1801. .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
  1802. .inv_gain = 732,
  1803. .time_stabiliz = 10,
  1804. .alpha_level = 0,
  1805. .thlock = 118,
  1806. .wbd_inv = 0,
  1807. .wbd_ref = 1200,
  1808. .wbd_sel = 3,
  1809. .wbd_alpha = 5,
  1810. .agc1_max = 65535,
  1811. .agc1_min = 0,
  1812. .agc2_max = 65535,
  1813. .agc2_min = 0,
  1814. .agc1_pt1 = 0,
  1815. .agc1_pt2 = 0,
  1816. .agc1_pt3 = 98,
  1817. .agc1_slope1 = 0,
  1818. .agc1_slope2 = 167,
  1819. .agc2_pt1 = 98,
  1820. .agc2_pt2 = 255,
  1821. .agc2_slope1 = 104,
  1822. .agc2_slope2 = 0,
  1823. .alpha_mant = 18,
  1824. .alpha_exp = 0,
  1825. .beta_mant = 20,
  1826. .beta_exp = 59,
  1827. .perform_agc_softsplit = 0,
  1828. }
  1829. };
  1830. static struct dibx000_bandwidth_config dib7090_clock_config_12_mhz = {
  1831. 60000, 15000,
  1832. 1, 5, 0, 0, 0,
  1833. 0, 0, 1, 1, 2,
  1834. (3 << 14) | (1 << 12) | (524 << 0),
  1835. (0 << 25) | 0,
  1836. 20452225,
  1837. 15000000,
  1838. };
  1839. static struct dib7000p_config nim7090_dib7000p_config = {
  1840. .output_mpeg2_in_188_bytes = 1,
  1841. .hostbus_diversity = 1,
  1842. .tuner_is_baseband = 1,
  1843. .update_lna = NULL,
  1844. .agc_config_count = 2,
  1845. .agc = dib7090_agc_config,
  1846. .bw = &dib7090_clock_config_12_mhz,
  1847. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  1848. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  1849. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  1850. .pwm_freq_div = 0,
  1851. .agc_control = dib7090_agc_restart,
  1852. .spur_protect = 0,
  1853. .disable_sample_and_hold = 0,
  1854. .enable_current_mirror = 0,
  1855. .diversity_delay = 0,
  1856. .output_mode = OUTMODE_MPEG2_FIFO,
  1857. .enMpegOutput = 1,
  1858. };
  1859. static struct dib7000p_config tfe7090pvr_dib7000p_config[2] = {
  1860. {
  1861. .output_mpeg2_in_188_bytes = 1,
  1862. .hostbus_diversity = 1,
  1863. .tuner_is_baseband = 1,
  1864. .update_lna = NULL,
  1865. .agc_config_count = 2,
  1866. .agc = dib7090_agc_config,
  1867. .bw = &dib7090_clock_config_12_mhz,
  1868. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  1869. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  1870. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  1871. .pwm_freq_div = 0,
  1872. .agc_control = dib7090_agc_restart,
  1873. .spur_protect = 0,
  1874. .disable_sample_and_hold = 0,
  1875. .enable_current_mirror = 0,
  1876. .diversity_delay = 0,
  1877. .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
  1878. .default_i2c_addr = 0x90,
  1879. .enMpegOutput = 1,
  1880. }, {
  1881. .output_mpeg2_in_188_bytes = 1,
  1882. .hostbus_diversity = 1,
  1883. .tuner_is_baseband = 1,
  1884. .update_lna = NULL,
  1885. .agc_config_count = 2,
  1886. .agc = dib7090_agc_config,
  1887. .bw = &dib7090_clock_config_12_mhz,
  1888. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  1889. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  1890. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  1891. .pwm_freq_div = 0,
  1892. .agc_control = dib7090_agc_restart,
  1893. .spur_protect = 0,
  1894. .disable_sample_and_hold = 0,
  1895. .enable_current_mirror = 0,
  1896. .diversity_delay = 0,
  1897. .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
  1898. .default_i2c_addr = 0x92,
  1899. .enMpegOutput = 0,
  1900. }
  1901. };
  1902. static const struct dib0090_config nim7090_dib0090_config = {
  1903. .io.clock_khz = 12000,
  1904. .io.pll_bypass = 0,
  1905. .io.pll_range = 0,
  1906. .io.pll_prediv = 3,
  1907. .io.pll_loopdiv = 6,
  1908. .io.adc_clock_ratio = 0,
  1909. .io.pll_int_loop_filt = 0,
  1910. .reset = dib7090_tuner_sleep,
  1911. .sleep = dib7090_tuner_sleep,
  1912. .freq_offset_khz_uhf = 0,
  1913. .freq_offset_khz_vhf = 0,
  1914. .get_adc_power = dib7090_get_adc_power,
  1915. .clkouttobamse = 1,
  1916. .analog_output = 0,
  1917. .wbd_vhf_offset = 0,
  1918. .wbd_cband_offset = 0,
  1919. .use_pwm_agc = 1,
  1920. .clkoutdrive = 0,
  1921. .fref_clock_ratio = 0,
  1922. .wbd = dib7090_wbd_table,
  1923. .ls_cfg_pad_drv = 0,
  1924. .data_tx_drv = 0,
  1925. .low_if = NULL,
  1926. .in_soc = 1,
  1927. };
  1928. static const struct dib0090_config tfe7090pvr_dib0090_config[2] = {
  1929. {
  1930. .io.clock_khz = 12000,
  1931. .io.pll_bypass = 0,
  1932. .io.pll_range = 0,
  1933. .io.pll_prediv = 3,
  1934. .io.pll_loopdiv = 6,
  1935. .io.adc_clock_ratio = 0,
  1936. .io.pll_int_loop_filt = 0,
  1937. .reset = dib7090_tuner_sleep,
  1938. .sleep = dib7090_tuner_sleep,
  1939. .freq_offset_khz_uhf = 50,
  1940. .freq_offset_khz_vhf = 70,
  1941. .get_adc_power = dib7090_get_adc_power,
  1942. .clkouttobamse = 1,
  1943. .analog_output = 0,
  1944. .wbd_vhf_offset = 0,
  1945. .wbd_cband_offset = 0,
  1946. .use_pwm_agc = 1,
  1947. .clkoutdrive = 0,
  1948. .fref_clock_ratio = 0,
  1949. .wbd = dib7090_wbd_table,
  1950. .ls_cfg_pad_drv = 0,
  1951. .data_tx_drv = 0,
  1952. .low_if = NULL,
  1953. .in_soc = 1,
  1954. }, {
  1955. .io.clock_khz = 12000,
  1956. .io.pll_bypass = 0,
  1957. .io.pll_range = 0,
  1958. .io.pll_prediv = 3,
  1959. .io.pll_loopdiv = 6,
  1960. .io.adc_clock_ratio = 0,
  1961. .io.pll_int_loop_filt = 0,
  1962. .reset = dib7090_tuner_sleep,
  1963. .sleep = dib7090_tuner_sleep,
  1964. .freq_offset_khz_uhf = -50,
  1965. .freq_offset_khz_vhf = -70,
  1966. .get_adc_power = dib7090_get_adc_power,
  1967. .clkouttobamse = 1,
  1968. .analog_output = 0,
  1969. .wbd_vhf_offset = 0,
  1970. .wbd_cband_offset = 0,
  1971. .use_pwm_agc = 1,
  1972. .clkoutdrive = 0,
  1973. .fref_clock_ratio = 0,
  1974. .wbd = dib7090_wbd_table,
  1975. .ls_cfg_pad_drv = 0,
  1976. .data_tx_drv = 0,
  1977. .low_if = NULL,
  1978. .in_soc = 1,
  1979. }
  1980. };
  1981. static int nim7090_frontend_attach(struct dvb_usb_adapter *adap)
  1982. {
  1983. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  1984. msleep(20);
  1985. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  1986. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  1987. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  1988. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  1989. msleep(20);
  1990. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  1991. msleep(20);
  1992. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  1993. if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, &nim7090_dib7000p_config) != 0) {
  1994. err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
  1995. return -ENODEV;
  1996. }
  1997. adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &nim7090_dib7000p_config);
  1998. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  1999. }
  2000. static int nim7090_tuner_attach(struct dvb_usb_adapter *adap)
  2001. {
  2002. struct dib0700_adapter_state *st = adap->priv;
  2003. struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe_adap[0].fe);
  2004. if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &nim7090_dib0090_config) == NULL)
  2005. return -ENODEV;
  2006. dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
  2007. st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
  2008. adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
  2009. return 0;
  2010. }
  2011. static int tfe7090pvr_frontend0_attach(struct dvb_usb_adapter *adap)
  2012. {
  2013. struct dib0700_state *st = adap->dev->priv;
  2014. /* The TFE7090 requires the dib0700 to not be in master mode */
  2015. st->disable_streaming_master_mode = 1;
  2016. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  2017. msleep(20);
  2018. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  2019. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  2020. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  2021. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  2022. msleep(20);
  2023. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  2024. msleep(20);
  2025. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  2026. /* initialize IC 0 */
  2027. if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, &tfe7090pvr_dib7000p_config[0]) != 0) {
  2028. err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
  2029. return -ENODEV;
  2030. }
  2031. dib0700_set_i2c_speed(adap->dev, 340);
  2032. adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x90, &tfe7090pvr_dib7000p_config[0]);
  2033. if (adap->fe_adap[0].fe == NULL)
  2034. return -ENODEV;
  2035. dib7090_slave_reset(adap->fe_adap[0].fe);
  2036. return 0;
  2037. }
  2038. static int tfe7090pvr_frontend1_attach(struct dvb_usb_adapter *adap)
  2039. {
  2040. struct i2c_adapter *i2c;
  2041. if (adap->dev->adapter[0].fe_adap[0].fe == NULL) {
  2042. err("the master dib7090 has to be initialized first");
  2043. return -ENODEV; /* the master device has not been initialized */
  2044. }
  2045. i2c = dib7000p_get_i2c_master(adap->dev->adapter[0].fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_6_7, 1);
  2046. if (dib7000p_i2c_enumeration(i2c, 1, 0x10, &tfe7090pvr_dib7000p_config[1]) != 0) {
  2047. err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
  2048. return -ENODEV;
  2049. }
  2050. adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, i2c, 0x92, &tfe7090pvr_dib7000p_config[1]);
  2051. dib0700_set_i2c_speed(adap->dev, 200);
  2052. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  2053. }
  2054. static int tfe7090pvr_tuner0_attach(struct dvb_usb_adapter *adap)
  2055. {
  2056. struct dib0700_adapter_state *st = adap->priv;
  2057. struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe_adap[0].fe);
  2058. if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &tfe7090pvr_dib0090_config[0]) == NULL)
  2059. return -ENODEV;
  2060. dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
  2061. st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
  2062. adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
  2063. return 0;
  2064. }
  2065. static int tfe7090pvr_tuner1_attach(struct dvb_usb_adapter *adap)
  2066. {
  2067. struct dib0700_adapter_state *st = adap->priv;
  2068. struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe_adap[0].fe);
  2069. if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &tfe7090pvr_dib0090_config[1]) == NULL)
  2070. return -ENODEV;
  2071. dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
  2072. st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
  2073. adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
  2074. return 0;
  2075. }
  2076. /* STK7070PD */
  2077. static struct dib7000p_config stk7070pd_dib7000p_config[2] = {
  2078. {
  2079. .output_mpeg2_in_188_bytes = 1,
  2080. .agc_config_count = 1,
  2081. .agc = &dib7070_agc_config,
  2082. .bw = &dib7070_bw_config_12_mhz,
  2083. .tuner_is_baseband = 1,
  2084. .spur_protect = 1,
  2085. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  2086. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  2087. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  2088. .hostbus_diversity = 1,
  2089. }, {
  2090. .output_mpeg2_in_188_bytes = 1,
  2091. .agc_config_count = 1,
  2092. .agc = &dib7070_agc_config,
  2093. .bw = &dib7070_bw_config_12_mhz,
  2094. .tuner_is_baseband = 1,
  2095. .spur_protect = 1,
  2096. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  2097. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  2098. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  2099. .hostbus_diversity = 1,
  2100. }
  2101. };
  2102. static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap)
  2103. {
  2104. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  2105. msleep(10);
  2106. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  2107. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  2108. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  2109. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  2110. dib0700_ctrl_clock(adap->dev, 72, 1);
  2111. msleep(10);
  2112. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  2113. msleep(10);
  2114. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  2115. if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
  2116. stk7070pd_dib7000p_config) != 0) {
  2117. err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
  2118. __func__);
  2119. return -ENODEV;
  2120. }
  2121. adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]);
  2122. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  2123. }
  2124. static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap)
  2125. {
  2126. adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]);
  2127. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  2128. }
  2129. /* S5H1411 */
  2130. static struct s5h1411_config pinnacle_801e_config = {
  2131. .output_mode = S5H1411_PARALLEL_OUTPUT,
  2132. .gpio = S5H1411_GPIO_OFF,
  2133. .mpeg_timing = S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK,
  2134. .qam_if = S5H1411_IF_44000,
  2135. .vsb_if = S5H1411_IF_44000,
  2136. .inversion = S5H1411_INVERSION_OFF,
  2137. .status_mode = S5H1411_DEMODLOCKING
  2138. };
  2139. /* Pinnacle PCTV HD Pro 801e GPIOs map:
  2140. GPIO0 - currently unknown
  2141. GPIO1 - xc5000 tuner reset
  2142. GPIO2 - CX25843 sleep
  2143. GPIO3 - currently unknown
  2144. GPIO4 - currently unknown
  2145. GPIO6 - currently unknown
  2146. GPIO7 - currently unknown
  2147. GPIO9 - currently unknown
  2148. GPIO10 - CX25843 reset
  2149. */
  2150. static int s5h1411_frontend_attach(struct dvb_usb_adapter *adap)
  2151. {
  2152. struct dib0700_state *st = adap->dev->priv;
  2153. /* Make use of the new i2c functions from FW 1.20 */
  2154. st->fw_use_new_i2c_api = 1;
  2155. /* The s5h1411 requires the dib0700 to not be in master mode */
  2156. st->disable_streaming_master_mode = 1;
  2157. /* All msleep values taken from Windows USB trace */
  2158. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
  2159. dib0700_set_gpio(adap->dev, GPIO3, GPIO_OUT, 0);
  2160. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  2161. msleep(400);
  2162. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  2163. msleep(60);
  2164. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  2165. msleep(30);
  2166. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  2167. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  2168. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  2169. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  2170. dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 0);
  2171. msleep(30);
  2172. /* Put the CX25843 to sleep for now since we're in digital mode */
  2173. dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
  2174. /* GPIOs are initialized, do the attach */
  2175. adap->fe_adap[0].fe = dvb_attach(s5h1411_attach, &pinnacle_801e_config,
  2176. &adap->dev->i2c_adap);
  2177. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  2178. }
  2179. static int dib0700_xc5000_tuner_callback(void *priv, int component,
  2180. int command, int arg)
  2181. {
  2182. struct dvb_usb_adapter *adap = priv;
  2183. if (command == XC5000_TUNER_RESET) {
  2184. /* Reset the tuner */
  2185. dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0);
  2186. msleep(10);
  2187. dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1);
  2188. msleep(10);
  2189. } else {
  2190. err("xc5000: unknown tuner callback command: %d\n", command);
  2191. return -EINVAL;
  2192. }
  2193. return 0;
  2194. }
  2195. static struct xc5000_config s5h1411_xc5000_tunerconfig = {
  2196. .i2c_address = 0x64,
  2197. .if_khz = 5380,
  2198. };
  2199. static int xc5000_tuner_attach(struct dvb_usb_adapter *adap)
  2200. {
  2201. /* FIXME: generalize & move to common area */
  2202. adap->fe_adap[0].fe->callback = dib0700_xc5000_tuner_callback;
  2203. return dvb_attach(xc5000_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap,
  2204. &s5h1411_xc5000_tunerconfig)
  2205. == NULL ? -ENODEV : 0;
  2206. }
  2207. static int dib0700_xc4000_tuner_callback(void *priv, int component,
  2208. int command, int arg)
  2209. {
  2210. struct dvb_usb_adapter *adap = priv;
  2211. if (command == XC4000_TUNER_RESET) {
  2212. /* Reset the tuner */
  2213. dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 0);
  2214. msleep(10);
  2215. dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
  2216. } else {
  2217. err("xc4000: unknown tuner callback command: %d\n", command);
  2218. return -EINVAL;
  2219. }
  2220. return 0;
  2221. }
  2222. static struct dibx000_agc_config stk7700p_7000p_xc4000_agc_config = {
  2223. .band_caps = BAND_UHF | BAND_VHF,
  2224. .setup = 0x64,
  2225. .inv_gain = 0x02c8,
  2226. .time_stabiliz = 0x15,
  2227. .alpha_level = 0x00,
  2228. .thlock = 0x76,
  2229. .wbd_inv = 0x01,
  2230. .wbd_ref = 0x0b33,
  2231. .wbd_sel = 0x00,
  2232. .wbd_alpha = 0x02,
  2233. .agc1_max = 0x00,
  2234. .agc1_min = 0x00,
  2235. .agc2_max = 0x9b26,
  2236. .agc2_min = 0x26ca,
  2237. .agc1_pt1 = 0x00,
  2238. .agc1_pt2 = 0x00,
  2239. .agc1_pt3 = 0x00,
  2240. .agc1_slope1 = 0x00,
  2241. .agc1_slope2 = 0x00,
  2242. .agc2_pt1 = 0x00,
  2243. .agc2_pt2 = 0x80,
  2244. .agc2_slope1 = 0x1d,
  2245. .agc2_slope2 = 0x1d,
  2246. .alpha_mant = 0x11,
  2247. .alpha_exp = 0x1b,
  2248. .beta_mant = 0x17,
  2249. .beta_exp = 0x33,
  2250. .perform_agc_softsplit = 0x00,
  2251. };
  2252. static struct dibx000_bandwidth_config stk7700p_xc4000_pll_config = {
  2253. 60000, 30000, /* internal, sampling */
  2254. 1, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */
  2255. 0, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, */
  2256. /* ADClkSrc, modulo */
  2257. (3 << 14) | (1 << 12) | 524, /* sad_cfg: refsel, sel, freq_15k */
  2258. 39370534, /* ifreq */
  2259. 20452225, /* timf */
  2260. 30000000 /* xtal */
  2261. };
  2262. /* FIXME: none of these inputs are validated yet */
  2263. static struct dib7000p_config pctv_340e_config = {
  2264. .output_mpeg2_in_188_bytes = 1,
  2265. .agc_config_count = 1,
  2266. .agc = &stk7700p_7000p_xc4000_agc_config,
  2267. .bw = &stk7700p_xc4000_pll_config,
  2268. .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
  2269. .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
  2270. .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
  2271. };
  2272. /* PCTV 340e GPIOs map:
  2273. dib0700:
  2274. GPIO2 - CX25843 sleep
  2275. GPIO3 - CS5340 reset
  2276. GPIO5 - IRD
  2277. GPIO6 - Power Supply
  2278. GPIO8 - LNA (1=off 0=on)
  2279. GPIO10 - CX25843 reset
  2280. dib7000:
  2281. GPIO8 - xc4000 reset
  2282. */
  2283. static int pctv340e_frontend_attach(struct dvb_usb_adapter *adap)
  2284. {
  2285. struct dib0700_state *st = adap->dev->priv;
  2286. /* Power Supply on */
  2287. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
  2288. msleep(50);
  2289. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  2290. msleep(100); /* Allow power supply to settle before probing */
  2291. /* cx25843 reset */
  2292. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  2293. msleep(1); /* cx25843 datasheet say 350us required */
  2294. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  2295. /* LNA off for now */
  2296. dib0700_set_gpio(adap->dev, GPIO8, GPIO_OUT, 1);
  2297. /* Put the CX25843 to sleep for now since we're in digital mode */
  2298. dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
  2299. /* FIXME: not verified yet */
  2300. dib0700_ctrl_clock(adap->dev, 72, 1);
  2301. msleep(500);
  2302. if (dib7000pc_detection(&adap->dev->i2c_adap) == 0) {
  2303. /* Demodulator not found for some reason? */
  2304. return -ENODEV;
  2305. }
  2306. adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x12,
  2307. &pctv_340e_config);
  2308. st->is_dib7000pc = 1;
  2309. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  2310. }
  2311. static struct xc4000_config dib7000p_xc4000_tunerconfig = {
  2312. .i2c_address = 0x61,
  2313. .default_pm = 1,
  2314. .dvb_amplitude = 0,
  2315. .set_smoothedcvbs = 0,
  2316. .if_khz = 5400
  2317. };
  2318. static int xc4000_tuner_attach(struct dvb_usb_adapter *adap)
  2319. {
  2320. struct i2c_adapter *tun_i2c;
  2321. /* The xc4000 is not on the main i2c bus */
  2322. tun_i2c = dib7000p_get_i2c_master(adap->fe_adap[0].fe,
  2323. DIBX000_I2C_INTERFACE_TUNER, 1);
  2324. if (tun_i2c == NULL) {
  2325. printk(KERN_ERR "Could not reach tuner i2c bus\n");
  2326. return 0;
  2327. }
  2328. /* Setup the reset callback */
  2329. adap->fe_adap[0].fe->callback = dib0700_xc4000_tuner_callback;
  2330. return dvb_attach(xc4000_attach, adap->fe_adap[0].fe, tun_i2c,
  2331. &dib7000p_xc4000_tunerconfig)
  2332. == NULL ? -ENODEV : 0;
  2333. }
  2334. static struct lgdt3305_config hcw_lgdt3305_config = {
  2335. .i2c_addr = 0x0e,
  2336. .mpeg_mode = LGDT3305_MPEG_PARALLEL,
  2337. .tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE,
  2338. .tpvalid_polarity = LGDT3305_TP_VALID_LOW,
  2339. .deny_i2c_rptr = 0,
  2340. .spectral_inversion = 1,
  2341. .qam_if_khz = 6000,
  2342. .vsb_if_khz = 6000,
  2343. .usref_8vsb = 0x0500,
  2344. };
  2345. static struct mxl5007t_config hcw_mxl5007t_config = {
  2346. .xtal_freq_hz = MxL_XTAL_25_MHZ,
  2347. .if_freq_hz = MxL_IF_6_MHZ,
  2348. .invert_if = 1,
  2349. };
  2350. /* TIGER-ATSC map:
  2351. GPIO0 - LNA_CTR (H: LNA power enabled, L: LNA power disabled)
  2352. GPIO1 - ANT_SEL (H: VPA, L: MCX)
  2353. GPIO4 - SCL2
  2354. GPIO6 - EN_TUNER
  2355. GPIO7 - SDA2
  2356. GPIO10 - DEM_RST
  2357. MXL is behind LG's i2c repeater. LG is on SCL2/SDA2 gpios on the DIB
  2358. */
  2359. static int lgdt3305_frontend_attach(struct dvb_usb_adapter *adap)
  2360. {
  2361. struct dib0700_state *st = adap->dev->priv;
  2362. /* Make use of the new i2c functions from FW 1.20 */
  2363. st->fw_use_new_i2c_api = 1;
  2364. st->disable_streaming_master_mode = 1;
  2365. /* fe power enable */
  2366. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
  2367. msleep(30);
  2368. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  2369. msleep(30);
  2370. /* demod reset */
  2371. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  2372. msleep(30);
  2373. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  2374. msleep(30);
  2375. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  2376. msleep(30);
  2377. adap->fe_adap[0].fe = dvb_attach(lgdt3305_attach,
  2378. &hcw_lgdt3305_config,
  2379. &adap->dev->i2c_adap);
  2380. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  2381. }
  2382. static int mxl5007t_tuner_attach(struct dvb_usb_adapter *adap)
  2383. {
  2384. return dvb_attach(mxl5007t_attach, adap->fe_adap[0].fe,
  2385. &adap->dev->i2c_adap, 0x60,
  2386. &hcw_mxl5007t_config) == NULL ? -ENODEV : 0;
  2387. }
  2388. /* DVB-USB and USB stuff follows */
  2389. struct usb_device_id dib0700_usb_id_table[] = {
  2390. /* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },
  2391. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) },
  2392. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },
  2393. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },
  2394. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },
  2395. /* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },
  2396. { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) },
  2397. { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) },
  2398. { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) },
  2399. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) },
  2400. /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) },
  2401. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) },
  2402. { USB_DEVICE(USB_VID_TERRATEC,
  2403. USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) },
  2404. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) },
  2405. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) },
  2406. /* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) },
  2407. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) },
  2408. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) },
  2409. { USB_DEVICE(USB_VID_PINNACLE,
  2410. USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) },
  2411. { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) },
  2412. /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) },
  2413. { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) },
  2414. { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) },
  2415. { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) },
  2416. { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) },
  2417. /* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) },
  2418. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) },
  2419. { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) },
  2420. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) },
  2421. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) },
  2422. /* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) },
  2423. { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) },
  2424. { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) },
  2425. { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) },
  2426. { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) },
  2427. /* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) },
  2428. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) },
  2429. { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U8000) },
  2430. { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700PH) },
  2431. { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000H) },
  2432. /* 40 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E) },
  2433. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E_SE) },
  2434. { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_EXPRESS) },
  2435. { USB_DEVICE(USB_VID_TERRATEC,
  2436. USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2) },
  2437. { USB_DEVICE(USB_VID_SONY, USB_PID_SONY_PLAYTV) },
  2438. /* 45 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_PD378S) },
  2439. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC) },
  2440. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC_B210) },
  2441. { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_MC770) },
  2442. { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT) },
  2443. /* 50 */{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_Dlx) },
  2444. { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_H) },
  2445. { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T3) },
  2446. { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T5) },
  2447. { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D) },
  2448. /* 55 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D_2) },
  2449. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73A) },
  2450. { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV73ESE) },
  2451. { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV282E) },
  2452. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7770P) },
  2453. /* 60 */{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS_2) },
  2454. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) },
  2455. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) },
  2456. { USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x000, 0x3f00) },
  2457. { USB_DEVICE(USB_VID_EVOLUTEPC, USB_PID_TVWAY_PLUS) },
  2458. /* 65 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) },
  2459. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) },
  2460. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK8096GP) },
  2461. { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DIVERSITY) },
  2462. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM9090M) },
  2463. /* 70 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM8096MD) },
  2464. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM9090MD) },
  2465. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM7090) },
  2466. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7090PVR) },
  2467. { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_AIRSTAR_TELESTICK_2) },
  2468. /* 75 */{ USB_DEVICE(USB_VID_MEDION, USB_PID_CREATIX_CTX1921) },
  2469. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV340E) },
  2470. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV340E_SE) },
  2471. { 0 } /* Terminating entry */
  2472. };
  2473. MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
  2474. #define DIB0700_DEFAULT_DEVICE_PROPERTIES \
  2475. .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
  2476. .usb_ctrl = DEVICE_SPECIFIC, \
  2477. .firmware = "dvb-usb-dib0700-1.20.fw", \
  2478. .download_firmware = dib0700_download_firmware, \
  2479. .no_reconnect = 1, \
  2480. .size_of_priv = sizeof(struct dib0700_state), \
  2481. .i2c_algo = &dib0700_i2c_algo, \
  2482. .identify_state = dib0700_identify_state
  2483. #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
  2484. .streaming_ctrl = dib0700_streaming_ctrl, \
  2485. .stream = { \
  2486. .type = USB_BULK, \
  2487. .count = 4, \
  2488. .endpoint = ep, \
  2489. .u = { \
  2490. .bulk = { \
  2491. .buffersize = 39480, \
  2492. } \
  2493. } \
  2494. }
  2495. struct dvb_usb_device_properties dib0700_devices[] = {
  2496. {
  2497. DIB0700_DEFAULT_DEVICE_PROPERTIES,
  2498. .num_adapters = 1,
  2499. .adapter = {
  2500. {
  2501. .num_frontends = 1,
  2502. .fe = {{
  2503. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  2504. .pid_filter_count = 32,
  2505. .pid_filter = stk7700p_pid_filter,
  2506. .pid_filter_ctrl = stk7700p_pid_filter_ctrl,
  2507. .frontend_attach = stk7700p_frontend_attach,
  2508. .tuner_attach = stk7700p_tuner_attach,
  2509. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  2510. }},
  2511. },
  2512. },
  2513. .num_device_descs = 8,
  2514. .devices = {
  2515. { "DiBcom STK7700P reference design",
  2516. { &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] },
  2517. { NULL },
  2518. },
  2519. { "Hauppauge Nova-T Stick",
  2520. { &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL },
  2521. { NULL },
  2522. },
  2523. { "AVerMedia AVerTV DVB-T Volar",
  2524. { &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] },
  2525. { NULL },
  2526. },
  2527. { "Compro Videomate U500",
  2528. { &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] },
  2529. { NULL },
  2530. },
  2531. { "Uniwill STK7700P based (Hama and others)",
  2532. { &dib0700_usb_id_table[7], NULL },
  2533. { NULL },
  2534. },
  2535. { "Leadtek Winfast DTV Dongle (STK7700P based)",
  2536. { &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] },
  2537. { NULL },
  2538. },
  2539. { "AVerMedia AVerTV DVB-T Express",
  2540. { &dib0700_usb_id_table[20] },
  2541. { NULL },
  2542. },
  2543. { "Gigabyte U7000",
  2544. { &dib0700_usb_id_table[21], NULL },
  2545. { NULL },
  2546. }
  2547. },
  2548. .rc.core = {
  2549. .rc_interval = DEFAULT_RC_INTERVAL,
  2550. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  2551. .rc_query = dib0700_rc_query_old_firmware,
  2552. .allowed_protos = RC_TYPE_RC5 |
  2553. RC_TYPE_RC6 |
  2554. RC_TYPE_NEC,
  2555. .change_protocol = dib0700_change_protocol,
  2556. },
  2557. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  2558. .num_adapters = 2,
  2559. .adapter = {
  2560. {
  2561. .num_frontends = 1,
  2562. .fe = {{
  2563. .frontend_attach = bristol_frontend_attach,
  2564. .tuner_attach = bristol_tuner_attach,
  2565. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  2566. }},
  2567. }, {
  2568. .num_frontends = 1,
  2569. .fe = {{
  2570. .frontend_attach = bristol_frontend_attach,
  2571. .tuner_attach = bristol_tuner_attach,
  2572. DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
  2573. }},
  2574. }
  2575. },
  2576. .num_device_descs = 1,
  2577. .devices = {
  2578. { "Hauppauge Nova-T 500 Dual DVB-T",
  2579. { &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL },
  2580. { NULL },
  2581. },
  2582. },
  2583. .rc.core = {
  2584. .rc_interval = DEFAULT_RC_INTERVAL,
  2585. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  2586. .rc_query = dib0700_rc_query_old_firmware,
  2587. .allowed_protos = RC_TYPE_RC5 |
  2588. RC_TYPE_RC6 |
  2589. RC_TYPE_NEC,
  2590. .change_protocol = dib0700_change_protocol,
  2591. },
  2592. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  2593. .num_adapters = 2,
  2594. .adapter = {
  2595. {
  2596. .num_frontends = 1,
  2597. .fe = {{
  2598. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  2599. .pid_filter_count = 32,
  2600. .pid_filter = stk70x0p_pid_filter,
  2601. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  2602. .frontend_attach = stk7700d_frontend_attach,
  2603. .tuner_attach = stk7700d_tuner_attach,
  2604. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  2605. }},
  2606. }, {
  2607. .num_frontends = 1,
  2608. .fe = {{
  2609. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  2610. .pid_filter_count = 32,
  2611. .pid_filter = stk70x0p_pid_filter,
  2612. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  2613. .frontend_attach = stk7700d_frontend_attach,
  2614. .tuner_attach = stk7700d_tuner_attach,
  2615. DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
  2616. }},
  2617. }
  2618. },
  2619. .num_device_descs = 5,
  2620. .devices = {
  2621. { "Pinnacle PCTV 2000e",
  2622. { &dib0700_usb_id_table[11], NULL },
  2623. { NULL },
  2624. },
  2625. { "Terratec Cinergy DT XS Diversity",
  2626. { &dib0700_usb_id_table[12], NULL },
  2627. { NULL },
  2628. },
  2629. { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",
  2630. { &dib0700_usb_id_table[13], NULL },
  2631. { NULL },
  2632. },
  2633. { "DiBcom STK7700D reference design",
  2634. { &dib0700_usb_id_table[14], NULL },
  2635. { NULL },
  2636. },
  2637. { "YUAN High-Tech DiBcom STK7700D",
  2638. { &dib0700_usb_id_table[55], NULL },
  2639. { NULL },
  2640. },
  2641. },
  2642. .rc.core = {
  2643. .rc_interval = DEFAULT_RC_INTERVAL,
  2644. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  2645. .rc_query = dib0700_rc_query_old_firmware,
  2646. .allowed_protos = RC_TYPE_RC5 |
  2647. RC_TYPE_RC6 |
  2648. RC_TYPE_NEC,
  2649. .change_protocol = dib0700_change_protocol,
  2650. },
  2651. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  2652. .num_adapters = 1,
  2653. .adapter = {
  2654. {
  2655. .num_frontends = 1,
  2656. .fe = {{
  2657. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  2658. .pid_filter_count = 32,
  2659. .pid_filter = stk70x0p_pid_filter,
  2660. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  2661. .frontend_attach = stk7700P2_frontend_attach,
  2662. .tuner_attach = stk7700d_tuner_attach,
  2663. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  2664. }},
  2665. },
  2666. },
  2667. .num_device_descs = 3,
  2668. .devices = {
  2669. { "ASUS My Cinema U3000 Mini DVBT Tuner",
  2670. { &dib0700_usb_id_table[23], NULL },
  2671. { NULL },
  2672. },
  2673. { "Yuan EC372S",
  2674. { &dib0700_usb_id_table[31], NULL },
  2675. { NULL },
  2676. },
  2677. { "Terratec Cinergy T Express",
  2678. { &dib0700_usb_id_table[42], NULL },
  2679. { NULL },
  2680. }
  2681. },
  2682. .rc.core = {
  2683. .rc_interval = DEFAULT_RC_INTERVAL,
  2684. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  2685. .module_name = "dib0700",
  2686. .rc_query = dib0700_rc_query_old_firmware,
  2687. .allowed_protos = RC_TYPE_RC5 |
  2688. RC_TYPE_RC6 |
  2689. RC_TYPE_NEC,
  2690. .change_protocol = dib0700_change_protocol,
  2691. },
  2692. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  2693. .num_adapters = 1,
  2694. .adapter = {
  2695. {
  2696. .num_frontends = 1,
  2697. .fe = {{
  2698. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  2699. .pid_filter_count = 32,
  2700. .pid_filter = stk70x0p_pid_filter,
  2701. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  2702. .frontend_attach = stk7070p_frontend_attach,
  2703. .tuner_attach = dib7070p_tuner_attach,
  2704. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  2705. }},
  2706. .size_of_priv = sizeof(struct dib0700_adapter_state),
  2707. },
  2708. },
  2709. .num_device_descs = 11,
  2710. .devices = {
  2711. { "DiBcom STK7070P reference design",
  2712. { &dib0700_usb_id_table[15], NULL },
  2713. { NULL },
  2714. },
  2715. { "Pinnacle PCTV DVB-T Flash Stick",
  2716. { &dib0700_usb_id_table[16], NULL },
  2717. { NULL },
  2718. },
  2719. { "Artec T14BR DVB-T",
  2720. { &dib0700_usb_id_table[22], NULL },
  2721. { NULL },
  2722. },
  2723. { "ASUS My Cinema U3100 Mini DVBT Tuner",
  2724. { &dib0700_usb_id_table[24], NULL },
  2725. { NULL },
  2726. },
  2727. { "Hauppauge Nova-T Stick",
  2728. { &dib0700_usb_id_table[25], NULL },
  2729. { NULL },
  2730. },
  2731. { "Hauppauge Nova-T MyTV.t",
  2732. { &dib0700_usb_id_table[26], NULL },
  2733. { NULL },
  2734. },
  2735. { "Pinnacle PCTV 72e",
  2736. { &dib0700_usb_id_table[29], NULL },
  2737. { NULL },
  2738. },
  2739. { "Pinnacle PCTV 73e",
  2740. { &dib0700_usb_id_table[30], NULL },
  2741. { NULL },
  2742. },
  2743. { "Elgato EyeTV DTT",
  2744. { &dib0700_usb_id_table[49], NULL },
  2745. { NULL },
  2746. },
  2747. { "Yuan PD378S",
  2748. { &dib0700_usb_id_table[45], NULL },
  2749. { NULL },
  2750. },
  2751. { "Elgato EyeTV Dtt Dlx PD378S",
  2752. { &dib0700_usb_id_table[50], NULL },
  2753. { NULL },
  2754. },
  2755. },
  2756. .rc.core = {
  2757. .rc_interval = DEFAULT_RC_INTERVAL,
  2758. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  2759. .module_name = "dib0700",
  2760. .rc_query = dib0700_rc_query_old_firmware,
  2761. .allowed_protos = RC_TYPE_RC5 |
  2762. RC_TYPE_RC6 |
  2763. RC_TYPE_NEC,
  2764. .change_protocol = dib0700_change_protocol,
  2765. },
  2766. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  2767. .num_adapters = 1,
  2768. .adapter = {
  2769. {
  2770. .num_frontends = 1,
  2771. .fe = {{
  2772. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  2773. .pid_filter_count = 32,
  2774. .pid_filter = stk70x0p_pid_filter,
  2775. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  2776. .frontend_attach = stk7070p_frontend_attach,
  2777. .tuner_attach = dib7070p_tuner_attach,
  2778. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  2779. }},
  2780. .size_of_priv = sizeof(struct dib0700_adapter_state),
  2781. },
  2782. },
  2783. .num_device_descs = 3,
  2784. .devices = {
  2785. { "Pinnacle PCTV 73A",
  2786. { &dib0700_usb_id_table[56], NULL },
  2787. { NULL },
  2788. },
  2789. { "Pinnacle PCTV 73e SE",
  2790. { &dib0700_usb_id_table[57], &dib0700_usb_id_table[65], NULL },
  2791. { NULL },
  2792. },
  2793. { "Pinnacle PCTV 282e",
  2794. { &dib0700_usb_id_table[58], &dib0700_usb_id_table[66], NULL },
  2795. { NULL },
  2796. },
  2797. },
  2798. .rc.core = {
  2799. .rc_interval = DEFAULT_RC_INTERVAL,
  2800. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  2801. .module_name = "dib0700",
  2802. .rc_query = dib0700_rc_query_old_firmware,
  2803. .allowed_protos = RC_TYPE_RC5 |
  2804. RC_TYPE_RC6 |
  2805. RC_TYPE_NEC,
  2806. .change_protocol = dib0700_change_protocol,
  2807. },
  2808. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  2809. .num_adapters = 2,
  2810. .adapter = {
  2811. {
  2812. .num_frontends = 1,
  2813. .fe = {{
  2814. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  2815. .pid_filter_count = 32,
  2816. .pid_filter = stk70x0p_pid_filter,
  2817. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  2818. .frontend_attach = stk7070pd_frontend_attach0,
  2819. .tuner_attach = dib7070p_tuner_attach,
  2820. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  2821. }},
  2822. .size_of_priv = sizeof(struct dib0700_adapter_state),
  2823. }, {
  2824. .num_frontends = 1,
  2825. .fe = {{
  2826. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  2827. .pid_filter_count = 32,
  2828. .pid_filter = stk70x0p_pid_filter,
  2829. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  2830. .frontend_attach = stk7070pd_frontend_attach1,
  2831. .tuner_attach = dib7070p_tuner_attach,
  2832. DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
  2833. }},
  2834. .size_of_priv = sizeof(struct dib0700_adapter_state),
  2835. }
  2836. },
  2837. .num_device_descs = 6,
  2838. .devices = {
  2839. { "DiBcom STK7070PD reference design",
  2840. { &dib0700_usb_id_table[17], NULL },
  2841. { NULL },
  2842. },
  2843. { "Pinnacle PCTV Dual DVB-T Diversity Stick",
  2844. { &dib0700_usb_id_table[18], NULL },
  2845. { NULL },
  2846. },
  2847. { "Hauppauge Nova-TD Stick (52009)",
  2848. { &dib0700_usb_id_table[35], NULL },
  2849. { NULL },
  2850. },
  2851. { "Hauppauge Nova-TD-500 (84xxx)",
  2852. { &dib0700_usb_id_table[36], NULL },
  2853. { NULL },
  2854. },
  2855. { "Terratec Cinergy DT USB XS Diversity/ T5",
  2856. { &dib0700_usb_id_table[43],
  2857. &dib0700_usb_id_table[53], NULL},
  2858. { NULL },
  2859. },
  2860. { "Sony PlayTV",
  2861. { &dib0700_usb_id_table[44], NULL },
  2862. { NULL },
  2863. },
  2864. },
  2865. .rc.core = {
  2866. .rc_interval = DEFAULT_RC_INTERVAL,
  2867. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  2868. .module_name = "dib0700",
  2869. .rc_query = dib0700_rc_query_old_firmware,
  2870. .allowed_protos = RC_TYPE_RC5 |
  2871. RC_TYPE_RC6 |
  2872. RC_TYPE_NEC,
  2873. .change_protocol = dib0700_change_protocol,
  2874. },
  2875. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  2876. .num_adapters = 2,
  2877. .adapter = {
  2878. {
  2879. .num_frontends = 1,
  2880. .fe = {{
  2881. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  2882. .pid_filter_count = 32,
  2883. .pid_filter = stk70x0p_pid_filter,
  2884. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  2885. .frontend_attach = stk7070pd_frontend_attach0,
  2886. .tuner_attach = dib7070p_tuner_attach,
  2887. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  2888. }},
  2889. .size_of_priv = sizeof(struct dib0700_adapter_state),
  2890. }, {
  2891. .num_frontends = 1,
  2892. .fe = {{
  2893. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  2894. .pid_filter_count = 32,
  2895. .pid_filter = stk70x0p_pid_filter,
  2896. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  2897. .frontend_attach = stk7070pd_frontend_attach1,
  2898. .tuner_attach = dib7070p_tuner_attach,
  2899. DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
  2900. }},
  2901. .size_of_priv = sizeof(struct dib0700_adapter_state),
  2902. }
  2903. },
  2904. .num_device_descs = 1,
  2905. .devices = {
  2906. { "Elgato EyeTV Diversity",
  2907. { &dib0700_usb_id_table[68], NULL },
  2908. { NULL },
  2909. },
  2910. },
  2911. .rc.core = {
  2912. .rc_interval = DEFAULT_RC_INTERVAL,
  2913. .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
  2914. .module_name = "dib0700",
  2915. .rc_query = dib0700_rc_query_old_firmware,
  2916. .allowed_protos = RC_TYPE_RC5 |
  2917. RC_TYPE_RC6 |
  2918. RC_TYPE_NEC,
  2919. .change_protocol = dib0700_change_protocol,
  2920. },
  2921. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  2922. .num_adapters = 1,
  2923. .adapter = {
  2924. {
  2925. .num_frontends = 1,
  2926. .fe = {{
  2927. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  2928. .pid_filter_count = 32,
  2929. .pid_filter = stk70x0p_pid_filter,
  2930. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  2931. .frontend_attach = stk7700ph_frontend_attach,
  2932. .tuner_attach = stk7700ph_tuner_attach,
  2933. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  2934. }},
  2935. .size_of_priv = sizeof(struct
  2936. dib0700_adapter_state),
  2937. },
  2938. },
  2939. .num_device_descs = 9,
  2940. .devices = {
  2941. { "Terratec Cinergy HT USB XE",
  2942. { &dib0700_usb_id_table[27], NULL },
  2943. { NULL },
  2944. },
  2945. { "Pinnacle Expresscard 320cx",
  2946. { &dib0700_usb_id_table[28], NULL },
  2947. { NULL },
  2948. },
  2949. { "Terratec Cinergy HT Express",
  2950. { &dib0700_usb_id_table[32], NULL },
  2951. { NULL },
  2952. },
  2953. { "Gigabyte U8000-RH",
  2954. { &dib0700_usb_id_table[37], NULL },
  2955. { NULL },
  2956. },
  2957. { "YUAN High-Tech STK7700PH",
  2958. { &dib0700_usb_id_table[38], NULL },
  2959. { NULL },
  2960. },
  2961. { "Asus My Cinema-U3000Hybrid",
  2962. { &dib0700_usb_id_table[39], NULL },
  2963. { NULL },
  2964. },
  2965. { "YUAN High-Tech MC770",
  2966. { &dib0700_usb_id_table[48], NULL },
  2967. { NULL },
  2968. },
  2969. { "Leadtek WinFast DTV Dongle H",
  2970. { &dib0700_usb_id_table[51], NULL },
  2971. { NULL },
  2972. },
  2973. { "YUAN High-Tech STK7700D",
  2974. { &dib0700_usb_id_table[54], NULL },
  2975. { NULL },
  2976. },
  2977. },
  2978. .rc.core = {
  2979. .rc_interval = DEFAULT_RC_INTERVAL,
  2980. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  2981. .module_name = "dib0700",
  2982. .rc_query = dib0700_rc_query_old_firmware,
  2983. .allowed_protos = RC_TYPE_RC5 |
  2984. RC_TYPE_RC6 |
  2985. RC_TYPE_NEC,
  2986. .change_protocol = dib0700_change_protocol,
  2987. },
  2988. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  2989. .num_adapters = 1,
  2990. .adapter = {
  2991. {
  2992. .num_frontends = 1,
  2993. .fe = {{
  2994. .frontend_attach = s5h1411_frontend_attach,
  2995. .tuner_attach = xc5000_tuner_attach,
  2996. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  2997. }},
  2998. .size_of_priv = sizeof(struct
  2999. dib0700_adapter_state),
  3000. },
  3001. },
  3002. .num_device_descs = 2,
  3003. .devices = {
  3004. { "Pinnacle PCTV HD Pro USB Stick",
  3005. { &dib0700_usb_id_table[40], NULL },
  3006. { NULL },
  3007. },
  3008. { "Pinnacle PCTV HD USB Stick",
  3009. { &dib0700_usb_id_table[41], NULL },
  3010. { NULL },
  3011. },
  3012. },
  3013. .rc.core = {
  3014. .rc_interval = DEFAULT_RC_INTERVAL,
  3015. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3016. .module_name = "dib0700",
  3017. .rc_query = dib0700_rc_query_old_firmware,
  3018. .allowed_protos = RC_TYPE_RC5 |
  3019. RC_TYPE_RC6 |
  3020. RC_TYPE_NEC,
  3021. .change_protocol = dib0700_change_protocol,
  3022. },
  3023. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3024. .num_adapters = 1,
  3025. .adapter = {
  3026. {
  3027. .num_frontends = 1,
  3028. .fe = {{
  3029. .frontend_attach = lgdt3305_frontend_attach,
  3030. .tuner_attach = mxl5007t_tuner_attach,
  3031. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3032. }},
  3033. .size_of_priv = sizeof(struct
  3034. dib0700_adapter_state),
  3035. },
  3036. },
  3037. .num_device_descs = 2,
  3038. .devices = {
  3039. { "Hauppauge ATSC MiniCard (B200)",
  3040. { &dib0700_usb_id_table[46], NULL },
  3041. { NULL },
  3042. },
  3043. { "Hauppauge ATSC MiniCard (B210)",
  3044. { &dib0700_usb_id_table[47], NULL },
  3045. { NULL },
  3046. },
  3047. },
  3048. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3049. .num_adapters = 1,
  3050. .adapter = {
  3051. {
  3052. .num_frontends = 1,
  3053. .fe = {{
  3054. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3055. .pid_filter_count = 32,
  3056. .pid_filter = stk70x0p_pid_filter,
  3057. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  3058. .frontend_attach = stk7770p_frontend_attach,
  3059. .tuner_attach = dib7770p_tuner_attach,
  3060. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3061. }},
  3062. .size_of_priv =
  3063. sizeof(struct dib0700_adapter_state),
  3064. },
  3065. },
  3066. .num_device_descs = 4,
  3067. .devices = {
  3068. { "DiBcom STK7770P reference design",
  3069. { &dib0700_usb_id_table[59], NULL },
  3070. { NULL },
  3071. },
  3072. { "Terratec Cinergy T USB XXS (HD)/ T3",
  3073. { &dib0700_usb_id_table[33],
  3074. &dib0700_usb_id_table[52],
  3075. &dib0700_usb_id_table[60], NULL},
  3076. { NULL },
  3077. },
  3078. { "TechniSat AirStar TeleStick 2",
  3079. { &dib0700_usb_id_table[74], NULL },
  3080. { NULL },
  3081. },
  3082. { "Medion CTX1921 DVB-T USB",
  3083. { &dib0700_usb_id_table[75], NULL },
  3084. { NULL },
  3085. },
  3086. },
  3087. .rc.core = {
  3088. .rc_interval = DEFAULT_RC_INTERVAL,
  3089. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3090. .module_name = "dib0700",
  3091. .rc_query = dib0700_rc_query_old_firmware,
  3092. .allowed_protos = RC_TYPE_RC5 |
  3093. RC_TYPE_RC6 |
  3094. RC_TYPE_NEC,
  3095. .change_protocol = dib0700_change_protocol,
  3096. },
  3097. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3098. .num_adapters = 1,
  3099. .adapter = {
  3100. {
  3101. .num_frontends = 1,
  3102. .fe = {{
  3103. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3104. .pid_filter_count = 32,
  3105. .pid_filter = stk80xx_pid_filter,
  3106. .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
  3107. .frontend_attach = stk807x_frontend_attach,
  3108. .tuner_attach = dib807x_tuner_attach,
  3109. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3110. }},
  3111. .size_of_priv =
  3112. sizeof(struct dib0700_adapter_state),
  3113. },
  3114. },
  3115. .num_device_descs = 3,
  3116. .devices = {
  3117. { "DiBcom STK807xP reference design",
  3118. { &dib0700_usb_id_table[62], NULL },
  3119. { NULL },
  3120. },
  3121. { "Prolink Pixelview SBTVD",
  3122. { &dib0700_usb_id_table[63], NULL },
  3123. { NULL },
  3124. },
  3125. { "EvolutePC TVWay+",
  3126. { &dib0700_usb_id_table[64], NULL },
  3127. { NULL },
  3128. },
  3129. },
  3130. .rc.core = {
  3131. .rc_interval = DEFAULT_RC_INTERVAL,
  3132. .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
  3133. .module_name = "dib0700",
  3134. .rc_query = dib0700_rc_query_old_firmware,
  3135. .allowed_protos = RC_TYPE_RC5 |
  3136. RC_TYPE_RC6 |
  3137. RC_TYPE_NEC,
  3138. .change_protocol = dib0700_change_protocol,
  3139. },
  3140. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3141. .num_adapters = 2,
  3142. .adapter = {
  3143. {
  3144. .num_frontends = 1,
  3145. .fe = {{
  3146. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3147. .pid_filter_count = 32,
  3148. .pid_filter = stk80xx_pid_filter,
  3149. .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
  3150. .frontend_attach = stk807xpvr_frontend_attach0,
  3151. .tuner_attach = dib807x_tuner_attach,
  3152. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3153. }},
  3154. .size_of_priv =
  3155. sizeof(struct dib0700_adapter_state),
  3156. },
  3157. {
  3158. .num_frontends = 1,
  3159. .fe = {{
  3160. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3161. .pid_filter_count = 32,
  3162. .pid_filter = stk80xx_pid_filter,
  3163. .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
  3164. .frontend_attach = stk807xpvr_frontend_attach1,
  3165. .tuner_attach = dib807x_tuner_attach,
  3166. DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
  3167. }},
  3168. .size_of_priv =
  3169. sizeof(struct dib0700_adapter_state),
  3170. },
  3171. },
  3172. .num_device_descs = 1,
  3173. .devices = {
  3174. { "DiBcom STK807xPVR reference design",
  3175. { &dib0700_usb_id_table[61], NULL },
  3176. { NULL },
  3177. },
  3178. },
  3179. .rc.core = {
  3180. .rc_interval = DEFAULT_RC_INTERVAL,
  3181. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3182. .module_name = "dib0700",
  3183. .rc_query = dib0700_rc_query_old_firmware,
  3184. .allowed_protos = RC_TYPE_RC5 |
  3185. RC_TYPE_RC6 |
  3186. RC_TYPE_NEC,
  3187. .change_protocol = dib0700_change_protocol,
  3188. },
  3189. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3190. .num_adapters = 1,
  3191. .adapter = {
  3192. {
  3193. .num_frontends = 1,
  3194. .fe = {{
  3195. .caps = DVB_USB_ADAP_HAS_PID_FILTER |
  3196. DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3197. .pid_filter_count = 32,
  3198. .pid_filter = stk80xx_pid_filter,
  3199. .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
  3200. .frontend_attach = stk809x_frontend_attach,
  3201. .tuner_attach = dib809x_tuner_attach,
  3202. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3203. }},
  3204. .size_of_priv =
  3205. sizeof(struct dib0700_adapter_state),
  3206. },
  3207. },
  3208. .num_device_descs = 1,
  3209. .devices = {
  3210. { "DiBcom STK8096GP reference design",
  3211. { &dib0700_usb_id_table[67], NULL },
  3212. { NULL },
  3213. },
  3214. },
  3215. .rc.core = {
  3216. .rc_interval = DEFAULT_RC_INTERVAL,
  3217. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3218. .module_name = "dib0700",
  3219. .rc_query = dib0700_rc_query_old_firmware,
  3220. .allowed_protos = RC_TYPE_RC5 |
  3221. RC_TYPE_RC6 |
  3222. RC_TYPE_NEC,
  3223. .change_protocol = dib0700_change_protocol,
  3224. },
  3225. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3226. .num_adapters = 1,
  3227. .adapter = {
  3228. {
  3229. .num_frontends = 1,
  3230. .fe = {{
  3231. .caps = DVB_USB_ADAP_HAS_PID_FILTER |
  3232. DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3233. .pid_filter_count = 32,
  3234. .pid_filter = dib90x0_pid_filter,
  3235. .pid_filter_ctrl = dib90x0_pid_filter_ctrl,
  3236. .frontend_attach = stk9090m_frontend_attach,
  3237. .tuner_attach = dib9090_tuner_attach,
  3238. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3239. }},
  3240. .size_of_priv =
  3241. sizeof(struct dib0700_adapter_state),
  3242. },
  3243. },
  3244. .num_device_descs = 1,
  3245. .devices = {
  3246. { "DiBcom STK9090M reference design",
  3247. { &dib0700_usb_id_table[69], NULL },
  3248. { NULL },
  3249. },
  3250. },
  3251. .rc.core = {
  3252. .rc_interval = DEFAULT_RC_INTERVAL,
  3253. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3254. .module_name = "dib0700",
  3255. .rc_query = dib0700_rc_query_old_firmware,
  3256. .allowed_protos = RC_TYPE_RC5 |
  3257. RC_TYPE_RC6 |
  3258. RC_TYPE_NEC,
  3259. .change_protocol = dib0700_change_protocol,
  3260. },
  3261. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3262. .num_adapters = 1,
  3263. .adapter = {
  3264. {
  3265. .num_frontends = 1,
  3266. .fe = {{
  3267. .caps = DVB_USB_ADAP_HAS_PID_FILTER |
  3268. DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3269. .pid_filter_count = 32,
  3270. .pid_filter = stk80xx_pid_filter,
  3271. .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
  3272. .frontend_attach = nim8096md_frontend_attach,
  3273. .tuner_attach = nim8096md_tuner_attach,
  3274. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3275. }},
  3276. .size_of_priv =
  3277. sizeof(struct dib0700_adapter_state),
  3278. },
  3279. },
  3280. .num_device_descs = 1,
  3281. .devices = {
  3282. { "DiBcom NIM8096MD reference design",
  3283. { &dib0700_usb_id_table[70], NULL },
  3284. { NULL },
  3285. },
  3286. },
  3287. .rc.core = {
  3288. .rc_interval = DEFAULT_RC_INTERVAL,
  3289. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3290. .module_name = "dib0700",
  3291. .rc_query = dib0700_rc_query_old_firmware,
  3292. .allowed_protos = RC_TYPE_RC5 |
  3293. RC_TYPE_RC6 |
  3294. RC_TYPE_NEC,
  3295. .change_protocol = dib0700_change_protocol,
  3296. },
  3297. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3298. .num_adapters = 1,
  3299. .adapter = {
  3300. {
  3301. .num_frontends = 1,
  3302. .fe = {{
  3303. .caps = DVB_USB_ADAP_HAS_PID_FILTER |
  3304. DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3305. .pid_filter_count = 32,
  3306. .pid_filter = dib90x0_pid_filter,
  3307. .pid_filter_ctrl = dib90x0_pid_filter_ctrl,
  3308. .frontend_attach = nim9090md_frontend_attach,
  3309. .tuner_attach = nim9090md_tuner_attach,
  3310. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3311. }},
  3312. .size_of_priv =
  3313. sizeof(struct dib0700_adapter_state),
  3314. },
  3315. },
  3316. .num_device_descs = 1,
  3317. .devices = {
  3318. { "DiBcom NIM9090MD reference design",
  3319. { &dib0700_usb_id_table[71], NULL },
  3320. { NULL },
  3321. },
  3322. },
  3323. .rc.core = {
  3324. .rc_interval = DEFAULT_RC_INTERVAL,
  3325. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3326. .module_name = "dib0700",
  3327. .rc_query = dib0700_rc_query_old_firmware,
  3328. .allowed_protos = RC_TYPE_RC5 |
  3329. RC_TYPE_RC6 |
  3330. RC_TYPE_NEC,
  3331. .change_protocol = dib0700_change_protocol,
  3332. },
  3333. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3334. .num_adapters = 1,
  3335. .adapter = {
  3336. {
  3337. .num_frontends = 1,
  3338. .fe = {{
  3339. .caps = DVB_USB_ADAP_HAS_PID_FILTER |
  3340. DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3341. .pid_filter_count = 32,
  3342. .pid_filter = stk70x0p_pid_filter,
  3343. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  3344. .frontend_attach = nim7090_frontend_attach,
  3345. .tuner_attach = nim7090_tuner_attach,
  3346. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3347. }},
  3348. .size_of_priv =
  3349. sizeof(struct dib0700_adapter_state),
  3350. },
  3351. },
  3352. .num_device_descs = 1,
  3353. .devices = {
  3354. { "DiBcom NIM7090 reference design",
  3355. { &dib0700_usb_id_table[72], NULL },
  3356. { NULL },
  3357. },
  3358. },
  3359. .rc.core = {
  3360. .rc_interval = DEFAULT_RC_INTERVAL,
  3361. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3362. .module_name = "dib0700",
  3363. .rc_query = dib0700_rc_query_old_firmware,
  3364. .allowed_protos = RC_TYPE_RC5 |
  3365. RC_TYPE_RC6 |
  3366. RC_TYPE_NEC,
  3367. .change_protocol = dib0700_change_protocol,
  3368. },
  3369. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3370. .num_adapters = 2,
  3371. .adapter = {
  3372. {
  3373. .num_frontends = 1,
  3374. .fe = {{
  3375. .caps = DVB_USB_ADAP_HAS_PID_FILTER |
  3376. DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3377. .pid_filter_count = 32,
  3378. .pid_filter = stk70x0p_pid_filter,
  3379. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  3380. .frontend_attach = tfe7090pvr_frontend0_attach,
  3381. .tuner_attach = tfe7090pvr_tuner0_attach,
  3382. DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
  3383. }},
  3384. .size_of_priv =
  3385. sizeof(struct dib0700_adapter_state),
  3386. },
  3387. {
  3388. .num_frontends = 1,
  3389. .fe = {{
  3390. .caps = DVB_USB_ADAP_HAS_PID_FILTER |
  3391. DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3392. .pid_filter_count = 32,
  3393. .pid_filter = stk70x0p_pid_filter,
  3394. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  3395. .frontend_attach = tfe7090pvr_frontend1_attach,
  3396. .tuner_attach = tfe7090pvr_tuner1_attach,
  3397. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3398. }},
  3399. .size_of_priv =
  3400. sizeof(struct dib0700_adapter_state),
  3401. },
  3402. },
  3403. .num_device_descs = 1,
  3404. .devices = {
  3405. { "DiBcom TFE7090PVR reference design",
  3406. { &dib0700_usb_id_table[73], NULL },
  3407. { NULL },
  3408. },
  3409. },
  3410. .rc.core = {
  3411. .rc_interval = DEFAULT_RC_INTERVAL,
  3412. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3413. .module_name = "dib0700",
  3414. .rc_query = dib0700_rc_query_old_firmware,
  3415. .allowed_protos = RC_TYPE_RC5 |
  3416. RC_TYPE_RC6 |
  3417. RC_TYPE_NEC,
  3418. .change_protocol = dib0700_change_protocol,
  3419. },
  3420. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3421. .num_adapters = 1,
  3422. .adapter = {
  3423. {
  3424. .num_frontends = 1,
  3425. .fe = {{
  3426. .frontend_attach = pctv340e_frontend_attach,
  3427. .tuner_attach = xc4000_tuner_attach,
  3428. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3429. }},
  3430. .size_of_priv = sizeof(struct
  3431. dib0700_adapter_state),
  3432. },
  3433. },
  3434. .num_device_descs = 2,
  3435. .devices = {
  3436. { "Pinnacle PCTV 340e HD Pro USB Stick",
  3437. { &dib0700_usb_id_table[76], NULL },
  3438. { NULL },
  3439. },
  3440. { "Pinnacle PCTV Hybrid Stick Solo",
  3441. { &dib0700_usb_id_table[77], NULL },
  3442. { NULL },
  3443. },
  3444. },
  3445. .rc.core = {
  3446. .rc_interval = DEFAULT_RC_INTERVAL,
  3447. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3448. .module_name = "dib0700",
  3449. .rc_query = dib0700_rc_query_old_firmware,
  3450. .allowed_protos = RC_TYPE_RC5 |
  3451. RC_TYPE_RC6 |
  3452. RC_TYPE_NEC,
  3453. .change_protocol = dib0700_change_protocol,
  3454. },
  3455. },
  3456. };
  3457. int dib0700_device_count = ARRAY_SIZE(dib0700_devices);