bttv-cards.c 126 KB

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