patch_sigmatel.c 137 KB

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