dib0700_devices.c 124 KB

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