patch_sigmatel.c 133 KB

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