cx25840-core.c 211 KB

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