dib0700_devices.c 128 KB

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