cx25840-core.c 210 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340
  1. /* cx25840 - Conexant CX25840 audio/video decoder driver
  2. *
  3. * Copyright (C) 2004 Ulf Eklund
  4. *
  5. * Based on the saa7115 driver and on the first version of Chris Kennedy's
  6. * cx25840 driver.
  7. *
  8. * Changes by Tyler Trafford <tatrafford@comcast.net>
  9. * - cleanup/rewrite for V4L2 API (2005)
  10. *
  11. * VBI support by Hans Verkuil <hverkuil@xs4all.nl>.
  12. *
  13. * NTSC sliced VBI support by Christopher Neufeld <television@cneufeld.ca>
  14. * with additional fixes by Hans Verkuil <hverkuil@xs4all.nl>.
  15. *
  16. * CX23885 support by Steven Toth <stoth@linuxtv.org>.
  17. *
  18. * CX2388[578] IRQ handling, IO Pin mux configuration and other small fixes are
  19. * Copyright (C) 2010 Andy Walls <awalls@md.metrocast.net>
  20. *
  21. * CX23888 DIF support for the HVR1850
  22. * Copyright (C) 2011 Steven Toth <stoth@kernellabs.com>
  23. *
  24. * This program is free software; you can redistribute it and/or
  25. * modify it under the terms of the GNU General Public License
  26. * as published by the Free Software Foundation; either version 2
  27. * of the License, or (at your option) any later version.
  28. *
  29. * This program is distributed in the hope that it will be useful,
  30. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  31. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  32. * GNU General Public License for more details.
  33. *
  34. * You should have received a copy of the GNU General Public License
  35. * along with this program; if not, write to the Free Software
  36. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  37. */
  38. #include <linux/kernel.h>
  39. #include <linux/module.h>
  40. #include <linux/slab.h>
  41. #include <linux/videodev2.h>
  42. #include <linux/i2c.h>
  43. #include <linux/delay.h>
  44. #include <linux/math64.h>
  45. #include <media/v4l2-common.h>
  46. #include <media/v4l2-chip-ident.h>
  47. #include <media/cx25840.h>
  48. #include "cx25840-core.h"
  49. MODULE_DESCRIPTION("Conexant CX25840 audio/video decoder driver");
  50. MODULE_AUTHOR("Ulf Eklund, Chris Kennedy, Hans Verkuil, Tyler Trafford");
  51. MODULE_LICENSE("GPL");
  52. #define CX25840_VID_INT_STAT_REG 0x410
  53. #define CX25840_VID_INT_STAT_BITS 0x0000ffff
  54. #define CX25840_VID_INT_MASK_BITS 0xffff0000
  55. #define CX25840_VID_INT_MASK_SHFT 16
  56. #define CX25840_VID_INT_MASK_REG 0x412
  57. #define CX23885_AUD_MC_INT_MASK_REG 0x80c
  58. #define CX23885_AUD_MC_INT_STAT_BITS 0xffff0000
  59. #define CX23885_AUD_MC_INT_CTRL_BITS 0x0000ffff
  60. #define CX23885_AUD_MC_INT_STAT_SHFT 16
  61. #define CX25840_AUD_INT_CTRL_REG 0x812
  62. #define CX25840_AUD_INT_STAT_REG 0x813
  63. #define CX23885_PIN_CTRL_IRQ_REG 0x123
  64. #define CX23885_PIN_CTRL_IRQ_IR_STAT 0x40
  65. #define CX23885_PIN_CTRL_IRQ_AUD_STAT 0x20
  66. #define CX23885_PIN_CTRL_IRQ_VID_STAT 0x10
  67. #define CX25840_IR_STATS_REG 0x210
  68. #define CX25840_IR_IRQEN_REG 0x214
  69. static int cx25840_debug;
  70. module_param_named(debug,cx25840_debug, int, 0644);
  71. MODULE_PARM_DESC(debug, "Debugging messages [0=Off (default) 1=On]");
  72. /* ----------------------------------------------------------------------- */
  73. static void cx23888_std_setup(struct i2c_client *client);
  74. int cx25840_write(struct i2c_client *client, u16 addr, u8 value)
  75. {
  76. u8 buffer[3];
  77. buffer[0] = addr >> 8;
  78. buffer[1] = addr & 0xff;
  79. buffer[2] = value;
  80. return i2c_master_send(client, buffer, 3);
  81. }
  82. int cx25840_write4(struct i2c_client *client, u16 addr, u32 value)
  83. {
  84. u8 buffer[6];
  85. buffer[0] = addr >> 8;
  86. buffer[1] = addr & 0xff;
  87. buffer[2] = value & 0xff;
  88. buffer[3] = (value >> 8) & 0xff;
  89. buffer[4] = (value >> 16) & 0xff;
  90. buffer[5] = value >> 24;
  91. return i2c_master_send(client, buffer, 6);
  92. }
  93. u8 cx25840_read(struct i2c_client * client, u16 addr)
  94. {
  95. struct i2c_msg msgs[2];
  96. u8 tx_buf[2], rx_buf[1];
  97. /* Write register address */
  98. tx_buf[0] = addr >> 8;
  99. tx_buf[1] = addr & 0xff;
  100. msgs[0].addr = client->addr;
  101. msgs[0].flags = 0;
  102. msgs[0].len = 2;
  103. msgs[0].buf = (char *) tx_buf;
  104. /* Read data from register */
  105. msgs[1].addr = client->addr;
  106. msgs[1].flags = I2C_M_RD;
  107. msgs[1].len = 1;
  108. msgs[1].buf = (char *) rx_buf;
  109. if (i2c_transfer(client->adapter, msgs, 2) < 2)
  110. return 0;
  111. return rx_buf[0];
  112. }
  113. u32 cx25840_read4(struct i2c_client * client, u16 addr)
  114. {
  115. struct i2c_msg msgs[2];
  116. u8 tx_buf[2], rx_buf[4];
  117. /* Write register address */
  118. tx_buf[0] = addr >> 8;
  119. tx_buf[1] = addr & 0xff;
  120. msgs[0].addr = client->addr;
  121. msgs[0].flags = 0;
  122. msgs[0].len = 2;
  123. msgs[0].buf = (char *) tx_buf;
  124. /* Read data from registers */
  125. msgs[1].addr = client->addr;
  126. msgs[1].flags = I2C_M_RD;
  127. msgs[1].len = 4;
  128. msgs[1].buf = (char *) rx_buf;
  129. if (i2c_transfer(client->adapter, msgs, 2) < 2)
  130. return 0;
  131. return (rx_buf[3] << 24) | (rx_buf[2] << 16) | (rx_buf[1] << 8) |
  132. rx_buf[0];
  133. }
  134. int cx25840_and_or(struct i2c_client *client, u16 addr, unsigned and_mask,
  135. u8 or_value)
  136. {
  137. return cx25840_write(client, addr,
  138. (cx25840_read(client, addr) & and_mask) |
  139. or_value);
  140. }
  141. int cx25840_and_or4(struct i2c_client *client, u16 addr, u32 and_mask,
  142. u32 or_value)
  143. {
  144. return cx25840_write4(client, addr,
  145. (cx25840_read4(client, addr) & and_mask) |
  146. or_value);
  147. }
  148. /* ----------------------------------------------------------------------- */
  149. static int set_input(struct i2c_client *client, enum cx25840_video_input vid_input,
  150. enum cx25840_audio_input aud_input);
  151. /* ----------------------------------------------------------------------- */
  152. static int cx23885_s_io_pin_config(struct v4l2_subdev *sd, size_t n,
  153. struct v4l2_subdev_io_pin_config *p)
  154. {
  155. struct i2c_client *client = v4l2_get_subdevdata(sd);
  156. int i;
  157. u32 pin_ctrl;
  158. u8 gpio_oe, gpio_data, strength;
  159. pin_ctrl = cx25840_read4(client, 0x120);
  160. gpio_oe = cx25840_read(client, 0x160);
  161. gpio_data = cx25840_read(client, 0x164);
  162. for (i = 0; i < n; i++) {
  163. strength = p[i].strength;
  164. if (strength > CX25840_PIN_DRIVE_FAST)
  165. strength = CX25840_PIN_DRIVE_FAST;
  166. switch (p[i].pin) {
  167. case CX23885_PIN_IRQ_N_GPIO16:
  168. if (p[i].function != CX23885_PAD_IRQ_N) {
  169. /* GPIO16 */
  170. pin_ctrl &= ~(0x1 << 25);
  171. } else {
  172. /* IRQ_N */
  173. if (p[i].flags &
  174. (V4L2_SUBDEV_IO_PIN_DISABLE |
  175. V4L2_SUBDEV_IO_PIN_INPUT)) {
  176. pin_ctrl &= ~(0x1 << 25);
  177. } else {
  178. pin_ctrl |= (0x1 << 25);
  179. }
  180. if (p[i].flags &
  181. V4L2_SUBDEV_IO_PIN_ACTIVE_LOW) {
  182. pin_ctrl &= ~(0x1 << 24);
  183. } else {
  184. pin_ctrl |= (0x1 << 24);
  185. }
  186. }
  187. break;
  188. case CX23885_PIN_IR_RX_GPIO19:
  189. if (p[i].function != CX23885_PAD_GPIO19) {
  190. /* IR_RX */
  191. gpio_oe |= (0x1 << 0);
  192. pin_ctrl &= ~(0x3 << 18);
  193. pin_ctrl |= (strength << 18);
  194. } else {
  195. /* GPIO19 */
  196. gpio_oe &= ~(0x1 << 0);
  197. if (p[i].flags & V4L2_SUBDEV_IO_PIN_SET_VALUE) {
  198. gpio_data &= ~(0x1 << 0);
  199. gpio_data |= ((p[i].value & 0x1) << 0);
  200. }
  201. pin_ctrl &= ~(0x3 << 12);
  202. pin_ctrl |= (strength << 12);
  203. }
  204. break;
  205. case CX23885_PIN_IR_TX_GPIO20:
  206. if (p[i].function != CX23885_PAD_GPIO20) {
  207. /* IR_TX */
  208. gpio_oe |= (0x1 << 1);
  209. if (p[i].flags & V4L2_SUBDEV_IO_PIN_DISABLE)
  210. pin_ctrl &= ~(0x1 << 10);
  211. else
  212. pin_ctrl |= (0x1 << 10);
  213. pin_ctrl &= ~(0x3 << 18);
  214. pin_ctrl |= (strength << 18);
  215. } else {
  216. /* GPIO20 */
  217. gpio_oe &= ~(0x1 << 1);
  218. if (p[i].flags & V4L2_SUBDEV_IO_PIN_SET_VALUE) {
  219. gpio_data &= ~(0x1 << 1);
  220. gpio_data |= ((p[i].value & 0x1) << 1);
  221. }
  222. pin_ctrl &= ~(0x3 << 12);
  223. pin_ctrl |= (strength << 12);
  224. }
  225. break;
  226. case CX23885_PIN_I2S_SDAT_GPIO21:
  227. if (p[i].function != CX23885_PAD_GPIO21) {
  228. /* I2S_SDAT */
  229. /* TODO: Input or Output config */
  230. gpio_oe |= (0x1 << 2);
  231. pin_ctrl &= ~(0x3 << 22);
  232. pin_ctrl |= (strength << 22);
  233. } else {
  234. /* GPIO21 */
  235. gpio_oe &= ~(0x1 << 2);
  236. if (p[i].flags & V4L2_SUBDEV_IO_PIN_SET_VALUE) {
  237. gpio_data &= ~(0x1 << 2);
  238. gpio_data |= ((p[i].value & 0x1) << 2);
  239. }
  240. pin_ctrl &= ~(0x3 << 12);
  241. pin_ctrl |= (strength << 12);
  242. }
  243. break;
  244. case CX23885_PIN_I2S_WCLK_GPIO22:
  245. if (p[i].function != CX23885_PAD_GPIO22) {
  246. /* I2S_WCLK */
  247. /* TODO: Input or Output config */
  248. gpio_oe |= (0x1 << 3);
  249. pin_ctrl &= ~(0x3 << 22);
  250. pin_ctrl |= (strength << 22);
  251. } else {
  252. /* GPIO22 */
  253. gpio_oe &= ~(0x1 << 3);
  254. if (p[i].flags & V4L2_SUBDEV_IO_PIN_SET_VALUE) {
  255. gpio_data &= ~(0x1 << 3);
  256. gpio_data |= ((p[i].value & 0x1) << 3);
  257. }
  258. pin_ctrl &= ~(0x3 << 12);
  259. pin_ctrl |= (strength << 12);
  260. }
  261. break;
  262. case CX23885_PIN_I2S_BCLK_GPIO23:
  263. if (p[i].function != CX23885_PAD_GPIO23) {
  264. /* I2S_BCLK */
  265. /* TODO: Input or Output config */
  266. gpio_oe |= (0x1 << 4);
  267. pin_ctrl &= ~(0x3 << 22);
  268. pin_ctrl |= (strength << 22);
  269. } else {
  270. /* GPIO23 */
  271. gpio_oe &= ~(0x1 << 4);
  272. if (p[i].flags & V4L2_SUBDEV_IO_PIN_SET_VALUE) {
  273. gpio_data &= ~(0x1 << 4);
  274. gpio_data |= ((p[i].value & 0x1) << 4);
  275. }
  276. pin_ctrl &= ~(0x3 << 12);
  277. pin_ctrl |= (strength << 12);
  278. }
  279. break;
  280. }
  281. }
  282. cx25840_write(client, 0x164, gpio_data);
  283. cx25840_write(client, 0x160, gpio_oe);
  284. cx25840_write4(client, 0x120, pin_ctrl);
  285. return 0;
  286. }
  287. static int common_s_io_pin_config(struct v4l2_subdev *sd, size_t n,
  288. struct v4l2_subdev_io_pin_config *pincfg)
  289. {
  290. struct cx25840_state *state = to_state(sd);
  291. if (is_cx2388x(state))
  292. return cx23885_s_io_pin_config(sd, n, pincfg);
  293. return 0;
  294. }
  295. /* ----------------------------------------------------------------------- */
  296. static void init_dll1(struct i2c_client *client)
  297. {
  298. /* This is the Hauppauge sequence used to
  299. * initialize the Delay Lock Loop 1 (ADC DLL). */
  300. cx25840_write(client, 0x159, 0x23);
  301. cx25840_write(client, 0x15a, 0x87);
  302. cx25840_write(client, 0x15b, 0x06);
  303. udelay(10);
  304. cx25840_write(client, 0x159, 0xe1);
  305. udelay(10);
  306. cx25840_write(client, 0x15a, 0x86);
  307. cx25840_write(client, 0x159, 0xe0);
  308. cx25840_write(client, 0x159, 0xe1);
  309. cx25840_write(client, 0x15b, 0x10);
  310. }
  311. static void init_dll2(struct i2c_client *client)
  312. {
  313. /* This is the Hauppauge sequence used to
  314. * initialize the Delay Lock Loop 2 (ADC DLL). */
  315. cx25840_write(client, 0x15d, 0xe3);
  316. cx25840_write(client, 0x15e, 0x86);
  317. cx25840_write(client, 0x15f, 0x06);
  318. udelay(10);
  319. cx25840_write(client, 0x15d, 0xe1);
  320. cx25840_write(client, 0x15d, 0xe0);
  321. cx25840_write(client, 0x15d, 0xe1);
  322. }
  323. static void cx25836_initialize(struct i2c_client *client)
  324. {
  325. /* reset configuration is described on page 3-77 of the CX25836 datasheet */
  326. /* 2. */
  327. cx25840_and_or(client, 0x000, ~0x01, 0x01);
  328. cx25840_and_or(client, 0x000, ~0x01, 0x00);
  329. /* 3a. */
  330. cx25840_and_or(client, 0x15a, ~0x70, 0x00);
  331. /* 3b. */
  332. cx25840_and_or(client, 0x15b, ~0x1e, 0x06);
  333. /* 3c. */
  334. cx25840_and_or(client, 0x159, ~0x02, 0x02);
  335. /* 3d. */
  336. udelay(10);
  337. /* 3e. */
  338. cx25840_and_or(client, 0x159, ~0x02, 0x00);
  339. /* 3f. */
  340. cx25840_and_or(client, 0x159, ~0xc0, 0xc0);
  341. /* 3g. */
  342. cx25840_and_or(client, 0x159, ~0x01, 0x00);
  343. cx25840_and_or(client, 0x159, ~0x01, 0x01);
  344. /* 3h. */
  345. cx25840_and_or(client, 0x15b, ~0x1e, 0x10);
  346. }
  347. static void cx25840_work_handler(struct work_struct *work)
  348. {
  349. struct cx25840_state *state = container_of(work, struct cx25840_state, fw_work);
  350. cx25840_loadfw(state->c);
  351. wake_up(&state->fw_wait);
  352. }
  353. static void cx25840_initialize(struct i2c_client *client)
  354. {
  355. DEFINE_WAIT(wait);
  356. struct cx25840_state *state = to_state(i2c_get_clientdata(client));
  357. struct workqueue_struct *q;
  358. /* datasheet startup in numbered steps, refer to page 3-77 */
  359. /* 2. */
  360. cx25840_and_or(client, 0x803, ~0x10, 0x00);
  361. /* The default of this register should be 4, but I get 0 instead.
  362. * Set this register to 4 manually. */
  363. cx25840_write(client, 0x000, 0x04);
  364. /* 3. */
  365. init_dll1(client);
  366. init_dll2(client);
  367. cx25840_write(client, 0x136, 0x0a);
  368. /* 4. */
  369. cx25840_write(client, 0x13c, 0x01);
  370. cx25840_write(client, 0x13c, 0x00);
  371. /* 5. */
  372. /* Do the firmware load in a work handler to prevent.
  373. Otherwise the kernel is blocked waiting for the
  374. bit-banging i2c interface to finish uploading the
  375. firmware. */
  376. INIT_WORK(&state->fw_work, cx25840_work_handler);
  377. init_waitqueue_head(&state->fw_wait);
  378. q = create_singlethread_workqueue("cx25840_fw");
  379. prepare_to_wait(&state->fw_wait, &wait, TASK_UNINTERRUPTIBLE);
  380. queue_work(q, &state->fw_work);
  381. schedule();
  382. finish_wait(&state->fw_wait, &wait);
  383. destroy_workqueue(q);
  384. /* 6. */
  385. cx25840_write(client, 0x115, 0x8c);
  386. cx25840_write(client, 0x116, 0x07);
  387. cx25840_write(client, 0x118, 0x02);
  388. /* 7. */
  389. cx25840_write(client, 0x4a5, 0x80);
  390. cx25840_write(client, 0x4a5, 0x00);
  391. cx25840_write(client, 0x402, 0x00);
  392. /* 8. */
  393. cx25840_and_or(client, 0x401, ~0x18, 0);
  394. cx25840_and_or(client, 0x4a2, ~0x10, 0x10);
  395. /* steps 8c and 8d are done in change_input() */
  396. /* 10. */
  397. cx25840_write(client, 0x8d3, 0x1f);
  398. cx25840_write(client, 0x8e3, 0x03);
  399. cx25840_std_setup(client);
  400. /* trial and error says these are needed to get audio */
  401. cx25840_write(client, 0x914, 0xa0);
  402. cx25840_write(client, 0x918, 0xa0);
  403. cx25840_write(client, 0x919, 0x01);
  404. /* stereo preferred */
  405. cx25840_write(client, 0x809, 0x04);
  406. /* AC97 shift */
  407. cx25840_write(client, 0x8cf, 0x0f);
  408. /* (re)set input */
  409. set_input(client, state->vid_input, state->aud_input);
  410. /* start microcontroller */
  411. cx25840_and_or(client, 0x803, ~0x10, 0x10);
  412. }
  413. static void cx23885_initialize(struct i2c_client *client)
  414. {
  415. DEFINE_WAIT(wait);
  416. struct cx25840_state *state = to_state(i2c_get_clientdata(client));
  417. struct workqueue_struct *q;
  418. /*
  419. * Come out of digital power down
  420. * The CX23888, at least, needs this, otherwise registers aside from
  421. * 0x0-0x2 can't be read or written.
  422. */
  423. cx25840_write(client, 0x000, 0);
  424. /* Internal Reset */
  425. cx25840_and_or(client, 0x102, ~0x01, 0x01);
  426. cx25840_and_or(client, 0x102, ~0x01, 0x00);
  427. /* Stop microcontroller */
  428. cx25840_and_or(client, 0x803, ~0x10, 0x00);
  429. /* DIF in reset? */
  430. cx25840_write(client, 0x398, 0);
  431. /*
  432. * Trust the default xtal, no division
  433. * '885: 28.636363... MHz
  434. * '887: 25.000000 MHz
  435. * '888: 50.000000 MHz
  436. */
  437. cx25840_write(client, 0x2, 0x76);
  438. /* Power up all the PLL's and DLL */
  439. cx25840_write(client, 0x1, 0x40);
  440. /* Sys PLL */
  441. switch (state->id) {
  442. case V4L2_IDENT_CX23888_AV:
  443. /*
  444. * 50.0 MHz * (0xb + 0xe8ba26/0x2000000)/4 = 5 * 28.636363 MHz
  445. * 572.73 MHz before post divide
  446. */
  447. /* HVR1850 or 50MHz xtal */
  448. cx25840_write(client, 0x2, 0x71);
  449. cx25840_write4(client, 0x11c, 0x01d1744c);
  450. cx25840_write4(client, 0x118, 0x00000416);
  451. cx25840_write4(client, 0x404, 0x0010253e);
  452. cx25840_write4(client, 0x42c, 0x42600000);
  453. cx25840_write4(client, 0x44c, 0x161f1000);
  454. break;
  455. case V4L2_IDENT_CX23887_AV:
  456. /*
  457. * 25.0 MHz * (0x16 + 0x1d1744c/0x2000000)/4 = 5 * 28.636363 MHz
  458. * 572.73 MHz before post divide
  459. */
  460. cx25840_write4(client, 0x11c, 0x01d1744c);
  461. cx25840_write4(client, 0x118, 0x00000416);
  462. break;
  463. case V4L2_IDENT_CX23885_AV:
  464. default:
  465. /*
  466. * 28.636363 MHz * (0x14 + 0x0/0x2000000)/4 = 5 * 28.636363 MHz
  467. * 572.73 MHz before post divide
  468. */
  469. cx25840_write4(client, 0x11c, 0x00000000);
  470. cx25840_write4(client, 0x118, 0x00000414);
  471. break;
  472. }
  473. /* Disable DIF bypass */
  474. cx25840_write4(client, 0x33c, 0x00000001);
  475. /* DIF Src phase inc */
  476. cx25840_write4(client, 0x340, 0x0df7df83);
  477. /*
  478. * Vid PLL
  479. * Setup for a BT.656 pixel clock of 13.5 Mpixels/second
  480. *
  481. * 28.636363 MHz * (0xf + 0x02be2c9/0x2000000)/4 = 8 * 13.5 MHz
  482. * 432.0 MHz before post divide
  483. */
  484. /* HVR1850 */
  485. switch (state->id) {
  486. case V4L2_IDENT_CX23888_AV:
  487. /* 888/HVR1250 specific */
  488. cx25840_write4(client, 0x10c, 0x13333333);
  489. cx25840_write4(client, 0x108, 0x00000515);
  490. break;
  491. default:
  492. cx25840_write4(client, 0x10c, 0x002be2c9);
  493. cx25840_write4(client, 0x108, 0x0000040f);
  494. }
  495. /* Luma */
  496. cx25840_write4(client, 0x414, 0x00107d12);
  497. /* Chroma */
  498. cx25840_write4(client, 0x420, 0x3d008282);
  499. /*
  500. * Aux PLL
  501. * Initial setup for audio sample clock:
  502. * 48 ksps, 16 bits/sample, x160 multiplier = 122.88 MHz
  503. * Initial I2S output/master clock(?):
  504. * 48 ksps, 16 bits/sample, x16 multiplier = 12.288 MHz
  505. */
  506. switch (state->id) {
  507. case V4L2_IDENT_CX23888_AV:
  508. /*
  509. * 50.0 MHz * (0x7 + 0x0bedfa4/0x2000000)/3 = 122.88 MHz
  510. * 368.64 MHz before post divide
  511. * 122.88 MHz / 0xa = 12.288 MHz
  512. */
  513. /* HVR1850 or 50MHz xtal */
  514. cx25840_write4(client, 0x114, 0x017dbf48);
  515. cx25840_write4(client, 0x110, 0x000a030e);
  516. break;
  517. case V4L2_IDENT_CX23887_AV:
  518. /*
  519. * 25.0 MHz * (0xe + 0x17dbf48/0x2000000)/3 = 122.88 MHz
  520. * 368.64 MHz before post divide
  521. * 122.88 MHz / 0xa = 12.288 MHz
  522. */
  523. cx25840_write4(client, 0x114, 0x017dbf48);
  524. cx25840_write4(client, 0x110, 0x000a030e);
  525. break;
  526. case V4L2_IDENT_CX23885_AV:
  527. default:
  528. /*
  529. * 28.636363 MHz * (0xc + 0x1bf0c9e/0x2000000)/3 = 122.88 MHz
  530. * 368.64 MHz before post divide
  531. * 122.88 MHz / 0xa = 12.288 MHz
  532. */
  533. cx25840_write4(client, 0x114, 0x01bf0c9e);
  534. cx25840_write4(client, 0x110, 0x000a030c);
  535. break;
  536. }
  537. /* ADC2 input select */
  538. cx25840_write(client, 0x102, 0x10);
  539. /* VIN1 & VIN5 */
  540. cx25840_write(client, 0x103, 0x11);
  541. /* Enable format auto detect */
  542. cx25840_write(client, 0x400, 0);
  543. /* Fast subchroma lock */
  544. /* White crush, Chroma AGC & Chroma Killer enabled */
  545. cx25840_write(client, 0x401, 0xe8);
  546. /* Select AFE clock pad output source */
  547. cx25840_write(client, 0x144, 0x05);
  548. /* Drive GPIO2 direction and values for HVR1700
  549. * where an onboard mux selects the output of demodulator
  550. * vs the 417. Failure to set this results in no DTV.
  551. * It's safe to set this across all Hauppauge boards
  552. * currently, regardless of the board type.
  553. */
  554. cx25840_write(client, 0x160, 0x1d);
  555. cx25840_write(client, 0x164, 0x00);
  556. /* Do the firmware load in a work handler to prevent.
  557. Otherwise the kernel is blocked waiting for the
  558. bit-banging i2c interface to finish uploading the
  559. firmware. */
  560. INIT_WORK(&state->fw_work, cx25840_work_handler);
  561. init_waitqueue_head(&state->fw_wait);
  562. q = create_singlethread_workqueue("cx25840_fw");
  563. prepare_to_wait(&state->fw_wait, &wait, TASK_UNINTERRUPTIBLE);
  564. queue_work(q, &state->fw_work);
  565. schedule();
  566. finish_wait(&state->fw_wait, &wait);
  567. destroy_workqueue(q);
  568. /* Call the cx23888 specific std setup func, we no longer rely on
  569. * the generic cx24840 func.
  570. */
  571. if (is_cx23888(state))
  572. cx23888_std_setup(client);
  573. else
  574. cx25840_std_setup(client);
  575. /* (re)set input */
  576. set_input(client, state->vid_input, state->aud_input);
  577. /* start microcontroller */
  578. cx25840_and_or(client, 0x803, ~0x10, 0x10);
  579. /* Disable and clear video interrupts - we don't use them */
  580. cx25840_write4(client, CX25840_VID_INT_STAT_REG, 0xffffffff);
  581. /* Disable and clear audio interrupts - we don't use them */
  582. cx25840_write(client, CX25840_AUD_INT_CTRL_REG, 0xff);
  583. cx25840_write(client, CX25840_AUD_INT_STAT_REG, 0xff);
  584. /* CC raw enable */
  585. /* - VIP 1.1 control codes - 10bit, blue field enable.
  586. * - enable raw data during vertical blanking.
  587. * - enable ancillary Data insertion for 656 or VIP.
  588. */
  589. cx25840_write4(client, 0x404, 0x0010253e);
  590. /* CC on - Undocumented Register */
  591. cx25840_write(client, 0x42f, 0x66);
  592. /* HVR-1250 / HVR1850 DIF related */
  593. /* Power everything up */
  594. cx25840_write4(client, 0x130, 0x0);
  595. /* Undocumented */
  596. cx25840_write4(client, 0x478, 0x6628021F);
  597. /* AFE_CLK_OUT_CTRL - Select the clock output source as output */
  598. cx25840_write4(client, 0x144, 0x5);
  599. /* I2C_OUT_CTL - I2S output configuration as
  600. * Master, Sony, Left justified, left sample on WS=1
  601. */
  602. cx25840_write4(client, 0x918, 0x1a0);
  603. /* AFE_DIAG_CTRL1 */
  604. cx25840_write4(client, 0x134, 0x000a1800);
  605. /* AFE_DIAG_CTRL3 - Inverted Polarity for Audio and Video */
  606. cx25840_write4(client, 0x13c, 0x00310000);
  607. }
  608. /* ----------------------------------------------------------------------- */
  609. static void cx231xx_initialize(struct i2c_client *client)
  610. {
  611. DEFINE_WAIT(wait);
  612. struct cx25840_state *state = to_state(i2c_get_clientdata(client));
  613. struct workqueue_struct *q;
  614. /* Internal Reset */
  615. cx25840_and_or(client, 0x102, ~0x01, 0x01);
  616. cx25840_and_or(client, 0x102, ~0x01, 0x00);
  617. /* Stop microcontroller */
  618. cx25840_and_or(client, 0x803, ~0x10, 0x00);
  619. /* DIF in reset? */
  620. cx25840_write(client, 0x398, 0);
  621. /* Trust the default xtal, no division */
  622. /* This changes for the cx23888 products */
  623. cx25840_write(client, 0x2, 0x76);
  624. /* Bring down the regulator for AUX clk */
  625. cx25840_write(client, 0x1, 0x40);
  626. /* Disable DIF bypass */
  627. cx25840_write4(client, 0x33c, 0x00000001);
  628. /* DIF Src phase inc */
  629. cx25840_write4(client, 0x340, 0x0df7df83);
  630. /* Luma */
  631. cx25840_write4(client, 0x414, 0x00107d12);
  632. /* Chroma */
  633. cx25840_write4(client, 0x420, 0x3d008282);
  634. /* ADC2 input select */
  635. cx25840_write(client, 0x102, 0x10);
  636. /* VIN1 & VIN5 */
  637. cx25840_write(client, 0x103, 0x11);
  638. /* Enable format auto detect */
  639. cx25840_write(client, 0x400, 0);
  640. /* Fast subchroma lock */
  641. /* White crush, Chroma AGC & Chroma Killer enabled */
  642. cx25840_write(client, 0x401, 0xe8);
  643. /* Do the firmware load in a work handler to prevent.
  644. Otherwise the kernel is blocked waiting for the
  645. bit-banging i2c interface to finish uploading the
  646. firmware. */
  647. INIT_WORK(&state->fw_work, cx25840_work_handler);
  648. init_waitqueue_head(&state->fw_wait);
  649. q = create_singlethread_workqueue("cx25840_fw");
  650. prepare_to_wait(&state->fw_wait, &wait, TASK_UNINTERRUPTIBLE);
  651. queue_work(q, &state->fw_work);
  652. schedule();
  653. finish_wait(&state->fw_wait, &wait);
  654. destroy_workqueue(q);
  655. cx25840_std_setup(client);
  656. /* (re)set input */
  657. set_input(client, state->vid_input, state->aud_input);
  658. /* start microcontroller */
  659. cx25840_and_or(client, 0x803, ~0x10, 0x10);
  660. /* CC raw enable */
  661. cx25840_write(client, 0x404, 0x0b);
  662. /* CC on */
  663. cx25840_write(client, 0x42f, 0x66);
  664. cx25840_write4(client, 0x474, 0x1e1e601a);
  665. }
  666. /* ----------------------------------------------------------------------- */
  667. void cx25840_std_setup(struct i2c_client *client)
  668. {
  669. struct cx25840_state *state = to_state(i2c_get_clientdata(client));
  670. v4l2_std_id std = state->std;
  671. int hblank, hactive, burst, vblank, vactive, sc;
  672. int vblank656, src_decimation;
  673. int luma_lpf, uv_lpf, comb;
  674. u32 pll_int, pll_frac, pll_post;
  675. /* datasheet startup, step 8d */
  676. if (std & ~V4L2_STD_NTSC)
  677. cx25840_write(client, 0x49f, 0x11);
  678. else
  679. cx25840_write(client, 0x49f, 0x14);
  680. if (std & V4L2_STD_625_50) {
  681. hblank = 132;
  682. hactive = 720;
  683. burst = 93;
  684. vblank = 36;
  685. vactive = 580;
  686. vblank656 = 40;
  687. src_decimation = 0x21f;
  688. luma_lpf = 2;
  689. if (std & V4L2_STD_SECAM) {
  690. uv_lpf = 0;
  691. comb = 0;
  692. sc = 0x0a425f;
  693. } else if (std == V4L2_STD_PAL_Nc) {
  694. uv_lpf = 1;
  695. comb = 0x20;
  696. sc = 556453;
  697. } else {
  698. uv_lpf = 1;
  699. comb = 0x20;
  700. sc = 688739;
  701. }
  702. } else {
  703. hactive = 720;
  704. hblank = 122;
  705. vactive = 487;
  706. luma_lpf = 1;
  707. uv_lpf = 1;
  708. src_decimation = 0x21f;
  709. if (std == V4L2_STD_PAL_60) {
  710. vblank = 26;
  711. vblank656 = 26;
  712. burst = 0x5b;
  713. luma_lpf = 2;
  714. comb = 0x20;
  715. sc = 688739;
  716. } else if (std == V4L2_STD_PAL_M) {
  717. vblank = 20;
  718. vblank656 = 24;
  719. burst = 0x61;
  720. comb = 0x20;
  721. sc = 555452;
  722. } else {
  723. vblank = 26;
  724. vblank656 = 26;
  725. burst = 0x5b;
  726. comb = 0x66;
  727. sc = 556063;
  728. }
  729. }
  730. /* DEBUG: Displays configured PLL frequency */
  731. if (!is_cx231xx(state)) {
  732. pll_int = cx25840_read(client, 0x108);
  733. pll_frac = cx25840_read4(client, 0x10c) & 0x1ffffff;
  734. pll_post = cx25840_read(client, 0x109);
  735. v4l_dbg(1, cx25840_debug, client,
  736. "PLL regs = int: %u, frac: %u, post: %u\n",
  737. pll_int, pll_frac, pll_post);
  738. if (pll_post) {
  739. int fin, fsc;
  740. int pll = (28636363L * ((((u64)pll_int) << 25L) + pll_frac)) >> 25L;
  741. pll /= pll_post;
  742. v4l_dbg(1, cx25840_debug, client, "PLL = %d.%06d MHz\n",
  743. pll / 1000000, pll % 1000000);
  744. v4l_dbg(1, cx25840_debug, client, "PLL/8 = %d.%06d MHz\n",
  745. pll / 8000000, (pll / 8) % 1000000);
  746. fin = ((u64)src_decimation * pll) >> 12;
  747. v4l_dbg(1, cx25840_debug, client,
  748. "ADC Sampling freq = %d.%06d MHz\n",
  749. fin / 1000000, fin % 1000000);
  750. fsc = (((u64)sc) * pll) >> 24L;
  751. v4l_dbg(1, cx25840_debug, client,
  752. "Chroma sub-carrier freq = %d.%06d MHz\n",
  753. fsc / 1000000, fsc % 1000000);
  754. v4l_dbg(1, cx25840_debug, client, "hblank %i, hactive %i, "
  755. "vblank %i, vactive %i, vblank656 %i, src_dec %i, "
  756. "burst 0x%02x, luma_lpf %i, uv_lpf %i, comb 0x%02x, "
  757. "sc 0x%06x\n",
  758. hblank, hactive, vblank, vactive, vblank656,
  759. src_decimation, burst, luma_lpf, uv_lpf, comb, sc);
  760. }
  761. }
  762. /* Sets horizontal blanking delay and active lines */
  763. cx25840_write(client, 0x470, hblank);
  764. cx25840_write(client, 0x471,
  765. 0xff & (((hblank >> 8) & 0x3) | (hactive << 4)));
  766. cx25840_write(client, 0x472, hactive >> 4);
  767. /* Sets burst gate delay */
  768. cx25840_write(client, 0x473, burst);
  769. /* Sets vertical blanking delay and active duration */
  770. cx25840_write(client, 0x474, vblank);
  771. cx25840_write(client, 0x475,
  772. 0xff & (((vblank >> 8) & 0x3) | (vactive << 4)));
  773. cx25840_write(client, 0x476, vactive >> 4);
  774. cx25840_write(client, 0x477, vblank656);
  775. /* Sets src decimation rate */
  776. cx25840_write(client, 0x478, 0xff & src_decimation);
  777. cx25840_write(client, 0x479, 0xff & (src_decimation >> 8));
  778. /* Sets Luma and UV Low pass filters */
  779. cx25840_write(client, 0x47a, luma_lpf << 6 | ((uv_lpf << 4) & 0x30));
  780. /* Enables comb filters */
  781. cx25840_write(client, 0x47b, comb);
  782. /* Sets SC Step*/
  783. cx25840_write(client, 0x47c, sc);
  784. cx25840_write(client, 0x47d, 0xff & sc >> 8);
  785. cx25840_write(client, 0x47e, 0xff & sc >> 16);
  786. /* Sets VBI parameters */
  787. if (std & V4L2_STD_625_50) {
  788. cx25840_write(client, 0x47f, 0x01);
  789. state->vbi_line_offset = 5;
  790. } else {
  791. cx25840_write(client, 0x47f, 0x00);
  792. state->vbi_line_offset = 8;
  793. }
  794. }
  795. /* ----------------------------------------------------------------------- */
  796. static void input_change(struct i2c_client *client)
  797. {
  798. struct cx25840_state *state = to_state(i2c_get_clientdata(client));
  799. v4l2_std_id std = state->std;
  800. /* Follow step 8c and 8d of section 3.16 in the cx25840 datasheet */
  801. if (std & V4L2_STD_SECAM) {
  802. cx25840_write(client, 0x402, 0);
  803. }
  804. else {
  805. cx25840_write(client, 0x402, 0x04);
  806. cx25840_write(client, 0x49f, (std & V4L2_STD_NTSC) ? 0x14 : 0x11);
  807. }
  808. cx25840_and_or(client, 0x401, ~0x60, 0);
  809. cx25840_and_or(client, 0x401, ~0x60, 0x60);
  810. /* Don't write into audio registers on cx2583x chips */
  811. if (is_cx2583x(state))
  812. return;
  813. cx25840_and_or(client, 0x810, ~0x01, 1);
  814. if (state->radio) {
  815. cx25840_write(client, 0x808, 0xf9);
  816. cx25840_write(client, 0x80b, 0x00);
  817. }
  818. else if (std & V4L2_STD_525_60) {
  819. /* Certain Hauppauge PVR150 models have a hardware bug
  820. that causes audio to drop out. For these models the
  821. audio standard must be set explicitly.
  822. To be precise: it affects cards with tuner models
  823. 85, 99 and 112 (model numbers from tveeprom). */
  824. int hw_fix = state->pvr150_workaround;
  825. if (std == V4L2_STD_NTSC_M_JP) {
  826. /* Japan uses EIAJ audio standard */
  827. cx25840_write(client, 0x808, hw_fix ? 0x2f : 0xf7);
  828. } else if (std == V4L2_STD_NTSC_M_KR) {
  829. /* South Korea uses A2 audio standard */
  830. cx25840_write(client, 0x808, hw_fix ? 0x3f : 0xf8);
  831. } else {
  832. /* Others use the BTSC audio standard */
  833. cx25840_write(client, 0x808, hw_fix ? 0x1f : 0xf6);
  834. }
  835. cx25840_write(client, 0x80b, 0x00);
  836. } else if (std & V4L2_STD_PAL) {
  837. /* Autodetect audio standard and audio system */
  838. cx25840_write(client, 0x808, 0xff);
  839. /* Since system PAL-L is pretty much non-existent and
  840. not used by any public broadcast network, force
  841. 6.5 MHz carrier to be interpreted as System DK,
  842. this avoids DK audio detection instability */
  843. cx25840_write(client, 0x80b, 0x00);
  844. } else if (std & V4L2_STD_SECAM) {
  845. /* Autodetect audio standard and audio system */
  846. cx25840_write(client, 0x808, 0xff);
  847. /* If only one of SECAM-DK / SECAM-L is required, then force
  848. 6.5MHz carrier, else autodetect it */
  849. if ((std & V4L2_STD_SECAM_DK) &&
  850. !(std & (V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC))) {
  851. /* 6.5 MHz carrier to be interpreted as System DK */
  852. cx25840_write(client, 0x80b, 0x00);
  853. } else if (!(std & V4L2_STD_SECAM_DK) &&
  854. (std & (V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC))) {
  855. /* 6.5 MHz carrier to be interpreted as System L */
  856. cx25840_write(client, 0x80b, 0x08);
  857. } else {
  858. /* 6.5 MHz carrier to be autodetected */
  859. cx25840_write(client, 0x80b, 0x10);
  860. }
  861. }
  862. cx25840_and_or(client, 0x810, ~0x01, 0);
  863. }
  864. static int set_input(struct i2c_client *client, enum cx25840_video_input vid_input,
  865. enum cx25840_audio_input aud_input)
  866. {
  867. struct cx25840_state *state = to_state(i2c_get_clientdata(client));
  868. u8 is_composite = (vid_input >= CX25840_COMPOSITE1 &&
  869. vid_input <= CX25840_COMPOSITE8);
  870. u8 is_component = (vid_input & CX25840_COMPONENT_ON) ==
  871. CX25840_COMPONENT_ON;
  872. u8 is_dif = (vid_input & CX25840_DIF_ON) ==
  873. CX25840_DIF_ON;
  874. u8 is_svideo = (vid_input & CX25840_SVIDEO_ON) ==
  875. CX25840_SVIDEO_ON;
  876. int luma = vid_input & 0xf0;
  877. int chroma = vid_input & 0xf00;
  878. u8 reg;
  879. u32 val;
  880. v4l_dbg(1, cx25840_debug, client,
  881. "decoder set video input %d, audio input %d\n",
  882. vid_input, aud_input);
  883. if (vid_input >= CX25840_VIN1_CH1) {
  884. v4l_dbg(1, cx25840_debug, client, "vid_input 0x%x\n",
  885. vid_input);
  886. reg = vid_input & 0xff;
  887. is_composite = !is_component &&
  888. ((vid_input & CX25840_SVIDEO_ON) != CX25840_SVIDEO_ON);
  889. v4l_dbg(1, cx25840_debug, client, "mux cfg 0x%x comp=%d\n",
  890. reg, is_composite);
  891. } else if (is_composite) {
  892. reg = 0xf0 + (vid_input - CX25840_COMPOSITE1);
  893. } else {
  894. if ((vid_input & ~0xff0) ||
  895. luma < CX25840_SVIDEO_LUMA1 || luma > CX25840_SVIDEO_LUMA8 ||
  896. chroma < CX25840_SVIDEO_CHROMA4 || chroma > CX25840_SVIDEO_CHROMA8) {
  897. v4l_err(client, "0x%04x is not a valid video input!\n",
  898. vid_input);
  899. return -EINVAL;
  900. }
  901. reg = 0xf0 + ((luma - CX25840_SVIDEO_LUMA1) >> 4);
  902. if (chroma >= CX25840_SVIDEO_CHROMA7) {
  903. reg &= 0x3f;
  904. reg |= (chroma - CX25840_SVIDEO_CHROMA7) >> 2;
  905. } else {
  906. reg &= 0xcf;
  907. reg |= (chroma - CX25840_SVIDEO_CHROMA4) >> 4;
  908. }
  909. }
  910. /* The caller has previously prepared the correct routing
  911. * configuration in reg (for the cx23885) so we have no
  912. * need to attempt to flip bits for earlier av decoders.
  913. */
  914. if (!is_cx2388x(state) && !is_cx231xx(state)) {
  915. switch (aud_input) {
  916. case CX25840_AUDIO_SERIAL:
  917. /* do nothing, use serial audio input */
  918. break;
  919. case CX25840_AUDIO4: reg &= ~0x30; break;
  920. case CX25840_AUDIO5: reg &= ~0x30; reg |= 0x10; break;
  921. case CX25840_AUDIO6: reg &= ~0x30; reg |= 0x20; break;
  922. case CX25840_AUDIO7: reg &= ~0xc0; break;
  923. case CX25840_AUDIO8: reg &= ~0xc0; reg |= 0x40; break;
  924. default:
  925. v4l_err(client, "0x%04x is not a valid audio input!\n",
  926. aud_input);
  927. return -EINVAL;
  928. }
  929. }
  930. cx25840_write(client, 0x103, reg);
  931. /* Set INPUT_MODE to Composite, S-Video or Component */
  932. if (is_component)
  933. cx25840_and_or(client, 0x401, ~0x6, 0x6);
  934. else
  935. cx25840_and_or(client, 0x401, ~0x6, is_composite ? 0 : 0x02);
  936. if (is_cx2388x(state)) {
  937. /* Enable or disable the DIF for tuner use */
  938. if (is_dif) {
  939. cx25840_and_or(client, 0x102, ~0x80, 0x80);
  940. /* Set of defaults for NTSC and PAL */
  941. cx25840_write4(client, 0x31c, 0xc2262600);
  942. cx25840_write4(client, 0x320, 0xc2262600);
  943. /* 18271 IF - Nobody else yet uses a different
  944. * tuner with the DIF, so these are reasonable
  945. * assumptions (HVR1250 and HVR1850 specific).
  946. */
  947. cx25840_write4(client, 0x318, 0xda262600);
  948. cx25840_write4(client, 0x33c, 0x2a24c800);
  949. cx25840_write4(client, 0x104, 0x0704dd00);
  950. } else {
  951. cx25840_write4(client, 0x300, 0x015c28f5);
  952. cx25840_and_or(client, 0x102, ~0x80, 0);
  953. cx25840_write4(client, 0x340, 0xdf7df83);
  954. cx25840_write4(client, 0x104, 0x0704dd80);
  955. cx25840_write4(client, 0x314, 0x22400600);
  956. cx25840_write4(client, 0x318, 0x40002600);
  957. cx25840_write4(client, 0x324, 0x40002600);
  958. cx25840_write4(client, 0x32c, 0x0250e620);
  959. cx25840_write4(client, 0x39c, 0x01FF0B00);
  960. cx25840_write4(client, 0x410, 0xffff0dbf);
  961. cx25840_write4(client, 0x414, 0x00137d03);
  962. /* on the 887, 0x418 is HSCALE_CTRL, on the 888 it is
  963. CHROMA_CTRL */
  964. if (is_cx23888(state))
  965. cx25840_write4(client, 0x418, 0x01008080);
  966. else
  967. cx25840_write4(client, 0x418, 0x01000000);
  968. cx25840_write4(client, 0x41c, 0x00000000);
  969. /* on the 887, 0x420 is CHROMA_CTRL, on the 888 it is
  970. CRUSH_CTRL */
  971. if (is_cx23888(state))
  972. cx25840_write4(client, 0x420, 0x001c3e0f);
  973. else
  974. cx25840_write4(client, 0x420, 0x001c8282);
  975. cx25840_write4(client, 0x42c, 0x42600000);
  976. cx25840_write4(client, 0x430, 0x0000039b);
  977. cx25840_write4(client, 0x438, 0x00000000);
  978. cx25840_write4(client, 0x440, 0xF8E3E824);
  979. cx25840_write4(client, 0x444, 0x401040dc);
  980. cx25840_write4(client, 0x448, 0xcd3f02a0);
  981. cx25840_write4(client, 0x44c, 0x161f1000);
  982. cx25840_write4(client, 0x450, 0x00000802);
  983. cx25840_write4(client, 0x91c, 0x01000000);
  984. cx25840_write4(client, 0x8e0, 0x03063870);
  985. cx25840_write4(client, 0x8d4, 0x7FFF0024);
  986. cx25840_write4(client, 0x8d0, 0x00063073);
  987. cx25840_write4(client, 0x8c8, 0x00010000);
  988. cx25840_write4(client, 0x8cc, 0x00080023);
  989. /* DIF BYPASS */
  990. cx25840_write4(client, 0x33c, 0x2a04c800);
  991. }
  992. /* Reset the DIF */
  993. cx25840_write4(client, 0x398, 0);
  994. }
  995. if (!is_cx2388x(state) && !is_cx231xx(state)) {
  996. /* Set CH_SEL_ADC2 to 1 if input comes from CH3 */
  997. cx25840_and_or(client, 0x102, ~0x2, (reg & 0x80) == 0 ? 2 : 0);
  998. /* Set DUAL_MODE_ADC2 to 1 if input comes from both CH2&CH3 */
  999. if ((reg & 0xc0) != 0xc0 && (reg & 0x30) != 0x30)
  1000. cx25840_and_or(client, 0x102, ~0x4, 4);
  1001. else
  1002. cx25840_and_or(client, 0x102, ~0x4, 0);
  1003. } else {
  1004. /* Set DUAL_MODE_ADC2 to 1 if component*/
  1005. cx25840_and_or(client, 0x102, ~0x4, is_component ? 0x4 : 0x0);
  1006. if (is_composite) {
  1007. /* ADC2 input select channel 2 */
  1008. cx25840_and_or(client, 0x102, ~0x2, 0);
  1009. } else if (!is_component) {
  1010. /* S-Video */
  1011. if (chroma >= CX25840_SVIDEO_CHROMA7) {
  1012. /* ADC2 input select channel 3 */
  1013. cx25840_and_or(client, 0x102, ~0x2, 2);
  1014. } else {
  1015. /* ADC2 input select channel 2 */
  1016. cx25840_and_or(client, 0x102, ~0x2, 0);
  1017. }
  1018. }
  1019. /* cx23885 / SVIDEO */
  1020. if (is_cx2388x(state) && is_svideo) {
  1021. #define AFE_CTRL (0x104)
  1022. #define MODE_CTRL (0x400)
  1023. cx25840_and_or(client, 0x102, ~0x2, 0x2);
  1024. val = cx25840_read4(client, MODE_CTRL);
  1025. val &= 0xFFFFF9FF;
  1026. /* YC */
  1027. val |= 0x00000200;
  1028. val &= ~0x2000;
  1029. cx25840_write4(client, MODE_CTRL, val);
  1030. val = cx25840_read4(client, AFE_CTRL);
  1031. /* Chroma in select */
  1032. val |= 0x00001000;
  1033. val &= 0xfffffe7f;
  1034. /* Clear VGA_SEL_CH2 and VGA_SEL_CH3 (bits 7 and 8).
  1035. * This sets them to use video rather than audio.
  1036. * Only one of the two will be in use.
  1037. */
  1038. cx25840_write4(client, AFE_CTRL, val);
  1039. } else
  1040. cx25840_and_or(client, 0x102, ~0x2, 0);
  1041. }
  1042. state->vid_input = vid_input;
  1043. state->aud_input = aud_input;
  1044. cx25840_audio_set_path(client);
  1045. input_change(client);
  1046. if (is_cx2388x(state)) {
  1047. /* Audio channel 1 src : Parallel 1 */
  1048. cx25840_write(client, 0x124, 0x03);
  1049. /* Select AFE clock pad output source */
  1050. cx25840_write(client, 0x144, 0x05);
  1051. /* I2S_IN_CTL: I2S_IN_SONY_MODE, LEFT SAMPLE on WS=1 */
  1052. cx25840_write(client, 0x914, 0xa0);
  1053. /* I2S_OUT_CTL:
  1054. * I2S_IN_SONY_MODE, LEFT SAMPLE on WS=1
  1055. * I2S_OUT_MASTER_MODE = Master
  1056. */
  1057. cx25840_write(client, 0x918, 0xa0);
  1058. cx25840_write(client, 0x919, 0x01);
  1059. } else if (is_cx231xx(state)) {
  1060. /* Audio channel 1 src : Parallel 1 */
  1061. cx25840_write(client, 0x124, 0x03);
  1062. /* I2S_IN_CTL: I2S_IN_SONY_MODE, LEFT SAMPLE on WS=1 */
  1063. cx25840_write(client, 0x914, 0xa0);
  1064. /* I2S_OUT_CTL:
  1065. * I2S_IN_SONY_MODE, LEFT SAMPLE on WS=1
  1066. * I2S_OUT_MASTER_MODE = Master
  1067. */
  1068. cx25840_write(client, 0x918, 0xa0);
  1069. cx25840_write(client, 0x919, 0x01);
  1070. }
  1071. if (is_cx2388x(state) && ((aud_input == CX25840_AUDIO7) ||
  1072. (aud_input == CX25840_AUDIO6))) {
  1073. /* Configure audio from LR1 or LR2 input */
  1074. cx25840_write4(client, 0x910, 0);
  1075. cx25840_write4(client, 0x8d0, 0x63073);
  1076. } else
  1077. if (is_cx2388x(state) && (aud_input == CX25840_AUDIO8)) {
  1078. /* Configure audio from tuner/sif input */
  1079. cx25840_write4(client, 0x910, 0x12b000c9);
  1080. cx25840_write4(client, 0x8d0, 0x1f063870);
  1081. }
  1082. if (is_cx23888(state)) {
  1083. /* HVR1850 */
  1084. /* AUD_IO_CTRL - I2S Input, Parallel1*/
  1085. /* - Channel 1 src - Parallel1 (Merlin out) */
  1086. /* - Channel 2 src - Parallel2 (Merlin out) */
  1087. /* - Channel 3 src - Parallel3 (Merlin AC97 out) */
  1088. /* - I2S source and dir - Merlin, output */
  1089. cx25840_write4(client, 0x124, 0x100);
  1090. if (!is_dif) {
  1091. /* Stop microcontroller if we don't need it
  1092. * to avoid audio popping on svideo/composite use.
  1093. */
  1094. cx25840_and_or(client, 0x803, ~0x10, 0x00);
  1095. }
  1096. }
  1097. return 0;
  1098. }
  1099. /* ----------------------------------------------------------------------- */
  1100. static int set_v4lstd(struct i2c_client *client)
  1101. {
  1102. struct cx25840_state *state = to_state(i2c_get_clientdata(client));
  1103. u8 fmt = 0; /* zero is autodetect */
  1104. u8 pal_m = 0;
  1105. /* First tests should be against specific std */
  1106. if (state->std == V4L2_STD_NTSC_M_JP) {
  1107. fmt = 0x2;
  1108. } else if (state->std == V4L2_STD_NTSC_443) {
  1109. fmt = 0x3;
  1110. } else if (state->std == V4L2_STD_PAL_M) {
  1111. pal_m = 1;
  1112. fmt = 0x5;
  1113. } else if (state->std == V4L2_STD_PAL_N) {
  1114. fmt = 0x6;
  1115. } else if (state->std == V4L2_STD_PAL_Nc) {
  1116. fmt = 0x7;
  1117. } else if (state->std == V4L2_STD_PAL_60) {
  1118. fmt = 0x8;
  1119. } else {
  1120. /* Then, test against generic ones */
  1121. if (state->std & V4L2_STD_NTSC)
  1122. fmt = 0x1;
  1123. else if (state->std & V4L2_STD_PAL)
  1124. fmt = 0x4;
  1125. else if (state->std & V4L2_STD_SECAM)
  1126. fmt = 0xc;
  1127. }
  1128. v4l_dbg(1, cx25840_debug, client, "changing video std to fmt %i\n",fmt);
  1129. /* Follow step 9 of section 3.16 in the cx25840 datasheet.
  1130. Without this PAL may display a vertical ghosting effect.
  1131. This happens for example with the Yuan MPC622. */
  1132. if (fmt >= 4 && fmt < 8) {
  1133. /* Set format to NTSC-M */
  1134. cx25840_and_or(client, 0x400, ~0xf, 1);
  1135. /* Turn off LCOMB */
  1136. cx25840_and_or(client, 0x47b, ~6, 0);
  1137. }
  1138. cx25840_and_or(client, 0x400, ~0xf, fmt);
  1139. cx25840_and_or(client, 0x403, ~0x3, pal_m);
  1140. if (is_cx23888(state))
  1141. cx23888_std_setup(client);
  1142. else
  1143. cx25840_std_setup(client);
  1144. if (!is_cx2583x(state))
  1145. input_change(client);
  1146. return 0;
  1147. }
  1148. /* ----------------------------------------------------------------------- */
  1149. static int cx25840_s_ctrl(struct v4l2_ctrl *ctrl)
  1150. {
  1151. struct v4l2_subdev *sd = to_sd(ctrl);
  1152. struct cx25840_state *state = to_state(sd);
  1153. struct i2c_client *client = v4l2_get_subdevdata(sd);
  1154. switch (ctrl->id) {
  1155. case V4L2_CID_BRIGHTNESS:
  1156. cx25840_write(client, 0x414, ctrl->val - 128);
  1157. break;
  1158. case V4L2_CID_CONTRAST:
  1159. cx25840_write(client, 0x415, ctrl->val << 1);
  1160. break;
  1161. case V4L2_CID_SATURATION:
  1162. if (is_cx23888(state)) {
  1163. cx25840_write(client, 0x418, ctrl->val << 1);
  1164. cx25840_write(client, 0x419, ctrl->val << 1);
  1165. } else {
  1166. cx25840_write(client, 0x420, ctrl->val << 1);
  1167. cx25840_write(client, 0x421, ctrl->val << 1);
  1168. }
  1169. break;
  1170. case V4L2_CID_HUE:
  1171. if (is_cx23888(state))
  1172. cx25840_write(client, 0x41a, ctrl->val);
  1173. else
  1174. cx25840_write(client, 0x422, ctrl->val);
  1175. break;
  1176. default:
  1177. return -EINVAL;
  1178. }
  1179. return 0;
  1180. }
  1181. /* ----------------------------------------------------------------------- */
  1182. static int cx25840_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt)
  1183. {
  1184. struct cx25840_state *state = to_state(sd);
  1185. struct i2c_client *client = v4l2_get_subdevdata(sd);
  1186. int HSC, VSC, Vsrc, Hsrc, filter, Vlines;
  1187. int is_50Hz = !(state->std & V4L2_STD_525_60);
  1188. if (fmt->code != V4L2_MBUS_FMT_FIXED)
  1189. return -EINVAL;
  1190. fmt->field = V4L2_FIELD_INTERLACED;
  1191. fmt->colorspace = V4L2_COLORSPACE_SMPTE170M;
  1192. if (is_cx23888(state)) {
  1193. Vsrc = (cx25840_read(client, 0x42a) & 0x3f) << 4;
  1194. Vsrc |= (cx25840_read(client, 0x429) & 0xf0) >> 4;
  1195. } else {
  1196. Vsrc = (cx25840_read(client, 0x476) & 0x3f) << 4;
  1197. Vsrc |= (cx25840_read(client, 0x475) & 0xf0) >> 4;
  1198. }
  1199. if (is_cx23888(state)) {
  1200. Hsrc = (cx25840_read(client, 0x426) & 0x3f) << 4;
  1201. Hsrc |= (cx25840_read(client, 0x425) & 0xf0) >> 4;
  1202. } else {
  1203. Hsrc = (cx25840_read(client, 0x472) & 0x3f) << 4;
  1204. Hsrc |= (cx25840_read(client, 0x471) & 0xf0) >> 4;
  1205. }
  1206. Vlines = fmt->height + (is_50Hz ? 4 : 7);
  1207. if ((fmt->width * 16 < Hsrc) || (Hsrc < fmt->width) ||
  1208. (Vlines * 8 < Vsrc) || (Vsrc < Vlines)) {
  1209. v4l_err(client, "%dx%d is not a valid size!\n",
  1210. fmt->width, fmt->height);
  1211. return -ERANGE;
  1212. }
  1213. HSC = (Hsrc * (1 << 20)) / fmt->width - (1 << 20);
  1214. VSC = (1 << 16) - (Vsrc * (1 << 9) / Vlines - (1 << 9));
  1215. VSC &= 0x1fff;
  1216. if (fmt->width >= 385)
  1217. filter = 0;
  1218. else if (fmt->width > 192)
  1219. filter = 1;
  1220. else if (fmt->width > 96)
  1221. filter = 2;
  1222. else
  1223. filter = 3;
  1224. v4l_dbg(1, cx25840_debug, client, "decoder set size %dx%d -> scale %ux%u\n",
  1225. fmt->width, fmt->height, HSC, VSC);
  1226. /* HSCALE=HSC */
  1227. cx25840_write(client, 0x418, HSC & 0xff);
  1228. cx25840_write(client, 0x419, (HSC >> 8) & 0xff);
  1229. cx25840_write(client, 0x41a, HSC >> 16);
  1230. /* VSCALE=VSC */
  1231. cx25840_write(client, 0x41c, VSC & 0xff);
  1232. cx25840_write(client, 0x41d, VSC >> 8);
  1233. /* VS_INTRLACE=1 VFILT=filter */
  1234. cx25840_write(client, 0x41e, 0x8 | filter);
  1235. return 0;
  1236. }
  1237. /* ----------------------------------------------------------------------- */
  1238. static void log_video_status(struct i2c_client *client)
  1239. {
  1240. static const char *const fmt_strs[] = {
  1241. "0x0",
  1242. "NTSC-M", "NTSC-J", "NTSC-4.43",
  1243. "PAL-BDGHI", "PAL-M", "PAL-N", "PAL-Nc", "PAL-60",
  1244. "0x9", "0xA", "0xB",
  1245. "SECAM",
  1246. "0xD", "0xE", "0xF"
  1247. };
  1248. struct cx25840_state *state = to_state(i2c_get_clientdata(client));
  1249. u8 vidfmt_sel = cx25840_read(client, 0x400) & 0xf;
  1250. u8 gen_stat1 = cx25840_read(client, 0x40d);
  1251. u8 gen_stat2 = cx25840_read(client, 0x40e);
  1252. int vid_input = state->vid_input;
  1253. v4l_info(client, "Video signal: %spresent\n",
  1254. (gen_stat2 & 0x20) ? "" : "not ");
  1255. v4l_info(client, "Detected format: %s\n",
  1256. fmt_strs[gen_stat1 & 0xf]);
  1257. v4l_info(client, "Specified standard: %s\n",
  1258. vidfmt_sel ? fmt_strs[vidfmt_sel] : "automatic detection");
  1259. if (vid_input >= CX25840_COMPOSITE1 &&
  1260. vid_input <= CX25840_COMPOSITE8) {
  1261. v4l_info(client, "Specified video input: Composite %d\n",
  1262. vid_input - CX25840_COMPOSITE1 + 1);
  1263. } else {
  1264. v4l_info(client, "Specified video input: S-Video (Luma In%d, Chroma In%d)\n",
  1265. (vid_input & 0xf0) >> 4, (vid_input & 0xf00) >> 8);
  1266. }
  1267. v4l_info(client, "Specified audioclock freq: %d Hz\n", state->audclk_freq);
  1268. }
  1269. /* ----------------------------------------------------------------------- */
  1270. static void log_audio_status(struct i2c_client *client)
  1271. {
  1272. struct cx25840_state *state = to_state(i2c_get_clientdata(client));
  1273. u8 download_ctl = cx25840_read(client, 0x803);
  1274. u8 mod_det_stat0 = cx25840_read(client, 0x804);
  1275. u8 mod_det_stat1 = cx25840_read(client, 0x805);
  1276. u8 audio_config = cx25840_read(client, 0x808);
  1277. u8 pref_mode = cx25840_read(client, 0x809);
  1278. u8 afc0 = cx25840_read(client, 0x80b);
  1279. u8 mute_ctl = cx25840_read(client, 0x8d3);
  1280. int aud_input = state->aud_input;
  1281. char *p;
  1282. switch (mod_det_stat0) {
  1283. case 0x00: p = "mono"; break;
  1284. case 0x01: p = "stereo"; break;
  1285. case 0x02: p = "dual"; break;
  1286. case 0x04: p = "tri"; break;
  1287. case 0x10: p = "mono with SAP"; break;
  1288. case 0x11: p = "stereo with SAP"; break;
  1289. case 0x12: p = "dual with SAP"; break;
  1290. case 0x14: p = "tri with SAP"; break;
  1291. case 0xfe: p = "forced mode"; break;
  1292. default: p = "not defined";
  1293. }
  1294. v4l_info(client, "Detected audio mode: %s\n", p);
  1295. switch (mod_det_stat1) {
  1296. case 0x00: p = "not defined"; break;
  1297. case 0x01: p = "EIAJ"; break;
  1298. case 0x02: p = "A2-M"; break;
  1299. case 0x03: p = "A2-BG"; break;
  1300. case 0x04: p = "A2-DK1"; break;
  1301. case 0x05: p = "A2-DK2"; break;
  1302. case 0x06: p = "A2-DK3"; break;
  1303. case 0x07: p = "A1 (6.0 MHz FM Mono)"; break;
  1304. case 0x08: p = "AM-L"; break;
  1305. case 0x09: p = "NICAM-BG"; break;
  1306. case 0x0a: p = "NICAM-DK"; break;
  1307. case 0x0b: p = "NICAM-I"; break;
  1308. case 0x0c: p = "NICAM-L"; break;
  1309. case 0x0d: p = "BTSC/EIAJ/A2-M Mono (4.5 MHz FMMono)"; break;
  1310. case 0x0e: p = "IF FM Radio"; break;
  1311. case 0x0f: p = "BTSC"; break;
  1312. case 0x10: p = "high-deviation FM"; break;
  1313. case 0x11: p = "very high-deviation FM"; break;
  1314. case 0xfd: p = "unknown audio standard"; break;
  1315. case 0xfe: p = "forced audio standard"; break;
  1316. case 0xff: p = "no detected audio standard"; break;
  1317. default: p = "not defined";
  1318. }
  1319. v4l_info(client, "Detected audio standard: %s\n", p);
  1320. v4l_info(client, "Audio microcontroller: %s\n",
  1321. (download_ctl & 0x10) ?
  1322. ((mute_ctl & 0x2) ? "detecting" : "running") : "stopped");
  1323. switch (audio_config >> 4) {
  1324. case 0x00: p = "undefined"; break;
  1325. case 0x01: p = "BTSC"; break;
  1326. case 0x02: p = "EIAJ"; break;
  1327. case 0x03: p = "A2-M"; break;
  1328. case 0x04: p = "A2-BG"; break;
  1329. case 0x05: p = "A2-DK1"; break;
  1330. case 0x06: p = "A2-DK2"; break;
  1331. case 0x07: p = "A2-DK3"; break;
  1332. case 0x08: p = "A1 (6.0 MHz FM Mono)"; break;
  1333. case 0x09: p = "AM-L"; break;
  1334. case 0x0a: p = "NICAM-BG"; break;
  1335. case 0x0b: p = "NICAM-DK"; break;
  1336. case 0x0c: p = "NICAM-I"; break;
  1337. case 0x0d: p = "NICAM-L"; break;
  1338. case 0x0e: p = "FM radio"; break;
  1339. case 0x0f: p = "automatic detection"; break;
  1340. default: p = "undefined";
  1341. }
  1342. v4l_info(client, "Configured audio standard: %s\n", p);
  1343. if ((audio_config >> 4) < 0xF) {
  1344. switch (audio_config & 0xF) {
  1345. case 0x00: p = "MONO1 (LANGUAGE A/Mono L+R channel for BTSC, EIAJ, A2)"; break;
  1346. case 0x01: p = "MONO2 (LANGUAGE B)"; break;
  1347. case 0x02: p = "MONO3 (STEREO forced MONO)"; break;
  1348. case 0x03: p = "MONO4 (NICAM ANALOG-Language C/Analog Fallback)"; break;
  1349. case 0x04: p = "STEREO"; break;
  1350. case 0x05: p = "DUAL1 (AB)"; break;
  1351. case 0x06: p = "DUAL2 (AC) (FM)"; break;
  1352. case 0x07: p = "DUAL3 (BC) (FM)"; break;
  1353. case 0x08: p = "DUAL4 (AC) (AM)"; break;
  1354. case 0x09: p = "DUAL5 (BC) (AM)"; break;
  1355. case 0x0a: p = "SAP"; break;
  1356. default: p = "undefined";
  1357. }
  1358. v4l_info(client, "Configured audio mode: %s\n", p);
  1359. } else {
  1360. switch (audio_config & 0xF) {
  1361. case 0x00: p = "BG"; break;
  1362. case 0x01: p = "DK1"; break;
  1363. case 0x02: p = "DK2"; break;
  1364. case 0x03: p = "DK3"; break;
  1365. case 0x04: p = "I"; break;
  1366. case 0x05: p = "L"; break;
  1367. case 0x06: p = "BTSC"; break;
  1368. case 0x07: p = "EIAJ"; break;
  1369. case 0x08: p = "A2-M"; break;
  1370. case 0x09: p = "FM Radio"; break;
  1371. case 0x0f: p = "automatic standard and mode detection"; break;
  1372. default: p = "undefined";
  1373. }
  1374. v4l_info(client, "Configured audio system: %s\n", p);
  1375. }
  1376. if (aud_input) {
  1377. v4l_info(client, "Specified audio input: Tuner (In%d)\n", aud_input);
  1378. } else {
  1379. v4l_info(client, "Specified audio input: External\n");
  1380. }
  1381. switch (pref_mode & 0xf) {
  1382. case 0: p = "mono/language A"; break;
  1383. case 1: p = "language B"; break;
  1384. case 2: p = "language C"; break;
  1385. case 3: p = "analog fallback"; break;
  1386. case 4: p = "stereo"; break;
  1387. case 5: p = "language AC"; break;
  1388. case 6: p = "language BC"; break;
  1389. case 7: p = "language AB"; break;
  1390. default: p = "undefined";
  1391. }
  1392. v4l_info(client, "Preferred audio mode: %s\n", p);
  1393. if ((audio_config & 0xf) == 0xf) {
  1394. switch ((afc0 >> 3) & 0x3) {
  1395. case 0: p = "system DK"; break;
  1396. case 1: p = "system L"; break;
  1397. case 2: p = "autodetect"; break;
  1398. default: p = "undefined";
  1399. }
  1400. v4l_info(client, "Selected 65 MHz format: %s\n", p);
  1401. switch (afc0 & 0x7) {
  1402. case 0: p = "chroma"; break;
  1403. case 1: p = "BTSC"; break;
  1404. case 2: p = "EIAJ"; break;
  1405. case 3: p = "A2-M"; break;
  1406. case 4: p = "autodetect"; break;
  1407. default: p = "undefined";
  1408. }
  1409. v4l_info(client, "Selected 45 MHz format: %s\n", p);
  1410. }
  1411. }
  1412. /* ----------------------------------------------------------------------- */
  1413. /* This load_fw operation must be called to load the driver's firmware.
  1414. Without this the audio standard detection will fail and you will
  1415. only get mono.
  1416. Since loading the firmware is often problematic when the driver is
  1417. compiled into the kernel I recommend postponing calling this function
  1418. until the first open of the video device. Another reason for
  1419. postponing it is that loading this firmware takes a long time (seconds)
  1420. due to the slow i2c bus speed. So it will speed up the boot process if
  1421. you can avoid loading the fw as long as the video device isn't used. */
  1422. static int cx25840_load_fw(struct v4l2_subdev *sd)
  1423. {
  1424. struct cx25840_state *state = to_state(sd);
  1425. struct i2c_client *client = v4l2_get_subdevdata(sd);
  1426. if (!state->is_initialized) {
  1427. /* initialize and load firmware */
  1428. state->is_initialized = 1;
  1429. if (is_cx2583x(state))
  1430. cx25836_initialize(client);
  1431. else if (is_cx2388x(state))
  1432. cx23885_initialize(client);
  1433. else if (is_cx231xx(state))
  1434. cx231xx_initialize(client);
  1435. else
  1436. cx25840_initialize(client);
  1437. }
  1438. return 0;
  1439. }
  1440. #ifdef CONFIG_VIDEO_ADV_DEBUG
  1441. static int cx25840_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
  1442. {
  1443. struct i2c_client *client = v4l2_get_subdevdata(sd);
  1444. if (!v4l2_chip_match_i2c_client(client, &reg->match))
  1445. return -EINVAL;
  1446. if (!capable(CAP_SYS_ADMIN))
  1447. return -EPERM;
  1448. reg->size = 1;
  1449. reg->val = cx25840_read(client, reg->reg & 0x0fff);
  1450. return 0;
  1451. }
  1452. static int cx25840_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
  1453. {
  1454. struct i2c_client *client = v4l2_get_subdevdata(sd);
  1455. if (!v4l2_chip_match_i2c_client(client, &reg->match))
  1456. return -EINVAL;
  1457. if (!capable(CAP_SYS_ADMIN))
  1458. return -EPERM;
  1459. cx25840_write(client, reg->reg & 0x0fff, reg->val & 0xff);
  1460. return 0;
  1461. }
  1462. #endif
  1463. static int cx25840_s_audio_stream(struct v4l2_subdev *sd, int enable)
  1464. {
  1465. struct cx25840_state *state = to_state(sd);
  1466. struct i2c_client *client = v4l2_get_subdevdata(sd);
  1467. u8 v;
  1468. if (is_cx2583x(state) || is_cx2388x(state) || is_cx231xx(state))
  1469. return 0;
  1470. v4l_dbg(1, cx25840_debug, client, "%s audio output\n",
  1471. enable ? "enable" : "disable");
  1472. if (enable) {
  1473. v = cx25840_read(client, 0x115) | 0x80;
  1474. cx25840_write(client, 0x115, v);
  1475. v = cx25840_read(client, 0x116) | 0x03;
  1476. cx25840_write(client, 0x116, v);
  1477. } else {
  1478. v = cx25840_read(client, 0x115) & ~(0x80);
  1479. cx25840_write(client, 0x115, v);
  1480. v = cx25840_read(client, 0x116) & ~(0x03);
  1481. cx25840_write(client, 0x116, v);
  1482. }
  1483. return 0;
  1484. }
  1485. static int cx25840_s_stream(struct v4l2_subdev *sd, int enable)
  1486. {
  1487. struct cx25840_state *state = to_state(sd);
  1488. struct i2c_client *client = v4l2_get_subdevdata(sd);
  1489. u8 v;
  1490. v4l_dbg(1, cx25840_debug, client, "%s video output\n",
  1491. enable ? "enable" : "disable");
  1492. if (enable) {
  1493. if (is_cx2388x(state) || is_cx231xx(state)) {
  1494. v = cx25840_read(client, 0x421) | 0x0b;
  1495. cx25840_write(client, 0x421, v);
  1496. } else {
  1497. v = cx25840_read(client, 0x115) | 0x0c;
  1498. cx25840_write(client, 0x115, v);
  1499. v = cx25840_read(client, 0x116) | 0x04;
  1500. cx25840_write(client, 0x116, v);
  1501. }
  1502. } else {
  1503. if (is_cx2388x(state) || is_cx231xx(state)) {
  1504. v = cx25840_read(client, 0x421) & ~(0x0b);
  1505. cx25840_write(client, 0x421, v);
  1506. } else {
  1507. v = cx25840_read(client, 0x115) & ~(0x0c);
  1508. cx25840_write(client, 0x115, v);
  1509. v = cx25840_read(client, 0x116) & ~(0x04);
  1510. cx25840_write(client, 0x116, v);
  1511. }
  1512. }
  1513. return 0;
  1514. }
  1515. /* Query the current detected video format */
  1516. static int cx25840_g_std(struct v4l2_subdev *sd, v4l2_std_id *std)
  1517. {
  1518. struct i2c_client *client = v4l2_get_subdevdata(sd);
  1519. v4l2_std_id stds[] = {
  1520. /* 0000 */ V4L2_STD_UNKNOWN,
  1521. /* 0001 */ V4L2_STD_NTSC_M,
  1522. /* 0010 */ V4L2_STD_NTSC_M_JP,
  1523. /* 0011 */ V4L2_STD_NTSC_443,
  1524. /* 0100 */ V4L2_STD_PAL,
  1525. /* 0101 */ V4L2_STD_PAL_M,
  1526. /* 0110 */ V4L2_STD_PAL_N,
  1527. /* 0111 */ V4L2_STD_PAL_Nc,
  1528. /* 1000 */ V4L2_STD_PAL_60,
  1529. /* 1001 */ V4L2_STD_UNKNOWN,
  1530. /* 1010 */ V4L2_STD_UNKNOWN,
  1531. /* 1001 */ V4L2_STD_UNKNOWN,
  1532. /* 1010 */ V4L2_STD_UNKNOWN,
  1533. /* 1011 */ V4L2_STD_UNKNOWN,
  1534. /* 1110 */ V4L2_STD_UNKNOWN,
  1535. /* 1111 */ V4L2_STD_UNKNOWN
  1536. };
  1537. u32 fmt = (cx25840_read4(client, 0x40c) >> 8) & 0xf;
  1538. *std = stds[ fmt ];
  1539. v4l_dbg(1, cx25840_debug, client, "g_std fmt = %x, v4l2_std_id = 0x%x\n",
  1540. fmt, (unsigned int)stds[ fmt ]);
  1541. return 0;
  1542. }
  1543. static int cx25840_g_input_status(struct v4l2_subdev *sd, u32 *status)
  1544. {
  1545. struct i2c_client *client = v4l2_get_subdevdata(sd);
  1546. /* A limited function that checks for signal status and returns
  1547. * the state.
  1548. */
  1549. /* Check for status of Horizontal lock (SRC lock isn't reliable) */
  1550. if ((cx25840_read4(client, 0x40c) & 0x00010000) == 0)
  1551. *status |= V4L2_IN_ST_NO_SIGNAL;
  1552. return 0;
  1553. }
  1554. static int cx25840_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
  1555. {
  1556. struct cx25840_state *state = to_state(sd);
  1557. struct i2c_client *client = v4l2_get_subdevdata(sd);
  1558. if (state->radio == 0 && state->std == std)
  1559. return 0;
  1560. state->radio = 0;
  1561. state->std = std;
  1562. return set_v4lstd(client);
  1563. }
  1564. static int cx25840_s_radio(struct v4l2_subdev *sd)
  1565. {
  1566. struct cx25840_state *state = to_state(sd);
  1567. state->radio = 1;
  1568. return 0;
  1569. }
  1570. static int cx25840_s_video_routing(struct v4l2_subdev *sd,
  1571. u32 input, u32 output, u32 config)
  1572. {
  1573. struct cx25840_state *state = to_state(sd);
  1574. struct i2c_client *client = v4l2_get_subdevdata(sd);
  1575. if (is_cx23888(state))
  1576. cx23888_std_setup(client);
  1577. return set_input(client, input, state->aud_input);
  1578. }
  1579. static int cx25840_s_audio_routing(struct v4l2_subdev *sd,
  1580. u32 input, u32 output, u32 config)
  1581. {
  1582. struct cx25840_state *state = to_state(sd);
  1583. struct i2c_client *client = v4l2_get_subdevdata(sd);
  1584. if (is_cx23888(state))
  1585. cx23888_std_setup(client);
  1586. return set_input(client, state->vid_input, input);
  1587. }
  1588. static int cx25840_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *freq)
  1589. {
  1590. struct i2c_client *client = v4l2_get_subdevdata(sd);
  1591. input_change(client);
  1592. return 0;
  1593. }
  1594. static int cx25840_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
  1595. {
  1596. struct cx25840_state *state = to_state(sd);
  1597. struct i2c_client *client = v4l2_get_subdevdata(sd);
  1598. u8 vpres = cx25840_read(client, 0x40e) & 0x20;
  1599. u8 mode;
  1600. int val = 0;
  1601. if (state->radio)
  1602. return 0;
  1603. vt->signal = vpres ? 0xffff : 0x0;
  1604. if (is_cx2583x(state))
  1605. return 0;
  1606. vt->capability |=
  1607. V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_LANG1 |
  1608. V4L2_TUNER_CAP_LANG2 | V4L2_TUNER_CAP_SAP;
  1609. mode = cx25840_read(client, 0x804);
  1610. /* get rxsubchans and audmode */
  1611. if ((mode & 0xf) == 1)
  1612. val |= V4L2_TUNER_SUB_STEREO;
  1613. else
  1614. val |= V4L2_TUNER_SUB_MONO;
  1615. if (mode == 2 || mode == 4)
  1616. val = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
  1617. if (mode & 0x10)
  1618. val |= V4L2_TUNER_SUB_SAP;
  1619. vt->rxsubchans = val;
  1620. vt->audmode = state->audmode;
  1621. return 0;
  1622. }
  1623. static int cx25840_s_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
  1624. {
  1625. struct cx25840_state *state = to_state(sd);
  1626. struct i2c_client *client = v4l2_get_subdevdata(sd);
  1627. if (state->radio || is_cx2583x(state))
  1628. return 0;
  1629. switch (vt->audmode) {
  1630. case V4L2_TUNER_MODE_MONO:
  1631. /* mono -> mono
  1632. stereo -> mono
  1633. bilingual -> lang1 */
  1634. cx25840_and_or(client, 0x809, ~0xf, 0x00);
  1635. break;
  1636. case V4L2_TUNER_MODE_STEREO:
  1637. case V4L2_TUNER_MODE_LANG1:
  1638. /* mono -> mono
  1639. stereo -> stereo
  1640. bilingual -> lang1 */
  1641. cx25840_and_or(client, 0x809, ~0xf, 0x04);
  1642. break;
  1643. case V4L2_TUNER_MODE_LANG1_LANG2:
  1644. /* mono -> mono
  1645. stereo -> stereo
  1646. bilingual -> lang1/lang2 */
  1647. cx25840_and_or(client, 0x809, ~0xf, 0x07);
  1648. break;
  1649. case V4L2_TUNER_MODE_LANG2:
  1650. /* mono -> mono
  1651. stereo -> stereo
  1652. bilingual -> lang2 */
  1653. cx25840_and_or(client, 0x809, ~0xf, 0x01);
  1654. break;
  1655. default:
  1656. return -EINVAL;
  1657. }
  1658. state->audmode = vt->audmode;
  1659. return 0;
  1660. }
  1661. static int cx25840_reset(struct v4l2_subdev *sd, u32 val)
  1662. {
  1663. struct cx25840_state *state = to_state(sd);
  1664. struct i2c_client *client = v4l2_get_subdevdata(sd);
  1665. if (is_cx2583x(state))
  1666. cx25836_initialize(client);
  1667. else if (is_cx2388x(state))
  1668. cx23885_initialize(client);
  1669. else if (is_cx231xx(state))
  1670. cx231xx_initialize(client);
  1671. else
  1672. cx25840_initialize(client);
  1673. return 0;
  1674. }
  1675. static int cx25840_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
  1676. {
  1677. struct cx25840_state *state = to_state(sd);
  1678. struct i2c_client *client = v4l2_get_subdevdata(sd);
  1679. return v4l2_chip_ident_i2c_client(client, chip, state->id, state->rev);
  1680. }
  1681. static int cx25840_log_status(struct v4l2_subdev *sd)
  1682. {
  1683. struct cx25840_state *state = to_state(sd);
  1684. struct i2c_client *client = v4l2_get_subdevdata(sd);
  1685. log_video_status(client);
  1686. if (!is_cx2583x(state))
  1687. log_audio_status(client);
  1688. cx25840_ir_log_status(sd);
  1689. v4l2_ctrl_handler_log_status(&state->hdl, sd->name);
  1690. return 0;
  1691. }
  1692. static int cx23885_irq_handler(struct v4l2_subdev *sd, u32 status,
  1693. bool *handled)
  1694. {
  1695. struct cx25840_state *state = to_state(sd);
  1696. struct i2c_client *c = v4l2_get_subdevdata(sd);
  1697. u8 irq_stat, aud_stat, aud_en, ir_stat, ir_en;
  1698. u32 vid_stat, aud_mc_stat;
  1699. bool block_handled;
  1700. int ret = 0;
  1701. irq_stat = cx25840_read(c, CX23885_PIN_CTRL_IRQ_REG);
  1702. v4l_dbg(2, cx25840_debug, c, "AV Core IRQ status (entry): %s %s %s\n",
  1703. irq_stat & CX23885_PIN_CTRL_IRQ_IR_STAT ? "ir" : " ",
  1704. irq_stat & CX23885_PIN_CTRL_IRQ_AUD_STAT ? "aud" : " ",
  1705. irq_stat & CX23885_PIN_CTRL_IRQ_VID_STAT ? "vid" : " ");
  1706. if ((is_cx23885(state) || is_cx23887(state))) {
  1707. ir_stat = cx25840_read(c, CX25840_IR_STATS_REG);
  1708. ir_en = cx25840_read(c, CX25840_IR_IRQEN_REG);
  1709. v4l_dbg(2, cx25840_debug, c,
  1710. "AV Core ir IRQ status: %#04x disables: %#04x\n",
  1711. ir_stat, ir_en);
  1712. if (irq_stat & CX23885_PIN_CTRL_IRQ_IR_STAT) {
  1713. block_handled = false;
  1714. ret = cx25840_ir_irq_handler(sd,
  1715. status, &block_handled);
  1716. if (block_handled)
  1717. *handled = true;
  1718. }
  1719. }
  1720. aud_stat = cx25840_read(c, CX25840_AUD_INT_STAT_REG);
  1721. aud_en = cx25840_read(c, CX25840_AUD_INT_CTRL_REG);
  1722. v4l_dbg(2, cx25840_debug, c,
  1723. "AV Core audio IRQ status: %#04x disables: %#04x\n",
  1724. aud_stat, aud_en);
  1725. aud_mc_stat = cx25840_read4(c, CX23885_AUD_MC_INT_MASK_REG);
  1726. v4l_dbg(2, cx25840_debug, c,
  1727. "AV Core audio MC IRQ status: %#06x enables: %#06x\n",
  1728. aud_mc_stat >> CX23885_AUD_MC_INT_STAT_SHFT,
  1729. aud_mc_stat & CX23885_AUD_MC_INT_CTRL_BITS);
  1730. if (irq_stat & CX23885_PIN_CTRL_IRQ_AUD_STAT) {
  1731. if (aud_stat) {
  1732. cx25840_write(c, CX25840_AUD_INT_STAT_REG, aud_stat);
  1733. *handled = true;
  1734. }
  1735. }
  1736. vid_stat = cx25840_read4(c, CX25840_VID_INT_STAT_REG);
  1737. v4l_dbg(2, cx25840_debug, c,
  1738. "AV Core video IRQ status: %#06x disables: %#06x\n",
  1739. vid_stat & CX25840_VID_INT_STAT_BITS,
  1740. vid_stat >> CX25840_VID_INT_MASK_SHFT);
  1741. if (irq_stat & CX23885_PIN_CTRL_IRQ_VID_STAT) {
  1742. if (vid_stat & CX25840_VID_INT_STAT_BITS) {
  1743. cx25840_write4(c, CX25840_VID_INT_STAT_REG, vid_stat);
  1744. *handled = true;
  1745. }
  1746. }
  1747. irq_stat = cx25840_read(c, CX23885_PIN_CTRL_IRQ_REG);
  1748. v4l_dbg(2, cx25840_debug, c, "AV Core IRQ status (exit): %s %s %s\n",
  1749. irq_stat & CX23885_PIN_CTRL_IRQ_IR_STAT ? "ir" : " ",
  1750. irq_stat & CX23885_PIN_CTRL_IRQ_AUD_STAT ? "aud" : " ",
  1751. irq_stat & CX23885_PIN_CTRL_IRQ_VID_STAT ? "vid" : " ");
  1752. return ret;
  1753. }
  1754. static int cx25840_irq_handler(struct v4l2_subdev *sd, u32 status,
  1755. bool *handled)
  1756. {
  1757. struct cx25840_state *state = to_state(sd);
  1758. *handled = false;
  1759. /* Only support the CX2388[578] AV Core for now */
  1760. if (is_cx2388x(state))
  1761. return cx23885_irq_handler(sd, status, handled);
  1762. return -ENODEV;
  1763. }
  1764. /* ----------------------------------------------------------------------- */
  1765. #define DIF_PLL_FREQ_WORD (0x300)
  1766. #define DIF_BPF_COEFF01 (0x348)
  1767. #define DIF_BPF_COEFF23 (0x34c)
  1768. #define DIF_BPF_COEFF45 (0x350)
  1769. #define DIF_BPF_COEFF67 (0x354)
  1770. #define DIF_BPF_COEFF89 (0x358)
  1771. #define DIF_BPF_COEFF1011 (0x35c)
  1772. #define DIF_BPF_COEFF1213 (0x360)
  1773. #define DIF_BPF_COEFF1415 (0x364)
  1774. #define DIF_BPF_COEFF1617 (0x368)
  1775. #define DIF_BPF_COEFF1819 (0x36c)
  1776. #define DIF_BPF_COEFF2021 (0x370)
  1777. #define DIF_BPF_COEFF2223 (0x374)
  1778. #define DIF_BPF_COEFF2425 (0x378)
  1779. #define DIF_BPF_COEFF2627 (0x37c)
  1780. #define DIF_BPF_COEFF2829 (0x380)
  1781. #define DIF_BPF_COEFF3031 (0x384)
  1782. #define DIF_BPF_COEFF3233 (0x388)
  1783. #define DIF_BPF_COEFF3435 (0x38c)
  1784. #define DIF_BPF_COEFF36 (0x390)
  1785. static void cx23885_dif_setup(struct i2c_client *client, u32 ifHz)
  1786. {
  1787. u64 pll_freq;
  1788. u32 pll_freq_word;
  1789. v4l_dbg(1, cx25840_debug, client, "%s(%d)\n", __func__, ifHz);
  1790. /* Assuming TV */
  1791. /* Calculate the PLL frequency word based on the adjusted ifHz */
  1792. pll_freq = div_u64((u64)ifHz * 268435456, 50000000);
  1793. pll_freq_word = (u32)pll_freq;
  1794. cx25840_write4(client, DIF_PLL_FREQ_WORD, pll_freq_word);
  1795. /* Round down to the nearest 100KHz */
  1796. ifHz = (ifHz / 100000) * 100000;
  1797. if (ifHz < 3000000)
  1798. ifHz = 3000000;
  1799. if (ifHz > 16000000)
  1800. ifHz = 16000000;
  1801. v4l_dbg(1, cx25840_debug, client, "%s(%d) again\n", __func__, ifHz);
  1802. switch (ifHz) {
  1803. case 3000000:
  1804. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000002);
  1805. cx25840_write4(client, DIF_BPF_COEFF23, 0x00080012);
  1806. cx25840_write4(client, DIF_BPF_COEFF45, 0x001e0024);
  1807. cx25840_write4(client, DIF_BPF_COEFF67, 0x001bfff8);
  1808. cx25840_write4(client, DIF_BPF_COEFF89, 0xffb4ff50);
  1809. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfed8fe68);
  1810. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe24fe34);
  1811. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfebaffc7);
  1812. cx25840_write4(client, DIF_BPF_COEFF1617, 0x014d031f);
  1813. cx25840_write4(client, DIF_BPF_COEFF1819, 0x04f0065d);
  1814. cx25840_write4(client, DIF_BPF_COEFF2021, 0x07010688);
  1815. cx25840_write4(client, DIF_BPF_COEFF2223, 0x04c901d6);
  1816. cx25840_write4(client, DIF_BPF_COEFF2425, 0xfe00f9d3);
  1817. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf600f342);
  1818. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf235f337);
  1819. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf64efb22);
  1820. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0105070f);
  1821. cx25840_write4(client, DIF_BPF_COEFF3435, 0x0c460fce);
  1822. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  1823. break;
  1824. case 3100000:
  1825. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000001);
  1826. cx25840_write4(client, DIF_BPF_COEFF23, 0x00070012);
  1827. cx25840_write4(client, DIF_BPF_COEFF45, 0x00220032);
  1828. cx25840_write4(client, DIF_BPF_COEFF67, 0x00370026);
  1829. cx25840_write4(client, DIF_BPF_COEFF89, 0xfff0ff91);
  1830. cx25840_write4(client, DIF_BPF_COEFF1011, 0xff0efe7c);
  1831. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe01fdcc);
  1832. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfe0afedb);
  1833. cx25840_write4(client, DIF_BPF_COEFF1617, 0x00440224);
  1834. cx25840_write4(client, DIF_BPF_COEFF1819, 0x0434060c);
  1835. cx25840_write4(client, DIF_BPF_COEFF2021, 0x0738074e);
  1836. cx25840_write4(client, DIF_BPF_COEFF2223, 0x06090361);
  1837. cx25840_write4(client, DIF_BPF_COEFF2425, 0xff99fb39);
  1838. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf6fef3b6);
  1839. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf21af2a5);
  1840. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf573fa33);
  1841. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0034067d);
  1842. cx25840_write4(client, DIF_BPF_COEFF3435, 0x0bfb0fb9);
  1843. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  1844. break;
  1845. case 3200000:
  1846. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000000);
  1847. cx25840_write4(client, DIF_BPF_COEFF23, 0x0004000e);
  1848. cx25840_write4(client, DIF_BPF_COEFF45, 0x00200038);
  1849. cx25840_write4(client, DIF_BPF_COEFF67, 0x004c004f);
  1850. cx25840_write4(client, DIF_BPF_COEFF89, 0x002fffdf);
  1851. cx25840_write4(client, DIF_BPF_COEFF1011, 0xff5cfeb6);
  1852. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe0dfd92);
  1853. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd7ffe03);
  1854. cx25840_write4(client, DIF_BPF_COEFF1617, 0xff36010a);
  1855. cx25840_write4(client, DIF_BPF_COEFF1819, 0x03410575);
  1856. cx25840_write4(client, DIF_BPF_COEFF2021, 0x072607d2);
  1857. cx25840_write4(client, DIF_BPF_COEFF2223, 0x071804d5);
  1858. cx25840_write4(client, DIF_BPF_COEFF2425, 0x0134fcb7);
  1859. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf81ff451);
  1860. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf223f22e);
  1861. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf4a7f94b);
  1862. cx25840_write4(client, DIF_BPF_COEFF3233, 0xff6405e8);
  1863. cx25840_write4(client, DIF_BPF_COEFF3435, 0x0bae0fa4);
  1864. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  1865. break;
  1866. case 3300000:
  1867. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000ffff);
  1868. cx25840_write4(client, DIF_BPF_COEFF23, 0x00000008);
  1869. cx25840_write4(client, DIF_BPF_COEFF45, 0x001a0036);
  1870. cx25840_write4(client, DIF_BPF_COEFF67, 0x0056006d);
  1871. cx25840_write4(client, DIF_BPF_COEFF89, 0x00670030);
  1872. cx25840_write4(client, DIF_BPF_COEFF1011, 0xffbdff10);
  1873. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe46fd8d);
  1874. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd25fd4f);
  1875. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfe35ffe0);
  1876. cx25840_write4(client, DIF_BPF_COEFF1819, 0x0224049f);
  1877. cx25840_write4(client, DIF_BPF_COEFF2021, 0x06c9080e);
  1878. cx25840_write4(client, DIF_BPF_COEFF2223, 0x07ef0627);
  1879. cx25840_write4(client, DIF_BPF_COEFF2425, 0x02c9fe45);
  1880. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf961f513);
  1881. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf250f1d2);
  1882. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf3ecf869);
  1883. cx25840_write4(client, DIF_BPF_COEFF3233, 0xfe930552);
  1884. cx25840_write4(client, DIF_BPF_COEFF3435, 0x0b5f0f8f);
  1885. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  1886. break;
  1887. case 3400000:
  1888. cx25840_write4(client, DIF_BPF_COEFF01, 0xfffffffe);
  1889. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffd0001);
  1890. cx25840_write4(client, DIF_BPF_COEFF45, 0x000f002c);
  1891. cx25840_write4(client, DIF_BPF_COEFF67, 0x0054007d);
  1892. cx25840_write4(client, DIF_BPF_COEFF89, 0x0093007c);
  1893. cx25840_write4(client, DIF_BPF_COEFF1011, 0x0024ff82);
  1894. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfea6fdbb);
  1895. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd03fcca);
  1896. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfd51feb9);
  1897. cx25840_write4(client, DIF_BPF_COEFF1819, 0x00eb0392);
  1898. cx25840_write4(client, DIF_BPF_COEFF2021, 0x06270802);
  1899. cx25840_write4(client, DIF_BPF_COEFF2223, 0x08880750);
  1900. cx25840_write4(client, DIF_BPF_COEFF2425, 0x044dffdb);
  1901. cx25840_write4(client, DIF_BPF_COEFF2627, 0xfabdf5f8);
  1902. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf2a0f193);
  1903. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf342f78f);
  1904. cx25840_write4(client, DIF_BPF_COEFF3233, 0xfdc404b9);
  1905. cx25840_write4(client, DIF_BPF_COEFF3435, 0x0b0e0f78);
  1906. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  1907. break;
  1908. case 3500000:
  1909. cx25840_write4(client, DIF_BPF_COEFF01, 0xfffffffd);
  1910. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffafff9);
  1911. cx25840_write4(client, DIF_BPF_COEFF45, 0x0002001b);
  1912. cx25840_write4(client, DIF_BPF_COEFF67, 0x0046007d);
  1913. cx25840_write4(client, DIF_BPF_COEFF89, 0x00ad00ba);
  1914. cx25840_write4(client, DIF_BPF_COEFF1011, 0x00870000);
  1915. cx25840_write4(client, DIF_BPF_COEFF1213, 0xff26fe1a);
  1916. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd1bfc7e);
  1917. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc99fda4);
  1918. cx25840_write4(client, DIF_BPF_COEFF1819, 0xffa5025c);
  1919. cx25840_write4(client, DIF_BPF_COEFF2021, 0x054507ad);
  1920. cx25840_write4(client, DIF_BPF_COEFF2223, 0x08dd0847);
  1921. cx25840_write4(client, DIF_BPF_COEFF2425, 0x05b80172);
  1922. cx25840_write4(client, DIF_BPF_COEFF2627, 0xfc2ef6ff);
  1923. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf313f170);
  1924. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf2abf6bd);
  1925. cx25840_write4(client, DIF_BPF_COEFF3233, 0xfcf6041f);
  1926. cx25840_write4(client, DIF_BPF_COEFF3435, 0x0abc0f61);
  1927. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  1928. break;
  1929. case 3600000:
  1930. cx25840_write4(client, DIF_BPF_COEFF01, 0xfffffffd);
  1931. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff8fff3);
  1932. cx25840_write4(client, DIF_BPF_COEFF45, 0xfff50006);
  1933. cx25840_write4(client, DIF_BPF_COEFF67, 0x002f006c);
  1934. cx25840_write4(client, DIF_BPF_COEFF89, 0x00b200e3);
  1935. cx25840_write4(client, DIF_BPF_COEFF1011, 0x00dc007e);
  1936. cx25840_write4(client, DIF_BPF_COEFF1213, 0xffb9fea0);
  1937. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd6bfc71);
  1938. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc17fcb1);
  1939. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfe65010b);
  1940. cx25840_write4(client, DIF_BPF_COEFF2021, 0x042d0713);
  1941. cx25840_write4(client, DIF_BPF_COEFF2223, 0x08ec0906);
  1942. cx25840_write4(client, DIF_BPF_COEFF2425, 0x07020302);
  1943. cx25840_write4(client, DIF_BPF_COEFF2627, 0xfdaff823);
  1944. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf3a7f16a);
  1945. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf228f5f5);
  1946. cx25840_write4(client, DIF_BPF_COEFF3233, 0xfc2a0384);
  1947. cx25840_write4(client, DIF_BPF_COEFF3435, 0x0a670f4a);
  1948. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  1949. break;
  1950. case 3700000:
  1951. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
  1952. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff7ffef);
  1953. cx25840_write4(client, DIF_BPF_COEFF45, 0xffe9fff1);
  1954. cx25840_write4(client, DIF_BPF_COEFF67, 0x0010004d);
  1955. cx25840_write4(client, DIF_BPF_COEFF89, 0x00a100f2);
  1956. cx25840_write4(client, DIF_BPF_COEFF1011, 0x011a00f0);
  1957. cx25840_write4(client, DIF_BPF_COEFF1213, 0x0053ff44);
  1958. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfdedfca2);
  1959. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfbd3fbef);
  1960. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfd39ffae);
  1961. cx25840_write4(client, DIF_BPF_COEFF2021, 0x02ea0638);
  1962. cx25840_write4(client, DIF_BPF_COEFF2223, 0x08b50987);
  1963. cx25840_write4(client, DIF_BPF_COEFF2425, 0x08230483);
  1964. cx25840_write4(client, DIF_BPF_COEFF2627, 0xff39f960);
  1965. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf45bf180);
  1966. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf1b8f537);
  1967. cx25840_write4(client, DIF_BPF_COEFF3233, 0xfb6102e7);
  1968. cx25840_write4(client, DIF_BPF_COEFF3435, 0x0a110f32);
  1969. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  1970. break;
  1971. case 3800000:
  1972. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffe);
  1973. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff9ffee);
  1974. cx25840_write4(client, DIF_BPF_COEFF45, 0xffe1ffdd);
  1975. cx25840_write4(client, DIF_BPF_COEFF67, 0xfff00024);
  1976. cx25840_write4(client, DIF_BPF_COEFF89, 0x007c00e5);
  1977. cx25840_write4(client, DIF_BPF_COEFF1011, 0x013a014a);
  1978. cx25840_write4(client, DIF_BPF_COEFF1213, 0x00e6fff8);
  1979. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfe98fd0f);
  1980. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfbd3fb67);
  1981. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfc32fe54);
  1982. cx25840_write4(client, DIF_BPF_COEFF2021, 0x01880525);
  1983. cx25840_write4(client, DIF_BPF_COEFF2223, 0x083909c7);
  1984. cx25840_write4(client, DIF_BPF_COEFF2425, 0x091505ee);
  1985. cx25840_write4(client, DIF_BPF_COEFF2627, 0x00c7fab3);
  1986. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf52df1b4);
  1987. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf15df484);
  1988. cx25840_write4(client, DIF_BPF_COEFF3233, 0xfa9b0249);
  1989. cx25840_write4(client, DIF_BPF_COEFF3435, 0x09ba0f19);
  1990. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  1991. break;
  1992. case 3900000:
  1993. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000000);
  1994. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffbfff0);
  1995. cx25840_write4(client, DIF_BPF_COEFF45, 0xffdeffcf);
  1996. cx25840_write4(client, DIF_BPF_COEFF67, 0xffd1fff6);
  1997. cx25840_write4(client, DIF_BPF_COEFF89, 0x004800be);
  1998. cx25840_write4(client, DIF_BPF_COEFF1011, 0x01390184);
  1999. cx25840_write4(client, DIF_BPF_COEFF1213, 0x016300ac);
  2000. cx25840_write4(client, DIF_BPF_COEFF1415, 0xff5efdb1);
  2001. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc17fb23);
  2002. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfb5cfd0d);
  2003. cx25840_write4(client, DIF_BPF_COEFF2021, 0x001703e4);
  2004. cx25840_write4(client, DIF_BPF_COEFF2223, 0x077b09c4);
  2005. cx25840_write4(client, DIF_BPF_COEFF2425, 0x09d2073c);
  2006. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0251fc18);
  2007. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf61cf203);
  2008. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf118f3dc);
  2009. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf9d801aa);
  2010. cx25840_write4(client, DIF_BPF_COEFF3435, 0x09600eff);
  2011. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2012. break;
  2013. case 4000000:
  2014. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000001);
  2015. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffefff4);
  2016. cx25840_write4(client, DIF_BPF_COEFF45, 0xffe1ffc8);
  2017. cx25840_write4(client, DIF_BPF_COEFF67, 0xffbaffca);
  2018. cx25840_write4(client, DIF_BPF_COEFF89, 0x000b0082);
  2019. cx25840_write4(client, DIF_BPF_COEFF1011, 0x01170198);
  2020. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01c10152);
  2021. cx25840_write4(client, DIF_BPF_COEFF1415, 0x0030fe7b);
  2022. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc99fb24);
  2023. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfac3fbe9);
  2024. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfea5027f);
  2025. cx25840_write4(client, DIF_BPF_COEFF2223, 0x0683097f);
  2026. cx25840_write4(client, DIF_BPF_COEFF2425, 0x0a560867);
  2027. cx25840_write4(client, DIF_BPF_COEFF2627, 0x03d2fd89);
  2028. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf723f26f);
  2029. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf0e8f341);
  2030. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf919010a);
  2031. cx25840_write4(client, DIF_BPF_COEFF3435, 0x09060ee5);
  2032. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2033. break;
  2034. case 4100000:
  2035. cx25840_write4(client, DIF_BPF_COEFF01, 0x00010002);
  2036. cx25840_write4(client, DIF_BPF_COEFF23, 0x0002fffb);
  2037. cx25840_write4(client, DIF_BPF_COEFF45, 0xffe8ffca);
  2038. cx25840_write4(client, DIF_BPF_COEFF67, 0xffacffa4);
  2039. cx25840_write4(client, DIF_BPF_COEFF89, 0xffcd0036);
  2040. cx25840_write4(client, DIF_BPF_COEFF1011, 0x00d70184);
  2041. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01f601dc);
  2042. cx25840_write4(client, DIF_BPF_COEFF1415, 0x00ffff60);
  2043. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfd51fb6d);
  2044. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa6efaf5);
  2045. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfd410103);
  2046. cx25840_write4(client, DIF_BPF_COEFF2223, 0x055708f9);
  2047. cx25840_write4(client, DIF_BPF_COEFF2425, 0x0a9e0969);
  2048. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0543ff02);
  2049. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf842f2f5);
  2050. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf0cef2b2);
  2051. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf85e006b);
  2052. cx25840_write4(client, DIF_BPF_COEFF3435, 0x08aa0ecb);
  2053. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2054. break;
  2055. case 4200000:
  2056. cx25840_write4(client, DIF_BPF_COEFF01, 0x00010003);
  2057. cx25840_write4(client, DIF_BPF_COEFF23, 0x00050003);
  2058. cx25840_write4(client, DIF_BPF_COEFF45, 0xfff3ffd3);
  2059. cx25840_write4(client, DIF_BPF_COEFF67, 0xffaaff8b);
  2060. cx25840_write4(client, DIF_BPF_COEFF89, 0xff95ffe5);
  2061. cx25840_write4(client, DIF_BPF_COEFF1011, 0x0080014a);
  2062. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01fe023f);
  2063. cx25840_write4(client, DIF_BPF_COEFF1415, 0x01ba0050);
  2064. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfe35fbf8);
  2065. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa62fa3b);
  2066. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfbf9ff7e);
  2067. cx25840_write4(client, DIF_BPF_COEFF2223, 0x04010836);
  2068. cx25840_write4(client, DIF_BPF_COEFF2425, 0x0aa90a3d);
  2069. cx25840_write4(client, DIF_BPF_COEFF2627, 0x069f007f);
  2070. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf975f395);
  2071. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf0cbf231);
  2072. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf7a9ffcb);
  2073. cx25840_write4(client, DIF_BPF_COEFF3435, 0x084c0eaf);
  2074. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2075. break;
  2076. case 4300000:
  2077. cx25840_write4(client, DIF_BPF_COEFF01, 0x00010003);
  2078. cx25840_write4(client, DIF_BPF_COEFF23, 0x0008000a);
  2079. cx25840_write4(client, DIF_BPF_COEFF45, 0x0000ffe4);
  2080. cx25840_write4(client, DIF_BPF_COEFF67, 0xffb4ff81);
  2081. cx25840_write4(client, DIF_BPF_COEFF89, 0xff6aff96);
  2082. cx25840_write4(client, DIF_BPF_COEFF1011, 0x001c00f0);
  2083. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01d70271);
  2084. cx25840_write4(client, DIF_BPF_COEFF1415, 0x0254013b);
  2085. cx25840_write4(client, DIF_BPF_COEFF1617, 0xff36fcbd);
  2086. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa9ff9c5);
  2087. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfadbfdfe);
  2088. cx25840_write4(client, DIF_BPF_COEFF2223, 0x028c073b);
  2089. cx25840_write4(client, DIF_BPF_COEFF2425, 0x0a750adf);
  2090. cx25840_write4(client, DIF_BPF_COEFF2627, 0x07e101fa);
  2091. cx25840_write4(client, DIF_BPF_COEFF2829, 0xfab8f44e);
  2092. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf0ddf1be);
  2093. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf6f9ff2b);
  2094. cx25840_write4(client, DIF_BPF_COEFF3435, 0x07ed0e94);
  2095. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2096. break;
  2097. case 4400000:
  2098. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
  2099. cx25840_write4(client, DIF_BPF_COEFF23, 0x0009000f);
  2100. cx25840_write4(client, DIF_BPF_COEFF45, 0x000efff8);
  2101. cx25840_write4(client, DIF_BPF_COEFF67, 0xffc9ff87);
  2102. cx25840_write4(client, DIF_BPF_COEFF89, 0xff52ff54);
  2103. cx25840_write4(client, DIF_BPF_COEFF1011, 0xffb5007e);
  2104. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01860270);
  2105. cx25840_write4(client, DIF_BPF_COEFF1415, 0x02c00210);
  2106. cx25840_write4(client, DIF_BPF_COEFF1617, 0x0044fdb2);
  2107. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfb22f997);
  2108. cx25840_write4(client, DIF_BPF_COEFF2021, 0xf9f2fc90);
  2109. cx25840_write4(client, DIF_BPF_COEFF2223, 0x0102060f);
  2110. cx25840_write4(client, DIF_BPF_COEFF2425, 0x0a050b4c);
  2111. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0902036e);
  2112. cx25840_write4(client, DIF_BPF_COEFF2829, 0xfc0af51e);
  2113. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf106f15a);
  2114. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf64efe8b);
  2115. cx25840_write4(client, DIF_BPF_COEFF3435, 0x078d0e77);
  2116. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2117. break;
  2118. case 4500000:
  2119. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000002);
  2120. cx25840_write4(client, DIF_BPF_COEFF23, 0x00080012);
  2121. cx25840_write4(client, DIF_BPF_COEFF45, 0x0019000e);
  2122. cx25840_write4(client, DIF_BPF_COEFF67, 0xffe5ff9e);
  2123. cx25840_write4(client, DIF_BPF_COEFF89, 0xff4fff25);
  2124. cx25840_write4(client, DIF_BPF_COEFF1011, 0xff560000);
  2125. cx25840_write4(client, DIF_BPF_COEFF1213, 0x0112023b);
  2126. cx25840_write4(client, DIF_BPF_COEFF1415, 0x02f702c0);
  2127. cx25840_write4(client, DIF_BPF_COEFF1617, 0x014dfec8);
  2128. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfbe5f9b3);
  2129. cx25840_write4(client, DIF_BPF_COEFF2021, 0xf947fb41);
  2130. cx25840_write4(client, DIF_BPF_COEFF2223, 0xff7004b9);
  2131. cx25840_write4(client, DIF_BPF_COEFF2425, 0x095a0b81);
  2132. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0a0004d8);
  2133. cx25840_write4(client, DIF_BPF_COEFF2829, 0xfd65f603);
  2134. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf144f104);
  2135. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf5aafdec);
  2136. cx25840_write4(client, DIF_BPF_COEFF3435, 0x072b0e5a);
  2137. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2138. break;
  2139. case 4600000:
  2140. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000001);
  2141. cx25840_write4(client, DIF_BPF_COEFF23, 0x00060012);
  2142. cx25840_write4(client, DIF_BPF_COEFF45, 0x00200022);
  2143. cx25840_write4(client, DIF_BPF_COEFF67, 0x0005ffc1);
  2144. cx25840_write4(client, DIF_BPF_COEFF89, 0xff61ff10);
  2145. cx25840_write4(client, DIF_BPF_COEFF1011, 0xff09ff82);
  2146. cx25840_write4(client, DIF_BPF_COEFF1213, 0x008601d7);
  2147. cx25840_write4(client, DIF_BPF_COEFF1415, 0x02f50340);
  2148. cx25840_write4(client, DIF_BPF_COEFF1617, 0x0241fff0);
  2149. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfcddfa19);
  2150. cx25840_write4(client, DIF_BPF_COEFF2021, 0xf8e2fa1e);
  2151. cx25840_write4(client, DIF_BPF_COEFF2223, 0xfde30343);
  2152. cx25840_write4(client, DIF_BPF_COEFF2425, 0x08790b7f);
  2153. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0ad50631);
  2154. cx25840_write4(client, DIF_BPF_COEFF2829, 0xfec7f6fc);
  2155. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf198f0bd);
  2156. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf50dfd4e);
  2157. cx25840_write4(client, DIF_BPF_COEFF3435, 0x06c90e3d);
  2158. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2159. break;
  2160. case 4700000:
  2161. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000ffff);
  2162. cx25840_write4(client, DIF_BPF_COEFF23, 0x0003000f);
  2163. cx25840_write4(client, DIF_BPF_COEFF45, 0x00220030);
  2164. cx25840_write4(client, DIF_BPF_COEFF67, 0x0025ffed);
  2165. cx25840_write4(client, DIF_BPF_COEFF89, 0xff87ff15);
  2166. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfed6ff10);
  2167. cx25840_write4(client, DIF_BPF_COEFF1213, 0xffed014c);
  2168. cx25840_write4(client, DIF_BPF_COEFF1415, 0x02b90386);
  2169. cx25840_write4(client, DIF_BPF_COEFF1617, 0x03110119);
  2170. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfdfefac4);
  2171. cx25840_write4(client, DIF_BPF_COEFF2021, 0xf8c6f92f);
  2172. cx25840_write4(client, DIF_BPF_COEFF2223, 0xfc6701b7);
  2173. cx25840_write4(client, DIF_BPF_COEFF2425, 0x07670b44);
  2174. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0b7e0776);
  2175. cx25840_write4(client, DIF_BPF_COEFF2829, 0x002df807);
  2176. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf200f086);
  2177. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf477fcb1);
  2178. cx25840_write4(client, DIF_BPF_COEFF3435, 0x06650e1e);
  2179. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2180. break;
  2181. case 4800000:
  2182. cx25840_write4(client, DIF_BPF_COEFF01, 0xfffffffe);
  2183. cx25840_write4(client, DIF_BPF_COEFF23, 0xffff0009);
  2184. cx25840_write4(client, DIF_BPF_COEFF45, 0x001e0038);
  2185. cx25840_write4(client, DIF_BPF_COEFF67, 0x003f001b);
  2186. cx25840_write4(client, DIF_BPF_COEFF89, 0xffbcff36);
  2187. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfec2feb6);
  2188. cx25840_write4(client, DIF_BPF_COEFF1213, 0xff5600a5);
  2189. cx25840_write4(client, DIF_BPF_COEFF1415, 0x0248038d);
  2190. cx25840_write4(client, DIF_BPF_COEFF1617, 0x03b00232);
  2191. cx25840_write4(client, DIF_BPF_COEFF1819, 0xff39fbab);
  2192. cx25840_write4(client, DIF_BPF_COEFF2021, 0xf8f4f87f);
  2193. cx25840_write4(client, DIF_BPF_COEFF2223, 0xfb060020);
  2194. cx25840_write4(client, DIF_BPF_COEFF2425, 0x062a0ad2);
  2195. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0bf908a3);
  2196. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0192f922);
  2197. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf27df05e);
  2198. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf3e8fc14);
  2199. cx25840_write4(client, DIF_BPF_COEFF3435, 0x06000e00);
  2200. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2201. break;
  2202. case 4900000:
  2203. cx25840_write4(client, DIF_BPF_COEFF01, 0xfffffffd);
  2204. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffc0002);
  2205. cx25840_write4(client, DIF_BPF_COEFF45, 0x00160037);
  2206. cx25840_write4(client, DIF_BPF_COEFF67, 0x00510046);
  2207. cx25840_write4(client, DIF_BPF_COEFF89, 0xfff9ff6d);
  2208. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfed0fe7c);
  2209. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfecefff0);
  2210. cx25840_write4(client, DIF_BPF_COEFF1415, 0x01aa0356);
  2211. cx25840_write4(client, DIF_BPF_COEFF1617, 0x0413032b);
  2212. cx25840_write4(client, DIF_BPF_COEFF1819, 0x007ffcc5);
  2213. cx25840_write4(client, DIF_BPF_COEFF2021, 0xf96cf812);
  2214. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf9cefe87);
  2215. cx25840_write4(client, DIF_BPF_COEFF2425, 0x04c90a2c);
  2216. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0c4309b4);
  2217. cx25840_write4(client, DIF_BPF_COEFF2829, 0x02f3fa4a);
  2218. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf30ef046);
  2219. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf361fb7a);
  2220. cx25840_write4(client, DIF_BPF_COEFF3435, 0x059b0de0);
  2221. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2222. break;
  2223. case 5000000:
  2224. cx25840_write4(client, DIF_BPF_COEFF01, 0xfffffffd);
  2225. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff9fffa);
  2226. cx25840_write4(client, DIF_BPF_COEFF45, 0x000a002d);
  2227. cx25840_write4(client, DIF_BPF_COEFF67, 0x00570067);
  2228. cx25840_write4(client, DIF_BPF_COEFF89, 0x0037ffb5);
  2229. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfefffe68);
  2230. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe62ff3d);
  2231. cx25840_write4(client, DIF_BPF_COEFF1415, 0x00ec02e3);
  2232. cx25840_write4(client, DIF_BPF_COEFF1617, 0x043503f6);
  2233. cx25840_write4(client, DIF_BPF_COEFF1819, 0x01befe05);
  2234. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfa27f7ee);
  2235. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf8c6fcf8);
  2236. cx25840_write4(client, DIF_BPF_COEFF2425, 0x034c0954);
  2237. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0c5c0aa4);
  2238. cx25840_write4(client, DIF_BPF_COEFF2829, 0x044cfb7e);
  2239. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf3b1f03f);
  2240. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf2e2fae1);
  2241. cx25840_write4(client, DIF_BPF_COEFF3435, 0x05340dc0);
  2242. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2243. break;
  2244. case 5100000:
  2245. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
  2246. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff8fff4);
  2247. cx25840_write4(client, DIF_BPF_COEFF45, 0xfffd001e);
  2248. cx25840_write4(client, DIF_BPF_COEFF67, 0x0051007b);
  2249. cx25840_write4(client, DIF_BPF_COEFF89, 0x006e0006);
  2250. cx25840_write4(client, DIF_BPF_COEFF1011, 0xff48fe7c);
  2251. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe1bfe9a);
  2252. cx25840_write4(client, DIF_BPF_COEFF1415, 0x001d023e);
  2253. cx25840_write4(client, DIF_BPF_COEFF1617, 0x04130488);
  2254. cx25840_write4(client, DIF_BPF_COEFF1819, 0x02e6ff5b);
  2255. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfb1ef812);
  2256. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf7f7fb7f);
  2257. cx25840_write4(client, DIF_BPF_COEFF2425, 0x01bc084e);
  2258. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0c430b72);
  2259. cx25840_write4(client, DIF_BPF_COEFF2829, 0x059afcba);
  2260. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf467f046);
  2261. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf26cfa4a);
  2262. cx25840_write4(client, DIF_BPF_COEFF3435, 0x04cd0da0);
  2263. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2264. break;
  2265. case 5200000:
  2266. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffe);
  2267. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff8ffef);
  2268. cx25840_write4(client, DIF_BPF_COEFF45, 0xfff00009);
  2269. cx25840_write4(client, DIF_BPF_COEFF67, 0x003f007f);
  2270. cx25840_write4(client, DIF_BPF_COEFF89, 0x00980056);
  2271. cx25840_write4(client, DIF_BPF_COEFF1011, 0xffa5feb6);
  2272. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe00fe15);
  2273. cx25840_write4(client, DIF_BPF_COEFF1415, 0xff4b0170);
  2274. cx25840_write4(client, DIF_BPF_COEFF1617, 0x03b004d7);
  2275. cx25840_write4(client, DIF_BPF_COEFF1819, 0x03e800b9);
  2276. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfc48f87f);
  2277. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf768fa23);
  2278. cx25840_write4(client, DIF_BPF_COEFF2425, 0x0022071f);
  2279. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0bf90c1b);
  2280. cx25840_write4(client, DIF_BPF_COEFF2829, 0x06dafdfd);
  2281. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf52df05e);
  2282. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf1fef9b5);
  2283. cx25840_write4(client, DIF_BPF_COEFF3435, 0x04640d7f);
  2284. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2285. break;
  2286. case 5300000:
  2287. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000ffff);
  2288. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff9ffee);
  2289. cx25840_write4(client, DIF_BPF_COEFF45, 0xffe6fff3);
  2290. cx25840_write4(client, DIF_BPF_COEFF67, 0x00250072);
  2291. cx25840_write4(client, DIF_BPF_COEFF89, 0x00af009c);
  2292. cx25840_write4(client, DIF_BPF_COEFF1011, 0x000cff10);
  2293. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe13fdb8);
  2294. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfe870089);
  2295. cx25840_write4(client, DIF_BPF_COEFF1617, 0x031104e1);
  2296. cx25840_write4(client, DIF_BPF_COEFF1819, 0x04b8020f);
  2297. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfd98f92f);
  2298. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf71df8f0);
  2299. cx25840_write4(client, DIF_BPF_COEFF2425, 0xfe8805ce);
  2300. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0b7e0c9c);
  2301. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0808ff44);
  2302. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf603f086);
  2303. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf19af922);
  2304. cx25840_write4(client, DIF_BPF_COEFF3435, 0x03fb0d5e);
  2305. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2306. break;
  2307. case 5400000:
  2308. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000001);
  2309. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffcffef);
  2310. cx25840_write4(client, DIF_BPF_COEFF45, 0xffe0ffe0);
  2311. cx25840_write4(client, DIF_BPF_COEFF67, 0x00050056);
  2312. cx25840_write4(client, DIF_BPF_COEFF89, 0x00b000d1);
  2313. cx25840_write4(client, DIF_BPF_COEFF1011, 0x0071ff82);
  2314. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe53fd8c);
  2315. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfddfff99);
  2316. cx25840_write4(client, DIF_BPF_COEFF1617, 0x024104a3);
  2317. cx25840_write4(client, DIF_BPF_COEFF1819, 0x054a034d);
  2318. cx25840_write4(client, DIF_BPF_COEFF2021, 0xff01fa1e);
  2319. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf717f7ed);
  2320. cx25840_write4(client, DIF_BPF_COEFF2425, 0xfcf50461);
  2321. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0ad50cf4);
  2322. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0921008d);
  2323. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf6e7f0bd);
  2324. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf13ff891);
  2325. cx25840_write4(client, DIF_BPF_COEFF3435, 0x03920d3b);
  2326. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2327. break;
  2328. case 5500000:
  2329. cx25840_write4(client, DIF_BPF_COEFF01, 0x00010002);
  2330. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffffff3);
  2331. cx25840_write4(client, DIF_BPF_COEFF45, 0xffdeffd1);
  2332. cx25840_write4(client, DIF_BPF_COEFF67, 0xffe5002f);
  2333. cx25840_write4(client, DIF_BPF_COEFF89, 0x009c00ed);
  2334. cx25840_write4(client, DIF_BPF_COEFF1011, 0x00cb0000);
  2335. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfebafd94);
  2336. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd61feb0);
  2337. cx25840_write4(client, DIF_BPF_COEFF1617, 0x014d0422);
  2338. cx25840_write4(client, DIF_BPF_COEFF1819, 0x05970464);
  2339. cx25840_write4(client, DIF_BPF_COEFF2021, 0x0074fb41);
  2340. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf759f721);
  2341. cx25840_write4(client, DIF_BPF_COEFF2425, 0xfb7502de);
  2342. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0a000d21);
  2343. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0a2201d4);
  2344. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf7d9f104);
  2345. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf0edf804);
  2346. cx25840_write4(client, DIF_BPF_COEFF3435, 0x03280d19);
  2347. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2348. break;
  2349. case 5600000:
  2350. cx25840_write4(client, DIF_BPF_COEFF01, 0x00010003);
  2351. cx25840_write4(client, DIF_BPF_COEFF23, 0x0003fffa);
  2352. cx25840_write4(client, DIF_BPF_COEFF45, 0xffe3ffc9);
  2353. cx25840_write4(client, DIF_BPF_COEFF67, 0xffc90002);
  2354. cx25840_write4(client, DIF_BPF_COEFF89, 0x007500ef);
  2355. cx25840_write4(client, DIF_BPF_COEFF1011, 0x010e007e);
  2356. cx25840_write4(client, DIF_BPF_COEFF1213, 0xff3dfdcf);
  2357. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd16fddd);
  2358. cx25840_write4(client, DIF_BPF_COEFF1617, 0x00440365);
  2359. cx25840_write4(client, DIF_BPF_COEFF1819, 0x059b0548);
  2360. cx25840_write4(client, DIF_BPF_COEFF2021, 0x01e3fc90);
  2361. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf7dff691);
  2362. cx25840_write4(client, DIF_BPF_COEFF2425, 0xfa0f014d);
  2363. cx25840_write4(client, DIF_BPF_COEFF2627, 0x09020d23);
  2364. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0b0a0318);
  2365. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf8d7f15a);
  2366. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf0a5f779);
  2367. cx25840_write4(client, DIF_BPF_COEFF3435, 0x02bd0cf6);
  2368. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2369. break;
  2370. case 5700000:
  2371. cx25840_write4(client, DIF_BPF_COEFF01, 0x00010003);
  2372. cx25840_write4(client, DIF_BPF_COEFF23, 0x00060001);
  2373. cx25840_write4(client, DIF_BPF_COEFF45, 0xffecffc9);
  2374. cx25840_write4(client, DIF_BPF_COEFF67, 0xffb4ffd4);
  2375. cx25840_write4(client, DIF_BPF_COEFF89, 0x004000d5);
  2376. cx25840_write4(client, DIF_BPF_COEFF1011, 0x013600f0);
  2377. cx25840_write4(client, DIF_BPF_COEFF1213, 0xffd3fe39);
  2378. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd04fd31);
  2379. cx25840_write4(client, DIF_BPF_COEFF1617, 0xff360277);
  2380. cx25840_write4(client, DIF_BPF_COEFF1819, 0x055605ef);
  2381. cx25840_write4(client, DIF_BPF_COEFF2021, 0x033efdfe);
  2382. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf8a5f642);
  2383. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf8cbffb6);
  2384. cx25840_write4(client, DIF_BPF_COEFF2627, 0x07e10cfb);
  2385. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0bd50456);
  2386. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf9dff1be);
  2387. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf067f6f2);
  2388. cx25840_write4(client, DIF_BPF_COEFF3435, 0x02520cd2);
  2389. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2390. break;
  2391. case 5800000:
  2392. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
  2393. cx25840_write4(client, DIF_BPF_COEFF23, 0x00080009);
  2394. cx25840_write4(client, DIF_BPF_COEFF45, 0xfff8ffd2);
  2395. cx25840_write4(client, DIF_BPF_COEFF67, 0xffaaffac);
  2396. cx25840_write4(client, DIF_BPF_COEFF89, 0x000200a3);
  2397. cx25840_write4(client, DIF_BPF_COEFF1011, 0x013c014a);
  2398. cx25840_write4(client, DIF_BPF_COEFF1213, 0x006dfec9);
  2399. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd2bfcb7);
  2400. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfe350165);
  2401. cx25840_write4(client, DIF_BPF_COEFF1819, 0x04cb0651);
  2402. cx25840_write4(client, DIF_BPF_COEFF2021, 0x0477ff7e);
  2403. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf9a5f635);
  2404. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf7b1fe20);
  2405. cx25840_write4(client, DIF_BPF_COEFF2627, 0x069f0ca8);
  2406. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0c81058b);
  2407. cx25840_write4(client, DIF_BPF_COEFF3031, 0xfaf0f231);
  2408. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf033f66d);
  2409. cx25840_write4(client, DIF_BPF_COEFF3435, 0x01e60cae);
  2410. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2411. break;
  2412. case 5900000:
  2413. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000002);
  2414. cx25840_write4(client, DIF_BPF_COEFF23, 0x0009000e);
  2415. cx25840_write4(client, DIF_BPF_COEFF45, 0x0005ffe1);
  2416. cx25840_write4(client, DIF_BPF_COEFF67, 0xffacff90);
  2417. cx25840_write4(client, DIF_BPF_COEFF89, 0xffc5005f);
  2418. cx25840_write4(client, DIF_BPF_COEFF1011, 0x01210184);
  2419. cx25840_write4(client, DIF_BPF_COEFF1213, 0x00fcff72);
  2420. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd8afc77);
  2421. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfd51003f);
  2422. cx25840_write4(client, DIF_BPF_COEFF1819, 0x04020669);
  2423. cx25840_write4(client, DIF_BPF_COEFF2021, 0x05830103);
  2424. cx25840_write4(client, DIF_BPF_COEFF2223, 0xfad7f66b);
  2425. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf6c8fc93);
  2426. cx25840_write4(client, DIF_BPF_COEFF2627, 0x05430c2b);
  2427. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0d0d06b5);
  2428. cx25840_write4(client, DIF_BPF_COEFF3031, 0xfc08f2b2);
  2429. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf00af5ec);
  2430. cx25840_write4(client, DIF_BPF_COEFF3435, 0x017b0c89);
  2431. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2432. break;
  2433. case 6000000:
  2434. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000001);
  2435. cx25840_write4(client, DIF_BPF_COEFF23, 0x00070012);
  2436. cx25840_write4(client, DIF_BPF_COEFF45, 0x0012fff5);
  2437. cx25840_write4(client, DIF_BPF_COEFF67, 0xffbaff82);
  2438. cx25840_write4(client, DIF_BPF_COEFF89, 0xff8e000f);
  2439. cx25840_write4(client, DIF_BPF_COEFF1011, 0x00e80198);
  2440. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01750028);
  2441. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfe18fc75);
  2442. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc99ff15);
  2443. cx25840_write4(client, DIF_BPF_COEFF1819, 0x03050636);
  2444. cx25840_write4(client, DIF_BPF_COEFF2021, 0x0656027f);
  2445. cx25840_write4(client, DIF_BPF_COEFF2223, 0xfc32f6e2);
  2446. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf614fb17);
  2447. cx25840_write4(client, DIF_BPF_COEFF2627, 0x03d20b87);
  2448. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0d7707d2);
  2449. cx25840_write4(client, DIF_BPF_COEFF3031, 0xfd26f341);
  2450. cx25840_write4(client, DIF_BPF_COEFF3233, 0xefeaf56f);
  2451. cx25840_write4(client, DIF_BPF_COEFF3435, 0x010f0c64);
  2452. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2453. break;
  2454. case 6100000:
  2455. cx25840_write4(client, DIF_BPF_COEFF01, 0xffff0000);
  2456. cx25840_write4(client, DIF_BPF_COEFF23, 0x00050012);
  2457. cx25840_write4(client, DIF_BPF_COEFF45, 0x001c000b);
  2458. cx25840_write4(client, DIF_BPF_COEFF67, 0xffd1ff84);
  2459. cx25840_write4(client, DIF_BPF_COEFF89, 0xff66ffbe);
  2460. cx25840_write4(client, DIF_BPF_COEFF1011, 0x00960184);
  2461. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01cd00da);
  2462. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfeccfcb2);
  2463. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc17fdf9);
  2464. cx25840_write4(client, DIF_BPF_COEFF1819, 0x01e005bc);
  2465. cx25840_write4(client, DIF_BPF_COEFF2021, 0x06e703e4);
  2466. cx25840_write4(client, DIF_BPF_COEFF2223, 0xfdabf798);
  2467. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf599f9b3);
  2468. cx25840_write4(client, DIF_BPF_COEFF2627, 0x02510abd);
  2469. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0dbf08df);
  2470. cx25840_write4(client, DIF_BPF_COEFF3031, 0xfe48f3dc);
  2471. cx25840_write4(client, DIF_BPF_COEFF3233, 0xefd5f4f6);
  2472. cx25840_write4(client, DIF_BPF_COEFF3435, 0x00a20c3e);
  2473. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2474. break;
  2475. case 6200000:
  2476. cx25840_write4(client, DIF_BPF_COEFF01, 0xfffffffe);
  2477. cx25840_write4(client, DIF_BPF_COEFF23, 0x0002000f);
  2478. cx25840_write4(client, DIF_BPF_COEFF45, 0x0021001f);
  2479. cx25840_write4(client, DIF_BPF_COEFF67, 0xfff0ff97);
  2480. cx25840_write4(client, DIF_BPF_COEFF89, 0xff50ff74);
  2481. cx25840_write4(client, DIF_BPF_COEFF1011, 0x0034014a);
  2482. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01fa0179);
  2483. cx25840_write4(client, DIF_BPF_COEFF1415, 0xff97fd2a);
  2484. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfbd3fcfa);
  2485. cx25840_write4(client, DIF_BPF_COEFF1819, 0x00a304fe);
  2486. cx25840_write4(client, DIF_BPF_COEFF2021, 0x07310525);
  2487. cx25840_write4(client, DIF_BPF_COEFF2223, 0xff37f886);
  2488. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf55cf86e);
  2489. cx25840_write4(client, DIF_BPF_COEFF2627, 0x00c709d0);
  2490. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0de209db);
  2491. cx25840_write4(client, DIF_BPF_COEFF3031, 0xff6df484);
  2492. cx25840_write4(client, DIF_BPF_COEFF3233, 0xefcbf481);
  2493. cx25840_write4(client, DIF_BPF_COEFF3435, 0x00360c18);
  2494. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2495. break;
  2496. case 6300000:
  2497. cx25840_write4(client, DIF_BPF_COEFF01, 0xfffffffd);
  2498. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffe000a);
  2499. cx25840_write4(client, DIF_BPF_COEFF45, 0x0021002f);
  2500. cx25840_write4(client, DIF_BPF_COEFF67, 0x0010ffb8);
  2501. cx25840_write4(client, DIF_BPF_COEFF89, 0xff50ff3b);
  2502. cx25840_write4(client, DIF_BPF_COEFF1011, 0xffcc00f0);
  2503. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01fa01fa);
  2504. cx25840_write4(client, DIF_BPF_COEFF1415, 0x0069fdd4);
  2505. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfbd3fc26);
  2506. cx25840_write4(client, DIF_BPF_COEFF1819, 0xff5d0407);
  2507. cx25840_write4(client, DIF_BPF_COEFF2021, 0x07310638);
  2508. cx25840_write4(client, DIF_BPF_COEFF2223, 0x00c9f9a8);
  2509. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf55cf74e);
  2510. cx25840_write4(client, DIF_BPF_COEFF2627, 0xff3908c3);
  2511. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0de20ac3);
  2512. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0093f537);
  2513. cx25840_write4(client, DIF_BPF_COEFF3233, 0xefcbf410);
  2514. cx25840_write4(client, DIF_BPF_COEFF3435, 0xffca0bf2);
  2515. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2516. break;
  2517. case 6400000:
  2518. cx25840_write4(client, DIF_BPF_COEFF01, 0xfffffffd);
  2519. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffb0003);
  2520. cx25840_write4(client, DIF_BPF_COEFF45, 0x001c0037);
  2521. cx25840_write4(client, DIF_BPF_COEFF67, 0x002fffe2);
  2522. cx25840_write4(client, DIF_BPF_COEFF89, 0xff66ff17);
  2523. cx25840_write4(client, DIF_BPF_COEFF1011, 0xff6a007e);
  2524. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01cd0251);
  2525. cx25840_write4(client, DIF_BPF_COEFF1415, 0x0134fea5);
  2526. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc17fb8b);
  2527. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfe2002e0);
  2528. cx25840_write4(client, DIF_BPF_COEFF2021, 0x06e70713);
  2529. cx25840_write4(client, DIF_BPF_COEFF2223, 0x0255faf5);
  2530. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf599f658);
  2531. cx25840_write4(client, DIF_BPF_COEFF2627, 0xfdaf0799);
  2532. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0dbf0b96);
  2533. cx25840_write4(client, DIF_BPF_COEFF3031, 0x01b8f5f5);
  2534. cx25840_write4(client, DIF_BPF_COEFF3233, 0xefd5f3a3);
  2535. cx25840_write4(client, DIF_BPF_COEFF3435, 0xff5e0bca);
  2536. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2537. break;
  2538. case 6500000:
  2539. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
  2540. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff9fffb);
  2541. cx25840_write4(client, DIF_BPF_COEFF45, 0x00120037);
  2542. cx25840_write4(client, DIF_BPF_COEFF67, 0x00460010);
  2543. cx25840_write4(client, DIF_BPF_COEFF89, 0xff8eff0f);
  2544. cx25840_write4(client, DIF_BPF_COEFF1011, 0xff180000);
  2545. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01750276);
  2546. cx25840_write4(client, DIF_BPF_COEFF1415, 0x01e8ff8d);
  2547. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc99fb31);
  2548. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfcfb0198);
  2549. cx25840_write4(client, DIF_BPF_COEFF2021, 0x065607ad);
  2550. cx25840_write4(client, DIF_BPF_COEFF2223, 0x03cefc64);
  2551. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf614f592);
  2552. cx25840_write4(client, DIF_BPF_COEFF2627, 0xfc2e0656);
  2553. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0d770c52);
  2554. cx25840_write4(client, DIF_BPF_COEFF3031, 0x02daf6bd);
  2555. cx25840_write4(client, DIF_BPF_COEFF3233, 0xefeaf33b);
  2556. cx25840_write4(client, DIF_BPF_COEFF3435, 0xfef10ba3);
  2557. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2558. break;
  2559. case 6600000:
  2560. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffe);
  2561. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff7fff5);
  2562. cx25840_write4(client, DIF_BPF_COEFF45, 0x0005002f);
  2563. cx25840_write4(client, DIF_BPF_COEFF67, 0x0054003c);
  2564. cx25840_write4(client, DIF_BPF_COEFF89, 0xffc5ff22);
  2565. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfedfff82);
  2566. cx25840_write4(client, DIF_BPF_COEFF1213, 0x00fc0267);
  2567. cx25840_write4(client, DIF_BPF_COEFF1415, 0x0276007e);
  2568. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfd51fb1c);
  2569. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfbfe003e);
  2570. cx25840_write4(client, DIF_BPF_COEFF2021, 0x05830802);
  2571. cx25840_write4(client, DIF_BPF_COEFF2223, 0x0529fdec);
  2572. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf6c8f4fe);
  2573. cx25840_write4(client, DIF_BPF_COEFF2627, 0xfabd04ff);
  2574. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0d0d0cf6);
  2575. cx25840_write4(client, DIF_BPF_COEFF3031, 0x03f8f78f);
  2576. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf00af2d7);
  2577. cx25840_write4(client, DIF_BPF_COEFF3435, 0xfe850b7b);
  2578. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2579. break;
  2580. case 6700000:
  2581. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000ffff);
  2582. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff8fff0);
  2583. cx25840_write4(client, DIF_BPF_COEFF45, 0xfff80020);
  2584. cx25840_write4(client, DIF_BPF_COEFF67, 0x00560060);
  2585. cx25840_write4(client, DIF_BPF_COEFF89, 0x0002ff4e);
  2586. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfec4ff10);
  2587. cx25840_write4(client, DIF_BPF_COEFF1213, 0x006d0225);
  2588. cx25840_write4(client, DIF_BPF_COEFF1415, 0x02d50166);
  2589. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfe35fb4e);
  2590. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfb35fee1);
  2591. cx25840_write4(client, DIF_BPF_COEFF2021, 0x0477080e);
  2592. cx25840_write4(client, DIF_BPF_COEFF2223, 0x065bff82);
  2593. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf7b1f4a0);
  2594. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf9610397);
  2595. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0c810d80);
  2596. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0510f869);
  2597. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf033f278);
  2598. cx25840_write4(client, DIF_BPF_COEFF3435, 0xfe1a0b52);
  2599. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2600. break;
  2601. case 6800000:
  2602. cx25840_write4(client, DIF_BPF_COEFF01, 0x00010000);
  2603. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffaffee);
  2604. cx25840_write4(client, DIF_BPF_COEFF45, 0xffec000c);
  2605. cx25840_write4(client, DIF_BPF_COEFF67, 0x004c0078);
  2606. cx25840_write4(client, DIF_BPF_COEFF89, 0x0040ff8e);
  2607. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfecafeb6);
  2608. cx25840_write4(client, DIF_BPF_COEFF1213, 0xffd301b6);
  2609. cx25840_write4(client, DIF_BPF_COEFF1415, 0x02fc0235);
  2610. cx25840_write4(client, DIF_BPF_COEFF1617, 0xff36fbc5);
  2611. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfaaafd90);
  2612. cx25840_write4(client, DIF_BPF_COEFF2021, 0x033e07d2);
  2613. cx25840_write4(client, DIF_BPF_COEFF2223, 0x075b011b);
  2614. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf8cbf47a);
  2615. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf81f0224);
  2616. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0bd50def);
  2617. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0621f94b);
  2618. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf067f21e);
  2619. cx25840_write4(client, DIF_BPF_COEFF3435, 0xfdae0b29);
  2620. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2621. break;
  2622. case 6900000:
  2623. cx25840_write4(client, DIF_BPF_COEFF01, 0x00010001);
  2624. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffdffef);
  2625. cx25840_write4(client, DIF_BPF_COEFF45, 0xffe3fff6);
  2626. cx25840_write4(client, DIF_BPF_COEFF67, 0x0037007f);
  2627. cx25840_write4(client, DIF_BPF_COEFF89, 0x0075ffdc);
  2628. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfef2fe7c);
  2629. cx25840_write4(client, DIF_BPF_COEFF1213, 0xff3d0122);
  2630. cx25840_write4(client, DIF_BPF_COEFF1415, 0x02ea02dd);
  2631. cx25840_write4(client, DIF_BPF_COEFF1617, 0x0044fc79);
  2632. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa65fc5d);
  2633. cx25840_write4(client, DIF_BPF_COEFF2021, 0x01e3074e);
  2634. cx25840_write4(client, DIF_BPF_COEFF2223, 0x082102ad);
  2635. cx25840_write4(client, DIF_BPF_COEFF2425, 0xfa0ff48c);
  2636. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf6fe00a9);
  2637. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0b0a0e43);
  2638. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0729fa33);
  2639. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf0a5f1c9);
  2640. cx25840_write4(client, DIF_BPF_COEFF3435, 0xfd430b00);
  2641. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2642. break;
  2643. case 7000000:
  2644. cx25840_write4(client, DIF_BPF_COEFF01, 0x00010002);
  2645. cx25840_write4(client, DIF_BPF_COEFF23, 0x0001fff3);
  2646. cx25840_write4(client, DIF_BPF_COEFF45, 0xffdeffe2);
  2647. cx25840_write4(client, DIF_BPF_COEFF67, 0x001b0076);
  2648. cx25840_write4(client, DIF_BPF_COEFF89, 0x009c002d);
  2649. cx25840_write4(client, DIF_BPF_COEFF1011, 0xff35fe68);
  2650. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfeba0076);
  2651. cx25840_write4(client, DIF_BPF_COEFF1415, 0x029f0352);
  2652. cx25840_write4(client, DIF_BPF_COEFF1617, 0x014dfd60);
  2653. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa69fb53);
  2654. cx25840_write4(client, DIF_BPF_COEFF2021, 0x00740688);
  2655. cx25840_write4(client, DIF_BPF_COEFF2223, 0x08a7042d);
  2656. cx25840_write4(client, DIF_BPF_COEFF2425, 0xfb75f4d6);
  2657. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf600ff2d);
  2658. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0a220e7a);
  2659. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0827fb22);
  2660. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf0edf17a);
  2661. cx25840_write4(client, DIF_BPF_COEFF3435, 0xfcd80ad6);
  2662. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2663. break;
  2664. case 7100000:
  2665. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
  2666. cx25840_write4(client, DIF_BPF_COEFF23, 0x0004fff9);
  2667. cx25840_write4(client, DIF_BPF_COEFF45, 0xffe0ffd2);
  2668. cx25840_write4(client, DIF_BPF_COEFF67, 0xfffb005e);
  2669. cx25840_write4(client, DIF_BPF_COEFF89, 0x00b0007a);
  2670. cx25840_write4(client, DIF_BPF_COEFF1011, 0xff8ffe7c);
  2671. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe53ffc1);
  2672. cx25840_write4(client, DIF_BPF_COEFF1415, 0x0221038c);
  2673. cx25840_write4(client, DIF_BPF_COEFF1617, 0x0241fe6e);
  2674. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfab6fa80);
  2675. cx25840_write4(client, DIF_BPF_COEFF2021, 0xff010587);
  2676. cx25840_write4(client, DIF_BPF_COEFF2223, 0x08e90590);
  2677. cx25840_write4(client, DIF_BPF_COEFF2425, 0xfcf5f556);
  2678. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf52bfdb3);
  2679. cx25840_write4(client, DIF_BPF_COEFF2829, 0x09210e95);
  2680. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0919fc15);
  2681. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf13ff12f);
  2682. cx25840_write4(client, DIF_BPF_COEFF3435, 0xfc6e0aab);
  2683. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2684. break;
  2685. case 7200000:
  2686. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
  2687. cx25840_write4(client, DIF_BPF_COEFF23, 0x00070000);
  2688. cx25840_write4(client, DIF_BPF_COEFF45, 0xffe6ffc9);
  2689. cx25840_write4(client, DIF_BPF_COEFF67, 0xffdb0039);
  2690. cx25840_write4(client, DIF_BPF_COEFF89, 0x00af00b8);
  2691. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfff4feb6);
  2692. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe13ff10);
  2693. cx25840_write4(client, DIF_BPF_COEFF1415, 0x01790388);
  2694. cx25840_write4(client, DIF_BPF_COEFF1617, 0x0311ff92);
  2695. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfb48f9ed);
  2696. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfd980453);
  2697. cx25840_write4(client, DIF_BPF_COEFF2223, 0x08e306cd);
  2698. cx25840_write4(client, DIF_BPF_COEFF2425, 0xfe88f60a);
  2699. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf482fc40);
  2700. cx25840_write4(client, DIF_BPF_COEFF2829, 0x08080e93);
  2701. cx25840_write4(client, DIF_BPF_COEFF3031, 0x09fdfd0c);
  2702. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf19af0ea);
  2703. cx25840_write4(client, DIF_BPF_COEFF3435, 0xfc050a81);
  2704. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2705. break;
  2706. case 7300000:
  2707. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000002);
  2708. cx25840_write4(client, DIF_BPF_COEFF23, 0x00080008);
  2709. cx25840_write4(client, DIF_BPF_COEFF45, 0xfff0ffc9);
  2710. cx25840_write4(client, DIF_BPF_COEFF67, 0xffc1000d);
  2711. cx25840_write4(client, DIF_BPF_COEFF89, 0x009800e2);
  2712. cx25840_write4(client, DIF_BPF_COEFF1011, 0x005bff10);
  2713. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe00fe74);
  2714. cx25840_write4(client, DIF_BPF_COEFF1415, 0x00b50345);
  2715. cx25840_write4(client, DIF_BPF_COEFF1617, 0x03b000bc);
  2716. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfc18f9a1);
  2717. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfc4802f9);
  2718. cx25840_write4(client, DIF_BPF_COEFF2223, 0x089807dc);
  2719. cx25840_write4(client, DIF_BPF_COEFF2425, 0x0022f6f0);
  2720. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf407fada);
  2721. cx25840_write4(client, DIF_BPF_COEFF2829, 0x06da0e74);
  2722. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0ad3fe06);
  2723. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf1fef0ab);
  2724. cx25840_write4(client, DIF_BPF_COEFF3435, 0xfb9c0a55);
  2725. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2726. break;
  2727. case 7400000:
  2728. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000001);
  2729. cx25840_write4(client, DIF_BPF_COEFF23, 0x0008000e);
  2730. cx25840_write4(client, DIF_BPF_COEFF45, 0xfffdffd0);
  2731. cx25840_write4(client, DIF_BPF_COEFF67, 0xffafffdf);
  2732. cx25840_write4(client, DIF_BPF_COEFF89, 0x006e00f2);
  2733. cx25840_write4(client, DIF_BPF_COEFF1011, 0x00b8ff82);
  2734. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe1bfdf8);
  2735. cx25840_write4(client, DIF_BPF_COEFF1415, 0xffe302c8);
  2736. cx25840_write4(client, DIF_BPF_COEFF1617, 0x041301dc);
  2737. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfd1af99e);
  2738. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfb1e0183);
  2739. cx25840_write4(client, DIF_BPF_COEFF2223, 0x080908b5);
  2740. cx25840_write4(client, DIF_BPF_COEFF2425, 0x01bcf801);
  2741. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf3bdf985);
  2742. cx25840_write4(client, DIF_BPF_COEFF2829, 0x059a0e38);
  2743. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0b99ff03);
  2744. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf26cf071);
  2745. cx25840_write4(client, DIF_BPF_COEFF3435, 0xfb330a2a);
  2746. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2747. break;
  2748. case 7500000:
  2749. cx25840_write4(client, DIF_BPF_COEFF01, 0xffff0000);
  2750. cx25840_write4(client, DIF_BPF_COEFF23, 0x00070011);
  2751. cx25840_write4(client, DIF_BPF_COEFF45, 0x000affdf);
  2752. cx25840_write4(client, DIF_BPF_COEFF67, 0xffa9ffb5);
  2753. cx25840_write4(client, DIF_BPF_COEFF89, 0x003700e6);
  2754. cx25840_write4(client, DIF_BPF_COEFF1011, 0x01010000);
  2755. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe62fda8);
  2756. cx25840_write4(client, DIF_BPF_COEFF1415, 0xff140219);
  2757. cx25840_write4(client, DIF_BPF_COEFF1617, 0x043502e1);
  2758. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfe42f9e6);
  2759. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfa270000);
  2760. cx25840_write4(client, DIF_BPF_COEFF2223, 0x073a0953);
  2761. cx25840_write4(client, DIF_BPF_COEFF2425, 0x034cf939);
  2762. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf3a4f845);
  2763. cx25840_write4(client, DIF_BPF_COEFF2829, 0x044c0de1);
  2764. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0c4f0000);
  2765. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf2e2f03c);
  2766. cx25840_write4(client, DIF_BPF_COEFF3435, 0xfacc09fe);
  2767. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2768. break;
  2769. case 7600000:
  2770. cx25840_write4(client, DIF_BPF_COEFF01, 0xffffffff);
  2771. cx25840_write4(client, DIF_BPF_COEFF23, 0x00040012);
  2772. cx25840_write4(client, DIF_BPF_COEFF45, 0x0016fff3);
  2773. cx25840_write4(client, DIF_BPF_COEFF67, 0xffafff95);
  2774. cx25840_write4(client, DIF_BPF_COEFF89, 0xfff900c0);
  2775. cx25840_write4(client, DIF_BPF_COEFF1011, 0x0130007e);
  2776. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfecefd89);
  2777. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfe560146);
  2778. cx25840_write4(client, DIF_BPF_COEFF1617, 0x041303bc);
  2779. cx25840_write4(client, DIF_BPF_COEFF1819, 0xff81fa76);
  2780. cx25840_write4(client, DIF_BPF_COEFF2021, 0xf96cfe7d);
  2781. cx25840_write4(client, DIF_BPF_COEFF2223, 0x063209b1);
  2782. cx25840_write4(client, DIF_BPF_COEFF2425, 0x04c9fa93);
  2783. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf3bdf71e);
  2784. cx25840_write4(client, DIF_BPF_COEFF2829, 0x02f30d6e);
  2785. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0cf200fd);
  2786. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf361f00e);
  2787. cx25840_write4(client, DIF_BPF_COEFF3435, 0xfa6509d1);
  2788. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2789. break;
  2790. case 7700000:
  2791. cx25840_write4(client, DIF_BPF_COEFF01, 0xfffffffe);
  2792. cx25840_write4(client, DIF_BPF_COEFF23, 0x00010010);
  2793. cx25840_write4(client, DIF_BPF_COEFF45, 0x001e0008);
  2794. cx25840_write4(client, DIF_BPF_COEFF67, 0xffc1ff84);
  2795. cx25840_write4(client, DIF_BPF_COEFF89, 0xffbc0084);
  2796. cx25840_write4(client, DIF_BPF_COEFF1011, 0x013e00f0);
  2797. cx25840_write4(client, DIF_BPF_COEFF1213, 0xff56fd9f);
  2798. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfdb8005c);
  2799. cx25840_write4(client, DIF_BPF_COEFF1617, 0x03b00460);
  2800. cx25840_write4(client, DIF_BPF_COEFF1819, 0x00c7fb45);
  2801. cx25840_write4(client, DIF_BPF_COEFF2021, 0xf8f4fd07);
  2802. cx25840_write4(client, DIF_BPF_COEFF2223, 0x04fa09ce);
  2803. cx25840_write4(client, DIF_BPF_COEFF2425, 0x062afc07);
  2804. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf407f614);
  2805. cx25840_write4(client, DIF_BPF_COEFF2829, 0x01920ce0);
  2806. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0d8301fa);
  2807. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf3e8efe5);
  2808. cx25840_write4(client, DIF_BPF_COEFF3435, 0xfa0009a4);
  2809. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2810. break;
  2811. case 7800000:
  2812. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
  2813. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffd000b);
  2814. cx25840_write4(client, DIF_BPF_COEFF45, 0x0022001d);
  2815. cx25840_write4(client, DIF_BPF_COEFF67, 0xffdbff82);
  2816. cx25840_write4(client, DIF_BPF_COEFF89, 0xff870039);
  2817. cx25840_write4(client, DIF_BPF_COEFF1011, 0x012a014a);
  2818. cx25840_write4(client, DIF_BPF_COEFF1213, 0xffedfde7);
  2819. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd47ff6b);
  2820. cx25840_write4(client, DIF_BPF_COEFF1617, 0x031104c6);
  2821. cx25840_write4(client, DIF_BPF_COEFF1819, 0x0202fc4c);
  2822. cx25840_write4(client, DIF_BPF_COEFF2021, 0xf8c6fbad);
  2823. cx25840_write4(client, DIF_BPF_COEFF2223, 0x039909a7);
  2824. cx25840_write4(client, DIF_BPF_COEFF2425, 0x0767fd8e);
  2825. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf482f52b);
  2826. cx25840_write4(client, DIF_BPF_COEFF2829, 0x002d0c39);
  2827. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0e0002f4);
  2828. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf477efc2);
  2829. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf99b0977);
  2830. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2831. break;
  2832. case 7900000:
  2833. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
  2834. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffa0004);
  2835. cx25840_write4(client, DIF_BPF_COEFF45, 0x0020002d);
  2836. cx25840_write4(client, DIF_BPF_COEFF67, 0xfffbff91);
  2837. cx25840_write4(client, DIF_BPF_COEFF89, 0xff61ffe8);
  2838. cx25840_write4(client, DIF_BPF_COEFF1011, 0x00f70184);
  2839. cx25840_write4(client, DIF_BPF_COEFF1213, 0x0086fe5c);
  2840. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd0bfe85);
  2841. cx25840_write4(client, DIF_BPF_COEFF1617, 0x024104e5);
  2842. cx25840_write4(client, DIF_BPF_COEFF1819, 0x0323fd7d);
  2843. cx25840_write4(client, DIF_BPF_COEFF2021, 0xf8e2fa79);
  2844. cx25840_write4(client, DIF_BPF_COEFF2223, 0x021d093f);
  2845. cx25840_write4(client, DIF_BPF_COEFF2425, 0x0879ff22);
  2846. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf52bf465);
  2847. cx25840_write4(client, DIF_BPF_COEFF2829, 0xfec70b79);
  2848. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0e6803eb);
  2849. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf50defa5);
  2850. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf937094a);
  2851. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2852. break;
  2853. case 8000000:
  2854. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffe);
  2855. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff8fffd);
  2856. cx25840_write4(client, DIF_BPF_COEFF45, 0x00190036);
  2857. cx25840_write4(client, DIF_BPF_COEFF67, 0x001bffaf);
  2858. cx25840_write4(client, DIF_BPF_COEFF89, 0xff4fff99);
  2859. cx25840_write4(client, DIF_BPF_COEFF1011, 0x00aa0198);
  2860. cx25840_write4(client, DIF_BPF_COEFF1213, 0x0112fef3);
  2861. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd09fdb9);
  2862. cx25840_write4(client, DIF_BPF_COEFF1617, 0x014d04be);
  2863. cx25840_write4(client, DIF_BPF_COEFF1819, 0x041bfecc);
  2864. cx25840_write4(client, DIF_BPF_COEFF2021, 0xf947f978);
  2865. cx25840_write4(client, DIF_BPF_COEFF2223, 0x00900897);
  2866. cx25840_write4(client, DIF_BPF_COEFF2425, 0x095a00b9);
  2867. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf600f3c5);
  2868. cx25840_write4(client, DIF_BPF_COEFF2829, 0xfd650aa3);
  2869. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0ebc04de);
  2870. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf5aaef8e);
  2871. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf8d5091c);
  2872. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2873. break;
  2874. case 8100000:
  2875. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000ffff);
  2876. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff7fff6);
  2877. cx25840_write4(client, DIF_BPF_COEFF45, 0x000e0038);
  2878. cx25840_write4(client, DIF_BPF_COEFF67, 0x0037ffd7);
  2879. cx25840_write4(client, DIF_BPF_COEFF89, 0xff52ff56);
  2880. cx25840_write4(client, DIF_BPF_COEFF1011, 0x004b0184);
  2881. cx25840_write4(client, DIF_BPF_COEFF1213, 0x0186ffa1);
  2882. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd40fd16);
  2883. cx25840_write4(client, DIF_BPF_COEFF1617, 0x00440452);
  2884. cx25840_write4(client, DIF_BPF_COEFF1819, 0x04de0029);
  2885. cx25840_write4(client, DIF_BPF_COEFF2021, 0xf9f2f8b2);
  2886. cx25840_write4(client, DIF_BPF_COEFF2223, 0xfefe07b5);
  2887. cx25840_write4(client, DIF_BPF_COEFF2425, 0x0a05024d);
  2888. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf6fef34d);
  2889. cx25840_write4(client, DIF_BPF_COEFF2829, 0xfc0a09b8);
  2890. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0efa05cd);
  2891. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf64eef7d);
  2892. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf87308ed);
  2893. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2894. break;
  2895. case 8200000:
  2896. cx25840_write4(client, DIF_BPF_COEFF01, 0x00010000);
  2897. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff8fff0);
  2898. cx25840_write4(client, DIF_BPF_COEFF45, 0x00000031);
  2899. cx25840_write4(client, DIF_BPF_COEFF67, 0x004c0005);
  2900. cx25840_write4(client, DIF_BPF_COEFF89, 0xff6aff27);
  2901. cx25840_write4(client, DIF_BPF_COEFF1011, 0xffe4014a);
  2902. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01d70057);
  2903. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfdacfca6);
  2904. cx25840_write4(client, DIF_BPF_COEFF1617, 0xff3603a7);
  2905. cx25840_write4(client, DIF_BPF_COEFF1819, 0x05610184);
  2906. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfadbf82e);
  2907. cx25840_write4(client, DIF_BPF_COEFF2223, 0xfd74069f);
  2908. cx25840_write4(client, DIF_BPF_COEFF2425, 0x0a7503d6);
  2909. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf81ff2ff);
  2910. cx25840_write4(client, DIF_BPF_COEFF2829, 0xfab808b9);
  2911. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0f2306b5);
  2912. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf6f9ef72);
  2913. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf81308bf);
  2914. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2915. break;
  2916. case 8300000:
  2917. cx25840_write4(client, DIF_BPF_COEFF01, 0x00010001);
  2918. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffbffee);
  2919. cx25840_write4(client, DIF_BPF_COEFF45, 0xfff30022);
  2920. cx25840_write4(client, DIF_BPF_COEFF67, 0x00560032);
  2921. cx25840_write4(client, DIF_BPF_COEFF89, 0xff95ff10);
  2922. cx25840_write4(client, DIF_BPF_COEFF1011, 0xff8000f0);
  2923. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01fe0106);
  2924. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfe46fc71);
  2925. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfe3502c7);
  2926. cx25840_write4(client, DIF_BPF_COEFF1819, 0x059e02ce);
  2927. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfbf9f7f2);
  2928. cx25840_write4(client, DIF_BPF_COEFF2223, 0xfbff055b);
  2929. cx25840_write4(client, DIF_BPF_COEFF2425, 0x0aa9054c);
  2930. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf961f2db);
  2931. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf97507aa);
  2932. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0f350797);
  2933. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf7a9ef6d);
  2934. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf7b40890);
  2935. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2936. break;
  2937. case 8400000:
  2938. cx25840_write4(client, DIF_BPF_COEFF01, 0x00010002);
  2939. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffeffee);
  2940. cx25840_write4(client, DIF_BPF_COEFF45, 0xffe8000f);
  2941. cx25840_write4(client, DIF_BPF_COEFF67, 0x00540058);
  2942. cx25840_write4(client, DIF_BPF_COEFF89, 0xffcdff14);
  2943. cx25840_write4(client, DIF_BPF_COEFF1011, 0xff29007e);
  2944. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01f6019e);
  2945. cx25840_write4(client, DIF_BPF_COEFF1415, 0xff01fc7c);
  2946. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfd5101bf);
  2947. cx25840_write4(client, DIF_BPF_COEFF1819, 0x059203f6);
  2948. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfd41f7fe);
  2949. cx25840_write4(client, DIF_BPF_COEFF2223, 0xfaa903f3);
  2950. cx25840_write4(client, DIF_BPF_COEFF2425, 0x0a9e06a9);
  2951. cx25840_write4(client, DIF_BPF_COEFF2627, 0xfabdf2e2);
  2952. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf842068b);
  2953. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0f320871);
  2954. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf85eef6e);
  2955. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf7560860);
  2956. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2957. break;
  2958. case 8500000:
  2959. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
  2960. cx25840_write4(client, DIF_BPF_COEFF23, 0x0002fff2);
  2961. cx25840_write4(client, DIF_BPF_COEFF45, 0xffe1fff9);
  2962. cx25840_write4(client, DIF_BPF_COEFF67, 0x00460073);
  2963. cx25840_write4(client, DIF_BPF_COEFF89, 0x000bff34);
  2964. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfee90000);
  2965. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01c10215);
  2966. cx25840_write4(client, DIF_BPF_COEFF1415, 0xffd0fcc5);
  2967. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc99009d);
  2968. cx25840_write4(client, DIF_BPF_COEFF1819, 0x053d04f1);
  2969. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfea5f853);
  2970. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf97d0270);
  2971. cx25840_write4(client, DIF_BPF_COEFF2425, 0x0a5607e4);
  2972. cx25840_write4(client, DIF_BPF_COEFF2627, 0xfc2ef314);
  2973. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf723055f);
  2974. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0f180943);
  2975. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf919ef75);
  2976. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf6fa0830);
  2977. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2978. break;
  2979. case 8600000:
  2980. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
  2981. cx25840_write4(client, DIF_BPF_COEFF23, 0x0005fff8);
  2982. cx25840_write4(client, DIF_BPF_COEFF45, 0xffdeffe4);
  2983. cx25840_write4(client, DIF_BPF_COEFF67, 0x002f007f);
  2984. cx25840_write4(client, DIF_BPF_COEFF89, 0x0048ff6b);
  2985. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfec7ff82);
  2986. cx25840_write4(client, DIF_BPF_COEFF1213, 0x0163025f);
  2987. cx25840_write4(client, DIF_BPF_COEFF1415, 0x00a2fd47);
  2988. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc17ff73);
  2989. cx25840_write4(client, DIF_BPF_COEFF1819, 0x04a405b2);
  2990. cx25840_write4(client, DIF_BPF_COEFF2021, 0x0017f8ed);
  2991. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf88500dc);
  2992. cx25840_write4(client, DIF_BPF_COEFF2425, 0x09d208f9);
  2993. cx25840_write4(client, DIF_BPF_COEFF2627, 0xfdaff370);
  2994. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf61c0429);
  2995. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0ee80a0b);
  2996. cx25840_write4(client, DIF_BPF_COEFF3233, 0xf9d8ef82);
  2997. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf6a00800);
  2998. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  2999. break;
  3000. case 8700000:
  3001. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
  3002. cx25840_write4(client, DIF_BPF_COEFF23, 0x0007ffff);
  3003. cx25840_write4(client, DIF_BPF_COEFF45, 0xffe1ffd4);
  3004. cx25840_write4(client, DIF_BPF_COEFF67, 0x0010007a);
  3005. cx25840_write4(client, DIF_BPF_COEFF89, 0x007cffb2);
  3006. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfec6ff10);
  3007. cx25840_write4(client, DIF_BPF_COEFF1213, 0x00e60277);
  3008. cx25840_write4(client, DIF_BPF_COEFF1415, 0x0168fdf9);
  3009. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfbd3fe50);
  3010. cx25840_write4(client, DIF_BPF_COEFF1819, 0x03ce0631);
  3011. cx25840_write4(client, DIF_BPF_COEFF2021, 0x0188f9c8);
  3012. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf7c7ff43);
  3013. cx25840_write4(client, DIF_BPF_COEFF2425, 0x091509e3);
  3014. cx25840_write4(client, DIF_BPF_COEFF2627, 0xff39f3f6);
  3015. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf52d02ea);
  3016. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0ea30ac9);
  3017. cx25840_write4(client, DIF_BPF_COEFF3233, 0xfa9bef95);
  3018. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf64607d0);
  3019. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3020. break;
  3021. case 8800000:
  3022. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000002);
  3023. cx25840_write4(client, DIF_BPF_COEFF23, 0x00090007);
  3024. cx25840_write4(client, DIF_BPF_COEFF45, 0xffe9ffca);
  3025. cx25840_write4(client, DIF_BPF_COEFF67, 0xfff00065);
  3026. cx25840_write4(client, DIF_BPF_COEFF89, 0x00a10003);
  3027. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfee6feb6);
  3028. cx25840_write4(client, DIF_BPF_COEFF1213, 0x0053025b);
  3029. cx25840_write4(client, DIF_BPF_COEFF1415, 0x0213fed0);
  3030. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfbd3fd46);
  3031. cx25840_write4(client, DIF_BPF_COEFF1819, 0x02c70668);
  3032. cx25840_write4(client, DIF_BPF_COEFF2021, 0x02eafadb);
  3033. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf74bfdae);
  3034. cx25840_write4(client, DIF_BPF_COEFF2425, 0x08230a9c);
  3035. cx25840_write4(client, DIF_BPF_COEFF2627, 0x00c7f4a3);
  3036. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf45b01a6);
  3037. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0e480b7c);
  3038. cx25840_write4(client, DIF_BPF_COEFF3233, 0xfb61efae);
  3039. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf5ef079f);
  3040. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3041. break;
  3042. case 8900000:
  3043. cx25840_write4(client, DIF_BPF_COEFF01, 0xffff0000);
  3044. cx25840_write4(client, DIF_BPF_COEFF23, 0x0008000d);
  3045. cx25840_write4(client, DIF_BPF_COEFF45, 0xfff5ffc8);
  3046. cx25840_write4(client, DIF_BPF_COEFF67, 0xffd10043);
  3047. cx25840_write4(client, DIF_BPF_COEFF89, 0x00b20053);
  3048. cx25840_write4(client, DIF_BPF_COEFF1011, 0xff24fe7c);
  3049. cx25840_write4(client, DIF_BPF_COEFF1213, 0xffb9020c);
  3050. cx25840_write4(client, DIF_BPF_COEFF1415, 0x0295ffbb);
  3051. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc17fc64);
  3052. cx25840_write4(client, DIF_BPF_COEFF1819, 0x019b0654);
  3053. cx25840_write4(client, DIF_BPF_COEFF2021, 0x042dfc1c);
  3054. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf714fc2a);
  3055. cx25840_write4(client, DIF_BPF_COEFF2425, 0x07020b21);
  3056. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0251f575);
  3057. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf3a7005e);
  3058. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0dd80c24);
  3059. cx25840_write4(client, DIF_BPF_COEFF3233, 0xfc2aefcd);
  3060. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf599076e);
  3061. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3062. break;
  3063. case 9000000:
  3064. cx25840_write4(client, DIF_BPF_COEFF01, 0xffffffff);
  3065. cx25840_write4(client, DIF_BPF_COEFF23, 0x00060011);
  3066. cx25840_write4(client, DIF_BPF_COEFF45, 0x0002ffcf);
  3067. cx25840_write4(client, DIF_BPF_COEFF67, 0xffba0018);
  3068. cx25840_write4(client, DIF_BPF_COEFF89, 0x00ad009a);
  3069. cx25840_write4(client, DIF_BPF_COEFF1011, 0xff79fe68);
  3070. cx25840_write4(client, DIF_BPF_COEFF1213, 0xff260192);
  3071. cx25840_write4(client, DIF_BPF_COEFF1415, 0x02e500ab);
  3072. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc99fbb6);
  3073. cx25840_write4(client, DIF_BPF_COEFF1819, 0x005b05f7);
  3074. cx25840_write4(client, DIF_BPF_COEFF2021, 0x0545fd81);
  3075. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf723fabf);
  3076. cx25840_write4(client, DIF_BPF_COEFF2425, 0x05b80b70);
  3077. cx25840_write4(client, DIF_BPF_COEFF2627, 0x03d2f669);
  3078. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf313ff15);
  3079. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0d550cbf);
  3080. cx25840_write4(client, DIF_BPF_COEFF3233, 0xfcf6eff2);
  3081. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf544073d);
  3082. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3083. break;
  3084. case 9100000:
  3085. cx25840_write4(client, DIF_BPF_COEFF01, 0xfffffffe);
  3086. cx25840_write4(client, DIF_BPF_COEFF23, 0x00030012);
  3087. cx25840_write4(client, DIF_BPF_COEFF45, 0x000fffdd);
  3088. cx25840_write4(client, DIF_BPF_COEFF67, 0xffacffea);
  3089. cx25840_write4(client, DIF_BPF_COEFF89, 0x009300cf);
  3090. cx25840_write4(client, DIF_BPF_COEFF1011, 0xffdcfe7c);
  3091. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfea600f7);
  3092. cx25840_write4(client, DIF_BPF_COEFF1415, 0x02fd0190);
  3093. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfd51fb46);
  3094. cx25840_write4(client, DIF_BPF_COEFF1819, 0xff150554);
  3095. cx25840_write4(client, DIF_BPF_COEFF2021, 0x0627fefd);
  3096. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf778f978);
  3097. cx25840_write4(client, DIF_BPF_COEFF2425, 0x044d0b87);
  3098. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0543f77d);
  3099. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf2a0fdcf);
  3100. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0cbe0d4e);
  3101. cx25840_write4(client, DIF_BPF_COEFF3233, 0xfdc4f01d);
  3102. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf4f2070b);
  3103. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3104. break;
  3105. case 9200000:
  3106. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
  3107. cx25840_write4(client, DIF_BPF_COEFF23, 0x00000010);
  3108. cx25840_write4(client, DIF_BPF_COEFF45, 0x001afff0);
  3109. cx25840_write4(client, DIF_BPF_COEFF67, 0xffaaffbf);
  3110. cx25840_write4(client, DIF_BPF_COEFF89, 0x006700ed);
  3111. cx25840_write4(client, DIF_BPF_COEFF1011, 0x0043feb6);
  3112. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe460047);
  3113. cx25840_write4(client, DIF_BPF_COEFF1415, 0x02db0258);
  3114. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfe35fb1b);
  3115. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfddc0473);
  3116. cx25840_write4(client, DIF_BPF_COEFF2021, 0x06c90082);
  3117. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf811f85e);
  3118. cx25840_write4(client, DIF_BPF_COEFF2425, 0x02c90b66);
  3119. cx25840_write4(client, DIF_BPF_COEFF2627, 0x069ff8ad);
  3120. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf250fc8d);
  3121. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0c140dcf);
  3122. cx25840_write4(client, DIF_BPF_COEFF3233, 0xfe93f04d);
  3123. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf4a106d9);
  3124. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3125. break;
  3126. case 9300000:
  3127. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
  3128. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffc000c);
  3129. cx25840_write4(client, DIF_BPF_COEFF45, 0x00200006);
  3130. cx25840_write4(client, DIF_BPF_COEFF67, 0xffb4ff9c);
  3131. cx25840_write4(client, DIF_BPF_COEFF89, 0x002f00ef);
  3132. cx25840_write4(client, DIF_BPF_COEFF1011, 0x00a4ff10);
  3133. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe0dff92);
  3134. cx25840_write4(client, DIF_BPF_COEFF1415, 0x028102f7);
  3135. cx25840_write4(client, DIF_BPF_COEFF1617, 0xff36fb37);
  3136. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfcbf035e);
  3137. cx25840_write4(client, DIF_BPF_COEFF2021, 0x07260202);
  3138. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf8e8f778);
  3139. cx25840_write4(client, DIF_BPF_COEFF2425, 0x01340b0d);
  3140. cx25840_write4(client, DIF_BPF_COEFF2627, 0x07e1f9f4);
  3141. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf223fb51);
  3142. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0b590e42);
  3143. cx25840_write4(client, DIF_BPF_COEFF3233, 0xff64f083);
  3144. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf45206a7);
  3145. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3146. break;
  3147. case 9400000:
  3148. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
  3149. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff90005);
  3150. cx25840_write4(client, DIF_BPF_COEFF45, 0x0022001a);
  3151. cx25840_write4(client, DIF_BPF_COEFF67, 0xffc9ff86);
  3152. cx25840_write4(client, DIF_BPF_COEFF89, 0xfff000d7);
  3153. cx25840_write4(client, DIF_BPF_COEFF1011, 0x00f2ff82);
  3154. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe01fee5);
  3155. cx25840_write4(client, DIF_BPF_COEFF1415, 0x01f60362);
  3156. cx25840_write4(client, DIF_BPF_COEFF1617, 0x0044fb99);
  3157. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfbcc0222);
  3158. cx25840_write4(client, DIF_BPF_COEFF2021, 0x07380370);
  3159. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf9f7f6cc);
  3160. cx25840_write4(client, DIF_BPF_COEFF2425, 0xff990a7e);
  3161. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0902fb50);
  3162. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf21afa1f);
  3163. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0a8d0ea6);
  3164. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0034f0bf);
  3165. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf4050675);
  3166. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3167. break;
  3168. case 9500000:
  3169. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffe);
  3170. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff8fffe);
  3171. cx25840_write4(client, DIF_BPF_COEFF45, 0x001e002b);
  3172. cx25840_write4(client, DIF_BPF_COEFF67, 0xffe5ff81);
  3173. cx25840_write4(client, DIF_BPF_COEFF89, 0xffb400a5);
  3174. cx25840_write4(client, DIF_BPF_COEFF1011, 0x01280000);
  3175. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe24fe50);
  3176. cx25840_write4(client, DIF_BPF_COEFF1415, 0x01460390);
  3177. cx25840_write4(client, DIF_BPF_COEFF1617, 0x014dfc3a);
  3178. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfb1000ce);
  3179. cx25840_write4(client, DIF_BPF_COEFF2021, 0x070104bf);
  3180. cx25840_write4(client, DIF_BPF_COEFF2223, 0xfb37f65f);
  3181. cx25840_write4(client, DIF_BPF_COEFF2425, 0xfe0009bc);
  3182. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0a00fcbb);
  3183. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf235f8f8);
  3184. cx25840_write4(client, DIF_BPF_COEFF3031, 0x09b20efc);
  3185. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0105f101);
  3186. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf3ba0642);
  3187. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3188. break;
  3189. case 9600000:
  3190. cx25840_write4(client, DIF_BPF_COEFF01, 0x0001ffff);
  3191. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff8fff7);
  3192. cx25840_write4(client, DIF_BPF_COEFF45, 0x00150036);
  3193. cx25840_write4(client, DIF_BPF_COEFF67, 0x0005ff8c);
  3194. cx25840_write4(client, DIF_BPF_COEFF89, 0xff810061);
  3195. cx25840_write4(client, DIF_BPF_COEFF1011, 0x013d007e);
  3196. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe71fddf);
  3197. cx25840_write4(client, DIF_BPF_COEFF1415, 0x007c0380);
  3198. cx25840_write4(client, DIF_BPF_COEFF1617, 0x0241fd13);
  3199. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa94ff70);
  3200. cx25840_write4(client, DIF_BPF_COEFF2021, 0x068005e2);
  3201. cx25840_write4(client, DIF_BPF_COEFF2223, 0xfc9bf633);
  3202. cx25840_write4(client, DIF_BPF_COEFF2425, 0xfc7308ca);
  3203. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0ad5fe30);
  3204. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf274f7e0);
  3205. cx25840_write4(client, DIF_BPF_COEFF3031, 0x08c90f43);
  3206. cx25840_write4(client, DIF_BPF_COEFF3233, 0x01d4f147);
  3207. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf371060f);
  3208. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3209. break;
  3210. case 9700000:
  3211. cx25840_write4(client, DIF_BPF_COEFF01, 0x00010001);
  3212. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff9fff1);
  3213. cx25840_write4(client, DIF_BPF_COEFF45, 0x00090038);
  3214. cx25840_write4(client, DIF_BPF_COEFF67, 0x0025ffa7);
  3215. cx25840_write4(client, DIF_BPF_COEFF89, 0xff5e0012);
  3216. cx25840_write4(client, DIF_BPF_COEFF1011, 0x013200f0);
  3217. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfee3fd9b);
  3218. cx25840_write4(client, DIF_BPF_COEFF1415, 0xffaa0331);
  3219. cx25840_write4(client, DIF_BPF_COEFF1617, 0x0311fe15);
  3220. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa60fe18);
  3221. cx25840_write4(client, DIF_BPF_COEFF2021, 0x05bd06d1);
  3222. cx25840_write4(client, DIF_BPF_COEFF2223, 0xfe1bf64a);
  3223. cx25840_write4(client, DIF_BPF_COEFF2425, 0xfafa07ae);
  3224. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0b7effab);
  3225. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf2d5f6d7);
  3226. cx25840_write4(client, DIF_BPF_COEFF3031, 0x07d30f7a);
  3227. cx25840_write4(client, DIF_BPF_COEFF3233, 0x02a3f194);
  3228. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf32905dc);
  3229. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3230. break;
  3231. case 9800000:
  3232. cx25840_write4(client, DIF_BPF_COEFF01, 0x00010002);
  3233. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffcffee);
  3234. cx25840_write4(client, DIF_BPF_COEFF45, 0xfffb0032);
  3235. cx25840_write4(client, DIF_BPF_COEFF67, 0x003fffcd);
  3236. cx25840_write4(client, DIF_BPF_COEFF89, 0xff4effc1);
  3237. cx25840_write4(client, DIF_BPF_COEFF1011, 0x0106014a);
  3238. cx25840_write4(client, DIF_BPF_COEFF1213, 0xff6efd8a);
  3239. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfedd02aa);
  3240. cx25840_write4(client, DIF_BPF_COEFF1617, 0x03b0ff34);
  3241. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa74fcd7);
  3242. cx25840_write4(client, DIF_BPF_COEFF2021, 0x04bf0781);
  3243. cx25840_write4(client, DIF_BPF_COEFF2223, 0xffaaf6a3);
  3244. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf99e066b);
  3245. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0bf90128);
  3246. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf359f5e1);
  3247. cx25840_write4(client, DIF_BPF_COEFF3031, 0x06d20fa2);
  3248. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0370f1e5);
  3249. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf2e405a8);
  3250. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3251. break;
  3252. case 9900000:
  3253. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
  3254. cx25840_write4(client, DIF_BPF_COEFF23, 0xffffffee);
  3255. cx25840_write4(client, DIF_BPF_COEFF45, 0xffef0024);
  3256. cx25840_write4(client, DIF_BPF_COEFF67, 0x0051fffa);
  3257. cx25840_write4(client, DIF_BPF_COEFF89, 0xff54ff77);
  3258. cx25840_write4(client, DIF_BPF_COEFF1011, 0x00be0184);
  3259. cx25840_write4(client, DIF_BPF_COEFF1213, 0x0006fdad);
  3260. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfe2701f3);
  3261. cx25840_write4(client, DIF_BPF_COEFF1617, 0x0413005e);
  3262. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfad1fbba);
  3263. cx25840_write4(client, DIF_BPF_COEFF2021, 0x039007ee);
  3264. cx25840_write4(client, DIF_BPF_COEFF2223, 0x013bf73d);
  3265. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf868050a);
  3266. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0c4302a1);
  3267. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf3fdf4fe);
  3268. cx25840_write4(client, DIF_BPF_COEFF3031, 0x05c70fba);
  3269. cx25840_write4(client, DIF_BPF_COEFF3233, 0x043bf23c);
  3270. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf2a10575);
  3271. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3272. break;
  3273. case 10000000:
  3274. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
  3275. cx25840_write4(client, DIF_BPF_COEFF23, 0x0003fff1);
  3276. cx25840_write4(client, DIF_BPF_COEFF45, 0xffe50011);
  3277. cx25840_write4(client, DIF_BPF_COEFF67, 0x00570027);
  3278. cx25840_write4(client, DIF_BPF_COEFF89, 0xff70ff3c);
  3279. cx25840_write4(client, DIF_BPF_COEFF1011, 0x00620198);
  3280. cx25840_write4(client, DIF_BPF_COEFF1213, 0x009efe01);
  3281. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd95011a);
  3282. cx25840_write4(client, DIF_BPF_COEFF1617, 0x04350183);
  3283. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfb71fad0);
  3284. cx25840_write4(client, DIF_BPF_COEFF2021, 0x023c0812);
  3285. cx25840_write4(client, DIF_BPF_COEFF2223, 0x02c3f811);
  3286. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf75e0390);
  3287. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0c5c0411);
  3288. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf4c1f432);
  3289. cx25840_write4(client, DIF_BPF_COEFF3031, 0x04b30fc1);
  3290. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0503f297);
  3291. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf2610541);
  3292. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3293. break;
  3294. case 10100000:
  3295. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
  3296. cx25840_write4(client, DIF_BPF_COEFF23, 0x0006fff7);
  3297. cx25840_write4(client, DIF_BPF_COEFF45, 0xffdffffc);
  3298. cx25840_write4(client, DIF_BPF_COEFF67, 0x00510050);
  3299. cx25840_write4(client, DIF_BPF_COEFF89, 0xff9dff18);
  3300. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfffc0184);
  3301. cx25840_write4(client, DIF_BPF_COEFF1213, 0x0128fe80);
  3302. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd32002e);
  3303. cx25840_write4(client, DIF_BPF_COEFF1617, 0x04130292);
  3304. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfc4dfa21);
  3305. cx25840_write4(client, DIF_BPF_COEFF2021, 0x00d107ee);
  3306. cx25840_write4(client, DIF_BPF_COEFF2223, 0x0435f91c);
  3307. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf6850205);
  3308. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0c430573);
  3309. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf5a1f37d);
  3310. cx25840_write4(client, DIF_BPF_COEFF3031, 0x03990fba);
  3311. cx25840_write4(client, DIF_BPF_COEFF3233, 0x05c7f2f8);
  3312. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf222050d);
  3313. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3314. break;
  3315. case 10200000:
  3316. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000002);
  3317. cx25840_write4(client, DIF_BPF_COEFF23, 0x0008fffe);
  3318. cx25840_write4(client, DIF_BPF_COEFF45, 0xffdfffe7);
  3319. cx25840_write4(client, DIF_BPF_COEFF67, 0x003f006e);
  3320. cx25840_write4(client, DIF_BPF_COEFF89, 0xffd6ff0f);
  3321. cx25840_write4(client, DIF_BPF_COEFF1011, 0xff96014a);
  3322. cx25840_write4(client, DIF_BPF_COEFF1213, 0x0197ff1f);
  3323. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd05ff3e);
  3324. cx25840_write4(client, DIF_BPF_COEFF1617, 0x03b0037c);
  3325. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfd59f9b7);
  3326. cx25840_write4(client, DIF_BPF_COEFF2021, 0xff5d0781);
  3327. cx25840_write4(client, DIF_BPF_COEFF2223, 0x0585fa56);
  3328. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf5e4006f);
  3329. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0bf906c4);
  3330. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf69df2e0);
  3331. cx25840_write4(client, DIF_BPF_COEFF3031, 0x02790fa2);
  3332. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0688f35d);
  3333. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf1e604d8);
  3334. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3335. break;
  3336. case 10300000:
  3337. cx25840_write4(client, DIF_BPF_COEFF01, 0xffff0001);
  3338. cx25840_write4(client, DIF_BPF_COEFF23, 0x00090005);
  3339. cx25840_write4(client, DIF_BPF_COEFF45, 0xffe4ffd6);
  3340. cx25840_write4(client, DIF_BPF_COEFF67, 0x0025007e);
  3341. cx25840_write4(client, DIF_BPF_COEFF89, 0x0014ff20);
  3342. cx25840_write4(client, DIF_BPF_COEFF1011, 0xff3c00f0);
  3343. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01e1ffd0);
  3344. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd12fe5c);
  3345. cx25840_write4(client, DIF_BPF_COEFF1617, 0x03110433);
  3346. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfe88f996);
  3347. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfdf106d1);
  3348. cx25840_write4(client, DIF_BPF_COEFF2223, 0x06aafbb7);
  3349. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf57efed8);
  3350. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0b7e07ff);
  3351. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf7b0f25e);
  3352. cx25840_write4(client, DIF_BPF_COEFF3031, 0x01560f7a);
  3353. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0745f3c7);
  3354. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf1ac04a4);
  3355. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3356. break;
  3357. case 10400000:
  3358. cx25840_write4(client, DIF_BPF_COEFF01, 0xffffffff);
  3359. cx25840_write4(client, DIF_BPF_COEFF23, 0x0008000c);
  3360. cx25840_write4(client, DIF_BPF_COEFF45, 0xffedffcb);
  3361. cx25840_write4(client, DIF_BPF_COEFF67, 0x0005007d);
  3362. cx25840_write4(client, DIF_BPF_COEFF89, 0x0050ff4c);
  3363. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfef6007e);
  3364. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01ff0086);
  3365. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd58fd97);
  3366. cx25840_write4(client, DIF_BPF_COEFF1617, 0x024104ad);
  3367. cx25840_write4(client, DIF_BPF_COEFF1819, 0xffcaf9c0);
  3368. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfc9905e2);
  3369. cx25840_write4(client, DIF_BPF_COEFF2223, 0x079afd35);
  3370. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf555fd46);
  3371. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0ad50920);
  3372. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf8d9f1f6);
  3373. cx25840_write4(client, DIF_BPF_COEFF3031, 0x00310f43);
  3374. cx25840_write4(client, DIF_BPF_COEFF3233, 0x07fdf435);
  3375. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf174046f);
  3376. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3377. break;
  3378. case 10500000:
  3379. cx25840_write4(client, DIF_BPF_COEFF01, 0xfffffffe);
  3380. cx25840_write4(client, DIF_BPF_COEFF23, 0x00050011);
  3381. cx25840_write4(client, DIF_BPF_COEFF45, 0xfffaffc8);
  3382. cx25840_write4(client, DIF_BPF_COEFF67, 0xffe5006b);
  3383. cx25840_write4(client, DIF_BPF_COEFF89, 0x0082ff8c);
  3384. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfecc0000);
  3385. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01f00130);
  3386. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfdd2fcfc);
  3387. cx25840_write4(client, DIF_BPF_COEFF1617, 0x014d04e3);
  3388. cx25840_write4(client, DIF_BPF_COEFF1819, 0x010efa32);
  3389. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfb6404bf);
  3390. cx25840_write4(client, DIF_BPF_COEFF2223, 0x084efec5);
  3391. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf569fbc2);
  3392. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0a000a23);
  3393. cx25840_write4(client, DIF_BPF_COEFF2829, 0xfa15f1ab);
  3394. cx25840_write4(client, DIF_BPF_COEFF3031, 0xff0b0efc);
  3395. cx25840_write4(client, DIF_BPF_COEFF3233, 0x08b0f4a7);
  3396. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf13f043a);
  3397. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3398. break;
  3399. case 10600000:
  3400. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
  3401. cx25840_write4(client, DIF_BPF_COEFF23, 0x00020012);
  3402. cx25840_write4(client, DIF_BPF_COEFF45, 0x0007ffcd);
  3403. cx25840_write4(client, DIF_BPF_COEFF67, 0xffc9004c);
  3404. cx25840_write4(client, DIF_BPF_COEFF89, 0x00a4ffd9);
  3405. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfec3ff82);
  3406. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01b401c1);
  3407. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfe76fc97);
  3408. cx25840_write4(client, DIF_BPF_COEFF1617, 0x004404d2);
  3409. cx25840_write4(client, DIF_BPF_COEFF1819, 0x0245fae8);
  3410. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfa5f0370);
  3411. cx25840_write4(client, DIF_BPF_COEFF2223, 0x08c1005f);
  3412. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf5bcfa52);
  3413. cx25840_write4(client, DIF_BPF_COEFF2627, 0x09020b04);
  3414. cx25840_write4(client, DIF_BPF_COEFF2829, 0xfb60f17b);
  3415. cx25840_write4(client, DIF_BPF_COEFF3031, 0xfde70ea6);
  3416. cx25840_write4(client, DIF_BPF_COEFF3233, 0x095df51e);
  3417. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf10c0405);
  3418. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3419. break;
  3420. case 10700000:
  3421. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
  3422. cx25840_write4(client, DIF_BPF_COEFF23, 0xffff0011);
  3423. cx25840_write4(client, DIF_BPF_COEFF45, 0x0014ffdb);
  3424. cx25840_write4(client, DIF_BPF_COEFF67, 0xffb40023);
  3425. cx25840_write4(client, DIF_BPF_COEFF89, 0x00b2002a);
  3426. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfedbff10);
  3427. cx25840_write4(client, DIF_BPF_COEFF1213, 0x0150022d);
  3428. cx25840_write4(client, DIF_BPF_COEFF1415, 0xff38fc6f);
  3429. cx25840_write4(client, DIF_BPF_COEFF1617, 0xff36047b);
  3430. cx25840_write4(client, DIF_BPF_COEFF1819, 0x035efbda);
  3431. cx25840_write4(client, DIF_BPF_COEFF2021, 0xf9940202);
  3432. cx25840_write4(client, DIF_BPF_COEFF2223, 0x08ee01f5);
  3433. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf649f8fe);
  3434. cx25840_write4(client, DIF_BPF_COEFF2627, 0x07e10bc2);
  3435. cx25840_write4(client, DIF_BPF_COEFF2829, 0xfcb6f169);
  3436. cx25840_write4(client, DIF_BPF_COEFF3031, 0xfcc60e42);
  3437. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0a04f599);
  3438. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf0db03d0);
  3439. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3440. break;
  3441. case 10800000:
  3442. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
  3443. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffb000d);
  3444. cx25840_write4(client, DIF_BPF_COEFF45, 0x001dffed);
  3445. cx25840_write4(client, DIF_BPF_COEFF67, 0xffaafff5);
  3446. cx25840_write4(client, DIF_BPF_COEFF89, 0x00aa0077);
  3447. cx25840_write4(client, DIF_BPF_COEFF1011, 0xff13feb6);
  3448. cx25840_write4(client, DIF_BPF_COEFF1213, 0x00ce026b);
  3449. cx25840_write4(client, DIF_BPF_COEFF1415, 0x000afc85);
  3450. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfe3503e3);
  3451. cx25840_write4(client, DIF_BPF_COEFF1819, 0x044cfcfb);
  3452. cx25840_write4(client, DIF_BPF_COEFF2021, 0xf90c0082);
  3453. cx25840_write4(client, DIF_BPF_COEFF2223, 0x08d5037f);
  3454. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf710f7cc);
  3455. cx25840_write4(client, DIF_BPF_COEFF2627, 0x069f0c59);
  3456. cx25840_write4(client, DIF_BPF_COEFF2829, 0xfe16f173);
  3457. cx25840_write4(client, DIF_BPF_COEFF3031, 0xfbaa0dcf);
  3458. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0aa5f617);
  3459. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf0ad039b);
  3460. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3461. break;
  3462. case 10900000:
  3463. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffe);
  3464. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff90006);
  3465. cx25840_write4(client, DIF_BPF_COEFF45, 0x00210003);
  3466. cx25840_write4(client, DIF_BPF_COEFF67, 0xffacffc8);
  3467. cx25840_write4(client, DIF_BPF_COEFF89, 0x008e00b6);
  3468. cx25840_write4(client, DIF_BPF_COEFF1011, 0xff63fe7c);
  3469. cx25840_write4(client, DIF_BPF_COEFF1213, 0x003a0275);
  3470. cx25840_write4(client, DIF_BPF_COEFF1415, 0x00dafcda);
  3471. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfd510313);
  3472. cx25840_write4(client, DIF_BPF_COEFF1819, 0x0501fe40);
  3473. cx25840_write4(client, DIF_BPF_COEFF2021, 0xf8cbfefd);
  3474. cx25840_write4(client, DIF_BPF_COEFF2223, 0x087604f0);
  3475. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf80af6c2);
  3476. cx25840_write4(client, DIF_BPF_COEFF2627, 0x05430cc8);
  3477. cx25840_write4(client, DIF_BPF_COEFF2829, 0xff7af19a);
  3478. cx25840_write4(client, DIF_BPF_COEFF3031, 0xfa940d4e);
  3479. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0b3ff699);
  3480. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf0810365);
  3481. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3482. break;
  3483. case 11000000:
  3484. cx25840_write4(client, DIF_BPF_COEFF01, 0x0001ffff);
  3485. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff8ffff);
  3486. cx25840_write4(client, DIF_BPF_COEFF45, 0x00210018);
  3487. cx25840_write4(client, DIF_BPF_COEFF67, 0xffbaffa3);
  3488. cx25840_write4(client, DIF_BPF_COEFF89, 0x006000e1);
  3489. cx25840_write4(client, DIF_BPF_COEFF1011, 0xffc4fe68);
  3490. cx25840_write4(client, DIF_BPF_COEFF1213, 0xffa0024b);
  3491. cx25840_write4(client, DIF_BPF_COEFF1415, 0x019afd66);
  3492. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc990216);
  3493. cx25840_write4(client, DIF_BPF_COEFF1819, 0x0575ff99);
  3494. cx25840_write4(client, DIF_BPF_COEFF2021, 0xf8d4fd81);
  3495. cx25840_write4(client, DIF_BPF_COEFF2223, 0x07d40640);
  3496. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf932f5e6);
  3497. cx25840_write4(client, DIF_BPF_COEFF2627, 0x03d20d0d);
  3498. cx25840_write4(client, DIF_BPF_COEFF2829, 0x00dff1de);
  3499. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf9860cbf);
  3500. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0bd1f71e);
  3501. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf058032f);
  3502. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3503. break;
  3504. case 11100000:
  3505. cx25840_write4(client, DIF_BPF_COEFF01, 0x00010000);
  3506. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff8fff8);
  3507. cx25840_write4(client, DIF_BPF_COEFF45, 0x001b0029);
  3508. cx25840_write4(client, DIF_BPF_COEFF67, 0xffd1ff8a);
  3509. cx25840_write4(client, DIF_BPF_COEFF89, 0x002600f2);
  3510. cx25840_write4(client, DIF_BPF_COEFF1011, 0x002cfe7c);
  3511. cx25840_write4(client, DIF_BPF_COEFF1213, 0xff0f01f0);
  3512. cx25840_write4(client, DIF_BPF_COEFF1415, 0x023bfe20);
  3513. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc1700fa);
  3514. cx25840_write4(client, DIF_BPF_COEFF1819, 0x05a200f7);
  3515. cx25840_write4(client, DIF_BPF_COEFF2021, 0xf927fc1c);
  3516. cx25840_write4(client, DIF_BPF_COEFF2223, 0x06f40765);
  3517. cx25840_write4(client, DIF_BPF_COEFF2425, 0xfa82f53b);
  3518. cx25840_write4(client, DIF_BPF_COEFF2627, 0x02510d27);
  3519. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0243f23d);
  3520. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf8810c24);
  3521. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0c5cf7a7);
  3522. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf03102fa);
  3523. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3524. break;
  3525. case 11200000:
  3526. cx25840_write4(client, DIF_BPF_COEFF01, 0x00010002);
  3527. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffafff2);
  3528. cx25840_write4(client, DIF_BPF_COEFF45, 0x00110035);
  3529. cx25840_write4(client, DIF_BPF_COEFF67, 0xfff0ff81);
  3530. cx25840_write4(client, DIF_BPF_COEFF89, 0xffe700e7);
  3531. cx25840_write4(client, DIF_BPF_COEFF1011, 0x008ffeb6);
  3532. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe94016d);
  3533. cx25840_write4(client, DIF_BPF_COEFF1415, 0x02b0fefb);
  3534. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfbd3ffd1);
  3535. cx25840_write4(client, DIF_BPF_COEFF1819, 0x05850249);
  3536. cx25840_write4(client, DIF_BPF_COEFF2021, 0xf9c1fadb);
  3537. cx25840_write4(client, DIF_BPF_COEFF2223, 0x05de0858);
  3538. cx25840_write4(client, DIF_BPF_COEFF2425, 0xfbf2f4c4);
  3539. cx25840_write4(client, DIF_BPF_COEFF2627, 0x00c70d17);
  3540. cx25840_write4(client, DIF_BPF_COEFF2829, 0x03a0f2b8);
  3541. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf7870b7c);
  3542. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0cdff833);
  3543. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf00d02c4);
  3544. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3545. break;
  3546. case 11300000:
  3547. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
  3548. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffdffee);
  3549. cx25840_write4(client, DIF_BPF_COEFF45, 0x00040038);
  3550. cx25840_write4(client, DIF_BPF_COEFF67, 0x0010ff88);
  3551. cx25840_write4(client, DIF_BPF_COEFF89, 0xffac00c2);
  3552. cx25840_write4(client, DIF_BPF_COEFF1011, 0x00e2ff10);
  3553. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe3900cb);
  3554. cx25840_write4(client, DIF_BPF_COEFF1415, 0x02f1ffe9);
  3555. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfbd3feaa);
  3556. cx25840_write4(client, DIF_BPF_COEFF1819, 0x05210381);
  3557. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfa9cf9c8);
  3558. cx25840_write4(client, DIF_BPF_COEFF2223, 0x04990912);
  3559. cx25840_write4(client, DIF_BPF_COEFF2425, 0xfd7af484);
  3560. cx25840_write4(client, DIF_BPF_COEFF2627, 0xff390cdb);
  3561. cx25840_write4(client, DIF_BPF_COEFF2829, 0x04f4f34d);
  3562. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf69a0ac9);
  3563. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0d5af8c1);
  3564. cx25840_write4(client, DIF_BPF_COEFF3435, 0xefec028e);
  3565. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3566. break;
  3567. case 11400000:
  3568. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
  3569. cx25840_write4(client, DIF_BPF_COEFF23, 0x0000ffee);
  3570. cx25840_write4(client, DIF_BPF_COEFF45, 0xfff60033);
  3571. cx25840_write4(client, DIF_BPF_COEFF67, 0x002fff9f);
  3572. cx25840_write4(client, DIF_BPF_COEFF89, 0xff7b0087);
  3573. cx25840_write4(client, DIF_BPF_COEFF1011, 0x011eff82);
  3574. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe080018);
  3575. cx25840_write4(client, DIF_BPF_COEFF1415, 0x02f900d8);
  3576. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc17fd96);
  3577. cx25840_write4(client, DIF_BPF_COEFF1819, 0x04790490);
  3578. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfbadf8ed);
  3579. cx25840_write4(client, DIF_BPF_COEFF2223, 0x032f098e);
  3580. cx25840_write4(client, DIF_BPF_COEFF2425, 0xff10f47d);
  3581. cx25840_write4(client, DIF_BPF_COEFF2627, 0xfdaf0c75);
  3582. cx25840_write4(client, DIF_BPF_COEFF2829, 0x063cf3fc);
  3583. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf5ba0a0b);
  3584. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0dccf952);
  3585. cx25840_write4(client, DIF_BPF_COEFF3435, 0xefcd0258);
  3586. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3587. break;
  3588. case 11500000:
  3589. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
  3590. cx25840_write4(client, DIF_BPF_COEFF23, 0x0004fff1);
  3591. cx25840_write4(client, DIF_BPF_COEFF45, 0xffea0026);
  3592. cx25840_write4(client, DIF_BPF_COEFF67, 0x0046ffc3);
  3593. cx25840_write4(client, DIF_BPF_COEFF89, 0xff5a003c);
  3594. cx25840_write4(client, DIF_BPF_COEFF1011, 0x013b0000);
  3595. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe04ff63);
  3596. cx25840_write4(client, DIF_BPF_COEFF1415, 0x02c801b8);
  3597. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc99fca6);
  3598. cx25840_write4(client, DIF_BPF_COEFF1819, 0x0397056a);
  3599. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfcecf853);
  3600. cx25840_write4(client, DIF_BPF_COEFF2223, 0x01ad09c9);
  3601. cx25840_write4(client, DIF_BPF_COEFF2425, 0x00acf4ad);
  3602. cx25840_write4(client, DIF_BPF_COEFF2627, 0xfc2e0be7);
  3603. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0773f4c2);
  3604. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf4e90943);
  3605. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0e35f9e6);
  3606. cx25840_write4(client, DIF_BPF_COEFF3435, 0xefb10221);
  3607. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3608. break;
  3609. case 11600000:
  3610. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000002);
  3611. cx25840_write4(client, DIF_BPF_COEFF23, 0x0007fff6);
  3612. cx25840_write4(client, DIF_BPF_COEFF45, 0xffe20014);
  3613. cx25840_write4(client, DIF_BPF_COEFF67, 0x0054ffee);
  3614. cx25840_write4(client, DIF_BPF_COEFF89, 0xff4effeb);
  3615. cx25840_write4(client, DIF_BPF_COEFF1011, 0x0137007e);
  3616. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe2efebb);
  3617. cx25840_write4(client, DIF_BPF_COEFF1415, 0x0260027a);
  3618. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfd51fbe6);
  3619. cx25840_write4(client, DIF_BPF_COEFF1819, 0x02870605);
  3620. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfe4af7fe);
  3621. cx25840_write4(client, DIF_BPF_COEFF2223, 0x001d09c1);
  3622. cx25840_write4(client, DIF_BPF_COEFF2425, 0x0243f515);
  3623. cx25840_write4(client, DIF_BPF_COEFF2627, 0xfabd0b32);
  3624. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0897f59e);
  3625. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf4280871);
  3626. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0e95fa7c);
  3627. cx25840_write4(client, DIF_BPF_COEFF3435, 0xef9701eb);
  3628. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3629. break;
  3630. case 11700000:
  3631. cx25840_write4(client, DIF_BPF_COEFF01, 0xffff0001);
  3632. cx25840_write4(client, DIF_BPF_COEFF23, 0x0008fffd);
  3633. cx25840_write4(client, DIF_BPF_COEFF45, 0xffdeffff);
  3634. cx25840_write4(client, DIF_BPF_COEFF67, 0x0056001d);
  3635. cx25840_write4(client, DIF_BPF_COEFF89, 0xff57ff9c);
  3636. cx25840_write4(client, DIF_BPF_COEFF1011, 0x011300f0);
  3637. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe82fe2e);
  3638. cx25840_write4(client, DIF_BPF_COEFF1415, 0x01ca0310);
  3639. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfe35fb62);
  3640. cx25840_write4(client, DIF_BPF_COEFF1819, 0x0155065a);
  3641. cx25840_write4(client, DIF_BPF_COEFF2021, 0xffbaf7f2);
  3642. cx25840_write4(client, DIF_BPF_COEFF2223, 0xfe8c0977);
  3643. cx25840_write4(client, DIF_BPF_COEFF2425, 0x03cef5b2);
  3644. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf9610a58);
  3645. cx25840_write4(client, DIF_BPF_COEFF2829, 0x09a5f68f);
  3646. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf3790797);
  3647. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0eebfb14);
  3648. cx25840_write4(client, DIF_BPF_COEFF3435, 0xef8001b5);
  3649. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3650. break;
  3651. case 11800000:
  3652. cx25840_write4(client, DIF_BPF_COEFF01, 0xffff0000);
  3653. cx25840_write4(client, DIF_BPF_COEFF23, 0x00080004);
  3654. cx25840_write4(client, DIF_BPF_COEFF45, 0xffe0ffe9);
  3655. cx25840_write4(client, DIF_BPF_COEFF67, 0x004c0047);
  3656. cx25840_write4(client, DIF_BPF_COEFF89, 0xff75ff58);
  3657. cx25840_write4(client, DIF_BPF_COEFF1011, 0x00d1014a);
  3658. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfef9fdc8);
  3659. cx25840_write4(client, DIF_BPF_COEFF1415, 0x0111036f);
  3660. cx25840_write4(client, DIF_BPF_COEFF1617, 0xff36fb21);
  3661. cx25840_write4(client, DIF_BPF_COEFF1819, 0x00120665);
  3662. cx25840_write4(client, DIF_BPF_COEFF2021, 0x012df82e);
  3663. cx25840_write4(client, DIF_BPF_COEFF2223, 0xfd0708ec);
  3664. cx25840_write4(client, DIF_BPF_COEFF2425, 0x0542f682);
  3665. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf81f095c);
  3666. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0a9af792);
  3667. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf2db06b5);
  3668. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0f38fbad);
  3669. cx25840_write4(client, DIF_BPF_COEFF3435, 0xef6c017e);
  3670. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3671. break;
  3672. case 11900000:
  3673. cx25840_write4(client, DIF_BPF_COEFF01, 0xffffffff);
  3674. cx25840_write4(client, DIF_BPF_COEFF23, 0x0007000b);
  3675. cx25840_write4(client, DIF_BPF_COEFF45, 0xffe7ffd8);
  3676. cx25840_write4(client, DIF_BPF_COEFF67, 0x00370068);
  3677. cx25840_write4(client, DIF_BPF_COEFF89, 0xffa4ff28);
  3678. cx25840_write4(client, DIF_BPF_COEFF1011, 0x00790184);
  3679. cx25840_write4(client, DIF_BPF_COEFF1213, 0xff87fd91);
  3680. cx25840_write4(client, DIF_BPF_COEFF1415, 0x00430392);
  3681. cx25840_write4(client, DIF_BPF_COEFF1617, 0x0044fb26);
  3682. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfece0626);
  3683. cx25840_write4(client, DIF_BPF_COEFF2021, 0x0294f8b2);
  3684. cx25840_write4(client, DIF_BPF_COEFF2223, 0xfb990825);
  3685. cx25840_write4(client, DIF_BPF_COEFF2425, 0x0698f77f);
  3686. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf6fe0842);
  3687. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0b73f8a7);
  3688. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf25105cd);
  3689. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0f7bfc48);
  3690. cx25840_write4(client, DIF_BPF_COEFF3435, 0xef5a0148);
  3691. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3692. break;
  3693. case 12000000:
  3694. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffe);
  3695. cx25840_write4(client, DIF_BPF_COEFF23, 0x00050010);
  3696. cx25840_write4(client, DIF_BPF_COEFF45, 0xfff2ffcc);
  3697. cx25840_write4(client, DIF_BPF_COEFF67, 0x001b007b);
  3698. cx25840_write4(client, DIF_BPF_COEFF89, 0xffdfff10);
  3699. cx25840_write4(client, DIF_BPF_COEFF1011, 0x00140198);
  3700. cx25840_write4(client, DIF_BPF_COEFF1213, 0x0020fd8e);
  3701. cx25840_write4(client, DIF_BPF_COEFF1415, 0xff710375);
  3702. cx25840_write4(client, DIF_BPF_COEFF1617, 0x014dfb73);
  3703. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfd9a059f);
  3704. cx25840_write4(client, DIF_BPF_COEFF2021, 0x03e0f978);
  3705. cx25840_write4(client, DIF_BPF_COEFF2223, 0xfa4e0726);
  3706. cx25840_write4(client, DIF_BPF_COEFF2425, 0x07c8f8a7);
  3707. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf600070c);
  3708. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0c2ff9c9);
  3709. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf1db04de);
  3710. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0fb4fce5);
  3711. cx25840_write4(client, DIF_BPF_COEFF3435, 0xef4b0111);
  3712. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3713. break;
  3714. case 12100000:
  3715. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
  3716. cx25840_write4(client, DIF_BPF_COEFF23, 0x00010012);
  3717. cx25840_write4(client, DIF_BPF_COEFF45, 0xffffffc8);
  3718. cx25840_write4(client, DIF_BPF_COEFF67, 0xfffb007e);
  3719. cx25840_write4(client, DIF_BPF_COEFF89, 0x001dff14);
  3720. cx25840_write4(client, DIF_BPF_COEFF1011, 0xffad0184);
  3721. cx25840_write4(client, DIF_BPF_COEFF1213, 0x00b7fdbe);
  3722. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfea9031b);
  3723. cx25840_write4(client, DIF_BPF_COEFF1617, 0x0241fc01);
  3724. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfc8504d6);
  3725. cx25840_write4(client, DIF_BPF_COEFF2021, 0x0504fa79);
  3726. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf93005f6);
  3727. cx25840_write4(client, DIF_BPF_COEFF2425, 0x08caf9f2);
  3728. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf52b05c0);
  3729. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0ccbfaf9);
  3730. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf17903eb);
  3731. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0fe3fd83);
  3732. cx25840_write4(client, DIF_BPF_COEFF3435, 0xef3f00db);
  3733. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3734. break;
  3735. case 12200000:
  3736. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
  3737. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffe0011);
  3738. cx25840_write4(client, DIF_BPF_COEFF45, 0x000cffcc);
  3739. cx25840_write4(client, DIF_BPF_COEFF67, 0xffdb0071);
  3740. cx25840_write4(client, DIF_BPF_COEFF89, 0x0058ff32);
  3741. cx25840_write4(client, DIF_BPF_COEFF1011, 0xff4f014a);
  3742. cx25840_write4(client, DIF_BPF_COEFF1213, 0x013cfe1f);
  3743. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfdfb028a);
  3744. cx25840_write4(client, DIF_BPF_COEFF1617, 0x0311fcc9);
  3745. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfb9d03d6);
  3746. cx25840_write4(client, DIF_BPF_COEFF2021, 0x05f4fbad);
  3747. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf848049d);
  3748. cx25840_write4(client, DIF_BPF_COEFF2425, 0x0999fb5b);
  3749. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf4820461);
  3750. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0d46fc32);
  3751. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf12d02f4);
  3752. cx25840_write4(client, DIF_BPF_COEFF3233, 0x1007fe21);
  3753. cx25840_write4(client, DIF_BPF_COEFF3435, 0xef3600a4);
  3754. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3755. break;
  3756. case 12300000:
  3757. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffe);
  3758. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffa000e);
  3759. cx25840_write4(client, DIF_BPF_COEFF45, 0x0017ffd9);
  3760. cx25840_write4(client, DIF_BPF_COEFF67, 0xffc10055);
  3761. cx25840_write4(client, DIF_BPF_COEFF89, 0x0088ff68);
  3762. cx25840_write4(client, DIF_BPF_COEFF1011, 0xff0400f0);
  3763. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01a6fea7);
  3764. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd7501cc);
  3765. cx25840_write4(client, DIF_BPF_COEFF1617, 0x03b0fdc0);
  3766. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfaef02a8);
  3767. cx25840_write4(client, DIF_BPF_COEFF2021, 0x06a7fd07);
  3768. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf79d0326);
  3769. cx25840_write4(client, DIF_BPF_COEFF2425, 0x0a31fcda);
  3770. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf40702f3);
  3771. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0d9ffd72);
  3772. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf0f601fa);
  3773. cx25840_write4(client, DIF_BPF_COEFF3233, 0x1021fec0);
  3774. cx25840_write4(client, DIF_BPF_COEFF3435, 0xef2f006d);
  3775. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3776. break;
  3777. case 12400000:
  3778. cx25840_write4(client, DIF_BPF_COEFF01, 0x0001ffff);
  3779. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff80007);
  3780. cx25840_write4(client, DIF_BPF_COEFF45, 0x001fffeb);
  3781. cx25840_write4(client, DIF_BPF_COEFF67, 0xffaf002d);
  3782. cx25840_write4(client, DIF_BPF_COEFF89, 0x00a8ffb0);
  3783. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfed3007e);
  3784. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01e9ff4c);
  3785. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd2000ee);
  3786. cx25840_write4(client, DIF_BPF_COEFF1617, 0x0413fed8);
  3787. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa82015c);
  3788. cx25840_write4(client, DIF_BPF_COEFF2021, 0x0715fe7d);
  3789. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf7340198);
  3790. cx25840_write4(client, DIF_BPF_COEFF2425, 0x0a8dfe69);
  3791. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf3bd017c);
  3792. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0dd5feb8);
  3793. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf0d500fd);
  3794. cx25840_write4(client, DIF_BPF_COEFF3233, 0x1031ff60);
  3795. cx25840_write4(client, DIF_BPF_COEFF3435, 0xef2b0037);
  3796. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3797. break;
  3798. case 12500000:
  3799. cx25840_write4(client, DIF_BPF_COEFF01, 0x00010000);
  3800. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff70000);
  3801. cx25840_write4(client, DIF_BPF_COEFF45, 0x00220000);
  3802. cx25840_write4(client, DIF_BPF_COEFF67, 0xffa90000);
  3803. cx25840_write4(client, DIF_BPF_COEFF89, 0x00b30000);
  3804. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfec20000);
  3805. cx25840_write4(client, DIF_BPF_COEFF1213, 0x02000000);
  3806. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd030000);
  3807. cx25840_write4(client, DIF_BPF_COEFF1617, 0x04350000);
  3808. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa5e0000);
  3809. cx25840_write4(client, DIF_BPF_COEFF2021, 0x073b0000);
  3810. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf7110000);
  3811. cx25840_write4(client, DIF_BPF_COEFF2425, 0x0aac0000);
  3812. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf3a40000);
  3813. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0de70000);
  3814. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf0c90000);
  3815. cx25840_write4(client, DIF_BPF_COEFF3233, 0x10360000);
  3816. cx25840_write4(client, DIF_BPF_COEFF3435, 0xef290000);
  3817. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3818. break;
  3819. case 12600000:
  3820. cx25840_write4(client, DIF_BPF_COEFF01, 0x00010001);
  3821. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff8fff9);
  3822. cx25840_write4(client, DIF_BPF_COEFF45, 0x001f0015);
  3823. cx25840_write4(client, DIF_BPF_COEFF67, 0xffafffd3);
  3824. cx25840_write4(client, DIF_BPF_COEFF89, 0x00a80050);
  3825. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfed3ff82);
  3826. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01e900b4);
  3827. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd20ff12);
  3828. cx25840_write4(client, DIF_BPF_COEFF1617, 0x04130128);
  3829. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa82fea4);
  3830. cx25840_write4(client, DIF_BPF_COEFF2021, 0x07150183);
  3831. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf734fe68);
  3832. cx25840_write4(client, DIF_BPF_COEFF2425, 0x0a8d0197);
  3833. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf3bdfe84);
  3834. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0dd50148);
  3835. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf0d5ff03);
  3836. cx25840_write4(client, DIF_BPF_COEFF3233, 0x103100a0);
  3837. cx25840_write4(client, DIF_BPF_COEFF3435, 0xef2bffc9);
  3838. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3839. break;
  3840. case 12700000:
  3841. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000002);
  3842. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffafff2);
  3843. cx25840_write4(client, DIF_BPF_COEFF45, 0x00170027);
  3844. cx25840_write4(client, DIF_BPF_COEFF67, 0xffc1ffab);
  3845. cx25840_write4(client, DIF_BPF_COEFF89, 0x00880098);
  3846. cx25840_write4(client, DIF_BPF_COEFF1011, 0xff04ff10);
  3847. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01a60159);
  3848. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd75fe34);
  3849. cx25840_write4(client, DIF_BPF_COEFF1617, 0x03b00240);
  3850. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfaeffd58);
  3851. cx25840_write4(client, DIF_BPF_COEFF2021, 0x06a702f9);
  3852. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf79dfcda);
  3853. cx25840_write4(client, DIF_BPF_COEFF2425, 0x0a310326);
  3854. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf407fd0d);
  3855. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0d9f028e);
  3856. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf0f6fe06);
  3857. cx25840_write4(client, DIF_BPF_COEFF3233, 0x10210140);
  3858. cx25840_write4(client, DIF_BPF_COEFF3435, 0xef2fff93);
  3859. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3860. break;
  3861. case 12800000:
  3862. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
  3863. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffeffef);
  3864. cx25840_write4(client, DIF_BPF_COEFF45, 0x000c0034);
  3865. cx25840_write4(client, DIF_BPF_COEFF67, 0xffdbff8f);
  3866. cx25840_write4(client, DIF_BPF_COEFF89, 0x005800ce);
  3867. cx25840_write4(client, DIF_BPF_COEFF1011, 0xff4ffeb6);
  3868. cx25840_write4(client, DIF_BPF_COEFF1213, 0x013c01e1);
  3869. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfdfbfd76);
  3870. cx25840_write4(client, DIF_BPF_COEFF1617, 0x03110337);
  3871. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfb9dfc2a);
  3872. cx25840_write4(client, DIF_BPF_COEFF2021, 0x05f40453);
  3873. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf848fb63);
  3874. cx25840_write4(client, DIF_BPF_COEFF2425, 0x099904a5);
  3875. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf482fb9f);
  3876. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0d4603ce);
  3877. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf12dfd0c);
  3878. cx25840_write4(client, DIF_BPF_COEFF3233, 0x100701df);
  3879. cx25840_write4(client, DIF_BPF_COEFF3435, 0xef36ff5c);
  3880. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3881. break;
  3882. case 12900000:
  3883. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
  3884. cx25840_write4(client, DIF_BPF_COEFF23, 0x0001ffee);
  3885. cx25840_write4(client, DIF_BPF_COEFF45, 0xffff0038);
  3886. cx25840_write4(client, DIF_BPF_COEFF67, 0xfffbff82);
  3887. cx25840_write4(client, DIF_BPF_COEFF89, 0x001d00ec);
  3888. cx25840_write4(client, DIF_BPF_COEFF1011, 0xffadfe7c);
  3889. cx25840_write4(client, DIF_BPF_COEFF1213, 0x00b70242);
  3890. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfea9fce5);
  3891. cx25840_write4(client, DIF_BPF_COEFF1617, 0x024103ff);
  3892. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfc85fb2a);
  3893. cx25840_write4(client, DIF_BPF_COEFF2021, 0x05040587);
  3894. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf930fa0a);
  3895. cx25840_write4(client, DIF_BPF_COEFF2425, 0x08ca060e);
  3896. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf52bfa40);
  3897. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0ccb0507);
  3898. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf179fc15);
  3899. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0fe3027d);
  3900. cx25840_write4(client, DIF_BPF_COEFF3435, 0xef3fff25);
  3901. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3902. break;
  3903. case 13000000:
  3904. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000002);
  3905. cx25840_write4(client, DIF_BPF_COEFF23, 0x0005fff0);
  3906. cx25840_write4(client, DIF_BPF_COEFF45, 0xfff20034);
  3907. cx25840_write4(client, DIF_BPF_COEFF67, 0x001bff85);
  3908. cx25840_write4(client, DIF_BPF_COEFF89, 0xffdf00f0);
  3909. cx25840_write4(client, DIF_BPF_COEFF1011, 0x0014fe68);
  3910. cx25840_write4(client, DIF_BPF_COEFF1213, 0x00200272);
  3911. cx25840_write4(client, DIF_BPF_COEFF1415, 0xff71fc8b);
  3912. cx25840_write4(client, DIF_BPF_COEFF1617, 0x014d048d);
  3913. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfd9afa61);
  3914. cx25840_write4(client, DIF_BPF_COEFF2021, 0x03e00688);
  3915. cx25840_write4(client, DIF_BPF_COEFF2223, 0xfa4ef8da);
  3916. cx25840_write4(client, DIF_BPF_COEFF2425, 0x07c80759);
  3917. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf600f8f4);
  3918. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0c2f0637);
  3919. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf1dbfb22);
  3920. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0fb4031b);
  3921. cx25840_write4(client, DIF_BPF_COEFF3435, 0xef4bfeef);
  3922. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3923. break;
  3924. case 13100000:
  3925. cx25840_write4(client, DIF_BPF_COEFF01, 0xffff0001);
  3926. cx25840_write4(client, DIF_BPF_COEFF23, 0x0007fff5);
  3927. cx25840_write4(client, DIF_BPF_COEFF45, 0xffe70028);
  3928. cx25840_write4(client, DIF_BPF_COEFF67, 0x0037ff98);
  3929. cx25840_write4(client, DIF_BPF_COEFF89, 0xffa400d8);
  3930. cx25840_write4(client, DIF_BPF_COEFF1011, 0x0079fe7c);
  3931. cx25840_write4(client, DIF_BPF_COEFF1213, 0xff87026f);
  3932. cx25840_write4(client, DIF_BPF_COEFF1415, 0x0043fc6e);
  3933. cx25840_write4(client, DIF_BPF_COEFF1617, 0x004404da);
  3934. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfecef9da);
  3935. cx25840_write4(client, DIF_BPF_COEFF2021, 0x0294074e);
  3936. cx25840_write4(client, DIF_BPF_COEFF2223, 0xfb99f7db);
  3937. cx25840_write4(client, DIF_BPF_COEFF2425, 0x06980881);
  3938. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf6fef7be);
  3939. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0b730759);
  3940. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf251fa33);
  3941. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0f7b03b8);
  3942. cx25840_write4(client, DIF_BPF_COEFF3435, 0xef5afeb8);
  3943. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3944. break;
  3945. case 13200000:
  3946. cx25840_write4(client, DIF_BPF_COEFF01, 0xffff0000);
  3947. cx25840_write4(client, DIF_BPF_COEFF23, 0x0008fffc);
  3948. cx25840_write4(client, DIF_BPF_COEFF45, 0xffe00017);
  3949. cx25840_write4(client, DIF_BPF_COEFF67, 0x004cffb9);
  3950. cx25840_write4(client, DIF_BPF_COEFF89, 0xff7500a8);
  3951. cx25840_write4(client, DIF_BPF_COEFF1011, 0x00d1feb6);
  3952. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfef90238);
  3953. cx25840_write4(client, DIF_BPF_COEFF1415, 0x0111fc91);
  3954. cx25840_write4(client, DIF_BPF_COEFF1617, 0xff3604df);
  3955. cx25840_write4(client, DIF_BPF_COEFF1819, 0x0012f99b);
  3956. cx25840_write4(client, DIF_BPF_COEFF2021, 0x012d07d2);
  3957. cx25840_write4(client, DIF_BPF_COEFF2223, 0xfd07f714);
  3958. cx25840_write4(client, DIF_BPF_COEFF2425, 0x0542097e);
  3959. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf81ff6a4);
  3960. cx25840_write4(client, DIF_BPF_COEFF2829, 0x0a9a086e);
  3961. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf2dbf94b);
  3962. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0f380453);
  3963. cx25840_write4(client, DIF_BPF_COEFF3435, 0xef6cfe82);
  3964. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3965. break;
  3966. case 13300000:
  3967. cx25840_write4(client, DIF_BPF_COEFF01, 0xffffffff);
  3968. cx25840_write4(client, DIF_BPF_COEFF23, 0x00080003);
  3969. cx25840_write4(client, DIF_BPF_COEFF45, 0xffde0001);
  3970. cx25840_write4(client, DIF_BPF_COEFF67, 0x0056ffe3);
  3971. cx25840_write4(client, DIF_BPF_COEFF89, 0xff570064);
  3972. cx25840_write4(client, DIF_BPF_COEFF1011, 0x0113ff10);
  3973. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe8201d2);
  3974. cx25840_write4(client, DIF_BPF_COEFF1415, 0x01cafcf0);
  3975. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfe35049e);
  3976. cx25840_write4(client, DIF_BPF_COEFF1819, 0x0155f9a6);
  3977. cx25840_write4(client, DIF_BPF_COEFF2021, 0xffba080e);
  3978. cx25840_write4(client, DIF_BPF_COEFF2223, 0xfe8cf689);
  3979. cx25840_write4(client, DIF_BPF_COEFF2425, 0x03ce0a4e);
  3980. cx25840_write4(client, DIF_BPF_COEFF2627, 0xf961f5a8);
  3981. cx25840_write4(client, DIF_BPF_COEFF2829, 0x09a50971);
  3982. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf379f869);
  3983. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0eeb04ec);
  3984. cx25840_write4(client, DIF_BPF_COEFF3435, 0xef80fe4b);
  3985. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  3986. break;
  3987. case 13400000:
  3988. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffe);
  3989. cx25840_write4(client, DIF_BPF_COEFF23, 0x0007000a);
  3990. cx25840_write4(client, DIF_BPF_COEFF45, 0xffe2ffec);
  3991. cx25840_write4(client, DIF_BPF_COEFF67, 0x00540012);
  3992. cx25840_write4(client, DIF_BPF_COEFF89, 0xff4e0015);
  3993. cx25840_write4(client, DIF_BPF_COEFF1011, 0x0137ff82);
  3994. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe2e0145);
  3995. cx25840_write4(client, DIF_BPF_COEFF1415, 0x0260fd86);
  3996. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfd51041a);
  3997. cx25840_write4(client, DIF_BPF_COEFF1819, 0x0287f9fb);
  3998. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfe4a0802);
  3999. cx25840_write4(client, DIF_BPF_COEFF2223, 0x001df63f);
  4000. cx25840_write4(client, DIF_BPF_COEFF2425, 0x02430aeb);
  4001. cx25840_write4(client, DIF_BPF_COEFF2627, 0xfabdf4ce);
  4002. cx25840_write4(client, DIF_BPF_COEFF2829, 0x08970a62);
  4003. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf428f78f);
  4004. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0e950584);
  4005. cx25840_write4(client, DIF_BPF_COEFF3435, 0xef97fe15);
  4006. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4007. break;
  4008. case 13500000:
  4009. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
  4010. cx25840_write4(client, DIF_BPF_COEFF23, 0x0004000f);
  4011. cx25840_write4(client, DIF_BPF_COEFF45, 0xffeaffda);
  4012. cx25840_write4(client, DIF_BPF_COEFF67, 0x0046003d);
  4013. cx25840_write4(client, DIF_BPF_COEFF89, 0xff5affc4);
  4014. cx25840_write4(client, DIF_BPF_COEFF1011, 0x013b0000);
  4015. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe04009d);
  4016. cx25840_write4(client, DIF_BPF_COEFF1415, 0x02c8fe48);
  4017. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc99035a);
  4018. cx25840_write4(client, DIF_BPF_COEFF1819, 0x0397fa96);
  4019. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfcec07ad);
  4020. cx25840_write4(client, DIF_BPF_COEFF2223, 0x01adf637);
  4021. cx25840_write4(client, DIF_BPF_COEFF2425, 0x00ac0b53);
  4022. cx25840_write4(client, DIF_BPF_COEFF2627, 0xfc2ef419);
  4023. cx25840_write4(client, DIF_BPF_COEFF2829, 0x07730b3e);
  4024. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf4e9f6bd);
  4025. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0e35061a);
  4026. cx25840_write4(client, DIF_BPF_COEFF3435, 0xefb1fddf);
  4027. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4028. break;
  4029. case 13600000:
  4030. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
  4031. cx25840_write4(client, DIF_BPF_COEFF23, 0x00000012);
  4032. cx25840_write4(client, DIF_BPF_COEFF45, 0xfff6ffcd);
  4033. cx25840_write4(client, DIF_BPF_COEFF67, 0x002f0061);
  4034. cx25840_write4(client, DIF_BPF_COEFF89, 0xff7bff79);
  4035. cx25840_write4(client, DIF_BPF_COEFF1011, 0x011e007e);
  4036. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe08ffe8);
  4037. cx25840_write4(client, DIF_BPF_COEFF1415, 0x02f9ff28);
  4038. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc17026a);
  4039. cx25840_write4(client, DIF_BPF_COEFF1819, 0x0479fb70);
  4040. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfbad0713);
  4041. cx25840_write4(client, DIF_BPF_COEFF2223, 0x032ff672);
  4042. cx25840_write4(client, DIF_BPF_COEFF2425, 0xff100b83);
  4043. cx25840_write4(client, DIF_BPF_COEFF2627, 0xfdaff38b);
  4044. cx25840_write4(client, DIF_BPF_COEFF2829, 0x063c0c04);
  4045. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf5baf5f5);
  4046. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0dcc06ae);
  4047. cx25840_write4(client, DIF_BPF_COEFF3435, 0xefcdfda8);
  4048. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4049. break;
  4050. case 13700000:
  4051. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
  4052. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffd0012);
  4053. cx25840_write4(client, DIF_BPF_COEFF45, 0x0004ffc8);
  4054. cx25840_write4(client, DIF_BPF_COEFF67, 0x00100078);
  4055. cx25840_write4(client, DIF_BPF_COEFF89, 0xffacff3e);
  4056. cx25840_write4(client, DIF_BPF_COEFF1011, 0x00e200f0);
  4057. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe39ff35);
  4058. cx25840_write4(client, DIF_BPF_COEFF1415, 0x02f10017);
  4059. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfbd30156);
  4060. cx25840_write4(client, DIF_BPF_COEFF1819, 0x0521fc7f);
  4061. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfa9c0638);
  4062. cx25840_write4(client, DIF_BPF_COEFF2223, 0x0499f6ee);
  4063. cx25840_write4(client, DIF_BPF_COEFF2425, 0xfd7a0b7c);
  4064. cx25840_write4(client, DIF_BPF_COEFF2627, 0xff39f325);
  4065. cx25840_write4(client, DIF_BPF_COEFF2829, 0x04f40cb3);
  4066. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf69af537);
  4067. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0d5a073f);
  4068. cx25840_write4(client, DIF_BPF_COEFF3435, 0xefecfd72);
  4069. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4070. break;
  4071. case 13800000:
  4072. cx25840_write4(client, DIF_BPF_COEFF01, 0x0001fffe);
  4073. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffa000e);
  4074. cx25840_write4(client, DIF_BPF_COEFF45, 0x0011ffcb);
  4075. cx25840_write4(client, DIF_BPF_COEFF67, 0xfff0007f);
  4076. cx25840_write4(client, DIF_BPF_COEFF89, 0xffe7ff19);
  4077. cx25840_write4(client, DIF_BPF_COEFF1011, 0x008f014a);
  4078. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe94fe93);
  4079. cx25840_write4(client, DIF_BPF_COEFF1415, 0x02b00105);
  4080. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfbd3002f);
  4081. cx25840_write4(client, DIF_BPF_COEFF1819, 0x0585fdb7);
  4082. cx25840_write4(client, DIF_BPF_COEFF2021, 0xf9c10525);
  4083. cx25840_write4(client, DIF_BPF_COEFF2223, 0x05def7a8);
  4084. cx25840_write4(client, DIF_BPF_COEFF2425, 0xfbf20b3c);
  4085. cx25840_write4(client, DIF_BPF_COEFF2627, 0x00c7f2e9);
  4086. cx25840_write4(client, DIF_BPF_COEFF2829, 0x03a00d48);
  4087. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf787f484);
  4088. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0cdf07cd);
  4089. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf00dfd3c);
  4090. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4091. break;
  4092. case 13900000:
  4093. cx25840_write4(client, DIF_BPF_COEFF01, 0x00010000);
  4094. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff80008);
  4095. cx25840_write4(client, DIF_BPF_COEFF45, 0x001bffd7);
  4096. cx25840_write4(client, DIF_BPF_COEFF67, 0xffd10076);
  4097. cx25840_write4(client, DIF_BPF_COEFF89, 0x0026ff0e);
  4098. cx25840_write4(client, DIF_BPF_COEFF1011, 0x002c0184);
  4099. cx25840_write4(client, DIF_BPF_COEFF1213, 0xff0ffe10);
  4100. cx25840_write4(client, DIF_BPF_COEFF1415, 0x023b01e0);
  4101. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc17ff06);
  4102. cx25840_write4(client, DIF_BPF_COEFF1819, 0x05a2ff09);
  4103. cx25840_write4(client, DIF_BPF_COEFF2021, 0xf92703e4);
  4104. cx25840_write4(client, DIF_BPF_COEFF2223, 0x06f4f89b);
  4105. cx25840_write4(client, DIF_BPF_COEFF2425, 0xfa820ac5);
  4106. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0251f2d9);
  4107. cx25840_write4(client, DIF_BPF_COEFF2829, 0x02430dc3);
  4108. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf881f3dc);
  4109. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0c5c0859);
  4110. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf031fd06);
  4111. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4112. break;
  4113. case 14000000:
  4114. cx25840_write4(client, DIF_BPF_COEFF01, 0x00010001);
  4115. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff80001);
  4116. cx25840_write4(client, DIF_BPF_COEFF45, 0x0021ffe8);
  4117. cx25840_write4(client, DIF_BPF_COEFF67, 0xffba005d);
  4118. cx25840_write4(client, DIF_BPF_COEFF89, 0x0060ff1f);
  4119. cx25840_write4(client, DIF_BPF_COEFF1011, 0xffc40198);
  4120. cx25840_write4(client, DIF_BPF_COEFF1213, 0xffa0fdb5);
  4121. cx25840_write4(client, DIF_BPF_COEFF1415, 0x019a029a);
  4122. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc99fdea);
  4123. cx25840_write4(client, DIF_BPF_COEFF1819, 0x05750067);
  4124. cx25840_write4(client, DIF_BPF_COEFF2021, 0xf8d4027f);
  4125. cx25840_write4(client, DIF_BPF_COEFF2223, 0x07d4f9c0);
  4126. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf9320a1a);
  4127. cx25840_write4(client, DIF_BPF_COEFF2627, 0x03d2f2f3);
  4128. cx25840_write4(client, DIF_BPF_COEFF2829, 0x00df0e22);
  4129. cx25840_write4(client, DIF_BPF_COEFF3031, 0xf986f341);
  4130. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0bd108e2);
  4131. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf058fcd1);
  4132. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4133. break;
  4134. case 14100000:
  4135. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000002);
  4136. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff9fffa);
  4137. cx25840_write4(client, DIF_BPF_COEFF45, 0x0021fffd);
  4138. cx25840_write4(client, DIF_BPF_COEFF67, 0xffac0038);
  4139. cx25840_write4(client, DIF_BPF_COEFF89, 0x008eff4a);
  4140. cx25840_write4(client, DIF_BPF_COEFF1011, 0xff630184);
  4141. cx25840_write4(client, DIF_BPF_COEFF1213, 0x003afd8b);
  4142. cx25840_write4(client, DIF_BPF_COEFF1415, 0x00da0326);
  4143. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfd51fced);
  4144. cx25840_write4(client, DIF_BPF_COEFF1819, 0x050101c0);
  4145. cx25840_write4(client, DIF_BPF_COEFF2021, 0xf8cb0103);
  4146. cx25840_write4(client, DIF_BPF_COEFF2223, 0x0876fb10);
  4147. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf80a093e);
  4148. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0543f338);
  4149. cx25840_write4(client, DIF_BPF_COEFF2829, 0xff7a0e66);
  4150. cx25840_write4(client, DIF_BPF_COEFF3031, 0xfa94f2b2);
  4151. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0b3f0967);
  4152. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf081fc9b);
  4153. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4154. break;
  4155. case 14200000:
  4156. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
  4157. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffbfff3);
  4158. cx25840_write4(client, DIF_BPF_COEFF45, 0x001d0013);
  4159. cx25840_write4(client, DIF_BPF_COEFF67, 0xffaa000b);
  4160. cx25840_write4(client, DIF_BPF_COEFF89, 0x00aaff89);
  4161. cx25840_write4(client, DIF_BPF_COEFF1011, 0xff13014a);
  4162. cx25840_write4(client, DIF_BPF_COEFF1213, 0x00cefd95);
  4163. cx25840_write4(client, DIF_BPF_COEFF1415, 0x000a037b);
  4164. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfe35fc1d);
  4165. cx25840_write4(client, DIF_BPF_COEFF1819, 0x044c0305);
  4166. cx25840_write4(client, DIF_BPF_COEFF2021, 0xf90cff7e);
  4167. cx25840_write4(client, DIF_BPF_COEFF2223, 0x08d5fc81);
  4168. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf7100834);
  4169. cx25840_write4(client, DIF_BPF_COEFF2627, 0x069ff3a7);
  4170. cx25840_write4(client, DIF_BPF_COEFF2829, 0xfe160e8d);
  4171. cx25840_write4(client, DIF_BPF_COEFF3031, 0xfbaaf231);
  4172. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0aa509e9);
  4173. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf0adfc65);
  4174. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4175. break;
  4176. case 14300000:
  4177. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
  4178. cx25840_write4(client, DIF_BPF_COEFF23, 0xffffffef);
  4179. cx25840_write4(client, DIF_BPF_COEFF45, 0x00140025);
  4180. cx25840_write4(client, DIF_BPF_COEFF67, 0xffb4ffdd);
  4181. cx25840_write4(client, DIF_BPF_COEFF89, 0x00b2ffd6);
  4182. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfedb00f0);
  4183. cx25840_write4(client, DIF_BPF_COEFF1213, 0x0150fdd3);
  4184. cx25840_write4(client, DIF_BPF_COEFF1415, 0xff380391);
  4185. cx25840_write4(client, DIF_BPF_COEFF1617, 0xff36fb85);
  4186. cx25840_write4(client, DIF_BPF_COEFF1819, 0x035e0426);
  4187. cx25840_write4(client, DIF_BPF_COEFF2021, 0xf994fdfe);
  4188. cx25840_write4(client, DIF_BPF_COEFF2223, 0x08eefe0b);
  4189. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf6490702);
  4190. cx25840_write4(client, DIF_BPF_COEFF2627, 0x07e1f43e);
  4191. cx25840_write4(client, DIF_BPF_COEFF2829, 0xfcb60e97);
  4192. cx25840_write4(client, DIF_BPF_COEFF3031, 0xfcc6f1be);
  4193. cx25840_write4(client, DIF_BPF_COEFF3233, 0x0a040a67);
  4194. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf0dbfc30);
  4195. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4196. break;
  4197. case 14400000:
  4198. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
  4199. cx25840_write4(client, DIF_BPF_COEFF23, 0x0002ffee);
  4200. cx25840_write4(client, DIF_BPF_COEFF45, 0x00070033);
  4201. cx25840_write4(client, DIF_BPF_COEFF67, 0xffc9ffb4);
  4202. cx25840_write4(client, DIF_BPF_COEFF89, 0x00a40027);
  4203. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfec3007e);
  4204. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01b4fe3f);
  4205. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfe760369);
  4206. cx25840_write4(client, DIF_BPF_COEFF1617, 0x0044fb2e);
  4207. cx25840_write4(client, DIF_BPF_COEFF1819, 0x02450518);
  4208. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfa5ffc90);
  4209. cx25840_write4(client, DIF_BPF_COEFF2223, 0x08c1ffa1);
  4210. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf5bc05ae);
  4211. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0902f4fc);
  4212. cx25840_write4(client, DIF_BPF_COEFF2829, 0xfb600e85);
  4213. cx25840_write4(client, DIF_BPF_COEFF3031, 0xfde7f15a);
  4214. cx25840_write4(client, DIF_BPF_COEFF3233, 0x095d0ae2);
  4215. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf10cfbfb);
  4216. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4217. break;
  4218. case 14500000:
  4219. cx25840_write4(client, DIF_BPF_COEFF01, 0xffff0002);
  4220. cx25840_write4(client, DIF_BPF_COEFF23, 0x0005ffef);
  4221. cx25840_write4(client, DIF_BPF_COEFF45, 0xfffa0038);
  4222. cx25840_write4(client, DIF_BPF_COEFF67, 0xffe5ff95);
  4223. cx25840_write4(client, DIF_BPF_COEFF89, 0x00820074);
  4224. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfecc0000);
  4225. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01f0fed0);
  4226. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfdd20304);
  4227. cx25840_write4(client, DIF_BPF_COEFF1617, 0x014dfb1d);
  4228. cx25840_write4(client, DIF_BPF_COEFF1819, 0x010e05ce);
  4229. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfb64fb41);
  4230. cx25840_write4(client, DIF_BPF_COEFF2223, 0x084e013b);
  4231. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf569043e);
  4232. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0a00f5dd);
  4233. cx25840_write4(client, DIF_BPF_COEFF2829, 0xfa150e55);
  4234. cx25840_write4(client, DIF_BPF_COEFF3031, 0xff0bf104);
  4235. cx25840_write4(client, DIF_BPF_COEFF3233, 0x08b00b59);
  4236. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf13ffbc6);
  4237. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4238. break;
  4239. case 14600000:
  4240. cx25840_write4(client, DIF_BPF_COEFF01, 0xffff0001);
  4241. cx25840_write4(client, DIF_BPF_COEFF23, 0x0008fff4);
  4242. cx25840_write4(client, DIF_BPF_COEFF45, 0xffed0035);
  4243. cx25840_write4(client, DIF_BPF_COEFF67, 0x0005ff83);
  4244. cx25840_write4(client, DIF_BPF_COEFF89, 0x005000b4);
  4245. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfef6ff82);
  4246. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01ffff7a);
  4247. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd580269);
  4248. cx25840_write4(client, DIF_BPF_COEFF1617, 0x0241fb53);
  4249. cx25840_write4(client, DIF_BPF_COEFF1819, 0xffca0640);
  4250. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfc99fa1e);
  4251. cx25840_write4(client, DIF_BPF_COEFF2223, 0x079a02cb);
  4252. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf55502ba);
  4253. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0ad5f6e0);
  4254. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf8d90e0a);
  4255. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0031f0bd);
  4256. cx25840_write4(client, DIF_BPF_COEFF3233, 0x07fd0bcb);
  4257. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf174fb91);
  4258. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4259. break;
  4260. case 14700000:
  4261. cx25840_write4(client, DIF_BPF_COEFF01, 0xffffffff);
  4262. cx25840_write4(client, DIF_BPF_COEFF23, 0x0009fffb);
  4263. cx25840_write4(client, DIF_BPF_COEFF45, 0xffe4002a);
  4264. cx25840_write4(client, DIF_BPF_COEFF67, 0x0025ff82);
  4265. cx25840_write4(client, DIF_BPF_COEFF89, 0x001400e0);
  4266. cx25840_write4(client, DIF_BPF_COEFF1011, 0xff3cff10);
  4267. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01e10030);
  4268. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd1201a4);
  4269. cx25840_write4(client, DIF_BPF_COEFF1617, 0x0311fbcd);
  4270. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfe88066a);
  4271. cx25840_write4(client, DIF_BPF_COEFF2021, 0xfdf1f92f);
  4272. cx25840_write4(client, DIF_BPF_COEFF2223, 0x06aa0449);
  4273. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf57e0128);
  4274. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0b7ef801);
  4275. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf7b00da2);
  4276. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0156f086);
  4277. cx25840_write4(client, DIF_BPF_COEFF3233, 0x07450c39);
  4278. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf1acfb5c);
  4279. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4280. break;
  4281. case 14800000:
  4282. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffe);
  4283. cx25840_write4(client, DIF_BPF_COEFF23, 0x00080002);
  4284. cx25840_write4(client, DIF_BPF_COEFF45, 0xffdf0019);
  4285. cx25840_write4(client, DIF_BPF_COEFF67, 0x003fff92);
  4286. cx25840_write4(client, DIF_BPF_COEFF89, 0xffd600f1);
  4287. cx25840_write4(client, DIF_BPF_COEFF1011, 0xff96feb6);
  4288. cx25840_write4(client, DIF_BPF_COEFF1213, 0x019700e1);
  4289. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd0500c2);
  4290. cx25840_write4(client, DIF_BPF_COEFF1617, 0x03b0fc84);
  4291. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfd590649);
  4292. cx25840_write4(client, DIF_BPF_COEFF2021, 0xff5df87f);
  4293. cx25840_write4(client, DIF_BPF_COEFF2223, 0x058505aa);
  4294. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf5e4ff91);
  4295. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0bf9f93c);
  4296. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf69d0d20);
  4297. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0279f05e);
  4298. cx25840_write4(client, DIF_BPF_COEFF3233, 0x06880ca3);
  4299. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf1e6fb28);
  4300. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4301. break;
  4302. case 14900000:
  4303. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
  4304. cx25840_write4(client, DIF_BPF_COEFF23, 0x00060009);
  4305. cx25840_write4(client, DIF_BPF_COEFF45, 0xffdf0004);
  4306. cx25840_write4(client, DIF_BPF_COEFF67, 0x0051ffb0);
  4307. cx25840_write4(client, DIF_BPF_COEFF89, 0xff9d00e8);
  4308. cx25840_write4(client, DIF_BPF_COEFF1011, 0xfffcfe7c);
  4309. cx25840_write4(client, DIF_BPF_COEFF1213, 0x01280180);
  4310. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd32ffd2);
  4311. cx25840_write4(client, DIF_BPF_COEFF1617, 0x0413fd6e);
  4312. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfc4d05df);
  4313. cx25840_write4(client, DIF_BPF_COEFF2021, 0x00d1f812);
  4314. cx25840_write4(client, DIF_BPF_COEFF2223, 0x043506e4);
  4315. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf685fdfb);
  4316. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0c43fa8d);
  4317. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf5a10c83);
  4318. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0399f046);
  4319. cx25840_write4(client, DIF_BPF_COEFF3233, 0x05c70d08);
  4320. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf222faf3);
  4321. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4322. break;
  4323. case 15000000:
  4324. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
  4325. cx25840_write4(client, DIF_BPF_COEFF23, 0x0003000f);
  4326. cx25840_write4(client, DIF_BPF_COEFF45, 0xffe5ffef);
  4327. cx25840_write4(client, DIF_BPF_COEFF67, 0x0057ffd9);
  4328. cx25840_write4(client, DIF_BPF_COEFF89, 0xff7000c4);
  4329. cx25840_write4(client, DIF_BPF_COEFF1011, 0x0062fe68);
  4330. cx25840_write4(client, DIF_BPF_COEFF1213, 0x009e01ff);
  4331. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd95fee6);
  4332. cx25840_write4(client, DIF_BPF_COEFF1617, 0x0435fe7d);
  4333. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfb710530);
  4334. cx25840_write4(client, DIF_BPF_COEFF2021, 0x023cf7ee);
  4335. cx25840_write4(client, DIF_BPF_COEFF2223, 0x02c307ef);
  4336. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf75efc70);
  4337. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0c5cfbef);
  4338. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf4c10bce);
  4339. cx25840_write4(client, DIF_BPF_COEFF3031, 0x04b3f03f);
  4340. cx25840_write4(client, DIF_BPF_COEFF3233, 0x05030d69);
  4341. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf261fabf);
  4342. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4343. break;
  4344. case 15100000:
  4345. cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
  4346. cx25840_write4(client, DIF_BPF_COEFF23, 0xffff0012);
  4347. cx25840_write4(client, DIF_BPF_COEFF45, 0xffefffdc);
  4348. cx25840_write4(client, DIF_BPF_COEFF67, 0x00510006);
  4349. cx25840_write4(client, DIF_BPF_COEFF89, 0xff540089);
  4350. cx25840_write4(client, DIF_BPF_COEFF1011, 0x00befe7c);
  4351. cx25840_write4(client, DIF_BPF_COEFF1213, 0x00060253);
  4352. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfe27fe0d);
  4353. cx25840_write4(client, DIF_BPF_COEFF1617, 0x0413ffa2);
  4354. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfad10446);
  4355. cx25840_write4(client, DIF_BPF_COEFF2021, 0x0390f812);
  4356. cx25840_write4(client, DIF_BPF_COEFF2223, 0x013b08c3);
  4357. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf868faf6);
  4358. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0c43fd5f);
  4359. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf3fd0b02);
  4360. cx25840_write4(client, DIF_BPF_COEFF3031, 0x05c7f046);
  4361. cx25840_write4(client, DIF_BPF_COEFF3233, 0x043b0dc4);
  4362. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf2a1fa8b);
  4363. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4364. break;
  4365. case 15200000:
  4366. cx25840_write4(client, DIF_BPF_COEFF01, 0x0001fffe);
  4367. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffc0012);
  4368. cx25840_write4(client, DIF_BPF_COEFF45, 0xfffbffce);
  4369. cx25840_write4(client, DIF_BPF_COEFF67, 0x003f0033);
  4370. cx25840_write4(client, DIF_BPF_COEFF89, 0xff4e003f);
  4371. cx25840_write4(client, DIF_BPF_COEFF1011, 0x0106feb6);
  4372. cx25840_write4(client, DIF_BPF_COEFF1213, 0xff6e0276);
  4373. cx25840_write4(client, DIF_BPF_COEFF1415, 0xfeddfd56);
  4374. cx25840_write4(client, DIF_BPF_COEFF1617, 0x03b000cc);
  4375. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa740329);
  4376. cx25840_write4(client, DIF_BPF_COEFF2021, 0x04bff87f);
  4377. cx25840_write4(client, DIF_BPF_COEFF2223, 0xffaa095d);
  4378. cx25840_write4(client, DIF_BPF_COEFF2425, 0xf99ef995);
  4379. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0bf9fed8);
  4380. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf3590a1f);
  4381. cx25840_write4(client, DIF_BPF_COEFF3031, 0x06d2f05e);
  4382. cx25840_write4(client, DIF_BPF_COEFF3233, 0x03700e1b);
  4383. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf2e4fa58);
  4384. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4385. break;
  4386. case 15300000:
  4387. cx25840_write4(client, DIF_BPF_COEFF01, 0x0001ffff);
  4388. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff9000f);
  4389. cx25840_write4(client, DIF_BPF_COEFF45, 0x0009ffc8);
  4390. cx25840_write4(client, DIF_BPF_COEFF67, 0x00250059);
  4391. cx25840_write4(client, DIF_BPF_COEFF89, 0xff5effee);
  4392. cx25840_write4(client, DIF_BPF_COEFF1011, 0x0132ff10);
  4393. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfee30265);
  4394. cx25840_write4(client, DIF_BPF_COEFF1415, 0xffaafccf);
  4395. cx25840_write4(client, DIF_BPF_COEFF1617, 0x031101eb);
  4396. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa6001e8);
  4397. cx25840_write4(client, DIF_BPF_COEFF2021, 0x05bdf92f);
  4398. cx25840_write4(client, DIF_BPF_COEFF2223, 0xfe1b09b6);
  4399. cx25840_write4(client, DIF_BPF_COEFF2425, 0xfafaf852);
  4400. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0b7e0055);
  4401. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf2d50929);
  4402. cx25840_write4(client, DIF_BPF_COEFF3031, 0x07d3f086);
  4403. cx25840_write4(client, DIF_BPF_COEFF3233, 0x02a30e6c);
  4404. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf329fa24);
  4405. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4406. break;
  4407. case 15400000:
  4408. cx25840_write4(client, DIF_BPF_COEFF01, 0x00010001);
  4409. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff80009);
  4410. cx25840_write4(client, DIF_BPF_COEFF45, 0x0015ffca);
  4411. cx25840_write4(client, DIF_BPF_COEFF67, 0x00050074);
  4412. cx25840_write4(client, DIF_BPF_COEFF89, 0xff81ff9f);
  4413. cx25840_write4(client, DIF_BPF_COEFF1011, 0x013dff82);
  4414. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe710221);
  4415. cx25840_write4(client, DIF_BPF_COEFF1415, 0x007cfc80);
  4416. cx25840_write4(client, DIF_BPF_COEFF1617, 0x024102ed);
  4417. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa940090);
  4418. cx25840_write4(client, DIF_BPF_COEFF2021, 0x0680fa1e);
  4419. cx25840_write4(client, DIF_BPF_COEFF2223, 0xfc9b09cd);
  4420. cx25840_write4(client, DIF_BPF_COEFF2425, 0xfc73f736);
  4421. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0ad501d0);
  4422. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf2740820);
  4423. cx25840_write4(client, DIF_BPF_COEFF3031, 0x08c9f0bd);
  4424. cx25840_write4(client, DIF_BPF_COEFF3233, 0x01d40eb9);
  4425. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf371f9f1);
  4426. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4427. break;
  4428. case 15500000:
  4429. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000002);
  4430. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff80002);
  4431. cx25840_write4(client, DIF_BPF_COEFF45, 0x001effd5);
  4432. cx25840_write4(client, DIF_BPF_COEFF67, 0xffe5007f);
  4433. cx25840_write4(client, DIF_BPF_COEFF89, 0xffb4ff5b);
  4434. cx25840_write4(client, DIF_BPF_COEFF1011, 0x01280000);
  4435. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe2401b0);
  4436. cx25840_write4(client, DIF_BPF_COEFF1415, 0x0146fc70);
  4437. cx25840_write4(client, DIF_BPF_COEFF1617, 0x014d03c6);
  4438. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfb10ff32);
  4439. cx25840_write4(client, DIF_BPF_COEFF2021, 0x0701fb41);
  4440. cx25840_write4(client, DIF_BPF_COEFF2223, 0xfb3709a1);
  4441. cx25840_write4(client, DIF_BPF_COEFF2425, 0xfe00f644);
  4442. cx25840_write4(client, DIF_BPF_COEFF2627, 0x0a000345);
  4443. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf2350708);
  4444. cx25840_write4(client, DIF_BPF_COEFF3031, 0x09b2f104);
  4445. cx25840_write4(client, DIF_BPF_COEFF3233, 0x01050eff);
  4446. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf3baf9be);
  4447. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4448. break;
  4449. case 15600000:
  4450. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
  4451. cx25840_write4(client, DIF_BPF_COEFF23, 0xfff9fffb);
  4452. cx25840_write4(client, DIF_BPF_COEFF45, 0x0022ffe6);
  4453. cx25840_write4(client, DIF_BPF_COEFF67, 0xffc9007a);
  4454. cx25840_write4(client, DIF_BPF_COEFF89, 0xfff0ff29);
  4455. cx25840_write4(client, DIF_BPF_COEFF1011, 0x00f2007e);
  4456. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe01011b);
  4457. cx25840_write4(client, DIF_BPF_COEFF1415, 0x01f6fc9e);
  4458. cx25840_write4(client, DIF_BPF_COEFF1617, 0x00440467);
  4459. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfbccfdde);
  4460. cx25840_write4(client, DIF_BPF_COEFF2021, 0x0738fc90);
  4461. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf9f70934);
  4462. cx25840_write4(client, DIF_BPF_COEFF2425, 0xff99f582);
  4463. cx25840_write4(client, DIF_BPF_COEFF2627, 0x090204b0);
  4464. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf21a05e1);
  4465. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0a8df15a);
  4466. cx25840_write4(client, DIF_BPF_COEFF3233, 0x00340f41);
  4467. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf405f98b);
  4468. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4469. break;
  4470. case 15700000:
  4471. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
  4472. cx25840_write4(client, DIF_BPF_COEFF23, 0xfffcfff4);
  4473. cx25840_write4(client, DIF_BPF_COEFF45, 0x0020fffa);
  4474. cx25840_write4(client, DIF_BPF_COEFF67, 0xffb40064);
  4475. cx25840_write4(client, DIF_BPF_COEFF89, 0x002fff11);
  4476. cx25840_write4(client, DIF_BPF_COEFF1011, 0x00a400f0);
  4477. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe0d006e);
  4478. cx25840_write4(client, DIF_BPF_COEFF1415, 0x0281fd09);
  4479. cx25840_write4(client, DIF_BPF_COEFF1617, 0xff3604c9);
  4480. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfcbffca2);
  4481. cx25840_write4(client, DIF_BPF_COEFF2021, 0x0726fdfe);
  4482. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf8e80888);
  4483. cx25840_write4(client, DIF_BPF_COEFF2425, 0x0134f4f3);
  4484. cx25840_write4(client, DIF_BPF_COEFF2627, 0x07e1060c);
  4485. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf22304af);
  4486. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0b59f1be);
  4487. cx25840_write4(client, DIF_BPF_COEFF3233, 0xff640f7d);
  4488. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf452f959);
  4489. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4490. break;
  4491. case 15800000:
  4492. cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
  4493. cx25840_write4(client, DIF_BPF_COEFF23, 0x0000fff0);
  4494. cx25840_write4(client, DIF_BPF_COEFF45, 0x001a0010);
  4495. cx25840_write4(client, DIF_BPF_COEFF67, 0xffaa0041);
  4496. cx25840_write4(client, DIF_BPF_COEFF89, 0x0067ff13);
  4497. cx25840_write4(client, DIF_BPF_COEFF1011, 0x0043014a);
  4498. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe46ffb9);
  4499. cx25840_write4(client, DIF_BPF_COEFF1415, 0x02dbfda8);
  4500. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfe3504e5);
  4501. cx25840_write4(client, DIF_BPF_COEFF1819, 0xfddcfb8d);
  4502. cx25840_write4(client, DIF_BPF_COEFF2021, 0x06c9ff7e);
  4503. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf81107a2);
  4504. cx25840_write4(client, DIF_BPF_COEFF2425, 0x02c9f49a);
  4505. cx25840_write4(client, DIF_BPF_COEFF2627, 0x069f0753);
  4506. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf2500373);
  4507. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0c14f231);
  4508. cx25840_write4(client, DIF_BPF_COEFF3233, 0xfe930fb3);
  4509. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf4a1f927);
  4510. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4511. break;
  4512. case 15900000:
  4513. cx25840_write4(client, DIF_BPF_COEFF01, 0xffff0002);
  4514. cx25840_write4(client, DIF_BPF_COEFF23, 0x0003ffee);
  4515. cx25840_write4(client, DIF_BPF_COEFF45, 0x000f0023);
  4516. cx25840_write4(client, DIF_BPF_COEFF67, 0xffac0016);
  4517. cx25840_write4(client, DIF_BPF_COEFF89, 0x0093ff31);
  4518. cx25840_write4(client, DIF_BPF_COEFF1011, 0xffdc0184);
  4519. cx25840_write4(client, DIF_BPF_COEFF1213, 0xfea6ff09);
  4520. cx25840_write4(client, DIF_BPF_COEFF1415, 0x02fdfe70);
  4521. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfd5104ba);
  4522. cx25840_write4(client, DIF_BPF_COEFF1819, 0xff15faac);
  4523. cx25840_write4(client, DIF_BPF_COEFF2021, 0x06270103);
  4524. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf7780688);
  4525. cx25840_write4(client, DIF_BPF_COEFF2425, 0x044df479);
  4526. cx25840_write4(client, DIF_BPF_COEFF2627, 0x05430883);
  4527. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf2a00231);
  4528. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0cbef2b2);
  4529. cx25840_write4(client, DIF_BPF_COEFF3233, 0xfdc40fe3);
  4530. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf4f2f8f5);
  4531. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4532. break;
  4533. case 16000000:
  4534. cx25840_write4(client, DIF_BPF_COEFF01, 0xffff0001);
  4535. cx25840_write4(client, DIF_BPF_COEFF23, 0x0006ffef);
  4536. cx25840_write4(client, DIF_BPF_COEFF45, 0x00020031);
  4537. cx25840_write4(client, DIF_BPF_COEFF67, 0xffbaffe8);
  4538. cx25840_write4(client, DIF_BPF_COEFF89, 0x00adff66);
  4539. cx25840_write4(client, DIF_BPF_COEFF1011, 0xff790198);
  4540. cx25840_write4(client, DIF_BPF_COEFF1213, 0xff26fe6e);
  4541. cx25840_write4(client, DIF_BPF_COEFF1415, 0x02e5ff55);
  4542. cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc99044a);
  4543. cx25840_write4(client, DIF_BPF_COEFF1819, 0x005bfa09);
  4544. cx25840_write4(client, DIF_BPF_COEFF2021, 0x0545027f);
  4545. cx25840_write4(client, DIF_BPF_COEFF2223, 0xf7230541);
  4546. cx25840_write4(client, DIF_BPF_COEFF2425, 0x05b8f490);
  4547. cx25840_write4(client, DIF_BPF_COEFF2627, 0x03d20997);
  4548. cx25840_write4(client, DIF_BPF_COEFF2829, 0xf31300eb);
  4549. cx25840_write4(client, DIF_BPF_COEFF3031, 0x0d55f341);
  4550. cx25840_write4(client, DIF_BPF_COEFF3233, 0xfcf6100e);
  4551. cx25840_write4(client, DIF_BPF_COEFF3435, 0xf544f8c3);
  4552. cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
  4553. break;
  4554. }
  4555. }
  4556. static void cx23888_std_setup(struct i2c_client *client)
  4557. {
  4558. struct cx25840_state *state = to_state(i2c_get_clientdata(client));
  4559. v4l2_std_id std = state->std;
  4560. u32 ifHz;
  4561. cx25840_write4(client, 0x478, 0x6628021F);
  4562. cx25840_write4(client, 0x400, 0x0);
  4563. cx25840_write4(client, 0x4b4, 0x20524030);
  4564. cx25840_write4(client, 0x47c, 0x010a8263);
  4565. if (std & V4L2_STD_NTSC) {
  4566. v4l_dbg(1, cx25840_debug, client, "%s() Selecting NTSC",
  4567. __func__);
  4568. /* Horiz / vert timing */
  4569. cx25840_write4(client, 0x428, 0x1e1e601a);
  4570. cx25840_write4(client, 0x424, 0x5b2d007a);
  4571. /* DIF NTSC */
  4572. cx25840_write4(client, 0x304, 0x6503bc0c);
  4573. cx25840_write4(client, 0x308, 0xbd038c85);
  4574. cx25840_write4(client, 0x30c, 0x1db4640a);
  4575. cx25840_write4(client, 0x310, 0x00008800);
  4576. cx25840_write4(client, 0x314, 0x44400400);
  4577. cx25840_write4(client, 0x32c, 0x0c800800);
  4578. cx25840_write4(client, 0x330, 0x27000100);
  4579. cx25840_write4(client, 0x334, 0x1f296e1f);
  4580. cx25840_write4(client, 0x338, 0x009f50c1);
  4581. cx25840_write4(client, 0x340, 0x1befbf06);
  4582. cx25840_write4(client, 0x344, 0x000035e8);
  4583. /* DIF I/F */
  4584. ifHz = 5400000;
  4585. } else {
  4586. v4l_dbg(1, cx25840_debug, client, "%s() Selecting PAL-BG",
  4587. __func__);
  4588. /* Horiz / vert timing */
  4589. cx25840_write4(client, 0x428, 0x28244024);
  4590. cx25840_write4(client, 0x424, 0x5d2d0084);
  4591. /* DIF */
  4592. cx25840_write4(client, 0x304, 0x6503bc0c);
  4593. cx25840_write4(client, 0x308, 0xbd038c85);
  4594. cx25840_write4(client, 0x30c, 0x1db4640a);
  4595. cx25840_write4(client, 0x310, 0x00008800);
  4596. cx25840_write4(client, 0x314, 0x44400600);
  4597. cx25840_write4(client, 0x32c, 0x0c800800);
  4598. cx25840_write4(client, 0x330, 0x27000100);
  4599. cx25840_write4(client, 0x334, 0x213530ec);
  4600. cx25840_write4(client, 0x338, 0x00a65ba8);
  4601. cx25840_write4(client, 0x340, 0x1befbf06);
  4602. cx25840_write4(client, 0x344, 0x000035e8);
  4603. /* DIF I/F */
  4604. ifHz = 6000000;
  4605. }
  4606. cx23885_dif_setup(client, ifHz);
  4607. /* Explicitly ensure the inputs are reconfigured after
  4608. * a standard change.
  4609. */
  4610. set_input(client, state->vid_input, state->aud_input);
  4611. }
  4612. /* ----------------------------------------------------------------------- */
  4613. static const struct v4l2_ctrl_ops cx25840_ctrl_ops = {
  4614. .s_ctrl = cx25840_s_ctrl,
  4615. };
  4616. static const struct v4l2_subdev_core_ops cx25840_core_ops = {
  4617. .log_status = cx25840_log_status,
  4618. .g_chip_ident = cx25840_g_chip_ident,
  4619. .g_ctrl = v4l2_subdev_g_ctrl,
  4620. .s_ctrl = v4l2_subdev_s_ctrl,
  4621. .s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
  4622. .try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
  4623. .g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
  4624. .queryctrl = v4l2_subdev_queryctrl,
  4625. .querymenu = v4l2_subdev_querymenu,
  4626. .s_std = cx25840_s_std,
  4627. .g_std = cx25840_g_std,
  4628. .reset = cx25840_reset,
  4629. .load_fw = cx25840_load_fw,
  4630. .s_io_pin_config = common_s_io_pin_config,
  4631. #ifdef CONFIG_VIDEO_ADV_DEBUG
  4632. .g_register = cx25840_g_register,
  4633. .s_register = cx25840_s_register,
  4634. #endif
  4635. .interrupt_service_routine = cx25840_irq_handler,
  4636. };
  4637. static const struct v4l2_subdev_tuner_ops cx25840_tuner_ops = {
  4638. .s_frequency = cx25840_s_frequency,
  4639. .s_radio = cx25840_s_radio,
  4640. .g_tuner = cx25840_g_tuner,
  4641. .s_tuner = cx25840_s_tuner,
  4642. };
  4643. static const struct v4l2_subdev_audio_ops cx25840_audio_ops = {
  4644. .s_clock_freq = cx25840_s_clock_freq,
  4645. .s_routing = cx25840_s_audio_routing,
  4646. .s_stream = cx25840_s_audio_stream,
  4647. };
  4648. static const struct v4l2_subdev_video_ops cx25840_video_ops = {
  4649. .s_routing = cx25840_s_video_routing,
  4650. .s_mbus_fmt = cx25840_s_mbus_fmt,
  4651. .s_stream = cx25840_s_stream,
  4652. .g_input_status = cx25840_g_input_status,
  4653. };
  4654. static const struct v4l2_subdev_vbi_ops cx25840_vbi_ops = {
  4655. .decode_vbi_line = cx25840_decode_vbi_line,
  4656. .s_raw_fmt = cx25840_s_raw_fmt,
  4657. .s_sliced_fmt = cx25840_s_sliced_fmt,
  4658. .g_sliced_fmt = cx25840_g_sliced_fmt,
  4659. };
  4660. static const struct v4l2_subdev_ops cx25840_ops = {
  4661. .core = &cx25840_core_ops,
  4662. .tuner = &cx25840_tuner_ops,
  4663. .audio = &cx25840_audio_ops,
  4664. .video = &cx25840_video_ops,
  4665. .vbi = &cx25840_vbi_ops,
  4666. .ir = &cx25840_ir_ops,
  4667. };
  4668. /* ----------------------------------------------------------------------- */
  4669. static u32 get_cx2388x_ident(struct i2c_client *client)
  4670. {
  4671. u32 ret;
  4672. /* Come out of digital power down */
  4673. cx25840_write(client, 0x000, 0);
  4674. /* Detecting whether the part is cx23885/7/8 is more
  4675. * difficult than it needs to be. No ID register. Instead we
  4676. * probe certain registers indicated in the datasheets to look
  4677. * for specific defaults that differ between the silicon designs. */
  4678. /* It's either 885/7 if the IR Tx Clk Divider register exists */
  4679. if (cx25840_read4(client, 0x204) & 0xffff) {
  4680. /* CX23885 returns bogus repetitive byte values for the DIF,
  4681. * which doesn't exist for it. (Ex. 8a8a8a8a or 31313131) */
  4682. ret = cx25840_read4(client, 0x300);
  4683. if (((ret & 0xffff0000) >> 16) == (ret & 0xffff)) {
  4684. /* No DIF */
  4685. ret = V4L2_IDENT_CX23885_AV;
  4686. } else {
  4687. /* CX23887 has a broken DIF, but the registers
  4688. * appear valid (but unused), good enough to detect. */
  4689. ret = V4L2_IDENT_CX23887_AV;
  4690. }
  4691. } else if (cx25840_read4(client, 0x300) & 0x0fffffff) {
  4692. /* DIF PLL Freq Word reg exists; chip must be a CX23888 */
  4693. ret = V4L2_IDENT_CX23888_AV;
  4694. } else {
  4695. v4l_err(client, "Unable to detect h/w, assuming cx23887\n");
  4696. ret = V4L2_IDENT_CX23887_AV;
  4697. }
  4698. /* Back into digital power down */
  4699. cx25840_write(client, 0x000, 2);
  4700. return ret;
  4701. }
  4702. static int cx25840_probe(struct i2c_client *client,
  4703. const struct i2c_device_id *did)
  4704. {
  4705. struct cx25840_state *state;
  4706. struct v4l2_subdev *sd;
  4707. int default_volume;
  4708. u32 id = V4L2_IDENT_NONE;
  4709. u16 device_id;
  4710. /* Check if the adapter supports the needed features */
  4711. if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
  4712. return -EIO;
  4713. v4l_dbg(1, cx25840_debug, client, "detecting cx25840 client on address 0x%x\n", client->addr << 1);
  4714. device_id = cx25840_read(client, 0x101) << 8;
  4715. device_id |= cx25840_read(client, 0x100);
  4716. v4l_dbg(1, cx25840_debug, client, "device_id = 0x%04x\n", device_id);
  4717. /* The high byte of the device ID should be
  4718. * 0x83 for the cx2583x and 0x84 for the cx2584x */
  4719. if ((device_id & 0xff00) == 0x8300) {
  4720. id = V4L2_IDENT_CX25836 + ((device_id >> 4) & 0xf) - 6;
  4721. } else if ((device_id & 0xff00) == 0x8400) {
  4722. id = V4L2_IDENT_CX25840 + ((device_id >> 4) & 0xf);
  4723. } else if (device_id == 0x0000) {
  4724. id = get_cx2388x_ident(client);
  4725. } else if ((device_id & 0xfff0) == 0x5A30) {
  4726. /* The CX23100 (0x5A3C = 23100) doesn't have an A/V decoder */
  4727. id = V4L2_IDENT_CX2310X_AV;
  4728. } else if ((device_id & 0xff) == (device_id >> 8)) {
  4729. v4l_err(client,
  4730. "likely a confused/unresponsive cx2388[578] A/V decoder"
  4731. " found @ 0x%x (%s)\n",
  4732. client->addr << 1, client->adapter->name);
  4733. v4l_err(client, "A method to reset it from the cx25840 driver"
  4734. " software is not known at this time\n");
  4735. return -ENODEV;
  4736. } else {
  4737. v4l_dbg(1, cx25840_debug, client, "cx25840 not found\n");
  4738. return -ENODEV;
  4739. }
  4740. state = kzalloc(sizeof(struct cx25840_state), GFP_KERNEL);
  4741. if (state == NULL)
  4742. return -ENOMEM;
  4743. sd = &state->sd;
  4744. v4l2_i2c_subdev_init(sd, client, &cx25840_ops);
  4745. switch (id) {
  4746. case V4L2_IDENT_CX23885_AV:
  4747. v4l_info(client, "cx23885 A/V decoder found @ 0x%x (%s)\n",
  4748. client->addr << 1, client->adapter->name);
  4749. break;
  4750. case V4L2_IDENT_CX23887_AV:
  4751. v4l_info(client, "cx23887 A/V decoder found @ 0x%x (%s)\n",
  4752. client->addr << 1, client->adapter->name);
  4753. break;
  4754. case V4L2_IDENT_CX23888_AV:
  4755. v4l_info(client, "cx23888 A/V decoder found @ 0x%x (%s)\n",
  4756. client->addr << 1, client->adapter->name);
  4757. break;
  4758. case V4L2_IDENT_CX2310X_AV:
  4759. v4l_info(client, "cx%d A/V decoder found @ 0x%x (%s)\n",
  4760. device_id, client->addr << 1, client->adapter->name);
  4761. break;
  4762. case V4L2_IDENT_CX25840:
  4763. case V4L2_IDENT_CX25841:
  4764. case V4L2_IDENT_CX25842:
  4765. case V4L2_IDENT_CX25843:
  4766. /* Note: revision '(device_id & 0x0f) == 2' was never built. The
  4767. marking skips from 0x1 == 22 to 0x3 == 23. */
  4768. v4l_info(client, "cx25%3x-2%x found @ 0x%x (%s)\n",
  4769. (device_id & 0xfff0) >> 4,
  4770. (device_id & 0x0f) < 3 ? (device_id & 0x0f) + 1
  4771. : (device_id & 0x0f),
  4772. client->addr << 1, client->adapter->name);
  4773. break;
  4774. case V4L2_IDENT_CX25836:
  4775. case V4L2_IDENT_CX25837:
  4776. default:
  4777. v4l_info(client, "cx25%3x-%x found @ 0x%x (%s)\n",
  4778. (device_id & 0xfff0) >> 4, device_id & 0x0f,
  4779. client->addr << 1, client->adapter->name);
  4780. break;
  4781. }
  4782. state->c = client;
  4783. state->vid_input = CX25840_COMPOSITE7;
  4784. state->aud_input = CX25840_AUDIO8;
  4785. state->audclk_freq = 48000;
  4786. state->audmode = V4L2_TUNER_MODE_LANG1;
  4787. state->vbi_line_offset = 8;
  4788. state->id = id;
  4789. state->rev = device_id;
  4790. v4l2_ctrl_handler_init(&state->hdl, 9);
  4791. v4l2_ctrl_new_std(&state->hdl, &cx25840_ctrl_ops,
  4792. V4L2_CID_BRIGHTNESS, 0, 255, 1, 128);
  4793. v4l2_ctrl_new_std(&state->hdl, &cx25840_ctrl_ops,
  4794. V4L2_CID_CONTRAST, 0, 127, 1, 64);
  4795. v4l2_ctrl_new_std(&state->hdl, &cx25840_ctrl_ops,
  4796. V4L2_CID_SATURATION, 0, 127, 1, 64);
  4797. v4l2_ctrl_new_std(&state->hdl, &cx25840_ctrl_ops,
  4798. V4L2_CID_HUE, -128, 127, 1, 0);
  4799. if (!is_cx2583x(state)) {
  4800. default_volume = cx25840_read(client, 0x8d4);
  4801. /*
  4802. * Enforce the legacy PVR-350/MSP3400 to PVR-150/CX25843 volume
  4803. * scale mapping limits to avoid -ERANGE errors when
  4804. * initializing the volume control
  4805. */
  4806. if (default_volume > 228) {
  4807. /* Bottom out at -96 dB, v4l2 vol range 0x2e00-0x2fff */
  4808. default_volume = 228;
  4809. cx25840_write(client, 0x8d4, 228);
  4810. }
  4811. else if (default_volume < 20) {
  4812. /* Top out at + 8 dB, v4l2 vol range 0xfe00-0xffff */
  4813. default_volume = 20;
  4814. cx25840_write(client, 0x8d4, 20);
  4815. }
  4816. default_volume = (((228 - default_volume) >> 1) + 23) << 9;
  4817. state->volume = v4l2_ctrl_new_std(&state->hdl,
  4818. &cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_VOLUME,
  4819. 0, 65535, 65535 / 100, default_volume);
  4820. state->mute = v4l2_ctrl_new_std(&state->hdl,
  4821. &cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_MUTE,
  4822. 0, 1, 1, 0);
  4823. v4l2_ctrl_new_std(&state->hdl, &cx25840_audio_ctrl_ops,
  4824. V4L2_CID_AUDIO_BALANCE,
  4825. 0, 65535, 65535 / 100, 32768);
  4826. v4l2_ctrl_new_std(&state->hdl, &cx25840_audio_ctrl_ops,
  4827. V4L2_CID_AUDIO_BASS,
  4828. 0, 65535, 65535 / 100, 32768);
  4829. v4l2_ctrl_new_std(&state->hdl, &cx25840_audio_ctrl_ops,
  4830. V4L2_CID_AUDIO_TREBLE,
  4831. 0, 65535, 65535 / 100, 32768);
  4832. }
  4833. sd->ctrl_handler = &state->hdl;
  4834. if (state->hdl.error) {
  4835. int err = state->hdl.error;
  4836. v4l2_ctrl_handler_free(&state->hdl);
  4837. kfree(state);
  4838. return err;
  4839. }
  4840. if (!is_cx2583x(state))
  4841. v4l2_ctrl_cluster(2, &state->volume);
  4842. v4l2_ctrl_handler_setup(&state->hdl);
  4843. if (client->dev.platform_data) {
  4844. struct cx25840_platform_data *pdata = client->dev.platform_data;
  4845. state->pvr150_workaround = pdata->pvr150_workaround;
  4846. }
  4847. cx25840_ir_probe(sd);
  4848. return 0;
  4849. }
  4850. static int cx25840_remove(struct i2c_client *client)
  4851. {
  4852. struct v4l2_subdev *sd = i2c_get_clientdata(client);
  4853. struct cx25840_state *state = to_state(sd);
  4854. cx25840_ir_remove(sd);
  4855. v4l2_device_unregister_subdev(sd);
  4856. v4l2_ctrl_handler_free(&state->hdl);
  4857. kfree(state);
  4858. return 0;
  4859. }
  4860. static const struct i2c_device_id cx25840_id[] = {
  4861. { "cx25840", 0 },
  4862. { }
  4863. };
  4864. MODULE_DEVICE_TABLE(i2c, cx25840_id);
  4865. static struct i2c_driver cx25840_driver = {
  4866. .driver = {
  4867. .owner = THIS_MODULE,
  4868. .name = "cx25840",
  4869. },
  4870. .probe = cx25840_probe,
  4871. .remove = cx25840_remove,
  4872. .id_table = cx25840_id,
  4873. };
  4874. module_i2c_driver(cx25840_driver);