bttv-cards.c 129 KB

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