patch_sigmatel.c 136 KB

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