patch_sigmatel.c 137 KB

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