bttv-cards.c 127 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359
  1. /*
  2. $Id: bttv-cards.c,v 1.53 2005/07/05 17:37:35 nsh Exp $
  3. bttv-cards.c
  4. this file has configuration informations - card-specific stuff
  5. like the big tvcards array for the most part
  6. Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de)
  7. & Marcus Metzler (mocm@thp.uni-koeln.de)
  8. (c) 1999-2001 Gerd Knorr <kraxel@goldbach.in-berlin.de>
  9. This program is free software; you can redistribute it and/or modify
  10. it under the terms of the GNU General Public License as published by
  11. the Free Software Foundation; either version 2 of the License, or
  12. (at your option) any later version.
  13. This program is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. GNU General Public License for more details.
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. */
  21. #include <linux/config.h>
  22. #include <linux/delay.h>
  23. #include <linux/module.h>
  24. #include <linux/moduleparam.h>
  25. #include <linux/kmod.h>
  26. #include <linux/init.h>
  27. #include <linux/pci.h>
  28. #include <linux/vmalloc.h>
  29. #include <linux/firmware.h>
  30. #include <asm/io.h>
  31. #include "bttvp.h"
  32. /* fwd decl */
  33. static void boot_msp34xx(struct bttv *btv, int pin);
  34. static void boot_bt832(struct bttv *btv);
  35. static void hauppauge_eeprom(struct bttv *btv);
  36. static void avermedia_eeprom(struct bttv *btv);
  37. static void osprey_eeprom(struct bttv *btv);
  38. static void modtec_eeprom(struct bttv *btv);
  39. static void init_PXC200(struct bttv *btv);
  40. static void init_RTV24(struct bttv *btv);
  41. static void winview_audio(struct bttv *btv, struct video_audio *v, int set);
  42. static void lt9415_audio(struct bttv *btv, struct video_audio *v, int set);
  43. static void avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v,
  44. int set);
  45. static void avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v,
  46. int set);
  47. static void terratv_audio(struct bttv *btv, struct video_audio *v, int set);
  48. static void gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set);
  49. static void gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set);
  50. static void winfast2000_audio(struct bttv *btv, struct video_audio *v, int set);
  51. static void pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set);
  52. static void fv2000s_audio(struct bttv *btv, struct video_audio *v, int set);
  53. static void windvr_audio(struct bttv *btv, struct video_audio *v, int set);
  54. static void adtvk503_audio(struct bttv *btv, struct video_audio *v, int set);
  55. static void rv605_muxsel(struct bttv *btv, unsigned int input);
  56. static void eagle_muxsel(struct bttv *btv, unsigned int input);
  57. static void xguard_muxsel(struct bttv *btv, unsigned int input);
  58. static void ivc120_muxsel(struct bttv *btv, unsigned int input);
  59. static void gvc1100_muxsel(struct bttv *btv, unsigned int input);
  60. static void PXC200_muxsel(struct bttv *btv, unsigned int input);
  61. static void picolo_tetra_muxsel(struct bttv *btv, unsigned int input);
  62. static void picolo_tetra_init(struct bttv *btv);
  63. static void tibetCS16_muxsel(struct bttv *btv, unsigned int input);
  64. static void tibetCS16_init(struct bttv *btv);
  65. static void kodicom4400r_muxsel(struct bttv *btv, unsigned int input);
  66. static void kodicom4400r_init(struct bttv *btv);
  67. static void sigmaSLC_muxsel(struct bttv *btv, unsigned int input);
  68. static void sigmaSQ_muxsel(struct bttv *btv, unsigned int input);
  69. static int terratec_active_radio_upgrade(struct bttv *btv);
  70. static int tea5757_read(struct bttv *btv);
  71. static int tea5757_write(struct bttv *btv, int value);
  72. static void identify_by_eeprom(struct bttv *btv,
  73. unsigned char eeprom_data[256]);
  74. static int __devinit pvr_boot(struct bttv *btv);
  75. /* config variables */
  76. static unsigned int triton1=0;
  77. static unsigned int vsfx=0;
  78. static unsigned int latency = UNSET;
  79. static unsigned int no_overlay=-1;
  80. static unsigned int card[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
  81. static unsigned int pll[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
  82. static unsigned int tuner[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
  83. static unsigned int svhs[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
  84. static unsigned int remote[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
  85. static struct bttv *master[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = NULL };
  86. #ifdef MODULE
  87. static unsigned int autoload = 1;
  88. #else
  89. static unsigned int autoload = 0;
  90. #endif
  91. static unsigned int gpiomask = UNSET;
  92. static unsigned int audioall = UNSET;
  93. static unsigned int audiomux[5] = { [ 0 ... 4 ] = UNSET };
  94. /* insmod options */
  95. module_param(triton1, int, 0444);
  96. module_param(vsfx, int, 0444);
  97. module_param(no_overlay, int, 0444);
  98. module_param(latency, int, 0444);
  99. module_param(gpiomask, int, 0444);
  100. module_param(audioall, int, 0444);
  101. module_param(autoload, int, 0444);
  102. module_param_array(card, int, NULL, 0444);
  103. module_param_array(pll, int, NULL, 0444);
  104. module_param_array(tuner, int, NULL, 0444);
  105. module_param_array(svhs, int, NULL, 0444);
  106. module_param_array(remote, int, NULL, 0444);
  107. module_param_array(audiomux, int, NULL, 0444);
  108. MODULE_PARM_DESC(triton1,"set ETBF pci config bit "
  109. "[enable bug compatibility for triton1 + others]");
  110. MODULE_PARM_DESC(vsfx,"set VSFX pci config bit "
  111. "[yet another chipset flaw workaround]");
  112. MODULE_PARM_DESC(latency,"pci latency timer");
  113. MODULE_PARM_DESC(card,"specify TV/grabber card model, see CARDLIST file for a list");
  114. MODULE_PARM_DESC(pll,"specify installed crystal (0=none, 28=28 MHz, 35=35 MHz)");
  115. MODULE_PARM_DESC(tuner,"specify installed tuner type");
  116. MODULE_PARM_DESC(autoload,"automatically load i2c modules like tuner.o, default is 1 (yes)");
  117. /* ----------------------------------------------------------------------- */
  118. /* list of card IDs for bt878+ cards */
  119. static struct CARD {
  120. unsigned id;
  121. int cardnr;
  122. char *name;
  123. } cards[] __devinitdata = {
  124. { 0x13eb0070, BTTV_HAUPPAUGE878, "Hauppauge WinTV" },
  125. { 0x39000070, BTTV_HAUPPAUGE878, "Hauppauge WinTV-D" },
  126. { 0x45000070, BTTV_HAUPPAUGEPVR, "Hauppauge WinTV/PVR" },
  127. { 0xff000070, BTTV_OSPREY1x0, "Osprey-100" },
  128. { 0xff010070, BTTV_OSPREY2x0_SVID,"Osprey-200" },
  129. { 0xff020070, BTTV_OSPREY500, "Osprey-500" },
  130. { 0xff030070, BTTV_OSPREY2000, "Osprey-2000" },
  131. { 0xff040070, BTTV_OSPREY540, "Osprey-540" },
  132. { 0x00011002, BTTV_ATI_TVWONDER, "ATI TV Wonder" },
  133. { 0x00031002, BTTV_ATI_TVWONDERVE,"ATI TV Wonder/VE" },
  134. { 0x6606107d, BTTV_WINFAST2000, "Leadtek WinFast TV 2000" },
  135. { 0x6607107d, BTTV_WINFASTVC100, "Leadtek WinFast VC 100" },
  136. { 0x6609107d, BTTV_WINFAST2000, "Leadtek TV 2000 XP" },
  137. { 0x263610b4, BTTV_STB2, "STB TV PCI FM, Gateway P/N 6000704" },
  138. { 0x264510b4, BTTV_STB2, "STB TV PCI FM, Gateway P/N 6000704" },
  139. { 0x402010fc, BTTV_GVBCTV3PCI, "I-O Data Co. GV-BCTV3/PCI" },
  140. { 0x405010fc, BTTV_GVBCTV4PCI, "I-O Data Co. GV-BCTV4/PCI" },
  141. { 0x407010fc, BTTV_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" },
  142. { 0xd01810fc, BTTV_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" },
  143. { 0x001211bd, BTTV_PINNACLE, "Pinnacle PCTV" },
  144. // some cards ship with byteswapped IDs ...
  145. { 0x1200bd11, BTTV_PINNACLE, "Pinnacle PCTV [bswap]" },
  146. { 0xff00bd11, BTTV_PINNACLE, "Pinnacle PCTV [bswap]" },
  147. // this seems to happen as well ...
  148. { 0xff1211bd, BTTV_PINNACLE, "Pinnacle PCTV" },
  149. { 0x3000121a, BTTV_VOODOOTV_FM, "3Dfx VoodooTV FM/ VoodooTV 200" },
  150. { 0x263710b4, BTTV_VOODOOTV_FM, "3Dfx VoodooTV FM/ VoodooTV 200" },
  151. { 0x3060121a, BTTV_STB2, "3Dfx VoodooTV 100/ STB OEM" },
  152. { 0x3000144f, BTTV_MAGICTVIEW063, "(Askey Magic/others) TView99 CPH06x" },
  153. { 0xa005144f, BTTV_MAGICTVIEW063, "CPH06X TView99-Card" },
  154. { 0x3002144f, BTTV_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH05x" },
  155. { 0x3005144f, BTTV_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH061/06L (T1/LC)" },
  156. { 0x5000144f, BTTV_MAGICTVIEW061, "Askey CPH050" },
  157. { 0x300014ff, BTTV_MAGICTVIEW061, "TView 99 (CPH061)" },
  158. { 0x300214ff, BTTV_PHOEBE_TVMAS, "Phoebe TV Master (CPH060)" },
  159. { 0x00011461, BTTV_AVPHONE98, "AVerMedia TVPhone98" },
  160. { 0x00021461, BTTV_AVERMEDIA98, "AVermedia TVCapture 98" },
  161. { 0x00031461, BTTV_AVPHONE98, "AVerMedia TVPhone98" },
  162. { 0x00041461, BTTV_AVERMEDIA98, "AVerMedia TVCapture 98" },
  163. { 0x03001461, BTTV_AVERMEDIA98, "VDOMATE TV TUNER CARD" },
  164. { 0x1117153b, BTTV_TERRATVALUE, "Terratec TValue (Philips PAL B/G)" },
  165. { 0x1118153b, BTTV_TERRATVALUE, "Terratec TValue (Temic PAL B/G)" },
  166. { 0x1119153b, BTTV_TERRATVALUE, "Terratec TValue (Philips PAL I)" },
  167. { 0x111a153b, BTTV_TERRATVALUE, "Terratec TValue (Temic PAL I)" },
  168. { 0x1123153b, BTTV_TERRATVRADIO, "Terratec TV Radio+" },
  169. { 0x1127153b, BTTV_TERRATV, "Terratec TV+ (V1.05)" },
  170. // clashes with FlyVideo
  171. //{ 0x18521852, BTTV_TERRATV, "Terratec TV+ (V1.10)" },
  172. { 0x1134153b, BTTV_TERRATVALUE, "Terratec TValue (LR102)" },
  173. { 0x1135153b, BTTV_TERRATVALUER, "Terratec TValue Radio" }, // LR102
  174. { 0x5018153b, BTTV_TERRATVALUE, "Terratec TValue" }, // ??
  175. { 0xff3b153b, BTTV_TERRATVALUER, "Terratec TValue Radio" }, // ??
  176. { 0x400015b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV" },
  177. { 0x400a15b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV" },
  178. { 0x400d15b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
  179. { 0x401015b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
  180. { 0x401615b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
  181. { 0x1430aa00, BTTV_PV143, "Provideo PV143A" },
  182. { 0x1431aa00, BTTV_PV143, "Provideo PV143B" },
  183. { 0x1432aa00, BTTV_PV143, "Provideo PV143C" },
  184. { 0x1433aa00, BTTV_PV143, "Provideo PV143D" },
  185. { 0x1433aa03, BTTV_PV143, "Security Eyes" },
  186. { 0x1460aa00, BTTV_PV150, "Provideo PV150A-1" },
  187. { 0x1461aa01, BTTV_PV150, "Provideo PV150A-2" },
  188. { 0x1462aa02, BTTV_PV150, "Provideo PV150A-3" },
  189. { 0x1463aa03, BTTV_PV150, "Provideo PV150A-4" },
  190. { 0x1464aa04, BTTV_PV150, "Provideo PV150B-1" },
  191. { 0x1465aa05, BTTV_PV150, "Provideo PV150B-2" },
  192. { 0x1466aa06, BTTV_PV150, "Provideo PV150B-3" },
  193. { 0x1467aa07, BTTV_PV150, "Provideo PV150B-4" },
  194. { 0xa132ff00, BTTV_IVC100, "IVC-100" },
  195. { 0xa1550000, BTTV_IVC200, "IVC-200" },
  196. { 0xa1550001, BTTV_IVC200, "IVC-200" },
  197. { 0xa1550002, BTTV_IVC200, "IVC-200" },
  198. { 0xa1550003, BTTV_IVC200, "IVC-200" },
  199. { 0xa1550100, BTTV_IVC200, "IVC-200G" },
  200. { 0xa1550101, BTTV_IVC200, "IVC-200G" },
  201. { 0xa1550102, BTTV_IVC200, "IVC-200G" },
  202. { 0xa1550103, BTTV_IVC200, "IVC-200G" },
  203. { 0xa182ff00, BTTV_IVC120, "IVC-120G" },
  204. { 0xa182ff01, BTTV_IVC120, "IVC-120G" },
  205. { 0xa182ff02, BTTV_IVC120, "IVC-120G" },
  206. { 0xa182ff03, BTTV_IVC120, "IVC-120G" },
  207. { 0xa182ff04, BTTV_IVC120, "IVC-120G" },
  208. { 0xa182ff05, BTTV_IVC120, "IVC-120G" },
  209. { 0xa182ff06, BTTV_IVC120, "IVC-120G" },
  210. { 0xa182ff07, BTTV_IVC120, "IVC-120G" },
  211. { 0xa182ff08, BTTV_IVC120, "IVC-120G" },
  212. { 0xa182ff09, BTTV_IVC120, "IVC-120G" },
  213. { 0xa182ff0a, BTTV_IVC120, "IVC-120G" },
  214. { 0xa182ff0b, BTTV_IVC120, "IVC-120G" },
  215. { 0xa182ff0c, BTTV_IVC120, "IVC-120G" },
  216. { 0xa182ff0d, BTTV_IVC120, "IVC-120G" },
  217. { 0xa182ff0e, BTTV_IVC120, "IVC-120G" },
  218. { 0xa182ff0f, BTTV_IVC120, "IVC-120G" },
  219. { 0x41424344, BTTV_GRANDTEC, "GrandTec Multi Capture" },
  220. { 0x01020304, BTTV_XGUARD, "Grandtec Grand X-Guard" },
  221. { 0x18501851, BTTV_CHRONOS_VS2, "FlyVideo 98 (LR50)/ Chronos Video Shuttle II" },
  222. { 0xa0501851, BTTV_CHRONOS_VS2, "FlyVideo 98 (LR50)/ Chronos Video Shuttle II" },
  223. { 0x18511851, BTTV_FLYVIDEO98EZ, "FlyVideo 98EZ (LR51)/ CyberMail AV" },
  224. { 0x18521852, BTTV_TYPHOON_TVIEW, "FlyVideo 98FM (LR50)/ Typhoon TView TV/FM Tuner" },
  225. { 0x41a0a051, BTTV_FLYVIDEO_98FM, "Lifeview FlyVideo 98 LR50 Rev Q" },
  226. { 0x18501f7f, BTTV_FLYVIDEO_98, "Lifeview Flyvideo 98" },
  227. { 0x010115cb, BTTV_GMV1, "AG GMV1" },
  228. { 0x010114c7, BTTV_MODTEC_205, "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV" },
  229. { 0x10b42636, BTTV_HAUPPAUGE878, "STB ???" },
  230. { 0x217d6606, BTTV_WINFAST2000, "Leadtek WinFast TV 2000" },
  231. { 0xfff6f6ff, BTTV_WINFAST2000, "Leadtek WinFast TV 2000" },
  232. { 0x03116000, BTTV_SENSORAY311, "Sensoray 311" },
  233. { 0x00790e11, BTTV_WINDVR, "Canopus WinDVR PCI" },
  234. { 0xa0fca1a0, BTTV_ZOLTRIX, "Face to Face Tvmax" },
  235. { 0x20007063, BTTV_PC_HDTV, "pcHDTV HD-2000 TV"},
  236. { 0x82b2aa6a, BTTV_SIMUS_GVC1100, "SIMUS GVC1100" },
  237. { 0x146caa0c, BTTV_PV951, "ituner spectra8" },
  238. { 0x200a1295, BTTV_PXC200, "ImageNation PXC200A" },
  239. { 0x40111554, BTTV_PV_BT878P_9B, "Prolink Pixelview PV-BT" },
  240. { 0x17de0a01, BTTV_KWORLD, "Mecer TV/FM/Video Tuner" },
  241. { 0x01051805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #1" },
  242. { 0x01061805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #2" },
  243. { 0x01071805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #3" },
  244. { 0x01081805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #4" },
  245. // likely broken, vendor id doesn't match the other magic views ...
  246. //{ 0xa0fca04f, BTTV_MAGICTVIEW063, "Guillemot Maxi TV Video 3" },
  247. // DVB cards (using pci function .1 for mpeg data xfer)
  248. { 0x01010071, BTTV_NEBULA_DIGITV, "Nebula Electronics DigiTV" },
  249. { 0x07611461, BTTV_AVDVBT_761, "AverMedia AverTV DVB-T 761" },
  250. { 0x001c11bd, BTTV_PINNACLESAT, "Pinnacle PCTV Sat" },
  251. { 0x002611bd, BTTV_TWINHAN_DST, "Pinnacle PCTV SAT CI" },
  252. { 0x00011822, BTTV_TWINHAN_DST, "Twinhan VisionPlus DVB" },
  253. { 0xfc00270f, BTTV_TWINHAN_DST, "ChainTech digitop DST-1000 DVB-S" },
  254. { 0x07711461, BTTV_AVDVBT_771, "AVermedia AverTV DVB-T 771" },
  255. { 0xdb1018ac, BTTV_DVICO_DVBT_LITE, "DVICO FusionHDTV DVB-T Lite" },
  256. { 0, -1, NULL }
  257. };
  258. /* ----------------------------------------------------------------------- */
  259. /* array with description for bt848 / bt878 tv/grabber cards */
  260. struct tvcard bttv_tvcards[] = {
  261. {
  262. /* ---- card 0x00 ---------------------------------- */
  263. .name = " *** UNKNOWN/GENERIC *** ",
  264. .video_inputs = 4,
  265. .audio_inputs = 1,
  266. .tuner = 0,
  267. .svhs = 2,
  268. .muxsel = { 2, 3, 1, 0},
  269. .tuner_type = -1,
  270. },{
  271. .name = "MIRO PCTV",
  272. .video_inputs = 4,
  273. .audio_inputs = 1,
  274. .tuner = 0,
  275. .svhs = 2,
  276. .gpiomask = 15,
  277. .muxsel = { 2, 3, 1, 1},
  278. .audiomux = { 2, 0, 0, 0, 10},
  279. .needs_tvaudio = 1,
  280. .tuner_type = -1,
  281. },{
  282. .name = "Hauppauge (bt848)",
  283. .video_inputs = 4,
  284. .audio_inputs = 1,
  285. .tuner = 0,
  286. .svhs = 2,
  287. .gpiomask = 7,
  288. .muxsel = { 2, 3, 1, 1},
  289. .audiomux = { 0, 1, 2, 3, 4},
  290. .needs_tvaudio = 1,
  291. .tuner_type = -1,
  292. },{
  293. .name = "STB, Gateway P/N 6000699 (bt848)",
  294. .video_inputs = 3,
  295. .audio_inputs = 1,
  296. .tuner = 0,
  297. .svhs = 2,
  298. .gpiomask = 7,
  299. .muxsel = { 2, 3, 1, 1},
  300. .audiomux = { 4, 0, 2, 3, 1},
  301. .no_msp34xx = 1,
  302. .needs_tvaudio = 1,
  303. .tuner_type = TUNER_PHILIPS_NTSC,
  304. .pll = PLL_28,
  305. .has_radio = 1,
  306. },{
  307. /* ---- card 0x04 ---------------------------------- */
  308. .name = "Intel Create and Share PCI/ Smart Video Recorder III",
  309. .video_inputs = 4,
  310. .audio_inputs = 0,
  311. .tuner = -1,
  312. .svhs = 2,
  313. .gpiomask = 0,
  314. .muxsel = { 2, 3, 1, 1},
  315. .audiomux = { 0 },
  316. .needs_tvaudio = 0,
  317. .tuner_type = 4,
  318. },{
  319. .name = "Diamond DTV2000",
  320. .video_inputs = 4,
  321. .audio_inputs = 1,
  322. .tuner = 0,
  323. .svhs = 2,
  324. .gpiomask = 3,
  325. .muxsel = { 2, 3, 1, 0},
  326. .audiomux = { 0, 1, 0, 1, 3},
  327. .needs_tvaudio = 1,
  328. .tuner_type = -1,
  329. },{
  330. .name = "AVerMedia TVPhone",
  331. .video_inputs = 3,
  332. .audio_inputs = 1,
  333. .tuner = 0,
  334. .svhs = 3,
  335. .muxsel = { 2, 3, 1, 1},
  336. .gpiomask = 0x0f,
  337. .audiomux = { 0x0c, 0x04, 0x08, 0x04, 0},
  338. /* 0x04 for some cards ?? */
  339. .needs_tvaudio = 1,
  340. .tuner_type = -1,
  341. .audio_hook = avermedia_tvphone_audio,
  342. .has_remote = 1,
  343. },{
  344. .name = "MATRIX-Vision MV-Delta",
  345. .video_inputs = 5,
  346. .audio_inputs = 1,
  347. .tuner = -1,
  348. .svhs = 3,
  349. .gpiomask = 0,
  350. .muxsel = { 2, 3, 1, 0, 0},
  351. .audiomux = {0 },
  352. .needs_tvaudio = 1,
  353. .tuner_type = -1,
  354. },{
  355. /* ---- card 0x08 ---------------------------------- */
  356. .name = "Lifeview FlyVideo II (Bt848) LR26 / MAXI TV Video PCI2 LR26",
  357. .video_inputs = 4,
  358. .audio_inputs = 1,
  359. .tuner = 0,
  360. .svhs = 2,
  361. .gpiomask = 0xc00,
  362. .muxsel = { 2, 3, 1, 1},
  363. .audiomux = { 0, 0xc00, 0x800, 0x400, 0xc00, 0},
  364. .needs_tvaudio = 1,
  365. .pll = PLL_28,
  366. .tuner_type = -1,
  367. },{
  368. .name = "IMS/IXmicro TurboTV",
  369. .video_inputs = 3,
  370. .audio_inputs = 1,
  371. .tuner = 0,
  372. .svhs = 2,
  373. .gpiomask = 3,
  374. .muxsel = { 2, 3, 1, 1},
  375. .audiomux = { 1, 1, 2, 3, 0},
  376. .needs_tvaudio = 0,
  377. .pll = PLL_28,
  378. .tuner_type = TUNER_TEMIC_PAL,
  379. },{
  380. .name = "Hauppauge (bt878)",
  381. .video_inputs = 4,
  382. .audio_inputs = 1,
  383. .tuner = 0,
  384. .svhs = 2,
  385. .gpiomask = 0x0f, /* old: 7 */
  386. .muxsel = { 2, 0, 1, 1},
  387. .audiomux = { 0, 1, 2, 3, 4},
  388. .needs_tvaudio = 1,
  389. .pll = PLL_28,
  390. .tuner_type = -1,
  391. },{
  392. .name = "MIRO PCTV pro",
  393. .video_inputs = 3,
  394. .audio_inputs = 1,
  395. .tuner = 0,
  396. .svhs = 2,
  397. .gpiomask = 0x3014f,
  398. .muxsel = { 2, 3, 1, 1},
  399. .audiomux = { 0x20001,0x10001, 0, 0,10},
  400. .needs_tvaudio = 1,
  401. .tuner_type = -1,
  402. },{
  403. /* ---- card 0x0c ---------------------------------- */
  404. .name = "ADS Technologies Channel Surfer TV (bt848)",
  405. .video_inputs = 3,
  406. .audio_inputs = 1,
  407. .tuner = 0,
  408. .svhs = 2,
  409. .gpiomask = 15,
  410. .muxsel = { 2, 3, 1, 1},
  411. .audiomux = { 13, 14, 11, 7, 0, 0},
  412. .needs_tvaudio = 1,
  413. .tuner_type = -1,
  414. },{
  415. .name = "AVerMedia TVCapture 98",
  416. .video_inputs = 3,
  417. .audio_inputs = 4,
  418. .tuner = 0,
  419. .svhs = 2,
  420. .gpiomask = 15,
  421. .muxsel = { 2, 3, 1, 1},
  422. .audiomux = { 13, 14, 11, 7, 0, 0},
  423. .needs_tvaudio = 1,
  424. .msp34xx_alt = 1,
  425. .pll = PLL_28,
  426. .tuner_type = TUNER_PHILIPS_PAL,
  427. .audio_hook = avermedia_tv_stereo_audio,
  428. },{
  429. .name = "Aimslab Video Highway Xtreme (VHX)",
  430. .video_inputs = 3,
  431. .audio_inputs = 1,
  432. .tuner = 0,
  433. .svhs = 2,
  434. .gpiomask = 7,
  435. .muxsel = { 2, 3, 1, 1},
  436. .audiomux = { 0, 2, 1, 3, 4}, /* old: { 0, 1, 2, 3, 4} */
  437. .needs_tvaudio = 1,
  438. .pll = PLL_28,
  439. .tuner_type = -1,
  440. },{
  441. .name = "Zoltrix TV-Max",
  442. .video_inputs = 3,
  443. .audio_inputs = 1,
  444. .tuner = 0,
  445. .svhs = 2,
  446. .gpiomask = 15,
  447. .muxsel = { 2, 3, 1, 1},
  448. .audiomux = {0 , 0, 1 , 0, 10},
  449. .needs_tvaudio = 1,
  450. .tuner_type = -1,
  451. },{
  452. /* ---- card 0x10 ---------------------------------- */
  453. .name = "Prolink Pixelview PlayTV (bt878)",
  454. .video_inputs = 3,
  455. .audio_inputs = 1,
  456. .tuner = 0,
  457. .svhs = 2,
  458. .gpiomask = 0x01fe00,
  459. .muxsel = { 2, 3, 1, 1},
  460. // 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru>
  461. .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 },
  462. .needs_tvaudio = 1,
  463. .pll = PLL_28,
  464. .tuner_type = -1,
  465. },{
  466. .name = "Leadtek WinView 601",
  467. .video_inputs = 3,
  468. .audio_inputs = 1,
  469. .tuner = 0,
  470. .svhs = 2,
  471. .gpiomask = 0x8300f8,
  472. .muxsel = { 2, 3, 1, 1,0},
  473. .audiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007},
  474. .needs_tvaudio = 1,
  475. .tuner_type = -1,
  476. .audio_hook = winview_audio,
  477. .has_radio = 1,
  478. },{
  479. .name = "AVEC Intercapture",
  480. .video_inputs = 3,
  481. .audio_inputs = 2,
  482. .tuner = 0,
  483. .svhs = 2,
  484. .gpiomask = 0,
  485. .muxsel = {2, 3, 1, 1},
  486. .audiomux = {1, 0, 0, 0, 0},
  487. .needs_tvaudio = 1,
  488. .tuner_type = -1,
  489. },{
  490. .name = "Lifeview FlyVideo II EZ /FlyKit LR38 Bt848 (capture only)",
  491. .video_inputs = 4,
  492. .audio_inputs = 1,
  493. .tuner = -1,
  494. .svhs = -1,
  495. .gpiomask = 0x8dff00,
  496. .muxsel = { 2, 3, 1, 1},
  497. .audiomux = { 0 },
  498. .no_msp34xx = 1,
  499. .tuner_type = -1,
  500. },{
  501. /* ---- card 0x14 ---------------------------------- */
  502. .name = "CEI Raffles Card",
  503. .video_inputs = 3,
  504. .audio_inputs = 3,
  505. .tuner = 0,
  506. .svhs = 2,
  507. .muxsel = {2, 3, 1, 1},
  508. .tuner_type = -1,
  509. },{
  510. .name = "Lifeview FlyVideo 98/ Lucky Star Image World ConferenceTV LR50",
  511. .video_inputs = 4,
  512. .audio_inputs = 2, // tuner, line in
  513. .tuner = 0,
  514. .svhs = 2,
  515. .gpiomask = 0x1800,
  516. .muxsel = { 2, 3, 1, 1},
  517. .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800},
  518. .pll = PLL_28,
  519. .tuner_type = TUNER_PHILIPS_PAL_I,
  520. },{
  521. .name = "Askey CPH050/ Phoebe Tv Master + FM",
  522. .video_inputs = 3,
  523. .audio_inputs = 1,
  524. .tuner = 0,
  525. .svhs = 2,
  526. .gpiomask = 0xc00,
  527. .muxsel = { 2, 3, 1, 1},
  528. .audiomux = {0, 1, 0x800, 0x400, 0xc00, 0},
  529. .needs_tvaudio = 1,
  530. .pll = PLL_28,
  531. .tuner_type = -1,
  532. },{
  533. .name = "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV, bt878",
  534. .video_inputs = 3,
  535. .audio_inputs = 1,
  536. .tuner = 0,
  537. .svhs = -1,
  538. .gpiomask = 7,
  539. .muxsel = { 2, 3, -1 },
  540. .digital_mode = DIGITAL_MODE_CAMERA,
  541. .audiomux = { 0, 0, 0, 0, 0 },
  542. .no_msp34xx = 1,
  543. .pll = PLL_28,
  544. .tuner_type = TUNER_ALPS_TSBB5_PAL_I,
  545. },{
  546. /* ---- card 0x18 ---------------------------------- */
  547. .name = "Askey CPH05X/06X (bt878) [many vendors]",
  548. .video_inputs = 3,
  549. .audio_inputs = 1,
  550. .tuner = 0,
  551. .svhs = 2,
  552. .gpiomask = 0xe00,
  553. .muxsel = { 2, 3, 1, 1},
  554. .audiomux = {0x400, 0x400, 0x400, 0x400, 0xc00},
  555. .needs_tvaudio = 1,
  556. .pll = PLL_28,
  557. .tuner_type = -1,
  558. .has_remote = 1,
  559. },{
  560. .name = "Terratec TerraTV+ Version 1.0 (Bt848)/ Terra TValue Version 1.0/ Vobis TV-Boostar",
  561. .video_inputs = 3,
  562. .audio_inputs = 1,
  563. .tuner = 0,
  564. .svhs = 2,
  565. .gpiomask = 0x1f0fff,
  566. .muxsel = { 2, 3, 1, 1},
  567. .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000},
  568. .needs_tvaudio = 0,
  569. .tuner_type = TUNER_PHILIPS_PAL,
  570. .audio_hook = terratv_audio,
  571. },{
  572. .name = "Hauppauge WinCam newer (bt878)",
  573. .video_inputs = 4,
  574. .audio_inputs = 1,
  575. .tuner = 0,
  576. .svhs = 3,
  577. .gpiomask = 7,
  578. .muxsel = { 2, 0, 1, 1},
  579. .audiomux = { 0, 1, 2, 3, 4},
  580. .needs_tvaudio = 1,
  581. .tuner_type = -1,
  582. },{
  583. .name = "Lifeview FlyVideo 98/ MAXI TV Video PCI2 LR50",
  584. .video_inputs = 4,
  585. .audio_inputs = 2,
  586. .tuner = 0,
  587. .svhs = 2,
  588. .gpiomask = 0x1800,
  589. .muxsel = { 2, 3, 1, 1},
  590. .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800},
  591. .pll = PLL_28,
  592. .tuner_type = TUNER_PHILIPS_SECAM,
  593. },{
  594. /* ---- card 0x1c ---------------------------------- */
  595. .name = "Terratec TerraTV+ Version 1.1 (bt878)",
  596. .video_inputs = 3,
  597. .audio_inputs = 1,
  598. .tuner = 0,
  599. .svhs = 2,
  600. .gpiomask = 0x1f0fff,
  601. .muxsel = { 2, 3, 1, 1},
  602. .audiomux = { 0x20000, 0x30000, 0x10000, 0x00000, 0x40000},
  603. .needs_tvaudio = 0,
  604. .tuner_type = TUNER_PHILIPS_PAL,
  605. .audio_hook = terratv_audio,
  606. /* GPIO wiring:
  607. External 20 pin connector (for Active Radio Upgrade board)
  608. gpio00: i2c-sda
  609. gpio01: i2c-scl
  610. gpio02: om5610-data
  611. gpio03: om5610-clk
  612. gpio04: om5610-wre
  613. gpio05: om5610-stereo
  614. gpio06: rds6588-davn
  615. gpio07: Pin 7 n.c.
  616. gpio08: nIOW
  617. gpio09+10: nIOR, nSEL ?? (bt878)
  618. gpio09: nIOR (bt848)
  619. gpio10: nSEL (bt848)
  620. Sound Routing:
  621. gpio16: u2-A0 (1st 4052bt)
  622. gpio17: u2-A1
  623. gpio18: u2-nEN
  624. gpio19: u4-A0 (2nd 4052)
  625. gpio20: u4-A1
  626. u4-nEN - GND
  627. Btspy:
  628. 00000 : Cdrom (internal audio input)
  629. 10000 : ext. Video audio input
  630. 20000 : TV Mono
  631. a0000 : TV Mono/2
  632. 1a0000 : TV Stereo
  633. 30000 : Radio
  634. 40000 : Mute
  635. */
  636. },{
  637. /* Jannik Fritsch <jannik@techfak.uni-bielefeld.de> */
  638. .name = "Imagenation PXC200",
  639. .video_inputs = 5,
  640. .audio_inputs = 1,
  641. .tuner = -1,
  642. .svhs = 1, /* was: 4 */
  643. .gpiomask = 0,
  644. .muxsel = { 2, 3, 1, 0, 0},
  645. .audiomux = { 0 },
  646. .needs_tvaudio = 1,
  647. .tuner_type = -1,
  648. .muxsel_hook = PXC200_muxsel,
  649. },{
  650. .name = "Lifeview FlyVideo 98 LR50",
  651. .video_inputs = 4,
  652. .audio_inputs = 1,
  653. .tuner = 0,
  654. .svhs = 2,
  655. .gpiomask = 0x1800, //0x8dfe00
  656. .muxsel = { 2, 3, 1, 1},
  657. .audiomux = { 0, 0x0800, 0x1000, 0x1000, 0x1800, 0 },
  658. .pll = PLL_28,
  659. .tuner_type = -1,
  660. },{
  661. .name = "Formac iProTV, Formac ProTV I (bt848)",
  662. .video_inputs = 4,
  663. .audio_inputs = 1,
  664. .tuner = 0,
  665. .svhs = 3,
  666. .gpiomask = 1,
  667. .muxsel = { 2, 3, 1, 1},
  668. .audiomux = { 1, 0, 0, 0, 0 },
  669. .pll = PLL_28,
  670. .tuner_type = TUNER_PHILIPS_PAL,
  671. },{
  672. /* ---- card 0x20 ---------------------------------- */
  673. .name = "Intel Create and Share PCI/ Smart Video Recorder III",
  674. .video_inputs = 4,
  675. .audio_inputs = 0,
  676. .tuner = -1,
  677. .svhs = 2,
  678. .gpiomask = 0,
  679. .muxsel = { 2, 3, 1, 1},
  680. .audiomux = { 0 },
  681. .needs_tvaudio = 0,
  682. .tuner_type = 4,
  683. },{
  684. .name = "Terratec TerraTValue Version Bt878",
  685. .video_inputs = 3,
  686. .audio_inputs = 1,
  687. .tuner = 0,
  688. .svhs = 2,
  689. .gpiomask = 0xffff00,
  690. .muxsel = { 2, 3, 1, 1},
  691. .audiomux = { 0x500, 0, 0x300, 0x900, 0x900},
  692. .needs_tvaudio = 1,
  693. .pll = PLL_28,
  694. .tuner_type = TUNER_PHILIPS_PAL,
  695. },{
  696. .name = "Leadtek WinFast 2000/ WinFast 2000 XP",
  697. .video_inputs = 4,
  698. .audio_inputs = 1,
  699. .tuner = 0,
  700. .svhs = 2,
  701. .muxsel = { 2, 3, 1, 1, 0}, // TV, CVid, SVid, CVid over SVid connector
  702. /* Alexander Varakin <avarakin@hotmail.com> [stereo version] */
  703. .gpiomask = 0xb33000,
  704. .audiomux = { 0x122000,0x1000,0x0000,0x620000,0x800000 },
  705. /* Audio Routing for "WinFast 2000 XP" (no tv stereo !)
  706. gpio23 -- hef4052:nEnable (0x800000)
  707. gpio12 -- hef4052:A1
  708. gpio13 -- hef4052:A0
  709. 0x0000: external audio
  710. 0x1000: FM
  711. 0x2000: TV
  712. 0x3000: n.c.
  713. Note: There exists another variant "Winfast 2000" with tv stereo !?
  714. Note: eeprom only contains FF and pci subsystem id 107d:6606
  715. */
  716. .needs_tvaudio = 0,
  717. .pll = PLL_28,
  718. .has_radio = 1,
  719. .tuner_type = 5, // default for now, gpio reads BFFF06 for Pal bg+dk
  720. .audio_hook = winfast2000_audio,
  721. .has_remote = 1,
  722. },{
  723. .name = "Lifeview FlyVideo 98 LR50 / Chronos Video Shuttle II",
  724. .video_inputs = 4,
  725. .audio_inputs = 3,
  726. .tuner = 0,
  727. .svhs = 2,
  728. .gpiomask = 0x1800,
  729. .muxsel = { 2, 3, 1, 1},
  730. .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800},
  731. .pll = PLL_28,
  732. .tuner_type = -1,
  733. },{
  734. /* ---- card 0x24 ---------------------------------- */
  735. .name = "Lifeview FlyVideo 98FM LR50 / Typhoon TView TV/FM Tuner",
  736. .video_inputs = 4,
  737. .audio_inputs = 3,
  738. .tuner = 0,
  739. .svhs = 2,
  740. .gpiomask = 0x1800,
  741. .muxsel = { 2, 3, 1, 1},
  742. .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 },
  743. .pll = PLL_28,
  744. .tuner_type = -1,
  745. .has_radio = 1,
  746. },{
  747. .name = "Prolink PixelView PlayTV pro",
  748. .video_inputs = 3,
  749. .audio_inputs = 1,
  750. .tuner = 0,
  751. .svhs = 2,
  752. .gpiomask = 0xff,
  753. .muxsel = { 2, 3, 1, 1 },
  754. .audiomux = { 0x21, 0x20, 0x24, 0x2c, 0x29, 0x29 },
  755. .no_msp34xx = 1,
  756. .pll = PLL_28,
  757. .tuner_type = -1,
  758. },{
  759. .name = "Askey CPH06X TView99",
  760. .video_inputs = 4,
  761. .audio_inputs = 1,
  762. .tuner = 0,
  763. .svhs = 2,
  764. .gpiomask = 0x551e00,
  765. .muxsel = { 2, 3, 1, 0},
  766. .audiomux = { 0x551400, 0x551200, 0, 0, 0x551c00, 0x551200 },
  767. .needs_tvaudio = 1,
  768. .pll = PLL_28,
  769. .tuner_type = 1,
  770. .has_remote = 1,
  771. },{
  772. .name = "Pinnacle PCTV Studio/Rave",
  773. .video_inputs = 3,
  774. .audio_inputs = 1,
  775. .tuner = 0,
  776. .svhs = 2,
  777. .gpiomask = 0x03000F,
  778. .muxsel = { 2, 3, 1, 1},
  779. .audiomux = { 2, 0xd0001, 0, 0, 1},
  780. .needs_tvaudio = 0,
  781. .pll = PLL_28,
  782. .tuner_type = -1,
  783. },{
  784. /* ---- card 0x28 ---------------------------------- */
  785. .name = "STB TV PCI FM, Gateway P/N 6000704 (bt878), 3Dfx VoodooTV 100",
  786. .video_inputs = 3,
  787. .audio_inputs = 1,
  788. .tuner = 0,
  789. .svhs = 2,
  790. .gpiomask = 7,
  791. .muxsel = { 2, 3, 1, 1},
  792. .audiomux = { 4, 0, 2, 3, 1},
  793. .no_msp34xx = 1,
  794. .needs_tvaudio = 1,
  795. .tuner_type = TUNER_PHILIPS_NTSC,
  796. .pll = PLL_28,
  797. .has_radio = 1,
  798. },{
  799. .name = "AVerMedia TVPhone 98",
  800. .video_inputs = 3,
  801. .audio_inputs = 4,
  802. .tuner = 0,
  803. .svhs = 2,
  804. .gpiomask = 15,
  805. .muxsel = { 2, 3, 1, 1},
  806. .audiomux = { 13, 4, 11, 7, 0, 0},
  807. .needs_tvaudio = 1,
  808. .pll = PLL_28,
  809. .tuner_type = -1,
  810. .has_radio = 1,
  811. .audio_hook = avermedia_tvphone_audio,
  812. },{
  813. .name = "ProVideo PV951", /* pic16c54 */
  814. .video_inputs = 3,
  815. .audio_inputs = 1,
  816. .tuner = 0,
  817. .svhs = 2,
  818. .gpiomask = 0,
  819. .muxsel = { 2, 3, 1, 1},
  820. .audiomux = { 0, 0, 0, 0, 0},
  821. .needs_tvaudio = 1,
  822. .no_msp34xx = 1,
  823. .pll = PLL_28,
  824. .tuner_type = 1,
  825. },{
  826. .name = "Little OnAir TV",
  827. .video_inputs = 3,
  828. .audio_inputs = 1,
  829. .tuner = 0,
  830. .svhs = 2,
  831. .gpiomask = 0xe00b,
  832. .muxsel = {2, 3, 1, 1},
  833. .audiomux = {0xff9ff6, 0xff9ff6, 0xff1ff7, 0, 0xff3ffc},
  834. .no_msp34xx = 1,
  835. .tuner_type = -1,
  836. },{
  837. /* ---- card 0x2c ---------------------------------- */
  838. .name = "Sigma TVII-FM",
  839. .video_inputs = 2,
  840. .audio_inputs = 1,
  841. .tuner = 0,
  842. .svhs = -1,
  843. .gpiomask = 3,
  844. .muxsel = {2, 3, 1, 1},
  845. .audiomux = {1, 1, 0, 2, 3},
  846. .no_msp34xx = 1,
  847. .pll = PLL_NONE,
  848. .tuner_type = -1,
  849. },{
  850. .name = "MATRIX-Vision MV-Delta 2",
  851. .video_inputs = 5,
  852. .audio_inputs = 1,
  853. .tuner = -1,
  854. .svhs = 3,
  855. .gpiomask = 0,
  856. .muxsel = { 2, 3, 1, 0, 0},
  857. .audiomux = {0 },
  858. .no_msp34xx = 1,
  859. .pll = PLL_28,
  860. .tuner_type = -1,
  861. },{
  862. .name = "Zoltrix Genie TV/FM",
  863. .video_inputs = 3,
  864. .audio_inputs = 1,
  865. .tuner = 0,
  866. .svhs = 2,
  867. .gpiomask = 0xbcf03f,
  868. .muxsel = { 2, 3, 1, 1},
  869. .audiomux = { 0xbc803f, 0xbc903f, 0xbcb03f, 0, 0xbcb03f},
  870. .no_msp34xx = 1,
  871. .pll = PLL_28,
  872. .tuner_type = 21,
  873. },{
  874. .name = "Terratec TV/Radio+",
  875. .video_inputs = 3,
  876. .audio_inputs = 1,
  877. .tuner = 0,
  878. .svhs = 2,
  879. .gpiomask = 0x70000,
  880. .muxsel = { 2, 3, 1, 1},
  881. .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000, 0x20000 },
  882. .needs_tvaudio = 1,
  883. .no_msp34xx = 1,
  884. .pll = PLL_35,
  885. .tuner_type = 1,
  886. .has_radio = 1,
  887. },{
  888. /* ---- card 0x30 ---------------------------------- */
  889. .name = "Askey CPH03x/ Dynalink Magic TView",
  890. .video_inputs = 3,
  891. .audio_inputs = 1,
  892. .tuner = 0,
  893. .svhs = 2,
  894. .gpiomask = 15,
  895. .muxsel = { 2, 3, 1, 1},
  896. .audiomux = {2,0,0,0,1},
  897. .needs_tvaudio = 1,
  898. .pll = PLL_28,
  899. .tuner_type = -1,
  900. },{
  901. .name = "IODATA GV-BCTV3/PCI",
  902. .video_inputs = 3,
  903. .audio_inputs = 1,
  904. .tuner = 0,
  905. .svhs = 2,
  906. .gpiomask = 0x010f00,
  907. .muxsel = {2, 3, 0, 0},
  908. .audiomux = {0x10000, 0, 0x10000, 0, 0, 0},
  909. .no_msp34xx = 1,
  910. .pll = PLL_28,
  911. .tuner_type = TUNER_ALPS_TSHC6_NTSC,
  912. .audio_hook = gvbctv3pci_audio,
  913. },{
  914. .name = "Prolink PV-BT878P+4E / PixelView PlayTV PAK / Lenco MXTV-9578 CP",
  915. .video_inputs = 5,
  916. .audio_inputs = 1,
  917. .tuner = 0,
  918. .svhs = 3,
  919. .gpiomask = 0xAA0000,
  920. .muxsel = { 2,3,1,1,-1 },
  921. .digital_mode = DIGITAL_MODE_CAMERA,
  922. .audiomux = { 0x20000, 0, 0x80000, 0x80000, 0xa8000, 0x46000 },
  923. .no_msp34xx = 1,
  924. .pll = PLL_28,
  925. .tuner_type = TUNER_PHILIPS_PAL_I,
  926. .has_remote = 1,
  927. /* GPIO wiring: (different from Rev.4C !)
  928. GPIO17: U4.A0 (first hef4052bt)
  929. GPIO19: U4.A1
  930. GPIO20: U5.A1 (second hef4052bt)
  931. GPIO21: U4.nEN
  932. GPIO22: BT832 Reset Line
  933. GPIO23: A5,A0, U5,nEN
  934. Note: At i2c=0x8a is a Bt832 chip, which changes to 0x88 after being reset via GPIO22
  935. */
  936. },{
  937. .name = "Eagle Wireless Capricorn2 (bt878A)",
  938. .video_inputs = 4,
  939. .audio_inputs = 1,
  940. .tuner = 0,
  941. .svhs = 2,
  942. .gpiomask = 7,
  943. .muxsel = { 2, 0, 1, 1},
  944. .audiomux = { 0, 1, 2, 3, 4},
  945. .pll = PLL_28,
  946. .tuner_type = -1 /* TUNER_ALPS_TMDH2_NTSC */,
  947. },{
  948. /* ---- card 0x34 ---------------------------------- */
  949. /* David Härdeman <david@2gen.com> */
  950. .name = "Pinnacle PCTV Studio Pro",
  951. .video_inputs = 4,
  952. .audio_inputs = 1,
  953. .tuner = 0,
  954. .svhs = 3,
  955. .gpiomask = 0x03000F,
  956. .muxsel = { 2, 3, 1, 1},
  957. .audiomux = { 1, 0xd0001, 0, 0, 10},
  958. /* sound path (5 sources):
  959. MUX1 (mask 0x03), Enable Pin 0x08 (0=enable, 1=disable)
  960. 0= ext. Audio IN
  961. 1= from MUX2
  962. 2= Mono TV sound from Tuner
  963. 3= not connected
  964. MUX2 (mask 0x30000):
  965. 0,2,3= from MSP34xx
  966. 1= FM stereo Radio from Tuner */
  967. .needs_tvaudio = 0,
  968. .pll = PLL_28,
  969. .tuner_type = -1,
  970. },{
  971. /* Claas Langbehn <claas@bigfoot.com>,
  972. Sven Grothklags <sven@upb.de> */
  973. .name = "Typhoon TView RDS + FM Stereo / KNC1 TV Station RDS",
  974. .video_inputs = 4,
  975. .audio_inputs = 3,
  976. .tuner = 0,
  977. .svhs = 2,
  978. .gpiomask = 0x1c,
  979. .muxsel = { 2, 3, 1, 1},
  980. .audiomux = { 0, 0, 0x10, 8, 4 },
  981. .needs_tvaudio = 1,
  982. .pll = PLL_28,
  983. .tuner_type = TUNER_PHILIPS_PAL,
  984. .has_radio = 1,
  985. },{
  986. /* Tim Röstermundt <rosterm@uni-muenster.de>
  987. in de.comp.os.unix.linux.hardware:
  988. options bttv card=0 pll=1 radio=1 gpiomask=0x18e0
  989. audiomux=0x44c71f,0x44d71f,0,0x44d71f,0x44dfff
  990. options tuner type=5 */
  991. .name = "Lifeview FlyVideo 2000 /FlyVideo A2/ Lifetec LT 9415 TV [LR90]",
  992. .video_inputs = 4,
  993. .audio_inputs = 1,
  994. .tuner = 0,
  995. .svhs = 2,
  996. .gpiomask = 0x18e0,
  997. .muxsel = { 2, 3, 1, 1},
  998. .audiomux = { 0x0000,0x0800,0x1000,0x1000,0x18e0 },
  999. /* For cards with tda9820/tda9821:
  1000. 0x0000: Tuner normal stereo
  1001. 0x0080: Tuner A2 SAP (second audio program = Zweikanalton)
  1002. 0x0880: Tuner A2 stereo */
  1003. .pll = PLL_28,
  1004. .tuner_type = -1,
  1005. },{
  1006. /* Miguel Angel Alvarez <maacruz@navegalia.com>
  1007. old Easy TV BT848 version (model CPH031) */
  1008. .name = "Askey CPH031/ BESTBUY Easy TV",
  1009. .video_inputs = 4,
  1010. .audio_inputs = 1,
  1011. .tuner = 0,
  1012. .svhs = 2,
  1013. .gpiomask = 0xF,
  1014. .muxsel = { 2, 3, 1, 0},
  1015. .audiomux = { 2, 0, 0, 0, 10},
  1016. .needs_tvaudio = 0,
  1017. .pll = PLL_28,
  1018. .tuner_type = TUNER_TEMIC_PAL,
  1019. },{
  1020. /* ---- card 0x38 ---------------------------------- */
  1021. /* Gordon Heydon <gjheydon@bigfoot.com ('98) */
  1022. .name = "Lifeview FlyVideo 98FM LR50",
  1023. .video_inputs = 4,
  1024. .audio_inputs = 3,
  1025. .tuner = 0,
  1026. .svhs = 2,
  1027. .gpiomask = 0x1800,
  1028. .muxsel = { 2, 3, 1, 1},
  1029. .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 },
  1030. .pll = PLL_28,
  1031. .tuner_type = 5,
  1032. },{
  1033. /* This is the ultimate cheapo capture card
  1034. * just a BT848A on a small PCB!
  1035. * Steve Hosgood <steve@equiinet.com> */
  1036. .name = "GrandTec 'Grand Video Capture' (Bt848)",
  1037. .video_inputs = 2,
  1038. .audio_inputs = 0,
  1039. .tuner = -1,
  1040. .svhs = 1,
  1041. .gpiomask = 0,
  1042. .muxsel = { 3, 1 },
  1043. .audiomux = { 0 },
  1044. .needs_tvaudio = 0,
  1045. .no_msp34xx = 1,
  1046. .pll = PLL_35,
  1047. .tuner_type = -1,
  1048. },{
  1049. /* Daniel Herrington <daniel.herrington@home.com> */
  1050. .name = "Askey CPH060/ Phoebe TV Master Only (No FM)",
  1051. .video_inputs = 3,
  1052. .audio_inputs = 1,
  1053. .tuner = 0,
  1054. .svhs = 2,
  1055. .gpiomask = 0xe00,
  1056. .muxsel = { 2, 3, 1, 1},
  1057. .audiomux = { 0x400, 0x400, 0x400, 0x400, 0x800, 0x400 },
  1058. .needs_tvaudio = 1,
  1059. .pll = PLL_28,
  1060. .tuner_type = TUNER_TEMIC_4036FY5_NTSC,
  1061. },{
  1062. /* Matti Mottus <mottus@physic.ut.ee> */
  1063. .name = "Askey CPH03x TV Capturer",
  1064. .video_inputs = 4,
  1065. .audio_inputs = 1,
  1066. .tuner = 0,
  1067. .svhs = 2,
  1068. .gpiomask = 0x03000F,
  1069. .muxsel = { 2, 3, 1, 0},
  1070. .audiomux = { 2,0,0,0,1 },
  1071. .pll = PLL_28,
  1072. .tuner_type = 0,
  1073. },{
  1074. /* ---- card 0x3c ---------------------------------- */
  1075. /* Philip Blundell <philb@gnu.org> */
  1076. .name = "Modular Technology MM100PCTV",
  1077. .video_inputs = 2,
  1078. .audio_inputs = 2,
  1079. .tuner = 0,
  1080. .svhs = -1,
  1081. .gpiomask = 11,
  1082. .muxsel = { 2, 3, 1, 1},
  1083. .audiomux = { 2, 0, 0, 1, 8},
  1084. .pll = PLL_35,
  1085. .tuner_type = TUNER_TEMIC_PAL,
  1086. },{
  1087. /* Adrian Cox <adrian@humboldt.co.uk */
  1088. .name = "AG Electronics GMV1",
  1089. .video_inputs = 2,
  1090. .audio_inputs = 0,
  1091. .tuner = -1,
  1092. .svhs = 1,
  1093. .gpiomask = 0xF,
  1094. .muxsel = { 2, 2},
  1095. .audiomux = { },
  1096. .no_msp34xx = 1,
  1097. .needs_tvaudio = 0,
  1098. .pll = PLL_28,
  1099. .tuner_type = -1,
  1100. },{
  1101. /* Miguel Angel Alvarez <maacruz@navegalia.com>
  1102. new Easy TV BT878 version (model CPH061)
  1103. special thanks to Informatica Mieres for providing the card */
  1104. .name = "Askey CPH061/ BESTBUY Easy TV (bt878)",
  1105. .video_inputs = 3,
  1106. .audio_inputs = 2,
  1107. .tuner = 0,
  1108. .svhs = 2,
  1109. .gpiomask = 0xFF,
  1110. .muxsel = { 2, 3, 1, 0},
  1111. .audiomux = { 1, 0, 4, 4, 9},
  1112. .needs_tvaudio = 0,
  1113. .pll = PLL_28,
  1114. .tuner_type = TUNER_PHILIPS_PAL,
  1115. },{
  1116. /* Lukas Gebauer <geby@volny.cz> */
  1117. .name = "ATI TV-Wonder",
  1118. .video_inputs = 3,
  1119. .audio_inputs = 1,
  1120. .tuner = 0,
  1121. .svhs = 2,
  1122. .gpiomask = 0xf03f,
  1123. .muxsel = { 2, 3, 1, 0 },
  1124. .audiomux = { 0xbffe, 0, 0xbfff, 0, 0xbffe},
  1125. .pll = PLL_28,
  1126. .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL,
  1127. },{
  1128. /* ---- card 0x40 ---------------------------------- */
  1129. /* Lukas Gebauer <geby@volny.cz> */
  1130. .name = "ATI TV-Wonder VE",
  1131. .video_inputs = 2,
  1132. .audio_inputs = 1,
  1133. .tuner = 0,
  1134. .svhs = -1,
  1135. .gpiomask = 1,
  1136. .muxsel = { 2, 3, 0, 1},
  1137. .audiomux = { 0, 0, 1, 0, 0},
  1138. .no_msp34xx = 1,
  1139. .pll = PLL_28,
  1140. .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL,
  1141. },{
  1142. /* DeeJay <deejay@westel900.net (2000S) */
  1143. .name = "Lifeview FlyVideo 2000S LR90",
  1144. .video_inputs = 3,
  1145. .audio_inputs = 3,
  1146. .tuner = 0,
  1147. .svhs = 2,
  1148. .gpiomask = 0x18e0,
  1149. .muxsel = { 2, 3, 0, 1},
  1150. /* Radio changed from 1e80 to 0x800 to make
  1151. FlyVideo2000S in .hu happy (gm)*/
  1152. /* -dk-???: set mute=0x1800 for tda9874h daughterboard */
  1153. .audiomux = { 0x0000,0x0800,0x1000,0x1000,0x1800, 0x1080 },
  1154. .audio_hook = fv2000s_audio,
  1155. .no_msp34xx = 1,
  1156. .no_tda9875 = 1,
  1157. .needs_tvaudio = 1,
  1158. .pll = PLL_28,
  1159. .tuner_type = 5,
  1160. },{
  1161. .name = "Terratec TValueRadio",
  1162. .video_inputs = 3,
  1163. .audio_inputs = 1,
  1164. .tuner = 0,
  1165. .svhs = 2,
  1166. .gpiomask = 0xffff00,
  1167. .muxsel = { 2, 3, 1, 1},
  1168. .audiomux = { 0x500, 0x500, 0x300, 0x900, 0x900},
  1169. .needs_tvaudio = 1,
  1170. .pll = PLL_28,
  1171. .tuner_type = TUNER_PHILIPS_PAL,
  1172. .has_radio = 1,
  1173. },{
  1174. /* TANAKA Kei <peg00625@nifty.com> */
  1175. .name = "IODATA GV-BCTV4/PCI",
  1176. .video_inputs = 3,
  1177. .audio_inputs = 1,
  1178. .tuner = 0,
  1179. .svhs = 2,
  1180. .gpiomask = 0x010f00,
  1181. .muxsel = {2, 3, 0, 0},
  1182. .audiomux = {0x10000, 0, 0x10000, 0, 0, 0},
  1183. .no_msp34xx = 1,
  1184. .pll = PLL_28,
  1185. .tuner_type = TUNER_SHARP_2U5JF5540_NTSC,
  1186. .audio_hook = gvbctv3pci_audio,
  1187. },{
  1188. /* ---- card 0x44 ---------------------------------- */
  1189. .name = "3Dfx VoodooTV FM (Euro), VoodooTV 200 (USA)",
  1190. // try "insmod msp3400 simple=0" if you have
  1191. // sound problems with this card.
  1192. .video_inputs = 4,
  1193. .audio_inputs = 1,
  1194. .tuner = 0,
  1195. .svhs = -1,
  1196. .gpiomask = 0x4f8a00,
  1197. // 0x100000: 1=MSP enabled (0=disable again)
  1198. // 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC)
  1199. .audiomux = {0x947fff, 0x987fff,0x947fff,0x947fff, 0x947fff},
  1200. // tvtuner, radio, external,internal, mute, stereo
  1201. /* tuner, Composit, SVid, Composit-on-Svid-adapter*/
  1202. .muxsel = { 2, 3 ,0 ,1},
  1203. .tuner_type = TUNER_MT2032,
  1204. .pll = PLL_28,
  1205. .has_radio = 1,
  1206. },{
  1207. /* Philip Blundell <pb@nexus.co.uk> */
  1208. .name = "Active Imaging AIMMS",
  1209. .video_inputs = 1,
  1210. .audio_inputs = 0,
  1211. .tuner = -1,
  1212. .tuner_type = -1,
  1213. .pll = PLL_28,
  1214. .muxsel = { 2 },
  1215. .gpiomask = 0
  1216. },{
  1217. /* Tomasz Pyra <hellfire@sedez.iq.pl> */
  1218. .name = "Prolink Pixelview PV-BT878P+ (Rev.4C,8E)",
  1219. .video_inputs = 3,
  1220. .audio_inputs = 4,
  1221. .tuner = 0,
  1222. .svhs = 2,
  1223. .gpiomask = 15,
  1224. .muxsel = { 2, 3, 1, 1},
  1225. .audiomux = { 0, 0, 11, 7, 13, 0}, // TV and Radio with same GPIO !
  1226. .needs_tvaudio = 1,
  1227. .pll = PLL_28,
  1228. .tuner_type = 25,
  1229. .has_remote = 1,
  1230. /* GPIO wiring:
  1231. GPIO0: U4.A0 (hef4052bt)
  1232. GPIO1: U4.A1
  1233. GPIO2: U4.A1 (second hef4052bt)
  1234. GPIO3: U4.nEN, U5.A0, A5.nEN
  1235. GPIO8-15: vrd866b ?
  1236. */
  1237. },{
  1238. .name = "Lifeview FlyVideo 98EZ (capture only) LR51",
  1239. .video_inputs = 4,
  1240. .audio_inputs = 0,
  1241. .tuner = -1,
  1242. .svhs = 2,
  1243. .muxsel = { 2, 3, 1, 1}, // AV1, AV2, SVHS, CVid adapter on SVHS
  1244. .pll = PLL_28,
  1245. .no_msp34xx = 1,
  1246. },{
  1247. /* ---- card 0x48 ---------------------------------- */
  1248. /* Dariusz Kowalewski <darekk@automex.pl> */
  1249. .name = "Prolink Pixelview PV-BT878P+9B (PlayTV Pro rev.9B FM+NICAM)",
  1250. .video_inputs = 4,
  1251. .audio_inputs = 1,
  1252. .tuner = 0,
  1253. .svhs = 2,
  1254. .gpiomask = 0x3f,
  1255. .muxsel = { 2, 3, 1, 1 },
  1256. .audiomux = { 0x01, 0x00, 0x03, 0x03, 0x09, 0x02 },
  1257. .needs_tvaudio = 1,
  1258. .no_msp34xx = 1,
  1259. .no_tda9875 = 1,
  1260. .pll = PLL_28,
  1261. .tuner_type = 5,
  1262. .audio_hook = pvbt878p9b_audio, // Note: not all cards have stereo
  1263. .has_radio = 1, // Note: not all cards have radio
  1264. .has_remote = 1,
  1265. /* GPIO wiring:
  1266. GPIO0: A0 hef4052
  1267. GPIO1: A1 hef4052
  1268. GPIO3: nEN hef4052
  1269. GPIO8-15: vrd866b
  1270. GPIO20,22,23: R30,R29,R28
  1271. */
  1272. },{
  1273. /* Clay Kunz <ckunz@mail.arc.nasa.gov> */
  1274. /* you must jumper JP5 for the card to work */
  1275. .name = "Sensoray 311",
  1276. .video_inputs = 5,
  1277. .audio_inputs = 0,
  1278. .tuner = -1,
  1279. .svhs = 4,
  1280. .gpiomask = 0,
  1281. .muxsel = { 2, 3, 1, 0, 0},
  1282. .audiomux = { 0 },
  1283. .needs_tvaudio = 0,
  1284. .tuner_type = -1,
  1285. },{
  1286. /* Miguel Freitas <miguel@cetuc.puc-rio.br> */
  1287. .name = "RemoteVision MX (RV605)",
  1288. .video_inputs = 16,
  1289. .audio_inputs = 0,
  1290. .tuner = -1,
  1291. .svhs = -1,
  1292. .gpiomask = 0x00,
  1293. .gpiomask2 = 0x07ff,
  1294. .muxsel = { 0x33, 0x13, 0x23, 0x43, 0xf3, 0x73, 0xe3, 0x03,
  1295. 0xd3, 0xb3, 0xc3, 0x63, 0x93, 0x53, 0x83, 0xa3 },
  1296. .no_msp34xx = 1,
  1297. .no_tda9875 = 1,
  1298. .tuner_type = -1,
  1299. .muxsel_hook = rv605_muxsel,
  1300. },{
  1301. .name = "Powercolor MTV878/ MTV878R/ MTV878F",
  1302. .video_inputs = 3,
  1303. .audio_inputs = 2,
  1304. .tuner = 0,
  1305. .svhs = 2,
  1306. .gpiomask = 0x1C800F, // Bit0-2: Audio select, 8-12:remote control 14:remote valid 15:remote reset
  1307. .muxsel = { 2, 1, 1, },
  1308. .audiomux = { 0, 1, 2, 2, 4 },
  1309. .needs_tvaudio = 0,
  1310. .tuner_type = TUNER_PHILIPS_PAL,
  1311. .pll = PLL_28,
  1312. .has_radio = 1,
  1313. },{
  1314. /* ---- card 0x4c ---------------------------------- */
  1315. /* Masaki Suzuki <masaki@btree.org> */
  1316. .name = "Canopus WinDVR PCI (COMPAQ Presario 3524JP, 5112JP)",
  1317. .video_inputs = 3,
  1318. .audio_inputs = 1,
  1319. .tuner = 0,
  1320. .svhs = 2,
  1321. .gpiomask = 0x140007,
  1322. .muxsel = { 2, 3, 1, 1 },
  1323. .audiomux = { 0, 1, 2, 3, 4, 0 },
  1324. .tuner_type = TUNER_PHILIPS_NTSC,
  1325. .audio_hook = windvr_audio,
  1326. },{
  1327. .name = "GrandTec Multi Capture Card (Bt878)",
  1328. .video_inputs = 4,
  1329. .audio_inputs = 0,
  1330. .tuner = -1,
  1331. .svhs = -1,
  1332. .gpiomask = 0,
  1333. .muxsel = { 2, 3, 1, 0 },
  1334. .audiomux = { 0 },
  1335. .needs_tvaudio = 0,
  1336. .no_msp34xx = 1,
  1337. .pll = PLL_28,
  1338. .tuner_type = -1,
  1339. },{
  1340. .name = "Jetway TV/Capture JW-TV878-FBK, Kworld KW-TV878RF",
  1341. .video_inputs = 4,
  1342. .audio_inputs = 3,
  1343. .tuner = 0,
  1344. .svhs = 2,
  1345. .gpiomask = 7,
  1346. .muxsel = { 2, 3, 1, 1 }, // Tuner, SVid, SVHS, SVid to SVHS connector
  1347. .audiomux = { 0 ,0 ,4, 4,4,4},// Yes, this tuner uses the same audio output for TV and FM radio!
  1348. // This card lacks external Audio In, so we mute it on Ext. & Int.
  1349. // The PCB can take a sbx1637/sbx1673, wiring unknown.
  1350. // This card lacks PCI subsystem ID, sigh.
  1351. // audiomux=1: lower volume, 2+3: mute
  1352. // btwincap uses 0x80000/0x80003
  1353. .needs_tvaudio = 0,
  1354. .no_msp34xx = 1,
  1355. .pll = PLL_28,
  1356. .tuner_type = 5, // Samsung TCPA9095PC27A (BG+DK), philips compatible, w/FM, stereo and
  1357. // radio signal strength indicators work fine.
  1358. .has_radio = 1,
  1359. /* GPIO Info:
  1360. GPIO0,1: HEF4052 A0,A1
  1361. GPIO2: HEF4052 nENABLE
  1362. GPIO3-7: n.c.
  1363. GPIO8-13: IRDC357 data0-5 (data6 n.c. ?) [chip not present on my card]
  1364. GPIO14,15: ??
  1365. GPIO16-21: n.c.
  1366. GPIO22,23: ??
  1367. ?? : mtu8b56ep microcontroller for IR (GPIO wiring unknown)*/
  1368. },{
  1369. /* Arthur Tetzlaff-Deas, DSP Design Ltd <software@dspdesign.com> */
  1370. .name = "DSP Design TCVIDEO",
  1371. .video_inputs = 4,
  1372. .svhs = -1,
  1373. .muxsel = { 2, 3, 1, 0},
  1374. .pll = PLL_28,
  1375. .tuner_type = -1,
  1376. },{
  1377. /* ---- card 0x50 ---------------------------------- */
  1378. .name = "Hauppauge WinTV PVR",
  1379. .video_inputs = 4,
  1380. .audio_inputs = 1,
  1381. .tuner = 0,
  1382. .svhs = 2,
  1383. .muxsel = { 2, 0, 1, 1},
  1384. .needs_tvaudio = 1,
  1385. .pll = PLL_28,
  1386. .tuner_type = -1,
  1387. .gpiomask = 7,
  1388. .audiomux = {7},
  1389. },{
  1390. .name = "IODATA GV-BCTV5/PCI",
  1391. .video_inputs = 3,
  1392. .audio_inputs = 1,
  1393. .tuner = 0,
  1394. .svhs = 2,
  1395. .gpiomask = 0x0f0f80,
  1396. .muxsel = {2, 3, 1, 0},
  1397. .audiomux = {0x030000, 0x010000, 0, 0, 0x020000, 0},
  1398. .no_msp34xx = 1,
  1399. .pll = PLL_28,
  1400. .tuner_type = TUNER_PHILIPS_NTSC_M,
  1401. .audio_hook = gvbctv5pci_audio,
  1402. .has_radio = 1,
  1403. },{
  1404. .name = "Osprey 100/150 (878)", /* 0x1(2|3)-45C6-C1 */
  1405. .video_inputs = 4, /* id-inputs-clock */
  1406. .audio_inputs = 0,
  1407. .tuner = -1,
  1408. .svhs = 3,
  1409. .muxsel = { 3, 2, 0, 1 },
  1410. .pll = PLL_28,
  1411. .tuner_type = -1,
  1412. .no_msp34xx = 1,
  1413. .no_tda9875 = 1,
  1414. .no_tda7432 = 1,
  1415. },{
  1416. .name = "Osprey 100/150 (848)", /* 0x04-54C0-C1 & older boards */
  1417. .video_inputs = 3,
  1418. .audio_inputs = 0,
  1419. .tuner = -1,
  1420. .svhs = 2,
  1421. .muxsel = { 2, 3, 1 },
  1422. .pll = PLL_28,
  1423. .tuner_type = -1,
  1424. .no_msp34xx = 1,
  1425. .no_tda9875 = 1,
  1426. .no_tda7432 = 1,
  1427. },{
  1428. /* ---- card 0x54 ---------------------------------- */
  1429. .name = "Osprey 101 (848)", /* 0x05-40C0-C1 */
  1430. .video_inputs = 2,
  1431. .audio_inputs = 0,
  1432. .tuner = -1,
  1433. .svhs = 1,
  1434. .muxsel = { 3, 1 },
  1435. .pll = PLL_28,
  1436. .tuner_type = -1,
  1437. .no_msp34xx = 1,
  1438. .no_tda9875 = 1,
  1439. .no_tda7432 = 1,
  1440. },{
  1441. .name = "Osprey 101/151", /* 0x1(4|5)-0004-C4 */
  1442. .video_inputs = 1,
  1443. .audio_inputs = 0,
  1444. .tuner = -1,
  1445. .svhs = -1,
  1446. .muxsel = { 0 },
  1447. .pll = PLL_28,
  1448. .tuner_type = -1,
  1449. .no_msp34xx = 1,
  1450. .no_tda9875 = 1,
  1451. .no_tda7432 = 1,
  1452. },{
  1453. .name = "Osprey 101/151 w/ svid", /* 0x(16|17|20)-00C4-C1 */
  1454. .video_inputs = 2,
  1455. .audio_inputs = 0,
  1456. .tuner = -1,
  1457. .svhs = 1,
  1458. .muxsel = { 0, 1 },
  1459. .pll = PLL_28,
  1460. .tuner_type = -1,
  1461. .no_msp34xx = 1,
  1462. .no_tda9875 = 1,
  1463. .no_tda7432 = 1,
  1464. },{
  1465. .name = "Osprey 200/201/250/251", /* 0x1(8|9|E|F)-0004-C4 */
  1466. .video_inputs = 1,
  1467. .audio_inputs = 1,
  1468. .tuner = -1,
  1469. .svhs = -1,
  1470. .muxsel = { 0 },
  1471. .pll = PLL_28,
  1472. .tuner_type = -1,
  1473. .no_msp34xx = 1,
  1474. .no_tda9875 = 1,
  1475. .no_tda7432 = 1,
  1476. },{
  1477. /* ---- card 0x58 ---------------------------------- */
  1478. .name = "Osprey 200/250", /* 0x1(A|B)-00C4-C1 */
  1479. .video_inputs = 2,
  1480. .audio_inputs = 1,
  1481. .tuner = -1,
  1482. .svhs = 1,
  1483. .muxsel = { 0, 1 },
  1484. .pll = PLL_28,
  1485. .tuner_type = -1,
  1486. .no_msp34xx = 1,
  1487. .no_tda9875 = 1,
  1488. .no_tda7432 = 1,
  1489. },{
  1490. .name = "Osprey 210/220", /* 0x1(A|B)-04C0-C1 */
  1491. .video_inputs = 2,
  1492. .audio_inputs = 1,
  1493. .tuner = -1,
  1494. .svhs = 1,
  1495. .muxsel = { 2, 3 },
  1496. .pll = PLL_28,
  1497. .tuner_type = -1,
  1498. .no_msp34xx = 1,
  1499. .no_tda9875 = 1,
  1500. .no_tda7432 = 1,
  1501. },{
  1502. .name = "Osprey 500", /* 500 */
  1503. .video_inputs = 2,
  1504. .audio_inputs = 1,
  1505. .tuner = -1,
  1506. .svhs = 1,
  1507. .muxsel = { 2, 3 },
  1508. .pll = PLL_28,
  1509. .tuner_type = -1,
  1510. .no_msp34xx = 1,
  1511. .no_tda9875 = 1,
  1512. .no_tda7432 = 1,
  1513. },{
  1514. .name = "Osprey 540", /* 540 */
  1515. .video_inputs = 4,
  1516. .audio_inputs = 1,
  1517. .tuner = -1,
  1518. .pll = PLL_28,
  1519. .tuner_type = -1,
  1520. .no_msp34xx = 1,
  1521. .no_tda9875 = 1,
  1522. .no_tda7432 = 1,
  1523. },{
  1524. /* ---- card 0x5C ---------------------------------- */
  1525. .name = "Osprey 2000", /* 2000 */
  1526. .video_inputs = 2,
  1527. .audio_inputs = 1,
  1528. .tuner = -1,
  1529. .svhs = 1,
  1530. .muxsel = { 2, 3 },
  1531. .pll = PLL_28,
  1532. .tuner_type = -1,
  1533. .no_msp34xx = 1,
  1534. .no_tda9875 = 1,
  1535. .no_tda7432 = 1, /* must avoid, conflicts with the bt860 */
  1536. },{
  1537. /* M G Berberich <berberic@forwiss.uni-passau.de> */
  1538. .name = "IDS Eagle",
  1539. .video_inputs = 4,
  1540. .audio_inputs = 0,
  1541. .tuner = -1,
  1542. .tuner_type = -1,
  1543. .svhs = -1,
  1544. .gpiomask = 0,
  1545. .muxsel = { 0, 1, 2, 3 },
  1546. .muxsel_hook = eagle_muxsel,
  1547. .no_msp34xx = 1,
  1548. .no_tda9875 = 1,
  1549. .pll = PLL_28,
  1550. },{
  1551. .name = "Pinnacle PCTV Sat",
  1552. .video_inputs = 2,
  1553. .audio_inputs = 0,
  1554. .svhs = 1,
  1555. .tuner = -1,
  1556. .tuner_type = -1,
  1557. .no_msp34xx = 1,
  1558. .no_tda9875 = 1,
  1559. .no_tda7432 = 1,
  1560. .gpiomask = 0x01,
  1561. .audiomux = { 0, 0, 0, 0, 1 },
  1562. .muxsel = { 3, 0, 1, 2},
  1563. .needs_tvaudio = 0,
  1564. .pll = PLL_28,
  1565. .no_gpioirq = 1,
  1566. .has_dvb = 1,
  1567. },{
  1568. .name = "Formac ProTV II (bt878)",
  1569. .video_inputs = 4,
  1570. .audio_inputs = 1,
  1571. .tuner = 0,
  1572. .svhs = 3,
  1573. .gpiomask = 2,
  1574. // TV, Comp1, Composite over SVID con, SVID
  1575. .muxsel = { 2, 3, 1, 1},
  1576. .audiomux = { 2, 2, 0, 0, 0 },
  1577. .pll = PLL_28,
  1578. .has_radio = 1,
  1579. .tuner_type = TUNER_PHILIPS_PAL,
  1580. /* sound routing:
  1581. GPIO=0x00,0x01,0x03: mute (?)
  1582. 0x02: both TV and radio (tuner: FM1216/I)
  1583. The card has onboard audio connectors labeled "cdrom" and "board",
  1584. not soldered here, though unknown wiring.
  1585. Card lacks: external audio in, pci subsystem id.
  1586. */
  1587. },{
  1588. /* ---- card 0x60 ---------------------------------- */
  1589. .name = "MachTV",
  1590. .video_inputs = 3,
  1591. .audio_inputs = 1,
  1592. .tuner = 0,
  1593. .svhs = -1,
  1594. .gpiomask = 7,
  1595. .muxsel = { 2, 3, 1, 1},
  1596. .audiomux = { 0, 1, 2, 3, 4},
  1597. .needs_tvaudio = 1,
  1598. .tuner_type = 5,
  1599. .pll = 1,
  1600. },{
  1601. .name = "Euresys Picolo",
  1602. .video_inputs = 3,
  1603. .audio_inputs = 0,
  1604. .tuner = -1,
  1605. .svhs = 2,
  1606. .gpiomask = 0,
  1607. .no_msp34xx = 1,
  1608. .no_tda9875 = 1,
  1609. .no_tda7432 = 1,
  1610. .muxsel = { 2, 0, 1},
  1611. .pll = PLL_28,
  1612. },{
  1613. /* Luc Van Hoeylandt <luc@e-magic.be> */
  1614. .name = "ProVideo PV150", /* 0x4f */
  1615. .video_inputs = 2,
  1616. .audio_inputs = 0,
  1617. .tuner = -1,
  1618. .svhs = -1,
  1619. .gpiomask = 0,
  1620. .muxsel = { 2, 3 },
  1621. .audiomux = { 0 },
  1622. .needs_tvaudio = 0,
  1623. .no_msp34xx = 1,
  1624. .pll = PLL_28,
  1625. .tuner_type = -1,
  1626. },{
  1627. /* Hiroshi Takekawa <sian@big.or.jp> */
  1628. /* This card lacks subsystem ID */
  1629. .name = "AD-TVK503", /* 0x63 */
  1630. .video_inputs = 4,
  1631. .audio_inputs = 1,
  1632. .tuner = 0,
  1633. .svhs = 2,
  1634. .gpiomask = 0x001e8007,
  1635. .muxsel = { 2, 3, 1, 0 },
  1636. /* Tuner, Radio, external, internal, off, on */
  1637. .audiomux = { 0x08, 0x0f, 0x0a, 0x08, 0x0f, 0x08 },
  1638. .needs_tvaudio = 0,
  1639. .no_msp34xx = 1,
  1640. .pll = PLL_28,
  1641. .tuner_type = 2,
  1642. .audio_hook = adtvk503_audio,
  1643. },{
  1644. /* ---- card 0x64 ---------------------------------- */
  1645. .name = "Hercules Smart TV Stereo",
  1646. .video_inputs = 4,
  1647. .audio_inputs = 1,
  1648. .tuner = 0,
  1649. .svhs = 2,
  1650. .gpiomask = 0x00,
  1651. .muxsel = { 2, 3, 1, 1 },
  1652. .needs_tvaudio = 1,
  1653. .no_msp34xx = 1,
  1654. .pll = PLL_28,
  1655. .tuner_type = 5,
  1656. /* Notes:
  1657. - card lacks subsystem ID
  1658. - stereo variant w/ daughter board with tda9874a @0xb0
  1659. - Audio Routing:
  1660. always from tda9874 independent of GPIO (?)
  1661. external line in: unknown
  1662. - Other chips: em78p156elp @ 0x96 (probably IR remote control)
  1663. hef4053 (instead 4052) for unknown function
  1664. */
  1665. },{
  1666. .name = "Pace TV & Radio Card",
  1667. .video_inputs = 4,
  1668. .audio_inputs = 1,
  1669. .tuner = 0,
  1670. .svhs = 2,
  1671. .muxsel = { 2, 3, 1, 1}, // Tuner, CVid, SVid, CVid over SVid connector
  1672. .gpiomask = 0,
  1673. .no_tda9875 = 1,
  1674. .no_tda7432 = 1,
  1675. .tuner_type = 1,
  1676. .has_radio = 1,
  1677. .pll = PLL_28,
  1678. /* Bt878, Bt832, FI1246 tuner; no pci subsystem id
  1679. only internal line out: (4pin header) RGGL
  1680. Radio must be decoded by msp3410d (not routed through)*/
  1681. // .digital_mode = DIGITAL_MODE_CAMERA, // todo!
  1682. },{
  1683. /* Chris Willing <chris@vislab.usyd.edu.au> */
  1684. .name = "IVC-200",
  1685. .video_inputs = 1,
  1686. .audio_inputs = 0,
  1687. .tuner = -1,
  1688. .tuner_type = -1,
  1689. .svhs = -1,
  1690. .gpiomask = 0xdf,
  1691. .muxsel = { 2 },
  1692. .pll = PLL_28,
  1693. },{
  1694. .name = "Grand X-Guard / Trust 814PCI",
  1695. .video_inputs = 16,
  1696. .audio_inputs = 0,
  1697. .tuner = -1,
  1698. .svhs = -1,
  1699. .tuner_type = 4,
  1700. .gpiomask2 = 0xff,
  1701. .muxsel = { 2,2,2,2, 3,3,3,3, 1,1,1,1, 0,0,0,0 },
  1702. .muxsel_hook = xguard_muxsel,
  1703. .no_msp34xx = 1,
  1704. .no_tda9875 = 1,
  1705. .no_tda7432 = 1,
  1706. .pll = PLL_28,
  1707. },{
  1708. /* ---- card 0x68 ---------------------------------- */
  1709. .name = "Nebula Electronics DigiTV",
  1710. .video_inputs = 1,
  1711. .tuner = -1,
  1712. .svhs = -1,
  1713. .muxsel = { 2, 3, 1, 0},
  1714. .no_msp34xx = 1,
  1715. .no_tda9875 = 1,
  1716. .no_tda7432 = 1,
  1717. .pll = PLL_28,
  1718. .tuner_type = -1,
  1719. .has_dvb = 1,
  1720. .no_gpioirq = 1,
  1721. },{
  1722. /* Jorge Boncompte - DTI2 <jorge@dti2.net> */
  1723. .name = "ProVideo PV143",
  1724. .video_inputs = 4,
  1725. .audio_inputs = 0,
  1726. .tuner = -1,
  1727. .svhs = -1,
  1728. .gpiomask = 0,
  1729. .muxsel = { 2, 3, 1, 0 },
  1730. .audiomux = { 0 },
  1731. .needs_tvaudio = 0,
  1732. .no_msp34xx = 1,
  1733. .pll = PLL_28,
  1734. .tuner_type = -1,
  1735. },{
  1736. /* M.Klahr@phytec.de */
  1737. .name = "PHYTEC VD-009-X1 MiniDIN (bt878)",
  1738. .video_inputs = 4,
  1739. .audio_inputs = 0,
  1740. .tuner = -1, /* card has no tuner */
  1741. .svhs = 3,
  1742. .gpiomask = 0x00,
  1743. .muxsel = { 2, 3, 1, 0},
  1744. .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
  1745. .needs_tvaudio = 1,
  1746. .pll = PLL_28,
  1747. .tuner_type = -1,
  1748. },{
  1749. .name = "PHYTEC VD-009-X1 Combi (bt878)",
  1750. .video_inputs = 4,
  1751. .audio_inputs = 0,
  1752. .tuner = -1, /* card has no tuner */
  1753. .svhs = 3,
  1754. .gpiomask = 0x00,
  1755. .muxsel = { 2, 3, 1, 1},
  1756. .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
  1757. .needs_tvaudio = 1,
  1758. .pll = PLL_28,
  1759. .tuner_type = -1,
  1760. },{
  1761. /* ---- card 0x6c ---------------------------------- */
  1762. .name = "PHYTEC VD-009 MiniDIN (bt878)",
  1763. .video_inputs = 10,
  1764. .audio_inputs = 0,
  1765. .tuner = -1, /* card has no tuner */
  1766. .svhs = 9,
  1767. .gpiomask = 0x00,
  1768. .gpiomask2 = 0x03, /* gpiomask2 defines the bits used to switch audio
  1769. via the upper nibble of muxsel. here: used for
  1770. xternal video-mux */
  1771. .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x00 },
  1772. .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
  1773. .needs_tvaudio = 1,
  1774. .pll = PLL_28,
  1775. .tuner_type = -1,
  1776. },{
  1777. .name = "PHYTEC VD-009 Combi (bt878)",
  1778. .video_inputs = 10,
  1779. .audio_inputs = 0,
  1780. .tuner = -1, /* card has no tuner */
  1781. .svhs = 9,
  1782. .gpiomask = 0x00,
  1783. .gpiomask2 = 0x03, /* gpiomask2 defines the bits used to switch audio
  1784. via the upper nibble of muxsel. here: used for
  1785. xternal video-mux */
  1786. .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x01 },
  1787. .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
  1788. .needs_tvaudio = 1,
  1789. .pll = PLL_28,
  1790. .tuner_type = -1,
  1791. },{
  1792. .name = "IVC-100",
  1793. .video_inputs = 4,
  1794. .audio_inputs = 0,
  1795. .tuner = -1,
  1796. .tuner_type = -1,
  1797. .svhs = -1,
  1798. .gpiomask = 0xdf,
  1799. .muxsel = { 2, 3, 1, 0 },
  1800. .pll = PLL_28,
  1801. },{
  1802. /* IVC-120G - Alan Garfield <alan@fromorbit.com> */
  1803. .name = "IVC-120G",
  1804. .video_inputs = 16,
  1805. .audio_inputs = 0, /* card has no audio */
  1806. .tuner = -1, /* card has no tuner */
  1807. .tuner_type = -1,
  1808. .svhs = -1, /* card has no svhs */
  1809. .needs_tvaudio = 0,
  1810. .no_msp34xx = 1,
  1811. .no_tda9875 = 1,
  1812. .no_tda7432 = 1,
  1813. .gpiomask = 0x00,
  1814. .muxsel = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
  1815. 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10 },
  1816. .muxsel_hook = ivc120_muxsel,
  1817. .pll = PLL_28,
  1818. },{
  1819. /* ---- card 0x70 ---------------------------------- */
  1820. .name = "pcHDTV HD-2000 TV",
  1821. .video_inputs = 4,
  1822. .audio_inputs = 1,
  1823. .tuner = 0,
  1824. .svhs = 2,
  1825. .muxsel = { 2, 3, 1, 0},
  1826. .tuner_type = TUNER_PHILIPS_ATSC,
  1827. .has_dvb = 1,
  1828. },{
  1829. .name = "Twinhan DST + clones",
  1830. .no_msp34xx = 1,
  1831. .no_tda9875 = 1,
  1832. .no_tda7432 = 1,
  1833. .tuner_type = TUNER_ABSENT,
  1834. .no_video = 1,
  1835. .has_dvb = 1,
  1836. },{
  1837. .name = "Winfast VC100",
  1838. .video_inputs = 3,
  1839. .audio_inputs = 0,
  1840. .svhs = 1,
  1841. .tuner = -1, // no tuner
  1842. .muxsel = { 3, 1, 1, 3}, // Vid In, SVid In, Vid over SVid in connector
  1843. .no_msp34xx = 1,
  1844. .no_tda9875 = 1,
  1845. .no_tda7432 = 1,
  1846. .tuner_type = TUNER_ABSENT,
  1847. .pll = PLL_28,
  1848. },{
  1849. .name = "Teppro TEV-560/InterVision IV-560",
  1850. .video_inputs = 3,
  1851. .audio_inputs = 1,
  1852. .tuner = 0,
  1853. .svhs = 2,
  1854. .gpiomask = 3,
  1855. .muxsel = { 2, 3, 1, 1},
  1856. .audiomux = { 1, 1, 1, 1, 0},
  1857. .needs_tvaudio = 1,
  1858. .tuner_type = TUNER_PHILIPS_PAL,
  1859. .pll = PLL_35,
  1860. },{
  1861. /* ---- card 0x74 ---------------------------------- */
  1862. .name = "SIMUS GVC1100",
  1863. .video_inputs = 4,
  1864. .audio_inputs = 0,
  1865. .tuner = -1,
  1866. .svhs = -1,
  1867. .tuner_type = -1,
  1868. .pll = PLL_28,
  1869. .muxsel = { 2, 2, 2, 2},
  1870. .gpiomask = 0x3F,
  1871. .muxsel_hook = gvc1100_muxsel,
  1872. },{
  1873. /* Carlos Silva r3pek@r3pek.homelinux.org || card 0x75 */
  1874. .name = "NGS NGSTV+",
  1875. .video_inputs = 3,
  1876. .tuner = 0,
  1877. .svhs = 2,
  1878. .gpiomask = 0x008007,
  1879. .muxsel = {2, 3, 0, 0},
  1880. .audiomux = {0, 0, 0, 0, 0x000003, 0},
  1881. .pll = PLL_28,
  1882. .tuner_type = TUNER_PHILIPS_PAL,
  1883. .has_remote = 1,
  1884. },{
  1885. /* http://linuxmedialabs.com */
  1886. .name = "LMLBT4",
  1887. .video_inputs = 4, /* IN1,IN2,IN3,IN4 */
  1888. .audio_inputs = 0,
  1889. .tuner = -1,
  1890. .svhs = -1,
  1891. .muxsel = { 2, 3, 1, 0 },
  1892. .no_msp34xx = 1,
  1893. .no_tda9875 = 1,
  1894. .no_tda7432 = 1,
  1895. .needs_tvaudio = 0,
  1896. },{
  1897. /* Helmroos Harri <harri.helmroos@pp.inet.fi> */
  1898. .name = "Tekram M205 PRO",
  1899. .video_inputs = 3,
  1900. .audio_inputs = 1,
  1901. .tuner = 0,
  1902. .tuner_type = TUNER_PHILIPS_PAL,
  1903. .svhs = 2,
  1904. .needs_tvaudio = 0,
  1905. .gpiomask = 0x68,
  1906. .muxsel = { 2, 3, 1},
  1907. .audiomux = { 0x68, 0x68, 0x61, 0x61, 0x00 },
  1908. .pll = PLL_28,
  1909. },{
  1910. /* ---- card 0x78 ---------------------------------- */
  1911. /* Javier Cendan Ares <jcendan@lycos.es> */
  1912. /* bt878 TV + FM without subsystem ID */
  1913. .name = "Conceptronic CONTVFMi",
  1914. .video_inputs = 3,
  1915. .audio_inputs = 1,
  1916. .tuner = 0,
  1917. .svhs = 2,
  1918. .gpiomask = 0x008007,
  1919. .muxsel = { 2, 3, 1, 1 },
  1920. .audiomux = { 0, 1, 2, 2, 3 },
  1921. .needs_tvaudio = 0,
  1922. .pll = PLL_28,
  1923. .tuner_type = TUNER_PHILIPS_PAL,
  1924. .has_remote = 1,
  1925. .has_radio = 1,
  1926. },{
  1927. /*Eric DEBIEF <debief@telemsa.com>*/
  1928. /*EURESYS Picolo Tetra : 4 Conexant Fusion 878A, no audio, video input set with analog multiplexers GPIO controled*/
  1929. /* adds picolo_tetra_muxsel(), picolo_tetra_init(), the folowing declaration strucure, and #define BTTV_PICOLO_TETRA_CHIP*/
  1930. /*0x79 in bttv.h*/
  1931. .name = "Euresys Picolo Tetra",
  1932. .video_inputs = 4,
  1933. .audio_inputs = 0,
  1934. .tuner = -1,
  1935. .svhs = -1,
  1936. .gpiomask = 0,
  1937. .gpiomask2 = 0x3C<<16,/*Set the GPIO[18]->GPIO[21] as output pin.==> drive the video inputs through analog multiplexers*/
  1938. .no_msp34xx = 1,
  1939. .no_tda9875 = 1,
  1940. .no_tda7432 = 1,
  1941. .muxsel = {2,2,2,2},/*878A input is always MUX0, see above.*/
  1942. .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
  1943. .pll = PLL_28,
  1944. .needs_tvaudio = 0,
  1945. .muxsel_hook = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/
  1946. },{
  1947. /* Spirit TV Tuner from http://spiritmodems.com.au */
  1948. /* Stafford Goodsell <surge@goliath.homeunix.org> */
  1949. .name = "Spirit TV Tuner",
  1950. .video_inputs = 3,
  1951. .audio_inputs = 1,
  1952. .tuner = 0,
  1953. .svhs = 2,
  1954. .gpiomask = 0x0000000f,
  1955. .muxsel = { 2, 1, 1 },
  1956. .audiomux = { 0x02, 0x00, 0x00, 0x00, 0x00},
  1957. .tuner_type = TUNER_TEMIC_PAL,
  1958. .no_msp34xx = 1,
  1959. .no_tda9875 = 1,
  1960. },{
  1961. /* Wolfram Joost <wojo@frokaschwei.de> */
  1962. .name = "AVerMedia AVerTV DVB-T 771",
  1963. .video_inputs = 2,
  1964. .svhs = 1,
  1965. .tuner = -1,
  1966. .tuner_type = TUNER_ABSENT,
  1967. .muxsel = { 3 , 3 },
  1968. .no_msp34xx = 1,
  1969. .no_tda9875 = 1,
  1970. .no_tda7432 = 1,
  1971. .pll = PLL_28,
  1972. .has_dvb = 1,
  1973. .no_gpioirq = 1,
  1974. .has_remote = 1,
  1975. },{
  1976. /* ---- card 0x7c ---------------------------------- */
  1977. /* Matt Jesson <dvb@jesson.eclipse.co.uk> */
  1978. /* Based on the Nebula card data - added remote and new card number - BTTV_AVDVBT_761, see also ir-kbd-gpio.c */
  1979. .name = "AverMedia AverTV DVB-T 761",
  1980. .video_inputs = 2,
  1981. .tuner = -1,
  1982. .svhs = 1,
  1983. .muxsel = { 3, 1, 2, 0}, /* Comp0, S-Video, ?, ? */
  1984. .no_msp34xx = 1,
  1985. .no_tda9875 = 1,
  1986. .no_tda7432 = 1,
  1987. .pll = PLL_28,
  1988. .tuner_type = -1,
  1989. .has_dvb = 1,
  1990. .no_gpioirq = 1,
  1991. .has_remote = 1,
  1992. },{
  1993. /* andre.schwarz@matrix-vision.de */
  1994. .name = "MATRIX Vision Sigma-SQ",
  1995. .video_inputs = 16,
  1996. .audio_inputs = 0,
  1997. .tuner = -1,
  1998. .svhs = -1,
  1999. .gpiomask = 0x0,
  2000. .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2,
  2001. 3, 3, 3, 3, 3, 3, 3, 3 },
  2002. .muxsel_hook = sigmaSQ_muxsel,
  2003. .audiomux = { 0 },
  2004. .no_msp34xx = 1,
  2005. .pll = PLL_28,
  2006. .tuner_type = -1,
  2007. },{
  2008. /* andre.schwarz@matrix-vision.de */
  2009. .name = "MATRIX Vision Sigma-SLC",
  2010. .video_inputs = 4,
  2011. .audio_inputs = 0,
  2012. .tuner = -1,
  2013. .svhs = -1,
  2014. .gpiomask = 0x0,
  2015. .muxsel = { 2, 2, 2, 2 },
  2016. .muxsel_hook = sigmaSLC_muxsel,
  2017. .audiomux = { 0 },
  2018. .no_msp34xx = 1,
  2019. .pll = PLL_28,
  2020. .tuner_type = -1,
  2021. },{
  2022. /* BTTV_APAC_VIEWCOMP */
  2023. /* Attila Kondoros <attila.kondoros@chello.hu> */
  2024. /* bt878 TV + FM 0x00000000 subsystem ID */
  2025. .name = "APAC Viewcomp 878(AMAX)",
  2026. .video_inputs = 2,
  2027. .audio_inputs = 1,
  2028. .tuner = 0,
  2029. .svhs = -1,
  2030. .gpiomask = 0xFF,
  2031. .muxsel = { 2, 3, 1, 1},
  2032. .audiomux = { 2, 0, 0, 0, 10},
  2033. .needs_tvaudio = 0,
  2034. .pll = PLL_28,
  2035. .tuner_type = TUNER_PHILIPS_PAL,
  2036. .has_remote = 1, /* miniremote works, see ir-kbd-gpio.c */
  2037. .has_radio = 1, /* not every card has radio */
  2038. },{
  2039. /* ---- card 0x80 ---------------------------------- */
  2040. /* Chris Pascoe <c.pascoe@itee.uq.edu.au> */
  2041. .name = "DVICO FusionHDTV DVB-T Lite",
  2042. .tuner = -1,
  2043. .no_msp34xx = 1,
  2044. .no_tda9875 = 1,
  2045. .no_tda7432 = 1,
  2046. .pll = PLL_28,
  2047. .no_video = 1,
  2048. .has_dvb = 1,
  2049. .tuner_type = -1,
  2050. },{
  2051. /* Steven <photon38@pchome.com.tw> */
  2052. .name = "V-Gear MyVCD",
  2053. .video_inputs = 3,
  2054. .audio_inputs = 1,
  2055. .tuner = 0,
  2056. .svhs = 2,
  2057. .gpiomask = 0x3f,
  2058. .muxsel = {2, 3, 1, 0},
  2059. .audiomux = {0x31, 0x31, 0x31, 0x31, 0x31, 0x31},
  2060. .no_msp34xx = 1,
  2061. .pll = PLL_28,
  2062. .tuner_type = TUNER_PHILIPS_NTSC_M,
  2063. .has_radio = 0,
  2064. // .has_remote = 1,
  2065. },{
  2066. /* Rick C <cryptdragoon@gmail.com> */
  2067. .name = "Super TV Tuner",
  2068. .video_inputs = 4,
  2069. .audio_inputs = 1,
  2070. .tuner = 0,
  2071. .svhs = 2,
  2072. .muxsel = { 2, 3, 1, 0},
  2073. .tuner_type = TUNER_PHILIPS_NTSC,
  2074. .gpiomask = 0x008007,
  2075. .audiomux = { 0, 0x000001,0,0, 0},
  2076. .needs_tvaudio = 1,
  2077. .has_radio = 1,
  2078. },{
  2079. /* Chris Fanning <video4linux@haydon.net> */
  2080. .name = "Tibet Systems 'Progress DVR' CS16",
  2081. .video_inputs = 16,
  2082. .audio_inputs = 0,
  2083. .tuner = -1,
  2084. .svhs = -1,
  2085. .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 },
  2086. .pll = PLL_28,
  2087. .no_msp34xx = 1,
  2088. .no_tda9875 = 1,
  2089. .no_tda7432 = 1,
  2090. .tuner_type = -1,
  2091. .muxsel_hook = tibetCS16_muxsel,
  2092. },
  2093. {
  2094. /* Bill Brack <wbrack@mmm.com.hk> */
  2095. /*
  2096. * Note that, because of the card's wiring, the "master"
  2097. * BT878A chip (i.e. the one which controls the analog switch
  2098. * and must use this card type) is the 2nd one detected. The
  2099. * other 3 chips should use card type 0x85, whose description
  2100. * follows this one. There is a EEPROM on the card (which is
  2101. * connected to the I2C of one of those other chips), but is
  2102. * not currently handled. There is also a facility for a
  2103. * "monitor", which is also not currently implemented.
  2104. */
  2105. .name = "Kodicom 4400R (master)",
  2106. .video_inputs = 16,
  2107. .audio_inputs = 0,
  2108. .tuner = -1,
  2109. .tuner_type = -1,
  2110. .svhs = -1,
  2111. /* GPIO bits 0-9 used for analog switch:
  2112. * 00 - 03: camera selector
  2113. * 04 - 06: channel (controller) selector
  2114. * 07: data (1->on, 0->off)
  2115. * 08: strobe
  2116. * 09: reset
  2117. * bit 16 is input from sync separator for the channel
  2118. */
  2119. .gpiomask = 0x0003ff,
  2120. .no_gpioirq = 1,
  2121. .muxsel = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
  2122. .pll = PLL_28,
  2123. .no_msp34xx = 1,
  2124. .no_tda7432 = 1,
  2125. .no_tda9875 = 1,
  2126. .muxsel_hook = kodicom4400r_muxsel,
  2127. },
  2128. {
  2129. /* Bill Brack <wbrack@mmm.com.hk> */
  2130. /* Note that, for reasons unknown, the "master" BT878A chip (i.e. the
  2131. * one which controls the analog switch, and must use the card type)
  2132. * is the 2nd one detected. The other 3 chips should use this card
  2133. * type
  2134. */
  2135. .name = "Kodicom 4400R (slave)",
  2136. .video_inputs = 16,
  2137. .audio_inputs = 0,
  2138. .tuner = -1,
  2139. .tuner_type = -1,
  2140. .svhs = -1,
  2141. .gpiomask = 0x010000,
  2142. .no_gpioirq = 1,
  2143. .muxsel = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
  2144. .pll = PLL_28,
  2145. .no_msp34xx = 1,
  2146. .no_tda7432 = 1,
  2147. .no_tda9875 = 1,
  2148. .muxsel_hook = kodicom4400r_muxsel,
  2149. },
  2150. {
  2151. /* ---- card 0x85---------------------------------- */
  2152. /* Michael Henson <mhenson@clarityvi.com> */
  2153. /* Adlink RTV24 with special unlock codes */
  2154. .name = "Adlink RTV24",
  2155. .video_inputs = 4,
  2156. .audio_inputs = 1,
  2157. .tuner = 0,
  2158. .svhs = 2,
  2159. .muxsel = { 2, 3, 1, 0},
  2160. .tuner_type = -1,
  2161. .pll = PLL_28,
  2162. }};
  2163. static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards);
  2164. /* ----------------------------------------------------------------------- */
  2165. static unsigned char eeprom_data[256];
  2166. /*
  2167. * identify card
  2168. */
  2169. void __devinit bttv_idcard(struct bttv *btv)
  2170. {
  2171. unsigned int gpiobits;
  2172. int i,type;
  2173. unsigned short tmp;
  2174. /* read PCI subsystem ID */
  2175. pci_read_config_word(btv->c.pci, PCI_SUBSYSTEM_ID, &tmp);
  2176. btv->cardid = tmp << 16;
  2177. pci_read_config_word(btv->c.pci, PCI_SUBSYSTEM_VENDOR_ID, &tmp);
  2178. btv->cardid |= tmp;
  2179. if (0 != btv->cardid && 0xffffffff != btv->cardid) {
  2180. /* look for the card */
  2181. for (type = -1, i = 0; cards[i].id != 0; i++)
  2182. if (cards[i].id == btv->cardid)
  2183. type = i;
  2184. if (type != -1) {
  2185. /* found it */
  2186. printk(KERN_INFO "bttv%d: detected: %s [card=%d], "
  2187. "PCI subsystem ID is %04x:%04x\n",
  2188. btv->c.nr,cards[type].name,cards[type].cardnr,
  2189. btv->cardid & 0xffff,
  2190. (btv->cardid >> 16) & 0xffff);
  2191. btv->c.type = cards[type].cardnr;
  2192. } else {
  2193. /* 404 */
  2194. printk(KERN_INFO "bttv%d: subsystem: %04x:%04x (UNKNOWN)\n",
  2195. btv->c.nr, btv->cardid & 0xffff,
  2196. (btv->cardid >> 16) & 0xffff);
  2197. printk(KERN_DEBUG "please mail id, board name and "
  2198. "the correct card= insmod option to kraxel@bytesex.org\n");
  2199. }
  2200. }
  2201. /* let the user override the autodetected type */
  2202. if (card[btv->c.nr] < bttv_num_tvcards)
  2203. btv->c.type=card[btv->c.nr];
  2204. /* print which card config we are using */
  2205. printk(KERN_INFO "bttv%d: using: %s [card=%d,%s]\n",btv->c.nr,
  2206. bttv_tvcards[btv->c.type].name, btv->c.type,
  2207. card[btv->c.nr] < bttv_num_tvcards
  2208. ? "insmod option" : "autodetected");
  2209. /* overwrite gpio stuff ?? */
  2210. if (UNSET == audioall && UNSET == audiomux[0])
  2211. return;
  2212. if (UNSET != audiomux[0]) {
  2213. gpiobits = 0;
  2214. for (i = 0; i < 5; i++) {
  2215. bttv_tvcards[btv->c.type].audiomux[i] = audiomux[i];
  2216. gpiobits |= audiomux[i];
  2217. }
  2218. } else {
  2219. gpiobits = audioall;
  2220. for (i = 0; i < 5; i++) {
  2221. bttv_tvcards[btv->c.type].audiomux[i] = audioall;
  2222. }
  2223. }
  2224. bttv_tvcards[btv->c.type].gpiomask = (UNSET != gpiomask) ? gpiomask : gpiobits;
  2225. printk(KERN_INFO "bttv%d: gpio config override: mask=0x%x, mux=",
  2226. btv->c.nr,bttv_tvcards[btv->c.type].gpiomask);
  2227. for (i = 0; i < 5; i++) {
  2228. printk("%s0x%x", i ? "," : "", bttv_tvcards[btv->c.type].audiomux[i]);
  2229. }
  2230. printk("\n");
  2231. }
  2232. /*
  2233. * (most) board specific initialisations goes here
  2234. */
  2235. /* Some Modular Technology cards have an eeprom, but no subsystem ID */
  2236. void identify_by_eeprom(struct bttv *btv, unsigned char eeprom_data[256])
  2237. {
  2238. int type = -1;
  2239. if (0 == strncmp(eeprom_data,"GET MM20xPCTV",13))
  2240. type = BTTV_MODTEC_205;
  2241. else if (0 == strncmp(eeprom_data+20,"Picolo",7))
  2242. type = BTTV_EURESYS_PICOLO;
  2243. else if (eeprom_data[0] == 0x84 && eeprom_data[2]== 0)
  2244. type = BTTV_HAUPPAUGE; /* old bt848 */
  2245. if (-1 != type) {
  2246. btv->c.type = type;
  2247. printk("bttv%d: detected by eeprom: %s [card=%d]\n",
  2248. btv->c.nr, bttv_tvcards[btv->c.type].name, btv->c.type);
  2249. }
  2250. }
  2251. static void flyvideo_gpio(struct bttv *btv)
  2252. {
  2253. int gpio,has_remote,has_radio,is_capture_only,is_lr90,has_tda9820_tda9821;
  2254. int tuner=-1,ttype;
  2255. gpio_inout(0xffffff, 0);
  2256. udelay(8); // without this we would see the 0x1800 mask
  2257. gpio = gpio_read();
  2258. /* FIXME: must restore OUR_EN ??? */
  2259. // all cards provide GPIO info, some have an additional eeprom
  2260. // LR50: GPIO coding can be found lower right CP1 .. CP9
  2261. // CP9=GPIO23 .. CP1=GPIO15; when OPEN, the corresponding GPIO reads 1.
  2262. // GPIO14-12: n.c.
  2263. // LR90: GP9=GPIO23 .. GP1=GPIO15 (right above the bt878)
  2264. // lowest 3 bytes are remote control codes (no handshake needed)
  2265. // xxxFFF: No remote control chip soldered
  2266. // xxxF00(LR26/LR50), xxxFE0(LR90): Remote control chip (LVA001 or CF45) soldered
  2267. // Note: Some bits are Audio_Mask !
  2268. ttype=(gpio&0x0f0000)>>16;
  2269. switch(ttype) {
  2270. case 0x0: tuner=2; // NTSC, e.g. TPI8NSR11P
  2271. break;
  2272. case 0x2: tuner=39;// LG NTSC (newer TAPC series) TAPC-H701P
  2273. break;
  2274. case 0x4: tuner=5; // Philips PAL TPI8PSB02P, TPI8PSB12P, TPI8PSB12D or FI1216, FM1216
  2275. break;
  2276. case 0x6: tuner=37; // LG PAL (newer TAPC series) TAPC-G702P
  2277. break;
  2278. case 0xC: tuner=3; // Philips SECAM(+PAL) FQ1216ME or FI1216MF
  2279. break;
  2280. default:
  2281. printk(KERN_INFO "bttv%d: FlyVideo_gpio: unknown tuner type.\n", btv->c.nr);
  2282. }
  2283. has_remote = gpio & 0x800000;
  2284. has_radio = gpio & 0x400000;
  2285. // unknown 0x200000;
  2286. // unknown2 0x100000;
  2287. is_capture_only = !(gpio & 0x008000); //GPIO15
  2288. has_tda9820_tda9821 = !(gpio & 0x004000);
  2289. is_lr90 = !(gpio & 0x002000); // else LR26/LR50 (LR38/LR51 f. capture only)
  2290. // gpio & 0x001000 // output bit for audio routing
  2291. if(is_capture_only)
  2292. tuner=4; // No tuner present
  2293. printk(KERN_INFO "bttv%d: FlyVideo Radio=%s RemoteControl=%s Tuner=%d gpio=0x%06x\n",
  2294. btv->c.nr, has_radio? "yes":"no ", has_remote? "yes":"no ", tuner, gpio);
  2295. printk(KERN_INFO "bttv%d: FlyVideo LR90=%s tda9821/tda9820=%s capture_only=%s\n",
  2296. btv->c.nr, is_lr90?"yes":"no ", has_tda9820_tda9821?"yes":"no ",
  2297. is_capture_only?"yes":"no ");
  2298. if(tuner!= -1) // only set if known tuner autodetected, else let insmod option through
  2299. btv->tuner_type = tuner;
  2300. btv->has_radio = has_radio;
  2301. // LR90 Audio Routing is done by 2 hef4052, so Audio_Mask has 4 bits: 0x001c80
  2302. // LR26/LR50 only has 1 hef4052, Audio_Mask 0x000c00
  2303. // Audio options: from tuner, from tda9821/tda9821(mono,stereo,sap), from tda9874, ext., mute
  2304. if(has_tda9820_tda9821) btv->audio_hook = lt9415_audio;
  2305. //todo: if(has_tda9874) btv->audio_hook = fv2000s_audio;
  2306. }
  2307. static int miro_tunermap[] = { 0,6,2,3, 4,5,6,0, 3,0,4,5, 5,2,16,1,
  2308. 14,2,17,1, 4,1,4,3, 1,2,16,1, 4,4,4,4 };
  2309. static int miro_fmtuner[] = { 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1,
  2310. 1,1,1,1, 1,1,1,0, 0,0,0,0, 0,1,0,0 };
  2311. static void miro_pinnacle_gpio(struct bttv *btv)
  2312. {
  2313. int id,msp,gpio;
  2314. char *info;
  2315. gpio_inout(0xffffff, 0);
  2316. gpio = gpio_read();
  2317. id = ((gpio>>10) & 63) -1;
  2318. msp = bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx");
  2319. if (id < 32) {
  2320. btv->tuner_type = miro_tunermap[id];
  2321. if (0 == (gpio & 0x20)) {
  2322. btv->has_radio = 1;
  2323. if (!miro_fmtuner[id]) {
  2324. btv->has_matchbox = 1;
  2325. btv->mbox_we = (1<<6);
  2326. btv->mbox_most = (1<<7);
  2327. btv->mbox_clk = (1<<8);
  2328. btv->mbox_data = (1<<9);
  2329. btv->mbox_mask = (1<<6)|(1<<7)|(1<<8)|(1<<9);
  2330. }
  2331. } else {
  2332. btv->has_radio = 0;
  2333. }
  2334. if (-1 != msp) {
  2335. if (btv->c.type == BTTV_MIRO)
  2336. btv->c.type = BTTV_MIROPRO;
  2337. if (btv->c.type == BTTV_PINNACLE)
  2338. btv->c.type = BTTV_PINNACLEPRO;
  2339. }
  2340. printk(KERN_INFO
  2341. "bttv%d: miro: id=%d tuner=%d radio=%s stereo=%s\n",
  2342. btv->c.nr, id+1, btv->tuner_type,
  2343. !btv->has_radio ? "no" :
  2344. (btv->has_matchbox ? "matchbox" : "fmtuner"),
  2345. (-1 == msp) ? "no" : "yes");
  2346. } else {
  2347. /* new cards with microtune tuner */
  2348. id = 63 - id;
  2349. btv->has_radio = 0;
  2350. switch (id) {
  2351. case 1:
  2352. info = "PAL / mono";
  2353. break;
  2354. case 2:
  2355. info = "PAL+SECAM / stereo";
  2356. btv->has_radio = 1;
  2357. break;
  2358. case 3:
  2359. info = "NTSC / stereo";
  2360. btv->has_radio = 1;
  2361. break;
  2362. case 4:
  2363. info = "PAL+SECAM / mono";
  2364. break;
  2365. case 5:
  2366. info = "NTSC / mono";
  2367. break;
  2368. case 6:
  2369. info = "NTSC / stereo";
  2370. break;
  2371. case 7:
  2372. info = "PAL / stereo";
  2373. break;
  2374. default:
  2375. info = "oops: unknown card";
  2376. break;
  2377. }
  2378. if (-1 != msp)
  2379. btv->c.type = BTTV_PINNACLEPRO;
  2380. printk(KERN_INFO
  2381. "bttv%d: pinnacle/mt: id=%d info=\"%s\" radio=%s\n",
  2382. btv->c.nr, id, info, btv->has_radio ? "yes" : "no");
  2383. btv->tuner_type = 33;
  2384. btv->pinnacle_id = id;
  2385. }
  2386. }
  2387. /* GPIO21 L: Buffer aktiv, H: Buffer inaktiv */
  2388. #define LM1882_SYNC_DRIVE 0x200000L
  2389. static void init_ids_eagle(struct bttv *btv)
  2390. {
  2391. gpio_inout(0xffffff,0xFFFF37);
  2392. gpio_write(0x200020);
  2393. /* flash strobe inverter ?! */
  2394. gpio_write(0x200024);
  2395. /* switch sync drive off */
  2396. gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE);
  2397. /* set BT848 muxel to 2 */
  2398. btaor((2)<<5, ~(2<<5), BT848_IFORM);
  2399. }
  2400. /* Muxsel helper for the IDS Eagle.
  2401. * the eagles does not use the standard muxsel-bits but
  2402. * has its own multiplexer */
  2403. static void eagle_muxsel(struct bttv *btv, unsigned int input)
  2404. {
  2405. btaor((2)<<5, ~(3<<5), BT848_IFORM);
  2406. gpio_bits(3,bttv_tvcards[btv->c.type].muxsel[input&7]);
  2407. /* composite */
  2408. /* set chroma ADC to sleep */
  2409. btor(BT848_ADC_C_SLEEP, BT848_ADC);
  2410. /* set to composite video */
  2411. btand(~BT848_CONTROL_COMP, BT848_E_CONTROL);
  2412. btand(~BT848_CONTROL_COMP, BT848_O_CONTROL);
  2413. /* switch sync drive off */
  2414. gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE);
  2415. }
  2416. static void gvc1100_muxsel(struct bttv *btv, unsigned int input)
  2417. {
  2418. static const int masks[] = {0x30, 0x01, 0x12, 0x23};
  2419. gpio_write(masks[input%4]);
  2420. }
  2421. /* LMLBT4x initialization - to allow access to GPIO bits for sensors input and
  2422. alarms output
  2423. GPIObit | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
  2424. assignment | TI | O3|INx| O2| O1|IN4|IN3|IN2|IN1| | |
  2425. IN - sensor inputs, INx - sensor inputs and TI XORed together
  2426. O1,O2,O3 - alarm outputs (relays)
  2427. OUT ENABLE 1 1 0 . 1 1 0 0 . 0 0 0 0 = 0x6C0
  2428. */
  2429. static void init_lmlbt4x(struct bttv *btv)
  2430. {
  2431. printk(KERN_DEBUG "LMLBT4x init\n");
  2432. btwrite(0x000000, BT848_GPIO_REG_INP);
  2433. gpio_inout(0xffffff, 0x0006C0);
  2434. gpio_write(0x000000);
  2435. }
  2436. static void sigmaSQ_muxsel(struct bttv *btv, unsigned int input)
  2437. {
  2438. unsigned int inmux = input % 8;
  2439. gpio_inout( 0xf, 0xf );
  2440. gpio_bits( 0xf, inmux );
  2441. }
  2442. static void sigmaSLC_muxsel(struct bttv *btv, unsigned int input)
  2443. {
  2444. unsigned int inmux = input % 4;
  2445. gpio_inout( 3<<9, 3<<9 );
  2446. gpio_bits( 3<<9, inmux<<9 );
  2447. }
  2448. /* ----------------------------------------------------------------------- */
  2449. static void bttv_reset_audio(struct bttv *btv)
  2450. {
  2451. /*
  2452. * BT878A has a audio-reset register.
  2453. * 1. This register is an audio reset function but it is in
  2454. * function-0 (video capture) address space.
  2455. * 2. It is enough to do this once per power-up of the card.
  2456. * 3. There is a typo in the Conexant doc -- it is not at
  2457. * 0x5B, but at 0x058. (B is an odd-number, obviously a typo!).
  2458. * --//Shrikumar 030609
  2459. */
  2460. if (btv->id != 878)
  2461. return;
  2462. if (bttv_debug)
  2463. printk("bttv%d: BT878A ARESET\n",btv->c.nr);
  2464. btwrite((1<<7), 0x058);
  2465. udelay(10);
  2466. btwrite( 0, 0x058);
  2467. }
  2468. /* initialization part one -- before registering i2c bus */
  2469. void __devinit bttv_init_card1(struct bttv *btv)
  2470. {
  2471. switch (btv->c.type) {
  2472. case BTTV_HAUPPAUGE:
  2473. case BTTV_HAUPPAUGE878:
  2474. boot_msp34xx(btv,5);
  2475. break;
  2476. case BTTV_VOODOOTV_FM:
  2477. boot_msp34xx(btv,20);
  2478. break;
  2479. case BTTV_AVERMEDIA98:
  2480. boot_msp34xx(btv,11);
  2481. break;
  2482. case BTTV_HAUPPAUGEPVR:
  2483. pvr_boot(btv);
  2484. break;
  2485. case BTTV_TWINHAN_DST:
  2486. case BTTV_AVDVBT_771:
  2487. btv->use_i2c_hw = 1;
  2488. break;
  2489. case BTTV_ADLINK_RTV24:
  2490. init_RTV24( btv );
  2491. break;
  2492. }
  2493. if (!bttv_tvcards[btv->c.type].has_dvb)
  2494. bttv_reset_audio(btv);
  2495. }
  2496. /* initialization part two -- after registering i2c bus */
  2497. void __devinit bttv_init_card2(struct bttv *btv)
  2498. {
  2499. int tda9887;
  2500. btv->tuner_type = -1;
  2501. if (BTTV_UNKNOWN == btv->c.type) {
  2502. bttv_readee(btv,eeprom_data,0xa0);
  2503. identify_by_eeprom(btv,eeprom_data);
  2504. }
  2505. switch (btv->c.type) {
  2506. case BTTV_MIRO:
  2507. case BTTV_MIROPRO:
  2508. case BTTV_PINNACLE:
  2509. case BTTV_PINNACLEPRO:
  2510. /* miro/pinnacle */
  2511. miro_pinnacle_gpio(btv);
  2512. break;
  2513. case BTTV_FLYVIDEO_98:
  2514. case BTTV_MAXI:
  2515. case BTTV_LIFE_FLYKIT:
  2516. case BTTV_FLYVIDEO:
  2517. case BTTV_TYPHOON_TVIEW:
  2518. case BTTV_CHRONOS_VS2:
  2519. case BTTV_FLYVIDEO_98FM:
  2520. case BTTV_FLYVIDEO2000:
  2521. case BTTV_FLYVIDEO98EZ:
  2522. case BTTV_CONFERENCETV:
  2523. case BTTV_LIFETEC_9415:
  2524. flyvideo_gpio(btv);
  2525. break;
  2526. case BTTV_HAUPPAUGE:
  2527. case BTTV_HAUPPAUGE878:
  2528. case BTTV_HAUPPAUGEPVR:
  2529. /* pick up some config infos from the eeprom */
  2530. bttv_readee(btv,eeprom_data,0xa0);
  2531. hauppauge_eeprom(btv);
  2532. break;
  2533. case BTTV_AVERMEDIA98:
  2534. case BTTV_AVPHONE98:
  2535. bttv_readee(btv,eeprom_data,0xa0);
  2536. avermedia_eeprom(btv);
  2537. break;
  2538. case BTTV_PXC200:
  2539. init_PXC200(btv);
  2540. break;
  2541. case BTTV_PICOLO_TETRA_CHIP:
  2542. picolo_tetra_init(btv);
  2543. break;
  2544. case BTTV_VHX:
  2545. btv->has_radio = 1;
  2546. btv->has_matchbox = 1;
  2547. btv->mbox_we = 0x20;
  2548. btv->mbox_most = 0;
  2549. btv->mbox_clk = 0x08;
  2550. btv->mbox_data = 0x10;
  2551. btv->mbox_mask = 0x38;
  2552. break;
  2553. case BTTV_VOBIS_BOOSTAR:
  2554. case BTTV_TERRATV:
  2555. terratec_active_radio_upgrade(btv);
  2556. break;
  2557. case BTTV_MAGICTVIEW061:
  2558. if (btv->cardid == 0x3002144f) {
  2559. btv->has_radio=1;
  2560. printk("bttv%d: radio detected by subsystem id (CPH05x)\n",btv->c.nr);
  2561. }
  2562. break;
  2563. case BTTV_STB2:
  2564. if (btv->cardid == 0x3060121a) {
  2565. /* Fix up entry for 3DFX VoodooTV 100,
  2566. which is an OEM STB card variant. */
  2567. btv->has_radio=0;
  2568. btv->tuner_type=TUNER_TEMIC_NTSC;
  2569. }
  2570. break;
  2571. case BTTV_OSPREY1x0:
  2572. case BTTV_OSPREY1x0_848:
  2573. case BTTV_OSPREY101_848:
  2574. case BTTV_OSPREY1x1:
  2575. case BTTV_OSPREY1x1_SVID:
  2576. case BTTV_OSPREY2xx:
  2577. case BTTV_OSPREY2x0_SVID:
  2578. case BTTV_OSPREY2x0:
  2579. case BTTV_OSPREY500:
  2580. case BTTV_OSPREY540:
  2581. case BTTV_OSPREY2000:
  2582. bttv_readee(btv,eeprom_data,0xa0);
  2583. osprey_eeprom(btv);
  2584. break;
  2585. case BTTV_IDS_EAGLE:
  2586. init_ids_eagle(btv);
  2587. break;
  2588. case BTTV_MODTEC_205:
  2589. bttv_readee(btv,eeprom_data,0xa0);
  2590. modtec_eeprom(btv);
  2591. break;
  2592. case BTTV_LMLBT4:
  2593. init_lmlbt4x(btv);
  2594. break;
  2595. case BTTV_TIBET_CS16:
  2596. tibetCS16_init(btv);
  2597. break;
  2598. case BTTV_KODICOM_4400R:
  2599. kodicom4400r_init(btv);
  2600. break;
  2601. }
  2602. /* pll configuration */
  2603. if (!(btv->id==848 && btv->revision==0x11)) {
  2604. /* defaults from card list */
  2605. if (PLL_28 == bttv_tvcards[btv->c.type].pll) {
  2606. btv->pll.pll_ifreq=28636363;
  2607. btv->pll.pll_crystal=BT848_IFORM_XT0;
  2608. }
  2609. if (PLL_35 == bttv_tvcards[btv->c.type].pll) {
  2610. btv->pll.pll_ifreq=35468950;
  2611. btv->pll.pll_crystal=BT848_IFORM_XT1;
  2612. }
  2613. /* insmod options can override */
  2614. switch (pll[btv->c.nr]) {
  2615. case 0: /* none */
  2616. btv->pll.pll_crystal = 0;
  2617. btv->pll.pll_ifreq = 0;
  2618. btv->pll.pll_ofreq = 0;
  2619. break;
  2620. case 1: /* 28 MHz */
  2621. case 28:
  2622. btv->pll.pll_ifreq = 28636363;
  2623. btv->pll.pll_ofreq = 0;
  2624. btv->pll.pll_crystal = BT848_IFORM_XT0;
  2625. break;
  2626. case 2: /* 35 MHz */
  2627. case 35:
  2628. btv->pll.pll_ifreq = 35468950;
  2629. btv->pll.pll_ofreq = 0;
  2630. btv->pll.pll_crystal = BT848_IFORM_XT1;
  2631. break;
  2632. }
  2633. }
  2634. btv->pll.pll_current = -1;
  2635. bttv_reset_audio(btv);
  2636. /* tuner configuration (from card list / autodetect / insmod option) */
  2637. if (UNSET != bttv_tvcards[btv->c.type].tuner_type)
  2638. if(UNSET == btv->tuner_type)
  2639. btv->tuner_type = bttv_tvcards[btv->c.type].tuner_type;
  2640. if (UNSET != tuner[btv->c.nr])
  2641. btv->tuner_type = tuner[btv->c.nr];
  2642. printk("bttv%d: using tuner=%d\n",btv->c.nr,btv->tuner_type);
  2643. if (btv->pinnacle_id != UNSET)
  2644. bttv_call_i2c_clients(btv, AUDC_CONFIG_PINNACLE,
  2645. &btv->pinnacle_id);
  2646. if (btv->tuner_type != UNSET) {
  2647. struct tuner_setup tun_setup;
  2648. tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
  2649. tun_setup.type = btv->tuner_type;
  2650. tun_setup.addr = ADDR_UNSET;
  2651. bttv_call_i2c_clients(btv, TUNER_SET_TYPE_ADDR, &tun_setup);
  2652. }
  2653. btv->svhs = bttv_tvcards[btv->c.type].svhs;
  2654. if (svhs[btv->c.nr] != UNSET)
  2655. btv->svhs = svhs[btv->c.nr];
  2656. if (remote[btv->c.nr] != UNSET)
  2657. btv->has_remote = remote[btv->c.nr];
  2658. if (bttv_tvcards[btv->c.type].has_radio)
  2659. btv->has_radio=1;
  2660. if (bttv_tvcards[btv->c.type].has_remote)
  2661. btv->has_remote=1;
  2662. if (bttv_tvcards[btv->c.type].no_gpioirq)
  2663. btv->gpioirq=0;
  2664. if (bttv_tvcards[btv->c.type].audio_hook)
  2665. btv->audio_hook=bttv_tvcards[btv->c.type].audio_hook;
  2666. if (bttv_tvcards[btv->c.type].digital_mode == DIGITAL_MODE_CAMERA) {
  2667. /* detect Bt832 chip for quartzsight digital camera */
  2668. if ((bttv_I2CRead(btv, I2C_BT832_ALT1, "Bt832") >=0) ||
  2669. (bttv_I2CRead(btv, I2C_BT832_ALT2, "Bt832") >=0))
  2670. boot_bt832(btv);
  2671. }
  2672. if (!autoload)
  2673. return;
  2674. /* try to detect audio/fader chips */
  2675. if (!bttv_tvcards[btv->c.type].no_msp34xx &&
  2676. bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx") >=0)
  2677. request_module("msp3400");
  2678. if (bttv_tvcards[btv->c.type].msp34xx_alt &&
  2679. bttv_I2CRead(btv, I2C_MSP3400_ALT, "MSP34xx (alternate address)") >=0)
  2680. request_module("msp3400");
  2681. if (!bttv_tvcards[btv->c.type].no_tda9875 &&
  2682. bttv_I2CRead(btv, I2C_TDA9875, "TDA9875") >=0)
  2683. request_module("tda9875");
  2684. if (!bttv_tvcards[btv->c.type].no_tda7432 &&
  2685. bttv_I2CRead(btv, I2C_TDA7432, "TDA7432") >=0)
  2686. request_module("tda7432");
  2687. if (bttv_tvcards[btv->c.type].needs_tvaudio)
  2688. request_module("tvaudio");
  2689. /* tuner modules */
  2690. tda9887 = 0;
  2691. if (btv->pinnacle_id != UNSET)
  2692. tda9887 = 1;
  2693. if (0 == tda9887 && 0 == bttv_tvcards[btv->c.type].has_dvb &&
  2694. bttv_I2CRead(btv, I2C_TDA9887, "TDA9887") >=0)
  2695. tda9887 = 1;
  2696. if((btv->tuner_type == TUNER_PHILIPS_FM1216ME_MK3) ||
  2697. (btv->tuner_type == TUNER_PHILIPS_FM1236_MK3) ||
  2698. (btv->tuner_type == TUNER_PHILIPS_FM1256_IH3) ||
  2699. tda9887)
  2700. request_module("tda9887");
  2701. if (btv->tuner_type != UNSET)
  2702. request_module("tuner");
  2703. }
  2704. /* ----------------------------------------------------------------------- */
  2705. static void modtec_eeprom(struct bttv *btv)
  2706. {
  2707. if( strncmp(&(eeprom_data[0x1e]),"Temic 4066 FY5",14) ==0) {
  2708. btv->tuner_type=TUNER_TEMIC_4066FY5_PAL_I;
  2709. printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
  2710. btv->c.nr,&eeprom_data[0x1e]);
  2711. } else if (strncmp(&(eeprom_data[0x1e]),"Alps TSBB5",10) ==0) {
  2712. btv->tuner_type=TUNER_ALPS_TSBB5_PAL_I;
  2713. printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
  2714. btv->c.nr,&eeprom_data[0x1e]);
  2715. } else if (strncmp(&(eeprom_data[0x1e]),"Philips FM1246",14) ==0) {
  2716. btv->tuner_type=TUNER_PHILIPS_NTSC;
  2717. printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
  2718. btv->c.nr,&eeprom_data[0x1e]);
  2719. } else {
  2720. printk("bttv%d: Modtec: Unknown TunerString: %s\n",
  2721. btv->c.nr,&eeprom_data[0x1e]);
  2722. }
  2723. }
  2724. static void __devinit hauppauge_eeprom(struct bttv *btv)
  2725. {
  2726. struct tveeprom tv;
  2727. tveeprom_hauppauge_analog(&tv, eeprom_data);
  2728. btv->tuner_type = tv.tuner_type;
  2729. btv->has_radio = tv.has_radio;
  2730. }
  2731. static int terratec_active_radio_upgrade(struct bttv *btv)
  2732. {
  2733. int freq;
  2734. btv->has_radio = 1;
  2735. btv->has_matchbox = 1;
  2736. btv->mbox_we = 0x10;
  2737. btv->mbox_most = 0x20;
  2738. btv->mbox_clk = 0x08;
  2739. btv->mbox_data = 0x04;
  2740. btv->mbox_mask = 0x3c;
  2741. btv->mbox_iow = 1 << 8;
  2742. btv->mbox_ior = 1 << 9;
  2743. btv->mbox_csel = 1 << 10;
  2744. freq=88000/62.5;
  2745. tea5757_write(btv, 5 * freq + 0x358); // write 0x1ed8
  2746. if (0x1ed8 == tea5757_read(btv)) {
  2747. printk("bttv%d: Terratec Active Radio Upgrade found.\n",
  2748. btv->c.nr);
  2749. btv->has_radio = 1;
  2750. btv->has_matchbox = 1;
  2751. } else {
  2752. btv->has_radio = 0;
  2753. btv->has_matchbox = 0;
  2754. }
  2755. return 0;
  2756. }
  2757. /* ----------------------------------------------------------------------- */
  2758. /*
  2759. * minimal bootstrap for the WinTV/PVR -- upload altera firmware.
  2760. *
  2761. * The hcwamc.rbf firmware file is on the Hauppauge driver CD. Have
  2762. * a look at Pvr/pvr45xxx.EXE (self-extracting zip archive, can be
  2763. * unpacked with unzip).
  2764. */
  2765. #define PVR_GPIO_DELAY 10
  2766. #define BTTV_ALT_DATA 0x000001
  2767. #define BTTV_ALT_DCLK 0x100000
  2768. #define BTTV_ALT_NCONFIG 0x800000
  2769. static int __devinit pvr_altera_load(struct bttv *btv, u8 *micro, u32 microlen)
  2770. {
  2771. u32 n;
  2772. u8 bits;
  2773. int i;
  2774. gpio_inout(0xffffff,BTTV_ALT_DATA|BTTV_ALT_DCLK|BTTV_ALT_NCONFIG);
  2775. gpio_write(0);
  2776. udelay(PVR_GPIO_DELAY);
  2777. gpio_write(BTTV_ALT_NCONFIG);
  2778. udelay(PVR_GPIO_DELAY);
  2779. for (n = 0; n < microlen; n++) {
  2780. bits = micro[n];
  2781. for ( i = 0 ; i < 8 ; i++ ) {
  2782. gpio_bits(BTTV_ALT_DCLK,0);
  2783. if (bits & 0x01)
  2784. gpio_bits(BTTV_ALT_DATA,BTTV_ALT_DATA);
  2785. else
  2786. gpio_bits(BTTV_ALT_DATA,0);
  2787. gpio_bits(BTTV_ALT_DCLK,BTTV_ALT_DCLK);
  2788. bits >>= 1;
  2789. }
  2790. }
  2791. gpio_bits(BTTV_ALT_DCLK,0);
  2792. udelay(PVR_GPIO_DELAY);
  2793. /* begin Altera init loop (Not necessary,but doesn't hurt) */
  2794. for (i = 0 ; i < 30 ; i++) {
  2795. gpio_bits(BTTV_ALT_DCLK,0);
  2796. gpio_bits(BTTV_ALT_DCLK,BTTV_ALT_DCLK);
  2797. }
  2798. gpio_bits(BTTV_ALT_DCLK,0);
  2799. return 0;
  2800. }
  2801. static int __devinit pvr_boot(struct bttv *btv)
  2802. {
  2803. const struct firmware *fw_entry;
  2804. int rc;
  2805. rc = request_firmware(&fw_entry, "hcwamc.rbf", &btv->c.pci->dev);
  2806. if (rc != 0) {
  2807. printk(KERN_WARNING "bttv%d: no altera firmware [via hotplug]\n",
  2808. btv->c.nr);
  2809. return rc;
  2810. }
  2811. rc = pvr_altera_load(btv, fw_entry->data, fw_entry->size);
  2812. printk(KERN_INFO "bttv%d: altera firmware upload %s\n",
  2813. btv->c.nr, (rc < 0) ? "failed" : "ok");
  2814. release_firmware(fw_entry);
  2815. return rc;
  2816. }
  2817. /* ----------------------------------------------------------------------- */
  2818. /* some osprey specific stuff */
  2819. static void __devinit osprey_eeprom(struct bttv *btv)
  2820. {
  2821. int i = 0;
  2822. unsigned char *ee = eeprom_data;
  2823. unsigned long serial = 0;
  2824. if (btv->c.type == 0) {
  2825. /* this might be an antique... check for MMAC label in eeprom */
  2826. if ((ee[0]=='M') && (ee[1]=='M') && (ee[2]=='A') && (ee[3]=='C')) {
  2827. unsigned char checksum = 0;
  2828. for (i =0; i<21; i++)
  2829. checksum += ee[i];
  2830. if (checksum != ee[21])
  2831. return;
  2832. btv->c.type = BTTV_OSPREY1x0_848;
  2833. for (i = 12; i < 21; i++)
  2834. serial *= 10, serial += ee[i] - '0';
  2835. }
  2836. } else {
  2837. unsigned short type;
  2838. int offset = 4*16;
  2839. for(; offset < 8*16; offset += 16) {
  2840. unsigned short checksum = 0;
  2841. /* verify the checksum */
  2842. for(i = 0; i<14; i++) checksum += ee[i+offset];
  2843. checksum = ~checksum; /* no idea why */
  2844. if ((((checksum>>8)&0x0FF) == ee[offset+14]) &&
  2845. ((checksum & 0x0FF) == ee[offset+15])) {
  2846. break;
  2847. }
  2848. }
  2849. if (offset >= 8*16)
  2850. return;
  2851. /* found a valid descriptor */
  2852. type = (ee[offset+4]<<8) | (ee[offset+5]);
  2853. switch(type) {
  2854. /* 848 based */
  2855. case 0x0004:
  2856. btv->c.type = BTTV_OSPREY1x0_848;
  2857. break;
  2858. case 0x0005:
  2859. btv->c.type = BTTV_OSPREY101_848;
  2860. break;
  2861. /* 878 based */
  2862. case 0x0012:
  2863. case 0x0013:
  2864. btv->c.type = BTTV_OSPREY1x0;
  2865. break;
  2866. case 0x0014:
  2867. case 0x0015:
  2868. btv->c.type = BTTV_OSPREY1x1;
  2869. break;
  2870. case 0x0016:
  2871. case 0x0017:
  2872. case 0x0020:
  2873. btv->c.type = BTTV_OSPREY1x1_SVID;
  2874. break;
  2875. case 0x0018:
  2876. case 0x0019:
  2877. case 0x001E:
  2878. case 0x001F:
  2879. btv->c.type = BTTV_OSPREY2xx;
  2880. break;
  2881. case 0x001A:
  2882. case 0x001B:
  2883. btv->c.type = BTTV_OSPREY2x0_SVID;
  2884. break;
  2885. case 0x0040:
  2886. btv->c.type = BTTV_OSPREY500;
  2887. break;
  2888. case 0x0050:
  2889. case 0x0056:
  2890. btv->c.type = BTTV_OSPREY540;
  2891. /* bttv_osprey_540_init(btv); */
  2892. break;
  2893. case 0x0060:
  2894. case 0x0070:
  2895. btv->c.type = BTTV_OSPREY2x0;
  2896. //enable output on select control lines
  2897. gpio_inout(0xffffff,0x000303);
  2898. break;
  2899. default:
  2900. /* unknown...leave generic, but get serial # */
  2901. break;
  2902. }
  2903. serial = (ee[offset+6] << 24)
  2904. | (ee[offset+7] << 16)
  2905. | (ee[offset+8] << 8)
  2906. | (ee[offset+9]);
  2907. }
  2908. printk(KERN_INFO "bttv%d: osprey eeprom: card=%d name=%s serial=%ld\n",
  2909. btv->c.nr, btv->c.type, bttv_tvcards[btv->c.type].name,serial);
  2910. }
  2911. /* ----------------------------------------------------------------------- */
  2912. /* AVermedia specific stuff, from bktr_card.c */
  2913. static int tuner_0_table[] = {
  2914. TUNER_PHILIPS_NTSC, TUNER_PHILIPS_PAL /* PAL-BG*/,
  2915. TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL /* PAL-I*/,
  2916. TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL,
  2917. TUNER_PHILIPS_SECAM, TUNER_PHILIPS_SECAM,
  2918. TUNER_PHILIPS_SECAM, TUNER_PHILIPS_PAL,
  2919. TUNER_PHILIPS_FM1216ME_MK3 };
  2920. static int tuner_1_table[] = {
  2921. TUNER_TEMIC_NTSC, TUNER_TEMIC_PAL,
  2922. TUNER_TEMIC_PAL, TUNER_TEMIC_PAL,
  2923. TUNER_TEMIC_PAL, TUNER_TEMIC_PAL,
  2924. TUNER_TEMIC_4012FY5, TUNER_TEMIC_4012FY5, //TUNER_TEMIC_SECAM
  2925. TUNER_TEMIC_4012FY5, TUNER_TEMIC_PAL};
  2926. static void __devinit avermedia_eeprom(struct bttv *btv)
  2927. {
  2928. int tuner_make,tuner_tv_fm,tuner_format,tuner=0;
  2929. tuner_make = (eeprom_data[0x41] & 0x7);
  2930. tuner_tv_fm = (eeprom_data[0x41] & 0x18) >> 3;
  2931. tuner_format = (eeprom_data[0x42] & 0xf0) >> 4;
  2932. btv->has_remote = (eeprom_data[0x42] & 0x01);
  2933. if (tuner_make == 0 || tuner_make == 2)
  2934. if(tuner_format <=0x0a)
  2935. tuner = tuner_0_table[tuner_format];
  2936. if (tuner_make == 1)
  2937. if(tuner_format <=9)
  2938. tuner = tuner_1_table[tuner_format];
  2939. if (tuner_make == 4)
  2940. if(tuner_format == 0x09)
  2941. tuner = TUNER_LG_NTSC_NEW_TAPC; // TAPC-G702P
  2942. printk(KERN_INFO "bttv%d: Avermedia eeprom[0x%02x%02x]: tuner=",
  2943. btv->c.nr,eeprom_data[0x41],eeprom_data[0x42]);
  2944. if(tuner) {
  2945. btv->tuner_type=tuner;
  2946. printk("%d",tuner);
  2947. } else
  2948. printk("Unknown type");
  2949. printk(" radio:%s remote control:%s\n",
  2950. tuner_tv_fm ? "yes" : "no",
  2951. btv->has_remote ? "yes" : "no");
  2952. }
  2953. /* used on Voodoo TV/FM (Voodoo 200), S0 wired to 0x10000 */
  2954. void bttv_tda9880_setnorm(struct bttv *btv, int norm)
  2955. {
  2956. // fix up our card entry
  2957. if(norm==VIDEO_MODE_NTSC) {
  2958. bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[0]=0x957fff;
  2959. bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[4]=0x957fff;
  2960. dprintk("bttv_tda9880_setnorm to NTSC\n");
  2961. }
  2962. else {
  2963. bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[0]=0x947fff;
  2964. bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[4]=0x947fff;
  2965. dprintk("bttv_tda9880_setnorm to PAL\n");
  2966. }
  2967. // set GPIO according
  2968. gpio_bits(bttv_tvcards[btv->c.type].gpiomask,
  2969. bttv_tvcards[btv->c.type].audiomux[btv->audio]);
  2970. }
  2971. /*
  2972. * reset/enable the MSP on some Hauppauge cards
  2973. * Thanks to Kyösti Mälkki (kmalkki@cc.hut.fi)!
  2974. *
  2975. * Hauppauge: pin 5
  2976. * Voodoo: pin 20
  2977. */
  2978. static void __devinit boot_msp34xx(struct bttv *btv, int pin)
  2979. {
  2980. int mask = (1 << pin);
  2981. gpio_inout(mask,mask);
  2982. gpio_bits(mask,0);
  2983. udelay(2500);
  2984. gpio_bits(mask,mask);
  2985. if (bttv_gpio)
  2986. bttv_gpio_tracking(btv,"msp34xx");
  2987. if (bttv_verbose)
  2988. printk(KERN_INFO "bttv%d: Hauppauge/Voodoo msp34xx: reset line "
  2989. "init [%d]\n", btv->c.nr, pin);
  2990. }
  2991. static void __devinit boot_bt832(struct bttv *btv)
  2992. {
  2993. }
  2994. /* ----------------------------------------------------------------------- */
  2995. /* Imagenation L-Model PXC200 Framegrabber */
  2996. /* This is basically the same procedure as
  2997. * used by Alessandro Rubini in his pxc200
  2998. * driver, but using BTTV functions */
  2999. static void __devinit init_PXC200(struct bttv *btv)
  3000. {
  3001. static int vals[] __devinitdata = { 0x08, 0x09, 0x0a, 0x0b, 0x0d, 0x0d,
  3002. 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
  3003. 0x00 };
  3004. unsigned int i;
  3005. int tmp;
  3006. u32 val;
  3007. /* Initialise GPIO-connevted stuff */
  3008. gpio_inout(0xffffff, (1<<13));
  3009. gpio_write(0);
  3010. udelay(3);
  3011. gpio_write(1<<13);
  3012. /* GPIO inputs are pulled up, so no need to drive
  3013. * reset pin any longer */
  3014. gpio_bits(0xffffff, 0);
  3015. if (bttv_gpio)
  3016. bttv_gpio_tracking(btv,"pxc200");
  3017. /* we could/should try and reset/control the AD pots? but
  3018. right now we simply turned off the crushing. Without
  3019. this the AGC drifts drifts
  3020. remember the EN is reverse logic -->
  3021. setting BT848_ADC_AGC_EN disable the AGC
  3022. tboult@eecs.lehigh.edu
  3023. */
  3024. btwrite(BT848_ADC_RESERVED|BT848_ADC_AGC_EN, BT848_ADC);
  3025. /* Initialise MAX517 DAC */
  3026. printk(KERN_INFO "Setting DAC reference voltage level ...\n");
  3027. bttv_I2CWrite(btv,0x5E,0,0x80,1);
  3028. /* Initialise 12C508 PIC */
  3029. /* The I2CWrite and I2CRead commmands are actually to the
  3030. * same chips - but the R/W bit is included in the address
  3031. * argument so the numbers are different */
  3032. printk(KERN_INFO "Initialising 12C508 PIC chip ...\n");
  3033. /* First of all, enable the clock line. This is used in the PXC200-F */
  3034. val = btread(BT848_GPIO_DMA_CTL);
  3035. val |= BT848_GPIO_DMA_CTL_GPCLKMODE;
  3036. btwrite(val, BT848_GPIO_DMA_CTL);
  3037. /* Then, push to 0 the reset pin long enough to reset the *
  3038. * device same as above for the reset line, but not the same
  3039. * value sent to the GPIO-connected stuff
  3040. * which one is the good one? */
  3041. gpio_inout(0xffffff,(1<<2));
  3042. gpio_write(0);
  3043. udelay(10);
  3044. gpio_write(1<<2);
  3045. for (i = 0; i < ARRAY_SIZE(vals); i++) {
  3046. tmp=bttv_I2CWrite(btv,0x1E,0,vals[i],1);
  3047. if (tmp != -1) {
  3048. printk(KERN_INFO
  3049. "I2C Write(%2.2x) = %i\nI2C Read () = %2.2x\n\n",
  3050. vals[i],tmp,bttv_I2CRead(btv,0x1F,NULL));
  3051. }
  3052. }
  3053. printk(KERN_INFO "PXC200 Initialised.\n");
  3054. }
  3055. /* ----------------------------------------------------------------------- */
  3056. /*
  3057. * The Adlink RTV-24 (aka Angelo) has some special initialisation to unlock
  3058. * it. This apparently involves the following procedure for each 878 chip:
  3059. *
  3060. * 1) write 0x00C3FEFF to the GPIO_OUT_EN register
  3061. *
  3062. * 2) write to GPIO_DATA
  3063. * - 0x0E
  3064. * - sleep 1ms
  3065. * - 0x10 + 0x0E
  3066. * - sleep 10ms
  3067. * - 0x0E
  3068. * read from GPIO_DATA into buf (uint_32)
  3069. * - if ( data>>18 & 0x01 != 0) || ( buf>>19 & 0x01 != 1 )
  3070. * error. ERROR_CPLD_Check_Failed stop.
  3071. *
  3072. * 3) write to GPIO_DATA
  3073. * - write 0x4400 + 0x0E
  3074. * - sleep 10ms
  3075. * - write 0x4410 + 0x0E
  3076. * - sleep 1ms
  3077. * - write 0x0E
  3078. * read from GPIO_DATA into buf (uint_32)
  3079. * - if ( buf>>18 & 0x01 ) || ( buf>>19 && 0x01 != 0 )
  3080. * error. ERROR_CPLD_Check_Failed.
  3081. */
  3082. /* ----------------------------------------------------------------------- */
  3083. void
  3084. init_RTV24 (struct bttv *btv)
  3085. {
  3086. uint32_t dataRead = 0;
  3087. long watchdog_value = 0x0E;
  3088. printk (KERN_INFO
  3089. "bttv%d: Adlink RTV-24 initialisation in progress ...\n",
  3090. btv->c.nr);
  3091. btwrite (0x00c3feff, BT848_GPIO_OUT_EN);
  3092. btwrite (0 + watchdog_value, BT848_GPIO_DATA);
  3093. msleep (1);
  3094. btwrite (0x10 + watchdog_value, BT848_GPIO_DATA);
  3095. msleep (10);
  3096. btwrite (0 + watchdog_value, BT848_GPIO_DATA);
  3097. dataRead = btread (BT848_GPIO_DATA);
  3098. if ((((dataRead >> 18) & 0x01) != 0) || (((dataRead >> 19) & 0x01) != 1)) {
  3099. printk (KERN_INFO
  3100. "bttv%d: Adlink RTV-24 initialisation(1) ERROR_CPLD_Check_Failed (read %d)\n",
  3101. btv->c.nr, dataRead);
  3102. }
  3103. btwrite (0x4400 + watchdog_value, BT848_GPIO_DATA);
  3104. msleep (10);
  3105. btwrite (0x4410 + watchdog_value, BT848_GPIO_DATA);
  3106. msleep (1);
  3107. btwrite (watchdog_value, BT848_GPIO_DATA);
  3108. msleep (1);
  3109. dataRead = btread (BT848_GPIO_DATA);
  3110. if ((((dataRead >> 18) & 0x01) != 0) || (((dataRead >> 19) & 0x01) != 0)) {
  3111. printk (KERN_INFO
  3112. "bttv%d: Adlink RTV-24 initialisation(2) ERROR_CPLD_Check_Failed (read %d)\n",
  3113. btv->c.nr, dataRead);
  3114. return;
  3115. }
  3116. printk (KERN_INFO
  3117. "bttv%d: Adlink RTV-24 initialisation complete.\n", btv->c.nr);
  3118. }
  3119. /* ----------------------------------------------------------------------- */
  3120. /* Miro Pro radio stuff -- the tea5757 is connected to some GPIO ports */
  3121. /*
  3122. * Copyright (c) 1999 Csaba Halasz <qgehali@uni-miskolc.hu>
  3123. * This code is placed under the terms of the GNU General Public License
  3124. *
  3125. * Brutally hacked by Dan Sheridan <dan.sheridan@contact.org.uk> djs52 8/3/00
  3126. */
  3127. static void bus_low(struct bttv *btv, int bit)
  3128. {
  3129. if (btv->mbox_ior) {
  3130. gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
  3131. btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
  3132. udelay(5);
  3133. }
  3134. gpio_bits(bit,0);
  3135. udelay(5);
  3136. if (btv->mbox_ior) {
  3137. gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
  3138. udelay(5);
  3139. }
  3140. }
  3141. static void bus_high(struct bttv *btv, int bit)
  3142. {
  3143. if (btv->mbox_ior) {
  3144. gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
  3145. btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
  3146. udelay(5);
  3147. }
  3148. gpio_bits(bit,bit);
  3149. udelay(5);
  3150. if (btv->mbox_ior) {
  3151. gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
  3152. udelay(5);
  3153. }
  3154. }
  3155. static int bus_in(struct bttv *btv, int bit)
  3156. {
  3157. if (btv->mbox_ior) {
  3158. gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
  3159. btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
  3160. udelay(5);
  3161. gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
  3162. udelay(5);
  3163. }
  3164. return gpio_read() & (bit);
  3165. }
  3166. /* TEA5757 register bits */
  3167. #define TEA_FREQ 0:14
  3168. #define TEA_BUFFER 15:15
  3169. #define TEA_SIGNAL_STRENGTH 16:17
  3170. #define TEA_PORT1 18:18
  3171. #define TEA_PORT0 19:19
  3172. #define TEA_BAND 20:21
  3173. #define TEA_BAND_FM 0
  3174. #define TEA_BAND_MW 1
  3175. #define TEA_BAND_LW 2
  3176. #define TEA_BAND_SW 3
  3177. #define TEA_MONO 22:22
  3178. #define TEA_ALLOW_STEREO 0
  3179. #define TEA_FORCE_MONO 1
  3180. #define TEA_SEARCH_DIRECTION 23:23
  3181. #define TEA_SEARCH_DOWN 0
  3182. #define TEA_SEARCH_UP 1
  3183. #define TEA_STATUS 24:24
  3184. #define TEA_STATUS_TUNED 0
  3185. #define TEA_STATUS_SEARCHING 1
  3186. /* Low-level stuff */
  3187. static int tea5757_read(struct bttv *btv)
  3188. {
  3189. unsigned long timeout;
  3190. int value = 0;
  3191. int i;
  3192. /* better safe than sorry */
  3193. gpio_inout(btv->mbox_mask, btv->mbox_clk | btv->mbox_we);
  3194. if (btv->mbox_ior) {
  3195. gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
  3196. btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
  3197. udelay(5);
  3198. }
  3199. if (bttv_gpio)
  3200. bttv_gpio_tracking(btv,"tea5757 read");
  3201. bus_low(btv,btv->mbox_we);
  3202. bus_low(btv,btv->mbox_clk);
  3203. udelay(10);
  3204. timeout= jiffies + HZ;
  3205. // wait for DATA line to go low; error if it doesn't
  3206. while (bus_in(btv,btv->mbox_data) && time_before(jiffies, timeout))
  3207. schedule();
  3208. if (bus_in(btv,btv->mbox_data)) {
  3209. printk(KERN_WARNING "bttv%d: tea5757: read timeout\n",btv->c.nr);
  3210. return -1;
  3211. }
  3212. dprintk("bttv%d: tea5757:",btv->c.nr);
  3213. for(i = 0; i < 24; i++)
  3214. {
  3215. udelay(5);
  3216. bus_high(btv,btv->mbox_clk);
  3217. udelay(5);
  3218. dprintk("%c",(bus_in(btv,btv->mbox_most) == 0)?'T':'-');
  3219. bus_low(btv,btv->mbox_clk);
  3220. value <<= 1;
  3221. value |= (bus_in(btv,btv->mbox_data) == 0)?0:1; /* MSB first */
  3222. dprintk("%c", (bus_in(btv,btv->mbox_most) == 0)?'S':'M');
  3223. }
  3224. dprintk("\nbttv%d: tea5757: read 0x%X\n", btv->c.nr, value);
  3225. return value;
  3226. }
  3227. static int tea5757_write(struct bttv *btv, int value)
  3228. {
  3229. int i;
  3230. int reg = value;
  3231. gpio_inout(btv->mbox_mask, btv->mbox_clk | btv->mbox_we | btv->mbox_data);
  3232. if (btv->mbox_ior) {
  3233. gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
  3234. btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
  3235. udelay(5);
  3236. }
  3237. if (bttv_gpio)
  3238. bttv_gpio_tracking(btv,"tea5757 write");
  3239. dprintk("bttv%d: tea5757: write 0x%X\n", btv->c.nr, value);
  3240. bus_low(btv,btv->mbox_clk);
  3241. bus_high(btv,btv->mbox_we);
  3242. for(i = 0; i < 25; i++)
  3243. {
  3244. if (reg & 0x1000000)
  3245. bus_high(btv,btv->mbox_data);
  3246. else
  3247. bus_low(btv,btv->mbox_data);
  3248. reg <<= 1;
  3249. bus_high(btv,btv->mbox_clk);
  3250. udelay(10);
  3251. bus_low(btv,btv->mbox_clk);
  3252. udelay(10);
  3253. }
  3254. bus_low(btv,btv->mbox_we); /* unmute !!! */
  3255. return 0;
  3256. }
  3257. void tea5757_set_freq(struct bttv *btv, unsigned short freq)
  3258. {
  3259. dprintk("tea5757_set_freq %d\n",freq);
  3260. tea5757_write(btv, 5 * freq + 0x358); /* add 10.7MHz (see docs) */
  3261. }
  3262. /* ----------------------------------------------------------------------- */
  3263. /* winview */
  3264. void winview_audio(struct bttv *btv, struct video_audio *v, int set)
  3265. {
  3266. /* PT2254A programming Jon Tombs, jon@gte.esi.us.es */
  3267. int bits_out, loops, vol, data;
  3268. if (!set) {
  3269. /* Fixed by Leandro Lucarella <luca@linuxmendoza.org.ar (07/31/01) */
  3270. v->flags |= VIDEO_AUDIO_VOLUME;
  3271. return;
  3272. }
  3273. /* 32 levels logarithmic */
  3274. vol = 32 - ((v->volume>>11));
  3275. /* units */
  3276. bits_out = (PT2254_DBS_IN_2>>(vol%5));
  3277. /* tens */
  3278. bits_out |= (PT2254_DBS_IN_10>>(vol/5));
  3279. bits_out |= PT2254_L_CHANNEL | PT2254_R_CHANNEL;
  3280. data = gpio_read();
  3281. data &= ~(WINVIEW_PT2254_CLK| WINVIEW_PT2254_DATA|
  3282. WINVIEW_PT2254_STROBE);
  3283. for (loops = 17; loops >= 0 ; loops--) {
  3284. if (bits_out & (1<<loops))
  3285. data |= WINVIEW_PT2254_DATA;
  3286. else
  3287. data &= ~WINVIEW_PT2254_DATA;
  3288. gpio_write(data);
  3289. udelay(5);
  3290. data |= WINVIEW_PT2254_CLK;
  3291. gpio_write(data);
  3292. udelay(5);
  3293. data &= ~WINVIEW_PT2254_CLK;
  3294. gpio_write(data);
  3295. }
  3296. data |= WINVIEW_PT2254_STROBE;
  3297. data &= ~WINVIEW_PT2254_DATA;
  3298. gpio_write(data);
  3299. udelay(10);
  3300. data &= ~WINVIEW_PT2254_STROBE;
  3301. gpio_write(data);
  3302. }
  3303. /* ----------------------------------------------------------------------- */
  3304. /* mono/stereo control for various cards (which don't use i2c chips but */
  3305. /* connect something to the GPIO pins */
  3306. static void
  3307. gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set)
  3308. {
  3309. unsigned int con = 0;
  3310. if (set) {
  3311. gpio_inout(0x300, 0x300);
  3312. if (v->mode & VIDEO_SOUND_LANG1)
  3313. con = 0x000;
  3314. if (v->mode & VIDEO_SOUND_LANG2)
  3315. con = 0x300;
  3316. if (v->mode & VIDEO_SOUND_STEREO)
  3317. con = 0x200;
  3318. // if (v->mode & VIDEO_SOUND_MONO)
  3319. // con = 0x100;
  3320. gpio_bits(0x300, con);
  3321. } else {
  3322. v->mode = VIDEO_SOUND_STEREO |
  3323. VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
  3324. }
  3325. }
  3326. static void
  3327. gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set)
  3328. {
  3329. unsigned int val, con;
  3330. if (btv->radio_user)
  3331. return;
  3332. val = gpio_read();
  3333. if (set) {
  3334. con = 0x000;
  3335. if (v->mode & VIDEO_SOUND_LANG2) {
  3336. if (v->mode & VIDEO_SOUND_LANG1) {
  3337. /* LANG1 + LANG2 */
  3338. con = 0x100;
  3339. }
  3340. else {
  3341. /* LANG2 */
  3342. con = 0x300;
  3343. }
  3344. }
  3345. if (con != (val & 0x300)) {
  3346. gpio_bits(0x300, con);
  3347. if (bttv_gpio)
  3348. bttv_gpio_tracking(btv,"gvbctv5pci");
  3349. }
  3350. } else {
  3351. switch (val & 0x70) {
  3352. case 0x10:
  3353. v->mode = VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
  3354. break;
  3355. case 0x30:
  3356. v->mode = VIDEO_SOUND_LANG2;
  3357. break;
  3358. case 0x50:
  3359. v->mode = VIDEO_SOUND_LANG1;
  3360. break;
  3361. case 0x60:
  3362. v->mode = VIDEO_SOUND_STEREO;
  3363. break;
  3364. case 0x70:
  3365. v->mode = VIDEO_SOUND_MONO;
  3366. break;
  3367. default:
  3368. v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
  3369. VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
  3370. }
  3371. }
  3372. }
  3373. /*
  3374. * Mario Medina Nussbaum <medisoft@alohabbs.org.mx>
  3375. * I discover that on BT848_GPIO_DATA address a byte 0xcce enable stereo,
  3376. * 0xdde enables mono and 0xccd enables sap
  3377. *
  3378. * Petr Vandrovec <VANDROVE@vc.cvut.cz>
  3379. * P.S.: At least mask in line above is wrong - GPIO pins 3,2 select
  3380. * input/output sound connection, so both must be set for output mode.
  3381. *
  3382. * Looks like it's needed only for the "tvphone", the "tvphone 98"
  3383. * handles this with a tda9840
  3384. *
  3385. */
  3386. static void
  3387. avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, int set)
  3388. {
  3389. int val = 0;
  3390. if (set) {
  3391. if (v->mode & VIDEO_SOUND_LANG2) /* SAP */
  3392. val = 0x02;
  3393. if (v->mode & VIDEO_SOUND_STEREO)
  3394. val = 0x01;
  3395. if (val) {
  3396. gpio_bits(0x03,val);
  3397. if (bttv_gpio)
  3398. bttv_gpio_tracking(btv,"avermedia");
  3399. }
  3400. } else {
  3401. v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
  3402. VIDEO_SOUND_LANG1;
  3403. return;
  3404. }
  3405. }
  3406. static void
  3407. avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v, int set)
  3408. {
  3409. int val = 0;
  3410. if (set) {
  3411. if (v->mode & VIDEO_SOUND_LANG2) /* SAP */
  3412. val = 0x01;
  3413. if (v->mode & VIDEO_SOUND_STEREO) /* STEREO */
  3414. val = 0x02;
  3415. btaor(val, ~0x03, BT848_GPIO_DATA);
  3416. if (bttv_gpio)
  3417. bttv_gpio_tracking(btv,"avermedia");
  3418. } else {
  3419. v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
  3420. VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
  3421. return;
  3422. }
  3423. }
  3424. /* Lifetec 9415 handling */
  3425. static void
  3426. lt9415_audio(struct bttv *btv, struct video_audio *v, int set)
  3427. {
  3428. int val = 0;
  3429. if (gpio_read() & 0x4000) {
  3430. v->mode = VIDEO_SOUND_MONO;
  3431. return;
  3432. }
  3433. if (set) {
  3434. if (v->mode & VIDEO_SOUND_LANG2) /* A2 SAP */
  3435. val = 0x0080;
  3436. if (v->mode & VIDEO_SOUND_STEREO) /* A2 stereo */
  3437. val = 0x0880;
  3438. if ((v->mode & VIDEO_SOUND_LANG1) ||
  3439. (v->mode & VIDEO_SOUND_MONO))
  3440. val = 0;
  3441. gpio_bits(0x0880, val);
  3442. if (bttv_gpio)
  3443. bttv_gpio_tracking(btv,"lt9415");
  3444. } else {
  3445. /* autodetect doesn't work with this card :-( */
  3446. v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
  3447. VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
  3448. return;
  3449. }
  3450. }
  3451. // TDA9821 on TerraTV+ Bt848, Bt878
  3452. static void
  3453. terratv_audio(struct bttv *btv, struct video_audio *v, int set)
  3454. {
  3455. unsigned int con = 0;
  3456. if (set) {
  3457. gpio_inout(0x180000,0x180000);
  3458. if (v->mode & VIDEO_SOUND_LANG2)
  3459. con = 0x080000;
  3460. if (v->mode & VIDEO_SOUND_STEREO)
  3461. con = 0x180000;
  3462. gpio_bits(0x180000, con);
  3463. if (bttv_gpio)
  3464. bttv_gpio_tracking(btv,"terratv");
  3465. } else {
  3466. v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
  3467. VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
  3468. }
  3469. }
  3470. static void
  3471. winfast2000_audio(struct bttv *btv, struct video_audio *v, int set)
  3472. {
  3473. unsigned long val = 0;
  3474. if (set) {
  3475. /*btor (0xc32000, BT848_GPIO_OUT_EN);*/
  3476. if (v->mode & VIDEO_SOUND_MONO) /* Mono */
  3477. val = 0x420000;
  3478. if (v->mode & VIDEO_SOUND_LANG1) /* Mono */
  3479. val = 0x420000;
  3480. if (v->mode & VIDEO_SOUND_LANG2) /* SAP */
  3481. val = 0x410000;
  3482. if (v->mode & VIDEO_SOUND_STEREO) /* Stereo */
  3483. val = 0x020000;
  3484. if (val) {
  3485. gpio_bits(0x430000, val);
  3486. if (bttv_gpio)
  3487. bttv_gpio_tracking(btv,"winfast2000");
  3488. }
  3489. } else {
  3490. v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
  3491. VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
  3492. }
  3493. }
  3494. /*
  3495. * Dariusz Kowalewski <darekk@automex.pl>
  3496. * sound control for Prolink PV-BT878P+9B (PixelView PlayTV Pro FM+NICAM
  3497. * revision 9B has on-board TDA9874A sound decoder).
  3498. *
  3499. * Note: There are card variants without tda9874a. Forcing the "stereo sound route"
  3500. * will mute this cards.
  3501. */
  3502. static void
  3503. pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set)
  3504. {
  3505. unsigned int val = 0;
  3506. if (btv->radio_user)
  3507. return;
  3508. if (set) {
  3509. if (v->mode & VIDEO_SOUND_MONO) {
  3510. val = 0x01;
  3511. }
  3512. if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2))
  3513. || (v->mode & VIDEO_SOUND_STEREO)) {
  3514. val = 0x02;
  3515. }
  3516. if (val) {
  3517. gpio_bits(0x03,val);
  3518. if (bttv_gpio)
  3519. bttv_gpio_tracking(btv,"pvbt878p9b");
  3520. }
  3521. } else {
  3522. v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
  3523. VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
  3524. }
  3525. }
  3526. /*
  3527. * Dariusz Kowalewski <darekk@automex.pl>
  3528. * sound control for FlyVideo 2000S (with tda9874 decoder)
  3529. * based on pvbt878p9b_audio() - this is not tested, please fix!!!
  3530. */
  3531. static void
  3532. fv2000s_audio(struct bttv *btv, struct video_audio *v, int set)
  3533. {
  3534. unsigned int val = 0xffff;
  3535. if (btv->radio_user)
  3536. return;
  3537. if (set) {
  3538. if (v->mode & VIDEO_SOUND_MONO) {
  3539. val = 0x0000;
  3540. }
  3541. if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2))
  3542. || (v->mode & VIDEO_SOUND_STEREO)) {
  3543. val = 0x1080; //-dk-???: 0x0880, 0x0080, 0x1800 ...
  3544. }
  3545. if (val != 0xffff) {
  3546. gpio_bits(0x1800, val);
  3547. if (bttv_gpio)
  3548. bttv_gpio_tracking(btv,"fv2000s");
  3549. }
  3550. } else {
  3551. v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
  3552. VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
  3553. }
  3554. }
  3555. /*
  3556. * sound control for Canopus WinDVR PCI
  3557. * Masaki Suzuki <masaki@btree.org>
  3558. */
  3559. static void
  3560. windvr_audio(struct bttv *btv, struct video_audio *v, int set)
  3561. {
  3562. unsigned long val = 0;
  3563. if (set) {
  3564. if (v->mode & VIDEO_SOUND_MONO)
  3565. val = 0x040000;
  3566. if (v->mode & VIDEO_SOUND_LANG1)
  3567. val = 0;
  3568. if (v->mode & VIDEO_SOUND_LANG2)
  3569. val = 0x100000;
  3570. if (v->mode & VIDEO_SOUND_STEREO)
  3571. val = 0;
  3572. if (val) {
  3573. gpio_bits(0x140000, val);
  3574. if (bttv_gpio)
  3575. bttv_gpio_tracking(btv,"windvr");
  3576. }
  3577. } else {
  3578. v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
  3579. VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
  3580. }
  3581. }
  3582. /*
  3583. * sound control for AD-TVK503
  3584. * Hiroshi Takekawa <sian@big.or.jp>
  3585. */
  3586. static void
  3587. adtvk503_audio(struct bttv *btv, struct video_audio *v, int set)
  3588. {
  3589. unsigned int con = 0xffffff;
  3590. //btaor(0x1e0000, ~0x1e0000, BT848_GPIO_OUT_EN);
  3591. if (set) {
  3592. //btor(***, BT848_GPIO_OUT_EN);
  3593. if (v->mode & VIDEO_SOUND_LANG1)
  3594. con = 0x00000000;
  3595. if (v->mode & VIDEO_SOUND_LANG2)
  3596. con = 0x00180000;
  3597. if (v->mode & VIDEO_SOUND_STEREO)
  3598. con = 0x00000000;
  3599. if (v->mode & VIDEO_SOUND_MONO)
  3600. con = 0x00060000;
  3601. if (con != 0xffffff) {
  3602. gpio_bits(0x1e0000,con);
  3603. if (bttv_gpio)
  3604. bttv_gpio_tracking(btv, "adtvk503");
  3605. }
  3606. } else {
  3607. v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
  3608. VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
  3609. }
  3610. }
  3611. /* RemoteVision MX (rv605) muxsel helper [Miguel Freitas]
  3612. *
  3613. * This is needed because rv605 don't use a normal multiplex, but a crosspoint
  3614. * switch instead (CD22M3494E). This IC can have multiple active connections
  3615. * between Xn (input) and Yn (output) pins. We need to clear any existing
  3616. * connection prior to establish a new one, pulsing the STROBE pin.
  3617. *
  3618. * The board hardwire Y0 (xpoint) to MUX1 and MUXOUT to Yin.
  3619. * GPIO pins are wired as:
  3620. * GPIO[0:3] - AX[0:3] (xpoint) - P1[0:3] (microcontroler)
  3621. * GPIO[4:6] - AY[0:2] (xpoint) - P1[4:6] (microcontroler)
  3622. * GPIO[7] - DATA (xpoint) - P1[7] (microcontroler)
  3623. * GPIO[8] - - P3[5] (microcontroler)
  3624. * GPIO[9] - RESET (xpoint) - P3[6] (microcontroler)
  3625. * GPIO[10] - STROBE (xpoint) - P3[7] (microcontroler)
  3626. * GPINTR - - P3[4] (microcontroler)
  3627. *
  3628. * The microcontroler is a 80C32 like. It should be possible to change xpoint
  3629. * configuration either directly (as we are doing) or using the microcontroler
  3630. * which is also wired to I2C interface. I have no further info on the
  3631. * microcontroler features, one would need to disassembly the firmware.
  3632. * note: the vendor refused to give any information on this product, all
  3633. * that stuff was found using a multimeter! :)
  3634. */
  3635. static void rv605_muxsel(struct bttv *btv, unsigned int input)
  3636. {
  3637. /* reset all conections */
  3638. gpio_bits(0x200,0x200);
  3639. mdelay(1);
  3640. gpio_bits(0x200,0x000);
  3641. mdelay(1);
  3642. /* create a new conection */
  3643. gpio_bits(0x480,0x080);
  3644. gpio_bits(0x480,0x480);
  3645. mdelay(1);
  3646. gpio_bits(0x480,0x080);
  3647. mdelay(1);
  3648. }
  3649. /* Tibet Systems 'Progress DVR' CS16 muxsel helper [Chris Fanning]
  3650. *
  3651. * The CS16 (available on eBay cheap) is a PCI board with four Fusion
  3652. * 878A chips, a PCI bridge, an Atmel microcontroller, four sync seperator
  3653. * chips, ten eight input analog multiplexors, a not chip and a few
  3654. * other components.
  3655. *
  3656. * 16 inputs on a secondary bracket are provided and can be selected
  3657. * from each of the four capture chips. Two of the eight input
  3658. * multiplexors are used to select from any of the 16 input signals.
  3659. *
  3660. * Unsupported hardware capabilities:
  3661. * . A video output monitor on the secondary bracket can be selected from
  3662. * one of the 878A chips.
  3663. * . Another passthrough but I haven't spent any time investigating it.
  3664. * . Digital I/O (logic level connected to GPIO) is available from an
  3665. * onboard header.
  3666. *
  3667. * The on chip input mux should always be set to 2.
  3668. * GPIO[16:19] - Video input selection
  3669. * GPIO[0:3] - Video output monitor select (only available from one 878A)
  3670. * GPIO[?:?] - Digital I/O.
  3671. *
  3672. * There is an ATMEL microcontroller with an 8031 core on board. I have not
  3673. * determined what function (if any) it provides. With the microcontroller
  3674. * and sync seperator chips a guess is that it might have to do with video
  3675. * switching and maybe some digital I/O.
  3676. */
  3677. static void tibetCS16_muxsel(struct bttv *btv, unsigned int input)
  3678. {
  3679. /* video mux */
  3680. gpio_bits(0x0f0000, input << 16);
  3681. }
  3682. static void tibetCS16_init(struct bttv *btv)
  3683. {
  3684. /* enable gpio bits, mask obtained via btSpy */
  3685. gpio_inout(0xffffff, 0x0f7fff);
  3686. gpio_write(0x0f7fff);
  3687. }
  3688. /*
  3689. * The following routines for the Kodicom-4400r get a little mind-twisting.
  3690. * There is a "master" controller and three "slave" controllers, together
  3691. * an analog switch which connects any of 16 cameras to any of the BT87A's.
  3692. * The analog switch is controlled by the "master", but the detection order
  3693. * of the four BT878A chips is in an order which I just don't understand.
  3694. * The "master" is actually the second controller to be detected. The
  3695. * logic on the board uses logical numbers for the 4 controlers, but
  3696. * those numbers are different from the detection sequence. When working
  3697. * with the analog switch, we need to "map" from the detection sequence
  3698. * over to the board's logical controller number. This mapping sequence
  3699. * is {3, 0, 2, 1}, i.e. the first controller to be detected is logical
  3700. * unit 3, the second (which is the master) is logical unit 0, etc.
  3701. * We need to maintain the status of the analog switch (which of the 16
  3702. * cameras is connected to which of the 4 controllers). Rather than
  3703. * add to the bttv structure for this, we use the data reserved for
  3704. * the mbox (unused for this card type).
  3705. */
  3706. /*
  3707. * First a routine to set the analog switch, which controls which camera
  3708. * is routed to which controller. The switch comprises an X-address
  3709. * (gpio bits 0-3, representing the camera, ranging from 0-15), and a
  3710. * Y-address (gpio bits 4-6, representing the controller, ranging from 0-3).
  3711. * A data value (gpio bit 7) of '1' enables the switch, and '0' disables
  3712. * the switch. A STROBE bit (gpio bit 8) latches the data value into the
  3713. * specified address. The idea is to set the address and data, then bring
  3714. * STROBE high, and finally bring STROBE back to low.
  3715. */
  3716. static void kodicom4400r_write(struct bttv *btv,
  3717. unsigned char xaddr,
  3718. unsigned char yaddr,
  3719. unsigned char data) {
  3720. unsigned int udata;
  3721. udata = (data << 7) | ((yaddr&3) << 4) | (xaddr&0xf);
  3722. gpio_bits(0x1ff, udata); /* write ADDR and DAT */
  3723. gpio_bits(0x1ff, udata | (1 << 8)); /* strobe high */
  3724. gpio_bits(0x1ff, udata); /* strobe low */
  3725. }
  3726. /*
  3727. * Next the mux select. Both the "master" and "slave" 'cards' (controllers)
  3728. * use this routine. The routine finds the "master" for the card, maps
  3729. * the controller number from the detected position over to the logical
  3730. * number, writes the appropriate data to the analog switch, and housekeeps
  3731. * the local copy of the switch information. The parameter 'input' is the
  3732. * requested camera number (0 - 15).
  3733. */
  3734. static void kodicom4400r_muxsel(struct bttv *btv, unsigned int input)
  3735. {
  3736. char *sw_status;
  3737. int xaddr, yaddr;
  3738. struct bttv *mctlr;
  3739. static unsigned char map[4] = {3, 0, 2, 1};
  3740. mctlr = master[btv->c.nr];
  3741. if (mctlr == NULL) { /* ignore if master not yet detected */
  3742. return;
  3743. }
  3744. yaddr = (btv->c.nr - mctlr->c.nr + 1) & 3; /* the '&' is for safety */
  3745. yaddr = map[yaddr];
  3746. sw_status = (char *)(&mctlr->mbox_we);
  3747. xaddr = input & 0xf;
  3748. /* Check if the controller/camera pair has changed, else ignore */
  3749. if (sw_status[yaddr] != xaddr)
  3750. {
  3751. /* "open" the old switch, "close" the new one, save the new */
  3752. kodicom4400r_write(mctlr, sw_status[yaddr], yaddr, 0);
  3753. sw_status[yaddr] = xaddr;
  3754. kodicom4400r_write(mctlr, xaddr, yaddr, 1);
  3755. }
  3756. }
  3757. /*
  3758. * During initialisation, we need to reset the analog switch. We
  3759. * also preset the switch to map the 4 connectors on the card to the
  3760. * *user's* (see above description of kodicom4400r_muxsel) channels
  3761. * 0 through 3
  3762. */
  3763. static void kodicom4400r_init(struct bttv *btv)
  3764. {
  3765. char *sw_status = (char *)(&btv->mbox_we);
  3766. int ix;
  3767. gpio_inout(0x0003ff, 0x0003ff);
  3768. gpio_write(1 << 9); /* reset MUX */
  3769. gpio_write(0);
  3770. /* Preset camera 0 to the 4 controllers */
  3771. for (ix=0; ix<4; ix++) {
  3772. sw_status[ix] = ix;
  3773. kodicom4400r_write(btv, ix, ix, 1);
  3774. }
  3775. /*
  3776. * Since this is the "master", we need to set up the
  3777. * other three controller chips' pointers to this structure
  3778. * for later use in the muxsel routine.
  3779. */
  3780. if ((btv->c.nr<1) || (btv->c.nr>BTTV_MAX-3))
  3781. return;
  3782. master[btv->c.nr-1] = btv;
  3783. master[btv->c.nr] = btv;
  3784. master[btv->c.nr+1] = btv;
  3785. master[btv->c.nr+2] = btv;
  3786. }
  3787. // The Grandtec X-Guard framegrabber card uses two Dual 4-channel
  3788. // video multiplexers to provide up to 16 video inputs. These
  3789. // multiplexers are controlled by the lower 8 GPIO pins of the
  3790. // bt878. The multiplexers probably Pericom PI5V331Q or similar.
  3791. // xxx0 is pin xxx of multiplexer U5,
  3792. // yyy1 is pin yyy of multiplexer U2
  3793. #define ENA0 0x01
  3794. #define ENB0 0x02
  3795. #define ENA1 0x04
  3796. #define ENB1 0x08
  3797. #define IN10 0x10
  3798. #define IN00 0x20
  3799. #define IN11 0x40
  3800. #define IN01 0x80
  3801. static void xguard_muxsel(struct bttv *btv, unsigned int input)
  3802. {
  3803. static const int masks[] = {
  3804. ENB0, ENB0|IN00, ENB0|IN10, ENB0|IN00|IN10,
  3805. ENA0, ENA0|IN00, ENA0|IN10, ENA0|IN00|IN10,
  3806. ENB1, ENB1|IN01, ENB1|IN11, ENB1|IN01|IN11,
  3807. ENA1, ENA1|IN01, ENA1|IN11, ENA1|IN01|IN11,
  3808. };
  3809. gpio_write(masks[input%16]);
  3810. }
  3811. static void picolo_tetra_init(struct bttv *btv)
  3812. {
  3813. /*This is the video input redirection fonctionality : I DID NOT USED IT. */
  3814. btwrite (0x08<<16,BT848_GPIO_DATA);/*GPIO[19] [==> 4053 B+C] set to 1 */
  3815. btwrite (0x04<<16,BT848_GPIO_DATA);/*GPIO[18] [==> 4053 A] set to 1*/
  3816. }
  3817. static void picolo_tetra_muxsel (struct bttv* btv, unsigned int input)
  3818. {
  3819. dprintk (KERN_DEBUG "bttv%d : picolo_tetra_muxsel => input = %d\n",btv->c.nr,input);
  3820. /*Just set the right path in the analog multiplexers : channel 1 -> 4 ==> Analog Mux ==> MUX0*/
  3821. /*GPIO[20]&GPIO[21] used to choose the right input*/
  3822. btwrite (input<<20,BT848_GPIO_DATA);
  3823. }
  3824. /*
  3825. * ivc120_muxsel [Added by Alan Garfield <alan@fromorbit.com>]
  3826. *
  3827. * The IVC120G security card has 4 i2c controlled TDA8540 matrix
  3828. * swichers to provide 16 channels to MUX0. The TDA8540's have
  3829. * 4 indepedant outputs and as such the IVC120G also has the
  3830. * optional "Monitor Out" bus. This allows the card to be looking
  3831. * at one input while the monitor is looking at another.
  3832. *
  3833. * Since I've couldn't be bothered figuring out how to add an
  3834. * independant muxsel for the monitor bus, I've just set it to
  3835. * whatever the card is looking at.
  3836. *
  3837. * OUT0 of the TDA8540's is connected to MUX0 (0x03)
  3838. * OUT1 of the TDA8540's is connected to "Monitor Out" (0x0C)
  3839. *
  3840. * TDA8540_ALT3 IN0-3 = Channel 13 - 16 (0x03)
  3841. * TDA8540_ALT4 IN0-3 = Channel 1 - 4 (0x03)
  3842. * TDA8540_ALT5 IN0-3 = Channel 5 - 8 (0x03)
  3843. * TDA8540_ALT6 IN0-3 = Channel 9 - 12 (0x03)
  3844. *
  3845. */
  3846. /* All 7 possible sub-ids for the TDA8540 Matrix Switcher */
  3847. #define I2C_TDA8540 0x90
  3848. #define I2C_TDA8540_ALT1 0x92
  3849. #define I2C_TDA8540_ALT2 0x94
  3850. #define I2C_TDA8540_ALT3 0x96
  3851. #define I2C_TDA8540_ALT4 0x98
  3852. #define I2C_TDA8540_ALT5 0x9a
  3853. #define I2C_TDA8540_ALT6 0x9c
  3854. static void ivc120_muxsel(struct bttv *btv, unsigned int input)
  3855. {
  3856. // Simple maths
  3857. int key = input % 4;
  3858. int matrix = input / 4;
  3859. dprintk("bttv%d: ivc120_muxsel: Input - %02d | TDA - %02d | In - %02d\n",
  3860. btv->c.nr, input, matrix, key);
  3861. // Handles the input selection on the TDA8540's
  3862. bttv_I2CWrite(btv, I2C_TDA8540_ALT3, 0x00,
  3863. ((matrix == 3) ? (key | key << 2) : 0x00), 1);
  3864. bttv_I2CWrite(btv, I2C_TDA8540_ALT4, 0x00,
  3865. ((matrix == 0) ? (key | key << 2) : 0x00), 1);
  3866. bttv_I2CWrite(btv, I2C_TDA8540_ALT5, 0x00,
  3867. ((matrix == 1) ? (key | key << 2) : 0x00), 1);
  3868. bttv_I2CWrite(btv, I2C_TDA8540_ALT6, 0x00,
  3869. ((matrix == 2) ? (key | key << 2) : 0x00), 1);
  3870. // Handles the output enables on the TDA8540's
  3871. bttv_I2CWrite(btv, I2C_TDA8540_ALT3, 0x02,
  3872. ((matrix == 3) ? 0x03 : 0x00), 1); // 13 - 16
  3873. bttv_I2CWrite(btv, I2C_TDA8540_ALT4, 0x02,
  3874. ((matrix == 0) ? 0x03 : 0x00), 1); // 1-4
  3875. bttv_I2CWrite(btv, I2C_TDA8540_ALT5, 0x02,
  3876. ((matrix == 1) ? 0x03 : 0x00), 1); // 5-8
  3877. bttv_I2CWrite(btv, I2C_TDA8540_ALT6, 0x02,
  3878. ((matrix == 2) ? 0x03 : 0x00), 1); // 9-12
  3879. // Selects MUX0 for input on the 878
  3880. btaor((0)<<5, ~(3<<5), BT848_IFORM);
  3881. }
  3882. /* PXC200 muxsel helper
  3883. * luke@syseng.anu.edu.au
  3884. * another transplant
  3885. * from Alessandro Rubini (rubini@linux.it)
  3886. *
  3887. * There are 4 kinds of cards:
  3888. * PXC200L which is bt848
  3889. * PXC200F which is bt848 with PIC controlling mux
  3890. * PXC200AL which is bt878
  3891. * PXC200AF which is bt878 with PIC controlling mux
  3892. */
  3893. #define PX_CFG_PXC200F 0x01
  3894. #define PX_FLAG_PXC200A 0x00001000 /* a pxc200A is bt-878 based */
  3895. #define PX_I2C_PIC 0x0f
  3896. #define PX_PXC200A_CARDID 0x200a1295
  3897. #define PX_I2C_CMD_CFG 0x00
  3898. static void PXC200_muxsel(struct bttv *btv, unsigned int input)
  3899. {
  3900. int rc;
  3901. long mux;
  3902. int bitmask;
  3903. unsigned char buf[2];
  3904. /* Read PIC config to determine if this is a PXC200F */
  3905. /* PX_I2C_CMD_CFG*/
  3906. buf[0]=0;
  3907. buf[1]=0;
  3908. rc=bttv_I2CWrite(btv,(PX_I2C_PIC<<1),buf[0],buf[1],1);
  3909. if (rc) {
  3910. printk(KERN_DEBUG "bttv%d: PXC200_muxsel: pic cfg write failed:%d\n", btv->c.nr,rc);
  3911. /* not PXC ? do nothing */
  3912. return;
  3913. }
  3914. rc=bttv_I2CRead(btv,(PX_I2C_PIC<<1),NULL);
  3915. if (!(rc & PX_CFG_PXC200F)) {
  3916. printk(KERN_DEBUG "bttv%d: PXC200_muxsel: not PXC200F rc:%d \n", btv->c.nr,rc);
  3917. return;
  3918. }
  3919. /* The multiplexer in the 200F is handled by the GPIO port */
  3920. /* get correct mapping between inputs */
  3921. /* mux = bttv_tvcards[btv->type].muxsel[input] & 3; */
  3922. /* ** not needed!? */
  3923. mux = input;
  3924. /* make sure output pins are enabled */
  3925. /* bitmask=0x30f; */
  3926. bitmask=0x302;
  3927. /* check whether we have a PXC200A */
  3928. if (btv->cardid == PX_PXC200A_CARDID) {
  3929. bitmask ^= 0x180; /* use 7 and 9, not 8 and 9 */
  3930. bitmask |= 7<<4; /* the DAC */
  3931. }
  3932. btwrite(bitmask, BT848_GPIO_OUT_EN);
  3933. bitmask = btread(BT848_GPIO_DATA);
  3934. if (btv->cardid == PX_PXC200A_CARDID)
  3935. bitmask = (bitmask & ~0x280) | ((mux & 2) << 8) | ((mux & 1) << 7);
  3936. else /* older device */
  3937. bitmask = (bitmask & ~0x300) | ((mux & 3) << 8);
  3938. btwrite(bitmask,BT848_GPIO_DATA);
  3939. /*
  3940. * Was "to be safe, set the bt848 to input 0"
  3941. * Actually, since it's ok at load time, better not messing
  3942. * with these bits (on PXC200AF you need to set mux 2 here)
  3943. *
  3944. * needed because bttv-driver sets mux before calling this function
  3945. */
  3946. if (btv->cardid == PX_PXC200A_CARDID)
  3947. btaor(2<<5, ~BT848_IFORM_MUXSEL, BT848_IFORM);
  3948. else /* older device */
  3949. btand(~BT848_IFORM_MUXSEL,BT848_IFORM);
  3950. printk(KERN_DEBUG "bttv%d: setting input channel to:%d\n", btv->c.nr,(int)mux);
  3951. }
  3952. /* ----------------------------------------------------------------------- */
  3953. /* motherboard chipset specific stuff */
  3954. void __devinit bttv_check_chipset(void)
  3955. {
  3956. int pcipci_fail = 0;
  3957. struct pci_dev *dev = NULL;
  3958. if (pci_pci_problems & PCIPCI_FAIL)
  3959. pcipci_fail = 1;
  3960. if (pci_pci_problems & (PCIPCI_TRITON|PCIPCI_NATOMA|PCIPCI_VIAETBF))
  3961. triton1 = 1;
  3962. if (pci_pci_problems & PCIPCI_VSFX)
  3963. vsfx = 1;
  3964. #ifdef PCIPCI_ALIMAGIK
  3965. if (pci_pci_problems & PCIPCI_ALIMAGIK)
  3966. latency = 0x0A;
  3967. #endif
  3968. /* print warnings about any quirks found */
  3969. if (triton1)
  3970. printk(KERN_INFO "bttv: Host bridge needs ETBF enabled.\n");
  3971. if (vsfx)
  3972. printk(KERN_INFO "bttv: Host bridge needs VSFX enabled.\n");
  3973. if (pcipci_fail) {
  3974. printk(KERN_WARNING "bttv: BT848 and your chipset may not work together.\n");
  3975. if (UNSET == no_overlay) {
  3976. printk(KERN_WARNING "bttv: going to disable overlay.\n");
  3977. no_overlay = 1;
  3978. }
  3979. }
  3980. if (UNSET != latency)
  3981. printk(KERN_INFO "bttv: pci latency fixup [%d]\n",latency);
  3982. while ((dev = pci_find_device(PCI_VENDOR_ID_INTEL,
  3983. PCI_DEVICE_ID_INTEL_82441, dev))) {
  3984. unsigned char b;
  3985. pci_read_config_byte(dev, 0x53, &b);
  3986. if (bttv_debug)
  3987. printk(KERN_INFO "bttv: Host bridge: 82441FX Natoma, "
  3988. "bufcon=0x%02x\n",b);
  3989. }
  3990. }
  3991. int __devinit bttv_handle_chipset(struct bttv *btv)
  3992. {
  3993. unsigned char command;
  3994. if (!triton1 && !vsfx && UNSET == latency)
  3995. return 0;
  3996. if (bttv_verbose) {
  3997. if (triton1)
  3998. printk(KERN_INFO "bttv%d: enabling ETBF (430FX/VP3 compatibilty)\n",btv->c.nr);
  3999. if (vsfx && btv->id >= 878)
  4000. printk(KERN_INFO "bttv%d: enabling VSFX\n",btv->c.nr);
  4001. if (UNSET != latency)
  4002. printk(KERN_INFO "bttv%d: setting pci timer to %d\n",
  4003. btv->c.nr,latency);
  4004. }
  4005. if (btv->id < 878) {
  4006. /* bt848 (mis)uses a bit in the irq mask for etbf */
  4007. if (triton1)
  4008. btv->triton1 = BT848_INT_ETBF;
  4009. } else {
  4010. /* bt878 has a bit in the pci config space for it */
  4011. pci_read_config_byte(btv->c.pci, BT878_DEVCTRL, &command);
  4012. if (triton1)
  4013. command |= BT878_EN_TBFX;
  4014. if (vsfx)
  4015. command |= BT878_EN_VSFX;
  4016. pci_write_config_byte(btv->c.pci, BT878_DEVCTRL, command);
  4017. }
  4018. if (UNSET != latency)
  4019. pci_write_config_byte(btv->c.pci, PCI_LATENCY_TIMER, latency);
  4020. return 0;
  4021. }
  4022. /*
  4023. * Local variables:
  4024. * c-basic-offset: 8
  4025. * End:
  4026. */