patch_sigmatel.c 137 KB

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