dib0700_devices.c 124 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688
  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 dtv_frontend_properties *p = &fe->dtv_property_cache;
  670. struct dvb_usb_adapter *adap = fe->dvb->priv;
  671. struct dib0700_adapter_state *state = adap->priv;
  672. u16 offset;
  673. u8 band = BAND_OF_FREQUENCY(p->frequency/1000);
  674. switch (band) {
  675. case BAND_VHF: offset = 950; break;
  676. case BAND_UHF:
  677. default: offset = 550; break;
  678. }
  679. deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
  680. dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
  681. return state->set_param_save(fe, fep);
  682. }
  683. static int dib7770_set_param_override(struct dvb_frontend *fe,
  684. struct dvb_frontend_parameters *fep)
  685. {
  686. struct dtv_frontend_properties *p = &fe->dtv_property_cache;
  687. struct dvb_usb_adapter *adap = fe->dvb->priv;
  688. struct dib0700_adapter_state *state = adap->priv;
  689. u16 offset;
  690. u8 band = BAND_OF_FREQUENCY(p->frequency/1000);
  691. switch (band) {
  692. case BAND_VHF:
  693. dib7000p_set_gpio(fe, 0, 0, 1);
  694. offset = 850;
  695. break;
  696. case BAND_UHF:
  697. default:
  698. dib7000p_set_gpio(fe, 0, 0, 0);
  699. offset = 250;
  700. break;
  701. }
  702. deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
  703. dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
  704. return state->set_param_save(fe, fep);
  705. }
  706. static int dib7770p_tuner_attach(struct dvb_usb_adapter *adap)
  707. {
  708. struct dib0700_adapter_state *st = adap->priv;
  709. struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe_adap[0].fe,
  710. DIBX000_I2C_INTERFACE_TUNER, 1);
  711. if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c,
  712. &dib7770p_dib0070_config) == NULL)
  713. return -ENODEV;
  714. st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
  715. adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7770_set_param_override;
  716. return 0;
  717. }
  718. static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap)
  719. {
  720. struct dib0700_adapter_state *st = adap->priv;
  721. struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
  722. if (adap->id == 0) {
  723. if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL)
  724. return -ENODEV;
  725. } else {
  726. if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL)
  727. return -ENODEV;
  728. }
  729. st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
  730. adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7070_set_param_override;
  731. return 0;
  732. }
  733. static int stk7700p_pid_filter(struct dvb_usb_adapter *adapter, int index,
  734. u16 pid, int onoff)
  735. {
  736. struct dib0700_state *st = adapter->dev->priv;
  737. if (st->is_dib7000pc)
  738. return dib7000p_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
  739. return dib7000m_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
  740. }
  741. static int stk7700p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
  742. {
  743. struct dib0700_state *st = adapter->dev->priv;
  744. if (st->is_dib7000pc)
  745. return dib7000p_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
  746. return dib7000m_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
  747. }
  748. static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
  749. {
  750. return dib7000p_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
  751. }
  752. static int stk70x0p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
  753. {
  754. return dib7000p_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
  755. }
  756. static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
  757. 60000, 15000,
  758. 1, 20, 3, 1, 0,
  759. 0, 0, 1, 1, 2,
  760. (3 << 14) | (1 << 12) | (524 << 0),
  761. (0 << 25) | 0,
  762. 20452225,
  763. 12000000,
  764. };
  765. static struct dib7000p_config dib7070p_dib7000p_config = {
  766. .output_mpeg2_in_188_bytes = 1,
  767. .agc_config_count = 1,
  768. .agc = &dib7070_agc_config,
  769. .bw = &dib7070_bw_config_12_mhz,
  770. .tuner_is_baseband = 1,
  771. .spur_protect = 1,
  772. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  773. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  774. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  775. .hostbus_diversity = 1,
  776. };
  777. /* STK7070P */
  778. static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)
  779. {
  780. struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
  781. if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
  782. p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
  783. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
  784. else
  785. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  786. msleep(10);
  787. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  788. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  789. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  790. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  791. dib0700_ctrl_clock(adap->dev, 72, 1);
  792. msleep(10);
  793. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  794. msleep(10);
  795. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  796. if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
  797. &dib7070p_dib7000p_config) != 0) {
  798. err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
  799. __func__);
  800. return -ENODEV;
  801. }
  802. adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
  803. &dib7070p_dib7000p_config);
  804. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  805. }
  806. /* STK7770P */
  807. static struct dib7000p_config dib7770p_dib7000p_config = {
  808. .output_mpeg2_in_188_bytes = 1,
  809. .agc_config_count = 1,
  810. .agc = &dib7070_agc_config,
  811. .bw = &dib7070_bw_config_12_mhz,
  812. .tuner_is_baseband = 1,
  813. .spur_protect = 1,
  814. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  815. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  816. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  817. .hostbus_diversity = 1,
  818. .enable_current_mirror = 1,
  819. .disable_sample_and_hold = 0,
  820. };
  821. static int stk7770p_frontend_attach(struct dvb_usb_adapter *adap)
  822. {
  823. struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
  824. if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
  825. p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
  826. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
  827. else
  828. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  829. msleep(10);
  830. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  831. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  832. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  833. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  834. dib0700_ctrl_clock(adap->dev, 72, 1);
  835. msleep(10);
  836. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  837. msleep(10);
  838. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  839. if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
  840. &dib7770p_dib7000p_config) != 0) {
  841. err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
  842. __func__);
  843. return -ENODEV;
  844. }
  845. adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
  846. &dib7770p_dib7000p_config);
  847. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  848. }
  849. /* DIB807x generic */
  850. static struct dibx000_agc_config dib807x_agc_config[2] = {
  851. {
  852. BAND_VHF,
  853. /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
  854. * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
  855. * P_agc_inv_pwm2=0,P_agc_inh_dc_rv_est=0,
  856. * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
  857. * P_agc_write=0 */
  858. (0 << 15) | (0 << 14) | (7 << 11) | (0 << 10) | (0 << 9) |
  859. (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
  860. (0 << 0), /* setup*/
  861. 600, /* inv_gain*/
  862. 10, /* time_stabiliz*/
  863. 0, /* alpha_level*/
  864. 118, /* thlock*/
  865. 0, /* wbd_inv*/
  866. 3530, /* wbd_ref*/
  867. 1, /* wbd_sel*/
  868. 5, /* wbd_alpha*/
  869. 65535, /* agc1_max*/
  870. 0, /* agc1_min*/
  871. 65535, /* agc2_max*/
  872. 0, /* agc2_min*/
  873. 0, /* agc1_pt1*/
  874. 40, /* agc1_pt2*/
  875. 183, /* agc1_pt3*/
  876. 206, /* agc1_slope1*/
  877. 255, /* agc1_slope2*/
  878. 72, /* agc2_pt1*/
  879. 152, /* agc2_pt2*/
  880. 88, /* agc2_slope1*/
  881. 90, /* agc2_slope2*/
  882. 17, /* alpha_mant*/
  883. 27, /* alpha_exp*/
  884. 23, /* beta_mant*/
  885. 51, /* beta_exp*/
  886. 0, /* perform_agc_softsplit*/
  887. }, {
  888. BAND_UHF,
  889. /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
  890. * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
  891. * P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
  892. * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
  893. * P_agc_write=0 */
  894. (0 << 15) | (0 << 14) | (1 << 11) | (0 << 10) | (0 << 9) |
  895. (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
  896. (0 << 0), /* setup */
  897. 600, /* inv_gain*/
  898. 10, /* time_stabiliz*/
  899. 0, /* alpha_level*/
  900. 118, /* thlock*/
  901. 0, /* wbd_inv*/
  902. 3530, /* wbd_ref*/
  903. 1, /* wbd_sel*/
  904. 5, /* wbd_alpha*/
  905. 65535, /* agc1_max*/
  906. 0, /* agc1_min*/
  907. 65535, /* agc2_max*/
  908. 0, /* agc2_min*/
  909. 0, /* agc1_pt1*/
  910. 40, /* agc1_pt2*/
  911. 183, /* agc1_pt3*/
  912. 206, /* agc1_slope1*/
  913. 255, /* agc1_slope2*/
  914. 72, /* agc2_pt1*/
  915. 152, /* agc2_pt2*/
  916. 88, /* agc2_slope1*/
  917. 90, /* agc2_slope2*/
  918. 17, /* alpha_mant*/
  919. 27, /* alpha_exp*/
  920. 23, /* beta_mant*/
  921. 51, /* beta_exp*/
  922. 0, /* perform_agc_softsplit*/
  923. }
  924. };
  925. static struct dibx000_bandwidth_config dib807x_bw_config_12_mhz = {
  926. 60000, 15000, /* internal, sampling*/
  927. 1, 20, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass*/
  928. 0, 0, 1, 1, 2, /* misc: refdiv, bypclk_div, IO_CLK_en_core,
  929. ADClkSrc, modulo */
  930. (3 << 14) | (1 << 12) | (599 << 0), /* sad_cfg: refsel, sel, freq_15k*/
  931. (0 << 25) | 0, /* ifreq = 0.000000 MHz*/
  932. 18179755, /* timf*/
  933. 12000000, /* xtal_hz*/
  934. };
  935. static struct dib8000_config dib807x_dib8000_config[2] = {
  936. {
  937. .output_mpeg2_in_188_bytes = 1,
  938. .agc_config_count = 2,
  939. .agc = dib807x_agc_config,
  940. .pll = &dib807x_bw_config_12_mhz,
  941. .tuner_is_baseband = 1,
  942. .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
  943. .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
  944. .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
  945. .hostbus_diversity = 1,
  946. .div_cfg = 1,
  947. .agc_control = &dib0070_ctrl_agc_filter,
  948. .output_mode = OUTMODE_MPEG2_FIFO,
  949. .drives = 0x2d98,
  950. }, {
  951. .output_mpeg2_in_188_bytes = 1,
  952. .agc_config_count = 2,
  953. .agc = dib807x_agc_config,
  954. .pll = &dib807x_bw_config_12_mhz,
  955. .tuner_is_baseband = 1,
  956. .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
  957. .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
  958. .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
  959. .hostbus_diversity = 1,
  960. .agc_control = &dib0070_ctrl_agc_filter,
  961. .output_mode = OUTMODE_MPEG2_FIFO,
  962. .drives = 0x2d98,
  963. }
  964. };
  965. static int dib80xx_tuner_reset(struct dvb_frontend *fe, int onoff)
  966. {
  967. return dib8000_set_gpio(fe, 5, 0, !onoff);
  968. }
  969. static int dib80xx_tuner_sleep(struct dvb_frontend *fe, int onoff)
  970. {
  971. return dib8000_set_gpio(fe, 0, 0, onoff);
  972. }
  973. static const struct dib0070_wbd_gain_cfg dib8070_wbd_gain_cfg[] = {
  974. { 240, 7},
  975. { 0xffff, 6},
  976. };
  977. static struct dib0070_config dib807x_dib0070_config[2] = {
  978. {
  979. .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
  980. .reset = dib80xx_tuner_reset,
  981. .sleep = dib80xx_tuner_sleep,
  982. .clock_khz = 12000,
  983. .clock_pad_drive = 4,
  984. .vga_filter = 1,
  985. .force_crystal_mode = 1,
  986. .enable_third_order_filter = 1,
  987. .charge_pump = 0,
  988. .wbd_gain = dib8070_wbd_gain_cfg,
  989. .osc_buffer_state = 0,
  990. .freq_offset_khz_uhf = -100,
  991. .freq_offset_khz_vhf = -100,
  992. }, {
  993. .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
  994. .reset = dib80xx_tuner_reset,
  995. .sleep = dib80xx_tuner_sleep,
  996. .clock_khz = 12000,
  997. .clock_pad_drive = 2,
  998. .vga_filter = 1,
  999. .force_crystal_mode = 1,
  1000. .enable_third_order_filter = 1,
  1001. .charge_pump = 0,
  1002. .wbd_gain = dib8070_wbd_gain_cfg,
  1003. .osc_buffer_state = 0,
  1004. .freq_offset_khz_uhf = -25,
  1005. .freq_offset_khz_vhf = -25,
  1006. }
  1007. };
  1008. static int dib807x_set_param_override(struct dvb_frontend *fe,
  1009. struct dvb_frontend_parameters *fep)
  1010. {
  1011. struct dtv_frontend_properties *p = &fe->dtv_property_cache;
  1012. struct dvb_usb_adapter *adap = fe->dvb->priv;
  1013. struct dib0700_adapter_state *state = adap->priv;
  1014. u16 offset = dib0070_wbd_offset(fe);
  1015. u8 band = BAND_OF_FREQUENCY(p->frequency/1000);
  1016. switch (band) {
  1017. case BAND_VHF:
  1018. offset += 750;
  1019. break;
  1020. case BAND_UHF: /* fall-thru wanted */
  1021. default:
  1022. offset += 250; break;
  1023. }
  1024. deb_info("WBD for DiB8000: %d\n", offset);
  1025. dib8000_set_wbd_ref(fe, offset);
  1026. return state->set_param_save(fe, fep);
  1027. }
  1028. static int dib807x_tuner_attach(struct dvb_usb_adapter *adap)
  1029. {
  1030. struct dib0700_adapter_state *st = adap->priv;
  1031. struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe_adap[0].fe,
  1032. DIBX000_I2C_INTERFACE_TUNER, 1);
  1033. if (adap->id == 0) {
  1034. if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c,
  1035. &dib807x_dib0070_config[0]) == NULL)
  1036. return -ENODEV;
  1037. } else {
  1038. if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c,
  1039. &dib807x_dib0070_config[1]) == NULL)
  1040. return -ENODEV;
  1041. }
  1042. st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
  1043. adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib807x_set_param_override;
  1044. return 0;
  1045. }
  1046. static int stk80xx_pid_filter(struct dvb_usb_adapter *adapter, int index,
  1047. u16 pid, int onoff)
  1048. {
  1049. return dib8000_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
  1050. }
  1051. static int stk80xx_pid_filter_ctrl(struct dvb_usb_adapter *adapter,
  1052. int onoff)
  1053. {
  1054. return dib8000_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
  1055. }
  1056. /* STK807x */
  1057. static int stk807x_frontend_attach(struct dvb_usb_adapter *adap)
  1058. {
  1059. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  1060. msleep(10);
  1061. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  1062. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  1063. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  1064. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  1065. dib0700_ctrl_clock(adap->dev, 72, 1);
  1066. msleep(10);
  1067. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  1068. msleep(10);
  1069. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  1070. dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
  1071. 0x80, 0);
  1072. adap->fe_adap[0].fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
  1073. &dib807x_dib8000_config[0]);
  1074. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  1075. }
  1076. /* STK807xPVR */
  1077. static int stk807xpvr_frontend_attach0(struct dvb_usb_adapter *adap)
  1078. {
  1079. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
  1080. msleep(30);
  1081. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  1082. msleep(500);
  1083. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  1084. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  1085. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  1086. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  1087. dib0700_ctrl_clock(adap->dev, 72, 1);
  1088. msleep(10);
  1089. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  1090. msleep(10);
  1091. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  1092. /* initialize IC 0 */
  1093. dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x22, 0x80, 0);
  1094. adap->fe_adap[0].fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
  1095. &dib807x_dib8000_config[0]);
  1096. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  1097. }
  1098. static int stk807xpvr_frontend_attach1(struct dvb_usb_adapter *adap)
  1099. {
  1100. /* initialize IC 1 */
  1101. dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x12, 0x82, 0);
  1102. adap->fe_adap[0].fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x82,
  1103. &dib807x_dib8000_config[1]);
  1104. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  1105. }
  1106. /* STK8096GP */
  1107. static struct dibx000_agc_config dib8090_agc_config[2] = {
  1108. {
  1109. BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
  1110. /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
  1111. * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
  1112. * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
  1113. (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
  1114. | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
  1115. 787,
  1116. 10,
  1117. 0,
  1118. 118,
  1119. 0,
  1120. 3530,
  1121. 1,
  1122. 5,
  1123. 65535,
  1124. 0,
  1125. 65535,
  1126. 0,
  1127. 0,
  1128. 32,
  1129. 114,
  1130. 143,
  1131. 144,
  1132. 114,
  1133. 227,
  1134. 116,
  1135. 117,
  1136. 28,
  1137. 26,
  1138. 31,
  1139. 51,
  1140. 0,
  1141. },
  1142. {
  1143. BAND_CBAND,
  1144. /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
  1145. * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
  1146. * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
  1147. (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
  1148. | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
  1149. 787,
  1150. 10,
  1151. 0,
  1152. 118,
  1153. 0,
  1154. 3530,
  1155. 1,
  1156. 5,
  1157. 0,
  1158. 0,
  1159. 65535,
  1160. 0,
  1161. 0,
  1162. 32,
  1163. 114,
  1164. 143,
  1165. 144,
  1166. 114,
  1167. 227,
  1168. 116,
  1169. 117,
  1170. 28,
  1171. 26,
  1172. 31,
  1173. 51,
  1174. 0,
  1175. }
  1176. };
  1177. static struct dibx000_bandwidth_config dib8090_pll_config_12mhz = {
  1178. 54000, 13500,
  1179. 1, 18, 3, 1, 0,
  1180. 0, 0, 1, 1, 2,
  1181. (3 << 14) | (1 << 12) | (599 << 0),
  1182. (0 << 25) | 0,
  1183. 20199727,
  1184. 12000000,
  1185. };
  1186. static int dib8090_get_adc_power(struct dvb_frontend *fe)
  1187. {
  1188. return dib8000_get_adc_power(fe, 1);
  1189. }
  1190. static struct dib8000_config dib809x_dib8000_config[2] = {
  1191. {
  1192. .output_mpeg2_in_188_bytes = 1,
  1193. .agc_config_count = 2,
  1194. .agc = dib8090_agc_config,
  1195. .agc_control = dib0090_dcc_freq,
  1196. .pll = &dib8090_pll_config_12mhz,
  1197. .tuner_is_baseband = 1,
  1198. .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
  1199. .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
  1200. .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
  1201. .hostbus_diversity = 1,
  1202. .div_cfg = 0x31,
  1203. .output_mode = OUTMODE_MPEG2_FIFO,
  1204. .drives = 0x2d98,
  1205. .diversity_delay = 48,
  1206. .refclksel = 3,
  1207. }, {
  1208. .output_mpeg2_in_188_bytes = 1,
  1209. .agc_config_count = 2,
  1210. .agc = dib8090_agc_config,
  1211. .agc_control = dib0090_dcc_freq,
  1212. .pll = &dib8090_pll_config_12mhz,
  1213. .tuner_is_baseband = 1,
  1214. .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
  1215. .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
  1216. .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
  1217. .hostbus_diversity = 1,
  1218. .div_cfg = 0x31,
  1219. .output_mode = OUTMODE_DIVERSITY,
  1220. .drives = 0x2d08,
  1221. .diversity_delay = 1,
  1222. .refclksel = 3,
  1223. }
  1224. };
  1225. static struct dib0090_wbd_slope dib8090_wbd_table[] = {
  1226. /* max freq ; cold slope ; cold offset ; warm slope ; warm offset ; wbd gain */
  1227. { 120, 0, 500, 0, 500, 4 }, /* CBAND */
  1228. { 170, 0, 450, 0, 450, 4 }, /* CBAND */
  1229. { 380, 48, 373, 28, 259, 6 }, /* VHF */
  1230. { 860, 34, 700, 36, 616, 6 }, /* high UHF */
  1231. { 0xFFFF, 34, 700, 36, 616, 6 }, /* default */
  1232. };
  1233. static struct dib0090_config dib809x_dib0090_config = {
  1234. .io.pll_bypass = 1,
  1235. .io.pll_range = 1,
  1236. .io.pll_prediv = 1,
  1237. .io.pll_loopdiv = 20,
  1238. .io.adc_clock_ratio = 8,
  1239. .io.pll_int_loop_filt = 0,
  1240. .io.clock_khz = 12000,
  1241. .reset = dib80xx_tuner_reset,
  1242. .sleep = dib80xx_tuner_sleep,
  1243. .clkouttobamse = 1,
  1244. .analog_output = 1,
  1245. .i2c_address = DEFAULT_DIB0090_I2C_ADDRESS,
  1246. .use_pwm_agc = 1,
  1247. .clkoutdrive = 1,
  1248. .get_adc_power = dib8090_get_adc_power,
  1249. .freq_offset_khz_uhf = -63,
  1250. .freq_offset_khz_vhf = -143,
  1251. .wbd = dib8090_wbd_table,
  1252. .fref_clock_ratio = 6,
  1253. };
  1254. static int dib8096_set_param_override(struct dvb_frontend *fe,
  1255. struct dvb_frontend_parameters *fep)
  1256. {
  1257. struct dtv_frontend_properties *p = &fe->dtv_property_cache;
  1258. struct dvb_usb_adapter *adap = fe->dvb->priv;
  1259. struct dib0700_adapter_state *state = adap->priv;
  1260. u8 band = BAND_OF_FREQUENCY(p->frequency/1000);
  1261. u16 target;
  1262. int ret = 0;
  1263. enum frontend_tune_state tune_state = CT_SHUTDOWN;
  1264. u16 ltgain, rf_gain_limit;
  1265. ret = state->set_param_save(fe, fep);
  1266. if (ret < 0)
  1267. return ret;
  1268. target = (dib0090_get_wbd_target(fe) * 8 * 18 / 33 + 1) / 2;
  1269. dib8000_set_wbd_ref(fe, target);
  1270. if (band == BAND_CBAND) {
  1271. deb_info("tuning in CBAND - soft-AGC startup\n");
  1272. dib0090_set_tune_state(fe, CT_AGC_START);
  1273. do {
  1274. ret = dib0090_gain_control(fe);
  1275. msleep(ret);
  1276. tune_state = dib0090_get_tune_state(fe);
  1277. if (tune_state == CT_AGC_STEP_0)
  1278. dib8000_set_gpio(fe, 6, 0, 1);
  1279. else if (tune_state == CT_AGC_STEP_1) {
  1280. dib0090_get_current_gain(fe, NULL, NULL, &rf_gain_limit, &ltgain);
  1281. if (rf_gain_limit == 0)
  1282. dib8000_set_gpio(fe, 6, 0, 0);
  1283. }
  1284. } while (tune_state < CT_AGC_STOP);
  1285. dib0090_pwm_gain_reset(fe);
  1286. dib8000_pwm_agc_reset(fe);
  1287. dib8000_set_tune_state(fe, CT_DEMOD_START);
  1288. } else {
  1289. deb_info("not tuning in CBAND - standard AGC startup\n");
  1290. dib0090_pwm_gain_reset(fe);
  1291. }
  1292. return 0;
  1293. }
  1294. static int dib809x_tuner_attach(struct dvb_usb_adapter *adap)
  1295. {
  1296. struct dib0700_adapter_state *st = adap->priv;
  1297. struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
  1298. if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &dib809x_dib0090_config) == NULL)
  1299. return -ENODEV;
  1300. st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
  1301. adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096_set_param_override;
  1302. return 0;
  1303. }
  1304. static int stk809x_frontend_attach(struct dvb_usb_adapter *adap)
  1305. {
  1306. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  1307. msleep(10);
  1308. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  1309. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  1310. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  1311. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  1312. dib0700_ctrl_clock(adap->dev, 72, 1);
  1313. msleep(10);
  1314. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  1315. msleep(10);
  1316. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  1317. dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, 0x80, 0);
  1318. adap->fe_adap[0].fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]);
  1319. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  1320. }
  1321. static int nim8096md_tuner_attach(struct dvb_usb_adapter *adap)
  1322. {
  1323. struct dib0700_adapter_state *st = adap->priv;
  1324. struct i2c_adapter *tun_i2c;
  1325. struct dvb_frontend *fe_slave = dib8000_get_slave_frontend(adap->fe_adap[0].fe, 1);
  1326. if (fe_slave) {
  1327. tun_i2c = dib8000_get_i2c_master(fe_slave, DIBX000_I2C_INTERFACE_TUNER, 1);
  1328. if (dvb_attach(dib0090_register, fe_slave, tun_i2c, &dib809x_dib0090_config) == NULL)
  1329. return -ENODEV;
  1330. fe_slave->dvb = adap->fe_adap[0].fe->dvb;
  1331. fe_slave->ops.tuner_ops.set_params = dib8096_set_param_override;
  1332. }
  1333. tun_i2c = dib8000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
  1334. if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &dib809x_dib0090_config) == NULL)
  1335. return -ENODEV;
  1336. st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
  1337. adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096_set_param_override;
  1338. return 0;
  1339. }
  1340. static int nim8096md_frontend_attach(struct dvb_usb_adapter *adap)
  1341. {
  1342. struct dvb_frontend *fe_slave;
  1343. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
  1344. msleep(20);
  1345. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  1346. msleep(1000);
  1347. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  1348. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  1349. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  1350. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  1351. dib0700_ctrl_clock(adap->dev, 72, 1);
  1352. msleep(20);
  1353. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  1354. msleep(20);
  1355. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  1356. dib8000_i2c_enumeration(&adap->dev->i2c_adap, 2, 18, 0x80, 0);
  1357. adap->fe_adap[0].fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]);
  1358. if (adap->fe_adap[0].fe == NULL)
  1359. return -ENODEV;
  1360. fe_slave = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x82, &dib809x_dib8000_config[1]);
  1361. dib8000_set_slave_frontend(adap->fe_adap[0].fe, fe_slave);
  1362. return fe_slave == NULL ? -ENODEV : 0;
  1363. }
  1364. /* TFE8096P */
  1365. static struct dibx000_agc_config dib8096p_agc_config[2] = {
  1366. {
  1367. .band_caps = BAND_UHF,
  1368. /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
  1369. P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
  1370. P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
  1371. P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
  1372. P_agc_write=0 */
  1373. .setup = (0 << 15) | (0 << 14) | (5 << 11)
  1374. | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5)
  1375. | (0 << 4) | (5 << 1) | (0 << 0),
  1376. .inv_gain = 684,
  1377. .time_stabiliz = 10,
  1378. .alpha_level = 0,
  1379. .thlock = 118,
  1380. .wbd_inv = 0,
  1381. .wbd_ref = 1200,
  1382. .wbd_sel = 3,
  1383. .wbd_alpha = 5,
  1384. .agc1_max = 65535,
  1385. .agc1_min = 0,
  1386. .agc2_max = 32767,
  1387. .agc2_min = 0,
  1388. .agc1_pt1 = 0,
  1389. .agc1_pt2 = 0,
  1390. .agc1_pt3 = 105,
  1391. .agc1_slope1 = 0,
  1392. .agc1_slope2 = 156,
  1393. .agc2_pt1 = 105,
  1394. .agc2_pt2 = 255,
  1395. .agc2_slope1 = 54,
  1396. .agc2_slope2 = 0,
  1397. .alpha_mant = 28,
  1398. .alpha_exp = 26,
  1399. .beta_mant = 31,
  1400. .beta_exp = 51,
  1401. .perform_agc_softsplit = 0,
  1402. } , {
  1403. .band_caps = BAND_FM | BAND_VHF | BAND_CBAND,
  1404. /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
  1405. P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
  1406. P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
  1407. P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
  1408. P_agc_write=0 */
  1409. .setup = (0 << 15) | (0 << 14) | (5 << 11)
  1410. | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5)
  1411. | (0 << 4) | (5 << 1) | (0 << 0),
  1412. .inv_gain = 732,
  1413. .time_stabiliz = 10,
  1414. .alpha_level = 0,
  1415. .thlock = 118,
  1416. .wbd_inv = 0,
  1417. .wbd_ref = 1200,
  1418. .wbd_sel = 3,
  1419. .wbd_alpha = 5,
  1420. .agc1_max = 65535,
  1421. .agc1_min = 0,
  1422. .agc2_max = 32767,
  1423. .agc2_min = 0,
  1424. .agc1_pt1 = 0,
  1425. .agc1_pt2 = 0,
  1426. .agc1_pt3 = 98,
  1427. .agc1_slope1 = 0,
  1428. .agc1_slope2 = 167,
  1429. .agc2_pt1 = 98,
  1430. .agc2_pt2 = 255,
  1431. .agc2_slope1 = 52,
  1432. .agc2_slope2 = 0,
  1433. .alpha_mant = 28,
  1434. .alpha_exp = 26,
  1435. .beta_mant = 31,
  1436. .beta_exp = 51,
  1437. .perform_agc_softsplit = 0,
  1438. }
  1439. };
  1440. static struct dibx000_bandwidth_config dib8096p_clock_config_12_mhz = {
  1441. 108000, 13500,
  1442. 1, 9, 1, 0, 0,
  1443. 0, 0, 0, 0, 2,
  1444. (3 << 14) | (1 << 12) | (524 << 0),
  1445. (0 << 25) | 0,
  1446. 20199729,
  1447. 12000000,
  1448. };
  1449. static struct dib8000_config tfe8096p_dib8000_config = {
  1450. .output_mpeg2_in_188_bytes = 1,
  1451. .hostbus_diversity = 1,
  1452. .update_lna = NULL,
  1453. .agc_config_count = 2,
  1454. .agc = dib8096p_agc_config,
  1455. .pll = &dib8096p_clock_config_12_mhz,
  1456. .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
  1457. .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
  1458. .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
  1459. .agc_control = NULL,
  1460. .diversity_delay = 48,
  1461. .output_mode = OUTMODE_MPEG2_FIFO,
  1462. .enMpegOutput = 1,
  1463. };
  1464. static struct dib0090_wbd_slope dib8096p_wbd_table[] = {
  1465. { 380, 81, 850, 64, 540, 4},
  1466. { 860, 51, 866, 21, 375, 4},
  1467. {1700, 0, 250, 0, 100, 6},
  1468. {2600, 0, 250, 0, 100, 6},
  1469. { 0xFFFF, 0, 0, 0, 0, 0},
  1470. };
  1471. static const struct dib0090_config tfe8096p_dib0090_config = {
  1472. .io.clock_khz = 12000,
  1473. .io.pll_bypass = 0,
  1474. .io.pll_range = 0,
  1475. .io.pll_prediv = 3,
  1476. .io.pll_loopdiv = 6,
  1477. .io.adc_clock_ratio = 0,
  1478. .io.pll_int_loop_filt = 0,
  1479. .reset = dib8096p_tuner_sleep,
  1480. .sleep = dib8096p_tuner_sleep,
  1481. .freq_offset_khz_uhf = -143,
  1482. .freq_offset_khz_vhf = -143,
  1483. .get_adc_power = dib8090_get_adc_power,
  1484. .clkouttobamse = 1,
  1485. .analog_output = 0,
  1486. .wbd_vhf_offset = 0,
  1487. .wbd_cband_offset = 0,
  1488. .use_pwm_agc = 1,
  1489. .clkoutdrive = 0,
  1490. .fref_clock_ratio = 1,
  1491. .wbd = dib8096p_wbd_table,
  1492. .ls_cfg_pad_drv = 0,
  1493. .data_tx_drv = 0,
  1494. .low_if = NULL,
  1495. .in_soc = 1,
  1496. .force_cband_input = 0,
  1497. };
  1498. struct dibx090p_adc {
  1499. u32 freq; /* RF freq MHz */
  1500. u32 timf; /* New Timf */
  1501. u32 pll_loopdiv; /* New prediv */
  1502. u32 pll_prediv; /* New loopdiv */
  1503. };
  1504. struct dibx090p_adc dib8090p_adc_tab[] = {
  1505. { 50000, 17043521, 16, 3}, /* 64 MHz */
  1506. {878000, 20199729, 9, 1}, /* 60 MHz */
  1507. {0xffffffff, 0, 0, 0}, /* 60 MHz */
  1508. };
  1509. static int dib8096p_agc_startup(struct dvb_frontend *fe,
  1510. struct dvb_frontend_parameters *fep)
  1511. {
  1512. struct dtv_frontend_properties *p = &fe->dtv_property_cache;
  1513. struct dvb_usb_adapter *adap = fe->dvb->priv;
  1514. struct dib0700_adapter_state *state = adap->priv;
  1515. struct dibx000_bandwidth_config pll;
  1516. u16 target;
  1517. int better_sampling_freq = 0, ret;
  1518. struct dibx090p_adc *adc_table = &dib8090p_adc_tab[0];
  1519. ret = state->set_param_save(fe, fep);
  1520. if (ret < 0)
  1521. return ret;
  1522. memset(&pll, 0, sizeof(struct dibx000_bandwidth_config));
  1523. dib0090_pwm_gain_reset(fe);
  1524. /* dib0090_get_wbd_target is returning any possible
  1525. temperature compensated wbd-target */
  1526. target = (dib0090_get_wbd_target(fe) * 8 + 1) / 2;
  1527. dib8000_set_wbd_ref(fe, target);
  1528. while (p->frequency / 1000 > adc_table->freq) {
  1529. better_sampling_freq = 1;
  1530. adc_table++;
  1531. }
  1532. if ((adc_table->freq != 0xffffffff) && better_sampling_freq) {
  1533. pll.pll_ratio = adc_table->pll_loopdiv;
  1534. pll.pll_prediv = adc_table->pll_prediv;
  1535. dib8000_update_pll(fe, &pll);
  1536. dib8000_ctrl_timf(fe, DEMOD_TIMF_SET, adc_table->timf);
  1537. }
  1538. return 0;
  1539. }
  1540. static int tfe8096p_frontend_attach(struct dvb_usb_adapter *adap)
  1541. {
  1542. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  1543. msleep(20);
  1544. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  1545. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  1546. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  1547. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  1548. dib0700_ctrl_clock(adap->dev, 72, 1);
  1549. msleep(20);
  1550. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  1551. msleep(20);
  1552. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  1553. dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, 0x80, 1);
  1554. adap->fe_adap[0].fe = dvb_attach(dib8000_attach,
  1555. &adap->dev->i2c_adap, 0x80, &tfe8096p_dib8000_config);
  1556. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  1557. }
  1558. static int tfe8096p_tuner_attach(struct dvb_usb_adapter *adap)
  1559. {
  1560. struct dib0700_adapter_state *st = adap->priv;
  1561. struct i2c_adapter *tun_i2c = dib8096p_get_i2c_tuner(adap->fe_adap[0].fe);
  1562. if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c,
  1563. &tfe8096p_dib0090_config) == NULL)
  1564. return -ENODEV;
  1565. dib8000_set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
  1566. st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
  1567. adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096p_agc_startup;
  1568. return 0;
  1569. }
  1570. /* STK9090M */
  1571. static int dib90x0_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
  1572. {
  1573. return dib9000_fw_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
  1574. }
  1575. static int dib90x0_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
  1576. {
  1577. return dib9000_fw_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
  1578. }
  1579. static int dib90x0_tuner_reset(struct dvb_frontend *fe, int onoff)
  1580. {
  1581. return dib9000_set_gpio(fe, 5, 0, !onoff);
  1582. }
  1583. static int dib90x0_tuner_sleep(struct dvb_frontend *fe, int onoff)
  1584. {
  1585. return dib9000_set_gpio(fe, 0, 0, onoff);
  1586. }
  1587. static int dib01x0_pmu_update(struct i2c_adapter *i2c, u16 *data, u8 len)
  1588. {
  1589. u8 wb[4] = { 0xc >> 8, 0xc & 0xff, 0, 0 };
  1590. u8 rb[2];
  1591. struct i2c_msg msg[2] = {
  1592. {.addr = 0x1e >> 1, .flags = 0, .buf = wb, .len = 2},
  1593. {.addr = 0x1e >> 1, .flags = I2C_M_RD, .buf = rb, .len = 2},
  1594. };
  1595. u8 index_data;
  1596. dibx000_i2c_set_speed(i2c, 250);
  1597. if (i2c_transfer(i2c, msg, 2) != 2)
  1598. return -EIO;
  1599. switch (rb[0] << 8 | rb[1]) {
  1600. case 0:
  1601. deb_info("Found DiB0170 rev1: This version of DiB0170 is not supported any longer.\n");
  1602. return -EIO;
  1603. case 1:
  1604. deb_info("Found DiB0170 rev2");
  1605. break;
  1606. case 2:
  1607. deb_info("Found DiB0190 rev2");
  1608. break;
  1609. default:
  1610. deb_info("DiB01x0 not found");
  1611. return -EIO;
  1612. }
  1613. for (index_data = 0; index_data < len; index_data += 2) {
  1614. wb[2] = (data[index_data + 1] >> 8) & 0xff;
  1615. wb[3] = (data[index_data + 1]) & 0xff;
  1616. if (data[index_data] == 0) {
  1617. wb[0] = (data[index_data] >> 8) & 0xff;
  1618. wb[1] = (data[index_data]) & 0xff;
  1619. msg[0].len = 2;
  1620. if (i2c_transfer(i2c, msg, 2) != 2)
  1621. return -EIO;
  1622. wb[2] |= rb[0];
  1623. wb[3] |= rb[1] & ~(3 << 4);
  1624. }
  1625. wb[0] = (data[index_data] >> 8)&0xff;
  1626. wb[1] = (data[index_data])&0xff;
  1627. msg[0].len = 4;
  1628. if (i2c_transfer(i2c, &msg[0], 1) != 1)
  1629. return -EIO;
  1630. }
  1631. return 0;
  1632. }
  1633. static struct dib9000_config stk9090m_config = {
  1634. .output_mpeg2_in_188_bytes = 1,
  1635. .output_mode = OUTMODE_MPEG2_FIFO,
  1636. .vcxo_timer = 279620,
  1637. .timing_frequency = 20452225,
  1638. .demod_clock_khz = 60000,
  1639. .xtal_clock_khz = 30000,
  1640. .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
  1641. .subband = {
  1642. 2,
  1643. {
  1644. { 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0008 } }, /* GPIO 3 to 1 for VHF */
  1645. { 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0000 } }, /* GPIO 3 to 0 for UHF */
  1646. { 0 },
  1647. },
  1648. },
  1649. .gpio_function = {
  1650. { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 },
  1651. { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 },
  1652. },
  1653. };
  1654. static struct dib9000_config nim9090md_config[2] = {
  1655. {
  1656. .output_mpeg2_in_188_bytes = 1,
  1657. .output_mode = OUTMODE_MPEG2_FIFO,
  1658. .vcxo_timer = 279620,
  1659. .timing_frequency = 20452225,
  1660. .demod_clock_khz = 60000,
  1661. .xtal_clock_khz = 30000,
  1662. .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
  1663. }, {
  1664. .output_mpeg2_in_188_bytes = 1,
  1665. .output_mode = OUTMODE_DIVERSITY,
  1666. .vcxo_timer = 279620,
  1667. .timing_frequency = 20452225,
  1668. .demod_clock_khz = 60000,
  1669. .xtal_clock_khz = 30000,
  1670. .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
  1671. .subband = {
  1672. 2,
  1673. {
  1674. { 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0006 } }, /* GPIO 1 and 2 to 1 for VHF */
  1675. { 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0000 } }, /* GPIO 1 and 2 to 0 for UHF */
  1676. { 0 },
  1677. },
  1678. },
  1679. .gpio_function = {
  1680. { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 },
  1681. { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 },
  1682. },
  1683. }
  1684. };
  1685. static struct dib0090_config dib9090_dib0090_config = {
  1686. .io.pll_bypass = 0,
  1687. .io.pll_range = 1,
  1688. .io.pll_prediv = 1,
  1689. .io.pll_loopdiv = 8,
  1690. .io.adc_clock_ratio = 8,
  1691. .io.pll_int_loop_filt = 0,
  1692. .io.clock_khz = 30000,
  1693. .reset = dib90x0_tuner_reset,
  1694. .sleep = dib90x0_tuner_sleep,
  1695. .clkouttobamse = 0,
  1696. .analog_output = 0,
  1697. .use_pwm_agc = 0,
  1698. .clkoutdrive = 0,
  1699. .freq_offset_khz_uhf = 0,
  1700. .freq_offset_khz_vhf = 0,
  1701. };
  1702. static struct dib0090_config nim9090md_dib0090_config[2] = {
  1703. {
  1704. .io.pll_bypass = 0,
  1705. .io.pll_range = 1,
  1706. .io.pll_prediv = 1,
  1707. .io.pll_loopdiv = 8,
  1708. .io.adc_clock_ratio = 8,
  1709. .io.pll_int_loop_filt = 0,
  1710. .io.clock_khz = 30000,
  1711. .reset = dib90x0_tuner_reset,
  1712. .sleep = dib90x0_tuner_sleep,
  1713. .clkouttobamse = 1,
  1714. .analog_output = 0,
  1715. .use_pwm_agc = 0,
  1716. .clkoutdrive = 0,
  1717. .freq_offset_khz_uhf = 0,
  1718. .freq_offset_khz_vhf = 0,
  1719. }, {
  1720. .io.pll_bypass = 0,
  1721. .io.pll_range = 1,
  1722. .io.pll_prediv = 1,
  1723. .io.pll_loopdiv = 8,
  1724. .io.adc_clock_ratio = 8,
  1725. .io.pll_int_loop_filt = 0,
  1726. .io.clock_khz = 30000,
  1727. .reset = dib90x0_tuner_reset,
  1728. .sleep = dib90x0_tuner_sleep,
  1729. .clkouttobamse = 0,
  1730. .analog_output = 0,
  1731. .use_pwm_agc = 0,
  1732. .clkoutdrive = 0,
  1733. .freq_offset_khz_uhf = 0,
  1734. .freq_offset_khz_vhf = 0,
  1735. }
  1736. };
  1737. static int stk9090m_frontend_attach(struct dvb_usb_adapter *adap)
  1738. {
  1739. struct dib0700_adapter_state *state = adap->priv;
  1740. struct dib0700_state *st = adap->dev->priv;
  1741. u32 fw_version;
  1742. /* Make use of the new i2c functions from FW 1.20 */
  1743. dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL);
  1744. if (fw_version >= 0x10200)
  1745. st->fw_use_new_i2c_api = 1;
  1746. dib0700_set_i2c_speed(adap->dev, 340);
  1747. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  1748. msleep(20);
  1749. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  1750. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  1751. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  1752. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  1753. dib0700_ctrl_clock(adap->dev, 72, 1);
  1754. msleep(20);
  1755. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  1756. msleep(20);
  1757. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  1758. dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, 0x80);
  1759. if (request_firmware(&state->frontend_firmware, "dib9090.fw", &adap->dev->udev->dev)) {
  1760. deb_info("%s: Upload failed. (file not found?)\n", __func__);
  1761. return -ENODEV;
  1762. } else {
  1763. deb_info("%s: firmware read %Zu bytes.\n", __func__, state->frontend_firmware->size);
  1764. }
  1765. stk9090m_config.microcode_B_fe_size = state->frontend_firmware->size;
  1766. stk9090m_config.microcode_B_fe_buffer = state->frontend_firmware->data;
  1767. adap->fe_adap[0].fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &stk9090m_config);
  1768. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  1769. }
  1770. static int dib9090_tuner_attach(struct dvb_usb_adapter *adap)
  1771. {
  1772. struct dib0700_adapter_state *state = adap->priv;
  1773. struct i2c_adapter *i2c = dib9000_get_tuner_interface(adap->fe_adap[0].fe);
  1774. u16 data_dib190[10] = {
  1775. 1, 0x1374,
  1776. 2, 0x01a2,
  1777. 7, 0x0020,
  1778. 0, 0x00ef,
  1779. 8, 0x0486,
  1780. };
  1781. if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &dib9090_dib0090_config) == NULL)
  1782. return -ENODEV;
  1783. i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);
  1784. if (dib01x0_pmu_update(i2c, data_dib190, 10) != 0)
  1785. return -ENODEV;
  1786. dib0700_set_i2c_speed(adap->dev, 1500);
  1787. if (dib9000_firmware_post_pll_init(adap->fe_adap[0].fe) < 0)
  1788. return -ENODEV;
  1789. release_firmware(state->frontend_firmware);
  1790. return 0;
  1791. }
  1792. static int nim9090md_frontend_attach(struct dvb_usb_adapter *adap)
  1793. {
  1794. struct dib0700_adapter_state *state = adap->priv;
  1795. struct dib0700_state *st = adap->dev->priv;
  1796. struct i2c_adapter *i2c;
  1797. struct dvb_frontend *fe_slave;
  1798. u32 fw_version;
  1799. /* Make use of the new i2c functions from FW 1.20 */
  1800. dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL);
  1801. if (fw_version >= 0x10200)
  1802. st->fw_use_new_i2c_api = 1;
  1803. dib0700_set_i2c_speed(adap->dev, 340);
  1804. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  1805. msleep(20);
  1806. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  1807. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  1808. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  1809. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  1810. dib0700_ctrl_clock(adap->dev, 72, 1);
  1811. msleep(20);
  1812. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  1813. msleep(20);
  1814. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  1815. if (request_firmware(&state->frontend_firmware, "dib9090.fw", &adap->dev->udev->dev)) {
  1816. deb_info("%s: Upload failed. (file not found?)\n", __func__);
  1817. return -EIO;
  1818. } else {
  1819. deb_info("%s: firmware read %Zu bytes.\n", __func__, state->frontend_firmware->size);
  1820. }
  1821. nim9090md_config[0].microcode_B_fe_size = state->frontend_firmware->size;
  1822. nim9090md_config[0].microcode_B_fe_buffer = state->frontend_firmware->data;
  1823. nim9090md_config[1].microcode_B_fe_size = state->frontend_firmware->size;
  1824. nim9090md_config[1].microcode_B_fe_buffer = state->frontend_firmware->data;
  1825. dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, 0x80);
  1826. adap->fe_adap[0].fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &nim9090md_config[0]);
  1827. if (adap->fe_adap[0].fe == NULL)
  1828. return -ENODEV;
  1829. i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_3_4, 0);
  1830. dib9000_i2c_enumeration(i2c, 1, 0x12, 0x82);
  1831. fe_slave = dvb_attach(dib9000_attach, i2c, 0x82, &nim9090md_config[1]);
  1832. dib9000_set_slave_frontend(adap->fe_adap[0].fe, fe_slave);
  1833. return fe_slave == NULL ? -ENODEV : 0;
  1834. }
  1835. static int nim9090md_tuner_attach(struct dvb_usb_adapter *adap)
  1836. {
  1837. struct dib0700_adapter_state *state = adap->priv;
  1838. struct i2c_adapter *i2c;
  1839. struct dvb_frontend *fe_slave;
  1840. u16 data_dib190[10] = {
  1841. 1, 0x5374,
  1842. 2, 0x01ae,
  1843. 7, 0x0020,
  1844. 0, 0x00ef,
  1845. 8, 0x0406,
  1846. };
  1847. i2c = dib9000_get_tuner_interface(adap->fe_adap[0].fe);
  1848. if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &nim9090md_dib0090_config[0]) == NULL)
  1849. return -ENODEV;
  1850. i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);
  1851. if (dib01x0_pmu_update(i2c, data_dib190, 10) < 0)
  1852. return -ENODEV;
  1853. dib0700_set_i2c_speed(adap->dev, 1500);
  1854. if (dib9000_firmware_post_pll_init(adap->fe_adap[0].fe) < 0)
  1855. return -ENODEV;
  1856. fe_slave = dib9000_get_slave_frontend(adap->fe_adap[0].fe, 1);
  1857. if (fe_slave != NULL) {
  1858. i2c = dib9000_get_component_bus_interface(adap->fe_adap[0].fe);
  1859. dib9000_set_i2c_adapter(fe_slave, i2c);
  1860. i2c = dib9000_get_tuner_interface(fe_slave);
  1861. if (dvb_attach(dib0090_fw_register, fe_slave, i2c, &nim9090md_dib0090_config[1]) == NULL)
  1862. return -ENODEV;
  1863. fe_slave->dvb = adap->fe_adap[0].fe->dvb;
  1864. dib9000_fw_set_component_bus_speed(adap->fe_adap[0].fe, 1500);
  1865. if (dib9000_firmware_post_pll_init(fe_slave) < 0)
  1866. return -ENODEV;
  1867. }
  1868. release_firmware(state->frontend_firmware);
  1869. return 0;
  1870. }
  1871. /* NIM7090 */
  1872. struct dib7090p_best_adc {
  1873. u32 timf;
  1874. u32 pll_loopdiv;
  1875. u32 pll_prediv;
  1876. };
  1877. static int dib7090p_get_best_sampling(struct dvb_frontend *fe , struct dib7090p_best_adc *adc)
  1878. {
  1879. u8 spur = 0, prediv = 0, loopdiv = 0, min_prediv = 1, max_prediv = 1;
  1880. u16 xtal = 12000;
  1881. u32 fcp_min = 1900; /* PLL Minimum Frequency comparator KHz */
  1882. u32 fcp_max = 20000; /* PLL Maximum Frequency comparator KHz */
  1883. u32 fdem_max = 76000;
  1884. u32 fdem_min = 69500;
  1885. u32 fcp = 0, fs = 0, fdem = 0;
  1886. u32 harmonic_id = 0;
  1887. adc->pll_loopdiv = loopdiv;
  1888. adc->pll_prediv = prediv;
  1889. adc->timf = 0;
  1890. deb_info("bandwidth = %d fdem_min =%d", fe->dtv_property_cache.bandwidth_hz, fdem_min);
  1891. /* Find Min and Max prediv */
  1892. while ((xtal/max_prediv) >= fcp_min)
  1893. max_prediv++;
  1894. max_prediv--;
  1895. min_prediv = max_prediv;
  1896. while ((xtal/min_prediv) <= fcp_max) {
  1897. min_prediv--;
  1898. if (min_prediv == 1)
  1899. break;
  1900. }
  1901. deb_info("MIN prediv = %d : MAX prediv = %d", min_prediv, max_prediv);
  1902. min_prediv = 2;
  1903. for (prediv = min_prediv ; prediv < max_prediv; prediv++) {
  1904. fcp = xtal / prediv;
  1905. if (fcp > fcp_min && fcp < fcp_max) {
  1906. for (loopdiv = 1 ; loopdiv < 64 ; loopdiv++) {
  1907. fdem = ((xtal/prediv) * loopdiv);
  1908. fs = fdem / 4;
  1909. /* test min/max system restrictions */
  1910. if ((fdem >= fdem_min) && (fdem <= fdem_max) && (fs >= fe->dtv_property_cache.bandwidth_hz/1000)) {
  1911. spur = 0;
  1912. /* test fs harmonics positions */
  1913. for (harmonic_id = (fe->dtv_property_cache.frequency / (1000*fs)) ; harmonic_id <= ((fe->dtv_property_cache.frequency / (1000*fs))+1) ; harmonic_id++) {
  1914. 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)))) {
  1915. spur = 1;
  1916. break;
  1917. }
  1918. }
  1919. if (!spur) {
  1920. adc->pll_loopdiv = loopdiv;
  1921. adc->pll_prediv = prediv;
  1922. adc->timf = 2396745143UL/fdem*(1 << 9);
  1923. adc->timf += ((2396745143UL%fdem) << 9)/fdem;
  1924. deb_info("loopdiv=%i prediv=%i timf=%i", loopdiv, prediv, adc->timf);
  1925. break;
  1926. }
  1927. }
  1928. }
  1929. }
  1930. if (!spur)
  1931. break;
  1932. }
  1933. if (adc->pll_loopdiv == 0 && adc->pll_prediv == 0)
  1934. return -EINVAL;
  1935. else
  1936. return 0;
  1937. }
  1938. static int dib7090_agc_startup(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
  1939. {
  1940. struct dvb_usb_adapter *adap = fe->dvb->priv;
  1941. struct dib0700_adapter_state *state = adap->priv;
  1942. struct dibx000_bandwidth_config pll;
  1943. u16 target;
  1944. struct dib7090p_best_adc adc;
  1945. int ret;
  1946. ret = state->set_param_save(fe, fep);
  1947. if (ret < 0)
  1948. return ret;
  1949. memset(&pll, 0, sizeof(struct dibx000_bandwidth_config));
  1950. dib0090_pwm_gain_reset(fe);
  1951. target = (dib0090_get_wbd_target(fe) * 8 + 1) / 2;
  1952. dib7000p_set_wbd_ref(fe, target);
  1953. if (dib7090p_get_best_sampling(fe, &adc) == 0) {
  1954. pll.pll_ratio = adc.pll_loopdiv;
  1955. pll.pll_prediv = adc.pll_prediv;
  1956. dib7000p_update_pll(fe, &pll);
  1957. dib7000p_ctrl_timf(fe, DEMOD_TIMF_SET, adc.timf);
  1958. }
  1959. return 0;
  1960. }
  1961. static int dib7090_agc_restart(struct dvb_frontend *fe, u8 restart)
  1962. {
  1963. deb_info("AGC restart callback: %d", restart);
  1964. if (restart == 0) /* before AGC startup */
  1965. dib0090_set_dc_servo(fe, 1);
  1966. return 0;
  1967. }
  1968. static int dib7090e_update_lna(struct dvb_frontend *fe, u16 agc_global)
  1969. {
  1970. u16 agc1 = 0, agc2, wbd = 0, wbd_target, wbd_offset, threshold_agc1;
  1971. s16 wbd_delta;
  1972. if ((fe->dtv_property_cache.frequency) < 400000000)
  1973. threshold_agc1 = 25000;
  1974. else
  1975. threshold_agc1 = 30000;
  1976. wbd_target = (dib0090_get_wbd_target(fe)*8+1)/2;
  1977. wbd_offset = dib0090_get_wbd_offset(fe);
  1978. dib7000p_get_agc_values(fe, NULL, &agc1, &agc2, &wbd);
  1979. wbd_delta = (s16)wbd - (((s16)wbd_offset+10)*4) ;
  1980. deb_info("update lna, agc_global=%d agc1=%d agc2=%d",
  1981. agc_global, agc1, agc2);
  1982. deb_info("update lna, wbd=%d wbd target=%d wbd offset=%d wbd delta=%d",
  1983. wbd, wbd_target, wbd_offset, wbd_delta);
  1984. if ((agc1 < threshold_agc1) && (wbd_delta > 0)) {
  1985. dib0090_set_switch(fe, 1, 1, 1);
  1986. dib0090_set_vga(fe, 0);
  1987. dib0090_update_rframp_7090(fe, 0);
  1988. dib0090_update_tuning_table_7090(fe, 0);
  1989. } else {
  1990. dib0090_set_vga(fe, 1);
  1991. dib0090_update_rframp_7090(fe, 1);
  1992. dib0090_update_tuning_table_7090(fe, 1);
  1993. dib0090_set_switch(fe, 0, 0, 0);
  1994. }
  1995. return 0;
  1996. }
  1997. static struct dib0090_wbd_slope dib7090_wbd_table[] = {
  1998. { 380, 81, 850, 64, 540, 4},
  1999. { 860, 51, 866, 21, 375, 4},
  2000. {1700, 0, 250, 0, 100, 6},
  2001. {2600, 0, 250, 0, 100, 6},
  2002. { 0xFFFF, 0, 0, 0, 0, 0},
  2003. };
  2004. static struct dib0090_wbd_slope dib7090e_wbd_table[] = {
  2005. { 380, 81, 850, 64, 540, 4},
  2006. { 700, 51, 866, 21, 320, 4},
  2007. { 860, 48, 666, 18, 330, 6},
  2008. {1700, 0, 250, 0, 100, 6},
  2009. {2600, 0, 250, 0, 100, 6},
  2010. { 0xFFFF, 0, 0, 0, 0, 0},
  2011. };
  2012. static struct dibx000_agc_config dib7090_agc_config[2] = {
  2013. {
  2014. .band_caps = BAND_UHF,
  2015. /* 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,
  2016. * 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 */
  2017. .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
  2018. .inv_gain = 687,
  2019. .time_stabiliz = 10,
  2020. .alpha_level = 0,
  2021. .thlock = 118,
  2022. .wbd_inv = 0,
  2023. .wbd_ref = 1200,
  2024. .wbd_sel = 3,
  2025. .wbd_alpha = 5,
  2026. .agc1_max = 65535,
  2027. .agc1_min = 0,
  2028. .agc2_max = 65535,
  2029. .agc2_min = 0,
  2030. .agc1_pt1 = 0,
  2031. .agc1_pt2 = 32,
  2032. .agc1_pt3 = 114,
  2033. .agc1_slope1 = 143,
  2034. .agc1_slope2 = 144,
  2035. .agc2_pt1 = 114,
  2036. .agc2_pt2 = 227,
  2037. .agc2_slope1 = 116,
  2038. .agc2_slope2 = 117,
  2039. .alpha_mant = 18,
  2040. .alpha_exp = 0,
  2041. .beta_mant = 20,
  2042. .beta_exp = 59,
  2043. .perform_agc_softsplit = 0,
  2044. } , {
  2045. .band_caps = BAND_FM | BAND_VHF | BAND_CBAND,
  2046. /* 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,
  2047. * 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 */
  2048. .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
  2049. .inv_gain = 732,
  2050. .time_stabiliz = 10,
  2051. .alpha_level = 0,
  2052. .thlock = 118,
  2053. .wbd_inv = 0,
  2054. .wbd_ref = 1200,
  2055. .wbd_sel = 3,
  2056. .wbd_alpha = 5,
  2057. .agc1_max = 65535,
  2058. .agc1_min = 0,
  2059. .agc2_max = 65535,
  2060. .agc2_min = 0,
  2061. .agc1_pt1 = 0,
  2062. .agc1_pt2 = 0,
  2063. .agc1_pt3 = 98,
  2064. .agc1_slope1 = 0,
  2065. .agc1_slope2 = 167,
  2066. .agc2_pt1 = 98,
  2067. .agc2_pt2 = 255,
  2068. .agc2_slope1 = 104,
  2069. .agc2_slope2 = 0,
  2070. .alpha_mant = 18,
  2071. .alpha_exp = 0,
  2072. .beta_mant = 20,
  2073. .beta_exp = 59,
  2074. .perform_agc_softsplit = 0,
  2075. }
  2076. };
  2077. static struct dibx000_bandwidth_config dib7090_clock_config_12_mhz = {
  2078. 60000, 15000,
  2079. 1, 5, 0, 0, 0,
  2080. 0, 0, 1, 1, 2,
  2081. (3 << 14) | (1 << 12) | (524 << 0),
  2082. (0 << 25) | 0,
  2083. 20452225,
  2084. 15000000,
  2085. };
  2086. static struct dib7000p_config nim7090_dib7000p_config = {
  2087. .output_mpeg2_in_188_bytes = 1,
  2088. .hostbus_diversity = 1,
  2089. .tuner_is_baseband = 1,
  2090. .update_lna = NULL,
  2091. .agc_config_count = 2,
  2092. .agc = dib7090_agc_config,
  2093. .bw = &dib7090_clock_config_12_mhz,
  2094. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  2095. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  2096. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  2097. .pwm_freq_div = 0,
  2098. .agc_control = dib7090_agc_restart,
  2099. .spur_protect = 0,
  2100. .disable_sample_and_hold = 0,
  2101. .enable_current_mirror = 0,
  2102. .diversity_delay = 0,
  2103. .output_mode = OUTMODE_MPEG2_FIFO,
  2104. .enMpegOutput = 1,
  2105. };
  2106. static struct dib7000p_config tfe7090pvr_dib7000p_config[2] = {
  2107. {
  2108. .output_mpeg2_in_188_bytes = 1,
  2109. .hostbus_diversity = 1,
  2110. .tuner_is_baseband = 1,
  2111. .update_lna = NULL,
  2112. .agc_config_count = 2,
  2113. .agc = dib7090_agc_config,
  2114. .bw = &dib7090_clock_config_12_mhz,
  2115. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  2116. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  2117. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  2118. .pwm_freq_div = 0,
  2119. .agc_control = dib7090_agc_restart,
  2120. .spur_protect = 0,
  2121. .disable_sample_and_hold = 0,
  2122. .enable_current_mirror = 0,
  2123. .diversity_delay = 0,
  2124. .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
  2125. .default_i2c_addr = 0x90,
  2126. .enMpegOutput = 1,
  2127. }, {
  2128. .output_mpeg2_in_188_bytes = 1,
  2129. .hostbus_diversity = 1,
  2130. .tuner_is_baseband = 1,
  2131. .update_lna = NULL,
  2132. .agc_config_count = 2,
  2133. .agc = dib7090_agc_config,
  2134. .bw = &dib7090_clock_config_12_mhz,
  2135. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  2136. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  2137. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  2138. .pwm_freq_div = 0,
  2139. .agc_control = dib7090_agc_restart,
  2140. .spur_protect = 0,
  2141. .disable_sample_and_hold = 0,
  2142. .enable_current_mirror = 0,
  2143. .diversity_delay = 0,
  2144. .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
  2145. .default_i2c_addr = 0x92,
  2146. .enMpegOutput = 0,
  2147. }
  2148. };
  2149. static struct dib7000p_config tfe7090e_dib7000p_config = {
  2150. .output_mpeg2_in_188_bytes = 1,
  2151. .hostbus_diversity = 1,
  2152. .tuner_is_baseband = 1,
  2153. .update_lna = dib7090e_update_lna,
  2154. .agc_config_count = 2,
  2155. .agc = dib7090_agc_config,
  2156. .bw = &dib7090_clock_config_12_mhz,
  2157. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  2158. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  2159. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  2160. .pwm_freq_div = 0,
  2161. .agc_control = dib7090_agc_restart,
  2162. .spur_protect = 0,
  2163. .disable_sample_and_hold = 0,
  2164. .enable_current_mirror = 0,
  2165. .diversity_delay = 0,
  2166. .output_mode = OUTMODE_MPEG2_FIFO,
  2167. .enMpegOutput = 1,
  2168. };
  2169. static const struct dib0090_config nim7090_dib0090_config = {
  2170. .io.clock_khz = 12000,
  2171. .io.pll_bypass = 0,
  2172. .io.pll_range = 0,
  2173. .io.pll_prediv = 3,
  2174. .io.pll_loopdiv = 6,
  2175. .io.adc_clock_ratio = 0,
  2176. .io.pll_int_loop_filt = 0,
  2177. .reset = dib7090_tuner_sleep,
  2178. .sleep = dib7090_tuner_sleep,
  2179. .freq_offset_khz_uhf = 0,
  2180. .freq_offset_khz_vhf = 0,
  2181. .get_adc_power = dib7090_get_adc_power,
  2182. .clkouttobamse = 1,
  2183. .analog_output = 0,
  2184. .wbd_vhf_offset = 0,
  2185. .wbd_cband_offset = 0,
  2186. .use_pwm_agc = 1,
  2187. .clkoutdrive = 0,
  2188. .fref_clock_ratio = 0,
  2189. .wbd = dib7090_wbd_table,
  2190. .ls_cfg_pad_drv = 0,
  2191. .data_tx_drv = 0,
  2192. .low_if = NULL,
  2193. .in_soc = 1,
  2194. };
  2195. static const struct dib0090_config tfe7090e_dib0090_config = {
  2196. .io.clock_khz = 12000,
  2197. .io.pll_bypass = 0,
  2198. .io.pll_range = 0,
  2199. .io.pll_prediv = 3,
  2200. .io.pll_loopdiv = 6,
  2201. .io.adc_clock_ratio = 0,
  2202. .io.pll_int_loop_filt = 0,
  2203. .reset = dib7090_tuner_sleep,
  2204. .sleep = dib7090_tuner_sleep,
  2205. .freq_offset_khz_uhf = 0,
  2206. .freq_offset_khz_vhf = 0,
  2207. .get_adc_power = dib7090_get_adc_power,
  2208. .clkouttobamse = 1,
  2209. .analog_output = 0,
  2210. .wbd_vhf_offset = 0,
  2211. .wbd_cband_offset = 0,
  2212. .use_pwm_agc = 1,
  2213. .clkoutdrive = 0,
  2214. .fref_clock_ratio = 0,
  2215. .wbd = dib7090e_wbd_table,
  2216. .ls_cfg_pad_drv = 0,
  2217. .data_tx_drv = 0,
  2218. .low_if = NULL,
  2219. .in_soc = 1,
  2220. .force_cband_input = 1,
  2221. .is_dib7090e = 1,
  2222. };
  2223. static struct dib7000p_config tfe7790e_dib7000p_config = {
  2224. .output_mpeg2_in_188_bytes = 1,
  2225. .hostbus_diversity = 1,
  2226. .tuner_is_baseband = 1,
  2227. .update_lna = dib7090e_update_lna,
  2228. .agc_config_count = 2,
  2229. .agc = dib7090_agc_config,
  2230. .bw = &dib7090_clock_config_12_mhz,
  2231. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  2232. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  2233. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  2234. .pwm_freq_div = 0,
  2235. .agc_control = dib7090_agc_restart,
  2236. .spur_protect = 0,
  2237. .disable_sample_and_hold = 0,
  2238. .enable_current_mirror = 0,
  2239. .diversity_delay = 0,
  2240. .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
  2241. .enMpegOutput = 1,
  2242. };
  2243. static const struct dib0090_config tfe7790e_dib0090_config = {
  2244. .io.clock_khz = 12000,
  2245. .io.pll_bypass = 0,
  2246. .io.pll_range = 0,
  2247. .io.pll_prediv = 3,
  2248. .io.pll_loopdiv = 6,
  2249. .io.adc_clock_ratio = 0,
  2250. .io.pll_int_loop_filt = 0,
  2251. .reset = dib7090_tuner_sleep,
  2252. .sleep = dib7090_tuner_sleep,
  2253. .freq_offset_khz_uhf = 0,
  2254. .freq_offset_khz_vhf = 0,
  2255. .get_adc_power = dib7090_get_adc_power,
  2256. .clkouttobamse = 1,
  2257. .analog_output = 0,
  2258. .wbd_vhf_offset = 0,
  2259. .wbd_cband_offset = 0,
  2260. .use_pwm_agc = 1,
  2261. .clkoutdrive = 0,
  2262. .fref_clock_ratio = 0,
  2263. .wbd = dib7090e_wbd_table,
  2264. .ls_cfg_pad_drv = 0,
  2265. .data_tx_drv = 0,
  2266. .low_if = NULL,
  2267. .in_soc = 1,
  2268. .force_cband_input = 1,
  2269. .is_dib7090e = 1,
  2270. .force_crystal_mode = 1,
  2271. };
  2272. static const struct dib0090_config tfe7090pvr_dib0090_config[2] = {
  2273. {
  2274. .io.clock_khz = 12000,
  2275. .io.pll_bypass = 0,
  2276. .io.pll_range = 0,
  2277. .io.pll_prediv = 3,
  2278. .io.pll_loopdiv = 6,
  2279. .io.adc_clock_ratio = 0,
  2280. .io.pll_int_loop_filt = 0,
  2281. .reset = dib7090_tuner_sleep,
  2282. .sleep = dib7090_tuner_sleep,
  2283. .freq_offset_khz_uhf = 50,
  2284. .freq_offset_khz_vhf = 70,
  2285. .get_adc_power = dib7090_get_adc_power,
  2286. .clkouttobamse = 1,
  2287. .analog_output = 0,
  2288. .wbd_vhf_offset = 0,
  2289. .wbd_cband_offset = 0,
  2290. .use_pwm_agc = 1,
  2291. .clkoutdrive = 0,
  2292. .fref_clock_ratio = 0,
  2293. .wbd = dib7090_wbd_table,
  2294. .ls_cfg_pad_drv = 0,
  2295. .data_tx_drv = 0,
  2296. .low_if = NULL,
  2297. .in_soc = 1,
  2298. }, {
  2299. .io.clock_khz = 12000,
  2300. .io.pll_bypass = 0,
  2301. .io.pll_range = 0,
  2302. .io.pll_prediv = 3,
  2303. .io.pll_loopdiv = 6,
  2304. .io.adc_clock_ratio = 0,
  2305. .io.pll_int_loop_filt = 0,
  2306. .reset = dib7090_tuner_sleep,
  2307. .sleep = dib7090_tuner_sleep,
  2308. .freq_offset_khz_uhf = -50,
  2309. .freq_offset_khz_vhf = -70,
  2310. .get_adc_power = dib7090_get_adc_power,
  2311. .clkouttobamse = 1,
  2312. .analog_output = 0,
  2313. .wbd_vhf_offset = 0,
  2314. .wbd_cband_offset = 0,
  2315. .use_pwm_agc = 1,
  2316. .clkoutdrive = 0,
  2317. .fref_clock_ratio = 0,
  2318. .wbd = dib7090_wbd_table,
  2319. .ls_cfg_pad_drv = 0,
  2320. .data_tx_drv = 0,
  2321. .low_if = NULL,
  2322. .in_soc = 1,
  2323. }
  2324. };
  2325. static int nim7090_frontend_attach(struct dvb_usb_adapter *adap)
  2326. {
  2327. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  2328. msleep(20);
  2329. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  2330. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  2331. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  2332. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  2333. msleep(20);
  2334. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  2335. msleep(20);
  2336. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  2337. if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, &nim7090_dib7000p_config) != 0) {
  2338. err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
  2339. return -ENODEV;
  2340. }
  2341. adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &nim7090_dib7000p_config);
  2342. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  2343. }
  2344. static int nim7090_tuner_attach(struct dvb_usb_adapter *adap)
  2345. {
  2346. struct dib0700_adapter_state *st = adap->priv;
  2347. struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe_adap[0].fe);
  2348. if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &nim7090_dib0090_config) == NULL)
  2349. return -ENODEV;
  2350. dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
  2351. st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
  2352. adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
  2353. return 0;
  2354. }
  2355. static int tfe7090pvr_frontend0_attach(struct dvb_usb_adapter *adap)
  2356. {
  2357. struct dib0700_state *st = adap->dev->priv;
  2358. /* The TFE7090 requires the dib0700 to not be in master mode */
  2359. st->disable_streaming_master_mode = 1;
  2360. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  2361. msleep(20);
  2362. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  2363. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  2364. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  2365. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  2366. msleep(20);
  2367. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  2368. msleep(20);
  2369. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  2370. /* initialize IC 0 */
  2371. if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, &tfe7090pvr_dib7000p_config[0]) != 0) {
  2372. err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
  2373. return -ENODEV;
  2374. }
  2375. dib0700_set_i2c_speed(adap->dev, 340);
  2376. adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x90, &tfe7090pvr_dib7000p_config[0]);
  2377. if (adap->fe_adap[0].fe == NULL)
  2378. return -ENODEV;
  2379. dib7090_slave_reset(adap->fe_adap[0].fe);
  2380. return 0;
  2381. }
  2382. static int tfe7090pvr_frontend1_attach(struct dvb_usb_adapter *adap)
  2383. {
  2384. struct i2c_adapter *i2c;
  2385. if (adap->dev->adapter[0].fe_adap[0].fe == NULL) {
  2386. err("the master dib7090 has to be initialized first");
  2387. return -ENODEV; /* the master device has not been initialized */
  2388. }
  2389. i2c = dib7000p_get_i2c_master(adap->dev->adapter[0].fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_6_7, 1);
  2390. if (dib7000p_i2c_enumeration(i2c, 1, 0x10, &tfe7090pvr_dib7000p_config[1]) != 0) {
  2391. err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
  2392. return -ENODEV;
  2393. }
  2394. adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, i2c, 0x92, &tfe7090pvr_dib7000p_config[1]);
  2395. dib0700_set_i2c_speed(adap->dev, 200);
  2396. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  2397. }
  2398. static int tfe7090pvr_tuner0_attach(struct dvb_usb_adapter *adap)
  2399. {
  2400. struct dib0700_adapter_state *st = adap->priv;
  2401. struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe_adap[0].fe);
  2402. if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &tfe7090pvr_dib0090_config[0]) == NULL)
  2403. return -ENODEV;
  2404. dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
  2405. st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
  2406. adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
  2407. return 0;
  2408. }
  2409. static int tfe7090pvr_tuner1_attach(struct dvb_usb_adapter *adap)
  2410. {
  2411. struct dib0700_adapter_state *st = adap->priv;
  2412. struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe_adap[0].fe);
  2413. if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &tfe7090pvr_dib0090_config[1]) == NULL)
  2414. return -ENODEV;
  2415. dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
  2416. st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
  2417. adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
  2418. return 0;
  2419. }
  2420. static int tfe7090e_frontend_attach(struct dvb_usb_adapter *adap)
  2421. {
  2422. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  2423. msleep(20);
  2424. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  2425. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  2426. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  2427. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  2428. msleep(20);
  2429. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  2430. msleep(20);
  2431. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  2432. if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap,
  2433. 1, 0x10, &tfe7090e_dib7000p_config) != 0) {
  2434. err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
  2435. __func__);
  2436. return -ENODEV;
  2437. }
  2438. adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,
  2439. 0x80, &tfe7090e_dib7000p_config);
  2440. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  2441. }
  2442. static int tfe7790e_frontend_attach(struct dvb_usb_adapter *adap)
  2443. {
  2444. struct dib0700_state *st = adap->dev->priv;
  2445. /* The TFE7790E requires the dib0700 to not be in master mode */
  2446. st->disable_streaming_master_mode = 1;
  2447. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  2448. msleep(20);
  2449. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  2450. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  2451. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  2452. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  2453. msleep(20);
  2454. dib0700_ctrl_clock(adap->dev, 72, 1);
  2455. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  2456. msleep(20);
  2457. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  2458. if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap,
  2459. 1, 0x10, &tfe7790e_dib7000p_config) != 0) {
  2460. err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
  2461. __func__);
  2462. return -ENODEV;
  2463. }
  2464. adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,
  2465. 0x80, &tfe7790e_dib7000p_config);
  2466. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  2467. }
  2468. static int tfe7790e_tuner_attach(struct dvb_usb_adapter *adap)
  2469. {
  2470. struct dib0700_adapter_state *st = adap->priv;
  2471. struct i2c_adapter *tun_i2c =
  2472. dib7090_get_i2c_tuner(adap->fe_adap[0].fe);
  2473. if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c,
  2474. &tfe7790e_dib0090_config) == NULL)
  2475. return -ENODEV;
  2476. dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
  2477. st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
  2478. adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
  2479. return 0;
  2480. }
  2481. static int tfe7090e_tuner_attach(struct dvb_usb_adapter *adap)
  2482. {
  2483. struct dib0700_adapter_state *st = adap->priv;
  2484. struct i2c_adapter *tun_i2c =
  2485. dib7090_get_i2c_tuner(adap->fe_adap[0].fe);
  2486. if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c,
  2487. &tfe7090e_dib0090_config) == NULL)
  2488. return -ENODEV;
  2489. dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
  2490. st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
  2491. adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
  2492. return 0;
  2493. }
  2494. /* STK7070PD */
  2495. static struct dib7000p_config stk7070pd_dib7000p_config[2] = {
  2496. {
  2497. .output_mpeg2_in_188_bytes = 1,
  2498. .agc_config_count = 1,
  2499. .agc = &dib7070_agc_config,
  2500. .bw = &dib7070_bw_config_12_mhz,
  2501. .tuner_is_baseband = 1,
  2502. .spur_protect = 1,
  2503. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  2504. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  2505. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  2506. .hostbus_diversity = 1,
  2507. }, {
  2508. .output_mpeg2_in_188_bytes = 1,
  2509. .agc_config_count = 1,
  2510. .agc = &dib7070_agc_config,
  2511. .bw = &dib7070_bw_config_12_mhz,
  2512. .tuner_is_baseband = 1,
  2513. .spur_protect = 1,
  2514. .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
  2515. .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
  2516. .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
  2517. .hostbus_diversity = 1,
  2518. }
  2519. };
  2520. static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap)
  2521. {
  2522. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  2523. msleep(10);
  2524. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  2525. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  2526. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  2527. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  2528. dib0700_ctrl_clock(adap->dev, 72, 1);
  2529. msleep(10);
  2530. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  2531. msleep(10);
  2532. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  2533. if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
  2534. stk7070pd_dib7000p_config) != 0) {
  2535. err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
  2536. __func__);
  2537. return -ENODEV;
  2538. }
  2539. adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]);
  2540. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  2541. }
  2542. static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap)
  2543. {
  2544. adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]);
  2545. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  2546. }
  2547. /* S5H1411 */
  2548. static struct s5h1411_config pinnacle_801e_config = {
  2549. .output_mode = S5H1411_PARALLEL_OUTPUT,
  2550. .gpio = S5H1411_GPIO_OFF,
  2551. .mpeg_timing = S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK,
  2552. .qam_if = S5H1411_IF_44000,
  2553. .vsb_if = S5H1411_IF_44000,
  2554. .inversion = S5H1411_INVERSION_OFF,
  2555. .status_mode = S5H1411_DEMODLOCKING
  2556. };
  2557. /* Pinnacle PCTV HD Pro 801e GPIOs map:
  2558. GPIO0 - currently unknown
  2559. GPIO1 - xc5000 tuner reset
  2560. GPIO2 - CX25843 sleep
  2561. GPIO3 - currently unknown
  2562. GPIO4 - currently unknown
  2563. GPIO6 - currently unknown
  2564. GPIO7 - currently unknown
  2565. GPIO9 - currently unknown
  2566. GPIO10 - CX25843 reset
  2567. */
  2568. static int s5h1411_frontend_attach(struct dvb_usb_adapter *adap)
  2569. {
  2570. struct dib0700_state *st = adap->dev->priv;
  2571. /* Make use of the new i2c functions from FW 1.20 */
  2572. st->fw_use_new_i2c_api = 1;
  2573. /* The s5h1411 requires the dib0700 to not be in master mode */
  2574. st->disable_streaming_master_mode = 1;
  2575. /* All msleep values taken from Windows USB trace */
  2576. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
  2577. dib0700_set_gpio(adap->dev, GPIO3, GPIO_OUT, 0);
  2578. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  2579. msleep(400);
  2580. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  2581. msleep(60);
  2582. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  2583. msleep(30);
  2584. dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
  2585. dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
  2586. dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
  2587. dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
  2588. dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 0);
  2589. msleep(30);
  2590. /* Put the CX25843 to sleep for now since we're in digital mode */
  2591. dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
  2592. /* GPIOs are initialized, do the attach */
  2593. adap->fe_adap[0].fe = dvb_attach(s5h1411_attach, &pinnacle_801e_config,
  2594. &adap->dev->i2c_adap);
  2595. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  2596. }
  2597. static int dib0700_xc5000_tuner_callback(void *priv, int component,
  2598. int command, int arg)
  2599. {
  2600. struct dvb_usb_adapter *adap = priv;
  2601. if (command == XC5000_TUNER_RESET) {
  2602. /* Reset the tuner */
  2603. dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0);
  2604. msleep(10);
  2605. dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1);
  2606. msleep(10);
  2607. } else {
  2608. err("xc5000: unknown tuner callback command: %d\n", command);
  2609. return -EINVAL;
  2610. }
  2611. return 0;
  2612. }
  2613. static struct xc5000_config s5h1411_xc5000_tunerconfig = {
  2614. .i2c_address = 0x64,
  2615. .if_khz = 5380,
  2616. };
  2617. static int xc5000_tuner_attach(struct dvb_usb_adapter *adap)
  2618. {
  2619. /* FIXME: generalize & move to common area */
  2620. adap->fe_adap[0].fe->callback = dib0700_xc5000_tuner_callback;
  2621. return dvb_attach(xc5000_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap,
  2622. &s5h1411_xc5000_tunerconfig)
  2623. == NULL ? -ENODEV : 0;
  2624. }
  2625. static int dib0700_xc4000_tuner_callback(void *priv, int component,
  2626. int command, int arg)
  2627. {
  2628. struct dvb_usb_adapter *adap = priv;
  2629. if (command == XC4000_TUNER_RESET) {
  2630. /* Reset the tuner */
  2631. dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 0);
  2632. msleep(10);
  2633. dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
  2634. } else {
  2635. err("xc4000: unknown tuner callback command: %d\n", command);
  2636. return -EINVAL;
  2637. }
  2638. return 0;
  2639. }
  2640. static struct dibx000_agc_config stk7700p_7000p_xc4000_agc_config = {
  2641. .band_caps = BAND_UHF | BAND_VHF,
  2642. .setup = 0x64,
  2643. .inv_gain = 0x02c8,
  2644. .time_stabiliz = 0x15,
  2645. .alpha_level = 0x00,
  2646. .thlock = 0x76,
  2647. .wbd_inv = 0x01,
  2648. .wbd_ref = 0x0b33,
  2649. .wbd_sel = 0x00,
  2650. .wbd_alpha = 0x02,
  2651. .agc1_max = 0x00,
  2652. .agc1_min = 0x00,
  2653. .agc2_max = 0x9b26,
  2654. .agc2_min = 0x26ca,
  2655. .agc1_pt1 = 0x00,
  2656. .agc1_pt2 = 0x00,
  2657. .agc1_pt3 = 0x00,
  2658. .agc1_slope1 = 0x00,
  2659. .agc1_slope2 = 0x00,
  2660. .agc2_pt1 = 0x00,
  2661. .agc2_pt2 = 0x80,
  2662. .agc2_slope1 = 0x1d,
  2663. .agc2_slope2 = 0x1d,
  2664. .alpha_mant = 0x11,
  2665. .alpha_exp = 0x1b,
  2666. .beta_mant = 0x17,
  2667. .beta_exp = 0x33,
  2668. .perform_agc_softsplit = 0x00,
  2669. };
  2670. static struct dibx000_bandwidth_config stk7700p_xc4000_pll_config = {
  2671. 60000, 30000, /* internal, sampling */
  2672. 1, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */
  2673. 0, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, */
  2674. /* ADClkSrc, modulo */
  2675. (3 << 14) | (1 << 12) | 524, /* sad_cfg: refsel, sel, freq_15k */
  2676. 39370534, /* ifreq */
  2677. 20452225, /* timf */
  2678. 30000000 /* xtal */
  2679. };
  2680. /* FIXME: none of these inputs are validated yet */
  2681. static struct dib7000p_config pctv_340e_config = {
  2682. .output_mpeg2_in_188_bytes = 1,
  2683. .agc_config_count = 1,
  2684. .agc = &stk7700p_7000p_xc4000_agc_config,
  2685. .bw = &stk7700p_xc4000_pll_config,
  2686. .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
  2687. .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
  2688. .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
  2689. };
  2690. /* PCTV 340e GPIOs map:
  2691. dib0700:
  2692. GPIO2 - CX25843 sleep
  2693. GPIO3 - CS5340 reset
  2694. GPIO5 - IRD
  2695. GPIO6 - Power Supply
  2696. GPIO8 - LNA (1=off 0=on)
  2697. GPIO10 - CX25843 reset
  2698. dib7000:
  2699. GPIO8 - xc4000 reset
  2700. */
  2701. static int pctv340e_frontend_attach(struct dvb_usb_adapter *adap)
  2702. {
  2703. struct dib0700_state *st = adap->dev->priv;
  2704. /* Power Supply on */
  2705. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
  2706. msleep(50);
  2707. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  2708. msleep(100); /* Allow power supply to settle before probing */
  2709. /* cx25843 reset */
  2710. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  2711. msleep(1); /* cx25843 datasheet say 350us required */
  2712. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  2713. /* LNA off for now */
  2714. dib0700_set_gpio(adap->dev, GPIO8, GPIO_OUT, 1);
  2715. /* Put the CX25843 to sleep for now since we're in digital mode */
  2716. dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
  2717. /* FIXME: not verified yet */
  2718. dib0700_ctrl_clock(adap->dev, 72, 1);
  2719. msleep(500);
  2720. if (dib7000pc_detection(&adap->dev->i2c_adap) == 0) {
  2721. /* Demodulator not found for some reason? */
  2722. return -ENODEV;
  2723. }
  2724. adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x12,
  2725. &pctv_340e_config);
  2726. st->is_dib7000pc = 1;
  2727. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  2728. }
  2729. static struct xc4000_config dib7000p_xc4000_tunerconfig = {
  2730. .i2c_address = 0x61,
  2731. .default_pm = 1,
  2732. .dvb_amplitude = 0,
  2733. .set_smoothedcvbs = 0,
  2734. .if_khz = 5400
  2735. };
  2736. static int xc4000_tuner_attach(struct dvb_usb_adapter *adap)
  2737. {
  2738. struct i2c_adapter *tun_i2c;
  2739. /* The xc4000 is not on the main i2c bus */
  2740. tun_i2c = dib7000p_get_i2c_master(adap->fe_adap[0].fe,
  2741. DIBX000_I2C_INTERFACE_TUNER, 1);
  2742. if (tun_i2c == NULL) {
  2743. printk(KERN_ERR "Could not reach tuner i2c bus\n");
  2744. return 0;
  2745. }
  2746. /* Setup the reset callback */
  2747. adap->fe_adap[0].fe->callback = dib0700_xc4000_tuner_callback;
  2748. return dvb_attach(xc4000_attach, adap->fe_adap[0].fe, tun_i2c,
  2749. &dib7000p_xc4000_tunerconfig)
  2750. == NULL ? -ENODEV : 0;
  2751. }
  2752. static struct lgdt3305_config hcw_lgdt3305_config = {
  2753. .i2c_addr = 0x0e,
  2754. .mpeg_mode = LGDT3305_MPEG_PARALLEL,
  2755. .tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE,
  2756. .tpvalid_polarity = LGDT3305_TP_VALID_LOW,
  2757. .deny_i2c_rptr = 0,
  2758. .spectral_inversion = 1,
  2759. .qam_if_khz = 6000,
  2760. .vsb_if_khz = 6000,
  2761. .usref_8vsb = 0x0500,
  2762. };
  2763. static struct mxl5007t_config hcw_mxl5007t_config = {
  2764. .xtal_freq_hz = MxL_XTAL_25_MHZ,
  2765. .if_freq_hz = MxL_IF_6_MHZ,
  2766. .invert_if = 1,
  2767. };
  2768. /* TIGER-ATSC map:
  2769. GPIO0 - LNA_CTR (H: LNA power enabled, L: LNA power disabled)
  2770. GPIO1 - ANT_SEL (H: VPA, L: MCX)
  2771. GPIO4 - SCL2
  2772. GPIO6 - EN_TUNER
  2773. GPIO7 - SDA2
  2774. GPIO10 - DEM_RST
  2775. MXL is behind LG's i2c repeater. LG is on SCL2/SDA2 gpios on the DIB
  2776. */
  2777. static int lgdt3305_frontend_attach(struct dvb_usb_adapter *adap)
  2778. {
  2779. struct dib0700_state *st = adap->dev->priv;
  2780. /* Make use of the new i2c functions from FW 1.20 */
  2781. st->fw_use_new_i2c_api = 1;
  2782. st->disable_streaming_master_mode = 1;
  2783. /* fe power enable */
  2784. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
  2785. msleep(30);
  2786. dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
  2787. msleep(30);
  2788. /* demod reset */
  2789. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  2790. msleep(30);
  2791. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
  2792. msleep(30);
  2793. dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
  2794. msleep(30);
  2795. adap->fe_adap[0].fe = dvb_attach(lgdt3305_attach,
  2796. &hcw_lgdt3305_config,
  2797. &adap->dev->i2c_adap);
  2798. return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
  2799. }
  2800. static int mxl5007t_tuner_attach(struct dvb_usb_adapter *adap)
  2801. {
  2802. return dvb_attach(mxl5007t_attach, adap->fe_adap[0].fe,
  2803. &adap->dev->i2c_adap, 0x60,
  2804. &hcw_mxl5007t_config) == NULL ? -ENODEV : 0;
  2805. }
  2806. /* DVB-USB and USB stuff follows */
  2807. struct usb_device_id dib0700_usb_id_table[] = {
  2808. /* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },
  2809. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) },
  2810. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },
  2811. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },
  2812. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },
  2813. /* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },
  2814. { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) },
  2815. { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) },
  2816. { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) },
  2817. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) },
  2818. /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) },
  2819. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) },
  2820. { USB_DEVICE(USB_VID_TERRATEC,
  2821. USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) },
  2822. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) },
  2823. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) },
  2824. /* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) },
  2825. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) },
  2826. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) },
  2827. { USB_DEVICE(USB_VID_PINNACLE,
  2828. USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) },
  2829. { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) },
  2830. /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) },
  2831. { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) },
  2832. { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) },
  2833. { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) },
  2834. { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) },
  2835. /* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) },
  2836. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) },
  2837. { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) },
  2838. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) },
  2839. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) },
  2840. /* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) },
  2841. { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) },
  2842. { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) },
  2843. { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) },
  2844. { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) },
  2845. /* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) },
  2846. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) },
  2847. { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U8000) },
  2848. { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700PH) },
  2849. { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000H) },
  2850. /* 40 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E) },
  2851. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E_SE) },
  2852. { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_EXPRESS) },
  2853. { USB_DEVICE(USB_VID_TERRATEC,
  2854. USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2) },
  2855. { USB_DEVICE(USB_VID_SONY, USB_PID_SONY_PLAYTV) },
  2856. /* 45 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_PD378S) },
  2857. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC) },
  2858. { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC_B210) },
  2859. { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_MC770) },
  2860. { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT) },
  2861. /* 50 */{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_Dlx) },
  2862. { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_H) },
  2863. { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T3) },
  2864. { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T5) },
  2865. { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D) },
  2866. /* 55 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D_2) },
  2867. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73A) },
  2868. { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV73ESE) },
  2869. { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV282E) },
  2870. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7770P) },
  2871. /* 60 */{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS_2) },
  2872. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) },
  2873. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) },
  2874. { USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x000, 0x3f00) },
  2875. { USB_DEVICE(USB_VID_EVOLUTEPC, USB_PID_TVWAY_PLUS) },
  2876. /* 65 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) },
  2877. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) },
  2878. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK8096GP) },
  2879. { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DIVERSITY) },
  2880. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM9090M) },
  2881. /* 70 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM8096MD) },
  2882. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM9090MD) },
  2883. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM7090) },
  2884. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7090PVR) },
  2885. { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_AIRSTAR_TELESTICK_2) },
  2886. /* 75 */{ USB_DEVICE(USB_VID_MEDION, USB_PID_CREATIX_CTX1921) },
  2887. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV340E) },
  2888. { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV340E_SE) },
  2889. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7090E) },
  2890. { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7790E) },
  2891. /* 80 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE8096P) },
  2892. { 0 } /* Terminating entry */
  2893. };
  2894. MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
  2895. #define DIB0700_DEFAULT_DEVICE_PROPERTIES \
  2896. .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
  2897. .usb_ctrl = DEVICE_SPECIFIC, \
  2898. .firmware = "dvb-usb-dib0700-1.20.fw", \
  2899. .download_firmware = dib0700_download_firmware, \
  2900. .no_reconnect = 1, \
  2901. .size_of_priv = sizeof(struct dib0700_state), \
  2902. .i2c_algo = &dib0700_i2c_algo, \
  2903. .identify_state = dib0700_identify_state
  2904. #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
  2905. .streaming_ctrl = dib0700_streaming_ctrl, \
  2906. .stream = { \
  2907. .type = USB_BULK, \
  2908. .count = 4, \
  2909. .endpoint = ep, \
  2910. .u = { \
  2911. .bulk = { \
  2912. .buffersize = 39480, \
  2913. } \
  2914. } \
  2915. }
  2916. struct dvb_usb_device_properties dib0700_devices[] = {
  2917. {
  2918. DIB0700_DEFAULT_DEVICE_PROPERTIES,
  2919. .num_adapters = 1,
  2920. .adapter = {
  2921. {
  2922. .num_frontends = 1,
  2923. .fe = {{
  2924. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  2925. .pid_filter_count = 32,
  2926. .pid_filter = stk7700p_pid_filter,
  2927. .pid_filter_ctrl = stk7700p_pid_filter_ctrl,
  2928. .frontend_attach = stk7700p_frontend_attach,
  2929. .tuner_attach = stk7700p_tuner_attach,
  2930. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  2931. }},
  2932. },
  2933. },
  2934. .num_device_descs = 8,
  2935. .devices = {
  2936. { "DiBcom STK7700P reference design",
  2937. { &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] },
  2938. { NULL },
  2939. },
  2940. { "Hauppauge Nova-T Stick",
  2941. { &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL },
  2942. { NULL },
  2943. },
  2944. { "AVerMedia AVerTV DVB-T Volar",
  2945. { &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] },
  2946. { NULL },
  2947. },
  2948. { "Compro Videomate U500",
  2949. { &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] },
  2950. { NULL },
  2951. },
  2952. { "Uniwill STK7700P based (Hama and others)",
  2953. { &dib0700_usb_id_table[7], NULL },
  2954. { NULL },
  2955. },
  2956. { "Leadtek Winfast DTV Dongle (STK7700P based)",
  2957. { &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] },
  2958. { NULL },
  2959. },
  2960. { "AVerMedia AVerTV DVB-T Express",
  2961. { &dib0700_usb_id_table[20] },
  2962. { NULL },
  2963. },
  2964. { "Gigabyte U7000",
  2965. { &dib0700_usb_id_table[21], NULL },
  2966. { NULL },
  2967. }
  2968. },
  2969. .rc.core = {
  2970. .rc_interval = DEFAULT_RC_INTERVAL,
  2971. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  2972. .rc_query = dib0700_rc_query_old_firmware,
  2973. .allowed_protos = RC_TYPE_RC5 |
  2974. RC_TYPE_RC6 |
  2975. RC_TYPE_NEC,
  2976. .change_protocol = dib0700_change_protocol,
  2977. },
  2978. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  2979. .num_adapters = 2,
  2980. .adapter = {
  2981. {
  2982. .num_frontends = 1,
  2983. .fe = {{
  2984. .frontend_attach = bristol_frontend_attach,
  2985. .tuner_attach = bristol_tuner_attach,
  2986. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  2987. }},
  2988. }, {
  2989. .num_frontends = 1,
  2990. .fe = {{
  2991. .frontend_attach = bristol_frontend_attach,
  2992. .tuner_attach = bristol_tuner_attach,
  2993. DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
  2994. }},
  2995. }
  2996. },
  2997. .num_device_descs = 1,
  2998. .devices = {
  2999. { "Hauppauge Nova-T 500 Dual DVB-T",
  3000. { &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL },
  3001. { NULL },
  3002. },
  3003. },
  3004. .rc.core = {
  3005. .rc_interval = DEFAULT_RC_INTERVAL,
  3006. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3007. .rc_query = dib0700_rc_query_old_firmware,
  3008. .allowed_protos = RC_TYPE_RC5 |
  3009. RC_TYPE_RC6 |
  3010. RC_TYPE_NEC,
  3011. .change_protocol = dib0700_change_protocol,
  3012. },
  3013. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3014. .num_adapters = 2,
  3015. .adapter = {
  3016. {
  3017. .num_frontends = 1,
  3018. .fe = {{
  3019. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3020. .pid_filter_count = 32,
  3021. .pid_filter = stk70x0p_pid_filter,
  3022. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  3023. .frontend_attach = stk7700d_frontend_attach,
  3024. .tuner_attach = stk7700d_tuner_attach,
  3025. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3026. }},
  3027. }, {
  3028. .num_frontends = 1,
  3029. .fe = {{
  3030. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3031. .pid_filter_count = 32,
  3032. .pid_filter = stk70x0p_pid_filter,
  3033. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  3034. .frontend_attach = stk7700d_frontend_attach,
  3035. .tuner_attach = stk7700d_tuner_attach,
  3036. DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
  3037. }},
  3038. }
  3039. },
  3040. .num_device_descs = 5,
  3041. .devices = {
  3042. { "Pinnacle PCTV 2000e",
  3043. { &dib0700_usb_id_table[11], NULL },
  3044. { NULL },
  3045. },
  3046. { "Terratec Cinergy DT XS Diversity",
  3047. { &dib0700_usb_id_table[12], NULL },
  3048. { NULL },
  3049. },
  3050. { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",
  3051. { &dib0700_usb_id_table[13], NULL },
  3052. { NULL },
  3053. },
  3054. { "DiBcom STK7700D reference design",
  3055. { &dib0700_usb_id_table[14], NULL },
  3056. { NULL },
  3057. },
  3058. { "YUAN High-Tech DiBcom STK7700D",
  3059. { &dib0700_usb_id_table[55], NULL },
  3060. { NULL },
  3061. },
  3062. },
  3063. .rc.core = {
  3064. .rc_interval = DEFAULT_RC_INTERVAL,
  3065. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3066. .rc_query = dib0700_rc_query_old_firmware,
  3067. .allowed_protos = RC_TYPE_RC5 |
  3068. RC_TYPE_RC6 |
  3069. RC_TYPE_NEC,
  3070. .change_protocol = dib0700_change_protocol,
  3071. },
  3072. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3073. .num_adapters = 1,
  3074. .adapter = {
  3075. {
  3076. .num_frontends = 1,
  3077. .fe = {{
  3078. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3079. .pid_filter_count = 32,
  3080. .pid_filter = stk70x0p_pid_filter,
  3081. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  3082. .frontend_attach = stk7700P2_frontend_attach,
  3083. .tuner_attach = stk7700d_tuner_attach,
  3084. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3085. }},
  3086. },
  3087. },
  3088. .num_device_descs = 3,
  3089. .devices = {
  3090. { "ASUS My Cinema U3000 Mini DVBT Tuner",
  3091. { &dib0700_usb_id_table[23], NULL },
  3092. { NULL },
  3093. },
  3094. { "Yuan EC372S",
  3095. { &dib0700_usb_id_table[31], NULL },
  3096. { NULL },
  3097. },
  3098. { "Terratec Cinergy T Express",
  3099. { &dib0700_usb_id_table[42], NULL },
  3100. { NULL },
  3101. }
  3102. },
  3103. .rc.core = {
  3104. .rc_interval = DEFAULT_RC_INTERVAL,
  3105. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3106. .module_name = "dib0700",
  3107. .rc_query = dib0700_rc_query_old_firmware,
  3108. .allowed_protos = RC_TYPE_RC5 |
  3109. RC_TYPE_RC6 |
  3110. RC_TYPE_NEC,
  3111. .change_protocol = dib0700_change_protocol,
  3112. },
  3113. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3114. .num_adapters = 1,
  3115. .adapter = {
  3116. {
  3117. .num_frontends = 1,
  3118. .fe = {{
  3119. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3120. .pid_filter_count = 32,
  3121. .pid_filter = stk70x0p_pid_filter,
  3122. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  3123. .frontend_attach = stk7070p_frontend_attach,
  3124. .tuner_attach = dib7070p_tuner_attach,
  3125. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3126. }},
  3127. .size_of_priv = sizeof(struct dib0700_adapter_state),
  3128. },
  3129. },
  3130. .num_device_descs = 11,
  3131. .devices = {
  3132. { "DiBcom STK7070P reference design",
  3133. { &dib0700_usb_id_table[15], NULL },
  3134. { NULL },
  3135. },
  3136. { "Pinnacle PCTV DVB-T Flash Stick",
  3137. { &dib0700_usb_id_table[16], NULL },
  3138. { NULL },
  3139. },
  3140. { "Artec T14BR DVB-T",
  3141. { &dib0700_usb_id_table[22], NULL },
  3142. { NULL },
  3143. },
  3144. { "ASUS My Cinema U3100 Mini DVBT Tuner",
  3145. { &dib0700_usb_id_table[24], NULL },
  3146. { NULL },
  3147. },
  3148. { "Hauppauge Nova-T Stick",
  3149. { &dib0700_usb_id_table[25], NULL },
  3150. { NULL },
  3151. },
  3152. { "Hauppauge Nova-T MyTV.t",
  3153. { &dib0700_usb_id_table[26], NULL },
  3154. { NULL },
  3155. },
  3156. { "Pinnacle PCTV 72e",
  3157. { &dib0700_usb_id_table[29], NULL },
  3158. { NULL },
  3159. },
  3160. { "Pinnacle PCTV 73e",
  3161. { &dib0700_usb_id_table[30], NULL },
  3162. { NULL },
  3163. },
  3164. { "Elgato EyeTV DTT",
  3165. { &dib0700_usb_id_table[49], NULL },
  3166. { NULL },
  3167. },
  3168. { "Yuan PD378S",
  3169. { &dib0700_usb_id_table[45], NULL },
  3170. { NULL },
  3171. },
  3172. { "Elgato EyeTV Dtt Dlx PD378S",
  3173. { &dib0700_usb_id_table[50], NULL },
  3174. { NULL },
  3175. },
  3176. },
  3177. .rc.core = {
  3178. .rc_interval = DEFAULT_RC_INTERVAL,
  3179. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3180. .module_name = "dib0700",
  3181. .rc_query = dib0700_rc_query_old_firmware,
  3182. .allowed_protos = RC_TYPE_RC5 |
  3183. RC_TYPE_RC6 |
  3184. RC_TYPE_NEC,
  3185. .change_protocol = dib0700_change_protocol,
  3186. },
  3187. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3188. .num_adapters = 1,
  3189. .adapter = {
  3190. {
  3191. .num_frontends = 1,
  3192. .fe = {{
  3193. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3194. .pid_filter_count = 32,
  3195. .pid_filter = stk70x0p_pid_filter,
  3196. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  3197. .frontend_attach = stk7070p_frontend_attach,
  3198. .tuner_attach = dib7070p_tuner_attach,
  3199. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3200. }},
  3201. .size_of_priv = sizeof(struct dib0700_adapter_state),
  3202. },
  3203. },
  3204. .num_device_descs = 3,
  3205. .devices = {
  3206. { "Pinnacle PCTV 73A",
  3207. { &dib0700_usb_id_table[56], NULL },
  3208. { NULL },
  3209. },
  3210. { "Pinnacle PCTV 73e SE",
  3211. { &dib0700_usb_id_table[57], &dib0700_usb_id_table[65], NULL },
  3212. { NULL },
  3213. },
  3214. { "Pinnacle PCTV 282e",
  3215. { &dib0700_usb_id_table[58], &dib0700_usb_id_table[66], NULL },
  3216. { NULL },
  3217. },
  3218. },
  3219. .rc.core = {
  3220. .rc_interval = DEFAULT_RC_INTERVAL,
  3221. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3222. .module_name = "dib0700",
  3223. .rc_query = dib0700_rc_query_old_firmware,
  3224. .allowed_protos = RC_TYPE_RC5 |
  3225. RC_TYPE_RC6 |
  3226. RC_TYPE_NEC,
  3227. .change_protocol = dib0700_change_protocol,
  3228. },
  3229. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3230. .num_adapters = 2,
  3231. .adapter = {
  3232. {
  3233. .num_frontends = 1,
  3234. .fe = {{
  3235. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3236. .pid_filter_count = 32,
  3237. .pid_filter = stk70x0p_pid_filter,
  3238. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  3239. .frontend_attach = stk7070pd_frontend_attach0,
  3240. .tuner_attach = dib7070p_tuner_attach,
  3241. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3242. }},
  3243. .size_of_priv = sizeof(struct dib0700_adapter_state),
  3244. }, {
  3245. .num_frontends = 1,
  3246. .fe = {{
  3247. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3248. .pid_filter_count = 32,
  3249. .pid_filter = stk70x0p_pid_filter,
  3250. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  3251. .frontend_attach = stk7070pd_frontend_attach1,
  3252. .tuner_attach = dib7070p_tuner_attach,
  3253. DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
  3254. }},
  3255. .size_of_priv = sizeof(struct dib0700_adapter_state),
  3256. }
  3257. },
  3258. .num_device_descs = 6,
  3259. .devices = {
  3260. { "DiBcom STK7070PD reference design",
  3261. { &dib0700_usb_id_table[17], NULL },
  3262. { NULL },
  3263. },
  3264. { "Pinnacle PCTV Dual DVB-T Diversity Stick",
  3265. { &dib0700_usb_id_table[18], NULL },
  3266. { NULL },
  3267. },
  3268. { "Hauppauge Nova-TD Stick (52009)",
  3269. { &dib0700_usb_id_table[35], NULL },
  3270. { NULL },
  3271. },
  3272. { "Hauppauge Nova-TD-500 (84xxx)",
  3273. { &dib0700_usb_id_table[36], NULL },
  3274. { NULL },
  3275. },
  3276. { "Terratec Cinergy DT USB XS Diversity/ T5",
  3277. { &dib0700_usb_id_table[43],
  3278. &dib0700_usb_id_table[53], NULL},
  3279. { NULL },
  3280. },
  3281. { "Sony PlayTV",
  3282. { &dib0700_usb_id_table[44], NULL },
  3283. { NULL },
  3284. },
  3285. },
  3286. .rc.core = {
  3287. .rc_interval = DEFAULT_RC_INTERVAL,
  3288. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3289. .module_name = "dib0700",
  3290. .rc_query = dib0700_rc_query_old_firmware,
  3291. .allowed_protos = RC_TYPE_RC5 |
  3292. RC_TYPE_RC6 |
  3293. RC_TYPE_NEC,
  3294. .change_protocol = dib0700_change_protocol,
  3295. },
  3296. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3297. .num_adapters = 2,
  3298. .adapter = {
  3299. {
  3300. .num_frontends = 1,
  3301. .fe = {{
  3302. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3303. .pid_filter_count = 32,
  3304. .pid_filter = stk70x0p_pid_filter,
  3305. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  3306. .frontend_attach = stk7070pd_frontend_attach0,
  3307. .tuner_attach = dib7070p_tuner_attach,
  3308. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3309. }},
  3310. .size_of_priv = sizeof(struct dib0700_adapter_state),
  3311. }, {
  3312. .num_frontends = 1,
  3313. .fe = {{
  3314. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3315. .pid_filter_count = 32,
  3316. .pid_filter = stk70x0p_pid_filter,
  3317. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  3318. .frontend_attach = stk7070pd_frontend_attach1,
  3319. .tuner_attach = dib7070p_tuner_attach,
  3320. DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
  3321. }},
  3322. .size_of_priv = sizeof(struct dib0700_adapter_state),
  3323. }
  3324. },
  3325. .num_device_descs = 1,
  3326. .devices = {
  3327. { "Elgato EyeTV Diversity",
  3328. { &dib0700_usb_id_table[68], NULL },
  3329. { NULL },
  3330. },
  3331. },
  3332. .rc.core = {
  3333. .rc_interval = DEFAULT_RC_INTERVAL,
  3334. .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
  3335. .module_name = "dib0700",
  3336. .rc_query = dib0700_rc_query_old_firmware,
  3337. .allowed_protos = RC_TYPE_RC5 |
  3338. RC_TYPE_RC6 |
  3339. RC_TYPE_NEC,
  3340. .change_protocol = dib0700_change_protocol,
  3341. },
  3342. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3343. .num_adapters = 1,
  3344. .adapter = {
  3345. {
  3346. .num_frontends = 1,
  3347. .fe = {{
  3348. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3349. .pid_filter_count = 32,
  3350. .pid_filter = stk70x0p_pid_filter,
  3351. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  3352. .frontend_attach = stk7700ph_frontend_attach,
  3353. .tuner_attach = stk7700ph_tuner_attach,
  3354. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3355. }},
  3356. .size_of_priv = sizeof(struct
  3357. dib0700_adapter_state),
  3358. },
  3359. },
  3360. .num_device_descs = 9,
  3361. .devices = {
  3362. { "Terratec Cinergy HT USB XE",
  3363. { &dib0700_usb_id_table[27], NULL },
  3364. { NULL },
  3365. },
  3366. { "Pinnacle Expresscard 320cx",
  3367. { &dib0700_usb_id_table[28], NULL },
  3368. { NULL },
  3369. },
  3370. { "Terratec Cinergy HT Express",
  3371. { &dib0700_usb_id_table[32], NULL },
  3372. { NULL },
  3373. },
  3374. { "Gigabyte U8000-RH",
  3375. { &dib0700_usb_id_table[37], NULL },
  3376. { NULL },
  3377. },
  3378. { "YUAN High-Tech STK7700PH",
  3379. { &dib0700_usb_id_table[38], NULL },
  3380. { NULL },
  3381. },
  3382. { "Asus My Cinema-U3000Hybrid",
  3383. { &dib0700_usb_id_table[39], NULL },
  3384. { NULL },
  3385. },
  3386. { "YUAN High-Tech MC770",
  3387. { &dib0700_usb_id_table[48], NULL },
  3388. { NULL },
  3389. },
  3390. { "Leadtek WinFast DTV Dongle H",
  3391. { &dib0700_usb_id_table[51], NULL },
  3392. { NULL },
  3393. },
  3394. { "YUAN High-Tech STK7700D",
  3395. { &dib0700_usb_id_table[54], NULL },
  3396. { NULL },
  3397. },
  3398. },
  3399. .rc.core = {
  3400. .rc_interval = DEFAULT_RC_INTERVAL,
  3401. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3402. .module_name = "dib0700",
  3403. .rc_query = dib0700_rc_query_old_firmware,
  3404. .allowed_protos = RC_TYPE_RC5 |
  3405. RC_TYPE_RC6 |
  3406. RC_TYPE_NEC,
  3407. .change_protocol = dib0700_change_protocol,
  3408. },
  3409. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3410. .num_adapters = 1,
  3411. .adapter = {
  3412. {
  3413. .num_frontends = 1,
  3414. .fe = {{
  3415. .frontend_attach = s5h1411_frontend_attach,
  3416. .tuner_attach = xc5000_tuner_attach,
  3417. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3418. }},
  3419. .size_of_priv = sizeof(struct
  3420. dib0700_adapter_state),
  3421. },
  3422. },
  3423. .num_device_descs = 2,
  3424. .devices = {
  3425. { "Pinnacle PCTV HD Pro USB Stick",
  3426. { &dib0700_usb_id_table[40], NULL },
  3427. { NULL },
  3428. },
  3429. { "Pinnacle PCTV HD USB Stick",
  3430. { &dib0700_usb_id_table[41], NULL },
  3431. { NULL },
  3432. },
  3433. },
  3434. .rc.core = {
  3435. .rc_interval = DEFAULT_RC_INTERVAL,
  3436. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3437. .module_name = "dib0700",
  3438. .rc_query = dib0700_rc_query_old_firmware,
  3439. .allowed_protos = RC_TYPE_RC5 |
  3440. RC_TYPE_RC6 |
  3441. RC_TYPE_NEC,
  3442. .change_protocol = dib0700_change_protocol,
  3443. },
  3444. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3445. .num_adapters = 1,
  3446. .adapter = {
  3447. {
  3448. .num_frontends = 1,
  3449. .fe = {{
  3450. .frontend_attach = lgdt3305_frontend_attach,
  3451. .tuner_attach = mxl5007t_tuner_attach,
  3452. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3453. }},
  3454. .size_of_priv = sizeof(struct
  3455. dib0700_adapter_state),
  3456. },
  3457. },
  3458. .num_device_descs = 2,
  3459. .devices = {
  3460. { "Hauppauge ATSC MiniCard (B200)",
  3461. { &dib0700_usb_id_table[46], NULL },
  3462. { NULL },
  3463. },
  3464. { "Hauppauge ATSC MiniCard (B210)",
  3465. { &dib0700_usb_id_table[47], NULL },
  3466. { NULL },
  3467. },
  3468. },
  3469. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3470. .num_adapters = 1,
  3471. .adapter = {
  3472. {
  3473. .num_frontends = 1,
  3474. .fe = {{
  3475. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3476. .pid_filter_count = 32,
  3477. .pid_filter = stk70x0p_pid_filter,
  3478. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  3479. .frontend_attach = stk7770p_frontend_attach,
  3480. .tuner_attach = dib7770p_tuner_attach,
  3481. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3482. }},
  3483. .size_of_priv =
  3484. sizeof(struct dib0700_adapter_state),
  3485. },
  3486. },
  3487. .num_device_descs = 4,
  3488. .devices = {
  3489. { "DiBcom STK7770P reference design",
  3490. { &dib0700_usb_id_table[59], NULL },
  3491. { NULL },
  3492. },
  3493. { "Terratec Cinergy T USB XXS (HD)/ T3",
  3494. { &dib0700_usb_id_table[33],
  3495. &dib0700_usb_id_table[52],
  3496. &dib0700_usb_id_table[60], NULL},
  3497. { NULL },
  3498. },
  3499. { "TechniSat AirStar TeleStick 2",
  3500. { &dib0700_usb_id_table[74], NULL },
  3501. { NULL },
  3502. },
  3503. { "Medion CTX1921 DVB-T USB",
  3504. { &dib0700_usb_id_table[75], NULL },
  3505. { NULL },
  3506. },
  3507. },
  3508. .rc.core = {
  3509. .rc_interval = DEFAULT_RC_INTERVAL,
  3510. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3511. .module_name = "dib0700",
  3512. .rc_query = dib0700_rc_query_old_firmware,
  3513. .allowed_protos = RC_TYPE_RC5 |
  3514. RC_TYPE_RC6 |
  3515. RC_TYPE_NEC,
  3516. .change_protocol = dib0700_change_protocol,
  3517. },
  3518. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3519. .num_adapters = 1,
  3520. .adapter = {
  3521. {
  3522. .num_frontends = 1,
  3523. .fe = {{
  3524. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3525. .pid_filter_count = 32,
  3526. .pid_filter = stk80xx_pid_filter,
  3527. .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
  3528. .frontend_attach = stk807x_frontend_attach,
  3529. .tuner_attach = dib807x_tuner_attach,
  3530. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3531. }},
  3532. .size_of_priv =
  3533. sizeof(struct dib0700_adapter_state),
  3534. },
  3535. },
  3536. .num_device_descs = 3,
  3537. .devices = {
  3538. { "DiBcom STK807xP reference design",
  3539. { &dib0700_usb_id_table[62], NULL },
  3540. { NULL },
  3541. },
  3542. { "Prolink Pixelview SBTVD",
  3543. { &dib0700_usb_id_table[63], NULL },
  3544. { NULL },
  3545. },
  3546. { "EvolutePC TVWay+",
  3547. { &dib0700_usb_id_table[64], NULL },
  3548. { NULL },
  3549. },
  3550. },
  3551. .rc.core = {
  3552. .rc_interval = DEFAULT_RC_INTERVAL,
  3553. .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
  3554. .module_name = "dib0700",
  3555. .rc_query = dib0700_rc_query_old_firmware,
  3556. .allowed_protos = RC_TYPE_RC5 |
  3557. RC_TYPE_RC6 |
  3558. RC_TYPE_NEC,
  3559. .change_protocol = dib0700_change_protocol,
  3560. },
  3561. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3562. .num_adapters = 2,
  3563. .adapter = {
  3564. {
  3565. .num_frontends = 1,
  3566. .fe = {{
  3567. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3568. .pid_filter_count = 32,
  3569. .pid_filter = stk80xx_pid_filter,
  3570. .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
  3571. .frontend_attach = stk807xpvr_frontend_attach0,
  3572. .tuner_attach = dib807x_tuner_attach,
  3573. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3574. }},
  3575. .size_of_priv =
  3576. sizeof(struct dib0700_adapter_state),
  3577. },
  3578. {
  3579. .num_frontends = 1,
  3580. .fe = {{
  3581. .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3582. .pid_filter_count = 32,
  3583. .pid_filter = stk80xx_pid_filter,
  3584. .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
  3585. .frontend_attach = stk807xpvr_frontend_attach1,
  3586. .tuner_attach = dib807x_tuner_attach,
  3587. DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
  3588. }},
  3589. .size_of_priv =
  3590. sizeof(struct dib0700_adapter_state),
  3591. },
  3592. },
  3593. .num_device_descs = 1,
  3594. .devices = {
  3595. { "DiBcom STK807xPVR reference design",
  3596. { &dib0700_usb_id_table[61], NULL },
  3597. { NULL },
  3598. },
  3599. },
  3600. .rc.core = {
  3601. .rc_interval = DEFAULT_RC_INTERVAL,
  3602. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3603. .module_name = "dib0700",
  3604. .rc_query = dib0700_rc_query_old_firmware,
  3605. .allowed_protos = RC_TYPE_RC5 |
  3606. RC_TYPE_RC6 |
  3607. RC_TYPE_NEC,
  3608. .change_protocol = dib0700_change_protocol,
  3609. },
  3610. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3611. .num_adapters = 1,
  3612. .adapter = {
  3613. {
  3614. .num_frontends = 1,
  3615. .fe = {{
  3616. .caps = DVB_USB_ADAP_HAS_PID_FILTER |
  3617. DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3618. .pid_filter_count = 32,
  3619. .pid_filter = stk80xx_pid_filter,
  3620. .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
  3621. .frontend_attach = stk809x_frontend_attach,
  3622. .tuner_attach = dib809x_tuner_attach,
  3623. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3624. }},
  3625. .size_of_priv =
  3626. sizeof(struct dib0700_adapter_state),
  3627. },
  3628. },
  3629. .num_device_descs = 1,
  3630. .devices = {
  3631. { "DiBcom STK8096GP reference design",
  3632. { &dib0700_usb_id_table[67], NULL },
  3633. { NULL },
  3634. },
  3635. },
  3636. .rc.core = {
  3637. .rc_interval = DEFAULT_RC_INTERVAL,
  3638. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3639. .module_name = "dib0700",
  3640. .rc_query = dib0700_rc_query_old_firmware,
  3641. .allowed_protos = RC_TYPE_RC5 |
  3642. RC_TYPE_RC6 |
  3643. RC_TYPE_NEC,
  3644. .change_protocol = dib0700_change_protocol,
  3645. },
  3646. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3647. .num_adapters = 1,
  3648. .adapter = {
  3649. {
  3650. .num_frontends = 1,
  3651. .fe = {{
  3652. .caps = DVB_USB_ADAP_HAS_PID_FILTER |
  3653. DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3654. .pid_filter_count = 32,
  3655. .pid_filter = dib90x0_pid_filter,
  3656. .pid_filter_ctrl = dib90x0_pid_filter_ctrl,
  3657. .frontend_attach = stk9090m_frontend_attach,
  3658. .tuner_attach = dib9090_tuner_attach,
  3659. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3660. }},
  3661. .size_of_priv =
  3662. sizeof(struct dib0700_adapter_state),
  3663. },
  3664. },
  3665. .num_device_descs = 1,
  3666. .devices = {
  3667. { "DiBcom STK9090M reference design",
  3668. { &dib0700_usb_id_table[69], NULL },
  3669. { NULL },
  3670. },
  3671. },
  3672. .rc.core = {
  3673. .rc_interval = DEFAULT_RC_INTERVAL,
  3674. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3675. .module_name = "dib0700",
  3676. .rc_query = dib0700_rc_query_old_firmware,
  3677. .allowed_protos = RC_TYPE_RC5 |
  3678. RC_TYPE_RC6 |
  3679. RC_TYPE_NEC,
  3680. .change_protocol = dib0700_change_protocol,
  3681. },
  3682. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3683. .num_adapters = 1,
  3684. .adapter = {
  3685. {
  3686. .num_frontends = 1,
  3687. .fe = {{
  3688. .caps = DVB_USB_ADAP_HAS_PID_FILTER |
  3689. DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3690. .pid_filter_count = 32,
  3691. .pid_filter = stk80xx_pid_filter,
  3692. .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
  3693. .frontend_attach = nim8096md_frontend_attach,
  3694. .tuner_attach = nim8096md_tuner_attach,
  3695. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3696. }},
  3697. .size_of_priv =
  3698. sizeof(struct dib0700_adapter_state),
  3699. },
  3700. },
  3701. .num_device_descs = 1,
  3702. .devices = {
  3703. { "DiBcom NIM8096MD reference design",
  3704. { &dib0700_usb_id_table[70], NULL },
  3705. { NULL },
  3706. },
  3707. },
  3708. .rc.core = {
  3709. .rc_interval = DEFAULT_RC_INTERVAL,
  3710. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3711. .module_name = "dib0700",
  3712. .rc_query = dib0700_rc_query_old_firmware,
  3713. .allowed_protos = RC_TYPE_RC5 |
  3714. RC_TYPE_RC6 |
  3715. RC_TYPE_NEC,
  3716. .change_protocol = dib0700_change_protocol,
  3717. },
  3718. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3719. .num_adapters = 1,
  3720. .adapter = {
  3721. {
  3722. .num_frontends = 1,
  3723. .fe = {{
  3724. .caps = DVB_USB_ADAP_HAS_PID_FILTER |
  3725. DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3726. .pid_filter_count = 32,
  3727. .pid_filter = dib90x0_pid_filter,
  3728. .pid_filter_ctrl = dib90x0_pid_filter_ctrl,
  3729. .frontend_attach = nim9090md_frontend_attach,
  3730. .tuner_attach = nim9090md_tuner_attach,
  3731. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3732. }},
  3733. .size_of_priv =
  3734. sizeof(struct dib0700_adapter_state),
  3735. },
  3736. },
  3737. .num_device_descs = 1,
  3738. .devices = {
  3739. { "DiBcom NIM9090MD reference design",
  3740. { &dib0700_usb_id_table[71], NULL },
  3741. { NULL },
  3742. },
  3743. },
  3744. .rc.core = {
  3745. .rc_interval = DEFAULT_RC_INTERVAL,
  3746. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3747. .module_name = "dib0700",
  3748. .rc_query = dib0700_rc_query_old_firmware,
  3749. .allowed_protos = RC_TYPE_RC5 |
  3750. RC_TYPE_RC6 |
  3751. RC_TYPE_NEC,
  3752. .change_protocol = dib0700_change_protocol,
  3753. },
  3754. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3755. .num_adapters = 1,
  3756. .adapter = {
  3757. {
  3758. .num_frontends = 1,
  3759. .fe = {{
  3760. .caps = DVB_USB_ADAP_HAS_PID_FILTER |
  3761. DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3762. .pid_filter_count = 32,
  3763. .pid_filter = stk70x0p_pid_filter,
  3764. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  3765. .frontend_attach = nim7090_frontend_attach,
  3766. .tuner_attach = nim7090_tuner_attach,
  3767. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3768. }},
  3769. .size_of_priv =
  3770. sizeof(struct dib0700_adapter_state),
  3771. },
  3772. },
  3773. .num_device_descs = 1,
  3774. .devices = {
  3775. { "DiBcom NIM7090 reference design",
  3776. { &dib0700_usb_id_table[72], NULL },
  3777. { NULL },
  3778. },
  3779. },
  3780. .rc.core = {
  3781. .rc_interval = DEFAULT_RC_INTERVAL,
  3782. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3783. .module_name = "dib0700",
  3784. .rc_query = dib0700_rc_query_old_firmware,
  3785. .allowed_protos = RC_TYPE_RC5 |
  3786. RC_TYPE_RC6 |
  3787. RC_TYPE_NEC,
  3788. .change_protocol = dib0700_change_protocol,
  3789. },
  3790. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3791. .num_adapters = 2,
  3792. .adapter = {
  3793. {
  3794. .num_frontends = 1,
  3795. .fe = {{
  3796. .caps = DVB_USB_ADAP_HAS_PID_FILTER |
  3797. DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3798. .pid_filter_count = 32,
  3799. .pid_filter = stk70x0p_pid_filter,
  3800. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  3801. .frontend_attach = tfe7090pvr_frontend0_attach,
  3802. .tuner_attach = tfe7090pvr_tuner0_attach,
  3803. DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
  3804. }},
  3805. .size_of_priv =
  3806. sizeof(struct dib0700_adapter_state),
  3807. },
  3808. {
  3809. .num_frontends = 1,
  3810. .fe = {{
  3811. .caps = DVB_USB_ADAP_HAS_PID_FILTER |
  3812. DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3813. .pid_filter_count = 32,
  3814. .pid_filter = stk70x0p_pid_filter,
  3815. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  3816. .frontend_attach = tfe7090pvr_frontend1_attach,
  3817. .tuner_attach = tfe7090pvr_tuner1_attach,
  3818. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3819. }},
  3820. .size_of_priv =
  3821. sizeof(struct dib0700_adapter_state),
  3822. },
  3823. },
  3824. .num_device_descs = 1,
  3825. .devices = {
  3826. { "DiBcom TFE7090PVR reference design",
  3827. { &dib0700_usb_id_table[73], NULL },
  3828. { NULL },
  3829. },
  3830. },
  3831. .rc.core = {
  3832. .rc_interval = DEFAULT_RC_INTERVAL,
  3833. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3834. .module_name = "dib0700",
  3835. .rc_query = dib0700_rc_query_old_firmware,
  3836. .allowed_protos = RC_TYPE_RC5 |
  3837. RC_TYPE_RC6 |
  3838. RC_TYPE_NEC,
  3839. .change_protocol = dib0700_change_protocol,
  3840. },
  3841. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3842. .num_adapters = 1,
  3843. .adapter = {
  3844. {
  3845. .num_frontends = 1,
  3846. .fe = {{
  3847. .frontend_attach = pctv340e_frontend_attach,
  3848. .tuner_attach = xc4000_tuner_attach,
  3849. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3850. }},
  3851. .size_of_priv = sizeof(struct
  3852. dib0700_adapter_state),
  3853. },
  3854. },
  3855. .num_device_descs = 2,
  3856. .devices = {
  3857. { "Pinnacle PCTV 340e HD Pro USB Stick",
  3858. { &dib0700_usb_id_table[76], NULL },
  3859. { NULL },
  3860. },
  3861. { "Pinnacle PCTV Hybrid Stick Solo",
  3862. { &dib0700_usb_id_table[77], NULL },
  3863. { NULL },
  3864. },
  3865. },
  3866. .rc.core = {
  3867. .rc_interval = DEFAULT_RC_INTERVAL,
  3868. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3869. .module_name = "dib0700",
  3870. .rc_query = dib0700_rc_query_old_firmware,
  3871. .allowed_protos = RC_TYPE_RC5 |
  3872. RC_TYPE_RC6 |
  3873. RC_TYPE_NEC,
  3874. .change_protocol = dib0700_change_protocol,
  3875. },
  3876. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3877. .num_adapters = 1,
  3878. .adapter = {
  3879. {
  3880. .num_frontends = 1,
  3881. .fe = {{
  3882. .caps = DVB_USB_ADAP_HAS_PID_FILTER |
  3883. DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3884. .pid_filter_count = 32,
  3885. .pid_filter = stk70x0p_pid_filter,
  3886. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  3887. .frontend_attach = tfe7090e_frontend_attach,
  3888. .tuner_attach = tfe7090e_tuner_attach,
  3889. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3890. } },
  3891. .size_of_priv =
  3892. sizeof(struct dib0700_adapter_state),
  3893. },
  3894. },
  3895. .num_device_descs = 1,
  3896. .devices = {
  3897. { "DiBcom TFE7090E reference design",
  3898. { &dib0700_usb_id_table[78], NULL },
  3899. { NULL },
  3900. },
  3901. },
  3902. .rc.core = {
  3903. .rc_interval = DEFAULT_RC_INTERVAL,
  3904. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3905. .module_name = "dib0700",
  3906. .rc_query = dib0700_rc_query_old_firmware,
  3907. .allowed_protos = RC_TYPE_RC5 |
  3908. RC_TYPE_RC6 |
  3909. RC_TYPE_NEC,
  3910. .change_protocol = dib0700_change_protocol,
  3911. },
  3912. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3913. .num_adapters = 1,
  3914. .adapter = {
  3915. {
  3916. .num_frontends = 1,
  3917. .fe = {{
  3918. .caps = DVB_USB_ADAP_HAS_PID_FILTER |
  3919. DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3920. .pid_filter_count = 32,
  3921. .pid_filter = stk70x0p_pid_filter,
  3922. .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
  3923. .frontend_attach = tfe7790e_frontend_attach,
  3924. .tuner_attach = tfe7790e_tuner_attach,
  3925. DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
  3926. } },
  3927. .size_of_priv =
  3928. sizeof(struct dib0700_adapter_state),
  3929. },
  3930. },
  3931. .num_device_descs = 1,
  3932. .devices = {
  3933. { "DiBcom TFE7790E reference design",
  3934. { &dib0700_usb_id_table[79], NULL },
  3935. { NULL },
  3936. },
  3937. },
  3938. .rc.core = {
  3939. .rc_interval = DEFAULT_RC_INTERVAL,
  3940. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3941. .module_name = "dib0700",
  3942. .rc_query = dib0700_rc_query_old_firmware,
  3943. .allowed_protos = RC_TYPE_RC5 |
  3944. RC_TYPE_RC6 |
  3945. RC_TYPE_NEC,
  3946. .change_protocol = dib0700_change_protocol,
  3947. },
  3948. }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
  3949. .num_adapters = 1,
  3950. .adapter = {
  3951. {
  3952. .num_frontends = 1,
  3953. .fe = {{
  3954. .caps = DVB_USB_ADAP_HAS_PID_FILTER |
  3955. DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
  3956. .pid_filter_count = 32,
  3957. .pid_filter = stk80xx_pid_filter,
  3958. .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
  3959. .frontend_attach = tfe8096p_frontend_attach,
  3960. .tuner_attach = tfe8096p_tuner_attach,
  3961. DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
  3962. } },
  3963. .size_of_priv =
  3964. sizeof(struct dib0700_adapter_state),
  3965. },
  3966. },
  3967. .num_device_descs = 1,
  3968. .devices = {
  3969. { "DiBcom TFE8096P reference design",
  3970. { &dib0700_usb_id_table[80], NULL },
  3971. { NULL },
  3972. },
  3973. },
  3974. .rc.core = {
  3975. .rc_interval = DEFAULT_RC_INTERVAL,
  3976. .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
  3977. .module_name = "dib0700",
  3978. .rc_query = dib0700_rc_query_old_firmware,
  3979. .allowed_protos = RC_TYPE_RC5 |
  3980. RC_TYPE_RC6 |
  3981. RC_TYPE_NEC,
  3982. .change_protocol = dib0700_change_protocol,
  3983. },
  3984. },
  3985. };
  3986. int dib0700_device_count = ARRAY_SIZE(dib0700_devices);