bttv-cards.c 127 KB

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