patch_sigmatel.c 133 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013
  1. /*
  2. * Universal Interface for Intel High Definition Audio Codec
  3. *
  4. * HD audio interface patch for SigmaTel STAC92xx
  5. *
  6. * Copyright (c) 2005 Embedded Alley Solutions, Inc.
  7. * Matt Porter <mporter@embeddedalley.com>
  8. *
  9. * Based on patch_cmedia.c and patch_realtek.c
  10. * Copyright (c) 2004 Takashi Iwai <tiwai@suse.de>
  11. *
  12. * This driver is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation; either version 2 of the License, or
  15. * (at your option) any later version.
  16. *
  17. * This driver is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program; if not, write to the Free Software
  24. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  25. */
  26. #include <linux/init.h>
  27. #include <linux/delay.h>
  28. #include <linux/slab.h>
  29. #include <linux/pci.h>
  30. #include <linux/dmi.h>
  31. #include <linux/module.h>
  32. #include <sound/core.h>
  33. #include <sound/jack.h>
  34. #include <sound/tlv.h>
  35. #include "hda_codec.h"
  36. #include "hda_local.h"
  37. #include "hda_auto_parser.h"
  38. #include "hda_beep.h"
  39. #include "hda_jack.h"
  40. #include "hda_generic.h"
  41. enum {
  42. STAC_VREF_EVENT = 8,
  43. STAC_PWR_EVENT,
  44. };
  45. enum {
  46. STAC_REF,
  47. STAC_9200_OQO,
  48. STAC_9200_DELL_D21,
  49. STAC_9200_DELL_D22,
  50. STAC_9200_DELL_D23,
  51. STAC_9200_DELL_M21,
  52. STAC_9200_DELL_M22,
  53. STAC_9200_DELL_M23,
  54. STAC_9200_DELL_M24,
  55. STAC_9200_DELL_M25,
  56. STAC_9200_DELL_M26,
  57. STAC_9200_DELL_M27,
  58. STAC_9200_M4,
  59. STAC_9200_M4_2,
  60. STAC_9200_PANASONIC,
  61. STAC_9200_EAPD_INIT,
  62. STAC_9200_MODELS
  63. };
  64. enum {
  65. STAC_9205_REF,
  66. STAC_9205_DELL_M42,
  67. STAC_9205_DELL_M43,
  68. STAC_9205_DELL_M44,
  69. STAC_9205_EAPD,
  70. STAC_9205_MODELS
  71. };
  72. enum {
  73. STAC_92HD73XX_NO_JD, /* no jack-detection */
  74. STAC_92HD73XX_REF,
  75. STAC_92HD73XX_INTEL,
  76. STAC_DELL_M6_AMIC,
  77. STAC_DELL_M6_DMIC,
  78. STAC_DELL_M6_BOTH,
  79. STAC_DELL_EQ,
  80. STAC_ALIENWARE_M17X,
  81. STAC_92HD89XX_HP_FRONT_JACK,
  82. STAC_92HD73XX_MODELS
  83. };
  84. enum {
  85. STAC_92HD83XXX_REF,
  86. STAC_92HD83XXX_PWR_REF,
  87. STAC_DELL_S14,
  88. STAC_DELL_VOSTRO_3500,
  89. STAC_92HD83XXX_HP_cNB11_INTQUAD,
  90. STAC_HP_DV7_4000,
  91. STAC_HP_ZEPHYR,
  92. STAC_92HD83XXX_HP_LED,
  93. STAC_92HD83XXX_HP_INV_LED,
  94. STAC_92HD83XXX_HP_MIC_LED,
  95. STAC_92HD83XXX_HEADSET_JACK,
  96. STAC_92HD83XXX_HP,
  97. STAC_HP_ENVY_BASS,
  98. STAC_HP_BNB13_EQ,
  99. STAC_92HD83XXX_MODELS
  100. };
  101. enum {
  102. STAC_92HD71BXX_REF,
  103. STAC_DELL_M4_1,
  104. STAC_DELL_M4_2,
  105. STAC_DELL_M4_3,
  106. STAC_HP_M4,
  107. STAC_HP_DV4,
  108. STAC_HP_DV5,
  109. STAC_HP_HDX,
  110. STAC_92HD71BXX_HP,
  111. STAC_92HD71BXX_NO_DMIC,
  112. STAC_92HD71BXX_NO_SMUX,
  113. STAC_92HD71BXX_MODELS
  114. };
  115. enum {
  116. STAC_925x_REF,
  117. STAC_M1,
  118. STAC_M1_2,
  119. STAC_M2,
  120. STAC_M2_2,
  121. STAC_M3,
  122. STAC_M5,
  123. STAC_M6,
  124. STAC_925x_MODELS
  125. };
  126. enum {
  127. STAC_D945_REF,
  128. STAC_D945GTP3,
  129. STAC_D945GTP5,
  130. STAC_INTEL_MAC_V1,
  131. STAC_INTEL_MAC_V2,
  132. STAC_INTEL_MAC_V3,
  133. STAC_INTEL_MAC_V4,
  134. STAC_INTEL_MAC_V5,
  135. STAC_INTEL_MAC_AUTO,
  136. STAC_ECS_202,
  137. STAC_922X_DELL_D81,
  138. STAC_922X_DELL_D82,
  139. STAC_922X_DELL_M81,
  140. STAC_922X_DELL_M82,
  141. STAC_922X_INTEL_MAC_GPIO,
  142. STAC_922X_MODELS
  143. };
  144. enum {
  145. STAC_D965_REF_NO_JD, /* no jack-detection */
  146. STAC_D965_REF,
  147. STAC_D965_3ST,
  148. STAC_D965_5ST,
  149. STAC_D965_5ST_NO_FP,
  150. STAC_D965_VERBS,
  151. STAC_DELL_3ST,
  152. STAC_DELL_BIOS,
  153. STAC_DELL_BIOS_AMIC,
  154. STAC_DELL_BIOS_SPDIF,
  155. STAC_927X_DELL_DMIC,
  156. STAC_927X_VOLKNOB,
  157. STAC_927X_MODELS
  158. };
  159. enum {
  160. STAC_9872_VAIO,
  161. STAC_9872_MODELS
  162. };
  163. struct sigmatel_spec {
  164. struct hda_gen_spec gen;
  165. unsigned int eapd_switch: 1;
  166. unsigned int linear_tone_beep:1;
  167. unsigned int headset_jack:1; /* 4-pin headset jack (hp + mono mic) */
  168. unsigned int volknob_init:1; /* special volume-knob initialization */
  169. unsigned int powerdown_adcs:1;
  170. unsigned int have_spdif_mux:1;
  171. /* gpio lines */
  172. unsigned int eapd_mask;
  173. unsigned int gpio_mask;
  174. unsigned int gpio_dir;
  175. unsigned int gpio_data;
  176. unsigned int gpio_mute;
  177. unsigned int gpio_led;
  178. unsigned int gpio_led_polarity;
  179. unsigned int vref_mute_led_nid; /* pin NID for mute-LED vref control */
  180. unsigned int vref_led;
  181. int default_polarity;
  182. unsigned int mic_mute_led_gpio; /* capture mute LED GPIO */
  183. unsigned int mic_enabled; /* current mic mute state (bitmask) */
  184. /* stream */
  185. unsigned int stream_delay;
  186. /* analog loopback */
  187. const struct snd_kcontrol_new *aloopback_ctl;
  188. unsigned int aloopback;
  189. unsigned char aloopback_mask;
  190. unsigned char aloopback_shift;
  191. /* power management */
  192. unsigned int power_map_bits;
  193. unsigned int num_pwrs;
  194. const hda_nid_t *pwr_nids;
  195. unsigned int active_adcs;
  196. /* beep widgets */
  197. hda_nid_t anabeep_nid;
  198. /* SPDIF-out mux */
  199. const char * const *spdif_labels;
  200. struct hda_input_mux spdif_mux;
  201. unsigned int cur_smux[2];
  202. };
  203. #define AC_VERB_IDT_SET_POWER_MAP 0x7ec
  204. #define AC_VERB_IDT_GET_POWER_MAP 0xfec
  205. static const hda_nid_t stac92hd73xx_pwr_nids[8] = {
  206. 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
  207. 0x0f, 0x10, 0x11
  208. };
  209. static const hda_nid_t stac92hd83xxx_pwr_nids[7] = {
  210. 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
  211. 0x0f, 0x10
  212. };
  213. static const hda_nid_t stac92hd71bxx_pwr_nids[3] = {
  214. 0x0a, 0x0d, 0x0f
  215. };
  216. /*
  217. * PCM hooks
  218. */
  219. static void stac_playback_pcm_hook(struct hda_pcm_stream *hinfo,
  220. struct hda_codec *codec,
  221. struct snd_pcm_substream *substream,
  222. int action)
  223. {
  224. struct sigmatel_spec *spec = codec->spec;
  225. if (action == HDA_GEN_PCM_ACT_OPEN && spec->stream_delay)
  226. msleep(spec->stream_delay);
  227. }
  228. static void stac_capture_pcm_hook(struct hda_pcm_stream *hinfo,
  229. struct hda_codec *codec,
  230. struct snd_pcm_substream *substream,
  231. int action)
  232. {
  233. struct sigmatel_spec *spec = codec->spec;
  234. int i, idx = 0;
  235. if (!spec->powerdown_adcs)
  236. return;
  237. for (i = 0; i < spec->gen.num_all_adcs; i++) {
  238. if (spec->gen.all_adcs[i] == hinfo->nid) {
  239. idx = i;
  240. break;
  241. }
  242. }
  243. switch (action) {
  244. case HDA_GEN_PCM_ACT_OPEN:
  245. msleep(40);
  246. snd_hda_codec_write(codec, hinfo->nid, 0,
  247. AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
  248. spec->active_adcs |= (1 << idx);
  249. break;
  250. case HDA_GEN_PCM_ACT_CLOSE:
  251. snd_hda_codec_write(codec, hinfo->nid, 0,
  252. AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
  253. spec->active_adcs &= ~(1 << idx);
  254. break;
  255. }
  256. }
  257. /*
  258. * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
  259. * funky external mute control using GPIO pins.
  260. */
  261. static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,
  262. unsigned int dir_mask, unsigned int data)
  263. {
  264. unsigned int gpiostate, gpiomask, gpiodir;
  265. snd_printdd("%s msk %x dir %x gpio %x\n", __func__, mask, dir_mask, data);
  266. gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
  267. AC_VERB_GET_GPIO_DATA, 0);
  268. gpiostate = (gpiostate & ~dir_mask) | (data & dir_mask);
  269. gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
  270. AC_VERB_GET_GPIO_MASK, 0);
  271. gpiomask |= mask;
  272. gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
  273. AC_VERB_GET_GPIO_DIRECTION, 0);
  274. gpiodir |= dir_mask;
  275. /* Configure GPIOx as CMOS */
  276. snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0);
  277. snd_hda_codec_write(codec, codec->afg, 0,
  278. AC_VERB_SET_GPIO_MASK, gpiomask);
  279. snd_hda_codec_read(codec, codec->afg, 0,
  280. AC_VERB_SET_GPIO_DIRECTION, gpiodir); /* sync */
  281. msleep(1);
  282. snd_hda_codec_read(codec, codec->afg, 0,
  283. AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */
  284. }
  285. /* hook for controlling mic-mute LED GPIO */
  286. static void stac_capture_led_hook(struct hda_codec *codec,
  287. struct snd_kcontrol *kcontrol,
  288. struct snd_ctl_elem_value *ucontrol)
  289. {
  290. struct sigmatel_spec *spec = codec->spec;
  291. unsigned int mask;
  292. bool cur_mute, prev_mute;
  293. if (!kcontrol || !ucontrol)
  294. return;
  295. mask = 1U << snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
  296. prev_mute = !spec->mic_enabled;
  297. if (ucontrol->value.integer.value[0] ||
  298. ucontrol->value.integer.value[1])
  299. spec->mic_enabled |= mask;
  300. else
  301. spec->mic_enabled &= ~mask;
  302. cur_mute = !spec->mic_enabled;
  303. if (cur_mute != prev_mute) {
  304. if (cur_mute)
  305. spec->gpio_data |= spec->mic_mute_led_gpio;
  306. else
  307. spec->gpio_data &= ~spec->mic_mute_led_gpio;
  308. stac_gpio_set(codec, spec->gpio_mask,
  309. spec->gpio_dir, spec->gpio_data);
  310. }
  311. }
  312. static int stac_vrefout_set(struct hda_codec *codec,
  313. hda_nid_t nid, unsigned int new_vref)
  314. {
  315. int error, pinctl;
  316. snd_printdd("%s, nid %x ctl %x\n", __func__, nid, new_vref);
  317. pinctl = snd_hda_codec_read(codec, nid, 0,
  318. AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
  319. if (pinctl < 0)
  320. return pinctl;
  321. pinctl &= 0xff;
  322. pinctl &= ~AC_PINCTL_VREFEN;
  323. pinctl |= (new_vref & AC_PINCTL_VREFEN);
  324. error = snd_hda_set_pin_ctl_cache(codec, nid, pinctl);
  325. if (error < 0)
  326. return error;
  327. return 1;
  328. }
  329. /* prevent codec AFG to D3 state when vref-out pin is used for mute LED */
  330. /* this hook is set in stac_setup_gpio() */
  331. static unsigned int stac_vref_led_power_filter(struct hda_codec *codec,
  332. hda_nid_t nid,
  333. unsigned int power_state)
  334. {
  335. if (nid == codec->afg && power_state == AC_PWRST_D3)
  336. return AC_PWRST_D1;
  337. return snd_hda_gen_path_power_filter(codec, nid, power_state);
  338. }
  339. /* update mute-LED accoring to the master switch */
  340. static void stac_update_led_status(struct hda_codec *codec, int enabled)
  341. {
  342. struct sigmatel_spec *spec = codec->spec;
  343. int muted = !enabled;
  344. if (!spec->gpio_led)
  345. return;
  346. /* LED state is inverted on these systems */
  347. if (spec->gpio_led_polarity)
  348. muted = !muted;
  349. if (!spec->vref_mute_led_nid) {
  350. if (muted)
  351. spec->gpio_data |= spec->gpio_led;
  352. else
  353. spec->gpio_data &= ~spec->gpio_led;
  354. stac_gpio_set(codec, spec->gpio_mask,
  355. spec->gpio_dir, spec->gpio_data);
  356. } else {
  357. spec->vref_led = muted ? AC_PINCTL_VREF_50 : AC_PINCTL_VREF_GRD;
  358. stac_vrefout_set(codec, spec->vref_mute_led_nid,
  359. spec->vref_led);
  360. }
  361. }
  362. /* vmaster hook to update mute LED */
  363. static void stac_vmaster_hook(void *private_data, int val)
  364. {
  365. stac_update_led_status(private_data, val);
  366. }
  367. /* automute hook to handle GPIO mute and EAPD updates */
  368. static void stac_update_outputs(struct hda_codec *codec)
  369. {
  370. struct sigmatel_spec *spec = codec->spec;
  371. if (spec->gpio_mute)
  372. spec->gen.master_mute =
  373. !(snd_hda_codec_read(codec, codec->afg, 0,
  374. AC_VERB_GET_GPIO_DATA, 0) & spec->gpio_mute);
  375. snd_hda_gen_update_outputs(codec);
  376. if (spec->eapd_mask && spec->eapd_switch) {
  377. unsigned int val = spec->gpio_data;
  378. if (spec->gen.speaker_muted)
  379. val &= ~spec->eapd_mask;
  380. else
  381. val |= spec->eapd_mask;
  382. if (spec->gpio_data != val) {
  383. spec->gpio_data = val;
  384. stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir,
  385. val);
  386. }
  387. }
  388. }
  389. static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
  390. bool enable, bool do_write)
  391. {
  392. struct sigmatel_spec *spec = codec->spec;
  393. unsigned int idx, val;
  394. for (idx = 0; idx < spec->num_pwrs; idx++) {
  395. if (spec->pwr_nids[idx] == nid)
  396. break;
  397. }
  398. if (idx >= spec->num_pwrs)
  399. return;
  400. idx = 1 << idx;
  401. val = spec->power_map_bits;
  402. if (enable)
  403. val &= ~idx;
  404. else
  405. val |= idx;
  406. /* power down unused output ports */
  407. if (val != spec->power_map_bits) {
  408. spec->power_map_bits = val;
  409. if (do_write)
  410. snd_hda_codec_write(codec, codec->afg, 0,
  411. AC_VERB_IDT_SET_POWER_MAP, val);
  412. }
  413. }
  414. /* update power bit per jack plug/unplug */
  415. static void jack_update_power(struct hda_codec *codec,
  416. struct hda_jack_tbl *jack)
  417. {
  418. struct sigmatel_spec *spec = codec->spec;
  419. int i;
  420. if (!spec->num_pwrs)
  421. return;
  422. if (jack && jack->nid) {
  423. stac_toggle_power_map(codec, jack->nid,
  424. snd_hda_jack_detect(codec, jack->nid),
  425. true);
  426. return;
  427. }
  428. /* update all jacks */
  429. for (i = 0; i < spec->num_pwrs; i++) {
  430. hda_nid_t nid = spec->pwr_nids[i];
  431. jack = snd_hda_jack_tbl_get(codec, nid);
  432. if (!jack || !jack->action)
  433. continue;
  434. if (jack->action == STAC_PWR_EVENT ||
  435. jack->action <= HDA_GEN_LAST_EVENT)
  436. stac_toggle_power_map(codec, nid,
  437. snd_hda_jack_detect(codec, nid),
  438. false);
  439. }
  440. snd_hda_codec_write(codec, codec->afg, 0, AC_VERB_IDT_SET_POWER_MAP,
  441. spec->power_map_bits);
  442. }
  443. static void stac_hp_automute(struct hda_codec *codec,
  444. struct hda_jack_tbl *jack)
  445. {
  446. snd_hda_gen_hp_automute(codec, jack);
  447. jack_update_power(codec, jack);
  448. }
  449. static void stac_line_automute(struct hda_codec *codec,
  450. struct hda_jack_tbl *jack)
  451. {
  452. snd_hda_gen_line_automute(codec, jack);
  453. jack_update_power(codec, jack);
  454. }
  455. static void stac_mic_autoswitch(struct hda_codec *codec,
  456. struct hda_jack_tbl *jack)
  457. {
  458. snd_hda_gen_mic_autoswitch(codec, jack);
  459. jack_update_power(codec, jack);
  460. }
  461. static void stac_vref_event(struct hda_codec *codec, struct hda_jack_tbl *event)
  462. {
  463. unsigned int data;
  464. data = snd_hda_codec_read(codec, codec->afg, 0,
  465. AC_VERB_GET_GPIO_DATA, 0);
  466. /* toggle VREF state based on GPIOx status */
  467. snd_hda_codec_write(codec, codec->afg, 0, 0x7e0,
  468. !!(data & (1 << event->private_data)));
  469. }
  470. /* initialize the power map and enable the power event to jacks that
  471. * haven't been assigned to automute
  472. */
  473. static void stac_init_power_map(struct hda_codec *codec)
  474. {
  475. struct sigmatel_spec *spec = codec->spec;
  476. int i;
  477. for (i = 0; i < spec->num_pwrs; i++) {
  478. hda_nid_t nid = spec->pwr_nids[i];
  479. unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
  480. def_conf = get_defcfg_connect(def_conf);
  481. if (snd_hda_jack_tbl_get(codec, nid))
  482. continue;
  483. if (def_conf == AC_JACK_PORT_COMPLEX &&
  484. !(spec->vref_mute_led_nid == nid ||
  485. is_jack_detectable(codec, nid))) {
  486. snd_hda_jack_detect_enable_callback(codec, nid,
  487. STAC_PWR_EVENT,
  488. jack_update_power);
  489. } else {
  490. if (def_conf == AC_JACK_PORT_NONE)
  491. stac_toggle_power_map(codec, nid, false, false);
  492. else
  493. stac_toggle_power_map(codec, nid, true, false);
  494. }
  495. }
  496. }
  497. /*
  498. */
  499. static inline bool get_int_hint(struct hda_codec *codec, const char *key,
  500. int *valp)
  501. {
  502. return !snd_hda_get_int_hint(codec, key, valp);
  503. }
  504. /* override some hints from the hwdep entry */
  505. static void stac_store_hints(struct hda_codec *codec)
  506. {
  507. struct sigmatel_spec *spec = codec->spec;
  508. int val;
  509. if (get_int_hint(codec, "gpio_mask", &spec->gpio_mask)) {
  510. spec->eapd_mask = spec->gpio_dir = spec->gpio_data =
  511. spec->gpio_mask;
  512. }
  513. if (get_int_hint(codec, "gpio_dir", &spec->gpio_dir))
  514. spec->gpio_mask &= spec->gpio_mask;
  515. if (get_int_hint(codec, "gpio_data", &spec->gpio_data))
  516. spec->gpio_dir &= spec->gpio_mask;
  517. if (get_int_hint(codec, "eapd_mask", &spec->eapd_mask))
  518. spec->eapd_mask &= spec->gpio_mask;
  519. if (get_int_hint(codec, "gpio_mute", &spec->gpio_mute))
  520. spec->gpio_mute &= spec->gpio_mask;
  521. val = snd_hda_get_bool_hint(codec, "eapd_switch");
  522. if (val >= 0)
  523. spec->eapd_switch = val;
  524. }
  525. /*
  526. * loopback controls
  527. */
  528. #define stac_aloopback_info snd_ctl_boolean_mono_info
  529. static int stac_aloopback_get(struct snd_kcontrol *kcontrol,
  530. struct snd_ctl_elem_value *ucontrol)
  531. {
  532. struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  533. unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
  534. struct sigmatel_spec *spec = codec->spec;
  535. ucontrol->value.integer.value[0] = !!(spec->aloopback &
  536. (spec->aloopback_mask << idx));
  537. return 0;
  538. }
  539. static int stac_aloopback_put(struct snd_kcontrol *kcontrol,
  540. struct snd_ctl_elem_value *ucontrol)
  541. {
  542. struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  543. struct sigmatel_spec *spec = codec->spec;
  544. unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
  545. unsigned int dac_mode;
  546. unsigned int val, idx_val;
  547. idx_val = spec->aloopback_mask << idx;
  548. if (ucontrol->value.integer.value[0])
  549. val = spec->aloopback | idx_val;
  550. else
  551. val = spec->aloopback & ~idx_val;
  552. if (spec->aloopback == val)
  553. return 0;
  554. spec->aloopback = val;
  555. /* Only return the bits defined by the shift value of the
  556. * first two bytes of the mask
  557. */
  558. dac_mode = snd_hda_codec_read(codec, codec->afg, 0,
  559. kcontrol->private_value & 0xFFFF, 0x0);
  560. dac_mode >>= spec->aloopback_shift;
  561. if (spec->aloopback & idx_val) {
  562. snd_hda_power_up(codec);
  563. dac_mode |= idx_val;
  564. } else {
  565. snd_hda_power_down(codec);
  566. dac_mode &= ~idx_val;
  567. }
  568. snd_hda_codec_write_cache(codec, codec->afg, 0,
  569. kcontrol->private_value >> 16, dac_mode);
  570. return 1;
  571. }
  572. #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \
  573. { \
  574. .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
  575. .name = "Analog Loopback", \
  576. .count = cnt, \
  577. .info = stac_aloopback_info, \
  578. .get = stac_aloopback_get, \
  579. .put = stac_aloopback_put, \
  580. .private_value = verb_read | (verb_write << 16), \
  581. }
  582. /*
  583. * Mute LED handling on HP laptops
  584. */
  585. /* check whether it's a HP laptop with a docking port */
  586. static bool hp_bnb2011_with_dock(struct hda_codec *codec)
  587. {
  588. if (codec->vendor_id != 0x111d7605 &&
  589. codec->vendor_id != 0x111d76d1)
  590. return false;
  591. switch (codec->subsystem_id) {
  592. case 0x103c1618:
  593. case 0x103c1619:
  594. case 0x103c161a:
  595. case 0x103c161b:
  596. case 0x103c161c:
  597. case 0x103c161d:
  598. case 0x103c161e:
  599. case 0x103c161f:
  600. case 0x103c162a:
  601. case 0x103c162b:
  602. case 0x103c1630:
  603. case 0x103c1631:
  604. case 0x103c1633:
  605. case 0x103c1634:
  606. case 0x103c1635:
  607. case 0x103c3587:
  608. case 0x103c3588:
  609. case 0x103c3589:
  610. case 0x103c358a:
  611. case 0x103c3667:
  612. case 0x103c3668:
  613. case 0x103c3669:
  614. return true;
  615. }
  616. return false;
  617. }
  618. static bool hp_blike_system(u32 subsystem_id)
  619. {
  620. switch (subsystem_id) {
  621. case 0x103c1520:
  622. case 0x103c1521:
  623. case 0x103c1523:
  624. case 0x103c1524:
  625. case 0x103c1525:
  626. case 0x103c1722:
  627. case 0x103c1723:
  628. case 0x103c1724:
  629. case 0x103c1725:
  630. case 0x103c1726:
  631. case 0x103c1727:
  632. case 0x103c1728:
  633. case 0x103c1729:
  634. case 0x103c172a:
  635. case 0x103c172b:
  636. case 0x103c307e:
  637. case 0x103c307f:
  638. case 0x103c3080:
  639. case 0x103c3081:
  640. case 0x103c7007:
  641. case 0x103c7008:
  642. return true;
  643. }
  644. return false;
  645. }
  646. static void set_hp_led_gpio(struct hda_codec *codec)
  647. {
  648. struct sigmatel_spec *spec = codec->spec;
  649. unsigned int gpio;
  650. if (spec->gpio_led)
  651. return;
  652. gpio = snd_hda_param_read(codec, codec->afg, AC_PAR_GPIO_CAP);
  653. gpio &= AC_GPIO_IO_COUNT;
  654. if (gpio > 3)
  655. spec->gpio_led = 0x08; /* GPIO 3 */
  656. else
  657. spec->gpio_led = 0x01; /* GPIO 0 */
  658. }
  659. /*
  660. * This method searches for the mute LED GPIO configuration
  661. * provided as OEM string in SMBIOS. The format of that string
  662. * is HP_Mute_LED_P_G or HP_Mute_LED_P
  663. * where P can be 0 or 1 and defines mute LED GPIO control state (low/high)
  664. * that corresponds to the NOT muted state of the master volume
  665. * and G is the index of the GPIO to use as the mute LED control (0..9)
  666. * If _G portion is missing it is assigned based on the codec ID
  667. *
  668. * So, HP B-series like systems may have HP_Mute_LED_0 (current models)
  669. * or HP_Mute_LED_0_3 (future models) OEM SMBIOS strings
  670. *
  671. *
  672. * The dv-series laptops don't seem to have the HP_Mute_LED* strings in
  673. * SMBIOS - at least the ones I have seen do not have them - which include
  674. * my own system (HP Pavilion dv6-1110ax) and my cousin's
  675. * HP Pavilion dv9500t CTO.
  676. * Need more information on whether it is true across the entire series.
  677. * -- kunal
  678. */
  679. static int find_mute_led_cfg(struct hda_codec *codec, int default_polarity)
  680. {
  681. struct sigmatel_spec *spec = codec->spec;
  682. const struct dmi_device *dev = NULL;
  683. if (get_int_hint(codec, "gpio_led", &spec->gpio_led)) {
  684. get_int_hint(codec, "gpio_led_polarity",
  685. &spec->gpio_led_polarity);
  686. return 1;
  687. }
  688. while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
  689. if (sscanf(dev->name, "HP_Mute_LED_%d_%x",
  690. &spec->gpio_led_polarity,
  691. &spec->gpio_led) == 2) {
  692. unsigned int max_gpio;
  693. max_gpio = snd_hda_param_read(codec, codec->afg,
  694. AC_PAR_GPIO_CAP);
  695. max_gpio &= AC_GPIO_IO_COUNT;
  696. if (spec->gpio_led < max_gpio)
  697. spec->gpio_led = 1 << spec->gpio_led;
  698. else
  699. spec->vref_mute_led_nid = spec->gpio_led;
  700. return 1;
  701. }
  702. if (sscanf(dev->name, "HP_Mute_LED_%d",
  703. &spec->gpio_led_polarity) == 1) {
  704. set_hp_led_gpio(codec);
  705. return 1;
  706. }
  707. /* BIOS bug: unfilled OEM string */
  708. if (strstr(dev->name, "HP_Mute_LED_P_G")) {
  709. set_hp_led_gpio(codec);
  710. if (default_polarity >= 0)
  711. spec->gpio_led_polarity = default_polarity;
  712. else
  713. spec->gpio_led_polarity = 1;
  714. return 1;
  715. }
  716. }
  717. /*
  718. * Fallback case - if we don't find the DMI strings,
  719. * we statically set the GPIO - if not a B-series system
  720. * and default polarity is provided
  721. */
  722. if (!hp_blike_system(codec->subsystem_id) &&
  723. (default_polarity == 0 || default_polarity == 1)) {
  724. set_hp_led_gpio(codec);
  725. spec->gpio_led_polarity = default_polarity;
  726. return 1;
  727. }
  728. return 0;
  729. }
  730. /* check whether a built-in speaker is included in parsed pins */
  731. static bool has_builtin_speaker(struct hda_codec *codec)
  732. {
  733. struct sigmatel_spec *spec = codec->spec;
  734. hda_nid_t *nid_pin;
  735. int nids, i;
  736. if (spec->gen.autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) {
  737. nid_pin = spec->gen.autocfg.line_out_pins;
  738. nids = spec->gen.autocfg.line_outs;
  739. } else {
  740. nid_pin = spec->gen.autocfg.speaker_pins;
  741. nids = spec->gen.autocfg.speaker_outs;
  742. }
  743. for (i = 0; i < nids; i++) {
  744. unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid_pin[i]);
  745. if (snd_hda_get_input_pin_attr(def_conf) == INPUT_PIN_ATTR_INT)
  746. return true;
  747. }
  748. return false;
  749. }
  750. /*
  751. * PC beep controls
  752. */
  753. /* create PC beep volume controls */
  754. static int stac_auto_create_beep_ctls(struct hda_codec *codec,
  755. hda_nid_t nid)
  756. {
  757. struct sigmatel_spec *spec = codec->spec;
  758. u32 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
  759. struct snd_kcontrol_new *knew;
  760. static struct snd_kcontrol_new abeep_mute_ctl =
  761. HDA_CODEC_MUTE(NULL, 0, 0, 0);
  762. static struct snd_kcontrol_new dbeep_mute_ctl =
  763. HDA_CODEC_MUTE_BEEP(NULL, 0, 0, 0);
  764. static struct snd_kcontrol_new beep_vol_ctl =
  765. HDA_CODEC_VOLUME(NULL, 0, 0, 0);
  766. /* check for mute support for the the amp */
  767. if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) {
  768. const struct snd_kcontrol_new *temp;
  769. if (spec->anabeep_nid == nid)
  770. temp = &abeep_mute_ctl;
  771. else
  772. temp = &dbeep_mute_ctl;
  773. knew = snd_hda_gen_add_kctl(&spec->gen,
  774. "Beep Playback Switch", temp);
  775. if (!knew)
  776. return -ENOMEM;
  777. knew->private_value =
  778. HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT);
  779. }
  780. /* check to see if there is volume support for the amp */
  781. if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) {
  782. knew = snd_hda_gen_add_kctl(&spec->gen,
  783. "Beep Playback Volume",
  784. &beep_vol_ctl);
  785. if (!knew)
  786. return -ENOMEM;
  787. knew->private_value =
  788. HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT);
  789. }
  790. return 0;
  791. }
  792. #ifdef CONFIG_SND_HDA_INPUT_BEEP
  793. #define stac_dig_beep_switch_info snd_ctl_boolean_mono_info
  794. static int stac_dig_beep_switch_get(struct snd_kcontrol *kcontrol,
  795. struct snd_ctl_elem_value *ucontrol)
  796. {
  797. struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  798. ucontrol->value.integer.value[0] = codec->beep->enabled;
  799. return 0;
  800. }
  801. static int stac_dig_beep_switch_put(struct snd_kcontrol *kcontrol,
  802. struct snd_ctl_elem_value *ucontrol)
  803. {
  804. struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  805. return snd_hda_enable_beep_device(codec, ucontrol->value.integer.value[0]);
  806. }
  807. static const struct snd_kcontrol_new stac_dig_beep_ctrl = {
  808. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  809. .name = "Beep Playback Switch",
  810. .info = stac_dig_beep_switch_info,
  811. .get = stac_dig_beep_switch_get,
  812. .put = stac_dig_beep_switch_put,
  813. };
  814. static int stac_beep_switch_ctl(struct hda_codec *codec)
  815. {
  816. struct sigmatel_spec *spec = codec->spec;
  817. if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &stac_dig_beep_ctrl))
  818. return -ENOMEM;
  819. return 0;
  820. }
  821. #endif
  822. /*
  823. * SPDIF-out mux controls
  824. */
  825. static int stac_smux_enum_info(struct snd_kcontrol *kcontrol,
  826. struct snd_ctl_elem_info *uinfo)
  827. {
  828. struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  829. struct sigmatel_spec *spec = codec->spec;
  830. return snd_hda_input_mux_info(&spec->spdif_mux, uinfo);
  831. }
  832. static int stac_smux_enum_get(struct snd_kcontrol *kcontrol,
  833. struct snd_ctl_elem_value *ucontrol)
  834. {
  835. struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  836. struct sigmatel_spec *spec = codec->spec;
  837. unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
  838. ucontrol->value.enumerated.item[0] = spec->cur_smux[smux_idx];
  839. return 0;
  840. }
  841. static int stac_smux_enum_put(struct snd_kcontrol *kcontrol,
  842. struct snd_ctl_elem_value *ucontrol)
  843. {
  844. struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  845. struct sigmatel_spec *spec = codec->spec;
  846. unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
  847. return snd_hda_input_mux_put(codec, &spec->spdif_mux, ucontrol,
  848. spec->gen.autocfg.dig_out_pins[smux_idx],
  849. &spec->cur_smux[smux_idx]);
  850. }
  851. static struct snd_kcontrol_new stac_smux_mixer = {
  852. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  853. .name = "IEC958 Playback Source",
  854. /* count set later */
  855. .info = stac_smux_enum_info,
  856. .get = stac_smux_enum_get,
  857. .put = stac_smux_enum_put,
  858. };
  859. static const char * const stac_spdif_labels[] = {
  860. "Digital Playback", "Analog Mux 1", "Analog Mux 2", NULL
  861. };
  862. static int stac_create_spdif_mux_ctls(struct hda_codec *codec)
  863. {
  864. struct sigmatel_spec *spec = codec->spec;
  865. struct auto_pin_cfg *cfg = &spec->gen.autocfg;
  866. const char * const *labels = spec->spdif_labels;
  867. struct snd_kcontrol_new *kctl;
  868. int i, num_cons;
  869. if (cfg->dig_outs < 1)
  870. return 0;
  871. num_cons = snd_hda_get_num_conns(codec, cfg->dig_out_pins[0]);
  872. if (num_cons <= 1)
  873. return 0;
  874. if (!labels)
  875. labels = stac_spdif_labels;
  876. for (i = 0; i < num_cons; i++) {
  877. if (snd_BUG_ON(!labels[i]))
  878. return -EINVAL;
  879. snd_hda_add_imux_item(&spec->spdif_mux, labels[i], i, NULL);
  880. }
  881. kctl = snd_hda_gen_add_kctl(&spec->gen, NULL, &stac_smux_mixer);
  882. if (!kctl)
  883. return -ENOMEM;
  884. kctl->count = cfg->dig_outs;
  885. return 0;
  886. }
  887. /*
  888. */
  889. static const struct hda_verb stac9200_core_init[] = {
  890. /* set dac0mux for dac converter */
  891. { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
  892. {}
  893. };
  894. static const struct hda_verb stac9200_eapd_init[] = {
  895. /* set dac0mux for dac converter */
  896. {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
  897. {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
  898. {}
  899. };
  900. static const struct hda_verb dell_eq_core_init[] = {
  901. /* set master volume to max value without distortion
  902. * and direct control */
  903. { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec},
  904. {}
  905. };
  906. static const struct hda_verb stac92hd73xx_core_init[] = {
  907. /* set master volume and direct control */
  908. { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
  909. {}
  910. };
  911. static const struct hda_verb stac92hd83xxx_core_init[] = {
  912. /* power state controls amps */
  913. { 0x01, AC_VERB_SET_EAPD, 1 << 2},
  914. {}
  915. };
  916. static const struct hda_verb stac92hd83xxx_hp_zephyr_init[] = {
  917. { 0x22, 0x785, 0x43 },
  918. { 0x22, 0x782, 0xe0 },
  919. { 0x22, 0x795, 0x00 },
  920. {}
  921. };
  922. static const struct hda_verb stac92hd71bxx_core_init[] = {
  923. /* set master volume and direct control */
  924. { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
  925. {}
  926. };
  927. static const struct hda_verb stac92hd71bxx_unmute_core_init[] = {
  928. /* unmute right and left channels for nodes 0x0f, 0xa, 0x0d */
  929. { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  930. { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  931. { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  932. {}
  933. };
  934. static const struct hda_verb stac925x_core_init[] = {
  935. /* set dac0mux for dac converter */
  936. { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00},
  937. /* mute the master volume */
  938. { 0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
  939. {}
  940. };
  941. static const struct hda_verb stac922x_core_init[] = {
  942. /* set master volume and direct control */
  943. { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
  944. {}
  945. };
  946. static const struct hda_verb d965_core_init[] = {
  947. /* unmute node 0x1b */
  948. { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
  949. /* select node 0x03 as DAC */
  950. { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
  951. {}
  952. };
  953. static const struct hda_verb dell_3st_core_init[] = {
  954. /* don't set delta bit */
  955. {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f},
  956. /* unmute node 0x1b */
  957. {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
  958. /* select node 0x03 as DAC */
  959. {0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
  960. {}
  961. };
  962. static const struct hda_verb stac927x_core_init[] = {
  963. /* set master volume and direct control */
  964. { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
  965. /* enable analog pc beep path */
  966. { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
  967. {}
  968. };
  969. static const struct hda_verb stac927x_volknob_core_init[] = {
  970. /* don't set delta bit */
  971. {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f},
  972. /* enable analog pc beep path */
  973. {0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
  974. {}
  975. };
  976. static const struct hda_verb stac9205_core_init[] = {
  977. /* set master volume and direct control */
  978. { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
  979. /* enable analog pc beep path */
  980. { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
  981. {}
  982. };
  983. static const struct snd_kcontrol_new stac92hd73xx_6ch_loopback =
  984. STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3);
  985. static const struct snd_kcontrol_new stac92hd73xx_8ch_loopback =
  986. STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4);
  987. static const struct snd_kcontrol_new stac92hd73xx_10ch_loopback =
  988. STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5);
  989. static const struct snd_kcontrol_new stac92hd71bxx_loopback =
  990. STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2);
  991. static const struct snd_kcontrol_new stac9205_loopback =
  992. STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1);
  993. static const struct snd_kcontrol_new stac927x_loopback =
  994. STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1);
  995. static const struct hda_pintbl ref9200_pin_configs[] = {
  996. { 0x08, 0x01c47010 },
  997. { 0x09, 0x01447010 },
  998. { 0x0d, 0x0221401f },
  999. { 0x0e, 0x01114010 },
  1000. { 0x0f, 0x02a19020 },
  1001. { 0x10, 0x01a19021 },
  1002. { 0x11, 0x90100140 },
  1003. { 0x12, 0x01813122 },
  1004. {}
  1005. };
  1006. static const struct hda_pintbl gateway9200_m4_pin_configs[] = {
  1007. { 0x08, 0x400000fe },
  1008. { 0x09, 0x404500f4 },
  1009. { 0x0d, 0x400100f0 },
  1010. { 0x0e, 0x90110010 },
  1011. { 0x0f, 0x400100f1 },
  1012. { 0x10, 0x02a1902e },
  1013. { 0x11, 0x500000f2 },
  1014. { 0x12, 0x500000f3 },
  1015. {}
  1016. };
  1017. static const struct hda_pintbl gateway9200_m4_2_pin_configs[] = {
  1018. { 0x08, 0x400000fe },
  1019. { 0x09, 0x404500f4 },
  1020. { 0x0d, 0x400100f0 },
  1021. { 0x0e, 0x90110010 },
  1022. { 0x0f, 0x400100f1 },
  1023. { 0x10, 0x02a1902e },
  1024. { 0x11, 0x500000f2 },
  1025. { 0x12, 0x500000f3 },
  1026. {}
  1027. };
  1028. /*
  1029. STAC 9200 pin configs for
  1030. 102801A8
  1031. 102801DE
  1032. 102801E8
  1033. */
  1034. static const struct hda_pintbl dell9200_d21_pin_configs[] = {
  1035. { 0x08, 0x400001f0 },
  1036. { 0x09, 0x400001f1 },
  1037. { 0x0d, 0x02214030 },
  1038. { 0x0e, 0x01014010 },
  1039. { 0x0f, 0x02a19020 },
  1040. { 0x10, 0x01a19021 },
  1041. { 0x11, 0x90100140 },
  1042. { 0x12, 0x01813122 },
  1043. {}
  1044. };
  1045. /*
  1046. STAC 9200 pin configs for
  1047. 102801C0
  1048. 102801C1
  1049. */
  1050. static const struct hda_pintbl dell9200_d22_pin_configs[] = {
  1051. { 0x08, 0x400001f0 },
  1052. { 0x09, 0x400001f1 },
  1053. { 0x0d, 0x0221401f },
  1054. { 0x0e, 0x01014010 },
  1055. { 0x0f, 0x01813020 },
  1056. { 0x10, 0x02a19021 },
  1057. { 0x11, 0x90100140 },
  1058. { 0x12, 0x400001f2 },
  1059. {}
  1060. };
  1061. /*
  1062. STAC 9200 pin configs for
  1063. 102801C4 (Dell Dimension E310)
  1064. 102801C5
  1065. 102801C7
  1066. 102801D9
  1067. 102801DA
  1068. 102801E3
  1069. */
  1070. static const struct hda_pintbl dell9200_d23_pin_configs[] = {
  1071. { 0x08, 0x400001f0 },
  1072. { 0x09, 0x400001f1 },
  1073. { 0x0d, 0x0221401f },
  1074. { 0x0e, 0x01014010 },
  1075. { 0x0f, 0x01813020 },
  1076. { 0x10, 0x01a19021 },
  1077. { 0x11, 0x90100140 },
  1078. { 0x12, 0x400001f2 },
  1079. {}
  1080. };
  1081. /*
  1082. STAC 9200-32 pin configs for
  1083. 102801B5 (Dell Inspiron 630m)
  1084. 102801D8 (Dell Inspiron 640m)
  1085. */
  1086. static const struct hda_pintbl dell9200_m21_pin_configs[] = {
  1087. { 0x08, 0x40c003fa },
  1088. { 0x09, 0x03441340 },
  1089. { 0x0d, 0x0321121f },
  1090. { 0x0e, 0x90170310 },
  1091. { 0x0f, 0x408003fb },
  1092. { 0x10, 0x03a11020 },
  1093. { 0x11, 0x401003fc },
  1094. { 0x12, 0x403003fd },
  1095. {}
  1096. };
  1097. /*
  1098. STAC 9200-32 pin configs for
  1099. 102801C2 (Dell Latitude D620)
  1100. 102801C8
  1101. 102801CC (Dell Latitude D820)
  1102. 102801D4
  1103. 102801D6
  1104. */
  1105. static const struct hda_pintbl dell9200_m22_pin_configs[] = {
  1106. { 0x08, 0x40c003fa },
  1107. { 0x09, 0x0144131f },
  1108. { 0x0d, 0x0321121f },
  1109. { 0x0e, 0x90170310 },
  1110. { 0x0f, 0x90a70321 },
  1111. { 0x10, 0x03a11020 },
  1112. { 0x11, 0x401003fb },
  1113. { 0x12, 0x40f000fc },
  1114. {}
  1115. };
  1116. /*
  1117. STAC 9200-32 pin configs for
  1118. 102801CE (Dell XPS M1710)
  1119. 102801CF (Dell Precision M90)
  1120. */
  1121. static const struct hda_pintbl dell9200_m23_pin_configs[] = {
  1122. { 0x08, 0x40c003fa },
  1123. { 0x09, 0x01441340 },
  1124. { 0x0d, 0x0421421f },
  1125. { 0x0e, 0x90170310 },
  1126. { 0x0f, 0x408003fb },
  1127. { 0x10, 0x04a1102e },
  1128. { 0x11, 0x90170311 },
  1129. { 0x12, 0x403003fc },
  1130. {}
  1131. };
  1132. /*
  1133. STAC 9200-32 pin configs for
  1134. 102801C9
  1135. 102801CA
  1136. 102801CB (Dell Latitude 120L)
  1137. 102801D3
  1138. */
  1139. static const struct hda_pintbl dell9200_m24_pin_configs[] = {
  1140. { 0x08, 0x40c003fa },
  1141. { 0x09, 0x404003fb },
  1142. { 0x0d, 0x0321121f },
  1143. { 0x0e, 0x90170310 },
  1144. { 0x0f, 0x408003fc },
  1145. { 0x10, 0x03a11020 },
  1146. { 0x11, 0x401003fd },
  1147. { 0x12, 0x403003fe },
  1148. {}
  1149. };
  1150. /*
  1151. STAC 9200-32 pin configs for
  1152. 102801BD (Dell Inspiron E1505n)
  1153. 102801EE
  1154. 102801EF
  1155. */
  1156. static const struct hda_pintbl dell9200_m25_pin_configs[] = {
  1157. { 0x08, 0x40c003fa },
  1158. { 0x09, 0x01441340 },
  1159. { 0x0d, 0x0421121f },
  1160. { 0x0e, 0x90170310 },
  1161. { 0x0f, 0x408003fb },
  1162. { 0x10, 0x04a11020 },
  1163. { 0x11, 0x401003fc },
  1164. { 0x12, 0x403003fd },
  1165. {}
  1166. };
  1167. /*
  1168. STAC 9200-32 pin configs for
  1169. 102801F5 (Dell Inspiron 1501)
  1170. 102801F6
  1171. */
  1172. static const struct hda_pintbl dell9200_m26_pin_configs[] = {
  1173. { 0x08, 0x40c003fa },
  1174. { 0x09, 0x404003fb },
  1175. { 0x0d, 0x0421121f },
  1176. { 0x0e, 0x90170310 },
  1177. { 0x0f, 0x408003fc },
  1178. { 0x10, 0x04a11020 },
  1179. { 0x11, 0x401003fd },
  1180. { 0x12, 0x403003fe },
  1181. {}
  1182. };
  1183. /*
  1184. STAC 9200-32
  1185. 102801CD (Dell Inspiron E1705/9400)
  1186. */
  1187. static const struct hda_pintbl dell9200_m27_pin_configs[] = {
  1188. { 0x08, 0x40c003fa },
  1189. { 0x09, 0x01441340 },
  1190. { 0x0d, 0x0421121f },
  1191. { 0x0e, 0x90170310 },
  1192. { 0x0f, 0x90170310 },
  1193. { 0x10, 0x04a11020 },
  1194. { 0x11, 0x90170310 },
  1195. { 0x12, 0x40f003fc },
  1196. {}
  1197. };
  1198. static const struct hda_pintbl oqo9200_pin_configs[] = {
  1199. { 0x08, 0x40c000f0 },
  1200. { 0x09, 0x404000f1 },
  1201. { 0x0d, 0x0221121f },
  1202. { 0x0e, 0x02211210 },
  1203. { 0x0f, 0x90170111 },
  1204. { 0x10, 0x90a70120 },
  1205. { 0x11, 0x400000f2 },
  1206. { 0x12, 0x400000f3 },
  1207. {}
  1208. };
  1209. static void stac9200_fixup_panasonic(struct hda_codec *codec,
  1210. const struct hda_fixup *fix, int action)
  1211. {
  1212. struct sigmatel_spec *spec = codec->spec;
  1213. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  1214. spec->gpio_mask = spec->gpio_dir = 0x09;
  1215. spec->gpio_data = 0x00;
  1216. /* CF-74 has no headphone detection, and the driver should *NOT*
  1217. * do detection and HP/speaker toggle because the hardware does it.
  1218. */
  1219. spec->gen.suppress_auto_mute = 1;
  1220. }
  1221. }
  1222. static const struct hda_fixup stac9200_fixups[] = {
  1223. [STAC_REF] = {
  1224. .type = HDA_FIXUP_PINS,
  1225. .v.pins = ref9200_pin_configs,
  1226. },
  1227. [STAC_9200_OQO] = {
  1228. .type = HDA_FIXUP_PINS,
  1229. .v.pins = oqo9200_pin_configs,
  1230. .chained = true,
  1231. .chain_id = STAC_9200_EAPD_INIT,
  1232. },
  1233. [STAC_9200_DELL_D21] = {
  1234. .type = HDA_FIXUP_PINS,
  1235. .v.pins = dell9200_d21_pin_configs,
  1236. },
  1237. [STAC_9200_DELL_D22] = {
  1238. .type = HDA_FIXUP_PINS,
  1239. .v.pins = dell9200_d22_pin_configs,
  1240. },
  1241. [STAC_9200_DELL_D23] = {
  1242. .type = HDA_FIXUP_PINS,
  1243. .v.pins = dell9200_d23_pin_configs,
  1244. },
  1245. [STAC_9200_DELL_M21] = {
  1246. .type = HDA_FIXUP_PINS,
  1247. .v.pins = dell9200_m21_pin_configs,
  1248. },
  1249. [STAC_9200_DELL_M22] = {
  1250. .type = HDA_FIXUP_PINS,
  1251. .v.pins = dell9200_m22_pin_configs,
  1252. },
  1253. [STAC_9200_DELL_M23] = {
  1254. .type = HDA_FIXUP_PINS,
  1255. .v.pins = dell9200_m23_pin_configs,
  1256. },
  1257. [STAC_9200_DELL_M24] = {
  1258. .type = HDA_FIXUP_PINS,
  1259. .v.pins = dell9200_m24_pin_configs,
  1260. },
  1261. [STAC_9200_DELL_M25] = {
  1262. .type = HDA_FIXUP_PINS,
  1263. .v.pins = dell9200_m25_pin_configs,
  1264. },
  1265. [STAC_9200_DELL_M26] = {
  1266. .type = HDA_FIXUP_PINS,
  1267. .v.pins = dell9200_m26_pin_configs,
  1268. },
  1269. [STAC_9200_DELL_M27] = {
  1270. .type = HDA_FIXUP_PINS,
  1271. .v.pins = dell9200_m27_pin_configs,
  1272. },
  1273. [STAC_9200_M4] = {
  1274. .type = HDA_FIXUP_PINS,
  1275. .v.pins = gateway9200_m4_pin_configs,
  1276. .chained = true,
  1277. .chain_id = STAC_9200_EAPD_INIT,
  1278. },
  1279. [STAC_9200_M4_2] = {
  1280. .type = HDA_FIXUP_PINS,
  1281. .v.pins = gateway9200_m4_2_pin_configs,
  1282. .chained = true,
  1283. .chain_id = STAC_9200_EAPD_INIT,
  1284. },
  1285. [STAC_9200_PANASONIC] = {
  1286. .type = HDA_FIXUP_FUNC,
  1287. .v.func = stac9200_fixup_panasonic,
  1288. },
  1289. [STAC_9200_EAPD_INIT] = {
  1290. .type = HDA_FIXUP_VERBS,
  1291. .v.verbs = (const struct hda_verb[]) {
  1292. {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
  1293. {}
  1294. },
  1295. },
  1296. };
  1297. static const struct hda_model_fixup stac9200_models[] = {
  1298. { .id = STAC_REF, .name = "ref" },
  1299. { .id = STAC_9200_OQO, .name = "oqo" },
  1300. { .id = STAC_9200_DELL_D21, .name = "dell-d21" },
  1301. { .id = STAC_9200_DELL_D22, .name = "dell-d22" },
  1302. { .id = STAC_9200_DELL_D23, .name = "dell-d23" },
  1303. { .id = STAC_9200_DELL_M21, .name = "dell-m21" },
  1304. { .id = STAC_9200_DELL_M22, .name = "dell-m22" },
  1305. { .id = STAC_9200_DELL_M23, .name = "dell-m23" },
  1306. { .id = STAC_9200_DELL_M24, .name = "dell-m24" },
  1307. { .id = STAC_9200_DELL_M25, .name = "dell-m25" },
  1308. { .id = STAC_9200_DELL_M26, .name = "dell-m26" },
  1309. { .id = STAC_9200_DELL_M27, .name = "dell-m27" },
  1310. { .id = STAC_9200_M4, .name = "gateway-m4" },
  1311. { .id = STAC_9200_M4_2, .name = "gateway-m4-2" },
  1312. { .id = STAC_9200_PANASONIC, .name = "panasonic" },
  1313. {}
  1314. };
  1315. static const struct snd_pci_quirk stac9200_fixup_tbl[] = {
  1316. /* SigmaTel reference board */
  1317. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
  1318. "DFI LanParty", STAC_REF),
  1319. SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
  1320. "DFI LanParty", STAC_REF),
  1321. /* Dell laptops have BIOS problem */
  1322. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8,
  1323. "unknown Dell", STAC_9200_DELL_D21),
  1324. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5,
  1325. "Dell Inspiron 630m", STAC_9200_DELL_M21),
  1326. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd,
  1327. "Dell Inspiron E1505n", STAC_9200_DELL_M25),
  1328. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0,
  1329. "unknown Dell", STAC_9200_DELL_D22),
  1330. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1,
  1331. "unknown Dell", STAC_9200_DELL_D22),
  1332. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2,
  1333. "Dell Latitude D620", STAC_9200_DELL_M22),
  1334. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5,
  1335. "unknown Dell", STAC_9200_DELL_D23),
  1336. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7,
  1337. "unknown Dell", STAC_9200_DELL_D23),
  1338. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8,
  1339. "unknown Dell", STAC_9200_DELL_M22),
  1340. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9,
  1341. "unknown Dell", STAC_9200_DELL_M24),
  1342. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca,
  1343. "unknown Dell", STAC_9200_DELL_M24),
  1344. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb,
  1345. "Dell Latitude 120L", STAC_9200_DELL_M24),
  1346. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc,
  1347. "Dell Latitude D820", STAC_9200_DELL_M22),
  1348. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd,
  1349. "Dell Inspiron E1705/9400", STAC_9200_DELL_M27),
  1350. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce,
  1351. "Dell XPS M1710", STAC_9200_DELL_M23),
  1352. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf,
  1353. "Dell Precision M90", STAC_9200_DELL_M23),
  1354. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3,
  1355. "unknown Dell", STAC_9200_DELL_M22),
  1356. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4,
  1357. "unknown Dell", STAC_9200_DELL_M22),
  1358. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6,
  1359. "unknown Dell", STAC_9200_DELL_M22),
  1360. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8,
  1361. "Dell Inspiron 640m", STAC_9200_DELL_M21),
  1362. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9,
  1363. "unknown Dell", STAC_9200_DELL_D23),
  1364. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da,
  1365. "unknown Dell", STAC_9200_DELL_D23),
  1366. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de,
  1367. "unknown Dell", STAC_9200_DELL_D21),
  1368. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3,
  1369. "unknown Dell", STAC_9200_DELL_D23),
  1370. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8,
  1371. "unknown Dell", STAC_9200_DELL_D21),
  1372. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee,
  1373. "unknown Dell", STAC_9200_DELL_M25),
  1374. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef,
  1375. "unknown Dell", STAC_9200_DELL_M25),
  1376. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5,
  1377. "Dell Inspiron 1501", STAC_9200_DELL_M26),
  1378. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6,
  1379. "unknown Dell", STAC_9200_DELL_M26),
  1380. /* Panasonic */
  1381. SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC),
  1382. /* Gateway machines needs EAPD to be set on resume */
  1383. SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_M4),
  1384. SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", STAC_9200_M4_2),
  1385. SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", STAC_9200_M4_2),
  1386. /* OQO Mobile */
  1387. SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO),
  1388. {} /* terminator */
  1389. };
  1390. static const struct hda_pintbl ref925x_pin_configs[] = {
  1391. { 0x07, 0x40c003f0 },
  1392. { 0x08, 0x424503f2 },
  1393. { 0x0a, 0x01813022 },
  1394. { 0x0b, 0x02a19021 },
  1395. { 0x0c, 0x90a70320 },
  1396. { 0x0d, 0x02214210 },
  1397. { 0x10, 0x01019020 },
  1398. { 0x11, 0x9033032e },
  1399. {}
  1400. };
  1401. static const struct hda_pintbl stac925xM1_pin_configs[] = {
  1402. { 0x07, 0x40c003f4 },
  1403. { 0x08, 0x424503f2 },
  1404. { 0x0a, 0x400000f3 },
  1405. { 0x0b, 0x02a19020 },
  1406. { 0x0c, 0x40a000f0 },
  1407. { 0x0d, 0x90100210 },
  1408. { 0x10, 0x400003f1 },
  1409. { 0x11, 0x9033032e },
  1410. {}
  1411. };
  1412. static const struct hda_pintbl stac925xM1_2_pin_configs[] = {
  1413. { 0x07, 0x40c003f4 },
  1414. { 0x08, 0x424503f2 },
  1415. { 0x0a, 0x400000f3 },
  1416. { 0x0b, 0x02a19020 },
  1417. { 0x0c, 0x40a000f0 },
  1418. { 0x0d, 0x90100210 },
  1419. { 0x10, 0x400003f1 },
  1420. { 0x11, 0x9033032e },
  1421. {}
  1422. };
  1423. static const struct hda_pintbl stac925xM2_pin_configs[] = {
  1424. { 0x07, 0x40c003f4 },
  1425. { 0x08, 0x424503f2 },
  1426. { 0x0a, 0x400000f3 },
  1427. { 0x0b, 0x02a19020 },
  1428. { 0x0c, 0x40a000f0 },
  1429. { 0x0d, 0x90100210 },
  1430. { 0x10, 0x400003f1 },
  1431. { 0x11, 0x9033032e },
  1432. {}
  1433. };
  1434. static const struct hda_pintbl stac925xM2_2_pin_configs[] = {
  1435. { 0x07, 0x40c003f4 },
  1436. { 0x08, 0x424503f2 },
  1437. { 0x0a, 0x400000f3 },
  1438. { 0x0b, 0x02a19020 },
  1439. { 0x0c, 0x40a000f0 },
  1440. { 0x0d, 0x90100210 },
  1441. { 0x10, 0x400003f1 },
  1442. { 0x11, 0x9033032e },
  1443. {}
  1444. };
  1445. static const struct hda_pintbl stac925xM3_pin_configs[] = {
  1446. { 0x07, 0x40c003f4 },
  1447. { 0x08, 0x424503f2 },
  1448. { 0x0a, 0x400000f3 },
  1449. { 0x0b, 0x02a19020 },
  1450. { 0x0c, 0x40a000f0 },
  1451. { 0x0d, 0x90100210 },
  1452. { 0x10, 0x400003f1 },
  1453. { 0x11, 0x503303f3 },
  1454. {}
  1455. };
  1456. static const struct hda_pintbl stac925xM5_pin_configs[] = {
  1457. { 0x07, 0x40c003f4 },
  1458. { 0x08, 0x424503f2 },
  1459. { 0x0a, 0x400000f3 },
  1460. { 0x0b, 0x02a19020 },
  1461. { 0x0c, 0x40a000f0 },
  1462. { 0x0d, 0x90100210 },
  1463. { 0x10, 0x400003f1 },
  1464. { 0x11, 0x9033032e },
  1465. {}
  1466. };
  1467. static const struct hda_pintbl stac925xM6_pin_configs[] = {
  1468. { 0x07, 0x40c003f4 },
  1469. { 0x08, 0x424503f2 },
  1470. { 0x0a, 0x400000f3 },
  1471. { 0x0b, 0x02a19020 },
  1472. { 0x0c, 0x40a000f0 },
  1473. { 0x0d, 0x90100210 },
  1474. { 0x10, 0x400003f1 },
  1475. { 0x11, 0x90330320 },
  1476. {}
  1477. };
  1478. static const struct hda_fixup stac925x_fixups[] = {
  1479. [STAC_REF] = {
  1480. .type = HDA_FIXUP_PINS,
  1481. .v.pins = ref925x_pin_configs,
  1482. },
  1483. [STAC_M1] = {
  1484. .type = HDA_FIXUP_PINS,
  1485. .v.pins = stac925xM1_pin_configs,
  1486. },
  1487. [STAC_M1_2] = {
  1488. .type = HDA_FIXUP_PINS,
  1489. .v.pins = stac925xM1_2_pin_configs,
  1490. },
  1491. [STAC_M2] = {
  1492. .type = HDA_FIXUP_PINS,
  1493. .v.pins = stac925xM2_pin_configs,
  1494. },
  1495. [STAC_M2_2] = {
  1496. .type = HDA_FIXUP_PINS,
  1497. .v.pins = stac925xM2_2_pin_configs,
  1498. },
  1499. [STAC_M3] = {
  1500. .type = HDA_FIXUP_PINS,
  1501. .v.pins = stac925xM3_pin_configs,
  1502. },
  1503. [STAC_M5] = {
  1504. .type = HDA_FIXUP_PINS,
  1505. .v.pins = stac925xM5_pin_configs,
  1506. },
  1507. [STAC_M6] = {
  1508. .type = HDA_FIXUP_PINS,
  1509. .v.pins = stac925xM6_pin_configs,
  1510. },
  1511. };
  1512. static const struct hda_model_fixup stac925x_models[] = {
  1513. { .id = STAC_REF, .name = "ref" },
  1514. { .id = STAC_M1, .name = "m1" },
  1515. { .id = STAC_M1_2, .name = "m1-2" },
  1516. { .id = STAC_M2, .name = "m2" },
  1517. { .id = STAC_M2_2, .name = "m2-2" },
  1518. { .id = STAC_M3, .name = "m3" },
  1519. { .id = STAC_M5, .name = "m5" },
  1520. { .id = STAC_M6, .name = "m6" },
  1521. {}
  1522. };
  1523. static const struct snd_pci_quirk stac925x_fixup_tbl[] = {
  1524. /* SigmaTel reference board */
  1525. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
  1526. SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, "DFI LanParty", STAC_REF),
  1527. SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
  1528. /* Default table for unknown ID */
  1529. SND_PCI_QUIRK(0x1002, 0x437b, "Gateway mobile", STAC_M2_2),
  1530. /* gateway machines are checked via codec ssid */
  1531. SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2),
  1532. SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5),
  1533. SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1),
  1534. SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_M2),
  1535. SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2),
  1536. /* Not sure about the brand name for those */
  1537. SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1),
  1538. SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3),
  1539. SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6),
  1540. SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2),
  1541. {} /* terminator */
  1542. };
  1543. static const struct hda_pintbl ref92hd73xx_pin_configs[] = {
  1544. { 0x0a, 0x02214030 },
  1545. { 0x0b, 0x02a19040 },
  1546. { 0x0c, 0x01a19020 },
  1547. { 0x0d, 0x02214030 },
  1548. { 0x0e, 0x0181302e },
  1549. { 0x0f, 0x01014010 },
  1550. { 0x10, 0x01014020 },
  1551. { 0x11, 0x01014030 },
  1552. { 0x12, 0x02319040 },
  1553. { 0x13, 0x90a000f0 },
  1554. { 0x14, 0x90a000f0 },
  1555. { 0x22, 0x01452050 },
  1556. { 0x23, 0x01452050 },
  1557. {}
  1558. };
  1559. static const struct hda_pintbl dell_m6_pin_configs[] = {
  1560. { 0x0a, 0x0321101f },
  1561. { 0x0b, 0x4f00000f },
  1562. { 0x0c, 0x4f0000f0 },
  1563. { 0x0d, 0x90170110 },
  1564. { 0x0e, 0x03a11020 },
  1565. { 0x0f, 0x0321101f },
  1566. { 0x10, 0x4f0000f0 },
  1567. { 0x11, 0x4f0000f0 },
  1568. { 0x12, 0x4f0000f0 },
  1569. { 0x13, 0x90a60160 },
  1570. { 0x14, 0x4f0000f0 },
  1571. { 0x22, 0x4f0000f0 },
  1572. { 0x23, 0x4f0000f0 },
  1573. {}
  1574. };
  1575. static const struct hda_pintbl alienware_m17x_pin_configs[] = {
  1576. { 0x0a, 0x0321101f },
  1577. { 0x0b, 0x0321101f },
  1578. { 0x0c, 0x03a11020 },
  1579. { 0x0d, 0x03014020 },
  1580. { 0x0e, 0x90170110 },
  1581. { 0x0f, 0x4f0000f0 },
  1582. { 0x10, 0x4f0000f0 },
  1583. { 0x11, 0x4f0000f0 },
  1584. { 0x12, 0x4f0000f0 },
  1585. { 0x13, 0x90a60160 },
  1586. { 0x14, 0x4f0000f0 },
  1587. { 0x22, 0x4f0000f0 },
  1588. { 0x23, 0x904601b0 },
  1589. {}
  1590. };
  1591. static const struct hda_pintbl intel_dg45id_pin_configs[] = {
  1592. { 0x0a, 0x02214230 },
  1593. { 0x0b, 0x02A19240 },
  1594. { 0x0c, 0x01013214 },
  1595. { 0x0d, 0x01014210 },
  1596. { 0x0e, 0x01A19250 },
  1597. { 0x0f, 0x01011212 },
  1598. { 0x10, 0x01016211 },
  1599. {}
  1600. };
  1601. static const struct hda_pintbl stac92hd89xx_hp_front_jack_pin_configs[] = {
  1602. { 0x0a, 0x02214030 },
  1603. { 0x0b, 0x02A19010 },
  1604. {}
  1605. };
  1606. static void stac92hd73xx_fixup_ref(struct hda_codec *codec,
  1607. const struct hda_fixup *fix, int action)
  1608. {
  1609. struct sigmatel_spec *spec = codec->spec;
  1610. if (action != HDA_FIXUP_ACT_PRE_PROBE)
  1611. return;
  1612. snd_hda_apply_pincfgs(codec, ref92hd73xx_pin_configs);
  1613. spec->gpio_mask = spec->gpio_dir = spec->gpio_data = 0;
  1614. }
  1615. static void stac92hd73xx_fixup_dell(struct hda_codec *codec)
  1616. {
  1617. struct sigmatel_spec *spec = codec->spec;
  1618. snd_hda_apply_pincfgs(codec, dell_m6_pin_configs);
  1619. spec->eapd_switch = 0;
  1620. }
  1621. static void stac92hd73xx_fixup_dell_eq(struct hda_codec *codec,
  1622. const struct hda_fixup *fix, int action)
  1623. {
  1624. struct sigmatel_spec *spec = codec->spec;
  1625. if (action != HDA_FIXUP_ACT_PRE_PROBE)
  1626. return;
  1627. stac92hd73xx_fixup_dell(codec);
  1628. snd_hda_add_verbs(codec, dell_eq_core_init);
  1629. spec->volknob_init = 1;
  1630. }
  1631. /* Analog Mics */
  1632. static void stac92hd73xx_fixup_dell_m6_amic(struct hda_codec *codec,
  1633. const struct hda_fixup *fix, int action)
  1634. {
  1635. if (action != HDA_FIXUP_ACT_PRE_PROBE)
  1636. return;
  1637. stac92hd73xx_fixup_dell(codec);
  1638. snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
  1639. }
  1640. /* Digital Mics */
  1641. static void stac92hd73xx_fixup_dell_m6_dmic(struct hda_codec *codec,
  1642. const struct hda_fixup *fix, int action)
  1643. {
  1644. if (action != HDA_FIXUP_ACT_PRE_PROBE)
  1645. return;
  1646. stac92hd73xx_fixup_dell(codec);
  1647. snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
  1648. }
  1649. /* Both */
  1650. static void stac92hd73xx_fixup_dell_m6_both(struct hda_codec *codec,
  1651. const struct hda_fixup *fix, int action)
  1652. {
  1653. if (action != HDA_FIXUP_ACT_PRE_PROBE)
  1654. return;
  1655. stac92hd73xx_fixup_dell(codec);
  1656. snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
  1657. snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
  1658. }
  1659. static void stac92hd73xx_fixup_alienware_m17x(struct hda_codec *codec,
  1660. const struct hda_fixup *fix, int action)
  1661. {
  1662. struct sigmatel_spec *spec = codec->spec;
  1663. if (action != HDA_FIXUP_ACT_PRE_PROBE)
  1664. return;
  1665. snd_hda_apply_pincfgs(codec, alienware_m17x_pin_configs);
  1666. spec->eapd_switch = 0;
  1667. }
  1668. static void stac92hd73xx_fixup_no_jd(struct hda_codec *codec,
  1669. const struct hda_fixup *fix, int action)
  1670. {
  1671. if (action == HDA_FIXUP_ACT_PRE_PROBE)
  1672. codec->no_jack_detect = 1;
  1673. }
  1674. static const struct hda_fixup stac92hd73xx_fixups[] = {
  1675. [STAC_92HD73XX_REF] = {
  1676. .type = HDA_FIXUP_FUNC,
  1677. .v.func = stac92hd73xx_fixup_ref,
  1678. },
  1679. [STAC_DELL_M6_AMIC] = {
  1680. .type = HDA_FIXUP_FUNC,
  1681. .v.func = stac92hd73xx_fixup_dell_m6_amic,
  1682. },
  1683. [STAC_DELL_M6_DMIC] = {
  1684. .type = HDA_FIXUP_FUNC,
  1685. .v.func = stac92hd73xx_fixup_dell_m6_dmic,
  1686. },
  1687. [STAC_DELL_M6_BOTH] = {
  1688. .type = HDA_FIXUP_FUNC,
  1689. .v.func = stac92hd73xx_fixup_dell_m6_both,
  1690. },
  1691. [STAC_DELL_EQ] = {
  1692. .type = HDA_FIXUP_FUNC,
  1693. .v.func = stac92hd73xx_fixup_dell_eq,
  1694. },
  1695. [STAC_ALIENWARE_M17X] = {
  1696. .type = HDA_FIXUP_FUNC,
  1697. .v.func = stac92hd73xx_fixup_alienware_m17x,
  1698. },
  1699. [STAC_92HD73XX_INTEL] = {
  1700. .type = HDA_FIXUP_PINS,
  1701. .v.pins = intel_dg45id_pin_configs,
  1702. },
  1703. [STAC_92HD73XX_NO_JD] = {
  1704. .type = HDA_FIXUP_FUNC,
  1705. .v.func = stac92hd73xx_fixup_no_jd,
  1706. },
  1707. [STAC_92HD89XX_HP_FRONT_JACK] = {
  1708. .type = HDA_FIXUP_PINS,
  1709. .v.pins = stac92hd89xx_hp_front_jack_pin_configs,
  1710. }
  1711. };
  1712. static const struct hda_model_fixup stac92hd73xx_models[] = {
  1713. { .id = STAC_92HD73XX_NO_JD, .name = "no-jd" },
  1714. { .id = STAC_92HD73XX_REF, .name = "ref" },
  1715. { .id = STAC_92HD73XX_INTEL, .name = "intel" },
  1716. { .id = STAC_DELL_M6_AMIC, .name = "dell-m6-amic" },
  1717. { .id = STAC_DELL_M6_DMIC, .name = "dell-m6-dmic" },
  1718. { .id = STAC_DELL_M6_BOTH, .name = "dell-m6" },
  1719. { .id = STAC_DELL_EQ, .name = "dell-eq" },
  1720. { .id = STAC_ALIENWARE_M17X, .name = "alienware" },
  1721. {}
  1722. };
  1723. static const struct snd_pci_quirk stac92hd73xx_fixup_tbl[] = {
  1724. /* SigmaTel reference board */
  1725. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
  1726. "DFI LanParty", STAC_92HD73XX_REF),
  1727. SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
  1728. "DFI LanParty", STAC_92HD73XX_REF),
  1729. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5002,
  1730. "Intel DG45ID", STAC_92HD73XX_INTEL),
  1731. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5003,
  1732. "Intel DG45FC", STAC_92HD73XX_INTEL),
  1733. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254,
  1734. "Dell Studio 1535", STAC_DELL_M6_DMIC),
  1735. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255,
  1736. "unknown Dell", STAC_DELL_M6_DMIC),
  1737. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256,
  1738. "unknown Dell", STAC_DELL_M6_BOTH),
  1739. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257,
  1740. "unknown Dell", STAC_DELL_M6_BOTH),
  1741. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e,
  1742. "unknown Dell", STAC_DELL_M6_AMIC),
  1743. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f,
  1744. "unknown Dell", STAC_DELL_M6_AMIC),
  1745. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271,
  1746. "unknown Dell", STAC_DELL_M6_DMIC),
  1747. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0272,
  1748. "unknown Dell", STAC_DELL_M6_DMIC),
  1749. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f,
  1750. "Dell Studio 1537", STAC_DELL_M6_DMIC),
  1751. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a0,
  1752. "Dell Studio 17", STAC_DELL_M6_DMIC),
  1753. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02be,
  1754. "Dell Studio 1555", STAC_DELL_M6_DMIC),
  1755. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02bd,
  1756. "Dell Studio 1557", STAC_DELL_M6_DMIC),
  1757. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02fe,
  1758. "Dell Studio XPS 1645", STAC_DELL_M6_DMIC),
  1759. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0413,
  1760. "Dell Studio 1558", STAC_DELL_M6_DMIC),
  1761. /* codec SSID matching */
  1762. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a1,
  1763. "Alienware M17x", STAC_ALIENWARE_M17X),
  1764. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a,
  1765. "Alienware M17x", STAC_ALIENWARE_M17X),
  1766. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490,
  1767. "Alienware M17x R3", STAC_DELL_EQ),
  1768. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2b17,
  1769. "unknown HP", STAC_92HD89XX_HP_FRONT_JACK),
  1770. {} /* terminator */
  1771. };
  1772. static const struct hda_pintbl ref92hd83xxx_pin_configs[] = {
  1773. { 0x0a, 0x02214030 },
  1774. { 0x0b, 0x02211010 },
  1775. { 0x0c, 0x02a19020 },
  1776. { 0x0d, 0x02170130 },
  1777. { 0x0e, 0x01014050 },
  1778. { 0x0f, 0x01819040 },
  1779. { 0x10, 0x01014020 },
  1780. { 0x11, 0x90a3014e },
  1781. { 0x1f, 0x01451160 },
  1782. { 0x20, 0x98560170 },
  1783. {}
  1784. };
  1785. static const struct hda_pintbl dell_s14_pin_configs[] = {
  1786. { 0x0a, 0x0221403f },
  1787. { 0x0b, 0x0221101f },
  1788. { 0x0c, 0x02a19020 },
  1789. { 0x0d, 0x90170110 },
  1790. { 0x0e, 0x40f000f0 },
  1791. { 0x0f, 0x40f000f0 },
  1792. { 0x10, 0x40f000f0 },
  1793. { 0x11, 0x90a60160 },
  1794. { 0x1f, 0x40f000f0 },
  1795. { 0x20, 0x40f000f0 },
  1796. {}
  1797. };
  1798. static const struct hda_pintbl dell_vostro_3500_pin_configs[] = {
  1799. { 0x0a, 0x02a11020 },
  1800. { 0x0b, 0x0221101f },
  1801. { 0x0c, 0x400000f0 },
  1802. { 0x0d, 0x90170110 },
  1803. { 0x0e, 0x400000f1 },
  1804. { 0x0f, 0x400000f2 },
  1805. { 0x10, 0x400000f3 },
  1806. { 0x11, 0x90a60160 },
  1807. { 0x1f, 0x400000f4 },
  1808. { 0x20, 0x400000f5 },
  1809. {}
  1810. };
  1811. static const struct hda_pintbl hp_dv7_4000_pin_configs[] = {
  1812. { 0x0a, 0x03a12050 },
  1813. { 0x0b, 0x0321201f },
  1814. { 0x0c, 0x40f000f0 },
  1815. { 0x0d, 0x90170110 },
  1816. { 0x0e, 0x40f000f0 },
  1817. { 0x0f, 0x40f000f0 },
  1818. { 0x10, 0x90170110 },
  1819. { 0x11, 0xd5a30140 },
  1820. { 0x1f, 0x40f000f0 },
  1821. { 0x20, 0x40f000f0 },
  1822. {}
  1823. };
  1824. static const struct hda_pintbl hp_zephyr_pin_configs[] = {
  1825. { 0x0a, 0x01813050 },
  1826. { 0x0b, 0x0421201f },
  1827. { 0x0c, 0x04a1205e },
  1828. { 0x0d, 0x96130310 },
  1829. { 0x0e, 0x96130310 },
  1830. { 0x0f, 0x0101401f },
  1831. { 0x10, 0x1111611f },
  1832. { 0x11, 0xd5a30130 },
  1833. {}
  1834. };
  1835. static const struct hda_pintbl hp_cNB11_intquad_pin_configs[] = {
  1836. { 0x0a, 0x40f000f0 },
  1837. { 0x0b, 0x0221101f },
  1838. { 0x0c, 0x02a11020 },
  1839. { 0x0d, 0x92170110 },
  1840. { 0x0e, 0x40f000f0 },
  1841. { 0x0f, 0x92170110 },
  1842. { 0x10, 0x40f000f0 },
  1843. { 0x11, 0xd5a30130 },
  1844. { 0x1f, 0x40f000f0 },
  1845. { 0x20, 0x40f000f0 },
  1846. {}
  1847. };
  1848. static void stac92hd83xxx_fixup_hp(struct hda_codec *codec,
  1849. const struct hda_fixup *fix, int action)
  1850. {
  1851. struct sigmatel_spec *spec = codec->spec;
  1852. if (action != HDA_FIXUP_ACT_PRE_PROBE)
  1853. return;
  1854. if (hp_bnb2011_with_dock(codec)) {
  1855. snd_hda_codec_set_pincfg(codec, 0xa, 0x2101201f);
  1856. snd_hda_codec_set_pincfg(codec, 0xf, 0x2181205e);
  1857. }
  1858. if (find_mute_led_cfg(codec, spec->default_polarity))
  1859. snd_printd("mute LED gpio %d polarity %d\n",
  1860. spec->gpio_led,
  1861. spec->gpio_led_polarity);
  1862. }
  1863. static void stac92hd83xxx_fixup_hp_zephyr(struct hda_codec *codec,
  1864. const struct hda_fixup *fix, int action)
  1865. {
  1866. if (action != HDA_FIXUP_ACT_PRE_PROBE)
  1867. return;
  1868. snd_hda_apply_pincfgs(codec, hp_zephyr_pin_configs);
  1869. snd_hda_add_verbs(codec, stac92hd83xxx_hp_zephyr_init);
  1870. }
  1871. static void stac92hd83xxx_fixup_hp_led(struct hda_codec *codec,
  1872. const struct hda_fixup *fix, int action)
  1873. {
  1874. struct sigmatel_spec *spec = codec->spec;
  1875. if (action == HDA_FIXUP_ACT_PRE_PROBE)
  1876. spec->default_polarity = 0;
  1877. }
  1878. static void stac92hd83xxx_fixup_hp_inv_led(struct hda_codec *codec,
  1879. const struct hda_fixup *fix, int action)
  1880. {
  1881. struct sigmatel_spec *spec = codec->spec;
  1882. if (action == HDA_FIXUP_ACT_PRE_PROBE)
  1883. spec->default_polarity = 1;
  1884. }
  1885. static void stac92hd83xxx_fixup_hp_mic_led(struct hda_codec *codec,
  1886. const struct hda_fixup *fix, int action)
  1887. {
  1888. struct sigmatel_spec *spec = codec->spec;
  1889. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  1890. spec->mic_mute_led_gpio = 0x08; /* GPIO3 */
  1891. /* resetting controller clears GPIO, so we need to keep on */
  1892. codec->bus->power_keep_link_on = 1;
  1893. }
  1894. }
  1895. static void stac92hd83xxx_fixup_headset_jack(struct hda_codec *codec,
  1896. const struct hda_fixup *fix, int action)
  1897. {
  1898. struct sigmatel_spec *spec = codec->spec;
  1899. if (action == HDA_FIXUP_ACT_PRE_PROBE)
  1900. spec->headset_jack = 1;
  1901. }
  1902. static const struct hda_verb hp_bnb13_eq_verbs[] = {
  1903. /* 44.1KHz base */
  1904. { 0x22, 0x7A6, 0x3E },
  1905. { 0x22, 0x7A7, 0x68 },
  1906. { 0x22, 0x7A8, 0x17 },
  1907. { 0x22, 0x7A9, 0x3E },
  1908. { 0x22, 0x7AA, 0x68 },
  1909. { 0x22, 0x7AB, 0x17 },
  1910. { 0x22, 0x7AC, 0x00 },
  1911. { 0x22, 0x7AD, 0x80 },
  1912. { 0x22, 0x7A6, 0x83 },
  1913. { 0x22, 0x7A7, 0x2F },
  1914. { 0x22, 0x7A8, 0xD1 },
  1915. { 0x22, 0x7A9, 0x83 },
  1916. { 0x22, 0x7AA, 0x2F },
  1917. { 0x22, 0x7AB, 0xD1 },
  1918. { 0x22, 0x7AC, 0x01 },
  1919. { 0x22, 0x7AD, 0x80 },
  1920. { 0x22, 0x7A6, 0x3E },
  1921. { 0x22, 0x7A7, 0x68 },
  1922. { 0x22, 0x7A8, 0x17 },
  1923. { 0x22, 0x7A9, 0x3E },
  1924. { 0x22, 0x7AA, 0x68 },
  1925. { 0x22, 0x7AB, 0x17 },
  1926. { 0x22, 0x7AC, 0x02 },
  1927. { 0x22, 0x7AD, 0x80 },
  1928. { 0x22, 0x7A6, 0x7C },
  1929. { 0x22, 0x7A7, 0xC6 },
  1930. { 0x22, 0x7A8, 0x0C },
  1931. { 0x22, 0x7A9, 0x7C },
  1932. { 0x22, 0x7AA, 0xC6 },
  1933. { 0x22, 0x7AB, 0x0C },
  1934. { 0x22, 0x7AC, 0x03 },
  1935. { 0x22, 0x7AD, 0x80 },
  1936. { 0x22, 0x7A6, 0xC3 },
  1937. { 0x22, 0x7A7, 0x25 },
  1938. { 0x22, 0x7A8, 0xAF },
  1939. { 0x22, 0x7A9, 0xC3 },
  1940. { 0x22, 0x7AA, 0x25 },
  1941. { 0x22, 0x7AB, 0xAF },
  1942. { 0x22, 0x7AC, 0x04 },
  1943. { 0x22, 0x7AD, 0x80 },
  1944. { 0x22, 0x7A6, 0x3E },
  1945. { 0x22, 0x7A7, 0x85 },
  1946. { 0x22, 0x7A8, 0x73 },
  1947. { 0x22, 0x7A9, 0x3E },
  1948. { 0x22, 0x7AA, 0x85 },
  1949. { 0x22, 0x7AB, 0x73 },
  1950. { 0x22, 0x7AC, 0x05 },
  1951. { 0x22, 0x7AD, 0x80 },
  1952. { 0x22, 0x7A6, 0x85 },
  1953. { 0x22, 0x7A7, 0x39 },
  1954. { 0x22, 0x7A8, 0xC7 },
  1955. { 0x22, 0x7A9, 0x85 },
  1956. { 0x22, 0x7AA, 0x39 },
  1957. { 0x22, 0x7AB, 0xC7 },
  1958. { 0x22, 0x7AC, 0x06 },
  1959. { 0x22, 0x7AD, 0x80 },
  1960. { 0x22, 0x7A6, 0x3C },
  1961. { 0x22, 0x7A7, 0x90 },
  1962. { 0x22, 0x7A8, 0xB0 },
  1963. { 0x22, 0x7A9, 0x3C },
  1964. { 0x22, 0x7AA, 0x90 },
  1965. { 0x22, 0x7AB, 0xB0 },
  1966. { 0x22, 0x7AC, 0x07 },
  1967. { 0x22, 0x7AD, 0x80 },
  1968. { 0x22, 0x7A6, 0x7A },
  1969. { 0x22, 0x7A7, 0xC6 },
  1970. { 0x22, 0x7A8, 0x39 },
  1971. { 0x22, 0x7A9, 0x7A },
  1972. { 0x22, 0x7AA, 0xC6 },
  1973. { 0x22, 0x7AB, 0x39 },
  1974. { 0x22, 0x7AC, 0x08 },
  1975. { 0x22, 0x7AD, 0x80 },
  1976. { 0x22, 0x7A6, 0xC4 },
  1977. { 0x22, 0x7A7, 0xE9 },
  1978. { 0x22, 0x7A8, 0xDC },
  1979. { 0x22, 0x7A9, 0xC4 },
  1980. { 0x22, 0x7AA, 0xE9 },
  1981. { 0x22, 0x7AB, 0xDC },
  1982. { 0x22, 0x7AC, 0x09 },
  1983. { 0x22, 0x7AD, 0x80 },
  1984. { 0x22, 0x7A6, 0x3D },
  1985. { 0x22, 0x7A7, 0xE1 },
  1986. { 0x22, 0x7A8, 0x0D },
  1987. { 0x22, 0x7A9, 0x3D },
  1988. { 0x22, 0x7AA, 0xE1 },
  1989. { 0x22, 0x7AB, 0x0D },
  1990. { 0x22, 0x7AC, 0x0A },
  1991. { 0x22, 0x7AD, 0x80 },
  1992. { 0x22, 0x7A6, 0x89 },
  1993. { 0x22, 0x7A7, 0xB6 },
  1994. { 0x22, 0x7A8, 0xEB },
  1995. { 0x22, 0x7A9, 0x89 },
  1996. { 0x22, 0x7AA, 0xB6 },
  1997. { 0x22, 0x7AB, 0xEB },
  1998. { 0x22, 0x7AC, 0x0B },
  1999. { 0x22, 0x7AD, 0x80 },
  2000. { 0x22, 0x7A6, 0x39 },
  2001. { 0x22, 0x7A7, 0x9D },
  2002. { 0x22, 0x7A8, 0xFE },
  2003. { 0x22, 0x7A9, 0x39 },
  2004. { 0x22, 0x7AA, 0x9D },
  2005. { 0x22, 0x7AB, 0xFE },
  2006. { 0x22, 0x7AC, 0x0C },
  2007. { 0x22, 0x7AD, 0x80 },
  2008. { 0x22, 0x7A6, 0x76 },
  2009. { 0x22, 0x7A7, 0x49 },
  2010. { 0x22, 0x7A8, 0x15 },
  2011. { 0x22, 0x7A9, 0x76 },
  2012. { 0x22, 0x7AA, 0x49 },
  2013. { 0x22, 0x7AB, 0x15 },
  2014. { 0x22, 0x7AC, 0x0D },
  2015. { 0x22, 0x7AD, 0x80 },
  2016. { 0x22, 0x7A6, 0xC8 },
  2017. { 0x22, 0x7A7, 0x80 },
  2018. { 0x22, 0x7A8, 0xF5 },
  2019. { 0x22, 0x7A9, 0xC8 },
  2020. { 0x22, 0x7AA, 0x80 },
  2021. { 0x22, 0x7AB, 0xF5 },
  2022. { 0x22, 0x7AC, 0x0E },
  2023. { 0x22, 0x7AD, 0x80 },
  2024. { 0x22, 0x7A6, 0x40 },
  2025. { 0x22, 0x7A7, 0x00 },
  2026. { 0x22, 0x7A8, 0x00 },
  2027. { 0x22, 0x7A9, 0x40 },
  2028. { 0x22, 0x7AA, 0x00 },
  2029. { 0x22, 0x7AB, 0x00 },
  2030. { 0x22, 0x7AC, 0x0F },
  2031. { 0x22, 0x7AD, 0x80 },
  2032. { 0x22, 0x7A6, 0x90 },
  2033. { 0x22, 0x7A7, 0x68 },
  2034. { 0x22, 0x7A8, 0xF1 },
  2035. { 0x22, 0x7A9, 0x90 },
  2036. { 0x22, 0x7AA, 0x68 },
  2037. { 0x22, 0x7AB, 0xF1 },
  2038. { 0x22, 0x7AC, 0x10 },
  2039. { 0x22, 0x7AD, 0x80 },
  2040. { 0x22, 0x7A6, 0x34 },
  2041. { 0x22, 0x7A7, 0x47 },
  2042. { 0x22, 0x7A8, 0x6C },
  2043. { 0x22, 0x7A9, 0x34 },
  2044. { 0x22, 0x7AA, 0x47 },
  2045. { 0x22, 0x7AB, 0x6C },
  2046. { 0x22, 0x7AC, 0x11 },
  2047. { 0x22, 0x7AD, 0x80 },
  2048. { 0x22, 0x7A6, 0x6F },
  2049. { 0x22, 0x7A7, 0x97 },
  2050. { 0x22, 0x7A8, 0x0F },
  2051. { 0x22, 0x7A9, 0x6F },
  2052. { 0x22, 0x7AA, 0x97 },
  2053. { 0x22, 0x7AB, 0x0F },
  2054. { 0x22, 0x7AC, 0x12 },
  2055. { 0x22, 0x7AD, 0x80 },
  2056. { 0x22, 0x7A6, 0xCB },
  2057. { 0x22, 0x7A7, 0xB8 },
  2058. { 0x22, 0x7A8, 0x94 },
  2059. { 0x22, 0x7A9, 0xCB },
  2060. { 0x22, 0x7AA, 0xB8 },
  2061. { 0x22, 0x7AB, 0x94 },
  2062. { 0x22, 0x7AC, 0x13 },
  2063. { 0x22, 0x7AD, 0x80 },
  2064. { 0x22, 0x7A6, 0x40 },
  2065. { 0x22, 0x7A7, 0x00 },
  2066. { 0x22, 0x7A8, 0x00 },
  2067. { 0x22, 0x7A9, 0x40 },
  2068. { 0x22, 0x7AA, 0x00 },
  2069. { 0x22, 0x7AB, 0x00 },
  2070. { 0x22, 0x7AC, 0x14 },
  2071. { 0x22, 0x7AD, 0x80 },
  2072. { 0x22, 0x7A6, 0x95 },
  2073. { 0x22, 0x7A7, 0x76 },
  2074. { 0x22, 0x7A8, 0x5B },
  2075. { 0x22, 0x7A9, 0x95 },
  2076. { 0x22, 0x7AA, 0x76 },
  2077. { 0x22, 0x7AB, 0x5B },
  2078. { 0x22, 0x7AC, 0x15 },
  2079. { 0x22, 0x7AD, 0x80 },
  2080. { 0x22, 0x7A6, 0x31 },
  2081. { 0x22, 0x7A7, 0xAC },
  2082. { 0x22, 0x7A8, 0x31 },
  2083. { 0x22, 0x7A9, 0x31 },
  2084. { 0x22, 0x7AA, 0xAC },
  2085. { 0x22, 0x7AB, 0x31 },
  2086. { 0x22, 0x7AC, 0x16 },
  2087. { 0x22, 0x7AD, 0x80 },
  2088. { 0x22, 0x7A6, 0x6A },
  2089. { 0x22, 0x7A7, 0x89 },
  2090. { 0x22, 0x7A8, 0xA5 },
  2091. { 0x22, 0x7A9, 0x6A },
  2092. { 0x22, 0x7AA, 0x89 },
  2093. { 0x22, 0x7AB, 0xA5 },
  2094. { 0x22, 0x7AC, 0x17 },
  2095. { 0x22, 0x7AD, 0x80 },
  2096. { 0x22, 0x7A6, 0xCE },
  2097. { 0x22, 0x7A7, 0x53 },
  2098. { 0x22, 0x7A8, 0xCF },
  2099. { 0x22, 0x7A9, 0xCE },
  2100. { 0x22, 0x7AA, 0x53 },
  2101. { 0x22, 0x7AB, 0xCF },
  2102. { 0x22, 0x7AC, 0x18 },
  2103. { 0x22, 0x7AD, 0x80 },
  2104. { 0x22, 0x7A6, 0x40 },
  2105. { 0x22, 0x7A7, 0x00 },
  2106. { 0x22, 0x7A8, 0x00 },
  2107. { 0x22, 0x7A9, 0x40 },
  2108. { 0x22, 0x7AA, 0x00 },
  2109. { 0x22, 0x7AB, 0x00 },
  2110. { 0x22, 0x7AC, 0x19 },
  2111. { 0x22, 0x7AD, 0x80 },
  2112. /* 48KHz base */
  2113. { 0x22, 0x7A6, 0x3E },
  2114. { 0x22, 0x7A7, 0x88 },
  2115. { 0x22, 0x7A8, 0xDC },
  2116. { 0x22, 0x7A9, 0x3E },
  2117. { 0x22, 0x7AA, 0x88 },
  2118. { 0x22, 0x7AB, 0xDC },
  2119. { 0x22, 0x7AC, 0x1A },
  2120. { 0x22, 0x7AD, 0x80 },
  2121. { 0x22, 0x7A6, 0x82 },
  2122. { 0x22, 0x7A7, 0xEE },
  2123. { 0x22, 0x7A8, 0x46 },
  2124. { 0x22, 0x7A9, 0x82 },
  2125. { 0x22, 0x7AA, 0xEE },
  2126. { 0x22, 0x7AB, 0x46 },
  2127. { 0x22, 0x7AC, 0x1B },
  2128. { 0x22, 0x7AD, 0x80 },
  2129. { 0x22, 0x7A6, 0x3E },
  2130. { 0x22, 0x7A7, 0x88 },
  2131. { 0x22, 0x7A8, 0xDC },
  2132. { 0x22, 0x7A9, 0x3E },
  2133. { 0x22, 0x7AA, 0x88 },
  2134. { 0x22, 0x7AB, 0xDC },
  2135. { 0x22, 0x7AC, 0x1C },
  2136. { 0x22, 0x7AD, 0x80 },
  2137. { 0x22, 0x7A6, 0x7D },
  2138. { 0x22, 0x7A7, 0x09 },
  2139. { 0x22, 0x7A8, 0x28 },
  2140. { 0x22, 0x7A9, 0x7D },
  2141. { 0x22, 0x7AA, 0x09 },
  2142. { 0x22, 0x7AB, 0x28 },
  2143. { 0x22, 0x7AC, 0x1D },
  2144. { 0x22, 0x7AD, 0x80 },
  2145. { 0x22, 0x7A6, 0xC2 },
  2146. { 0x22, 0x7A7, 0xE5 },
  2147. { 0x22, 0x7A8, 0xB4 },
  2148. { 0x22, 0x7A9, 0xC2 },
  2149. { 0x22, 0x7AA, 0xE5 },
  2150. { 0x22, 0x7AB, 0xB4 },
  2151. { 0x22, 0x7AC, 0x1E },
  2152. { 0x22, 0x7AD, 0x80 },
  2153. { 0x22, 0x7A6, 0x3E },
  2154. { 0x22, 0x7A7, 0xA3 },
  2155. { 0x22, 0x7A8, 0x1F },
  2156. { 0x22, 0x7A9, 0x3E },
  2157. { 0x22, 0x7AA, 0xA3 },
  2158. { 0x22, 0x7AB, 0x1F },
  2159. { 0x22, 0x7AC, 0x1F },
  2160. { 0x22, 0x7AD, 0x80 },
  2161. { 0x22, 0x7A6, 0x84 },
  2162. { 0x22, 0x7A7, 0xCA },
  2163. { 0x22, 0x7A8, 0xF1 },
  2164. { 0x22, 0x7A9, 0x84 },
  2165. { 0x22, 0x7AA, 0xCA },
  2166. { 0x22, 0x7AB, 0xF1 },
  2167. { 0x22, 0x7AC, 0x20 },
  2168. { 0x22, 0x7AD, 0x80 },
  2169. { 0x22, 0x7A6, 0x3C },
  2170. { 0x22, 0x7A7, 0xD5 },
  2171. { 0x22, 0x7A8, 0x9C },
  2172. { 0x22, 0x7A9, 0x3C },
  2173. { 0x22, 0x7AA, 0xD5 },
  2174. { 0x22, 0x7AB, 0x9C },
  2175. { 0x22, 0x7AC, 0x21 },
  2176. { 0x22, 0x7AD, 0x80 },
  2177. { 0x22, 0x7A6, 0x7B },
  2178. { 0x22, 0x7A7, 0x35 },
  2179. { 0x22, 0x7A8, 0x0F },
  2180. { 0x22, 0x7A9, 0x7B },
  2181. { 0x22, 0x7AA, 0x35 },
  2182. { 0x22, 0x7AB, 0x0F },
  2183. { 0x22, 0x7AC, 0x22 },
  2184. { 0x22, 0x7AD, 0x80 },
  2185. { 0x22, 0x7A6, 0xC4 },
  2186. { 0x22, 0x7A7, 0x87 },
  2187. { 0x22, 0x7A8, 0x45 },
  2188. { 0x22, 0x7A9, 0xC4 },
  2189. { 0x22, 0x7AA, 0x87 },
  2190. { 0x22, 0x7AB, 0x45 },
  2191. { 0x22, 0x7AC, 0x23 },
  2192. { 0x22, 0x7AD, 0x80 },
  2193. { 0x22, 0x7A6, 0x3E },
  2194. { 0x22, 0x7A7, 0x0A },
  2195. { 0x22, 0x7A8, 0x78 },
  2196. { 0x22, 0x7A9, 0x3E },
  2197. { 0x22, 0x7AA, 0x0A },
  2198. { 0x22, 0x7AB, 0x78 },
  2199. { 0x22, 0x7AC, 0x24 },
  2200. { 0x22, 0x7AD, 0x80 },
  2201. { 0x22, 0x7A6, 0x88 },
  2202. { 0x22, 0x7A7, 0xE2 },
  2203. { 0x22, 0x7A8, 0x05 },
  2204. { 0x22, 0x7A9, 0x88 },
  2205. { 0x22, 0x7AA, 0xE2 },
  2206. { 0x22, 0x7AB, 0x05 },
  2207. { 0x22, 0x7AC, 0x25 },
  2208. { 0x22, 0x7AD, 0x80 },
  2209. { 0x22, 0x7A6, 0x3A },
  2210. { 0x22, 0x7A7, 0x1A },
  2211. { 0x22, 0x7A8, 0xA3 },
  2212. { 0x22, 0x7A9, 0x3A },
  2213. { 0x22, 0x7AA, 0x1A },
  2214. { 0x22, 0x7AB, 0xA3 },
  2215. { 0x22, 0x7AC, 0x26 },
  2216. { 0x22, 0x7AD, 0x80 },
  2217. { 0x22, 0x7A6, 0x77 },
  2218. { 0x22, 0x7A7, 0x1D },
  2219. { 0x22, 0x7A8, 0xFB },
  2220. { 0x22, 0x7A9, 0x77 },
  2221. { 0x22, 0x7AA, 0x1D },
  2222. { 0x22, 0x7AB, 0xFB },
  2223. { 0x22, 0x7AC, 0x27 },
  2224. { 0x22, 0x7AD, 0x80 },
  2225. { 0x22, 0x7A6, 0xC7 },
  2226. { 0x22, 0x7A7, 0xDA },
  2227. { 0x22, 0x7A8, 0xE5 },
  2228. { 0x22, 0x7A9, 0xC7 },
  2229. { 0x22, 0x7AA, 0xDA },
  2230. { 0x22, 0x7AB, 0xE5 },
  2231. { 0x22, 0x7AC, 0x28 },
  2232. { 0x22, 0x7AD, 0x80 },
  2233. { 0x22, 0x7A6, 0x40 },
  2234. { 0x22, 0x7A7, 0x00 },
  2235. { 0x22, 0x7A8, 0x00 },
  2236. { 0x22, 0x7A9, 0x40 },
  2237. { 0x22, 0x7AA, 0x00 },
  2238. { 0x22, 0x7AB, 0x00 },
  2239. { 0x22, 0x7AC, 0x29 },
  2240. { 0x22, 0x7AD, 0x80 },
  2241. { 0x22, 0x7A6, 0x8E },
  2242. { 0x22, 0x7A7, 0xD7 },
  2243. { 0x22, 0x7A8, 0x22 },
  2244. { 0x22, 0x7A9, 0x8E },
  2245. { 0x22, 0x7AA, 0xD7 },
  2246. { 0x22, 0x7AB, 0x22 },
  2247. { 0x22, 0x7AC, 0x2A },
  2248. { 0x22, 0x7AD, 0x80 },
  2249. { 0x22, 0x7A6, 0x35 },
  2250. { 0x22, 0x7A7, 0x26 },
  2251. { 0x22, 0x7A8, 0xC6 },
  2252. { 0x22, 0x7A9, 0x35 },
  2253. { 0x22, 0x7AA, 0x26 },
  2254. { 0x22, 0x7AB, 0xC6 },
  2255. { 0x22, 0x7AC, 0x2B },
  2256. { 0x22, 0x7AD, 0x80 },
  2257. { 0x22, 0x7A6, 0x71 },
  2258. { 0x22, 0x7A7, 0x28 },
  2259. { 0x22, 0x7A8, 0xDE },
  2260. { 0x22, 0x7A9, 0x71 },
  2261. { 0x22, 0x7AA, 0x28 },
  2262. { 0x22, 0x7AB, 0xDE },
  2263. { 0x22, 0x7AC, 0x2C },
  2264. { 0x22, 0x7AD, 0x80 },
  2265. { 0x22, 0x7A6, 0xCA },
  2266. { 0x22, 0x7A7, 0xD9 },
  2267. { 0x22, 0x7A8, 0x3A },
  2268. { 0x22, 0x7A9, 0xCA },
  2269. { 0x22, 0x7AA, 0xD9 },
  2270. { 0x22, 0x7AB, 0x3A },
  2271. { 0x22, 0x7AC, 0x2D },
  2272. { 0x22, 0x7AD, 0x80 },
  2273. { 0x22, 0x7A6, 0x40 },
  2274. { 0x22, 0x7A7, 0x00 },
  2275. { 0x22, 0x7A8, 0x00 },
  2276. { 0x22, 0x7A9, 0x40 },
  2277. { 0x22, 0x7AA, 0x00 },
  2278. { 0x22, 0x7AB, 0x00 },
  2279. { 0x22, 0x7AC, 0x2E },
  2280. { 0x22, 0x7AD, 0x80 },
  2281. { 0x22, 0x7A6, 0x93 },
  2282. { 0x22, 0x7A7, 0x5E },
  2283. { 0x22, 0x7A8, 0xD8 },
  2284. { 0x22, 0x7A9, 0x93 },
  2285. { 0x22, 0x7AA, 0x5E },
  2286. { 0x22, 0x7AB, 0xD8 },
  2287. { 0x22, 0x7AC, 0x2F },
  2288. { 0x22, 0x7AD, 0x80 },
  2289. { 0x22, 0x7A6, 0x32 },
  2290. { 0x22, 0x7A7, 0xB7 },
  2291. { 0x22, 0x7A8, 0xB1 },
  2292. { 0x22, 0x7A9, 0x32 },
  2293. { 0x22, 0x7AA, 0xB7 },
  2294. { 0x22, 0x7AB, 0xB1 },
  2295. { 0x22, 0x7AC, 0x30 },
  2296. { 0x22, 0x7AD, 0x80 },
  2297. { 0x22, 0x7A6, 0x6C },
  2298. { 0x22, 0x7A7, 0xA1 },
  2299. { 0x22, 0x7A8, 0x28 },
  2300. { 0x22, 0x7A9, 0x6C },
  2301. { 0x22, 0x7AA, 0xA1 },
  2302. { 0x22, 0x7AB, 0x28 },
  2303. { 0x22, 0x7AC, 0x31 },
  2304. { 0x22, 0x7AD, 0x80 },
  2305. { 0x22, 0x7A6, 0xCD },
  2306. { 0x22, 0x7A7, 0x48 },
  2307. { 0x22, 0x7A8, 0x4F },
  2308. { 0x22, 0x7A9, 0xCD },
  2309. { 0x22, 0x7AA, 0x48 },
  2310. { 0x22, 0x7AB, 0x4F },
  2311. { 0x22, 0x7AC, 0x32 },
  2312. { 0x22, 0x7AD, 0x80 },
  2313. { 0x22, 0x7A6, 0x40 },
  2314. { 0x22, 0x7A7, 0x00 },
  2315. { 0x22, 0x7A8, 0x00 },
  2316. { 0x22, 0x7A9, 0x40 },
  2317. { 0x22, 0x7AA, 0x00 },
  2318. { 0x22, 0x7AB, 0x00 },
  2319. { 0x22, 0x7AC, 0x33 },
  2320. { 0x22, 0x7AD, 0x80 },
  2321. /* common */
  2322. { 0x22, 0x782, 0xC1 },
  2323. { 0x22, 0x771, 0x2C },
  2324. { 0x22, 0x772, 0x2C },
  2325. { 0x22, 0x788, 0x04 },
  2326. { 0x01, 0x7B0, 0x08 },
  2327. {}
  2328. };
  2329. static const struct hda_fixup stac92hd83xxx_fixups[] = {
  2330. [STAC_92HD83XXX_REF] = {
  2331. .type = HDA_FIXUP_PINS,
  2332. .v.pins = ref92hd83xxx_pin_configs,
  2333. },
  2334. [STAC_92HD83XXX_PWR_REF] = {
  2335. .type = HDA_FIXUP_PINS,
  2336. .v.pins = ref92hd83xxx_pin_configs,
  2337. },
  2338. [STAC_DELL_S14] = {
  2339. .type = HDA_FIXUP_PINS,
  2340. .v.pins = dell_s14_pin_configs,
  2341. },
  2342. [STAC_DELL_VOSTRO_3500] = {
  2343. .type = HDA_FIXUP_PINS,
  2344. .v.pins = dell_vostro_3500_pin_configs,
  2345. },
  2346. [STAC_92HD83XXX_HP_cNB11_INTQUAD] = {
  2347. .type = HDA_FIXUP_PINS,
  2348. .v.pins = hp_cNB11_intquad_pin_configs,
  2349. .chained = true,
  2350. .chain_id = STAC_92HD83XXX_HP,
  2351. },
  2352. [STAC_92HD83XXX_HP] = {
  2353. .type = HDA_FIXUP_FUNC,
  2354. .v.func = stac92hd83xxx_fixup_hp,
  2355. },
  2356. [STAC_HP_DV7_4000] = {
  2357. .type = HDA_FIXUP_PINS,
  2358. .v.pins = hp_dv7_4000_pin_configs,
  2359. .chained = true,
  2360. .chain_id = STAC_92HD83XXX_HP,
  2361. },
  2362. [STAC_HP_ZEPHYR] = {
  2363. .type = HDA_FIXUP_FUNC,
  2364. .v.func = stac92hd83xxx_fixup_hp_zephyr,
  2365. .chained = true,
  2366. .chain_id = STAC_92HD83XXX_HP,
  2367. },
  2368. [STAC_92HD83XXX_HP_LED] = {
  2369. .type = HDA_FIXUP_FUNC,
  2370. .v.func = stac92hd83xxx_fixup_hp_led,
  2371. .chained = true,
  2372. .chain_id = STAC_92HD83XXX_HP,
  2373. },
  2374. [STAC_92HD83XXX_HP_INV_LED] = {
  2375. .type = HDA_FIXUP_FUNC,
  2376. .v.func = stac92hd83xxx_fixup_hp_inv_led,
  2377. .chained = true,
  2378. .chain_id = STAC_92HD83XXX_HP,
  2379. },
  2380. [STAC_92HD83XXX_HP_MIC_LED] = {
  2381. .type = HDA_FIXUP_FUNC,
  2382. .v.func = stac92hd83xxx_fixup_hp_mic_led,
  2383. .chained = true,
  2384. .chain_id = STAC_92HD83XXX_HP,
  2385. },
  2386. [STAC_92HD83XXX_HEADSET_JACK] = {
  2387. .type = HDA_FIXUP_FUNC,
  2388. .v.func = stac92hd83xxx_fixup_headset_jack,
  2389. },
  2390. [STAC_HP_ENVY_BASS] = {
  2391. .type = HDA_FIXUP_PINS,
  2392. .v.pins = (const struct hda_pintbl[]) {
  2393. { 0x0f, 0x90170111 },
  2394. {}
  2395. },
  2396. },
  2397. [STAC_HP_BNB13_EQ] = {
  2398. .type = HDA_FIXUP_VERBS,
  2399. .v.verbs = hp_bnb13_eq_verbs,
  2400. .chained = true,
  2401. .chain_id = STAC_92HD83XXX_HP_MIC_LED,
  2402. },
  2403. };
  2404. static const struct hda_model_fixup stac92hd83xxx_models[] = {
  2405. { .id = STAC_92HD83XXX_REF, .name = "ref" },
  2406. { .id = STAC_92HD83XXX_PWR_REF, .name = "mic-ref" },
  2407. { .id = STAC_DELL_S14, .name = "dell-s14" },
  2408. { .id = STAC_DELL_VOSTRO_3500, .name = "dell-vostro-3500" },
  2409. { .id = STAC_92HD83XXX_HP_cNB11_INTQUAD, .name = "hp_cNB11_intquad" },
  2410. { .id = STAC_HP_DV7_4000, .name = "hp-dv7-4000" },
  2411. { .id = STAC_HP_ZEPHYR, .name = "hp-zephyr" },
  2412. { .id = STAC_92HD83XXX_HP_LED, .name = "hp-led" },
  2413. { .id = STAC_92HD83XXX_HP_INV_LED, .name = "hp-inv-led" },
  2414. { .id = STAC_92HD83XXX_HP_MIC_LED, .name = "hp-mic-led" },
  2415. { .id = STAC_92HD83XXX_HEADSET_JACK, .name = "headset-jack" },
  2416. { .id = STAC_HP_ENVY_BASS, .name = "hp-envy-bass" },
  2417. { .id = STAC_HP_BNB13_EQ, .name = "hp-bnb13-eq" },
  2418. {}
  2419. };
  2420. static const struct snd_pci_quirk stac92hd83xxx_fixup_tbl[] = {
  2421. /* SigmaTel reference board */
  2422. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
  2423. "DFI LanParty", STAC_92HD83XXX_REF),
  2424. SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
  2425. "DFI LanParty", STAC_92HD83XXX_REF),
  2426. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ba,
  2427. "unknown Dell", STAC_DELL_S14),
  2428. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0532,
  2429. "Dell Latitude E6230", STAC_92HD83XXX_HEADSET_JACK),
  2430. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0533,
  2431. "Dell Latitude E6330", STAC_92HD83XXX_HEADSET_JACK),
  2432. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0534,
  2433. "Dell Latitude E6430", STAC_92HD83XXX_HEADSET_JACK),
  2434. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0535,
  2435. "Dell Latitude E6530", STAC_92HD83XXX_HEADSET_JACK),
  2436. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x053c,
  2437. "Dell Latitude E5430", STAC_92HD83XXX_HEADSET_JACK),
  2438. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x053d,
  2439. "Dell Latitude E5530", STAC_92HD83XXX_HEADSET_JACK),
  2440. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0549,
  2441. "Dell Latitude E5430", STAC_92HD83XXX_HEADSET_JACK),
  2442. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x057d,
  2443. "Dell Latitude E6430s", STAC_92HD83XXX_HEADSET_JACK),
  2444. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0584,
  2445. "Dell Latitude E6430U", STAC_92HD83XXX_HEADSET_JACK),
  2446. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x1028,
  2447. "Dell Vostro 3500", STAC_DELL_VOSTRO_3500),
  2448. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1656,
  2449. "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  2450. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1657,
  2451. "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  2452. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1658,
  2453. "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  2454. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1659,
  2455. "HP Pavilion dv7", STAC_HP_DV7_4000),
  2456. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165A,
  2457. "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  2458. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165B,
  2459. "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  2460. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1888,
  2461. "HP Envy Spectre", STAC_HP_ENVY_BASS),
  2462. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18df,
  2463. "HP Folio", STAC_HP_BNB13_EQ),
  2464. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18F8,
  2465. "HP bNB13", STAC_HP_BNB13_EQ),
  2466. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1909,
  2467. "HP bNB13", STAC_HP_BNB13_EQ),
  2468. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x190A,
  2469. "HP bNB13", STAC_HP_BNB13_EQ),
  2470. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1940,
  2471. "HP bNB13", STAC_HP_BNB13_EQ),
  2472. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1941,
  2473. "HP bNB13", STAC_HP_BNB13_EQ),
  2474. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1942,
  2475. "HP bNB13", STAC_HP_BNB13_EQ),
  2476. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1943,
  2477. "HP bNB13", STAC_HP_BNB13_EQ),
  2478. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1944,
  2479. "HP bNB13", STAC_HP_BNB13_EQ),
  2480. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1945,
  2481. "HP bNB13", STAC_HP_BNB13_EQ),
  2482. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1946,
  2483. "HP bNB13", STAC_HP_BNB13_EQ),
  2484. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1948,
  2485. "HP bNB13", STAC_HP_BNB13_EQ),
  2486. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1949,
  2487. "HP bNB13", STAC_HP_BNB13_EQ),
  2488. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194A,
  2489. "HP bNB13", STAC_HP_BNB13_EQ),
  2490. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194B,
  2491. "HP bNB13", STAC_HP_BNB13_EQ),
  2492. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194C,
  2493. "HP bNB13", STAC_HP_BNB13_EQ),
  2494. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194E,
  2495. "HP bNB13", STAC_HP_BNB13_EQ),
  2496. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194F,
  2497. "HP bNB13", STAC_HP_BNB13_EQ),
  2498. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1950,
  2499. "HP bNB13", STAC_HP_BNB13_EQ),
  2500. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1951,
  2501. "HP bNB13", STAC_HP_BNB13_EQ),
  2502. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x195A,
  2503. "HP bNB13", STAC_HP_BNB13_EQ),
  2504. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x195B,
  2505. "HP bNB13", STAC_HP_BNB13_EQ),
  2506. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x195C,
  2507. "HP bNB13", STAC_HP_BNB13_EQ),
  2508. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1991,
  2509. "HP bNB13", STAC_HP_BNB13_EQ),
  2510. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2103,
  2511. "HP bNB13", STAC_HP_BNB13_EQ),
  2512. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2104,
  2513. "HP bNB13", STAC_HP_BNB13_EQ),
  2514. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2105,
  2515. "HP bNB13", STAC_HP_BNB13_EQ),
  2516. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2106,
  2517. "HP bNB13", STAC_HP_BNB13_EQ),
  2518. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2107,
  2519. "HP bNB13", STAC_HP_BNB13_EQ),
  2520. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2108,
  2521. "HP bNB13", STAC_HP_BNB13_EQ),
  2522. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2109,
  2523. "HP bNB13", STAC_HP_BNB13_EQ),
  2524. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x210A,
  2525. "HP bNB13", STAC_HP_BNB13_EQ),
  2526. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x210B,
  2527. "HP bNB13", STAC_HP_BNB13_EQ),
  2528. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x211C,
  2529. "HP bNB13", STAC_HP_BNB13_EQ),
  2530. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x211D,
  2531. "HP bNB13", STAC_HP_BNB13_EQ),
  2532. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x211E,
  2533. "HP bNB13", STAC_HP_BNB13_EQ),
  2534. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x211F,
  2535. "HP bNB13", STAC_HP_BNB13_EQ),
  2536. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2120,
  2537. "HP bNB13", STAC_HP_BNB13_EQ),
  2538. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2121,
  2539. "HP bNB13", STAC_HP_BNB13_EQ),
  2540. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2122,
  2541. "HP bNB13", STAC_HP_BNB13_EQ),
  2542. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2123,
  2543. "HP bNB13", STAC_HP_BNB13_EQ),
  2544. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x213E,
  2545. "HP bNB13", STAC_HP_BNB13_EQ),
  2546. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x213F,
  2547. "HP bNB13", STAC_HP_BNB13_EQ),
  2548. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2140,
  2549. "HP bNB13", STAC_HP_BNB13_EQ),
  2550. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x21B2,
  2551. "HP bNB13", STAC_HP_BNB13_EQ),
  2552. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x21B3,
  2553. "HP bNB13", STAC_HP_BNB13_EQ),
  2554. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x21B5,
  2555. "HP bNB13", STAC_HP_BNB13_EQ),
  2556. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x21B6,
  2557. "HP bNB13", STAC_HP_BNB13_EQ),
  2558. SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x1900,
  2559. "HP", STAC_92HD83XXX_HP_MIC_LED),
  2560. SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x2000,
  2561. "HP", STAC_92HD83XXX_HP_MIC_LED),
  2562. SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x2100,
  2563. "HP", STAC_92HD83XXX_HP_MIC_LED),
  2564. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3388,
  2565. "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  2566. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3389,
  2567. "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  2568. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355B,
  2569. "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  2570. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355C,
  2571. "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  2572. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355D,
  2573. "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  2574. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355E,
  2575. "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  2576. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355F,
  2577. "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  2578. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3560,
  2579. "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  2580. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358B,
  2581. "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  2582. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358C,
  2583. "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  2584. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358D,
  2585. "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  2586. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3591,
  2587. "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  2588. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3592,
  2589. "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  2590. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3593,
  2591. "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  2592. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3561,
  2593. "HP", STAC_HP_ZEPHYR),
  2594. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3660,
  2595. "HP Mini", STAC_92HD83XXX_HP_LED),
  2596. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x144E,
  2597. "HP Pavilion dv5", STAC_92HD83XXX_HP_INV_LED),
  2598. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x148a,
  2599. "HP Mini", STAC_92HD83XXX_HP_LED),
  2600. SND_PCI_QUIRK_VENDOR(PCI_VENDOR_ID_HP, "HP", STAC_92HD83XXX_HP),
  2601. {} /* terminator */
  2602. };
  2603. /* HP dv7 bass switch - GPIO5 */
  2604. #define stac_hp_bass_gpio_info snd_ctl_boolean_mono_info
  2605. static int stac_hp_bass_gpio_get(struct snd_kcontrol *kcontrol,
  2606. struct snd_ctl_elem_value *ucontrol)
  2607. {
  2608. struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  2609. struct sigmatel_spec *spec = codec->spec;
  2610. ucontrol->value.integer.value[0] = !!(spec->gpio_data & 0x20);
  2611. return 0;
  2612. }
  2613. static int stac_hp_bass_gpio_put(struct snd_kcontrol *kcontrol,
  2614. struct snd_ctl_elem_value *ucontrol)
  2615. {
  2616. struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  2617. struct sigmatel_spec *spec = codec->spec;
  2618. unsigned int gpio_data;
  2619. gpio_data = (spec->gpio_data & ~0x20) |
  2620. (ucontrol->value.integer.value[0] ? 0x20 : 0);
  2621. if (gpio_data == spec->gpio_data)
  2622. return 0;
  2623. spec->gpio_data = gpio_data;
  2624. stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data);
  2625. return 1;
  2626. }
  2627. static const struct snd_kcontrol_new stac_hp_bass_sw_ctrl = {
  2628. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  2629. .info = stac_hp_bass_gpio_info,
  2630. .get = stac_hp_bass_gpio_get,
  2631. .put = stac_hp_bass_gpio_put,
  2632. };
  2633. static int stac_add_hp_bass_switch(struct hda_codec *codec)
  2634. {
  2635. struct sigmatel_spec *spec = codec->spec;
  2636. if (!snd_hda_gen_add_kctl(&spec->gen, "Bass Speaker Playback Switch",
  2637. &stac_hp_bass_sw_ctrl))
  2638. return -ENOMEM;
  2639. spec->gpio_mask |= 0x20;
  2640. spec->gpio_dir |= 0x20;
  2641. spec->gpio_data |= 0x20;
  2642. return 0;
  2643. }
  2644. static const struct hda_pintbl ref92hd71bxx_pin_configs[] = {
  2645. { 0x0a, 0x02214030 },
  2646. { 0x0b, 0x02a19040 },
  2647. { 0x0c, 0x01a19020 },
  2648. { 0x0d, 0x01014010 },
  2649. { 0x0e, 0x0181302e },
  2650. { 0x0f, 0x01014010 },
  2651. { 0x14, 0x01019020 },
  2652. { 0x18, 0x90a000f0 },
  2653. { 0x19, 0x90a000f0 },
  2654. { 0x1e, 0x01452050 },
  2655. { 0x1f, 0x01452050 },
  2656. {}
  2657. };
  2658. static const struct hda_pintbl dell_m4_1_pin_configs[] = {
  2659. { 0x0a, 0x0421101f },
  2660. { 0x0b, 0x04a11221 },
  2661. { 0x0c, 0x40f000f0 },
  2662. { 0x0d, 0x90170110 },
  2663. { 0x0e, 0x23a1902e },
  2664. { 0x0f, 0x23014250 },
  2665. { 0x14, 0x40f000f0 },
  2666. { 0x18, 0x90a000f0 },
  2667. { 0x19, 0x40f000f0 },
  2668. { 0x1e, 0x4f0000f0 },
  2669. { 0x1f, 0x4f0000f0 },
  2670. {}
  2671. };
  2672. static const struct hda_pintbl dell_m4_2_pin_configs[] = {
  2673. { 0x0a, 0x0421101f },
  2674. { 0x0b, 0x04a11221 },
  2675. { 0x0c, 0x90a70330 },
  2676. { 0x0d, 0x90170110 },
  2677. { 0x0e, 0x23a1902e },
  2678. { 0x0f, 0x23014250 },
  2679. { 0x14, 0x40f000f0 },
  2680. { 0x18, 0x40f000f0 },
  2681. { 0x19, 0x40f000f0 },
  2682. { 0x1e, 0x044413b0 },
  2683. { 0x1f, 0x044413b0 },
  2684. {}
  2685. };
  2686. static const struct hda_pintbl dell_m4_3_pin_configs[] = {
  2687. { 0x0a, 0x0421101f },
  2688. { 0x0b, 0x04a11221 },
  2689. { 0x0c, 0x90a70330 },
  2690. { 0x0d, 0x90170110 },
  2691. { 0x0e, 0x40f000f0 },
  2692. { 0x0f, 0x40f000f0 },
  2693. { 0x14, 0x40f000f0 },
  2694. { 0x18, 0x90a000f0 },
  2695. { 0x19, 0x40f000f0 },
  2696. { 0x1e, 0x044413b0 },
  2697. { 0x1f, 0x044413b0 },
  2698. {}
  2699. };
  2700. static void stac92hd71bxx_fixup_ref(struct hda_codec *codec,
  2701. const struct hda_fixup *fix, int action)
  2702. {
  2703. struct sigmatel_spec *spec = codec->spec;
  2704. if (action != HDA_FIXUP_ACT_PRE_PROBE)
  2705. return;
  2706. snd_hda_apply_pincfgs(codec, ref92hd71bxx_pin_configs);
  2707. spec->gpio_mask = spec->gpio_dir = spec->gpio_data = 0;
  2708. }
  2709. static void stac92hd71bxx_fixup_hp_m4(struct hda_codec *codec,
  2710. const struct hda_fixup *fix, int action)
  2711. {
  2712. struct sigmatel_spec *spec = codec->spec;
  2713. struct hda_jack_tbl *jack;
  2714. if (action != HDA_FIXUP_ACT_PRE_PROBE)
  2715. return;
  2716. /* Enable VREF power saving on GPIO1 detect */
  2717. snd_hda_codec_write_cache(codec, codec->afg, 0,
  2718. AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02);
  2719. snd_hda_jack_detect_enable_callback(codec, codec->afg,
  2720. STAC_VREF_EVENT,
  2721. stac_vref_event);
  2722. jack = snd_hda_jack_tbl_get(codec, codec->afg);
  2723. if (jack)
  2724. jack->private_data = 0x02;
  2725. spec->gpio_mask |= 0x02;
  2726. /* enable internal microphone */
  2727. snd_hda_codec_set_pincfg(codec, 0x0e, 0x01813040);
  2728. }
  2729. static void stac92hd71bxx_fixup_hp_dv4(struct hda_codec *codec,
  2730. const struct hda_fixup *fix, int action)
  2731. {
  2732. struct sigmatel_spec *spec = codec->spec;
  2733. if (action != HDA_FIXUP_ACT_PRE_PROBE)
  2734. return;
  2735. spec->gpio_led = 0x01;
  2736. }
  2737. static void stac92hd71bxx_fixup_hp_dv5(struct hda_codec *codec,
  2738. const struct hda_fixup *fix, int action)
  2739. {
  2740. unsigned int cap;
  2741. switch (action) {
  2742. case HDA_FIXUP_ACT_PRE_PROBE:
  2743. snd_hda_codec_set_pincfg(codec, 0x0d, 0x90170010);
  2744. break;
  2745. case HDA_FIXUP_ACT_PROBE:
  2746. /* enable bass on HP dv7 */
  2747. cap = snd_hda_param_read(codec, 0x1, AC_PAR_GPIO_CAP);
  2748. cap &= AC_GPIO_IO_COUNT;
  2749. if (cap >= 6)
  2750. stac_add_hp_bass_switch(codec);
  2751. break;
  2752. }
  2753. }
  2754. static void stac92hd71bxx_fixup_hp_hdx(struct hda_codec *codec,
  2755. const struct hda_fixup *fix, int action)
  2756. {
  2757. struct sigmatel_spec *spec = codec->spec;
  2758. if (action != HDA_FIXUP_ACT_PRE_PROBE)
  2759. return;
  2760. spec->gpio_led = 0x08;
  2761. }
  2762. static void stac92hd71bxx_fixup_hp(struct hda_codec *codec,
  2763. const struct hda_fixup *fix, int action)
  2764. {
  2765. struct sigmatel_spec *spec = codec->spec;
  2766. if (action != HDA_FIXUP_ACT_PRE_PROBE)
  2767. return;
  2768. if (hp_blike_system(codec->subsystem_id)) {
  2769. unsigned int pin_cfg = snd_hda_codec_get_pincfg(codec, 0x0f);
  2770. if (get_defcfg_device(pin_cfg) == AC_JACK_LINE_OUT ||
  2771. get_defcfg_device(pin_cfg) == AC_JACK_SPEAKER ||
  2772. get_defcfg_device(pin_cfg) == AC_JACK_HP_OUT) {
  2773. /* It was changed in the BIOS to just satisfy MS DTM.
  2774. * Lets turn it back into slaved HP
  2775. */
  2776. pin_cfg = (pin_cfg & (~AC_DEFCFG_DEVICE))
  2777. | (AC_JACK_HP_OUT <<
  2778. AC_DEFCFG_DEVICE_SHIFT);
  2779. pin_cfg = (pin_cfg & (~(AC_DEFCFG_DEF_ASSOC
  2780. | AC_DEFCFG_SEQUENCE)))
  2781. | 0x1f;
  2782. snd_hda_codec_set_pincfg(codec, 0x0f, pin_cfg);
  2783. }
  2784. }
  2785. if (find_mute_led_cfg(codec, 1))
  2786. snd_printd("mute LED gpio %d polarity %d\n",
  2787. spec->gpio_led,
  2788. spec->gpio_led_polarity);
  2789. }
  2790. static const struct hda_fixup stac92hd71bxx_fixups[] = {
  2791. [STAC_92HD71BXX_REF] = {
  2792. .type = HDA_FIXUP_FUNC,
  2793. .v.func = stac92hd71bxx_fixup_ref,
  2794. },
  2795. [STAC_DELL_M4_1] = {
  2796. .type = HDA_FIXUP_PINS,
  2797. .v.pins = dell_m4_1_pin_configs,
  2798. },
  2799. [STAC_DELL_M4_2] = {
  2800. .type = HDA_FIXUP_PINS,
  2801. .v.pins = dell_m4_2_pin_configs,
  2802. },
  2803. [STAC_DELL_M4_3] = {
  2804. .type = HDA_FIXUP_PINS,
  2805. .v.pins = dell_m4_3_pin_configs,
  2806. },
  2807. [STAC_HP_M4] = {
  2808. .type = HDA_FIXUP_FUNC,
  2809. .v.func = stac92hd71bxx_fixup_hp_m4,
  2810. .chained = true,
  2811. .chain_id = STAC_92HD71BXX_HP,
  2812. },
  2813. [STAC_HP_DV4] = {
  2814. .type = HDA_FIXUP_FUNC,
  2815. .v.func = stac92hd71bxx_fixup_hp_dv4,
  2816. .chained = true,
  2817. .chain_id = STAC_HP_DV5,
  2818. },
  2819. [STAC_HP_DV5] = {
  2820. .type = HDA_FIXUP_FUNC,
  2821. .v.func = stac92hd71bxx_fixup_hp_dv5,
  2822. .chained = true,
  2823. .chain_id = STAC_92HD71BXX_HP,
  2824. },
  2825. [STAC_HP_HDX] = {
  2826. .type = HDA_FIXUP_FUNC,
  2827. .v.func = stac92hd71bxx_fixup_hp_hdx,
  2828. .chained = true,
  2829. .chain_id = STAC_92HD71BXX_HP,
  2830. },
  2831. [STAC_92HD71BXX_HP] = {
  2832. .type = HDA_FIXUP_FUNC,
  2833. .v.func = stac92hd71bxx_fixup_hp,
  2834. },
  2835. };
  2836. static const struct hda_model_fixup stac92hd71bxx_models[] = {
  2837. { .id = STAC_92HD71BXX_REF, .name = "ref" },
  2838. { .id = STAC_DELL_M4_1, .name = "dell-m4-1" },
  2839. { .id = STAC_DELL_M4_2, .name = "dell-m4-2" },
  2840. { .id = STAC_DELL_M4_3, .name = "dell-m4-3" },
  2841. { .id = STAC_HP_M4, .name = "hp-m4" },
  2842. { .id = STAC_HP_DV4, .name = "hp-dv4" },
  2843. { .id = STAC_HP_DV5, .name = "hp-dv5" },
  2844. { .id = STAC_HP_HDX, .name = "hp-hdx" },
  2845. { .id = STAC_HP_DV4, .name = "hp-dv4-1222nr" },
  2846. {}
  2847. };
  2848. static const struct snd_pci_quirk stac92hd71bxx_fixup_tbl[] = {
  2849. /* SigmaTel reference board */
  2850. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
  2851. "DFI LanParty", STAC_92HD71BXX_REF),
  2852. SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
  2853. "DFI LanParty", STAC_92HD71BXX_REF),
  2854. SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x1720,
  2855. "HP", STAC_HP_DV5),
  2856. SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3080,
  2857. "HP", STAC_HP_DV5),
  2858. SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x30f0,
  2859. "HP dv4-7", STAC_HP_DV4),
  2860. SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3600,
  2861. "HP dv4-7", STAC_HP_DV5),
  2862. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3610,
  2863. "HP HDX", STAC_HP_HDX), /* HDX18 */
  2864. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a,
  2865. "HP mini 1000", STAC_HP_M4),
  2866. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361b,
  2867. "HP HDX", STAC_HP_HDX), /* HDX16 */
  2868. SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3620,
  2869. "HP dv6", STAC_HP_DV5),
  2870. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3061,
  2871. "HP dv6", STAC_HP_DV5), /* HP dv6-1110ax */
  2872. SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x363e,
  2873. "HP DV6", STAC_HP_DV5),
  2874. SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x7010,
  2875. "HP", STAC_HP_DV5),
  2876. SND_PCI_QUIRK_VENDOR(PCI_VENDOR_ID_HP, "HP", STAC_92HD71BXX_HP),
  2877. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
  2878. "unknown Dell", STAC_DELL_M4_1),
  2879. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234,
  2880. "unknown Dell", STAC_DELL_M4_1),
  2881. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250,
  2882. "unknown Dell", STAC_DELL_M4_1),
  2883. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f,
  2884. "unknown Dell", STAC_DELL_M4_1),
  2885. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d,
  2886. "unknown Dell", STAC_DELL_M4_1),
  2887. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251,
  2888. "unknown Dell", STAC_DELL_M4_1),
  2889. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277,
  2890. "unknown Dell", STAC_DELL_M4_1),
  2891. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263,
  2892. "unknown Dell", STAC_DELL_M4_2),
  2893. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265,
  2894. "unknown Dell", STAC_DELL_M4_2),
  2895. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262,
  2896. "unknown Dell", STAC_DELL_M4_2),
  2897. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264,
  2898. "unknown Dell", STAC_DELL_M4_2),
  2899. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02aa,
  2900. "unknown Dell", STAC_DELL_M4_3),
  2901. {} /* terminator */
  2902. };
  2903. static const struct hda_pintbl ref922x_pin_configs[] = {
  2904. { 0x0a, 0x01014010 },
  2905. { 0x0b, 0x01016011 },
  2906. { 0x0c, 0x01012012 },
  2907. { 0x0d, 0x0221401f },
  2908. { 0x0e, 0x01813122 },
  2909. { 0x0f, 0x01011014 },
  2910. { 0x10, 0x01441030 },
  2911. { 0x11, 0x01c41030 },
  2912. { 0x15, 0x40000100 },
  2913. { 0x1b, 0x40000100 },
  2914. {}
  2915. };
  2916. /*
  2917. STAC 922X pin configs for
  2918. 102801A7
  2919. 102801AB
  2920. 102801A9
  2921. 102801D1
  2922. 102801D2
  2923. */
  2924. static const struct hda_pintbl dell_922x_d81_pin_configs[] = {
  2925. { 0x0a, 0x02214030 },
  2926. { 0x0b, 0x01a19021 },
  2927. { 0x0c, 0x01111012 },
  2928. { 0x0d, 0x01114010 },
  2929. { 0x0e, 0x02a19020 },
  2930. { 0x0f, 0x01117011 },
  2931. { 0x10, 0x400001f0 },
  2932. { 0x11, 0x400001f1 },
  2933. { 0x15, 0x01813122 },
  2934. { 0x1b, 0x400001f2 },
  2935. {}
  2936. };
  2937. /*
  2938. STAC 922X pin configs for
  2939. 102801AC
  2940. 102801D0
  2941. */
  2942. static const struct hda_pintbl dell_922x_d82_pin_configs[] = {
  2943. { 0x0a, 0x02214030 },
  2944. { 0x0b, 0x01a19021 },
  2945. { 0x0c, 0x01111012 },
  2946. { 0x0d, 0x01114010 },
  2947. { 0x0e, 0x02a19020 },
  2948. { 0x0f, 0x01117011 },
  2949. { 0x10, 0x01451140 },
  2950. { 0x11, 0x400001f0 },
  2951. { 0x15, 0x01813122 },
  2952. { 0x1b, 0x400001f1 },
  2953. {}
  2954. };
  2955. /*
  2956. STAC 922X pin configs for
  2957. 102801BF
  2958. */
  2959. static const struct hda_pintbl dell_922x_m81_pin_configs[] = {
  2960. { 0x0a, 0x0321101f },
  2961. { 0x0b, 0x01112024 },
  2962. { 0x0c, 0x01111222 },
  2963. { 0x0d, 0x91174220 },
  2964. { 0x0e, 0x03a11050 },
  2965. { 0x0f, 0x01116221 },
  2966. { 0x10, 0x90a70330 },
  2967. { 0x11, 0x01452340 },
  2968. { 0x15, 0x40C003f1 },
  2969. { 0x1b, 0x405003f0 },
  2970. {}
  2971. };
  2972. /*
  2973. STAC 9221 A1 pin configs for
  2974. 102801D7 (Dell XPS M1210)
  2975. */
  2976. static const struct hda_pintbl dell_922x_m82_pin_configs[] = {
  2977. { 0x0a, 0x02211211 },
  2978. { 0x0b, 0x408103ff },
  2979. { 0x0c, 0x02a1123e },
  2980. { 0x0d, 0x90100310 },
  2981. { 0x0e, 0x408003f1 },
  2982. { 0x0f, 0x0221121f },
  2983. { 0x10, 0x03451340 },
  2984. { 0x11, 0x40c003f2 },
  2985. { 0x15, 0x508003f3 },
  2986. { 0x1b, 0x405003f4 },
  2987. {}
  2988. };
  2989. static const struct hda_pintbl d945gtp3_pin_configs[] = {
  2990. { 0x0a, 0x0221401f },
  2991. { 0x0b, 0x01a19022 },
  2992. { 0x0c, 0x01813021 },
  2993. { 0x0d, 0x01014010 },
  2994. { 0x0e, 0x40000100 },
  2995. { 0x0f, 0x40000100 },
  2996. { 0x10, 0x40000100 },
  2997. { 0x11, 0x40000100 },
  2998. { 0x15, 0x02a19120 },
  2999. { 0x1b, 0x40000100 },
  3000. {}
  3001. };
  3002. static const struct hda_pintbl d945gtp5_pin_configs[] = {
  3003. { 0x0a, 0x0221401f },
  3004. { 0x0b, 0x01011012 },
  3005. { 0x0c, 0x01813024 },
  3006. { 0x0d, 0x01014010 },
  3007. { 0x0e, 0x01a19021 },
  3008. { 0x0f, 0x01016011 },
  3009. { 0x10, 0x01452130 },
  3010. { 0x11, 0x40000100 },
  3011. { 0x15, 0x02a19320 },
  3012. { 0x1b, 0x40000100 },
  3013. {}
  3014. };
  3015. static const struct hda_pintbl intel_mac_v1_pin_configs[] = {
  3016. { 0x0a, 0x0121e21f },
  3017. { 0x0b, 0x400000ff },
  3018. { 0x0c, 0x9017e110 },
  3019. { 0x0d, 0x400000fd },
  3020. { 0x0e, 0x400000fe },
  3021. { 0x0f, 0x0181e020 },
  3022. { 0x10, 0x1145e030 },
  3023. { 0x11, 0x11c5e240 },
  3024. { 0x15, 0x400000fc },
  3025. { 0x1b, 0x400000fb },
  3026. {}
  3027. };
  3028. static const struct hda_pintbl intel_mac_v2_pin_configs[] = {
  3029. { 0x0a, 0x0121e21f },
  3030. { 0x0b, 0x90a7012e },
  3031. { 0x0c, 0x9017e110 },
  3032. { 0x0d, 0x400000fd },
  3033. { 0x0e, 0x400000fe },
  3034. { 0x0f, 0x0181e020 },
  3035. { 0x10, 0x1145e230 },
  3036. { 0x11, 0x500000fa },
  3037. { 0x15, 0x400000fc },
  3038. { 0x1b, 0x400000fb },
  3039. {}
  3040. };
  3041. static const struct hda_pintbl intel_mac_v3_pin_configs[] = {
  3042. { 0x0a, 0x0121e21f },
  3043. { 0x0b, 0x90a7012e },
  3044. { 0x0c, 0x9017e110 },
  3045. { 0x0d, 0x400000fd },
  3046. { 0x0e, 0x400000fe },
  3047. { 0x0f, 0x0181e020 },
  3048. { 0x10, 0x1145e230 },
  3049. { 0x11, 0x11c5e240 },
  3050. { 0x15, 0x400000fc },
  3051. { 0x1b, 0x400000fb },
  3052. {}
  3053. };
  3054. static const struct hda_pintbl intel_mac_v4_pin_configs[] = {
  3055. { 0x0a, 0x0321e21f },
  3056. { 0x0b, 0x03a1e02e },
  3057. { 0x0c, 0x9017e110 },
  3058. { 0x0d, 0x9017e11f },
  3059. { 0x0e, 0x400000fe },
  3060. { 0x0f, 0x0381e020 },
  3061. { 0x10, 0x1345e230 },
  3062. { 0x11, 0x13c5e240 },
  3063. { 0x15, 0x400000fc },
  3064. { 0x1b, 0x400000fb },
  3065. {}
  3066. };
  3067. static const struct hda_pintbl intel_mac_v5_pin_configs[] = {
  3068. { 0x0a, 0x0321e21f },
  3069. { 0x0b, 0x03a1e02e },
  3070. { 0x0c, 0x9017e110 },
  3071. { 0x0d, 0x9017e11f },
  3072. { 0x0e, 0x400000fe },
  3073. { 0x0f, 0x0381e020 },
  3074. { 0x10, 0x1345e230 },
  3075. { 0x11, 0x13c5e240 },
  3076. { 0x15, 0x400000fc },
  3077. { 0x1b, 0x400000fb },
  3078. {}
  3079. };
  3080. static const struct hda_pintbl ecs202_pin_configs[] = {
  3081. { 0x0a, 0x0221401f },
  3082. { 0x0b, 0x02a19020 },
  3083. { 0x0c, 0x01a19020 },
  3084. { 0x0d, 0x01114010 },
  3085. { 0x0e, 0x408000f0 },
  3086. { 0x0f, 0x01813022 },
  3087. { 0x10, 0x074510a0 },
  3088. { 0x11, 0x40c400f1 },
  3089. { 0x15, 0x9037012e },
  3090. { 0x1b, 0x40e000f2 },
  3091. {}
  3092. };
  3093. /* codec SSIDs for Intel Mac sharing the same PCI SSID 8384:7680 */
  3094. static const struct snd_pci_quirk stac922x_intel_mac_fixup_tbl[] = {
  3095. SND_PCI_QUIRK(0x0000, 0x0100, "Mac Mini", STAC_INTEL_MAC_V3),
  3096. SND_PCI_QUIRK(0x106b, 0x0800, "Mac", STAC_INTEL_MAC_V1),
  3097. SND_PCI_QUIRK(0x106b, 0x0600, "Mac", STAC_INTEL_MAC_V2),
  3098. SND_PCI_QUIRK(0x106b, 0x0700, "Mac", STAC_INTEL_MAC_V2),
  3099. SND_PCI_QUIRK(0x106b, 0x0e00, "Mac", STAC_INTEL_MAC_V3),
  3100. SND_PCI_QUIRK(0x106b, 0x0f00, "Mac", STAC_INTEL_MAC_V3),
  3101. SND_PCI_QUIRK(0x106b, 0x1600, "Mac", STAC_INTEL_MAC_V3),
  3102. SND_PCI_QUIRK(0x106b, 0x1700, "Mac", STAC_INTEL_MAC_V3),
  3103. SND_PCI_QUIRK(0x106b, 0x0200, "Mac", STAC_INTEL_MAC_V3),
  3104. SND_PCI_QUIRK(0x106b, 0x1e00, "Mac", STAC_INTEL_MAC_V3),
  3105. SND_PCI_QUIRK(0x106b, 0x1a00, "Mac", STAC_INTEL_MAC_V4),
  3106. SND_PCI_QUIRK(0x106b, 0x0a00, "Mac", STAC_INTEL_MAC_V5),
  3107. SND_PCI_QUIRK(0x106b, 0x2200, "Mac", STAC_INTEL_MAC_V5),
  3108. {}
  3109. };
  3110. static const struct hda_fixup stac922x_fixups[];
  3111. /* remap the fixup from codec SSID and apply it */
  3112. static void stac922x_fixup_intel_mac_auto(struct hda_codec *codec,
  3113. const struct hda_fixup *fix,
  3114. int action)
  3115. {
  3116. if (action != HDA_FIXUP_ACT_PRE_PROBE)
  3117. return;
  3118. snd_hda_pick_fixup(codec, NULL, stac922x_intel_mac_fixup_tbl,
  3119. stac922x_fixups);
  3120. if (codec->fixup_id != STAC_INTEL_MAC_AUTO)
  3121. snd_hda_apply_fixup(codec, action);
  3122. }
  3123. static void stac922x_fixup_intel_mac_gpio(struct hda_codec *codec,
  3124. const struct hda_fixup *fix,
  3125. int action)
  3126. {
  3127. struct sigmatel_spec *spec = codec->spec;
  3128. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  3129. spec->gpio_mask = spec->gpio_dir = 0x03;
  3130. spec->gpio_data = 0x03;
  3131. }
  3132. }
  3133. static const struct hda_fixup stac922x_fixups[] = {
  3134. [STAC_D945_REF] = {
  3135. .type = HDA_FIXUP_PINS,
  3136. .v.pins = ref922x_pin_configs,
  3137. },
  3138. [STAC_D945GTP3] = {
  3139. .type = HDA_FIXUP_PINS,
  3140. .v.pins = d945gtp3_pin_configs,
  3141. },
  3142. [STAC_D945GTP5] = {
  3143. .type = HDA_FIXUP_PINS,
  3144. .v.pins = d945gtp5_pin_configs,
  3145. },
  3146. [STAC_INTEL_MAC_AUTO] = {
  3147. .type = HDA_FIXUP_FUNC,
  3148. .v.func = stac922x_fixup_intel_mac_auto,
  3149. },
  3150. [STAC_INTEL_MAC_V1] = {
  3151. .type = HDA_FIXUP_PINS,
  3152. .v.pins = intel_mac_v1_pin_configs,
  3153. .chained = true,
  3154. .chain_id = STAC_922X_INTEL_MAC_GPIO,
  3155. },
  3156. [STAC_INTEL_MAC_V2] = {
  3157. .type = HDA_FIXUP_PINS,
  3158. .v.pins = intel_mac_v2_pin_configs,
  3159. .chained = true,
  3160. .chain_id = STAC_922X_INTEL_MAC_GPIO,
  3161. },
  3162. [STAC_INTEL_MAC_V3] = {
  3163. .type = HDA_FIXUP_PINS,
  3164. .v.pins = intel_mac_v3_pin_configs,
  3165. .chained = true,
  3166. .chain_id = STAC_922X_INTEL_MAC_GPIO,
  3167. },
  3168. [STAC_INTEL_MAC_V4] = {
  3169. .type = HDA_FIXUP_PINS,
  3170. .v.pins = intel_mac_v4_pin_configs,
  3171. .chained = true,
  3172. .chain_id = STAC_922X_INTEL_MAC_GPIO,
  3173. },
  3174. [STAC_INTEL_MAC_V5] = {
  3175. .type = HDA_FIXUP_PINS,
  3176. .v.pins = intel_mac_v5_pin_configs,
  3177. .chained = true,
  3178. .chain_id = STAC_922X_INTEL_MAC_GPIO,
  3179. },
  3180. [STAC_922X_INTEL_MAC_GPIO] = {
  3181. .type = HDA_FIXUP_FUNC,
  3182. .v.func = stac922x_fixup_intel_mac_gpio,
  3183. },
  3184. [STAC_ECS_202] = {
  3185. .type = HDA_FIXUP_PINS,
  3186. .v.pins = ecs202_pin_configs,
  3187. },
  3188. [STAC_922X_DELL_D81] = {
  3189. .type = HDA_FIXUP_PINS,
  3190. .v.pins = dell_922x_d81_pin_configs,
  3191. },
  3192. [STAC_922X_DELL_D82] = {
  3193. .type = HDA_FIXUP_PINS,
  3194. .v.pins = dell_922x_d82_pin_configs,
  3195. },
  3196. [STAC_922X_DELL_M81] = {
  3197. .type = HDA_FIXUP_PINS,
  3198. .v.pins = dell_922x_m81_pin_configs,
  3199. },
  3200. [STAC_922X_DELL_M82] = {
  3201. .type = HDA_FIXUP_PINS,
  3202. .v.pins = dell_922x_m82_pin_configs,
  3203. },
  3204. };
  3205. static const struct hda_model_fixup stac922x_models[] = {
  3206. { .id = STAC_D945_REF, .name = "ref" },
  3207. { .id = STAC_D945GTP5, .name = "5stack" },
  3208. { .id = STAC_D945GTP3, .name = "3stack" },
  3209. { .id = STAC_INTEL_MAC_V1, .name = "intel-mac-v1" },
  3210. { .id = STAC_INTEL_MAC_V2, .name = "intel-mac-v2" },
  3211. { .id = STAC_INTEL_MAC_V3, .name = "intel-mac-v3" },
  3212. { .id = STAC_INTEL_MAC_V4, .name = "intel-mac-v4" },
  3213. { .id = STAC_INTEL_MAC_V5, .name = "intel-mac-v5" },
  3214. { .id = STAC_INTEL_MAC_AUTO, .name = "intel-mac-auto" },
  3215. { .id = STAC_ECS_202, .name = "ecs202" },
  3216. { .id = STAC_922X_DELL_D81, .name = "dell-d81" },
  3217. { .id = STAC_922X_DELL_D82, .name = "dell-d82" },
  3218. { .id = STAC_922X_DELL_M81, .name = "dell-m81" },
  3219. { .id = STAC_922X_DELL_M82, .name = "dell-m82" },
  3220. /* for backward compatibility */
  3221. { .id = STAC_INTEL_MAC_V3, .name = "macmini" },
  3222. { .id = STAC_INTEL_MAC_V5, .name = "macbook" },
  3223. { .id = STAC_INTEL_MAC_V3, .name = "macbook-pro-v1" },
  3224. { .id = STAC_INTEL_MAC_V3, .name = "macbook-pro" },
  3225. { .id = STAC_INTEL_MAC_V2, .name = "imac-intel" },
  3226. { .id = STAC_INTEL_MAC_V3, .name = "imac-intel-20" },
  3227. {}
  3228. };
  3229. static const struct snd_pci_quirk stac922x_fixup_tbl[] = {
  3230. /* SigmaTel reference board */
  3231. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
  3232. "DFI LanParty", STAC_D945_REF),
  3233. SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
  3234. "DFI LanParty", STAC_D945_REF),
  3235. /* Intel 945G based systems */
  3236. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101,
  3237. "Intel D945G", STAC_D945GTP3),
  3238. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202,
  3239. "Intel D945G", STAC_D945GTP3),
  3240. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606,
  3241. "Intel D945G", STAC_D945GTP3),
  3242. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601,
  3243. "Intel D945G", STAC_D945GTP3),
  3244. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111,
  3245. "Intel D945G", STAC_D945GTP3),
  3246. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115,
  3247. "Intel D945G", STAC_D945GTP3),
  3248. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116,
  3249. "Intel D945G", STAC_D945GTP3),
  3250. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117,
  3251. "Intel D945G", STAC_D945GTP3),
  3252. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118,
  3253. "Intel D945G", STAC_D945GTP3),
  3254. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119,
  3255. "Intel D945G", STAC_D945GTP3),
  3256. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826,
  3257. "Intel D945G", STAC_D945GTP3),
  3258. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049,
  3259. "Intel D945G", STAC_D945GTP3),
  3260. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055,
  3261. "Intel D945G", STAC_D945GTP3),
  3262. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048,
  3263. "Intel D945G", STAC_D945GTP3),
  3264. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110,
  3265. "Intel D945G", STAC_D945GTP3),
  3266. /* Intel D945G 5-stack systems */
  3267. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404,
  3268. "Intel D945G", STAC_D945GTP5),
  3269. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303,
  3270. "Intel D945G", STAC_D945GTP5),
  3271. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013,
  3272. "Intel D945G", STAC_D945GTP5),
  3273. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417,
  3274. "Intel D945G", STAC_D945GTP5),
  3275. /* Intel 945P based systems */
  3276. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b,
  3277. "Intel D945P", STAC_D945GTP3),
  3278. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112,
  3279. "Intel D945P", STAC_D945GTP3),
  3280. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d,
  3281. "Intel D945P", STAC_D945GTP3),
  3282. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909,
  3283. "Intel D945P", STAC_D945GTP3),
  3284. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505,
  3285. "Intel D945P", STAC_D945GTP3),
  3286. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707,
  3287. "Intel D945P", STAC_D945GTP5),
  3288. /* other intel */
  3289. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0204,
  3290. "Intel D945", STAC_D945_REF),
  3291. /* other systems */
  3292. /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */
  3293. SND_PCI_QUIRK(0x8384, 0x7680, "Mac", STAC_INTEL_MAC_AUTO),
  3294. /* Dell systems */
  3295. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7,
  3296. "unknown Dell", STAC_922X_DELL_D81),
  3297. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a9,
  3298. "unknown Dell", STAC_922X_DELL_D81),
  3299. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ab,
  3300. "unknown Dell", STAC_922X_DELL_D81),
  3301. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ac,
  3302. "unknown Dell", STAC_922X_DELL_D82),
  3303. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bf,
  3304. "unknown Dell", STAC_922X_DELL_M81),
  3305. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d0,
  3306. "unknown Dell", STAC_922X_DELL_D82),
  3307. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d1,
  3308. "unknown Dell", STAC_922X_DELL_D81),
  3309. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d2,
  3310. "unknown Dell", STAC_922X_DELL_D81),
  3311. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7,
  3312. "Dell XPS M1210", STAC_922X_DELL_M82),
  3313. /* ECS/PC Chips boards */
  3314. SND_PCI_QUIRK_MASK(0x1019, 0xf000, 0x2000,
  3315. "ECS/PC chips", STAC_ECS_202),
  3316. {} /* terminator */
  3317. };
  3318. static const struct hda_pintbl ref927x_pin_configs[] = {
  3319. { 0x0a, 0x02214020 },
  3320. { 0x0b, 0x02a19080 },
  3321. { 0x0c, 0x0181304e },
  3322. { 0x0d, 0x01014010 },
  3323. { 0x0e, 0x01a19040 },
  3324. { 0x0f, 0x01011012 },
  3325. { 0x10, 0x01016011 },
  3326. { 0x11, 0x0101201f },
  3327. { 0x12, 0x183301f0 },
  3328. { 0x13, 0x18a001f0 },
  3329. { 0x14, 0x18a001f0 },
  3330. { 0x21, 0x01442070 },
  3331. { 0x22, 0x01c42190 },
  3332. { 0x23, 0x40000100 },
  3333. {}
  3334. };
  3335. static const struct hda_pintbl d965_3st_pin_configs[] = {
  3336. { 0x0a, 0x0221401f },
  3337. { 0x0b, 0x02a19120 },
  3338. { 0x0c, 0x40000100 },
  3339. { 0x0d, 0x01014011 },
  3340. { 0x0e, 0x01a19021 },
  3341. { 0x0f, 0x01813024 },
  3342. { 0x10, 0x40000100 },
  3343. { 0x11, 0x40000100 },
  3344. { 0x12, 0x40000100 },
  3345. { 0x13, 0x40000100 },
  3346. { 0x14, 0x40000100 },
  3347. { 0x21, 0x40000100 },
  3348. { 0x22, 0x40000100 },
  3349. { 0x23, 0x40000100 },
  3350. {}
  3351. };
  3352. static const struct hda_pintbl d965_5st_pin_configs[] = {
  3353. { 0x0a, 0x02214020 },
  3354. { 0x0b, 0x02a19080 },
  3355. { 0x0c, 0x0181304e },
  3356. { 0x0d, 0x01014010 },
  3357. { 0x0e, 0x01a19040 },
  3358. { 0x0f, 0x01011012 },
  3359. { 0x10, 0x01016011 },
  3360. { 0x11, 0x40000100 },
  3361. { 0x12, 0x40000100 },
  3362. { 0x13, 0x40000100 },
  3363. { 0x14, 0x40000100 },
  3364. { 0x21, 0x01442070 },
  3365. { 0x22, 0x40000100 },
  3366. { 0x23, 0x40000100 },
  3367. {}
  3368. };
  3369. static const struct hda_pintbl d965_5st_no_fp_pin_configs[] = {
  3370. { 0x0a, 0x40000100 },
  3371. { 0x0b, 0x40000100 },
  3372. { 0x0c, 0x0181304e },
  3373. { 0x0d, 0x01014010 },
  3374. { 0x0e, 0x01a19040 },
  3375. { 0x0f, 0x01011012 },
  3376. { 0x10, 0x01016011 },
  3377. { 0x11, 0x40000100 },
  3378. { 0x12, 0x40000100 },
  3379. { 0x13, 0x40000100 },
  3380. { 0x14, 0x40000100 },
  3381. { 0x21, 0x01442070 },
  3382. { 0x22, 0x40000100 },
  3383. { 0x23, 0x40000100 },
  3384. {}
  3385. };
  3386. static const struct hda_pintbl dell_3st_pin_configs[] = {
  3387. { 0x0a, 0x02211230 },
  3388. { 0x0b, 0x02a11220 },
  3389. { 0x0c, 0x01a19040 },
  3390. { 0x0d, 0x01114210 },
  3391. { 0x0e, 0x01111212 },
  3392. { 0x0f, 0x01116211 },
  3393. { 0x10, 0x01813050 },
  3394. { 0x11, 0x01112214 },
  3395. { 0x12, 0x403003fa },
  3396. { 0x13, 0x90a60040 },
  3397. { 0x14, 0x90a60040 },
  3398. { 0x21, 0x404003fb },
  3399. { 0x22, 0x40c003fc },
  3400. { 0x23, 0x40000100 },
  3401. {}
  3402. };
  3403. static void stac927x_fixup_ref_no_jd(struct hda_codec *codec,
  3404. const struct hda_fixup *fix, int action)
  3405. {
  3406. /* no jack detecion for ref-no-jd model */
  3407. if (action == HDA_FIXUP_ACT_PRE_PROBE)
  3408. codec->no_jack_detect = 1;
  3409. }
  3410. static void stac927x_fixup_ref(struct hda_codec *codec,
  3411. const struct hda_fixup *fix, int action)
  3412. {
  3413. struct sigmatel_spec *spec = codec->spec;
  3414. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  3415. snd_hda_apply_pincfgs(codec, ref927x_pin_configs);
  3416. spec->eapd_mask = spec->gpio_mask = 0;
  3417. spec->gpio_dir = spec->gpio_data = 0;
  3418. }
  3419. }
  3420. static void stac927x_fixup_dell_dmic(struct hda_codec *codec,
  3421. const struct hda_fixup *fix, int action)
  3422. {
  3423. struct sigmatel_spec *spec = codec->spec;
  3424. if (action != HDA_FIXUP_ACT_PRE_PROBE)
  3425. return;
  3426. if (codec->subsystem_id != 0x1028022f) {
  3427. /* GPIO2 High = Enable EAPD */
  3428. spec->eapd_mask = spec->gpio_mask = 0x04;
  3429. spec->gpio_dir = spec->gpio_data = 0x04;
  3430. }
  3431. snd_hda_add_verbs(codec, dell_3st_core_init);
  3432. spec->volknob_init = 1;
  3433. }
  3434. static void stac927x_fixup_volknob(struct hda_codec *codec,
  3435. const struct hda_fixup *fix, int action)
  3436. {
  3437. struct sigmatel_spec *spec = codec->spec;
  3438. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  3439. snd_hda_add_verbs(codec, stac927x_volknob_core_init);
  3440. spec->volknob_init = 1;
  3441. }
  3442. }
  3443. static const struct hda_fixup stac927x_fixups[] = {
  3444. [STAC_D965_REF_NO_JD] = {
  3445. .type = HDA_FIXUP_FUNC,
  3446. .v.func = stac927x_fixup_ref_no_jd,
  3447. .chained = true,
  3448. .chain_id = STAC_D965_REF,
  3449. },
  3450. [STAC_D965_REF] = {
  3451. .type = HDA_FIXUP_FUNC,
  3452. .v.func = stac927x_fixup_ref,
  3453. },
  3454. [STAC_D965_3ST] = {
  3455. .type = HDA_FIXUP_PINS,
  3456. .v.pins = d965_3st_pin_configs,
  3457. .chained = true,
  3458. .chain_id = STAC_D965_VERBS,
  3459. },
  3460. [STAC_D965_5ST] = {
  3461. .type = HDA_FIXUP_PINS,
  3462. .v.pins = d965_5st_pin_configs,
  3463. .chained = true,
  3464. .chain_id = STAC_D965_VERBS,
  3465. },
  3466. [STAC_D965_VERBS] = {
  3467. .type = HDA_FIXUP_VERBS,
  3468. .v.verbs = d965_core_init,
  3469. },
  3470. [STAC_D965_5ST_NO_FP] = {
  3471. .type = HDA_FIXUP_PINS,
  3472. .v.pins = d965_5st_no_fp_pin_configs,
  3473. },
  3474. [STAC_DELL_3ST] = {
  3475. .type = HDA_FIXUP_PINS,
  3476. .v.pins = dell_3st_pin_configs,
  3477. .chained = true,
  3478. .chain_id = STAC_927X_DELL_DMIC,
  3479. },
  3480. [STAC_DELL_BIOS] = {
  3481. .type = HDA_FIXUP_PINS,
  3482. .v.pins = (const struct hda_pintbl[]) {
  3483. /* correct the front output jack as a hp out */
  3484. { 0x0f, 0x0221101f },
  3485. /* correct the front input jack as a mic */
  3486. { 0x0e, 0x02a79130 },
  3487. {}
  3488. },
  3489. .chained = true,
  3490. .chain_id = STAC_927X_DELL_DMIC,
  3491. },
  3492. [STAC_DELL_BIOS_AMIC] = {
  3493. .type = HDA_FIXUP_PINS,
  3494. .v.pins = (const struct hda_pintbl[]) {
  3495. /* configure the analog microphone on some laptops */
  3496. { 0x0c, 0x90a79130 },
  3497. {}
  3498. },
  3499. .chained = true,
  3500. .chain_id = STAC_DELL_BIOS,
  3501. },
  3502. [STAC_DELL_BIOS_SPDIF] = {
  3503. .type = HDA_FIXUP_PINS,
  3504. .v.pins = (const struct hda_pintbl[]) {
  3505. /* correct the device field to SPDIF out */
  3506. { 0x21, 0x01442070 },
  3507. {}
  3508. },
  3509. .chained = true,
  3510. .chain_id = STAC_DELL_BIOS,
  3511. },
  3512. [STAC_927X_DELL_DMIC] = {
  3513. .type = HDA_FIXUP_FUNC,
  3514. .v.func = stac927x_fixup_dell_dmic,
  3515. },
  3516. [STAC_927X_VOLKNOB] = {
  3517. .type = HDA_FIXUP_FUNC,
  3518. .v.func = stac927x_fixup_volknob,
  3519. },
  3520. };
  3521. static const struct hda_model_fixup stac927x_models[] = {
  3522. { .id = STAC_D965_REF_NO_JD, .name = "ref-no-jd" },
  3523. { .id = STAC_D965_REF, .name = "ref" },
  3524. { .id = STAC_D965_3ST, .name = "3stack" },
  3525. { .id = STAC_D965_5ST, .name = "5stack" },
  3526. { .id = STAC_D965_5ST_NO_FP, .name = "5stack-no-fp" },
  3527. { .id = STAC_DELL_3ST, .name = "dell-3stack" },
  3528. { .id = STAC_DELL_BIOS, .name = "dell-bios" },
  3529. { .id = STAC_DELL_BIOS_AMIC, .name = "dell-bios-amic" },
  3530. { .id = STAC_927X_VOLKNOB, .name = "volknob" },
  3531. {}
  3532. };
  3533. static const struct snd_pci_quirk stac927x_fixup_tbl[] = {
  3534. /* SigmaTel reference board */
  3535. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
  3536. "DFI LanParty", STAC_D965_REF),
  3537. SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
  3538. "DFI LanParty", STAC_D965_REF),
  3539. /* Intel 946 based systems */
  3540. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST),
  3541. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST),
  3542. /* 965 based 3 stack systems */
  3543. SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2100,
  3544. "Intel D965", STAC_D965_3ST),
  3545. SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2000,
  3546. "Intel D965", STAC_D965_3ST),
  3547. /* Dell 3 stack systems */
  3548. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST),
  3549. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST),
  3550. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST),
  3551. /* Dell 3 stack systems with verb table in BIOS */
  3552. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS),
  3553. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_BIOS),
  3554. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS),
  3555. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS_SPDIF),
  3556. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell Inspiron 1525", STAC_DELL_BIOS),
  3557. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS),
  3558. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS),
  3559. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS),
  3560. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS_SPDIF),
  3561. /* 965 based 5 stack systems */
  3562. SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2300,
  3563. "Intel D965", STAC_D965_5ST),
  3564. SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500,
  3565. "Intel D965", STAC_D965_5ST),
  3566. /* volume-knob fixes */
  3567. SND_PCI_QUIRK_VENDOR(0x10cf, "FSC", STAC_927X_VOLKNOB),
  3568. {} /* terminator */
  3569. };
  3570. static const struct hda_pintbl ref9205_pin_configs[] = {
  3571. { 0x0a, 0x40000100 },
  3572. { 0x0b, 0x40000100 },
  3573. { 0x0c, 0x01016011 },
  3574. { 0x0d, 0x01014010 },
  3575. { 0x0e, 0x01813122 },
  3576. { 0x0f, 0x01a19021 },
  3577. { 0x14, 0x01019020 },
  3578. { 0x16, 0x40000100 },
  3579. { 0x17, 0x90a000f0 },
  3580. { 0x18, 0x90a000f0 },
  3581. { 0x21, 0x01441030 },
  3582. { 0x22, 0x01c41030 },
  3583. {}
  3584. };
  3585. /*
  3586. STAC 9205 pin configs for
  3587. 102801F1
  3588. 102801F2
  3589. 102801FC
  3590. 102801FD
  3591. 10280204
  3592. 1028021F
  3593. 10280228 (Dell Vostro 1500)
  3594. 10280229 (Dell Vostro 1700)
  3595. */
  3596. static const struct hda_pintbl dell_9205_m42_pin_configs[] = {
  3597. { 0x0a, 0x0321101F },
  3598. { 0x0b, 0x03A11020 },
  3599. { 0x0c, 0x400003FA },
  3600. { 0x0d, 0x90170310 },
  3601. { 0x0e, 0x400003FB },
  3602. { 0x0f, 0x400003FC },
  3603. { 0x14, 0x400003FD },
  3604. { 0x16, 0x40F000F9 },
  3605. { 0x17, 0x90A60330 },
  3606. { 0x18, 0x400003FF },
  3607. { 0x21, 0x0144131F },
  3608. { 0x22, 0x40C003FE },
  3609. {}
  3610. };
  3611. /*
  3612. STAC 9205 pin configs for
  3613. 102801F9
  3614. 102801FA
  3615. 102801FE
  3616. 102801FF (Dell Precision M4300)
  3617. 10280206
  3618. 10280200
  3619. 10280201
  3620. */
  3621. static const struct hda_pintbl dell_9205_m43_pin_configs[] = {
  3622. { 0x0a, 0x0321101f },
  3623. { 0x0b, 0x03a11020 },
  3624. { 0x0c, 0x90a70330 },
  3625. { 0x0d, 0x90170310 },
  3626. { 0x0e, 0x400000fe },
  3627. { 0x0f, 0x400000ff },
  3628. { 0x14, 0x400000fd },
  3629. { 0x16, 0x40f000f9 },
  3630. { 0x17, 0x400000fa },
  3631. { 0x18, 0x400000fc },
  3632. { 0x21, 0x0144131f },
  3633. { 0x22, 0x40c003f8 },
  3634. /* Enable SPDIF in/out */
  3635. { 0x1f, 0x01441030 },
  3636. { 0x20, 0x1c410030 },
  3637. {}
  3638. };
  3639. static const struct hda_pintbl dell_9205_m44_pin_configs[] = {
  3640. { 0x0a, 0x0421101f },
  3641. { 0x0b, 0x04a11020 },
  3642. { 0x0c, 0x400003fa },
  3643. { 0x0d, 0x90170310 },
  3644. { 0x0e, 0x400003fb },
  3645. { 0x0f, 0x400003fc },
  3646. { 0x14, 0x400003fd },
  3647. { 0x16, 0x400003f9 },
  3648. { 0x17, 0x90a60330 },
  3649. { 0x18, 0x400003ff },
  3650. { 0x21, 0x01441340 },
  3651. { 0x22, 0x40c003fe },
  3652. {}
  3653. };
  3654. static void stac9205_fixup_ref(struct hda_codec *codec,
  3655. const struct hda_fixup *fix, int action)
  3656. {
  3657. struct sigmatel_spec *spec = codec->spec;
  3658. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  3659. snd_hda_apply_pincfgs(codec, ref9205_pin_configs);
  3660. /* SPDIF-In enabled */
  3661. spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0;
  3662. }
  3663. }
  3664. static void stac9205_fixup_dell_m43(struct hda_codec *codec,
  3665. const struct hda_fixup *fix, int action)
  3666. {
  3667. struct sigmatel_spec *spec = codec->spec;
  3668. struct hda_jack_tbl *jack;
  3669. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  3670. snd_hda_apply_pincfgs(codec, dell_9205_m43_pin_configs);
  3671. /* Enable unsol response for GPIO4/Dock HP connection */
  3672. snd_hda_codec_write_cache(codec, codec->afg, 0,
  3673. AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10);
  3674. snd_hda_jack_detect_enable_callback(codec, codec->afg,
  3675. STAC_VREF_EVENT,
  3676. stac_vref_event);
  3677. jack = snd_hda_jack_tbl_get(codec, codec->afg);
  3678. if (jack)
  3679. jack->private_data = 0x01;
  3680. spec->gpio_dir = 0x0b;
  3681. spec->eapd_mask = 0x01;
  3682. spec->gpio_mask = 0x1b;
  3683. spec->gpio_mute = 0x10;
  3684. /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute,
  3685. * GPIO3 Low = DRM
  3686. */
  3687. spec->gpio_data = 0x01;
  3688. }
  3689. }
  3690. static void stac9205_fixup_eapd(struct hda_codec *codec,
  3691. const struct hda_fixup *fix, int action)
  3692. {
  3693. struct sigmatel_spec *spec = codec->spec;
  3694. if (action == HDA_FIXUP_ACT_PRE_PROBE)
  3695. spec->eapd_switch = 0;
  3696. }
  3697. static const struct hda_fixup stac9205_fixups[] = {
  3698. [STAC_9205_REF] = {
  3699. .type = HDA_FIXUP_FUNC,
  3700. .v.func = stac9205_fixup_ref,
  3701. },
  3702. [STAC_9205_DELL_M42] = {
  3703. .type = HDA_FIXUP_PINS,
  3704. .v.pins = dell_9205_m42_pin_configs,
  3705. },
  3706. [STAC_9205_DELL_M43] = {
  3707. .type = HDA_FIXUP_FUNC,
  3708. .v.func = stac9205_fixup_dell_m43,
  3709. },
  3710. [STAC_9205_DELL_M44] = {
  3711. .type = HDA_FIXUP_PINS,
  3712. .v.pins = dell_9205_m44_pin_configs,
  3713. },
  3714. [STAC_9205_EAPD] = {
  3715. .type = HDA_FIXUP_FUNC,
  3716. .v.func = stac9205_fixup_eapd,
  3717. },
  3718. {}
  3719. };
  3720. static const struct hda_model_fixup stac9205_models[] = {
  3721. { .id = STAC_9205_REF, .name = "ref" },
  3722. { .id = STAC_9205_DELL_M42, .name = "dell-m42" },
  3723. { .id = STAC_9205_DELL_M43, .name = "dell-m43" },
  3724. { .id = STAC_9205_DELL_M44, .name = "dell-m44" },
  3725. { .id = STAC_9205_EAPD, .name = "eapd" },
  3726. {}
  3727. };
  3728. static const struct snd_pci_quirk stac9205_fixup_tbl[] = {
  3729. /* SigmaTel reference board */
  3730. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
  3731. "DFI LanParty", STAC_9205_REF),
  3732. SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xfb30,
  3733. "SigmaTel", STAC_9205_REF),
  3734. SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
  3735. "DFI LanParty", STAC_9205_REF),
  3736. /* Dell */
  3737. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1,
  3738. "unknown Dell", STAC_9205_DELL_M42),
  3739. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2,
  3740. "unknown Dell", STAC_9205_DELL_M42),
  3741. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8,
  3742. "Dell Precision", STAC_9205_DELL_M43),
  3743. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9,
  3744. "Dell Precision", STAC_9205_DELL_M43),
  3745. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa,
  3746. "Dell Precision", STAC_9205_DELL_M43),
  3747. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc,
  3748. "unknown Dell", STAC_9205_DELL_M42),
  3749. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd,
  3750. "unknown Dell", STAC_9205_DELL_M42),
  3751. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fe,
  3752. "Dell Precision", STAC_9205_DELL_M43),
  3753. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff,
  3754. "Dell Precision M4300", STAC_9205_DELL_M43),
  3755. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204,
  3756. "unknown Dell", STAC_9205_DELL_M42),
  3757. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206,
  3758. "Dell Precision", STAC_9205_DELL_M43),
  3759. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b,
  3760. "Dell Precision", STAC_9205_DELL_M43),
  3761. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c,
  3762. "Dell Precision", STAC_9205_DELL_M43),
  3763. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f,
  3764. "Dell Inspiron", STAC_9205_DELL_M44),
  3765. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228,
  3766. "Dell Vostro 1500", STAC_9205_DELL_M42),
  3767. SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0229,
  3768. "Dell Vostro 1700", STAC_9205_DELL_M42),
  3769. /* Gateway */
  3770. SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD),
  3771. SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD),
  3772. {} /* terminator */
  3773. };
  3774. static int stac_parse_auto_config(struct hda_codec *codec)
  3775. {
  3776. struct sigmatel_spec *spec = codec->spec;
  3777. int err;
  3778. int flags = 0;
  3779. if (spec->headset_jack)
  3780. flags |= HDA_PINCFG_HEADSET_MIC;
  3781. err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL, flags);
  3782. if (err < 0)
  3783. return err;
  3784. /* add hooks */
  3785. spec->gen.pcm_playback_hook = stac_playback_pcm_hook;
  3786. spec->gen.pcm_capture_hook = stac_capture_pcm_hook;
  3787. spec->gen.automute_hook = stac_update_outputs;
  3788. spec->gen.hp_automute_hook = stac_hp_automute;
  3789. spec->gen.line_automute_hook = stac_line_automute;
  3790. spec->gen.mic_autoswitch_hook = stac_mic_autoswitch;
  3791. err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg);
  3792. if (err < 0)
  3793. return err;
  3794. /* minimum value is actually mute */
  3795. spec->gen.vmaster_tlv[3] |= TLV_DB_SCALE_MUTE;
  3796. /* setup analog beep controls */
  3797. if (spec->anabeep_nid > 0) {
  3798. err = stac_auto_create_beep_ctls(codec,
  3799. spec->anabeep_nid);
  3800. if (err < 0)
  3801. return err;
  3802. }
  3803. /* setup digital beep controls and input device */
  3804. #ifdef CONFIG_SND_HDA_INPUT_BEEP
  3805. if (spec->gen.beep_nid) {
  3806. hda_nid_t nid = spec->gen.beep_nid;
  3807. unsigned int caps;
  3808. err = stac_auto_create_beep_ctls(codec, nid);
  3809. if (err < 0)
  3810. return err;
  3811. if (codec->beep) {
  3812. /* IDT/STAC codecs have linear beep tone parameter */
  3813. codec->beep->linear_tone = spec->linear_tone_beep;
  3814. /* if no beep switch is available, make its own one */
  3815. caps = query_amp_caps(codec, nid, HDA_OUTPUT);
  3816. if (!(caps & AC_AMPCAP_MUTE)) {
  3817. err = stac_beep_switch_ctl(codec);
  3818. if (err < 0)
  3819. return err;
  3820. }
  3821. }
  3822. }
  3823. #endif
  3824. if (spec->gpio_led)
  3825. spec->gen.vmaster_mute.hook = stac_vmaster_hook;
  3826. if (spec->aloopback_ctl &&
  3827. snd_hda_get_bool_hint(codec, "loopback") == 1) {
  3828. if (!snd_hda_gen_add_kctl(&spec->gen, NULL, spec->aloopback_ctl))
  3829. return -ENOMEM;
  3830. }
  3831. if (spec->have_spdif_mux) {
  3832. err = stac_create_spdif_mux_ctls(codec);
  3833. if (err < 0)
  3834. return err;
  3835. }
  3836. stac_init_power_map(codec);
  3837. return 0;
  3838. }
  3839. static int stac_init(struct hda_codec *codec)
  3840. {
  3841. struct sigmatel_spec *spec = codec->spec;
  3842. int i;
  3843. /* override some hints */
  3844. stac_store_hints(codec);
  3845. /* set up GPIO */
  3846. /* turn on EAPD statically when spec->eapd_switch isn't set.
  3847. * otherwise, unsol event will turn it on/off dynamically
  3848. */
  3849. if (!spec->eapd_switch)
  3850. spec->gpio_data |= spec->eapd_mask;
  3851. stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data);
  3852. snd_hda_gen_init(codec);
  3853. /* sync the power-map */
  3854. if (spec->num_pwrs)
  3855. snd_hda_codec_write(codec, codec->afg, 0,
  3856. AC_VERB_IDT_SET_POWER_MAP,
  3857. spec->power_map_bits);
  3858. /* power down inactive ADCs */
  3859. if (spec->powerdown_adcs) {
  3860. for (i = 0; i < spec->gen.num_all_adcs; i++) {
  3861. if (spec->active_adcs & (1 << i))
  3862. continue;
  3863. snd_hda_codec_write(codec, spec->gen.all_adcs[i], 0,
  3864. AC_VERB_SET_POWER_STATE,
  3865. AC_PWRST_D3);
  3866. }
  3867. }
  3868. return 0;
  3869. }
  3870. static void stac_shutup(struct hda_codec *codec)
  3871. {
  3872. struct sigmatel_spec *spec = codec->spec;
  3873. snd_hda_shutup_pins(codec);
  3874. if (spec->eapd_mask)
  3875. stac_gpio_set(codec, spec->gpio_mask,
  3876. spec->gpio_dir, spec->gpio_data &
  3877. ~spec->eapd_mask);
  3878. }
  3879. #define stac_free snd_hda_gen_free
  3880. #ifdef CONFIG_PROC_FS
  3881. static void stac92hd_proc_hook(struct snd_info_buffer *buffer,
  3882. struct hda_codec *codec, hda_nid_t nid)
  3883. {
  3884. if (nid == codec->afg)
  3885. snd_iprintf(buffer, "Power-Map: 0x%02x\n",
  3886. snd_hda_codec_read(codec, nid, 0,
  3887. AC_VERB_IDT_GET_POWER_MAP, 0));
  3888. }
  3889. static void analog_loop_proc_hook(struct snd_info_buffer *buffer,
  3890. struct hda_codec *codec,
  3891. unsigned int verb)
  3892. {
  3893. snd_iprintf(buffer, "Analog Loopback: 0x%02x\n",
  3894. snd_hda_codec_read(codec, codec->afg, 0, verb, 0));
  3895. }
  3896. /* stac92hd71bxx, stac92hd73xx */
  3897. static void stac92hd7x_proc_hook(struct snd_info_buffer *buffer,
  3898. struct hda_codec *codec, hda_nid_t nid)
  3899. {
  3900. stac92hd_proc_hook(buffer, codec, nid);
  3901. if (nid == codec->afg)
  3902. analog_loop_proc_hook(buffer, codec, 0xfa0);
  3903. }
  3904. static void stac9205_proc_hook(struct snd_info_buffer *buffer,
  3905. struct hda_codec *codec, hda_nid_t nid)
  3906. {
  3907. if (nid == codec->afg)
  3908. analog_loop_proc_hook(buffer, codec, 0xfe0);
  3909. }
  3910. static void stac927x_proc_hook(struct snd_info_buffer *buffer,
  3911. struct hda_codec *codec, hda_nid_t nid)
  3912. {
  3913. if (nid == codec->afg)
  3914. analog_loop_proc_hook(buffer, codec, 0xfeb);
  3915. }
  3916. #else
  3917. #define stac92hd_proc_hook NULL
  3918. #define stac92hd7x_proc_hook NULL
  3919. #define stac9205_proc_hook NULL
  3920. #define stac927x_proc_hook NULL
  3921. #endif
  3922. #ifdef CONFIG_PM
  3923. static int stac_suspend(struct hda_codec *codec)
  3924. {
  3925. stac_shutup(codec);
  3926. return 0;
  3927. }
  3928. #else
  3929. #define stac_suspend NULL
  3930. #endif /* CONFIG_PM */
  3931. static const struct hda_codec_ops stac_patch_ops = {
  3932. .build_controls = snd_hda_gen_build_controls,
  3933. .build_pcms = snd_hda_gen_build_pcms,
  3934. .init = stac_init,
  3935. .free = stac_free,
  3936. .unsol_event = snd_hda_jack_unsol_event,
  3937. #ifdef CONFIG_PM
  3938. .suspend = stac_suspend,
  3939. #endif
  3940. .reboot_notify = stac_shutup,
  3941. };
  3942. static int alloc_stac_spec(struct hda_codec *codec)
  3943. {
  3944. struct sigmatel_spec *spec;
  3945. spec = kzalloc(sizeof(*spec), GFP_KERNEL);
  3946. if (!spec)
  3947. return -ENOMEM;
  3948. snd_hda_gen_spec_init(&spec->gen);
  3949. codec->spec = spec;
  3950. codec->no_trigger_sense = 1; /* seems common with STAC/IDT codecs */
  3951. return 0;
  3952. }
  3953. static int patch_stac9200(struct hda_codec *codec)
  3954. {
  3955. struct sigmatel_spec *spec;
  3956. int err;
  3957. err = alloc_stac_spec(codec);
  3958. if (err < 0)
  3959. return err;
  3960. spec = codec->spec;
  3961. spec->linear_tone_beep = 1;
  3962. spec->gen.own_eapd_ctl = 1;
  3963. codec->patch_ops = stac_patch_ops;
  3964. codec->power_filter = snd_hda_codec_eapd_power_filter;
  3965. snd_hda_add_verbs(codec, stac9200_eapd_init);
  3966. snd_hda_pick_fixup(codec, stac9200_models, stac9200_fixup_tbl,
  3967. stac9200_fixups);
  3968. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  3969. err = stac_parse_auto_config(codec);
  3970. if (err < 0) {
  3971. stac_free(codec);
  3972. return err;
  3973. }
  3974. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  3975. return 0;
  3976. }
  3977. static int patch_stac925x(struct hda_codec *codec)
  3978. {
  3979. struct sigmatel_spec *spec;
  3980. int err;
  3981. err = alloc_stac_spec(codec);
  3982. if (err < 0)
  3983. return err;
  3984. spec = codec->spec;
  3985. spec->linear_tone_beep = 1;
  3986. spec->gen.own_eapd_ctl = 1;
  3987. codec->patch_ops = stac_patch_ops;
  3988. snd_hda_add_verbs(codec, stac925x_core_init);
  3989. snd_hda_pick_fixup(codec, stac925x_models, stac925x_fixup_tbl,
  3990. stac925x_fixups);
  3991. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  3992. err = stac_parse_auto_config(codec);
  3993. if (err < 0) {
  3994. stac_free(codec);
  3995. return err;
  3996. }
  3997. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  3998. return 0;
  3999. }
  4000. static int patch_stac92hd73xx(struct hda_codec *codec)
  4001. {
  4002. struct sigmatel_spec *spec;
  4003. int err;
  4004. int num_dacs;
  4005. err = alloc_stac_spec(codec);
  4006. if (err < 0)
  4007. return err;
  4008. spec = codec->spec;
  4009. spec->linear_tone_beep = 0;
  4010. spec->gen.mixer_nid = 0x1d;
  4011. spec->have_spdif_mux = 1;
  4012. num_dacs = snd_hda_get_num_conns(codec, 0x0a) - 1;
  4013. if (num_dacs < 3 || num_dacs > 5) {
  4014. printk(KERN_WARNING "hda_codec: Could not determine "
  4015. "number of channels defaulting to DAC count\n");
  4016. num_dacs = 5;
  4017. }
  4018. switch (num_dacs) {
  4019. case 0x3: /* 6 Channel */
  4020. spec->aloopback_ctl = &stac92hd73xx_6ch_loopback;
  4021. break;
  4022. case 0x4: /* 8 Channel */
  4023. spec->aloopback_ctl = &stac92hd73xx_8ch_loopback;
  4024. break;
  4025. case 0x5: /* 10 Channel */
  4026. spec->aloopback_ctl = &stac92hd73xx_10ch_loopback;
  4027. break;
  4028. }
  4029. spec->aloopback_mask = 0x01;
  4030. spec->aloopback_shift = 8;
  4031. spec->gen.beep_nid = 0x1c; /* digital beep */
  4032. /* GPIO0 High = Enable EAPD */
  4033. spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
  4034. spec->gpio_data = 0x01;
  4035. spec->eapd_switch = 1;
  4036. spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids);
  4037. spec->pwr_nids = stac92hd73xx_pwr_nids;
  4038. spec->gen.own_eapd_ctl = 1;
  4039. spec->gen.power_down_unused = 1;
  4040. codec->patch_ops = stac_patch_ops;
  4041. snd_hda_pick_fixup(codec, stac92hd73xx_models, stac92hd73xx_fixup_tbl,
  4042. stac92hd73xx_fixups);
  4043. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  4044. if (!spec->volknob_init)
  4045. snd_hda_add_verbs(codec, stac92hd73xx_core_init);
  4046. err = stac_parse_auto_config(codec);
  4047. if (err < 0) {
  4048. stac_free(codec);
  4049. return err;
  4050. }
  4051. /* Don't GPIO-mute speakers if there are no internal speakers, because
  4052. * the GPIO might be necessary for Headphone
  4053. */
  4054. if (spec->eapd_switch && !has_builtin_speaker(codec))
  4055. spec->eapd_switch = 0;
  4056. codec->proc_widget_hook = stac92hd7x_proc_hook;
  4057. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  4058. return 0;
  4059. }
  4060. static void stac_setup_gpio(struct hda_codec *codec)
  4061. {
  4062. struct sigmatel_spec *spec = codec->spec;
  4063. spec->gpio_mask |= spec->eapd_mask;
  4064. if (spec->gpio_led) {
  4065. if (!spec->vref_mute_led_nid) {
  4066. spec->gpio_mask |= spec->gpio_led;
  4067. spec->gpio_dir |= spec->gpio_led;
  4068. spec->gpio_data |= spec->gpio_led;
  4069. } else {
  4070. codec->power_filter = stac_vref_led_power_filter;
  4071. }
  4072. }
  4073. if (spec->mic_mute_led_gpio) {
  4074. spec->gpio_mask |= spec->mic_mute_led_gpio;
  4075. spec->gpio_dir |= spec->mic_mute_led_gpio;
  4076. spec->mic_enabled = 0;
  4077. spec->gpio_data |= spec->mic_mute_led_gpio;
  4078. spec->gen.cap_sync_hook = stac_capture_led_hook;
  4079. }
  4080. }
  4081. static int patch_stac92hd83xxx(struct hda_codec *codec)
  4082. {
  4083. struct sigmatel_spec *spec;
  4084. int err;
  4085. err = alloc_stac_spec(codec);
  4086. if (err < 0)
  4087. return err;
  4088. codec->epss = 0; /* longer delay needed for D3 */
  4089. spec = codec->spec;
  4090. spec->linear_tone_beep = 0;
  4091. spec->gen.own_eapd_ctl = 1;
  4092. spec->gen.power_down_unused = 1;
  4093. spec->gen.mixer_nid = 0x1b;
  4094. spec->gen.beep_nid = 0x21; /* digital beep */
  4095. spec->pwr_nids = stac92hd83xxx_pwr_nids;
  4096. spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids);
  4097. spec->default_polarity = -1; /* no default cfg */
  4098. codec->patch_ops = stac_patch_ops;
  4099. snd_hda_add_verbs(codec, stac92hd83xxx_core_init);
  4100. snd_hda_pick_fixup(codec, stac92hd83xxx_models, stac92hd83xxx_fixup_tbl,
  4101. stac92hd83xxx_fixups);
  4102. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  4103. stac_setup_gpio(codec);
  4104. err = stac_parse_auto_config(codec);
  4105. if (err < 0) {
  4106. stac_free(codec);
  4107. return err;
  4108. }
  4109. codec->proc_widget_hook = stac92hd_proc_hook;
  4110. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  4111. return 0;
  4112. }
  4113. static const hda_nid_t stac92hd95_pwr_nids[] = {
  4114. 0x0a, 0x0b, 0x0c, 0x0d
  4115. };
  4116. static int patch_stac92hd95(struct hda_codec *codec)
  4117. {
  4118. struct sigmatel_spec *spec;
  4119. int err;
  4120. err = alloc_stac_spec(codec);
  4121. if (err < 0)
  4122. return err;
  4123. codec->epss = 0; /* longer delay needed for D3 */
  4124. spec = codec->spec;
  4125. spec->linear_tone_beep = 0;
  4126. spec->gen.own_eapd_ctl = 1;
  4127. spec->gen.power_down_unused = 1;
  4128. spec->gen.beep_nid = 0x19; /* digital beep */
  4129. spec->pwr_nids = stac92hd95_pwr_nids;
  4130. spec->num_pwrs = ARRAY_SIZE(stac92hd95_pwr_nids);
  4131. spec->default_polarity = -1; /* no default cfg */
  4132. codec->patch_ops = stac_patch_ops;
  4133. err = stac_parse_auto_config(codec);
  4134. if (err < 0) {
  4135. stac_free(codec);
  4136. return err;
  4137. }
  4138. codec->proc_widget_hook = stac92hd_proc_hook;
  4139. return 0;
  4140. }
  4141. static int patch_stac92hd71bxx(struct hda_codec *codec)
  4142. {
  4143. struct sigmatel_spec *spec;
  4144. const struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init;
  4145. int err;
  4146. err = alloc_stac_spec(codec);
  4147. if (err < 0)
  4148. return err;
  4149. spec = codec->spec;
  4150. spec->linear_tone_beep = 0;
  4151. spec->gen.own_eapd_ctl = 1;
  4152. spec->gen.power_down_unused = 1;
  4153. spec->gen.mixer_nid = 0x17;
  4154. spec->have_spdif_mux = 1;
  4155. codec->patch_ops = stac_patch_ops;
  4156. /* GPIO0 = EAPD */
  4157. spec->gpio_mask = 0x01;
  4158. spec->gpio_dir = 0x01;
  4159. spec->gpio_data = 0x01;
  4160. switch (codec->vendor_id) {
  4161. case 0x111d76b6: /* 4 Port without Analog Mixer */
  4162. case 0x111d76b7:
  4163. unmute_init++;
  4164. break;
  4165. case 0x111d7608: /* 5 Port with Analog Mixer */
  4166. if ((codec->revision_id & 0xf) == 0 ||
  4167. (codec->revision_id & 0xf) == 1)
  4168. spec->stream_delay = 40; /* 40 milliseconds */
  4169. /* disable VSW */
  4170. unmute_init++;
  4171. snd_hda_codec_set_pincfg(codec, 0x0f, 0x40f000f0);
  4172. snd_hda_codec_set_pincfg(codec, 0x19, 0x40f000f3);
  4173. break;
  4174. case 0x111d7603: /* 6 Port with Analog Mixer */
  4175. if ((codec->revision_id & 0xf) == 1)
  4176. spec->stream_delay = 40; /* 40 milliseconds */
  4177. break;
  4178. }
  4179. if (get_wcaps_type(get_wcaps(codec, 0x28)) == AC_WID_VOL_KNB)
  4180. snd_hda_add_verbs(codec, stac92hd71bxx_core_init);
  4181. if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP)
  4182. snd_hda_sequence_write_cache(codec, unmute_init);
  4183. spec->aloopback_ctl = &stac92hd71bxx_loopback;
  4184. spec->aloopback_mask = 0x50;
  4185. spec->aloopback_shift = 0;
  4186. spec->powerdown_adcs = 1;
  4187. spec->gen.beep_nid = 0x26; /* digital beep */
  4188. spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids);
  4189. spec->pwr_nids = stac92hd71bxx_pwr_nids;
  4190. snd_hda_pick_fixup(codec, stac92hd71bxx_models, stac92hd71bxx_fixup_tbl,
  4191. stac92hd71bxx_fixups);
  4192. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  4193. stac_setup_gpio(codec);
  4194. err = stac_parse_auto_config(codec);
  4195. if (err < 0) {
  4196. stac_free(codec);
  4197. return err;
  4198. }
  4199. codec->proc_widget_hook = stac92hd7x_proc_hook;
  4200. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  4201. return 0;
  4202. }
  4203. static int patch_stac922x(struct hda_codec *codec)
  4204. {
  4205. struct sigmatel_spec *spec;
  4206. int err;
  4207. err = alloc_stac_spec(codec);
  4208. if (err < 0)
  4209. return err;
  4210. spec = codec->spec;
  4211. spec->linear_tone_beep = 1;
  4212. spec->gen.own_eapd_ctl = 1;
  4213. codec->patch_ops = stac_patch_ops;
  4214. snd_hda_add_verbs(codec, stac922x_core_init);
  4215. /* Fix Mux capture level; max to 2 */
  4216. snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
  4217. (0 << AC_AMPCAP_OFFSET_SHIFT) |
  4218. (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
  4219. (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
  4220. (0 << AC_AMPCAP_MUTE_SHIFT));
  4221. snd_hda_pick_fixup(codec, stac922x_models, stac922x_fixup_tbl,
  4222. stac922x_fixups);
  4223. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  4224. err = stac_parse_auto_config(codec);
  4225. if (err < 0) {
  4226. stac_free(codec);
  4227. return err;
  4228. }
  4229. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  4230. return 0;
  4231. }
  4232. static const char * const stac927x_spdif_labels[] = {
  4233. "Digital Playback", "ADAT", "Analog Mux 1",
  4234. "Analog Mux 2", "Analog Mux 3", NULL
  4235. };
  4236. static int patch_stac927x(struct hda_codec *codec)
  4237. {
  4238. struct sigmatel_spec *spec;
  4239. int err;
  4240. err = alloc_stac_spec(codec);
  4241. if (err < 0)
  4242. return err;
  4243. spec = codec->spec;
  4244. spec->linear_tone_beep = 1;
  4245. spec->gen.own_eapd_ctl = 1;
  4246. spec->have_spdif_mux = 1;
  4247. spec->spdif_labels = stac927x_spdif_labels;
  4248. spec->gen.beep_nid = 0x23; /* digital beep */
  4249. /* GPIO0 High = Enable EAPD */
  4250. spec->eapd_mask = spec->gpio_mask = 0x01;
  4251. spec->gpio_dir = spec->gpio_data = 0x01;
  4252. spec->aloopback_ctl = &stac927x_loopback;
  4253. spec->aloopback_mask = 0x40;
  4254. spec->aloopback_shift = 0;
  4255. spec->eapd_switch = 1;
  4256. codec->patch_ops = stac_patch_ops;
  4257. snd_hda_pick_fixup(codec, stac927x_models, stac927x_fixup_tbl,
  4258. stac927x_fixups);
  4259. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  4260. if (!spec->volknob_init)
  4261. snd_hda_add_verbs(codec, stac927x_core_init);
  4262. err = stac_parse_auto_config(codec);
  4263. if (err < 0) {
  4264. stac_free(codec);
  4265. return err;
  4266. }
  4267. codec->proc_widget_hook = stac927x_proc_hook;
  4268. /*
  4269. * !!FIXME!!
  4270. * The STAC927x seem to require fairly long delays for certain
  4271. * command sequences. With too short delays (even if the answer
  4272. * is set to RIRB properly), it results in the silence output
  4273. * on some hardwares like Dell.
  4274. *
  4275. * The below flag enables the longer delay (see get_response
  4276. * in hda_intel.c).
  4277. */
  4278. codec->bus->needs_damn_long_delay = 1;
  4279. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  4280. return 0;
  4281. }
  4282. static int patch_stac9205(struct hda_codec *codec)
  4283. {
  4284. struct sigmatel_spec *spec;
  4285. int err;
  4286. err = alloc_stac_spec(codec);
  4287. if (err < 0)
  4288. return err;
  4289. spec = codec->spec;
  4290. spec->linear_tone_beep = 1;
  4291. spec->gen.own_eapd_ctl = 1;
  4292. spec->have_spdif_mux = 1;
  4293. spec->gen.beep_nid = 0x23; /* digital beep */
  4294. snd_hda_add_verbs(codec, stac9205_core_init);
  4295. spec->aloopback_ctl = &stac9205_loopback;
  4296. spec->aloopback_mask = 0x40;
  4297. spec->aloopback_shift = 0;
  4298. /* GPIO0 High = EAPD */
  4299. spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
  4300. spec->gpio_data = 0x01;
  4301. /* Turn on/off EAPD per HP plugging */
  4302. spec->eapd_switch = 1;
  4303. codec->patch_ops = stac_patch_ops;
  4304. snd_hda_pick_fixup(codec, stac9205_models, stac9205_fixup_tbl,
  4305. stac9205_fixups);
  4306. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  4307. err = stac_parse_auto_config(codec);
  4308. if (err < 0) {
  4309. stac_free(codec);
  4310. return err;
  4311. }
  4312. codec->proc_widget_hook = stac9205_proc_hook;
  4313. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  4314. return 0;
  4315. }
  4316. /*
  4317. * STAC9872 hack
  4318. */
  4319. static const struct hda_verb stac9872_core_init[] = {
  4320. {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
  4321. {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
  4322. {}
  4323. };
  4324. static const struct hda_pintbl stac9872_vaio_pin_configs[] = {
  4325. { 0x0a, 0x03211020 },
  4326. { 0x0b, 0x411111f0 },
  4327. { 0x0c, 0x411111f0 },
  4328. { 0x0d, 0x03a15030 },
  4329. { 0x0e, 0x411111f0 },
  4330. { 0x0f, 0x90170110 },
  4331. { 0x11, 0x411111f0 },
  4332. { 0x13, 0x411111f0 },
  4333. { 0x14, 0x90a7013e },
  4334. {}
  4335. };
  4336. static const struct hda_model_fixup stac9872_models[] = {
  4337. { .id = STAC_9872_VAIO, .name = "vaio" },
  4338. {}
  4339. };
  4340. static const struct hda_fixup stac9872_fixups[] = {
  4341. [STAC_9872_VAIO] = {
  4342. .type = HDA_FIXUP_PINS,
  4343. .v.pins = stac9872_vaio_pin_configs,
  4344. },
  4345. };
  4346. static const struct snd_pci_quirk stac9872_fixup_tbl[] = {
  4347. SND_PCI_QUIRK_MASK(0x104d, 0xfff0, 0x81e0,
  4348. "Sony VAIO F/S", STAC_9872_VAIO),
  4349. {} /* terminator */
  4350. };
  4351. static int patch_stac9872(struct hda_codec *codec)
  4352. {
  4353. struct sigmatel_spec *spec;
  4354. int err;
  4355. err = alloc_stac_spec(codec);
  4356. if (err < 0)
  4357. return err;
  4358. spec = codec->spec;
  4359. spec->linear_tone_beep = 1;
  4360. spec->gen.own_eapd_ctl = 1;
  4361. codec->patch_ops = stac_patch_ops;
  4362. snd_hda_add_verbs(codec, stac9872_core_init);
  4363. snd_hda_pick_fixup(codec, stac9872_models, stac9872_fixup_tbl,
  4364. stac9872_fixups);
  4365. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  4366. err = stac_parse_auto_config(codec);
  4367. if (err < 0) {
  4368. stac_free(codec);
  4369. return -EINVAL;
  4370. }
  4371. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  4372. return 0;
  4373. }
  4374. /*
  4375. * patch entries
  4376. */
  4377. static const struct hda_codec_preset snd_hda_preset_sigmatel[] = {
  4378. { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 },
  4379. { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x },
  4380. { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x },
  4381. { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x },
  4382. { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x },
  4383. { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x },
  4384. { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x },
  4385. { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x },
  4386. { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x },
  4387. { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x },
  4388. { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x },
  4389. { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x },
  4390. { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x },
  4391. { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x },
  4392. { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x },
  4393. { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x },
  4394. { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x },
  4395. { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x },
  4396. { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x },
  4397. { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x },
  4398. { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x },
  4399. { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x },
  4400. { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x },
  4401. { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x },
  4402. { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x },
  4403. { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x },
  4404. { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x },
  4405. { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x },
  4406. { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x },
  4407. { .id = 0x83847645, .name = "92HD206X", .patch = patch_stac927x },
  4408. { .id = 0x83847646, .name = "92HD206D", .patch = patch_stac927x },
  4409. /* The following does not take into account .id=0x83847661 when subsys =
  4410. * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
  4411. * currently not fully supported.
  4412. */
  4413. { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 },
  4414. { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 },
  4415. { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 },
  4416. { .id = 0x83847698, .name = "STAC9205", .patch = patch_stac9205 },
  4417. { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 },
  4418. { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 },
  4419. { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 },
  4420. { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 },
  4421. { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 },
  4422. { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 },
  4423. { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 },
  4424. { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 },
  4425. { .id = 0x111d7603, .name = "92HD75B3X5", .patch = patch_stac92hd71bxx},
  4426. { .id = 0x111d7604, .name = "92HD83C1X5", .patch = patch_stac92hd83xxx},
  4427. { .id = 0x111d76d4, .name = "92HD83C1C5", .patch = patch_stac92hd83xxx},
  4428. { .id = 0x111d7605, .name = "92HD81B1X5", .patch = patch_stac92hd83xxx},
  4429. { .id = 0x111d76d5, .name = "92HD81B1C5", .patch = patch_stac92hd83xxx},
  4430. { .id = 0x111d76d1, .name = "92HD87B1/3", .patch = patch_stac92hd83xxx},
  4431. { .id = 0x111d76d9, .name = "92HD87B2/4", .patch = patch_stac92hd83xxx},
  4432. { .id = 0x111d7666, .name = "92HD88B3", .patch = patch_stac92hd83xxx},
  4433. { .id = 0x111d7667, .name = "92HD88B1", .patch = patch_stac92hd83xxx},
  4434. { .id = 0x111d7668, .name = "92HD88B2", .patch = patch_stac92hd83xxx},
  4435. { .id = 0x111d7669, .name = "92HD88B4", .patch = patch_stac92hd83xxx},
  4436. { .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx},
  4437. { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx },
  4438. { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx },
  4439. { .id = 0x111d7676, .name = "92HD73E1X5", .patch = patch_stac92hd73xx },
  4440. { .id = 0x111d7695, .name = "92HD95", .patch = patch_stac92hd95 },
  4441. { .id = 0x111d76b0, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
  4442. { .id = 0x111d76b1, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
  4443. { .id = 0x111d76b2, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
  4444. { .id = 0x111d76b3, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
  4445. { .id = 0x111d76b4, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
  4446. { .id = 0x111d76b5, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
  4447. { .id = 0x111d76b6, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
  4448. { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
  4449. { .id = 0x111d76c0, .name = "92HD89C3", .patch = patch_stac92hd73xx },
  4450. { .id = 0x111d76c1, .name = "92HD89C2", .patch = patch_stac92hd73xx },
  4451. { .id = 0x111d76c2, .name = "92HD89C1", .patch = patch_stac92hd73xx },
  4452. { .id = 0x111d76c3, .name = "92HD89B3", .patch = patch_stac92hd73xx },
  4453. { .id = 0x111d76c4, .name = "92HD89B2", .patch = patch_stac92hd73xx },
  4454. { .id = 0x111d76c5, .name = "92HD89B1", .patch = patch_stac92hd73xx },
  4455. { .id = 0x111d76c6, .name = "92HD89E3", .patch = patch_stac92hd73xx },
  4456. { .id = 0x111d76c7, .name = "92HD89E2", .patch = patch_stac92hd73xx },
  4457. { .id = 0x111d76c8, .name = "92HD89E1", .patch = patch_stac92hd73xx },
  4458. { .id = 0x111d76c9, .name = "92HD89D3", .patch = patch_stac92hd73xx },
  4459. { .id = 0x111d76ca, .name = "92HD89D2", .patch = patch_stac92hd73xx },
  4460. { .id = 0x111d76cb, .name = "92HD89D1", .patch = patch_stac92hd73xx },
  4461. { .id = 0x111d76cc, .name = "92HD89F3", .patch = patch_stac92hd73xx },
  4462. { .id = 0x111d76cd, .name = "92HD89F2", .patch = patch_stac92hd73xx },
  4463. { .id = 0x111d76ce, .name = "92HD89F1", .patch = patch_stac92hd73xx },
  4464. { .id = 0x111d76df, .name = "92HD93BXX", .patch = patch_stac92hd83xxx},
  4465. { .id = 0x111d76e0, .name = "92HD91BXX", .patch = patch_stac92hd83xxx},
  4466. { .id = 0x111d76e3, .name = "92HD98BXX", .patch = patch_stac92hd83xxx},
  4467. { .id = 0x111d76e5, .name = "92HD99BXX", .patch = patch_stac92hd83xxx},
  4468. { .id = 0x111d76e7, .name = "92HD90BXX", .patch = patch_stac92hd83xxx},
  4469. { .id = 0x111d76e8, .name = "92HD66B1X5", .patch = patch_stac92hd83xxx},
  4470. { .id = 0x111d76e9, .name = "92HD66B2X5", .patch = patch_stac92hd83xxx},
  4471. { .id = 0x111d76ea, .name = "92HD66B3X5", .patch = patch_stac92hd83xxx},
  4472. { .id = 0x111d76eb, .name = "92HD66C1X5", .patch = patch_stac92hd83xxx},
  4473. { .id = 0x111d76ec, .name = "92HD66C2X5", .patch = patch_stac92hd83xxx},
  4474. { .id = 0x111d76ed, .name = "92HD66C3X5", .patch = patch_stac92hd83xxx},
  4475. { .id = 0x111d76ee, .name = "92HD66B1X3", .patch = patch_stac92hd83xxx},
  4476. { .id = 0x111d76ef, .name = "92HD66B2X3", .patch = patch_stac92hd83xxx},
  4477. { .id = 0x111d76f0, .name = "92HD66B3X3", .patch = patch_stac92hd83xxx},
  4478. { .id = 0x111d76f1, .name = "92HD66C1X3", .patch = patch_stac92hd83xxx},
  4479. { .id = 0x111d76f2, .name = "92HD66C2X3", .patch = patch_stac92hd83xxx},
  4480. { .id = 0x111d76f3, .name = "92HD66C3/65", .patch = patch_stac92hd83xxx},
  4481. {} /* terminator */
  4482. };
  4483. MODULE_ALIAS("snd-hda-codec-id:8384*");
  4484. MODULE_ALIAS("snd-hda-codec-id:111d*");
  4485. MODULE_LICENSE("GPL");
  4486. MODULE_DESCRIPTION("IDT/Sigmatel HD-audio codec");
  4487. static struct hda_codec_preset_list sigmatel_list = {
  4488. .preset = snd_hda_preset_sigmatel,
  4489. .owner = THIS_MODULE,
  4490. };
  4491. static int __init patch_sigmatel_init(void)
  4492. {
  4493. return snd_hda_add_codec_preset(&sigmatel_list);
  4494. }
  4495. static void __exit patch_sigmatel_exit(void)
  4496. {
  4497. snd_hda_delete_codec_preset(&sigmatel_list);
  4498. }
  4499. module_init(patch_sigmatel_init)
  4500. module_exit(patch_sigmatel_exit)