patch_realtek.c 255 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486
  1. /*
  2. * Universal Interface for Intel High Definition Audio Codec
  3. *
  4. * HD audio interface patch for Realtek ALC codecs
  5. *
  6. * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
  7. * PeiSen Hou <pshou@realtek.com.tw>
  8. * Takashi Iwai <tiwai@suse.de>
  9. * Jonathan Woithe <jwoithe@just42.net>
  10. *
  11. * This driver is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 2 of the License, or
  14. * (at your option) any later version.
  15. *
  16. * This driver is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  24. */
  25. #include <linux/init.h>
  26. #include <linux/delay.h>
  27. #include <linux/slab.h>
  28. #include <linux/pci.h>
  29. #include <linux/dmi.h>
  30. #include <linux/module.h>
  31. #include <linux/input.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_jack.h"
  38. #include "hda_generic.h"
  39. /* keep halting ALC5505 DSP, for power saving */
  40. #define HALT_REALTEK_ALC5505
  41. /* extra amp-initialization sequence types */
  42. enum {
  43. ALC_INIT_NONE,
  44. ALC_INIT_DEFAULT,
  45. ALC_INIT_GPIO1,
  46. ALC_INIT_GPIO2,
  47. ALC_INIT_GPIO3,
  48. };
  49. enum {
  50. ALC_HEADSET_MODE_UNKNOWN,
  51. ALC_HEADSET_MODE_UNPLUGGED,
  52. ALC_HEADSET_MODE_HEADSET,
  53. ALC_HEADSET_MODE_MIC,
  54. ALC_HEADSET_MODE_HEADPHONE,
  55. };
  56. enum {
  57. ALC_HEADSET_TYPE_UNKNOWN,
  58. ALC_HEADSET_TYPE_CTIA,
  59. ALC_HEADSET_TYPE_OMTP,
  60. };
  61. enum {
  62. ALC_KEY_MICMUTE_INDEX,
  63. };
  64. struct alc_customize_define {
  65. unsigned int sku_cfg;
  66. unsigned char port_connectivity;
  67. unsigned char check_sum;
  68. unsigned char customization;
  69. unsigned char external_amp;
  70. unsigned int enable_pcbeep:1;
  71. unsigned int platform_type:1;
  72. unsigned int swap:1;
  73. unsigned int override:1;
  74. unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
  75. };
  76. struct alc_spec {
  77. struct hda_gen_spec gen; /* must be at head */
  78. /* codec parameterization */
  79. const struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
  80. unsigned int num_mixers;
  81. unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
  82. struct alc_customize_define cdefine;
  83. unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
  84. /* mute LED for HP laptops, see alc269_fixup_mic_mute_hook() */
  85. int mute_led_polarity;
  86. hda_nid_t mute_led_nid;
  87. hda_nid_t cap_mute_led_nid;
  88. unsigned int gpio_led; /* used for alc269_fixup_hp_gpio_led() */
  89. unsigned int gpio_mute_led_mask;
  90. unsigned int gpio_mic_led_mask;
  91. hda_nid_t headset_mic_pin;
  92. hda_nid_t headphone_mic_pin;
  93. int current_headset_mode;
  94. int current_headset_type;
  95. /* hooks */
  96. void (*init_hook)(struct hda_codec *codec);
  97. #ifdef CONFIG_PM
  98. void (*power_hook)(struct hda_codec *codec);
  99. #endif
  100. void (*shutup)(struct hda_codec *codec);
  101. void (*reboot_notify)(struct hda_codec *codec);
  102. int init_amp;
  103. int codec_variant; /* flag for other variants */
  104. unsigned int has_alc5505_dsp:1;
  105. unsigned int no_depop_delay:1;
  106. unsigned int done_hp_init:1;
  107. /* for PLL fix */
  108. hda_nid_t pll_nid;
  109. unsigned int pll_coef_idx, pll_coef_bit;
  110. unsigned int coef0;
  111. struct input_dev *kb_dev;
  112. u8 alc_mute_keycode_map[1];
  113. };
  114. /*
  115. * COEF access helper functions
  116. */
  117. static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
  118. unsigned int coef_idx)
  119. {
  120. unsigned int val;
  121. snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
  122. val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
  123. return val;
  124. }
  125. #define alc_read_coef_idx(codec, coef_idx) \
  126. alc_read_coefex_idx(codec, 0x20, coef_idx)
  127. static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
  128. unsigned int coef_idx, unsigned int coef_val)
  129. {
  130. snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
  131. snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
  132. }
  133. #define alc_write_coef_idx(codec, coef_idx, coef_val) \
  134. alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
  135. static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
  136. unsigned int coef_idx, unsigned int mask,
  137. unsigned int bits_set)
  138. {
  139. unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
  140. if (val != -1)
  141. alc_write_coefex_idx(codec, nid, coef_idx,
  142. (val & ~mask) | bits_set);
  143. }
  144. #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
  145. alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
  146. /* a special bypass for COEF 0; read the cached value at the second time */
  147. static unsigned int alc_get_coef0(struct hda_codec *codec)
  148. {
  149. struct alc_spec *spec = codec->spec;
  150. if (!spec->coef0)
  151. spec->coef0 = alc_read_coef_idx(codec, 0);
  152. return spec->coef0;
  153. }
  154. /* coef writes/updates batch */
  155. struct coef_fw {
  156. unsigned char nid;
  157. unsigned char idx;
  158. unsigned short mask;
  159. unsigned short val;
  160. };
  161. #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
  162. { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
  163. #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
  164. #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
  165. #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
  166. static void alc_process_coef_fw(struct hda_codec *codec,
  167. const struct coef_fw *fw)
  168. {
  169. for (; fw->nid; fw++) {
  170. if (fw->mask == (unsigned short)-1)
  171. alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
  172. else
  173. alc_update_coefex_idx(codec, fw->nid, fw->idx,
  174. fw->mask, fw->val);
  175. }
  176. }
  177. /*
  178. * Append the given mixer and verb elements for the later use
  179. * The mixer array is referred in build_controls(), and init_verbs are
  180. * called in init().
  181. */
  182. static void add_mixer(struct alc_spec *spec, const struct snd_kcontrol_new *mix)
  183. {
  184. if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
  185. return;
  186. spec->mixers[spec->num_mixers++] = mix;
  187. }
  188. /*
  189. * GPIO setup tables, used in initialization
  190. */
  191. /* Enable GPIO mask and set output */
  192. static const struct hda_verb alc_gpio1_init_verbs[] = {
  193. {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
  194. {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
  195. {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
  196. { }
  197. };
  198. static const struct hda_verb alc_gpio2_init_verbs[] = {
  199. {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
  200. {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
  201. {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
  202. { }
  203. };
  204. static const struct hda_verb alc_gpio3_init_verbs[] = {
  205. {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
  206. {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
  207. {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
  208. { }
  209. };
  210. /*
  211. * Fix hardware PLL issue
  212. * On some codecs, the analog PLL gating control must be off while
  213. * the default value is 1.
  214. */
  215. static void alc_fix_pll(struct hda_codec *codec)
  216. {
  217. struct alc_spec *spec = codec->spec;
  218. if (spec->pll_nid)
  219. alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
  220. 1 << spec->pll_coef_bit, 0);
  221. }
  222. static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
  223. unsigned int coef_idx, unsigned int coef_bit)
  224. {
  225. struct alc_spec *spec = codec->spec;
  226. spec->pll_nid = nid;
  227. spec->pll_coef_idx = coef_idx;
  228. spec->pll_coef_bit = coef_bit;
  229. alc_fix_pll(codec);
  230. }
  231. /* update the master volume per volume-knob's unsol event */
  232. static void alc_update_knob_master(struct hda_codec *codec,
  233. struct hda_jack_callback *jack)
  234. {
  235. unsigned int val;
  236. struct snd_kcontrol *kctl;
  237. struct snd_ctl_elem_value *uctl;
  238. kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
  239. if (!kctl)
  240. return;
  241. uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
  242. if (!uctl)
  243. return;
  244. val = snd_hda_codec_read(codec, jack->nid, 0,
  245. AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
  246. val &= HDA_AMP_VOLMASK;
  247. uctl->value.integer.value[0] = val;
  248. uctl->value.integer.value[1] = val;
  249. kctl->put(kctl, uctl);
  250. kfree(uctl);
  251. }
  252. static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
  253. {
  254. /* For some reason, the res given from ALC880 is broken.
  255. Here we adjust it properly. */
  256. snd_hda_jack_unsol_event(codec, res >> 2);
  257. }
  258. /* Change EAPD to verb control */
  259. static void alc_fill_eapd_coef(struct hda_codec *codec)
  260. {
  261. int coef;
  262. coef = alc_get_coef0(codec);
  263. switch (codec->core.vendor_id) {
  264. case 0x10ec0262:
  265. alc_update_coef_idx(codec, 0x7, 0, 1<<5);
  266. break;
  267. case 0x10ec0267:
  268. case 0x10ec0268:
  269. alc_update_coef_idx(codec, 0x7, 0, 1<<13);
  270. break;
  271. case 0x10ec0269:
  272. if ((coef & 0x00f0) == 0x0010)
  273. alc_update_coef_idx(codec, 0xd, 0, 1<<14);
  274. if ((coef & 0x00f0) == 0x0020)
  275. alc_update_coef_idx(codec, 0x4, 1<<15, 0);
  276. if ((coef & 0x00f0) == 0x0030)
  277. alc_update_coef_idx(codec, 0x10, 1<<9, 0);
  278. break;
  279. case 0x10ec0280:
  280. case 0x10ec0284:
  281. case 0x10ec0290:
  282. case 0x10ec0292:
  283. alc_update_coef_idx(codec, 0x4, 1<<15, 0);
  284. break;
  285. case 0x10ec0225:
  286. case 0x10ec0295:
  287. case 0x10ec0299:
  288. alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
  289. /* fallthrough */
  290. case 0x10ec0215:
  291. case 0x10ec0233:
  292. case 0x10ec0235:
  293. case 0x10ec0236:
  294. case 0x10ec0245:
  295. case 0x10ec0255:
  296. case 0x10ec0256:
  297. case 0x10ec0257:
  298. case 0x10ec0282:
  299. case 0x10ec0283:
  300. case 0x10ec0286:
  301. case 0x10ec0288:
  302. case 0x10ec0285:
  303. case 0x10ec0298:
  304. case 0x10ec0289:
  305. case 0x10ec0300:
  306. alc_update_coef_idx(codec, 0x10, 1<<9, 0);
  307. break;
  308. case 0x10ec0275:
  309. alc_update_coef_idx(codec, 0xe, 0, 1<<0);
  310. break;
  311. case 0x10ec0287:
  312. alc_update_coef_idx(codec, 0x10, 1<<9, 0);
  313. alc_write_coef_idx(codec, 0x8, 0x4ab7);
  314. break;
  315. case 0x10ec0293:
  316. alc_update_coef_idx(codec, 0xa, 1<<13, 0);
  317. break;
  318. case 0x10ec0234:
  319. case 0x10ec0274:
  320. case 0x10ec0294:
  321. case 0x10ec0700:
  322. case 0x10ec0701:
  323. case 0x10ec0703:
  324. case 0x10ec0711:
  325. alc_update_coef_idx(codec, 0x10, 1<<15, 0);
  326. break;
  327. case 0x10ec0662:
  328. if ((coef & 0x00f0) == 0x0030)
  329. alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
  330. break;
  331. case 0x10ec0272:
  332. case 0x10ec0273:
  333. case 0x10ec0663:
  334. case 0x10ec0665:
  335. case 0x10ec0670:
  336. case 0x10ec0671:
  337. case 0x10ec0672:
  338. alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
  339. break;
  340. case 0x10ec0222:
  341. case 0x10ec0623:
  342. alc_update_coef_idx(codec, 0x19, 1<<13, 0);
  343. break;
  344. case 0x10ec0668:
  345. alc_update_coef_idx(codec, 0x7, 3<<13, 0);
  346. break;
  347. case 0x10ec0867:
  348. alc_update_coef_idx(codec, 0x4, 1<<10, 0);
  349. break;
  350. case 0x10ec0888:
  351. if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
  352. alc_update_coef_idx(codec, 0x7, 1<<5, 0);
  353. break;
  354. case 0x10ec0892:
  355. case 0x10ec0897:
  356. alc_update_coef_idx(codec, 0x7, 1<<5, 0);
  357. break;
  358. case 0x10ec0899:
  359. case 0x10ec0900:
  360. case 0x10ec0b00:
  361. case 0x10ec1168:
  362. case 0x10ec1220:
  363. alc_update_coef_idx(codec, 0x7, 1<<1, 0);
  364. break;
  365. }
  366. }
  367. /* additional initialization for ALC888 variants */
  368. static void alc888_coef_init(struct hda_codec *codec)
  369. {
  370. switch (alc_get_coef0(codec) & 0x00f0) {
  371. /* alc888-VA */
  372. case 0x00:
  373. /* alc888-VB */
  374. case 0x10:
  375. alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
  376. break;
  377. }
  378. }
  379. /* turn on/off EAPD control (only if available) */
  380. static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
  381. {
  382. if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
  383. return;
  384. if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
  385. snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
  386. on ? 2 : 0);
  387. }
  388. /* turn on/off EAPD controls of the codec */
  389. static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
  390. {
  391. /* We currently only handle front, HP */
  392. static hda_nid_t pins[] = {
  393. 0x0f, 0x10, 0x14, 0x15, 0x17, 0
  394. };
  395. hda_nid_t *p;
  396. for (p = pins; *p; p++)
  397. set_eapd(codec, *p, on);
  398. }
  399. /* generic shutup callback;
  400. * just turning off EAPD and a little pause for avoiding pop-noise
  401. */
  402. static void alc_eapd_shutup(struct hda_codec *codec)
  403. {
  404. struct alc_spec *spec = codec->spec;
  405. alc_auto_setup_eapd(codec, false);
  406. if (!spec->no_depop_delay)
  407. msleep(200);
  408. snd_hda_shutup_pins(codec);
  409. }
  410. /* generic EAPD initialization */
  411. static void alc_auto_init_amp(struct hda_codec *codec, int type)
  412. {
  413. alc_fill_eapd_coef(codec);
  414. alc_auto_setup_eapd(codec, true);
  415. switch (type) {
  416. case ALC_INIT_GPIO1:
  417. snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
  418. break;
  419. case ALC_INIT_GPIO2:
  420. snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
  421. break;
  422. case ALC_INIT_GPIO3:
  423. snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
  424. break;
  425. case ALC_INIT_DEFAULT:
  426. switch (codec->core.vendor_id) {
  427. case 0x10ec0260:
  428. alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
  429. break;
  430. case 0x10ec0880:
  431. case 0x10ec0882:
  432. case 0x10ec0883:
  433. case 0x10ec0885:
  434. alc_update_coef_idx(codec, 7, 0, 0x2030);
  435. break;
  436. case 0x10ec0888:
  437. alc888_coef_init(codec);
  438. break;
  439. }
  440. break;
  441. }
  442. }
  443. /*
  444. * Realtek SSID verification
  445. */
  446. /* Could be any non-zero and even value. When used as fixup, tells
  447. * the driver to ignore any present sku defines.
  448. */
  449. #define ALC_FIXUP_SKU_IGNORE (2)
  450. static void alc_fixup_sku_ignore(struct hda_codec *codec,
  451. const struct hda_fixup *fix, int action)
  452. {
  453. struct alc_spec *spec = codec->spec;
  454. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  455. spec->cdefine.fixup = 1;
  456. spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
  457. }
  458. }
  459. static void alc_fixup_no_depop_delay(struct hda_codec *codec,
  460. const struct hda_fixup *fix, int action)
  461. {
  462. struct alc_spec *spec = codec->spec;
  463. if (action == HDA_FIXUP_ACT_PROBE) {
  464. spec->no_depop_delay = 1;
  465. codec->depop_delay = 0;
  466. }
  467. }
  468. static int alc_auto_parse_customize_define(struct hda_codec *codec)
  469. {
  470. unsigned int ass, tmp, i;
  471. unsigned nid = 0;
  472. struct alc_spec *spec = codec->spec;
  473. spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
  474. if (spec->cdefine.fixup) {
  475. ass = spec->cdefine.sku_cfg;
  476. if (ass == ALC_FIXUP_SKU_IGNORE)
  477. return -1;
  478. goto do_sku;
  479. }
  480. if (!codec->bus->pci)
  481. return -1;
  482. ass = codec->core.subsystem_id & 0xffff;
  483. if (ass != codec->bus->pci->subsystem_device && (ass & 1))
  484. goto do_sku;
  485. nid = 0x1d;
  486. if (codec->core.vendor_id == 0x10ec0260)
  487. nid = 0x17;
  488. ass = snd_hda_codec_get_pincfg(codec, nid);
  489. if (!(ass & 1)) {
  490. codec_info(codec, "%s: SKU not ready 0x%08x\n",
  491. codec->core.chip_name, ass);
  492. return -1;
  493. }
  494. /* check sum */
  495. tmp = 0;
  496. for (i = 1; i < 16; i++) {
  497. if ((ass >> i) & 1)
  498. tmp++;
  499. }
  500. if (((ass >> 16) & 0xf) != tmp)
  501. return -1;
  502. spec->cdefine.port_connectivity = ass >> 30;
  503. spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
  504. spec->cdefine.check_sum = (ass >> 16) & 0xf;
  505. spec->cdefine.customization = ass >> 8;
  506. do_sku:
  507. spec->cdefine.sku_cfg = ass;
  508. spec->cdefine.external_amp = (ass & 0x38) >> 3;
  509. spec->cdefine.platform_type = (ass & 0x4) >> 2;
  510. spec->cdefine.swap = (ass & 0x2) >> 1;
  511. spec->cdefine.override = ass & 0x1;
  512. codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
  513. nid, spec->cdefine.sku_cfg);
  514. codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
  515. spec->cdefine.port_connectivity);
  516. codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
  517. codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
  518. codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
  519. codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
  520. codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
  521. codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
  522. codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
  523. return 0;
  524. }
  525. /* return the position of NID in the list, or -1 if not found */
  526. static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
  527. {
  528. int i;
  529. for (i = 0; i < nums; i++)
  530. if (list[i] == nid)
  531. return i;
  532. return -1;
  533. }
  534. /* return true if the given NID is found in the list */
  535. static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
  536. {
  537. return find_idx_in_nid_list(nid, list, nums) >= 0;
  538. }
  539. /* check subsystem ID and set up device-specific initialization;
  540. * return 1 if initialized, 0 if invalid SSID
  541. */
  542. /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
  543. * 31 ~ 16 : Manufacture ID
  544. * 15 ~ 8 : SKU ID
  545. * 7 ~ 0 : Assembly ID
  546. * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
  547. */
  548. static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
  549. {
  550. unsigned int ass, tmp, i;
  551. unsigned nid;
  552. struct alc_spec *spec = codec->spec;
  553. if (spec->cdefine.fixup) {
  554. ass = spec->cdefine.sku_cfg;
  555. if (ass == ALC_FIXUP_SKU_IGNORE)
  556. return 0;
  557. goto do_sku;
  558. }
  559. ass = codec->core.subsystem_id & 0xffff;
  560. if (codec->bus->pci &&
  561. ass != codec->bus->pci->subsystem_device && (ass & 1))
  562. goto do_sku;
  563. /* invalid SSID, check the special NID pin defcfg instead */
  564. /*
  565. * 31~30 : port connectivity
  566. * 29~21 : reserve
  567. * 20 : PCBEEP input
  568. * 19~16 : Check sum (15:1)
  569. * 15~1 : Custom
  570. * 0 : override
  571. */
  572. nid = 0x1d;
  573. if (codec->core.vendor_id == 0x10ec0260)
  574. nid = 0x17;
  575. ass = snd_hda_codec_get_pincfg(codec, nid);
  576. codec_dbg(codec,
  577. "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
  578. ass, nid);
  579. if (!(ass & 1))
  580. return 0;
  581. if ((ass >> 30) != 1) /* no physical connection */
  582. return 0;
  583. /* check sum */
  584. tmp = 0;
  585. for (i = 1; i < 16; i++) {
  586. if ((ass >> i) & 1)
  587. tmp++;
  588. }
  589. if (((ass >> 16) & 0xf) != tmp)
  590. return 0;
  591. do_sku:
  592. codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
  593. ass & 0xffff, codec->core.vendor_id);
  594. /*
  595. * 0 : override
  596. * 1 : Swap Jack
  597. * 2 : 0 --> Desktop, 1 --> Laptop
  598. * 3~5 : External Amplifier control
  599. * 7~6 : Reserved
  600. */
  601. tmp = (ass & 0x38) >> 3; /* external Amp control */
  602. switch (tmp) {
  603. case 1:
  604. spec->init_amp = ALC_INIT_GPIO1;
  605. break;
  606. case 3:
  607. spec->init_amp = ALC_INIT_GPIO2;
  608. break;
  609. case 7:
  610. spec->init_amp = ALC_INIT_GPIO3;
  611. break;
  612. case 5:
  613. default:
  614. spec->init_amp = ALC_INIT_DEFAULT;
  615. break;
  616. }
  617. /* is laptop or Desktop and enable the function "Mute internal speaker
  618. * when the external headphone out jack is plugged"
  619. */
  620. if (!(ass & 0x8000))
  621. return 1;
  622. /*
  623. * 10~8 : Jack location
  624. * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
  625. * 14~13: Resvered
  626. * 15 : 1 --> enable the function "Mute internal speaker
  627. * when the external headphone out jack is plugged"
  628. */
  629. if (!spec->gen.autocfg.hp_pins[0] &&
  630. !(spec->gen.autocfg.line_out_pins[0] &&
  631. spec->gen.autocfg.line_out_type == AUTO_PIN_HP_OUT)) {
  632. hda_nid_t nid;
  633. tmp = (ass >> 11) & 0x3; /* HP to chassis */
  634. nid = ports[tmp];
  635. if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
  636. spec->gen.autocfg.line_outs))
  637. return 1;
  638. spec->gen.autocfg.hp_pins[0] = nid;
  639. }
  640. return 1;
  641. }
  642. /* Check the validity of ALC subsystem-id
  643. * ports contains an array of 4 pin NIDs for port-A, E, D and I */
  644. static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
  645. {
  646. if (!alc_subsystem_id(codec, ports)) {
  647. struct alc_spec *spec = codec->spec;
  648. codec_dbg(codec,
  649. "realtek: Enable default setup for auto mode as fallback\n");
  650. spec->init_amp = ALC_INIT_DEFAULT;
  651. }
  652. }
  653. /*
  654. */
  655. static void alc_fixup_inv_dmic(struct hda_codec *codec,
  656. const struct hda_fixup *fix, int action)
  657. {
  658. struct alc_spec *spec = codec->spec;
  659. spec->gen.inv_dmic_split = 1;
  660. }
  661. #ifdef CONFIG_SND_HDA_INPUT_BEEP
  662. /* additional beep mixers; the actual parameters are overwritten at build */
  663. static const struct snd_kcontrol_new alc_beep_mixer[] = {
  664. HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
  665. HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
  666. { } /* end */
  667. };
  668. #endif
  669. static int alc_build_controls(struct hda_codec *codec)
  670. {
  671. struct alc_spec *spec = codec->spec;
  672. int i, err;
  673. err = snd_hda_gen_build_controls(codec);
  674. if (err < 0)
  675. return err;
  676. for (i = 0; i < spec->num_mixers; i++) {
  677. err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
  678. if (err < 0)
  679. return err;
  680. }
  681. #ifdef CONFIG_SND_HDA_INPUT_BEEP
  682. /* create beep controls if needed */
  683. if (spec->beep_amp) {
  684. const struct snd_kcontrol_new *knew;
  685. for (knew = alc_beep_mixer; knew->name; knew++) {
  686. struct snd_kcontrol *kctl;
  687. kctl = snd_ctl_new1(knew, codec);
  688. if (!kctl)
  689. return -ENOMEM;
  690. kctl->private_value = spec->beep_amp;
  691. err = snd_hda_ctl_add(codec, 0, kctl);
  692. if (err < 0)
  693. return err;
  694. }
  695. }
  696. #endif
  697. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
  698. return 0;
  699. }
  700. /*
  701. * Common callbacks
  702. */
  703. static int alc_init(struct hda_codec *codec)
  704. {
  705. struct alc_spec *spec = codec->spec;
  706. if (spec->init_hook)
  707. spec->init_hook(codec);
  708. spec->gen.skip_verbs = 1; /* applied in below */
  709. snd_hda_gen_init(codec);
  710. alc_fix_pll(codec);
  711. alc_auto_init_amp(codec, spec->init_amp);
  712. snd_hda_apply_verbs(codec); /* apply verbs here after own init */
  713. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
  714. return 0;
  715. }
  716. static inline void alc_shutup(struct hda_codec *codec)
  717. {
  718. struct alc_spec *spec = codec->spec;
  719. if (spec && spec->shutup)
  720. spec->shutup(codec);
  721. else
  722. snd_hda_shutup_pins(codec);
  723. }
  724. static void alc_reboot_notify(struct hda_codec *codec)
  725. {
  726. struct alc_spec *spec = codec->spec;
  727. if (spec && spec->reboot_notify)
  728. spec->reboot_notify(codec);
  729. else
  730. alc_shutup(codec);
  731. }
  732. #define alc_free snd_hda_gen_free
  733. #ifdef CONFIG_PM
  734. static void alc_power_eapd(struct hda_codec *codec)
  735. {
  736. alc_auto_setup_eapd(codec, false);
  737. }
  738. static int alc_suspend(struct hda_codec *codec)
  739. {
  740. struct alc_spec *spec = codec->spec;
  741. alc_shutup(codec);
  742. if (spec && spec->power_hook)
  743. spec->power_hook(codec);
  744. return 0;
  745. }
  746. #endif
  747. #ifdef CONFIG_PM
  748. static int alc_resume(struct hda_codec *codec)
  749. {
  750. struct alc_spec *spec = codec->spec;
  751. if (!spec->no_depop_delay)
  752. msleep(150); /* to avoid pop noise */
  753. codec->patch_ops.init(codec);
  754. regcache_sync(codec->core.regmap);
  755. hda_call_check_power_status(codec, 0x01);
  756. return 0;
  757. }
  758. #endif
  759. /*
  760. */
  761. static const struct hda_codec_ops alc_patch_ops = {
  762. .build_controls = alc_build_controls,
  763. .build_pcms = snd_hda_gen_build_pcms,
  764. .init = alc_init,
  765. .free = alc_free,
  766. .unsol_event = snd_hda_jack_unsol_event,
  767. #ifdef CONFIG_PM
  768. .resume = alc_resume,
  769. .suspend = alc_suspend,
  770. .check_power_status = snd_hda_gen_check_power_status,
  771. #endif
  772. .reboot_notify = alc_reboot_notify,
  773. };
  774. #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
  775. /*
  776. * Rename codecs appropriately from COEF value or subvendor id
  777. */
  778. struct alc_codec_rename_table {
  779. unsigned int vendor_id;
  780. unsigned short coef_mask;
  781. unsigned short coef_bits;
  782. const char *name;
  783. };
  784. struct alc_codec_rename_pci_table {
  785. unsigned int codec_vendor_id;
  786. unsigned short pci_subvendor;
  787. unsigned short pci_subdevice;
  788. const char *name;
  789. };
  790. static struct alc_codec_rename_table rename_tbl[] = {
  791. { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
  792. { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
  793. { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
  794. { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
  795. { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
  796. { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
  797. { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
  798. { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
  799. { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
  800. { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
  801. { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
  802. { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
  803. { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
  804. { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
  805. { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
  806. { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
  807. { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
  808. { } /* terminator */
  809. };
  810. static struct alc_codec_rename_pci_table rename_pci_tbl[] = {
  811. { 0x10ec0280, 0x1028, 0, "ALC3220" },
  812. { 0x10ec0282, 0x1028, 0, "ALC3221" },
  813. { 0x10ec0283, 0x1028, 0, "ALC3223" },
  814. { 0x10ec0288, 0x1028, 0, "ALC3263" },
  815. { 0x10ec0292, 0x1028, 0, "ALC3226" },
  816. { 0x10ec0293, 0x1028, 0, "ALC3235" },
  817. { 0x10ec0255, 0x1028, 0, "ALC3234" },
  818. { 0x10ec0668, 0x1028, 0, "ALC3661" },
  819. { 0x10ec0275, 0x1028, 0, "ALC3260" },
  820. { 0x10ec0899, 0x1028, 0, "ALC3861" },
  821. { 0x10ec0298, 0x1028, 0, "ALC3266" },
  822. { 0x10ec0236, 0x1028, 0, "ALC3204" },
  823. { 0x10ec0256, 0x1028, 0, "ALC3246" },
  824. { 0x10ec0225, 0x1028, 0, "ALC3253" },
  825. { 0x10ec0295, 0x1028, 0, "ALC3254" },
  826. { 0x10ec0299, 0x1028, 0, "ALC3271" },
  827. { 0x10ec0670, 0x1025, 0, "ALC669X" },
  828. { 0x10ec0676, 0x1025, 0, "ALC679X" },
  829. { 0x10ec0282, 0x1043, 0, "ALC3229" },
  830. { 0x10ec0233, 0x1043, 0, "ALC3236" },
  831. { 0x10ec0280, 0x103c, 0, "ALC3228" },
  832. { 0x10ec0282, 0x103c, 0, "ALC3227" },
  833. { 0x10ec0286, 0x103c, 0, "ALC3242" },
  834. { 0x10ec0290, 0x103c, 0, "ALC3241" },
  835. { 0x10ec0668, 0x103c, 0, "ALC3662" },
  836. { 0x10ec0283, 0x17aa, 0, "ALC3239" },
  837. { 0x10ec0292, 0x17aa, 0, "ALC3232" },
  838. { } /* terminator */
  839. };
  840. static int alc_codec_rename_from_preset(struct hda_codec *codec)
  841. {
  842. const struct alc_codec_rename_table *p;
  843. const struct alc_codec_rename_pci_table *q;
  844. for (p = rename_tbl; p->vendor_id; p++) {
  845. if (p->vendor_id != codec->core.vendor_id)
  846. continue;
  847. if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
  848. return alc_codec_rename(codec, p->name);
  849. }
  850. if (!codec->bus->pci)
  851. return 0;
  852. for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
  853. if (q->codec_vendor_id != codec->core.vendor_id)
  854. continue;
  855. if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
  856. continue;
  857. if (!q->pci_subdevice ||
  858. q->pci_subdevice == codec->bus->pci->subsystem_device)
  859. return alc_codec_rename(codec, q->name);
  860. }
  861. return 0;
  862. }
  863. /*
  864. * Digital-beep handlers
  865. */
  866. #ifdef CONFIG_SND_HDA_INPUT_BEEP
  867. #define set_beep_amp(spec, nid, idx, dir) \
  868. ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
  869. static const struct snd_pci_quirk beep_white_list[] = {
  870. SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
  871. SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
  872. SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
  873. SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
  874. SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
  875. SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
  876. SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
  877. SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
  878. SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
  879. /* blacklist -- no beep available */
  880. SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
  881. SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
  882. {}
  883. };
  884. static inline int has_cdefine_beep(struct hda_codec *codec)
  885. {
  886. struct alc_spec *spec = codec->spec;
  887. const struct snd_pci_quirk *q;
  888. q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
  889. if (q)
  890. return q->value;
  891. return spec->cdefine.enable_pcbeep;
  892. }
  893. #else
  894. #define set_beep_amp(spec, nid, idx, dir) /* NOP */
  895. #define has_cdefine_beep(codec) 0
  896. #endif
  897. /* parse the BIOS configuration and set up the alc_spec */
  898. /* return 1 if successful, 0 if the proper config is not found,
  899. * or a negative error code
  900. */
  901. static int alc_parse_auto_config(struct hda_codec *codec,
  902. const hda_nid_t *ignore_nids,
  903. const hda_nid_t *ssid_nids)
  904. {
  905. struct alc_spec *spec = codec->spec;
  906. struct auto_pin_cfg *cfg = &spec->gen.autocfg;
  907. int err;
  908. err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
  909. spec->parse_flags);
  910. if (err < 0)
  911. return err;
  912. if (ssid_nids)
  913. alc_ssid_check(codec, ssid_nids);
  914. err = snd_hda_gen_parse_auto_config(codec, cfg);
  915. if (err < 0)
  916. return err;
  917. return 1;
  918. }
  919. /* common preparation job for alc_spec */
  920. static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
  921. {
  922. struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
  923. int err;
  924. if (!spec)
  925. return -ENOMEM;
  926. codec->spec = spec;
  927. snd_hda_gen_spec_init(&spec->gen);
  928. spec->gen.mixer_nid = mixer_nid;
  929. spec->gen.own_eapd_ctl = 1;
  930. codec->single_adc_amp = 1;
  931. /* FIXME: do we need this for all Realtek codec models? */
  932. codec->spdif_status_reset = 1;
  933. codec->patch_ops = alc_patch_ops;
  934. err = alc_codec_rename_from_preset(codec);
  935. if (err < 0) {
  936. kfree(spec);
  937. return err;
  938. }
  939. return 0;
  940. }
  941. static int alc880_parse_auto_config(struct hda_codec *codec)
  942. {
  943. static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
  944. static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
  945. return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
  946. }
  947. /*
  948. * ALC880 fix-ups
  949. */
  950. enum {
  951. ALC880_FIXUP_GPIO1,
  952. ALC880_FIXUP_GPIO2,
  953. ALC880_FIXUP_MEDION_RIM,
  954. ALC880_FIXUP_LG,
  955. ALC880_FIXUP_LG_LW25,
  956. ALC880_FIXUP_W810,
  957. ALC880_FIXUP_EAPD_COEF,
  958. ALC880_FIXUP_TCL_S700,
  959. ALC880_FIXUP_VOL_KNOB,
  960. ALC880_FIXUP_FUJITSU,
  961. ALC880_FIXUP_F1734,
  962. ALC880_FIXUP_UNIWILL,
  963. ALC880_FIXUP_UNIWILL_DIG,
  964. ALC880_FIXUP_Z71V,
  965. ALC880_FIXUP_ASUS_W5A,
  966. ALC880_FIXUP_3ST_BASE,
  967. ALC880_FIXUP_3ST,
  968. ALC880_FIXUP_3ST_DIG,
  969. ALC880_FIXUP_5ST_BASE,
  970. ALC880_FIXUP_5ST,
  971. ALC880_FIXUP_5ST_DIG,
  972. ALC880_FIXUP_6ST_BASE,
  973. ALC880_FIXUP_6ST,
  974. ALC880_FIXUP_6ST_DIG,
  975. ALC880_FIXUP_6ST_AUTOMUTE,
  976. };
  977. /* enable the volume-knob widget support on NID 0x21 */
  978. static void alc880_fixup_vol_knob(struct hda_codec *codec,
  979. const struct hda_fixup *fix, int action)
  980. {
  981. if (action == HDA_FIXUP_ACT_PROBE)
  982. snd_hda_jack_detect_enable_callback(codec, 0x21,
  983. alc_update_knob_master);
  984. }
  985. static const struct hda_fixup alc880_fixups[] = {
  986. [ALC880_FIXUP_GPIO1] = {
  987. .type = HDA_FIXUP_VERBS,
  988. .v.verbs = alc_gpio1_init_verbs,
  989. },
  990. [ALC880_FIXUP_GPIO2] = {
  991. .type = HDA_FIXUP_VERBS,
  992. .v.verbs = alc_gpio2_init_verbs,
  993. },
  994. [ALC880_FIXUP_MEDION_RIM] = {
  995. .type = HDA_FIXUP_VERBS,
  996. .v.verbs = (const struct hda_verb[]) {
  997. { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
  998. { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
  999. { }
  1000. },
  1001. .chained = true,
  1002. .chain_id = ALC880_FIXUP_GPIO2,
  1003. },
  1004. [ALC880_FIXUP_LG] = {
  1005. .type = HDA_FIXUP_PINS,
  1006. .v.pins = (const struct hda_pintbl[]) {
  1007. /* disable bogus unused pins */
  1008. { 0x16, 0x411111f0 },
  1009. { 0x18, 0x411111f0 },
  1010. { 0x1a, 0x411111f0 },
  1011. { }
  1012. }
  1013. },
  1014. [ALC880_FIXUP_LG_LW25] = {
  1015. .type = HDA_FIXUP_PINS,
  1016. .v.pins = (const struct hda_pintbl[]) {
  1017. { 0x1a, 0x0181344f }, /* line-in */
  1018. { 0x1b, 0x0321403f }, /* headphone */
  1019. { }
  1020. }
  1021. },
  1022. [ALC880_FIXUP_W810] = {
  1023. .type = HDA_FIXUP_PINS,
  1024. .v.pins = (const struct hda_pintbl[]) {
  1025. /* disable bogus unused pins */
  1026. { 0x17, 0x411111f0 },
  1027. { }
  1028. },
  1029. .chained = true,
  1030. .chain_id = ALC880_FIXUP_GPIO2,
  1031. },
  1032. [ALC880_FIXUP_EAPD_COEF] = {
  1033. .type = HDA_FIXUP_VERBS,
  1034. .v.verbs = (const struct hda_verb[]) {
  1035. /* change to EAPD mode */
  1036. { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
  1037. { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
  1038. {}
  1039. },
  1040. },
  1041. [ALC880_FIXUP_TCL_S700] = {
  1042. .type = HDA_FIXUP_VERBS,
  1043. .v.verbs = (const struct hda_verb[]) {
  1044. /* change to EAPD mode */
  1045. { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
  1046. { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
  1047. {}
  1048. },
  1049. .chained = true,
  1050. .chain_id = ALC880_FIXUP_GPIO2,
  1051. },
  1052. [ALC880_FIXUP_VOL_KNOB] = {
  1053. .type = HDA_FIXUP_FUNC,
  1054. .v.func = alc880_fixup_vol_knob,
  1055. },
  1056. [ALC880_FIXUP_FUJITSU] = {
  1057. /* override all pins as BIOS on old Amilo is broken */
  1058. .type = HDA_FIXUP_PINS,
  1059. .v.pins = (const struct hda_pintbl[]) {
  1060. { 0x14, 0x0121401f }, /* HP */
  1061. { 0x15, 0x99030120 }, /* speaker */
  1062. { 0x16, 0x99030130 }, /* bass speaker */
  1063. { 0x17, 0x411111f0 }, /* N/A */
  1064. { 0x18, 0x411111f0 }, /* N/A */
  1065. { 0x19, 0x01a19950 }, /* mic-in */
  1066. { 0x1a, 0x411111f0 }, /* N/A */
  1067. { 0x1b, 0x411111f0 }, /* N/A */
  1068. { 0x1c, 0x411111f0 }, /* N/A */
  1069. { 0x1d, 0x411111f0 }, /* N/A */
  1070. { 0x1e, 0x01454140 }, /* SPDIF out */
  1071. { }
  1072. },
  1073. .chained = true,
  1074. .chain_id = ALC880_FIXUP_VOL_KNOB,
  1075. },
  1076. [ALC880_FIXUP_F1734] = {
  1077. /* almost compatible with FUJITSU, but no bass and SPDIF */
  1078. .type = HDA_FIXUP_PINS,
  1079. .v.pins = (const struct hda_pintbl[]) {
  1080. { 0x14, 0x0121401f }, /* HP */
  1081. { 0x15, 0x99030120 }, /* speaker */
  1082. { 0x16, 0x411111f0 }, /* N/A */
  1083. { 0x17, 0x411111f0 }, /* N/A */
  1084. { 0x18, 0x411111f0 }, /* N/A */
  1085. { 0x19, 0x01a19950 }, /* mic-in */
  1086. { 0x1a, 0x411111f0 }, /* N/A */
  1087. { 0x1b, 0x411111f0 }, /* N/A */
  1088. { 0x1c, 0x411111f0 }, /* N/A */
  1089. { 0x1d, 0x411111f0 }, /* N/A */
  1090. { 0x1e, 0x411111f0 }, /* N/A */
  1091. { }
  1092. },
  1093. .chained = true,
  1094. .chain_id = ALC880_FIXUP_VOL_KNOB,
  1095. },
  1096. [ALC880_FIXUP_UNIWILL] = {
  1097. /* need to fix HP and speaker pins to be parsed correctly */
  1098. .type = HDA_FIXUP_PINS,
  1099. .v.pins = (const struct hda_pintbl[]) {
  1100. { 0x14, 0x0121411f }, /* HP */
  1101. { 0x15, 0x99030120 }, /* speaker */
  1102. { 0x16, 0x99030130 }, /* bass speaker */
  1103. { }
  1104. },
  1105. },
  1106. [ALC880_FIXUP_UNIWILL_DIG] = {
  1107. .type = HDA_FIXUP_PINS,
  1108. .v.pins = (const struct hda_pintbl[]) {
  1109. /* disable bogus unused pins */
  1110. { 0x17, 0x411111f0 },
  1111. { 0x19, 0x411111f0 },
  1112. { 0x1b, 0x411111f0 },
  1113. { 0x1f, 0x411111f0 },
  1114. { }
  1115. }
  1116. },
  1117. [ALC880_FIXUP_Z71V] = {
  1118. .type = HDA_FIXUP_PINS,
  1119. .v.pins = (const struct hda_pintbl[]) {
  1120. /* set up the whole pins as BIOS is utterly broken */
  1121. { 0x14, 0x99030120 }, /* speaker */
  1122. { 0x15, 0x0121411f }, /* HP */
  1123. { 0x16, 0x411111f0 }, /* N/A */
  1124. { 0x17, 0x411111f0 }, /* N/A */
  1125. { 0x18, 0x01a19950 }, /* mic-in */
  1126. { 0x19, 0x411111f0 }, /* N/A */
  1127. { 0x1a, 0x01813031 }, /* line-in */
  1128. { 0x1b, 0x411111f0 }, /* N/A */
  1129. { 0x1c, 0x411111f0 }, /* N/A */
  1130. { 0x1d, 0x411111f0 }, /* N/A */
  1131. { 0x1e, 0x0144111e }, /* SPDIF */
  1132. { }
  1133. }
  1134. },
  1135. [ALC880_FIXUP_ASUS_W5A] = {
  1136. .type = HDA_FIXUP_PINS,
  1137. .v.pins = (const struct hda_pintbl[]) {
  1138. /* set up the whole pins as BIOS is utterly broken */
  1139. { 0x14, 0x0121411f }, /* HP */
  1140. { 0x15, 0x411111f0 }, /* N/A */
  1141. { 0x16, 0x411111f0 }, /* N/A */
  1142. { 0x17, 0x411111f0 }, /* N/A */
  1143. { 0x18, 0x90a60160 }, /* mic */
  1144. { 0x19, 0x411111f0 }, /* N/A */
  1145. { 0x1a, 0x411111f0 }, /* N/A */
  1146. { 0x1b, 0x411111f0 }, /* N/A */
  1147. { 0x1c, 0x411111f0 }, /* N/A */
  1148. { 0x1d, 0x411111f0 }, /* N/A */
  1149. { 0x1e, 0xb743111e }, /* SPDIF out */
  1150. { }
  1151. },
  1152. .chained = true,
  1153. .chain_id = ALC880_FIXUP_GPIO1,
  1154. },
  1155. [ALC880_FIXUP_3ST_BASE] = {
  1156. .type = HDA_FIXUP_PINS,
  1157. .v.pins = (const struct hda_pintbl[]) {
  1158. { 0x14, 0x01014010 }, /* line-out */
  1159. { 0x15, 0x411111f0 }, /* N/A */
  1160. { 0x16, 0x411111f0 }, /* N/A */
  1161. { 0x17, 0x411111f0 }, /* N/A */
  1162. { 0x18, 0x01a19c30 }, /* mic-in */
  1163. { 0x19, 0x0121411f }, /* HP */
  1164. { 0x1a, 0x01813031 }, /* line-in */
  1165. { 0x1b, 0x02a19c40 }, /* front-mic */
  1166. { 0x1c, 0x411111f0 }, /* N/A */
  1167. { 0x1d, 0x411111f0 }, /* N/A */
  1168. /* 0x1e is filled in below */
  1169. { 0x1f, 0x411111f0 }, /* N/A */
  1170. { }
  1171. }
  1172. },
  1173. [ALC880_FIXUP_3ST] = {
  1174. .type = HDA_FIXUP_PINS,
  1175. .v.pins = (const struct hda_pintbl[]) {
  1176. { 0x1e, 0x411111f0 }, /* N/A */
  1177. { }
  1178. },
  1179. .chained = true,
  1180. .chain_id = ALC880_FIXUP_3ST_BASE,
  1181. },
  1182. [ALC880_FIXUP_3ST_DIG] = {
  1183. .type = HDA_FIXUP_PINS,
  1184. .v.pins = (const struct hda_pintbl[]) {
  1185. { 0x1e, 0x0144111e }, /* SPDIF */
  1186. { }
  1187. },
  1188. .chained = true,
  1189. .chain_id = ALC880_FIXUP_3ST_BASE,
  1190. },
  1191. [ALC880_FIXUP_5ST_BASE] = {
  1192. .type = HDA_FIXUP_PINS,
  1193. .v.pins = (const struct hda_pintbl[]) {
  1194. { 0x14, 0x01014010 }, /* front */
  1195. { 0x15, 0x411111f0 }, /* N/A */
  1196. { 0x16, 0x01011411 }, /* CLFE */
  1197. { 0x17, 0x01016412 }, /* surr */
  1198. { 0x18, 0x01a19c30 }, /* mic-in */
  1199. { 0x19, 0x0121411f }, /* HP */
  1200. { 0x1a, 0x01813031 }, /* line-in */
  1201. { 0x1b, 0x02a19c40 }, /* front-mic */
  1202. { 0x1c, 0x411111f0 }, /* N/A */
  1203. { 0x1d, 0x411111f0 }, /* N/A */
  1204. /* 0x1e is filled in below */
  1205. { 0x1f, 0x411111f0 }, /* N/A */
  1206. { }
  1207. }
  1208. },
  1209. [ALC880_FIXUP_5ST] = {
  1210. .type = HDA_FIXUP_PINS,
  1211. .v.pins = (const struct hda_pintbl[]) {
  1212. { 0x1e, 0x411111f0 }, /* N/A */
  1213. { }
  1214. },
  1215. .chained = true,
  1216. .chain_id = ALC880_FIXUP_5ST_BASE,
  1217. },
  1218. [ALC880_FIXUP_5ST_DIG] = {
  1219. .type = HDA_FIXUP_PINS,
  1220. .v.pins = (const struct hda_pintbl[]) {
  1221. { 0x1e, 0x0144111e }, /* SPDIF */
  1222. { }
  1223. },
  1224. .chained = true,
  1225. .chain_id = ALC880_FIXUP_5ST_BASE,
  1226. },
  1227. [ALC880_FIXUP_6ST_BASE] = {
  1228. .type = HDA_FIXUP_PINS,
  1229. .v.pins = (const struct hda_pintbl[]) {
  1230. { 0x14, 0x01014010 }, /* front */
  1231. { 0x15, 0x01016412 }, /* surr */
  1232. { 0x16, 0x01011411 }, /* CLFE */
  1233. { 0x17, 0x01012414 }, /* side */
  1234. { 0x18, 0x01a19c30 }, /* mic-in */
  1235. { 0x19, 0x02a19c40 }, /* front-mic */
  1236. { 0x1a, 0x01813031 }, /* line-in */
  1237. { 0x1b, 0x0121411f }, /* HP */
  1238. { 0x1c, 0x411111f0 }, /* N/A */
  1239. { 0x1d, 0x411111f0 }, /* N/A */
  1240. /* 0x1e is filled in below */
  1241. { 0x1f, 0x411111f0 }, /* N/A */
  1242. { }
  1243. }
  1244. },
  1245. [ALC880_FIXUP_6ST] = {
  1246. .type = HDA_FIXUP_PINS,
  1247. .v.pins = (const struct hda_pintbl[]) {
  1248. { 0x1e, 0x411111f0 }, /* N/A */
  1249. { }
  1250. },
  1251. .chained = true,
  1252. .chain_id = ALC880_FIXUP_6ST_BASE,
  1253. },
  1254. [ALC880_FIXUP_6ST_DIG] = {
  1255. .type = HDA_FIXUP_PINS,
  1256. .v.pins = (const struct hda_pintbl[]) {
  1257. { 0x1e, 0x0144111e }, /* SPDIF */
  1258. { }
  1259. },
  1260. .chained = true,
  1261. .chain_id = ALC880_FIXUP_6ST_BASE,
  1262. },
  1263. [ALC880_FIXUP_6ST_AUTOMUTE] = {
  1264. .type = HDA_FIXUP_PINS,
  1265. .v.pins = (const struct hda_pintbl[]) {
  1266. { 0x1b, 0x0121401f }, /* HP with jack detect */
  1267. { }
  1268. },
  1269. .chained_before = true,
  1270. .chain_id = ALC880_FIXUP_6ST_BASE,
  1271. },
  1272. };
  1273. static const struct snd_pci_quirk alc880_fixup_tbl[] = {
  1274. SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
  1275. SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
  1276. SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
  1277. SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
  1278. SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
  1279. SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
  1280. SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
  1281. SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
  1282. SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
  1283. SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
  1284. SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
  1285. SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
  1286. SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
  1287. SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
  1288. SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
  1289. SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
  1290. SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
  1291. SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
  1292. SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
  1293. SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
  1294. SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
  1295. SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
  1296. SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
  1297. /* Below is the copied entries from alc880_quirks.c.
  1298. * It's not quite sure whether BIOS sets the correct pin-config table
  1299. * on these machines, thus they are kept to be compatible with
  1300. * the old static quirks. Once when it's confirmed to work without
  1301. * these overrides, it'd be better to remove.
  1302. */
  1303. SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
  1304. SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
  1305. SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
  1306. SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
  1307. SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
  1308. SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
  1309. SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
  1310. SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
  1311. SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
  1312. SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
  1313. SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
  1314. SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
  1315. SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
  1316. SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
  1317. SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
  1318. SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
  1319. SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
  1320. SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
  1321. SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
  1322. SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
  1323. SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
  1324. SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
  1325. SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
  1326. SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
  1327. SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
  1328. SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
  1329. SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
  1330. SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
  1331. SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
  1332. SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
  1333. SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
  1334. SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
  1335. SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
  1336. /* default Intel */
  1337. SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
  1338. SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
  1339. SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
  1340. {}
  1341. };
  1342. static const struct hda_model_fixup alc880_fixup_models[] = {
  1343. {.id = ALC880_FIXUP_3ST, .name = "3stack"},
  1344. {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
  1345. {.id = ALC880_FIXUP_5ST, .name = "5stack"},
  1346. {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
  1347. {.id = ALC880_FIXUP_6ST, .name = "6stack"},
  1348. {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
  1349. {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
  1350. {}
  1351. };
  1352. /*
  1353. * OK, here we have finally the patch for ALC880
  1354. */
  1355. static int patch_alc880(struct hda_codec *codec)
  1356. {
  1357. struct alc_spec *spec;
  1358. int err;
  1359. err = alc_alloc_spec(codec, 0x0b);
  1360. if (err < 0)
  1361. return err;
  1362. spec = codec->spec;
  1363. spec->gen.need_dac_fix = 1;
  1364. spec->gen.beep_nid = 0x01;
  1365. codec->patch_ops.unsol_event = alc880_unsol_event;
  1366. snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
  1367. alc880_fixups);
  1368. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  1369. /* automatic parse from the BIOS config */
  1370. err = alc880_parse_auto_config(codec);
  1371. if (err < 0)
  1372. goto error;
  1373. if (!spec->gen.no_analog)
  1374. set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
  1375. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  1376. return 0;
  1377. error:
  1378. alc_free(codec);
  1379. return err;
  1380. }
  1381. /*
  1382. * ALC260 support
  1383. */
  1384. static int alc260_parse_auto_config(struct hda_codec *codec)
  1385. {
  1386. static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
  1387. static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
  1388. return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
  1389. }
  1390. /*
  1391. * Pin config fixes
  1392. */
  1393. enum {
  1394. ALC260_FIXUP_HP_DC5750,
  1395. ALC260_FIXUP_HP_PIN_0F,
  1396. ALC260_FIXUP_COEF,
  1397. ALC260_FIXUP_GPIO1,
  1398. ALC260_FIXUP_GPIO1_TOGGLE,
  1399. ALC260_FIXUP_REPLACER,
  1400. ALC260_FIXUP_HP_B1900,
  1401. ALC260_FIXUP_KN1,
  1402. ALC260_FIXUP_FSC_S7020,
  1403. ALC260_FIXUP_FSC_S7020_JWSE,
  1404. ALC260_FIXUP_VAIO_PINS,
  1405. };
  1406. static void alc260_gpio1_automute(struct hda_codec *codec)
  1407. {
  1408. struct alc_spec *spec = codec->spec;
  1409. snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
  1410. spec->gen.hp_jack_present);
  1411. }
  1412. static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
  1413. const struct hda_fixup *fix, int action)
  1414. {
  1415. struct alc_spec *spec = codec->spec;
  1416. if (action == HDA_FIXUP_ACT_PROBE) {
  1417. /* although the machine has only one output pin, we need to
  1418. * toggle GPIO1 according to the jack state
  1419. */
  1420. spec->gen.automute_hook = alc260_gpio1_automute;
  1421. spec->gen.detect_hp = 1;
  1422. spec->gen.automute_speaker = 1;
  1423. spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
  1424. snd_hda_jack_detect_enable_callback(codec, 0x0f,
  1425. snd_hda_gen_hp_automute);
  1426. snd_hda_add_verbs(codec, alc_gpio1_init_verbs);
  1427. }
  1428. }
  1429. static void alc260_fixup_kn1(struct hda_codec *codec,
  1430. const struct hda_fixup *fix, int action)
  1431. {
  1432. struct alc_spec *spec = codec->spec;
  1433. static const struct hda_pintbl pincfgs[] = {
  1434. { 0x0f, 0x02214000 }, /* HP/speaker */
  1435. { 0x12, 0x90a60160 }, /* int mic */
  1436. { 0x13, 0x02a19000 }, /* ext mic */
  1437. { 0x18, 0x01446000 }, /* SPDIF out */
  1438. /* disable bogus I/O pins */
  1439. { 0x10, 0x411111f0 },
  1440. { 0x11, 0x411111f0 },
  1441. { 0x14, 0x411111f0 },
  1442. { 0x15, 0x411111f0 },
  1443. { 0x16, 0x411111f0 },
  1444. { 0x17, 0x411111f0 },
  1445. { 0x19, 0x411111f0 },
  1446. { }
  1447. };
  1448. switch (action) {
  1449. case HDA_FIXUP_ACT_PRE_PROBE:
  1450. snd_hda_apply_pincfgs(codec, pincfgs);
  1451. break;
  1452. case HDA_FIXUP_ACT_PROBE:
  1453. spec->init_amp = ALC_INIT_NONE;
  1454. break;
  1455. }
  1456. }
  1457. static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
  1458. const struct hda_fixup *fix, int action)
  1459. {
  1460. struct alc_spec *spec = codec->spec;
  1461. if (action == HDA_FIXUP_ACT_PROBE)
  1462. spec->init_amp = ALC_INIT_NONE;
  1463. }
  1464. static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
  1465. const struct hda_fixup *fix, int action)
  1466. {
  1467. struct alc_spec *spec = codec->spec;
  1468. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  1469. spec->gen.add_jack_modes = 1;
  1470. spec->gen.hp_mic = 1;
  1471. }
  1472. }
  1473. static const struct hda_fixup alc260_fixups[] = {
  1474. [ALC260_FIXUP_HP_DC5750] = {
  1475. .type = HDA_FIXUP_PINS,
  1476. .v.pins = (const struct hda_pintbl[]) {
  1477. { 0x11, 0x90130110 }, /* speaker */
  1478. { }
  1479. }
  1480. },
  1481. [ALC260_FIXUP_HP_PIN_0F] = {
  1482. .type = HDA_FIXUP_PINS,
  1483. .v.pins = (const struct hda_pintbl[]) {
  1484. { 0x0f, 0x01214000 }, /* HP */
  1485. { }
  1486. }
  1487. },
  1488. [ALC260_FIXUP_COEF] = {
  1489. .type = HDA_FIXUP_VERBS,
  1490. .v.verbs = (const struct hda_verb[]) {
  1491. { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
  1492. { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
  1493. { }
  1494. },
  1495. },
  1496. [ALC260_FIXUP_GPIO1] = {
  1497. .type = HDA_FIXUP_VERBS,
  1498. .v.verbs = alc_gpio1_init_verbs,
  1499. },
  1500. [ALC260_FIXUP_GPIO1_TOGGLE] = {
  1501. .type = HDA_FIXUP_FUNC,
  1502. .v.func = alc260_fixup_gpio1_toggle,
  1503. .chained = true,
  1504. .chain_id = ALC260_FIXUP_HP_PIN_0F,
  1505. },
  1506. [ALC260_FIXUP_REPLACER] = {
  1507. .type = HDA_FIXUP_VERBS,
  1508. .v.verbs = (const struct hda_verb[]) {
  1509. { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
  1510. { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
  1511. { }
  1512. },
  1513. .chained = true,
  1514. .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
  1515. },
  1516. [ALC260_FIXUP_HP_B1900] = {
  1517. .type = HDA_FIXUP_FUNC,
  1518. .v.func = alc260_fixup_gpio1_toggle,
  1519. .chained = true,
  1520. .chain_id = ALC260_FIXUP_COEF,
  1521. },
  1522. [ALC260_FIXUP_KN1] = {
  1523. .type = HDA_FIXUP_FUNC,
  1524. .v.func = alc260_fixup_kn1,
  1525. },
  1526. [ALC260_FIXUP_FSC_S7020] = {
  1527. .type = HDA_FIXUP_FUNC,
  1528. .v.func = alc260_fixup_fsc_s7020,
  1529. },
  1530. [ALC260_FIXUP_FSC_S7020_JWSE] = {
  1531. .type = HDA_FIXUP_FUNC,
  1532. .v.func = alc260_fixup_fsc_s7020_jwse,
  1533. .chained = true,
  1534. .chain_id = ALC260_FIXUP_FSC_S7020,
  1535. },
  1536. [ALC260_FIXUP_VAIO_PINS] = {
  1537. .type = HDA_FIXUP_PINS,
  1538. .v.pins = (const struct hda_pintbl[]) {
  1539. /* Pin configs are missing completely on some VAIOs */
  1540. { 0x0f, 0x01211020 },
  1541. { 0x10, 0x0001003f },
  1542. { 0x11, 0x411111f0 },
  1543. { 0x12, 0x01a15930 },
  1544. { 0x13, 0x411111f0 },
  1545. { 0x14, 0x411111f0 },
  1546. { 0x15, 0x411111f0 },
  1547. { 0x16, 0x411111f0 },
  1548. { 0x17, 0x411111f0 },
  1549. { 0x18, 0x411111f0 },
  1550. { 0x19, 0x411111f0 },
  1551. { }
  1552. }
  1553. },
  1554. };
  1555. static const struct snd_pci_quirk alc260_fixup_tbl[] = {
  1556. SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
  1557. SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
  1558. SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
  1559. SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
  1560. SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
  1561. SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
  1562. SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
  1563. SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
  1564. SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
  1565. SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
  1566. SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
  1567. SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
  1568. {}
  1569. };
  1570. static const struct hda_model_fixup alc260_fixup_models[] = {
  1571. {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
  1572. {.id = ALC260_FIXUP_COEF, .name = "coef"},
  1573. {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
  1574. {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
  1575. {}
  1576. };
  1577. /*
  1578. */
  1579. static int patch_alc260(struct hda_codec *codec)
  1580. {
  1581. struct alc_spec *spec;
  1582. int err;
  1583. err = alc_alloc_spec(codec, 0x07);
  1584. if (err < 0)
  1585. return err;
  1586. spec = codec->spec;
  1587. /* as quite a few machines require HP amp for speaker outputs,
  1588. * it's easier to enable it unconditionally; even if it's unneeded,
  1589. * it's almost harmless.
  1590. */
  1591. spec->gen.prefer_hp_amp = 1;
  1592. spec->gen.beep_nid = 0x01;
  1593. spec->shutup = alc_eapd_shutup;
  1594. snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
  1595. alc260_fixups);
  1596. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  1597. /* automatic parse from the BIOS config */
  1598. err = alc260_parse_auto_config(codec);
  1599. if (err < 0)
  1600. goto error;
  1601. if (!spec->gen.no_analog)
  1602. set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
  1603. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  1604. return 0;
  1605. error:
  1606. alc_free(codec);
  1607. return err;
  1608. }
  1609. /*
  1610. * ALC882/883/885/888/889 support
  1611. *
  1612. * ALC882 is almost identical with ALC880 but has cleaner and more flexible
  1613. * configuration. Each pin widget can choose any input DACs and a mixer.
  1614. * Each ADC is connected from a mixer of all inputs. This makes possible
  1615. * 6-channel independent captures.
  1616. *
  1617. * In addition, an independent DAC for the multi-playback (not used in this
  1618. * driver yet).
  1619. */
  1620. /*
  1621. * Pin config fixes
  1622. */
  1623. enum {
  1624. ALC882_FIXUP_ABIT_AW9D_MAX,
  1625. ALC882_FIXUP_LENOVO_Y530,
  1626. ALC882_FIXUP_PB_M5210,
  1627. ALC882_FIXUP_ACER_ASPIRE_7736,
  1628. ALC882_FIXUP_ASUS_W90V,
  1629. ALC889_FIXUP_CD,
  1630. ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
  1631. ALC889_FIXUP_VAIO_TT,
  1632. ALC888_FIXUP_EEE1601,
  1633. ALC886_FIXUP_EAPD,
  1634. ALC882_FIXUP_EAPD,
  1635. ALC883_FIXUP_EAPD,
  1636. ALC883_FIXUP_ACER_EAPD,
  1637. ALC882_FIXUP_GPIO1,
  1638. ALC882_FIXUP_GPIO2,
  1639. ALC882_FIXUP_GPIO3,
  1640. ALC889_FIXUP_COEF,
  1641. ALC882_FIXUP_ASUS_W2JC,
  1642. ALC882_FIXUP_ACER_ASPIRE_4930G,
  1643. ALC882_FIXUP_ACER_ASPIRE_8930G,
  1644. ALC882_FIXUP_ASPIRE_8930G_VERBS,
  1645. ALC885_FIXUP_MACPRO_GPIO,
  1646. ALC889_FIXUP_DAC_ROUTE,
  1647. ALC889_FIXUP_MBP_VREF,
  1648. ALC889_FIXUP_IMAC91_VREF,
  1649. ALC889_FIXUP_MBA11_VREF,
  1650. ALC889_FIXUP_MBA21_VREF,
  1651. ALC889_FIXUP_MP11_VREF,
  1652. ALC889_FIXUP_MP41_VREF,
  1653. ALC882_FIXUP_INV_DMIC,
  1654. ALC882_FIXUP_NO_PRIMARY_HP,
  1655. ALC887_FIXUP_ASUS_BASS,
  1656. ALC887_FIXUP_BASS_CHMAP,
  1657. ALC1220_FIXUP_GB_DUAL_CODECS,
  1658. };
  1659. static void alc889_fixup_coef(struct hda_codec *codec,
  1660. const struct hda_fixup *fix, int action)
  1661. {
  1662. if (action != HDA_FIXUP_ACT_INIT)
  1663. return;
  1664. alc_update_coef_idx(codec, 7, 0, 0x2030);
  1665. }
  1666. /* toggle speaker-output according to the hp-jack state */
  1667. static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
  1668. {
  1669. unsigned int gpiostate, gpiomask, gpiodir;
  1670. gpiostate = snd_hda_codec_read(codec, codec->core.afg, 0,
  1671. AC_VERB_GET_GPIO_DATA, 0);
  1672. if (!muted)
  1673. gpiostate |= (1 << pin);
  1674. else
  1675. gpiostate &= ~(1 << pin);
  1676. gpiomask = snd_hda_codec_read(codec, codec->core.afg, 0,
  1677. AC_VERB_GET_GPIO_MASK, 0);
  1678. gpiomask |= (1 << pin);
  1679. gpiodir = snd_hda_codec_read(codec, codec->core.afg, 0,
  1680. AC_VERB_GET_GPIO_DIRECTION, 0);
  1681. gpiodir |= (1 << pin);
  1682. snd_hda_codec_write(codec, codec->core.afg, 0,
  1683. AC_VERB_SET_GPIO_MASK, gpiomask);
  1684. snd_hda_codec_write(codec, codec->core.afg, 0,
  1685. AC_VERB_SET_GPIO_DIRECTION, gpiodir);
  1686. msleep(1);
  1687. snd_hda_codec_write(codec, codec->core.afg, 0,
  1688. AC_VERB_SET_GPIO_DATA, gpiostate);
  1689. }
  1690. /* set up GPIO at initialization */
  1691. static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
  1692. const struct hda_fixup *fix, int action)
  1693. {
  1694. if (action != HDA_FIXUP_ACT_INIT)
  1695. return;
  1696. alc882_gpio_mute(codec, 0, 0);
  1697. alc882_gpio_mute(codec, 1, 0);
  1698. }
  1699. /* Fix the connection of some pins for ALC889:
  1700. * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
  1701. * work correctly (bko#42740)
  1702. */
  1703. static void alc889_fixup_dac_route(struct hda_codec *codec,
  1704. const struct hda_fixup *fix, int action)
  1705. {
  1706. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  1707. /* fake the connections during parsing the tree */
  1708. hda_nid_t conn1[2] = { 0x0c, 0x0d };
  1709. hda_nid_t conn2[2] = { 0x0e, 0x0f };
  1710. snd_hda_override_conn_list(codec, 0x14, 2, conn1);
  1711. snd_hda_override_conn_list(codec, 0x15, 2, conn1);
  1712. snd_hda_override_conn_list(codec, 0x18, 2, conn2);
  1713. snd_hda_override_conn_list(codec, 0x1a, 2, conn2);
  1714. } else if (action == HDA_FIXUP_ACT_PROBE) {
  1715. /* restore the connections */
  1716. hda_nid_t conn[5] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
  1717. snd_hda_override_conn_list(codec, 0x14, 5, conn);
  1718. snd_hda_override_conn_list(codec, 0x15, 5, conn);
  1719. snd_hda_override_conn_list(codec, 0x18, 5, conn);
  1720. snd_hda_override_conn_list(codec, 0x1a, 5, conn);
  1721. }
  1722. }
  1723. /* Set VREF on HP pin */
  1724. static void alc889_fixup_mbp_vref(struct hda_codec *codec,
  1725. const struct hda_fixup *fix, int action)
  1726. {
  1727. struct alc_spec *spec = codec->spec;
  1728. static hda_nid_t nids[3] = { 0x14, 0x15, 0x19 };
  1729. int i;
  1730. if (action != HDA_FIXUP_ACT_INIT)
  1731. return;
  1732. for (i = 0; i < ARRAY_SIZE(nids); i++) {
  1733. unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
  1734. if (get_defcfg_device(val) != AC_JACK_HP_OUT)
  1735. continue;
  1736. val = snd_hda_codec_get_pin_target(codec, nids[i]);
  1737. val |= AC_PINCTL_VREF_80;
  1738. snd_hda_set_pin_ctl(codec, nids[i], val);
  1739. spec->gen.keep_vref_in_automute = 1;
  1740. break;
  1741. }
  1742. }
  1743. static void alc889_fixup_mac_pins(struct hda_codec *codec,
  1744. const hda_nid_t *nids, int num_nids)
  1745. {
  1746. struct alc_spec *spec = codec->spec;
  1747. int i;
  1748. for (i = 0; i < num_nids; i++) {
  1749. unsigned int val;
  1750. val = snd_hda_codec_get_pin_target(codec, nids[i]);
  1751. val |= AC_PINCTL_VREF_50;
  1752. snd_hda_set_pin_ctl(codec, nids[i], val);
  1753. }
  1754. spec->gen.keep_vref_in_automute = 1;
  1755. }
  1756. /* Set VREF on speaker pins on imac91 */
  1757. static void alc889_fixup_imac91_vref(struct hda_codec *codec,
  1758. const struct hda_fixup *fix, int action)
  1759. {
  1760. static hda_nid_t nids[2] = { 0x18, 0x1a };
  1761. if (action == HDA_FIXUP_ACT_INIT)
  1762. alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
  1763. }
  1764. /* Set VREF on speaker pins on mba11 */
  1765. static void alc889_fixup_mba11_vref(struct hda_codec *codec,
  1766. const struct hda_fixup *fix, int action)
  1767. {
  1768. static hda_nid_t nids[1] = { 0x18 };
  1769. if (action == HDA_FIXUP_ACT_INIT)
  1770. alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
  1771. }
  1772. /* Set VREF on speaker pins on mba21 */
  1773. static void alc889_fixup_mba21_vref(struct hda_codec *codec,
  1774. const struct hda_fixup *fix, int action)
  1775. {
  1776. static hda_nid_t nids[2] = { 0x18, 0x19 };
  1777. if (action == HDA_FIXUP_ACT_INIT)
  1778. alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
  1779. }
  1780. /* Don't take HP output as primary
  1781. * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
  1782. * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
  1783. */
  1784. static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
  1785. const struct hda_fixup *fix, int action)
  1786. {
  1787. struct alc_spec *spec = codec->spec;
  1788. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  1789. spec->gen.no_primary_hp = 1;
  1790. spec->gen.no_multi_io = 1;
  1791. }
  1792. }
  1793. static void alc_fixup_bass_chmap(struct hda_codec *codec,
  1794. const struct hda_fixup *fix, int action);
  1795. /* For dual-codec configuration, we need to disable some features to avoid
  1796. * conflicts of kctls and PCM streams
  1797. */
  1798. static void alc_fixup_dual_codecs(struct hda_codec *codec,
  1799. const struct hda_fixup *fix, int action)
  1800. {
  1801. struct alc_spec *spec = codec->spec;
  1802. if (action != HDA_FIXUP_ACT_PRE_PROBE)
  1803. return;
  1804. /* disable vmaster */
  1805. spec->gen.suppress_vmaster = 1;
  1806. /* auto-mute and auto-mic switch don't work with multiple codecs */
  1807. spec->gen.suppress_auto_mute = 1;
  1808. spec->gen.suppress_auto_mic = 1;
  1809. /* disable aamix as well */
  1810. spec->gen.mixer_nid = 0;
  1811. /* add location prefix to avoid conflicts */
  1812. codec->force_pin_prefix = 1;
  1813. }
  1814. static void rename_ctl(struct hda_codec *codec, const char *oldname,
  1815. const char *newname)
  1816. {
  1817. struct snd_kcontrol *kctl;
  1818. kctl = snd_hda_find_mixer_ctl(codec, oldname);
  1819. if (kctl)
  1820. strcpy(kctl->id.name, newname);
  1821. }
  1822. static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
  1823. const struct hda_fixup *fix,
  1824. int action)
  1825. {
  1826. alc_fixup_dual_codecs(codec, fix, action);
  1827. switch (action) {
  1828. case HDA_FIXUP_ACT_PRE_PROBE:
  1829. /* override card longname to provide a unique UCM profile */
  1830. strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
  1831. break;
  1832. case HDA_FIXUP_ACT_BUILD:
  1833. /* rename Capture controls depending on the codec */
  1834. rename_ctl(codec, "Capture Volume",
  1835. codec->addr == 0 ?
  1836. "Rear-Panel Capture Volume" :
  1837. "Front-Panel Capture Volume");
  1838. rename_ctl(codec, "Capture Switch",
  1839. codec->addr == 0 ?
  1840. "Rear-Panel Capture Switch" :
  1841. "Front-Panel Capture Switch");
  1842. break;
  1843. }
  1844. }
  1845. static const struct hda_fixup alc882_fixups[] = {
  1846. [ALC882_FIXUP_ABIT_AW9D_MAX] = {
  1847. .type = HDA_FIXUP_PINS,
  1848. .v.pins = (const struct hda_pintbl[]) {
  1849. { 0x15, 0x01080104 }, /* side */
  1850. { 0x16, 0x01011012 }, /* rear */
  1851. { 0x17, 0x01016011 }, /* clfe */
  1852. { }
  1853. }
  1854. },
  1855. [ALC882_FIXUP_LENOVO_Y530] = {
  1856. .type = HDA_FIXUP_PINS,
  1857. .v.pins = (const struct hda_pintbl[]) {
  1858. { 0x15, 0x99130112 }, /* rear int speakers */
  1859. { 0x16, 0x99130111 }, /* subwoofer */
  1860. { }
  1861. }
  1862. },
  1863. [ALC882_FIXUP_PB_M5210] = {
  1864. .type = HDA_FIXUP_PINCTLS,
  1865. .v.pins = (const struct hda_pintbl[]) {
  1866. { 0x19, PIN_VREF50 },
  1867. {}
  1868. }
  1869. },
  1870. [ALC882_FIXUP_ACER_ASPIRE_7736] = {
  1871. .type = HDA_FIXUP_FUNC,
  1872. .v.func = alc_fixup_sku_ignore,
  1873. },
  1874. [ALC882_FIXUP_ASUS_W90V] = {
  1875. .type = HDA_FIXUP_PINS,
  1876. .v.pins = (const struct hda_pintbl[]) {
  1877. { 0x16, 0x99130110 }, /* fix sequence for CLFE */
  1878. { }
  1879. }
  1880. },
  1881. [ALC889_FIXUP_CD] = {
  1882. .type = HDA_FIXUP_PINS,
  1883. .v.pins = (const struct hda_pintbl[]) {
  1884. { 0x1c, 0x993301f0 }, /* CD */
  1885. { }
  1886. }
  1887. },
  1888. [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
  1889. .type = HDA_FIXUP_PINS,
  1890. .v.pins = (const struct hda_pintbl[]) {
  1891. { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
  1892. { }
  1893. },
  1894. .chained = true,
  1895. .chain_id = ALC889_FIXUP_CD,
  1896. },
  1897. [ALC889_FIXUP_VAIO_TT] = {
  1898. .type = HDA_FIXUP_PINS,
  1899. .v.pins = (const struct hda_pintbl[]) {
  1900. { 0x17, 0x90170111 }, /* hidden surround speaker */
  1901. { }
  1902. }
  1903. },
  1904. [ALC888_FIXUP_EEE1601] = {
  1905. .type = HDA_FIXUP_VERBS,
  1906. .v.verbs = (const struct hda_verb[]) {
  1907. { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
  1908. { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
  1909. { }
  1910. }
  1911. },
  1912. [ALC886_FIXUP_EAPD] = {
  1913. .type = HDA_FIXUP_VERBS,
  1914. .v.verbs = (const struct hda_verb[]) {
  1915. /* change to EAPD mode */
  1916. { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
  1917. { 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
  1918. { }
  1919. }
  1920. },
  1921. [ALC882_FIXUP_EAPD] = {
  1922. .type = HDA_FIXUP_VERBS,
  1923. .v.verbs = (const struct hda_verb[]) {
  1924. /* change to EAPD mode */
  1925. { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
  1926. { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
  1927. { }
  1928. }
  1929. },
  1930. [ALC883_FIXUP_EAPD] = {
  1931. .type = HDA_FIXUP_VERBS,
  1932. .v.verbs = (const struct hda_verb[]) {
  1933. /* change to EAPD mode */
  1934. { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
  1935. { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
  1936. { }
  1937. }
  1938. },
  1939. [ALC883_FIXUP_ACER_EAPD] = {
  1940. .type = HDA_FIXUP_VERBS,
  1941. .v.verbs = (const struct hda_verb[]) {
  1942. /* eanable EAPD on Acer laptops */
  1943. { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
  1944. { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
  1945. { }
  1946. }
  1947. },
  1948. [ALC882_FIXUP_GPIO1] = {
  1949. .type = HDA_FIXUP_VERBS,
  1950. .v.verbs = alc_gpio1_init_verbs,
  1951. },
  1952. [ALC882_FIXUP_GPIO2] = {
  1953. .type = HDA_FIXUP_VERBS,
  1954. .v.verbs = alc_gpio2_init_verbs,
  1955. },
  1956. [ALC882_FIXUP_GPIO3] = {
  1957. .type = HDA_FIXUP_VERBS,
  1958. .v.verbs = alc_gpio3_init_verbs,
  1959. },
  1960. [ALC882_FIXUP_ASUS_W2JC] = {
  1961. .type = HDA_FIXUP_VERBS,
  1962. .v.verbs = alc_gpio1_init_verbs,
  1963. .chained = true,
  1964. .chain_id = ALC882_FIXUP_EAPD,
  1965. },
  1966. [ALC889_FIXUP_COEF] = {
  1967. .type = HDA_FIXUP_FUNC,
  1968. .v.func = alc889_fixup_coef,
  1969. },
  1970. [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
  1971. .type = HDA_FIXUP_PINS,
  1972. .v.pins = (const struct hda_pintbl[]) {
  1973. { 0x16, 0x99130111 }, /* CLFE speaker */
  1974. { 0x17, 0x99130112 }, /* surround speaker */
  1975. { }
  1976. },
  1977. .chained = true,
  1978. .chain_id = ALC882_FIXUP_GPIO1,
  1979. },
  1980. [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
  1981. .type = HDA_FIXUP_PINS,
  1982. .v.pins = (const struct hda_pintbl[]) {
  1983. { 0x16, 0x99130111 }, /* CLFE speaker */
  1984. { 0x1b, 0x99130112 }, /* surround speaker */
  1985. { }
  1986. },
  1987. .chained = true,
  1988. .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
  1989. },
  1990. [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
  1991. /* additional init verbs for Acer Aspire 8930G */
  1992. .type = HDA_FIXUP_VERBS,
  1993. .v.verbs = (const struct hda_verb[]) {
  1994. /* Enable all DACs */
  1995. /* DAC DISABLE/MUTE 1? */
  1996. /* setting bits 1-5 disables DAC nids 0x02-0x06
  1997. * apparently. Init=0x38 */
  1998. { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
  1999. { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
  2000. /* DAC DISABLE/MUTE 2? */
  2001. /* some bit here disables the other DACs.
  2002. * Init=0x4900 */
  2003. { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
  2004. { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
  2005. /* DMIC fix
  2006. * This laptop has a stereo digital microphone.
  2007. * The mics are only 1cm apart which makes the stereo
  2008. * useless. However, either the mic or the ALC889
  2009. * makes the signal become a difference/sum signal
  2010. * instead of standard stereo, which is annoying.
  2011. * So instead we flip this bit which makes the
  2012. * codec replicate the sum signal to both channels,
  2013. * turning it into a normal mono mic.
  2014. */
  2015. /* DMIC_CONTROL? Init value = 0x0001 */
  2016. { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
  2017. { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
  2018. { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
  2019. { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
  2020. { }
  2021. },
  2022. .chained = true,
  2023. .chain_id = ALC882_FIXUP_GPIO1,
  2024. },
  2025. [ALC885_FIXUP_MACPRO_GPIO] = {
  2026. .type = HDA_FIXUP_FUNC,
  2027. .v.func = alc885_fixup_macpro_gpio,
  2028. },
  2029. [ALC889_FIXUP_DAC_ROUTE] = {
  2030. .type = HDA_FIXUP_FUNC,
  2031. .v.func = alc889_fixup_dac_route,
  2032. },
  2033. [ALC889_FIXUP_MBP_VREF] = {
  2034. .type = HDA_FIXUP_FUNC,
  2035. .v.func = alc889_fixup_mbp_vref,
  2036. .chained = true,
  2037. .chain_id = ALC882_FIXUP_GPIO1,
  2038. },
  2039. [ALC889_FIXUP_IMAC91_VREF] = {
  2040. .type = HDA_FIXUP_FUNC,
  2041. .v.func = alc889_fixup_imac91_vref,
  2042. .chained = true,
  2043. .chain_id = ALC882_FIXUP_GPIO1,
  2044. },
  2045. [ALC889_FIXUP_MBA11_VREF] = {
  2046. .type = HDA_FIXUP_FUNC,
  2047. .v.func = alc889_fixup_mba11_vref,
  2048. .chained = true,
  2049. .chain_id = ALC889_FIXUP_MBP_VREF,
  2050. },
  2051. [ALC889_FIXUP_MBA21_VREF] = {
  2052. .type = HDA_FIXUP_FUNC,
  2053. .v.func = alc889_fixup_mba21_vref,
  2054. .chained = true,
  2055. .chain_id = ALC889_FIXUP_MBP_VREF,
  2056. },
  2057. [ALC889_FIXUP_MP11_VREF] = {
  2058. .type = HDA_FIXUP_FUNC,
  2059. .v.func = alc889_fixup_mba11_vref,
  2060. .chained = true,
  2061. .chain_id = ALC885_FIXUP_MACPRO_GPIO,
  2062. },
  2063. [ALC889_FIXUP_MP41_VREF] = {
  2064. .type = HDA_FIXUP_FUNC,
  2065. .v.func = alc889_fixup_mbp_vref,
  2066. .chained = true,
  2067. .chain_id = ALC885_FIXUP_MACPRO_GPIO,
  2068. },
  2069. [ALC882_FIXUP_INV_DMIC] = {
  2070. .type = HDA_FIXUP_FUNC,
  2071. .v.func = alc_fixup_inv_dmic,
  2072. },
  2073. [ALC882_FIXUP_NO_PRIMARY_HP] = {
  2074. .type = HDA_FIXUP_FUNC,
  2075. .v.func = alc882_fixup_no_primary_hp,
  2076. },
  2077. [ALC887_FIXUP_ASUS_BASS] = {
  2078. .type = HDA_FIXUP_PINS,
  2079. .v.pins = (const struct hda_pintbl[]) {
  2080. {0x16, 0x99130130}, /* bass speaker */
  2081. {}
  2082. },
  2083. .chained = true,
  2084. .chain_id = ALC887_FIXUP_BASS_CHMAP,
  2085. },
  2086. [ALC887_FIXUP_BASS_CHMAP] = {
  2087. .type = HDA_FIXUP_FUNC,
  2088. .v.func = alc_fixup_bass_chmap,
  2089. },
  2090. [ALC1220_FIXUP_GB_DUAL_CODECS] = {
  2091. .type = HDA_FIXUP_FUNC,
  2092. .v.func = alc1220_fixup_gb_dual_codecs,
  2093. },
  2094. };
  2095. static const struct snd_pci_quirk alc882_fixup_tbl[] = {
  2096. SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
  2097. SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
  2098. SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
  2099. SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
  2100. SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
  2101. SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
  2102. SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
  2103. SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
  2104. ALC882_FIXUP_ACER_ASPIRE_4930G),
  2105. SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
  2106. ALC882_FIXUP_ACER_ASPIRE_4930G),
  2107. SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
  2108. ALC882_FIXUP_ACER_ASPIRE_8930G),
  2109. SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
  2110. ALC882_FIXUP_ACER_ASPIRE_8930G),
  2111. SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
  2112. ALC882_FIXUP_ACER_ASPIRE_4930G),
  2113. SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
  2114. SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
  2115. ALC882_FIXUP_ACER_ASPIRE_4930G),
  2116. SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
  2117. ALC882_FIXUP_ACER_ASPIRE_4930G),
  2118. SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
  2119. ALC882_FIXUP_ACER_ASPIRE_4930G),
  2120. SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
  2121. SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
  2122. SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
  2123. SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
  2124. SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
  2125. SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
  2126. SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
  2127. SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
  2128. SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
  2129. SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
  2130. SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
  2131. SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
  2132. SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
  2133. SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
  2134. /* All Apple entries are in codec SSIDs */
  2135. SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
  2136. SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
  2137. SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
  2138. SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
  2139. SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
  2140. SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
  2141. SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
  2142. SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
  2143. SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
  2144. SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
  2145. SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
  2146. SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
  2147. SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
  2148. SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
  2149. SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
  2150. SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
  2151. SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
  2152. SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
  2153. SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
  2154. SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
  2155. SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
  2156. SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
  2157. SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
  2158. SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
  2159. SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
  2160. SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
  2161. SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
  2162. SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
  2163. SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
  2164. SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
  2165. SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
  2166. SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
  2167. SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
  2168. SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
  2169. {}
  2170. };
  2171. static const struct hda_model_fixup alc882_fixup_models[] = {
  2172. {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
  2173. {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
  2174. {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
  2175. {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
  2176. {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
  2177. {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
  2178. {}
  2179. };
  2180. /*
  2181. * BIOS auto configuration
  2182. */
  2183. /* almost identical with ALC880 parser... */
  2184. static int alc882_parse_auto_config(struct hda_codec *codec)
  2185. {
  2186. static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
  2187. static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
  2188. return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
  2189. }
  2190. /*
  2191. */
  2192. static int patch_alc882(struct hda_codec *codec)
  2193. {
  2194. struct alc_spec *spec;
  2195. int err;
  2196. err = alc_alloc_spec(codec, 0x0b);
  2197. if (err < 0)
  2198. return err;
  2199. spec = codec->spec;
  2200. switch (codec->core.vendor_id) {
  2201. case 0x10ec0882:
  2202. case 0x10ec0885:
  2203. case 0x10ec0900:
  2204. case 0x10ec0b00:
  2205. case 0x10ec1220:
  2206. break;
  2207. default:
  2208. /* ALC883 and variants */
  2209. alc_fix_pll_init(codec, 0x20, 0x0a, 10);
  2210. break;
  2211. }
  2212. snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
  2213. alc882_fixups);
  2214. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  2215. alc_auto_parse_customize_define(codec);
  2216. if (has_cdefine_beep(codec))
  2217. spec->gen.beep_nid = 0x01;
  2218. /* automatic parse from the BIOS config */
  2219. err = alc882_parse_auto_config(codec);
  2220. if (err < 0)
  2221. goto error;
  2222. if (!spec->gen.no_analog && spec->gen.beep_nid)
  2223. set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
  2224. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  2225. return 0;
  2226. error:
  2227. alc_free(codec);
  2228. return err;
  2229. }
  2230. /*
  2231. * ALC262 support
  2232. */
  2233. static int alc262_parse_auto_config(struct hda_codec *codec)
  2234. {
  2235. static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
  2236. static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
  2237. return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
  2238. }
  2239. /*
  2240. * Pin config fixes
  2241. */
  2242. enum {
  2243. ALC262_FIXUP_FSC_H270,
  2244. ALC262_FIXUP_FSC_S7110,
  2245. ALC262_FIXUP_HP_Z200,
  2246. ALC262_FIXUP_TYAN,
  2247. ALC262_FIXUP_LENOVO_3000,
  2248. ALC262_FIXUP_BENQ,
  2249. ALC262_FIXUP_BENQ_T31,
  2250. ALC262_FIXUP_INV_DMIC,
  2251. ALC262_FIXUP_INTEL_BAYLEYBAY,
  2252. };
  2253. static const struct hda_fixup alc262_fixups[] = {
  2254. [ALC262_FIXUP_FSC_H270] = {
  2255. .type = HDA_FIXUP_PINS,
  2256. .v.pins = (const struct hda_pintbl[]) {
  2257. { 0x14, 0x99130110 }, /* speaker */
  2258. { 0x15, 0x0221142f }, /* front HP */
  2259. { 0x1b, 0x0121141f }, /* rear HP */
  2260. { }
  2261. }
  2262. },
  2263. [ALC262_FIXUP_FSC_S7110] = {
  2264. .type = HDA_FIXUP_PINS,
  2265. .v.pins = (const struct hda_pintbl[]) {
  2266. { 0x15, 0x90170110 }, /* speaker */
  2267. { }
  2268. },
  2269. .chained = true,
  2270. .chain_id = ALC262_FIXUP_BENQ,
  2271. },
  2272. [ALC262_FIXUP_HP_Z200] = {
  2273. .type = HDA_FIXUP_PINS,
  2274. .v.pins = (const struct hda_pintbl[]) {
  2275. { 0x16, 0x99130120 }, /* internal speaker */
  2276. { }
  2277. }
  2278. },
  2279. [ALC262_FIXUP_TYAN] = {
  2280. .type = HDA_FIXUP_PINS,
  2281. .v.pins = (const struct hda_pintbl[]) {
  2282. { 0x14, 0x1993e1f0 }, /* int AUX */
  2283. { }
  2284. }
  2285. },
  2286. [ALC262_FIXUP_LENOVO_3000] = {
  2287. .type = HDA_FIXUP_PINCTLS,
  2288. .v.pins = (const struct hda_pintbl[]) {
  2289. { 0x19, PIN_VREF50 },
  2290. {}
  2291. },
  2292. .chained = true,
  2293. .chain_id = ALC262_FIXUP_BENQ,
  2294. },
  2295. [ALC262_FIXUP_BENQ] = {
  2296. .type = HDA_FIXUP_VERBS,
  2297. .v.verbs = (const struct hda_verb[]) {
  2298. { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
  2299. { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
  2300. {}
  2301. }
  2302. },
  2303. [ALC262_FIXUP_BENQ_T31] = {
  2304. .type = HDA_FIXUP_VERBS,
  2305. .v.verbs = (const struct hda_verb[]) {
  2306. { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
  2307. { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
  2308. {}
  2309. }
  2310. },
  2311. [ALC262_FIXUP_INV_DMIC] = {
  2312. .type = HDA_FIXUP_FUNC,
  2313. .v.func = alc_fixup_inv_dmic,
  2314. },
  2315. [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
  2316. .type = HDA_FIXUP_FUNC,
  2317. .v.func = alc_fixup_no_depop_delay,
  2318. },
  2319. };
  2320. static const struct snd_pci_quirk alc262_fixup_tbl[] = {
  2321. SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
  2322. SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
  2323. SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
  2324. SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
  2325. SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
  2326. SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
  2327. SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
  2328. SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
  2329. SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
  2330. SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
  2331. {}
  2332. };
  2333. static const struct hda_model_fixup alc262_fixup_models[] = {
  2334. {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
  2335. {}
  2336. };
  2337. /*
  2338. */
  2339. static int patch_alc262(struct hda_codec *codec)
  2340. {
  2341. struct alc_spec *spec;
  2342. int err;
  2343. err = alc_alloc_spec(codec, 0x0b);
  2344. if (err < 0)
  2345. return err;
  2346. spec = codec->spec;
  2347. spec->gen.shared_mic_vref_pin = 0x18;
  2348. spec->shutup = alc_eapd_shutup;
  2349. #if 0
  2350. /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
  2351. * under-run
  2352. */
  2353. alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
  2354. #endif
  2355. alc_fix_pll_init(codec, 0x20, 0x0a, 10);
  2356. snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
  2357. alc262_fixups);
  2358. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  2359. alc_auto_parse_customize_define(codec);
  2360. if (has_cdefine_beep(codec))
  2361. spec->gen.beep_nid = 0x01;
  2362. /* automatic parse from the BIOS config */
  2363. err = alc262_parse_auto_config(codec);
  2364. if (err < 0)
  2365. goto error;
  2366. if (!spec->gen.no_analog && spec->gen.beep_nid)
  2367. set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
  2368. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  2369. return 0;
  2370. error:
  2371. alc_free(codec);
  2372. return err;
  2373. }
  2374. /*
  2375. * ALC268
  2376. */
  2377. /* bind Beep switches of both NID 0x0f and 0x10 */
  2378. static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
  2379. struct snd_ctl_elem_value *ucontrol)
  2380. {
  2381. struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  2382. unsigned long pval;
  2383. int err;
  2384. mutex_lock(&codec->control_mutex);
  2385. pval = kcontrol->private_value;
  2386. kcontrol->private_value = (pval & ~0xff) | 0x0f;
  2387. err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
  2388. if (err >= 0) {
  2389. kcontrol->private_value = (pval & ~0xff) | 0x10;
  2390. err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
  2391. }
  2392. kcontrol->private_value = pval;
  2393. mutex_unlock(&codec->control_mutex);
  2394. return err;
  2395. }
  2396. static const struct snd_kcontrol_new alc268_beep_mixer[] = {
  2397. HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
  2398. {
  2399. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  2400. .name = "Beep Playback Switch",
  2401. .subdevice = HDA_SUBDEV_AMP_FLAG,
  2402. .info = snd_hda_mixer_amp_switch_info,
  2403. .get = snd_hda_mixer_amp_switch_get,
  2404. .put = alc268_beep_switch_put,
  2405. .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
  2406. },
  2407. { }
  2408. };
  2409. /* set PCBEEP vol = 0, mute connections */
  2410. static const struct hda_verb alc268_beep_init_verbs[] = {
  2411. {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  2412. {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  2413. {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  2414. { }
  2415. };
  2416. enum {
  2417. ALC268_FIXUP_INV_DMIC,
  2418. ALC268_FIXUP_HP_EAPD,
  2419. ALC268_FIXUP_SPDIF,
  2420. };
  2421. static const struct hda_fixup alc268_fixups[] = {
  2422. [ALC268_FIXUP_INV_DMIC] = {
  2423. .type = HDA_FIXUP_FUNC,
  2424. .v.func = alc_fixup_inv_dmic,
  2425. },
  2426. [ALC268_FIXUP_HP_EAPD] = {
  2427. .type = HDA_FIXUP_VERBS,
  2428. .v.verbs = (const struct hda_verb[]) {
  2429. {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
  2430. {}
  2431. }
  2432. },
  2433. [ALC268_FIXUP_SPDIF] = {
  2434. .type = HDA_FIXUP_PINS,
  2435. .v.pins = (const struct hda_pintbl[]) {
  2436. { 0x1e, 0x014b1180 }, /* enable SPDIF out */
  2437. {}
  2438. }
  2439. },
  2440. };
  2441. static const struct hda_model_fixup alc268_fixup_models[] = {
  2442. {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
  2443. {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
  2444. {}
  2445. };
  2446. static const struct snd_pci_quirk alc268_fixup_tbl[] = {
  2447. SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
  2448. SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
  2449. /* below is codec SSID since multiple Toshiba laptops have the
  2450. * same PCI SSID 1179:ff00
  2451. */
  2452. SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
  2453. {}
  2454. };
  2455. /*
  2456. * BIOS auto configuration
  2457. */
  2458. static int alc268_parse_auto_config(struct hda_codec *codec)
  2459. {
  2460. static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
  2461. return alc_parse_auto_config(codec, NULL, alc268_ssids);
  2462. }
  2463. /*
  2464. */
  2465. static int patch_alc268(struct hda_codec *codec)
  2466. {
  2467. struct alc_spec *spec;
  2468. int err;
  2469. /* ALC268 has no aa-loopback mixer */
  2470. err = alc_alloc_spec(codec, 0);
  2471. if (err < 0)
  2472. return err;
  2473. spec = codec->spec;
  2474. spec->gen.beep_nid = 0x01;
  2475. spec->shutup = alc_eapd_shutup;
  2476. snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
  2477. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  2478. /* automatic parse from the BIOS config */
  2479. err = alc268_parse_auto_config(codec);
  2480. if (err < 0)
  2481. goto error;
  2482. if (err > 0 && !spec->gen.no_analog &&
  2483. spec->gen.autocfg.speaker_pins[0] != 0x1d) {
  2484. add_mixer(spec, alc268_beep_mixer);
  2485. snd_hda_add_verbs(codec, alc268_beep_init_verbs);
  2486. if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
  2487. /* override the amp caps for beep generator */
  2488. snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
  2489. (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
  2490. (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
  2491. (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
  2492. (0 << AC_AMPCAP_MUTE_SHIFT));
  2493. }
  2494. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  2495. return 0;
  2496. error:
  2497. alc_free(codec);
  2498. return err;
  2499. }
  2500. /*
  2501. * ALC269
  2502. */
  2503. static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
  2504. .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
  2505. };
  2506. static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
  2507. .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
  2508. };
  2509. /* different alc269-variants */
  2510. enum {
  2511. ALC269_TYPE_ALC269VA,
  2512. ALC269_TYPE_ALC269VB,
  2513. ALC269_TYPE_ALC269VC,
  2514. ALC269_TYPE_ALC269VD,
  2515. ALC269_TYPE_ALC280,
  2516. ALC269_TYPE_ALC282,
  2517. ALC269_TYPE_ALC283,
  2518. ALC269_TYPE_ALC284,
  2519. ALC269_TYPE_ALC293,
  2520. ALC269_TYPE_ALC286,
  2521. ALC269_TYPE_ALC298,
  2522. ALC269_TYPE_ALC255,
  2523. ALC269_TYPE_ALC256,
  2524. ALC269_TYPE_ALC257,
  2525. ALC269_TYPE_ALC215,
  2526. ALC269_TYPE_ALC225,
  2527. ALC269_TYPE_ALC294,
  2528. ALC269_TYPE_ALC300,
  2529. ALC269_TYPE_ALC623,
  2530. ALC269_TYPE_ALC700,
  2531. };
  2532. /*
  2533. * BIOS auto configuration
  2534. */
  2535. static int alc269_parse_auto_config(struct hda_codec *codec)
  2536. {
  2537. static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
  2538. static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
  2539. static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
  2540. struct alc_spec *spec = codec->spec;
  2541. const hda_nid_t *ssids;
  2542. switch (spec->codec_variant) {
  2543. case ALC269_TYPE_ALC269VA:
  2544. case ALC269_TYPE_ALC269VC:
  2545. case ALC269_TYPE_ALC280:
  2546. case ALC269_TYPE_ALC284:
  2547. case ALC269_TYPE_ALC293:
  2548. ssids = alc269va_ssids;
  2549. break;
  2550. case ALC269_TYPE_ALC269VB:
  2551. case ALC269_TYPE_ALC269VD:
  2552. case ALC269_TYPE_ALC282:
  2553. case ALC269_TYPE_ALC283:
  2554. case ALC269_TYPE_ALC286:
  2555. case ALC269_TYPE_ALC298:
  2556. case ALC269_TYPE_ALC255:
  2557. case ALC269_TYPE_ALC256:
  2558. case ALC269_TYPE_ALC257:
  2559. case ALC269_TYPE_ALC215:
  2560. case ALC269_TYPE_ALC225:
  2561. case ALC269_TYPE_ALC294:
  2562. case ALC269_TYPE_ALC300:
  2563. case ALC269_TYPE_ALC623:
  2564. case ALC269_TYPE_ALC700:
  2565. ssids = alc269_ssids;
  2566. break;
  2567. default:
  2568. ssids = alc269_ssids;
  2569. break;
  2570. }
  2571. return alc_parse_auto_config(codec, alc269_ignore, ssids);
  2572. }
  2573. static int find_ext_mic_pin(struct hda_codec *codec);
  2574. static void alc286_shutup(struct hda_codec *codec)
  2575. {
  2576. int i;
  2577. int mic_pin = find_ext_mic_pin(codec);
  2578. /* don't shut up pins when unloading the driver; otherwise it breaks
  2579. * the default pin setup at the next load of the driver
  2580. */
  2581. if (codec->bus->shutdown)
  2582. return;
  2583. for (i = 0; i < codec->init_pins.used; i++) {
  2584. struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i);
  2585. /* use read here for syncing after issuing each verb */
  2586. if (pin->nid != mic_pin)
  2587. snd_hda_codec_read(codec, pin->nid, 0,
  2588. AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
  2589. }
  2590. codec->pins_shutup = 1;
  2591. }
  2592. static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
  2593. {
  2594. alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
  2595. }
  2596. static void alc269_shutup(struct hda_codec *codec)
  2597. {
  2598. struct alc_spec *spec = codec->spec;
  2599. if (spec->codec_variant == ALC269_TYPE_ALC269VB)
  2600. alc269vb_toggle_power_output(codec, 0);
  2601. if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
  2602. (alc_get_coef0(codec) & 0x00ff) == 0x018) {
  2603. msleep(150);
  2604. }
  2605. snd_hda_shutup_pins(codec);
  2606. }
  2607. static struct coef_fw alc282_coefs[] = {
  2608. WRITE_COEF(0x03, 0x0002), /* Power Down Control */
  2609. UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
  2610. WRITE_COEF(0x07, 0x0200), /* DMIC control */
  2611. UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
  2612. UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
  2613. WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
  2614. WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
  2615. WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
  2616. UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
  2617. UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
  2618. WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
  2619. UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
  2620. WRITE_COEF(0x34, 0xa0c0), /* ANC */
  2621. UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
  2622. UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
  2623. UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
  2624. WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
  2625. WRITE_COEF(0x63, 0x2902), /* PLL */
  2626. WRITE_COEF(0x68, 0xa080), /* capless control 2 */
  2627. WRITE_COEF(0x69, 0x3400), /* capless control 3 */
  2628. WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
  2629. WRITE_COEF(0x6b, 0x0), /* capless control 5 */
  2630. UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
  2631. WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
  2632. UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
  2633. WRITE_COEF(0x71, 0x0014), /* class D test 6 */
  2634. WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
  2635. UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
  2636. WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
  2637. {}
  2638. };
  2639. static void alc282_restore_default_value(struct hda_codec *codec)
  2640. {
  2641. alc_process_coef_fw(codec, alc282_coefs);
  2642. }
  2643. static void alc282_init(struct hda_codec *codec)
  2644. {
  2645. struct alc_spec *spec = codec->spec;
  2646. hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
  2647. bool hp_pin_sense;
  2648. int coef78;
  2649. alc282_restore_default_value(codec);
  2650. if (!hp_pin)
  2651. return;
  2652. hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
  2653. coef78 = alc_read_coef_idx(codec, 0x78);
  2654. /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
  2655. /* Headphone capless set to high power mode */
  2656. alc_write_coef_idx(codec, 0x78, 0x9004);
  2657. if (hp_pin_sense)
  2658. msleep(2);
  2659. snd_hda_codec_write(codec, hp_pin, 0,
  2660. AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
  2661. if (hp_pin_sense)
  2662. msleep(85);
  2663. snd_hda_codec_write(codec, hp_pin, 0,
  2664. AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
  2665. if (hp_pin_sense)
  2666. msleep(100);
  2667. /* Headphone capless set to normal mode */
  2668. alc_write_coef_idx(codec, 0x78, coef78);
  2669. }
  2670. static void alc282_shutup(struct hda_codec *codec)
  2671. {
  2672. struct alc_spec *spec = codec->spec;
  2673. hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
  2674. bool hp_pin_sense;
  2675. int coef78;
  2676. if (!hp_pin) {
  2677. alc269_shutup(codec);
  2678. return;
  2679. }
  2680. hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
  2681. coef78 = alc_read_coef_idx(codec, 0x78);
  2682. alc_write_coef_idx(codec, 0x78, 0x9004);
  2683. if (hp_pin_sense)
  2684. msleep(2);
  2685. snd_hda_codec_write(codec, hp_pin, 0,
  2686. AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
  2687. if (hp_pin_sense)
  2688. msleep(85);
  2689. snd_hda_codec_write(codec, hp_pin, 0,
  2690. AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
  2691. if (hp_pin_sense)
  2692. msleep(100);
  2693. alc_auto_setup_eapd(codec, false);
  2694. snd_hda_shutup_pins(codec);
  2695. alc_write_coef_idx(codec, 0x78, coef78);
  2696. }
  2697. static struct coef_fw alc283_coefs[] = {
  2698. WRITE_COEF(0x03, 0x0002), /* Power Down Control */
  2699. UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
  2700. WRITE_COEF(0x07, 0x0200), /* DMIC control */
  2701. UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
  2702. UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
  2703. WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
  2704. WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
  2705. WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
  2706. UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
  2707. UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
  2708. WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
  2709. UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
  2710. WRITE_COEF(0x22, 0xa0c0), /* ANC */
  2711. UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
  2712. UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
  2713. UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
  2714. WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
  2715. WRITE_COEF(0x2e, 0x2902), /* PLL */
  2716. WRITE_COEF(0x33, 0xa080), /* capless control 2 */
  2717. WRITE_COEF(0x34, 0x3400), /* capless control 3 */
  2718. WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
  2719. WRITE_COEF(0x36, 0x0), /* capless control 5 */
  2720. UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
  2721. WRITE_COEF(0x39, 0x110a), /* class D test 3 */
  2722. UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
  2723. WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
  2724. WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
  2725. UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
  2726. WRITE_COEF(0x49, 0x0), /* test mode */
  2727. UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
  2728. UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
  2729. WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
  2730. UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
  2731. {}
  2732. };
  2733. static void alc283_restore_default_value(struct hda_codec *codec)
  2734. {
  2735. alc_process_coef_fw(codec, alc283_coefs);
  2736. }
  2737. static void alc283_init(struct hda_codec *codec)
  2738. {
  2739. struct alc_spec *spec = codec->spec;
  2740. hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
  2741. bool hp_pin_sense;
  2742. if (!spec->gen.autocfg.hp_outs) {
  2743. if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
  2744. hp_pin = spec->gen.autocfg.line_out_pins[0];
  2745. }
  2746. alc283_restore_default_value(codec);
  2747. if (!hp_pin)
  2748. return;
  2749. msleep(30);
  2750. hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
  2751. /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
  2752. /* Headphone capless set to high power mode */
  2753. alc_write_coef_idx(codec, 0x43, 0x9004);
  2754. snd_hda_codec_write(codec, hp_pin, 0,
  2755. AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
  2756. if (hp_pin_sense)
  2757. msleep(85);
  2758. snd_hda_codec_write(codec, hp_pin, 0,
  2759. AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
  2760. if (hp_pin_sense)
  2761. msleep(85);
  2762. /* Index 0x46 Combo jack auto switch control 2 */
  2763. /* 3k pull low control for Headset jack. */
  2764. alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
  2765. /* Headphone capless set to normal mode */
  2766. alc_write_coef_idx(codec, 0x43, 0x9614);
  2767. }
  2768. static void alc283_shutup(struct hda_codec *codec)
  2769. {
  2770. struct alc_spec *spec = codec->spec;
  2771. hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
  2772. bool hp_pin_sense;
  2773. if (!spec->gen.autocfg.hp_outs) {
  2774. if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
  2775. hp_pin = spec->gen.autocfg.line_out_pins[0];
  2776. }
  2777. if (!hp_pin) {
  2778. alc269_shutup(codec);
  2779. return;
  2780. }
  2781. hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
  2782. alc_write_coef_idx(codec, 0x43, 0x9004);
  2783. /*depop hp during suspend*/
  2784. alc_write_coef_idx(codec, 0x06, 0x2100);
  2785. snd_hda_codec_write(codec, hp_pin, 0,
  2786. AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
  2787. if (hp_pin_sense)
  2788. msleep(100);
  2789. snd_hda_codec_write(codec, hp_pin, 0,
  2790. AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
  2791. alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
  2792. if (hp_pin_sense)
  2793. msleep(100);
  2794. alc_auto_setup_eapd(codec, false);
  2795. snd_hda_shutup_pins(codec);
  2796. alc_write_coef_idx(codec, 0x43, 0x9614);
  2797. }
  2798. static void alc256_init(struct hda_codec *codec)
  2799. {
  2800. struct alc_spec *spec = codec->spec;
  2801. hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
  2802. bool hp_pin_sense;
  2803. if (!hp_pin)
  2804. return;
  2805. msleep(30);
  2806. hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
  2807. if (hp_pin_sense)
  2808. msleep(2);
  2809. alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
  2810. snd_hda_codec_write(codec, hp_pin, 0,
  2811. AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
  2812. if (hp_pin_sense)
  2813. msleep(85);
  2814. snd_hda_codec_write(codec, hp_pin, 0,
  2815. AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
  2816. if (hp_pin_sense)
  2817. msleep(100);
  2818. alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
  2819. alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
  2820. alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
  2821. alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
  2822. /*
  2823. * Expose headphone mic (or possibly Line In on some machines) instead
  2824. * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
  2825. * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
  2826. * this register.
  2827. */
  2828. alc_write_coef_idx(codec, 0x36, 0x5757);
  2829. }
  2830. static void alc256_shutup(struct hda_codec *codec)
  2831. {
  2832. struct alc_spec *spec = codec->spec;
  2833. hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
  2834. bool hp_pin_sense;
  2835. if (!hp_pin) {
  2836. alc269_shutup(codec);
  2837. return;
  2838. }
  2839. hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
  2840. if (hp_pin_sense)
  2841. msleep(2);
  2842. snd_hda_codec_write(codec, hp_pin, 0,
  2843. AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
  2844. if (hp_pin_sense)
  2845. msleep(85);
  2846. /* 3k pull low control for Headset jack. */
  2847. /* NOTE: call this before clearing the pin, otherwise codec stalls */
  2848. /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
  2849. * when booting with headset plugged. So skip setting it for the codec alc257
  2850. */
  2851. if (codec->core.vendor_id != 0x10ec0257)
  2852. alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
  2853. snd_hda_codec_write(codec, hp_pin, 0,
  2854. AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
  2855. if (hp_pin_sense)
  2856. msleep(100);
  2857. alc_auto_setup_eapd(codec, false);
  2858. snd_hda_shutup_pins(codec);
  2859. }
  2860. static void alc_default_init(struct hda_codec *codec)
  2861. {
  2862. struct alc_spec *spec = codec->spec;
  2863. hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
  2864. bool hp_pin_sense;
  2865. if (!hp_pin)
  2866. return;
  2867. msleep(30);
  2868. hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
  2869. if (hp_pin_sense)
  2870. msleep(2);
  2871. snd_hda_codec_write(codec, hp_pin, 0,
  2872. AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
  2873. if (hp_pin_sense)
  2874. msleep(85);
  2875. snd_hda_codec_write(codec, hp_pin, 0,
  2876. AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
  2877. if (hp_pin_sense)
  2878. msleep(100);
  2879. }
  2880. static void alc_default_shutup(struct hda_codec *codec)
  2881. {
  2882. struct alc_spec *spec = codec->spec;
  2883. hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
  2884. bool hp_pin_sense;
  2885. if (!hp_pin) {
  2886. alc269_shutup(codec);
  2887. return;
  2888. }
  2889. hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
  2890. if (hp_pin_sense)
  2891. msleep(2);
  2892. snd_hda_codec_write(codec, hp_pin, 0,
  2893. AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
  2894. if (hp_pin_sense)
  2895. msleep(85);
  2896. snd_hda_codec_write(codec, hp_pin, 0,
  2897. AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
  2898. if (hp_pin_sense)
  2899. msleep(100);
  2900. alc_auto_setup_eapd(codec, false);
  2901. snd_hda_shutup_pins(codec);
  2902. }
  2903. static void alc294_hp_init(struct hda_codec *codec)
  2904. {
  2905. struct alc_spec *spec = codec->spec;
  2906. hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
  2907. int i, val;
  2908. if (!hp_pin)
  2909. return;
  2910. snd_hda_codec_write(codec, hp_pin, 0,
  2911. AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
  2912. msleep(100);
  2913. snd_hda_codec_write(codec, hp_pin, 0,
  2914. AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
  2915. alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
  2916. alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
  2917. /* Wait for depop procedure finish */
  2918. val = alc_read_coefex_idx(codec, 0x58, 0x01);
  2919. for (i = 0; i < 20 && val & 0x0080; i++) {
  2920. msleep(50);
  2921. val = alc_read_coefex_idx(codec, 0x58, 0x01);
  2922. }
  2923. /* Set HP depop to auto mode */
  2924. alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
  2925. msleep(50);
  2926. }
  2927. static void alc294_init(struct hda_codec *codec)
  2928. {
  2929. struct alc_spec *spec = codec->spec;
  2930. /* required only at boot or S4 resume time */
  2931. if (!spec->done_hp_init ||
  2932. codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
  2933. alc294_hp_init(codec);
  2934. spec->done_hp_init = true;
  2935. }
  2936. alc_default_init(codec);
  2937. }
  2938. static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
  2939. unsigned int val)
  2940. {
  2941. snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
  2942. snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
  2943. snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
  2944. }
  2945. static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
  2946. {
  2947. unsigned int val;
  2948. snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
  2949. val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
  2950. & 0xffff;
  2951. val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
  2952. << 16;
  2953. return val;
  2954. }
  2955. static void alc5505_dsp_halt(struct hda_codec *codec)
  2956. {
  2957. unsigned int val;
  2958. alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
  2959. alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
  2960. alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
  2961. alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
  2962. alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
  2963. alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
  2964. alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
  2965. val = alc5505_coef_get(codec, 0x6220);
  2966. alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
  2967. }
  2968. static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
  2969. {
  2970. alc5505_coef_set(codec, 0x61b8, 0x04133302);
  2971. alc5505_coef_set(codec, 0x61b0, 0x00005b16);
  2972. alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
  2973. alc5505_coef_set(codec, 0x6230, 0xf80d4011);
  2974. alc5505_coef_set(codec, 0x6220, 0x2002010f);
  2975. alc5505_coef_set(codec, 0x880c, 0x00000004);
  2976. }
  2977. static void alc5505_dsp_init(struct hda_codec *codec)
  2978. {
  2979. unsigned int val;
  2980. alc5505_dsp_halt(codec);
  2981. alc5505_dsp_back_from_halt(codec);
  2982. alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
  2983. alc5505_coef_set(codec, 0x61b0, 0x5b16);
  2984. alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
  2985. alc5505_coef_set(codec, 0x61b4, 0x04132b02);
  2986. alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
  2987. alc5505_coef_set(codec, 0x61b8, 0x041f3302);
  2988. snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
  2989. alc5505_coef_set(codec, 0x61b8, 0x041b3302);
  2990. alc5505_coef_set(codec, 0x61b8, 0x04173302);
  2991. alc5505_coef_set(codec, 0x61b8, 0x04163302);
  2992. alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
  2993. alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
  2994. alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
  2995. val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
  2996. if (val <= 3)
  2997. alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
  2998. else
  2999. alc5505_coef_set(codec, 0x6220, 0x6002018f);
  3000. alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
  3001. alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
  3002. alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
  3003. alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
  3004. alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
  3005. alc5505_coef_set(codec, 0x880c, 0x00000003);
  3006. alc5505_coef_set(codec, 0x880c, 0x00000010);
  3007. #ifdef HALT_REALTEK_ALC5505
  3008. alc5505_dsp_halt(codec);
  3009. #endif
  3010. }
  3011. #ifdef HALT_REALTEK_ALC5505
  3012. #define alc5505_dsp_suspend(codec) /* NOP */
  3013. #define alc5505_dsp_resume(codec) /* NOP */
  3014. #else
  3015. #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
  3016. #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
  3017. #endif
  3018. #ifdef CONFIG_PM
  3019. static int alc269_suspend(struct hda_codec *codec)
  3020. {
  3021. struct alc_spec *spec = codec->spec;
  3022. if (spec->has_alc5505_dsp)
  3023. alc5505_dsp_suspend(codec);
  3024. return alc_suspend(codec);
  3025. }
  3026. static int alc269_resume(struct hda_codec *codec)
  3027. {
  3028. struct alc_spec *spec = codec->spec;
  3029. if (spec->codec_variant == ALC269_TYPE_ALC269VB)
  3030. alc269vb_toggle_power_output(codec, 0);
  3031. if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
  3032. (alc_get_coef0(codec) & 0x00ff) == 0x018) {
  3033. msleep(150);
  3034. }
  3035. codec->patch_ops.init(codec);
  3036. if (spec->codec_variant == ALC269_TYPE_ALC269VB)
  3037. alc269vb_toggle_power_output(codec, 1);
  3038. if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
  3039. (alc_get_coef0(codec) & 0x00ff) == 0x017) {
  3040. msleep(200);
  3041. }
  3042. regcache_sync(codec->core.regmap);
  3043. hda_call_check_power_status(codec, 0x01);
  3044. /* on some machine, the BIOS will clear the codec gpio data when enter
  3045. * suspend, and won't restore the data after resume, so we restore it
  3046. * in the driver.
  3047. */
  3048. if (spec->gpio_led)
  3049. snd_hda_codec_write(codec, codec->core.afg, 0, AC_VERB_SET_GPIO_DATA,
  3050. spec->gpio_led);
  3051. if (spec->has_alc5505_dsp)
  3052. alc5505_dsp_resume(codec);
  3053. return 0;
  3054. }
  3055. #endif /* CONFIG_PM */
  3056. static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
  3057. const struct hda_fixup *fix, int action)
  3058. {
  3059. struct alc_spec *spec = codec->spec;
  3060. if (action == HDA_FIXUP_ACT_PRE_PROBE)
  3061. spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
  3062. }
  3063. static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
  3064. const struct hda_fixup *fix,
  3065. int action)
  3066. {
  3067. unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
  3068. unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
  3069. if (cfg_headphone && cfg_headset_mic == 0x411111f0)
  3070. snd_hda_codec_set_pincfg(codec, 0x19,
  3071. (cfg_headphone & ~AC_DEFCFG_DEVICE) |
  3072. (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
  3073. }
  3074. static void alc269_fixup_hweq(struct hda_codec *codec,
  3075. const struct hda_fixup *fix, int action)
  3076. {
  3077. if (action == HDA_FIXUP_ACT_INIT)
  3078. alc_update_coef_idx(codec, 0x1e, 0, 0x80);
  3079. }
  3080. static void alc269_fixup_headset_mic(struct hda_codec *codec,
  3081. const struct hda_fixup *fix, int action)
  3082. {
  3083. struct alc_spec *spec = codec->spec;
  3084. if (action == HDA_FIXUP_ACT_PRE_PROBE)
  3085. spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
  3086. }
  3087. static void alc271_fixup_dmic(struct hda_codec *codec,
  3088. const struct hda_fixup *fix, int action)
  3089. {
  3090. static const struct hda_verb verbs[] = {
  3091. {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
  3092. {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
  3093. {}
  3094. };
  3095. unsigned int cfg;
  3096. if (strcmp(codec->core.chip_name, "ALC271X") &&
  3097. strcmp(codec->core.chip_name, "ALC269VB"))
  3098. return;
  3099. cfg = snd_hda_codec_get_pincfg(codec, 0x12);
  3100. if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
  3101. snd_hda_sequence_write(codec, verbs);
  3102. }
  3103. static void alc269_fixup_pcm_44k(struct hda_codec *codec,
  3104. const struct hda_fixup *fix, int action)
  3105. {
  3106. struct alc_spec *spec = codec->spec;
  3107. if (action != HDA_FIXUP_ACT_PROBE)
  3108. return;
  3109. /* Due to a hardware problem on Lenovo Ideadpad, we need to
  3110. * fix the sample rate of analog I/O to 44.1kHz
  3111. */
  3112. spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
  3113. spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
  3114. }
  3115. static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
  3116. const struct hda_fixup *fix, int action)
  3117. {
  3118. /* The digital-mic unit sends PDM (differential signal) instead of
  3119. * the standard PCM, thus you can't record a valid mono stream as is.
  3120. * Below is a workaround specific to ALC269 to control the dmic
  3121. * signal source as mono.
  3122. */
  3123. if (action == HDA_FIXUP_ACT_INIT)
  3124. alc_update_coef_idx(codec, 0x07, 0, 0x80);
  3125. }
  3126. static void alc269_quanta_automute(struct hda_codec *codec)
  3127. {
  3128. snd_hda_gen_update_outputs(codec);
  3129. alc_write_coef_idx(codec, 0x0c, 0x680);
  3130. alc_write_coef_idx(codec, 0x0c, 0x480);
  3131. }
  3132. static void alc269_fixup_quanta_mute(struct hda_codec *codec,
  3133. const struct hda_fixup *fix, int action)
  3134. {
  3135. struct alc_spec *spec = codec->spec;
  3136. if (action != HDA_FIXUP_ACT_PROBE)
  3137. return;
  3138. spec->gen.automute_hook = alc269_quanta_automute;
  3139. }
  3140. static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
  3141. struct hda_jack_callback *jack)
  3142. {
  3143. struct alc_spec *spec = codec->spec;
  3144. int vref;
  3145. msleep(200);
  3146. snd_hda_gen_hp_automute(codec, jack);
  3147. vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
  3148. msleep(100);
  3149. snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
  3150. vref);
  3151. msleep(500);
  3152. snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
  3153. vref);
  3154. }
  3155. static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
  3156. const struct hda_fixup *fix, int action)
  3157. {
  3158. struct alc_spec *spec = codec->spec;
  3159. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  3160. spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
  3161. spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
  3162. }
  3163. }
  3164. /* update mute-LED according to the speaker mute state via mic VREF pin */
  3165. static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
  3166. {
  3167. struct hda_codec *codec = private_data;
  3168. struct alc_spec *spec = codec->spec;
  3169. unsigned int pinval;
  3170. if (spec->mute_led_polarity)
  3171. enabled = !enabled;
  3172. pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
  3173. pinval &= ~AC_PINCTL_VREFEN;
  3174. pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
  3175. if (spec->mute_led_nid) {
  3176. /* temporarily power up/down for setting VREF */
  3177. snd_hda_power_up_pm(codec);
  3178. snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
  3179. snd_hda_power_down_pm(codec);
  3180. }
  3181. }
  3182. /* Make sure the led works even in runtime suspend */
  3183. static unsigned int led_power_filter(struct hda_codec *codec,
  3184. hda_nid_t nid,
  3185. unsigned int power_state)
  3186. {
  3187. struct alc_spec *spec = codec->spec;
  3188. if (power_state != AC_PWRST_D3 || nid == 0 ||
  3189. (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
  3190. return power_state;
  3191. /* Set pin ctl again, it might have just been set to 0 */
  3192. snd_hda_set_pin_ctl(codec, nid,
  3193. snd_hda_codec_get_pin_target(codec, nid));
  3194. return snd_hda_gen_path_power_filter(codec, nid, power_state);
  3195. }
  3196. static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
  3197. const struct hda_fixup *fix, int action)
  3198. {
  3199. struct alc_spec *spec = codec->spec;
  3200. const struct dmi_device *dev = NULL;
  3201. if (action != HDA_FIXUP_ACT_PRE_PROBE)
  3202. return;
  3203. while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
  3204. int pol, pin;
  3205. if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
  3206. continue;
  3207. if (pin < 0x0a || pin >= 0x10)
  3208. break;
  3209. spec->mute_led_polarity = pol;
  3210. spec->mute_led_nid = pin - 0x0a + 0x18;
  3211. spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
  3212. spec->gen.vmaster_mute_enum = 1;
  3213. codec->power_filter = led_power_filter;
  3214. codec_dbg(codec,
  3215. "Detected mute LED for %x:%d\n", spec->mute_led_nid,
  3216. spec->mute_led_polarity);
  3217. break;
  3218. }
  3219. }
  3220. static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
  3221. const struct hda_fixup *fix, int action)
  3222. {
  3223. struct alc_spec *spec = codec->spec;
  3224. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  3225. spec->mute_led_polarity = 0;
  3226. spec->mute_led_nid = 0x18;
  3227. spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
  3228. spec->gen.vmaster_mute_enum = 1;
  3229. codec->power_filter = led_power_filter;
  3230. }
  3231. }
  3232. static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
  3233. const struct hda_fixup *fix, int action)
  3234. {
  3235. struct alc_spec *spec = codec->spec;
  3236. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  3237. spec->mute_led_polarity = 0;
  3238. spec->mute_led_nid = 0x19;
  3239. spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
  3240. spec->gen.vmaster_mute_enum = 1;
  3241. codec->power_filter = led_power_filter;
  3242. }
  3243. }
  3244. static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
  3245. const struct hda_fixup *fix, int action)
  3246. {
  3247. struct alc_spec *spec = codec->spec;
  3248. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  3249. spec->mute_led_polarity = 0;
  3250. spec->mute_led_nid = 0x1b;
  3251. spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
  3252. spec->gen.vmaster_mute_enum = 1;
  3253. codec->power_filter = led_power_filter;
  3254. }
  3255. }
  3256. /* update LED status via GPIO */
  3257. static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
  3258. bool enabled)
  3259. {
  3260. struct alc_spec *spec = codec->spec;
  3261. unsigned int oldval = spec->gpio_led;
  3262. if (spec->mute_led_polarity)
  3263. enabled = !enabled;
  3264. if (enabled)
  3265. spec->gpio_led &= ~mask;
  3266. else
  3267. spec->gpio_led |= mask;
  3268. if (spec->gpio_led != oldval)
  3269. snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
  3270. spec->gpio_led);
  3271. }
  3272. /* turn on/off mute LED via GPIO per vmaster hook */
  3273. static void alc_fixup_gpio_mute_hook(void *private_data, int enabled)
  3274. {
  3275. struct hda_codec *codec = private_data;
  3276. struct alc_spec *spec = codec->spec;
  3277. alc_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled);
  3278. }
  3279. /* turn on/off mic-mute LED via GPIO per capture hook */
  3280. static void alc_fixup_gpio_mic_mute_hook(struct hda_codec *codec,
  3281. struct snd_kcontrol *kcontrol,
  3282. struct snd_ctl_elem_value *ucontrol)
  3283. {
  3284. struct alc_spec *spec = codec->spec;
  3285. if (ucontrol)
  3286. alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
  3287. ucontrol->value.integer.value[0] ||
  3288. ucontrol->value.integer.value[1]);
  3289. }
  3290. static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
  3291. const struct hda_fixup *fix, int action)
  3292. {
  3293. struct alc_spec *spec = codec->spec;
  3294. static const struct hda_verb gpio_init[] = {
  3295. { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
  3296. { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
  3297. {}
  3298. };
  3299. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  3300. spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
  3301. spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
  3302. spec->gpio_led = 0;
  3303. spec->mute_led_polarity = 0;
  3304. spec->gpio_mute_led_mask = 0x08;
  3305. spec->gpio_mic_led_mask = 0x10;
  3306. snd_hda_add_verbs(codec, gpio_init);
  3307. }
  3308. }
  3309. static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
  3310. const struct hda_fixup *fix, int action)
  3311. {
  3312. struct alc_spec *spec = codec->spec;
  3313. static const struct hda_verb gpio_init[] = {
  3314. { 0x01, AC_VERB_SET_GPIO_MASK, 0x22 },
  3315. { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x22 },
  3316. {}
  3317. };
  3318. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  3319. spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
  3320. spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
  3321. spec->gpio_led = 0;
  3322. spec->mute_led_polarity = 0;
  3323. spec->gpio_mute_led_mask = 0x02;
  3324. spec->gpio_mic_led_mask = 0x20;
  3325. snd_hda_add_verbs(codec, gpio_init);
  3326. }
  3327. }
  3328. /* turn on/off mic-mute LED per capture hook */
  3329. static void alc269_fixup_hp_cap_mic_mute_hook(struct hda_codec *codec,
  3330. struct snd_kcontrol *kcontrol,
  3331. struct snd_ctl_elem_value *ucontrol)
  3332. {
  3333. struct alc_spec *spec = codec->spec;
  3334. unsigned int pinval, enable, disable;
  3335. pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid);
  3336. pinval &= ~AC_PINCTL_VREFEN;
  3337. enable = pinval | AC_PINCTL_VREF_80;
  3338. disable = pinval | AC_PINCTL_VREF_HIZ;
  3339. if (!ucontrol)
  3340. return;
  3341. if (ucontrol->value.integer.value[0] ||
  3342. ucontrol->value.integer.value[1])
  3343. pinval = disable;
  3344. else
  3345. pinval = enable;
  3346. if (spec->cap_mute_led_nid)
  3347. snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval);
  3348. }
  3349. static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
  3350. const struct hda_fixup *fix, int action)
  3351. {
  3352. struct alc_spec *spec = codec->spec;
  3353. static const struct hda_verb gpio_init[] = {
  3354. { 0x01, AC_VERB_SET_GPIO_MASK, 0x08 },
  3355. { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x08 },
  3356. {}
  3357. };
  3358. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  3359. spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
  3360. spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
  3361. spec->gpio_led = 0;
  3362. spec->mute_led_polarity = 0;
  3363. spec->gpio_mute_led_mask = 0x08;
  3364. spec->cap_mute_led_nid = 0x18;
  3365. snd_hda_add_verbs(codec, gpio_init);
  3366. codec->power_filter = led_power_filter;
  3367. }
  3368. }
  3369. static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
  3370. const struct hda_fixup *fix, int action)
  3371. {
  3372. /* Like hp_gpio_mic1_led, but also needs GPIO4 low to enable headphone amp */
  3373. struct alc_spec *spec = codec->spec;
  3374. static const struct hda_verb gpio_init[] = {
  3375. { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
  3376. { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
  3377. {}
  3378. };
  3379. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  3380. spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
  3381. spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
  3382. spec->gpio_led = 0;
  3383. spec->mute_led_polarity = 0;
  3384. spec->gpio_mute_led_mask = 0x08;
  3385. spec->cap_mute_led_nid = 0x18;
  3386. snd_hda_add_verbs(codec, gpio_init);
  3387. codec->power_filter = led_power_filter;
  3388. }
  3389. }
  3390. #if IS_REACHABLE(CONFIG_INPUT)
  3391. static void gpio2_mic_hotkey_event(struct hda_codec *codec,
  3392. struct hda_jack_callback *event)
  3393. {
  3394. struct alc_spec *spec = codec->spec;
  3395. /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
  3396. send both key on and key off event for every interrupt. */
  3397. input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
  3398. input_sync(spec->kb_dev);
  3399. input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
  3400. input_sync(spec->kb_dev);
  3401. }
  3402. static int alc_register_micmute_input_device(struct hda_codec *codec)
  3403. {
  3404. struct alc_spec *spec = codec->spec;
  3405. int i;
  3406. spec->kb_dev = input_allocate_device();
  3407. if (!spec->kb_dev) {
  3408. codec_err(codec, "Out of memory (input_allocate_device)\n");
  3409. return -ENOMEM;
  3410. }
  3411. spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
  3412. spec->kb_dev->name = "Microphone Mute Button";
  3413. spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
  3414. spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
  3415. spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
  3416. spec->kb_dev->keycode = spec->alc_mute_keycode_map;
  3417. for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
  3418. set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
  3419. if (input_register_device(spec->kb_dev)) {
  3420. codec_err(codec, "input_register_device failed\n");
  3421. input_free_device(spec->kb_dev);
  3422. spec->kb_dev = NULL;
  3423. return -ENOMEM;
  3424. }
  3425. return 0;
  3426. }
  3427. static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
  3428. const struct hda_fixup *fix, int action)
  3429. {
  3430. /* GPIO1 = set according to SKU external amp
  3431. GPIO2 = mic mute hotkey
  3432. GPIO3 = mute LED
  3433. GPIO4 = mic mute LED */
  3434. static const struct hda_verb gpio_init[] = {
  3435. { 0x01, AC_VERB_SET_GPIO_MASK, 0x1e },
  3436. { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x1a },
  3437. { 0x01, AC_VERB_SET_GPIO_DATA, 0x02 },
  3438. {}
  3439. };
  3440. struct alc_spec *spec = codec->spec;
  3441. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  3442. if (alc_register_micmute_input_device(codec) != 0)
  3443. return;
  3444. snd_hda_add_verbs(codec, gpio_init);
  3445. snd_hda_codec_write_cache(codec, codec->core.afg, 0,
  3446. AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
  3447. snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
  3448. gpio2_mic_hotkey_event);
  3449. spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
  3450. spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
  3451. spec->gpio_led = 0;
  3452. spec->mute_led_polarity = 0;
  3453. spec->gpio_mute_led_mask = 0x08;
  3454. spec->gpio_mic_led_mask = 0x10;
  3455. return;
  3456. }
  3457. if (!spec->kb_dev)
  3458. return;
  3459. switch (action) {
  3460. case HDA_FIXUP_ACT_PROBE:
  3461. spec->init_amp = ALC_INIT_DEFAULT;
  3462. break;
  3463. case HDA_FIXUP_ACT_FREE:
  3464. input_unregister_device(spec->kb_dev);
  3465. spec->kb_dev = NULL;
  3466. }
  3467. }
  3468. static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
  3469. const struct hda_fixup *fix, int action)
  3470. {
  3471. /* Line2 = mic mute hotkey
  3472. GPIO2 = mic mute LED */
  3473. static const struct hda_verb gpio_init[] = {
  3474. { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
  3475. { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
  3476. {}
  3477. };
  3478. struct alc_spec *spec = codec->spec;
  3479. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  3480. if (alc_register_micmute_input_device(codec) != 0)
  3481. return;
  3482. snd_hda_add_verbs(codec, gpio_init);
  3483. snd_hda_jack_detect_enable_callback(codec, 0x1b,
  3484. gpio2_mic_hotkey_event);
  3485. spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
  3486. spec->gpio_led = 0;
  3487. spec->mute_led_polarity = 0;
  3488. spec->gpio_mic_led_mask = 0x04;
  3489. return;
  3490. }
  3491. if (!spec->kb_dev)
  3492. return;
  3493. switch (action) {
  3494. case HDA_FIXUP_ACT_PROBE:
  3495. spec->init_amp = ALC_INIT_DEFAULT;
  3496. break;
  3497. case HDA_FIXUP_ACT_FREE:
  3498. input_unregister_device(spec->kb_dev);
  3499. spec->kb_dev = NULL;
  3500. }
  3501. }
  3502. #else /* INPUT */
  3503. #define alc280_fixup_hp_gpio2_mic_hotkey NULL
  3504. #define alc233_fixup_lenovo_line2_mic_hotkey NULL
  3505. #endif /* INPUT */
  3506. static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
  3507. const struct hda_fixup *fix, int action)
  3508. {
  3509. struct alc_spec *spec = codec->spec;
  3510. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  3511. spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
  3512. spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
  3513. spec->mute_led_polarity = 0;
  3514. spec->mute_led_nid = 0x1a;
  3515. spec->cap_mute_led_nid = 0x18;
  3516. spec->gen.vmaster_mute_enum = 1;
  3517. codec->power_filter = led_power_filter;
  3518. }
  3519. }
  3520. static struct coef_fw alc225_pre_hsmode[] = {
  3521. UPDATE_COEF(0x4a, 1<<8, 0),
  3522. UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
  3523. UPDATE_COEF(0x63, 3<<14, 3<<14),
  3524. UPDATE_COEF(0x4a, 3<<4, 2<<4),
  3525. UPDATE_COEF(0x4a, 3<<10, 3<<10),
  3526. UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
  3527. UPDATE_COEF(0x4a, 3<<10, 0),
  3528. {}
  3529. };
  3530. static void alc_headset_mode_unplugged(struct hda_codec *codec)
  3531. {
  3532. static struct coef_fw coef0255[] = {
  3533. WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
  3534. WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
  3535. UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
  3536. WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
  3537. WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
  3538. {}
  3539. };
  3540. static struct coef_fw coef0256[] = {
  3541. WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
  3542. WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
  3543. WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
  3544. WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
  3545. UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
  3546. {}
  3547. };
  3548. static struct coef_fw coef0233[] = {
  3549. WRITE_COEF(0x1b, 0x0c0b),
  3550. WRITE_COEF(0x45, 0xc429),
  3551. UPDATE_COEF(0x35, 0x4000, 0),
  3552. WRITE_COEF(0x06, 0x2104),
  3553. WRITE_COEF(0x1a, 0x0001),
  3554. WRITE_COEF(0x26, 0x0004),
  3555. WRITE_COEF(0x32, 0x42a3),
  3556. {}
  3557. };
  3558. static struct coef_fw coef0288[] = {
  3559. UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
  3560. UPDATE_COEF(0x50, 0x2000, 0x2000),
  3561. UPDATE_COEF(0x56, 0x0006, 0x0006),
  3562. UPDATE_COEF(0x66, 0x0008, 0),
  3563. UPDATE_COEF(0x67, 0x2000, 0),
  3564. {}
  3565. };
  3566. static struct coef_fw coef0298[] = {
  3567. UPDATE_COEF(0x19, 0x1300, 0x0300),
  3568. {}
  3569. };
  3570. static struct coef_fw coef0292[] = {
  3571. WRITE_COEF(0x76, 0x000e),
  3572. WRITE_COEF(0x6c, 0x2400),
  3573. WRITE_COEF(0x18, 0x7308),
  3574. WRITE_COEF(0x6b, 0xc429),
  3575. {}
  3576. };
  3577. static struct coef_fw coef0293[] = {
  3578. UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
  3579. UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
  3580. UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
  3581. UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
  3582. WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
  3583. UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
  3584. {}
  3585. };
  3586. static struct coef_fw coef0668[] = {
  3587. WRITE_COEF(0x15, 0x0d40),
  3588. WRITE_COEF(0xb7, 0x802b),
  3589. {}
  3590. };
  3591. static struct coef_fw coef0225[] = {
  3592. UPDATE_COEF(0x63, 3<<14, 0),
  3593. {}
  3594. };
  3595. static struct coef_fw coef0274[] = {
  3596. UPDATE_COEF(0x4a, 0x0100, 0),
  3597. UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
  3598. UPDATE_COEF(0x6b, 0xf000, 0x5000),
  3599. UPDATE_COEF(0x4a, 0x0010, 0),
  3600. UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
  3601. WRITE_COEF(0x45, 0x5289),
  3602. UPDATE_COEF(0x4a, 0x0c00, 0),
  3603. {}
  3604. };
  3605. switch (codec->core.vendor_id) {
  3606. case 0x10ec0255:
  3607. alc_process_coef_fw(codec, coef0255);
  3608. break;
  3609. case 0x10ec0236:
  3610. case 0x10ec0256:
  3611. alc_process_coef_fw(codec, coef0256);
  3612. break;
  3613. case 0x10ec0234:
  3614. case 0x10ec0274:
  3615. case 0x10ec0294:
  3616. alc_process_coef_fw(codec, coef0274);
  3617. break;
  3618. case 0x10ec0233:
  3619. case 0x10ec0283:
  3620. alc_process_coef_fw(codec, coef0233);
  3621. break;
  3622. case 0x10ec0286:
  3623. case 0x10ec0288:
  3624. alc_process_coef_fw(codec, coef0288);
  3625. break;
  3626. case 0x10ec0298:
  3627. alc_process_coef_fw(codec, coef0298);
  3628. alc_process_coef_fw(codec, coef0288);
  3629. break;
  3630. case 0x10ec0292:
  3631. alc_process_coef_fw(codec, coef0292);
  3632. break;
  3633. case 0x10ec0293:
  3634. alc_process_coef_fw(codec, coef0293);
  3635. break;
  3636. case 0x10ec0668:
  3637. alc_process_coef_fw(codec, coef0668);
  3638. break;
  3639. case 0x10ec0225:
  3640. case 0x10ec0295:
  3641. case 0x10ec0299:
  3642. alc_process_coef_fw(codec, alc225_pre_hsmode);
  3643. alc_process_coef_fw(codec, coef0225);
  3644. break;
  3645. case 0x10ec0867:
  3646. alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
  3647. break;
  3648. }
  3649. codec_dbg(codec, "Headset jack set to unplugged mode.\n");
  3650. }
  3651. static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
  3652. hda_nid_t mic_pin)
  3653. {
  3654. static struct coef_fw coef0255[] = {
  3655. WRITE_COEFEX(0x57, 0x03, 0x8aa6),
  3656. WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
  3657. {}
  3658. };
  3659. static struct coef_fw coef0256[] = {
  3660. UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
  3661. WRITE_COEFEX(0x57, 0x03, 0x09a3),
  3662. WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
  3663. {}
  3664. };
  3665. static struct coef_fw coef0233[] = {
  3666. UPDATE_COEF(0x35, 0, 1<<14),
  3667. WRITE_COEF(0x06, 0x2100),
  3668. WRITE_COEF(0x1a, 0x0021),
  3669. WRITE_COEF(0x26, 0x008c),
  3670. {}
  3671. };
  3672. static struct coef_fw coef0288[] = {
  3673. UPDATE_COEF(0x4f, 0x00c0, 0),
  3674. UPDATE_COEF(0x50, 0x2000, 0),
  3675. UPDATE_COEF(0x56, 0x0006, 0),
  3676. UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
  3677. UPDATE_COEF(0x66, 0x0008, 0x0008),
  3678. UPDATE_COEF(0x67, 0x2000, 0x2000),
  3679. {}
  3680. };
  3681. static struct coef_fw coef0292[] = {
  3682. WRITE_COEF(0x19, 0xa208),
  3683. WRITE_COEF(0x2e, 0xacf0),
  3684. {}
  3685. };
  3686. static struct coef_fw coef0293[] = {
  3687. UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
  3688. UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
  3689. UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
  3690. {}
  3691. };
  3692. static struct coef_fw coef0688[] = {
  3693. WRITE_COEF(0xb7, 0x802b),
  3694. WRITE_COEF(0xb5, 0x1040),
  3695. UPDATE_COEF(0xc3, 0, 1<<12),
  3696. {}
  3697. };
  3698. static struct coef_fw coef0225[] = {
  3699. UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
  3700. UPDATE_COEF(0x4a, 3<<4, 2<<4),
  3701. UPDATE_COEF(0x63, 3<<14, 0),
  3702. {}
  3703. };
  3704. static struct coef_fw coef0274[] = {
  3705. UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
  3706. UPDATE_COEF(0x4a, 0x0010, 0),
  3707. UPDATE_COEF(0x6b, 0xf000, 0),
  3708. {}
  3709. };
  3710. switch (codec->core.vendor_id) {
  3711. case 0x10ec0255:
  3712. alc_write_coef_idx(codec, 0x45, 0xc489);
  3713. snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
  3714. alc_process_coef_fw(codec, coef0255);
  3715. snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
  3716. break;
  3717. case 0x10ec0236:
  3718. case 0x10ec0256:
  3719. alc_write_coef_idx(codec, 0x45, 0xc489);
  3720. snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
  3721. alc_process_coef_fw(codec, coef0256);
  3722. snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
  3723. break;
  3724. case 0x10ec0234:
  3725. case 0x10ec0274:
  3726. case 0x10ec0294:
  3727. alc_write_coef_idx(codec, 0x45, 0x4689);
  3728. snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
  3729. alc_process_coef_fw(codec, coef0274);
  3730. snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
  3731. break;
  3732. case 0x10ec0233:
  3733. case 0x10ec0283:
  3734. alc_write_coef_idx(codec, 0x45, 0xc429);
  3735. snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
  3736. alc_process_coef_fw(codec, coef0233);
  3737. snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
  3738. break;
  3739. case 0x10ec0286:
  3740. case 0x10ec0288:
  3741. case 0x10ec0298:
  3742. snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
  3743. alc_process_coef_fw(codec, coef0288);
  3744. snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
  3745. break;
  3746. case 0x10ec0292:
  3747. snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
  3748. alc_process_coef_fw(codec, coef0292);
  3749. break;
  3750. case 0x10ec0293:
  3751. /* Set to TRS mode */
  3752. alc_write_coef_idx(codec, 0x45, 0xc429);
  3753. snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
  3754. alc_process_coef_fw(codec, coef0293);
  3755. snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
  3756. break;
  3757. case 0x10ec0867:
  3758. alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
  3759. /* fallthru */
  3760. case 0x10ec0221:
  3761. case 0x10ec0662:
  3762. snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
  3763. snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
  3764. break;
  3765. case 0x10ec0668:
  3766. alc_write_coef_idx(codec, 0x11, 0x0001);
  3767. snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
  3768. alc_process_coef_fw(codec, coef0688);
  3769. snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
  3770. break;
  3771. case 0x10ec0225:
  3772. case 0x10ec0295:
  3773. case 0x10ec0299:
  3774. alc_process_coef_fw(codec, alc225_pre_hsmode);
  3775. alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
  3776. snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
  3777. alc_process_coef_fw(codec, coef0225);
  3778. snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
  3779. break;
  3780. }
  3781. codec_dbg(codec, "Headset jack set to mic-in mode.\n");
  3782. }
  3783. static void alc_headset_mode_default(struct hda_codec *codec)
  3784. {
  3785. static struct coef_fw coef0225[] = {
  3786. UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
  3787. UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
  3788. UPDATE_COEF(0x49, 3<<8, 0<<8),
  3789. UPDATE_COEF(0x4a, 3<<4, 3<<4),
  3790. UPDATE_COEF(0x63, 3<<14, 0),
  3791. UPDATE_COEF(0x67, 0xf000, 0x3000),
  3792. {}
  3793. };
  3794. static struct coef_fw coef0255[] = {
  3795. WRITE_COEF(0x45, 0xc089),
  3796. WRITE_COEF(0x45, 0xc489),
  3797. WRITE_COEFEX(0x57, 0x03, 0x8ea6),
  3798. WRITE_COEF(0x49, 0x0049),
  3799. {}
  3800. };
  3801. static struct coef_fw coef0256[] = {
  3802. WRITE_COEF(0x45, 0xc489),
  3803. WRITE_COEFEX(0x57, 0x03, 0x0da3),
  3804. WRITE_COEF(0x49, 0x0049),
  3805. UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
  3806. WRITE_COEF(0x06, 0x6100),
  3807. {}
  3808. };
  3809. static struct coef_fw coef0233[] = {
  3810. WRITE_COEF(0x06, 0x2100),
  3811. WRITE_COEF(0x32, 0x4ea3),
  3812. {}
  3813. };
  3814. static struct coef_fw coef0288[] = {
  3815. UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
  3816. UPDATE_COEF(0x50, 0x2000, 0x2000),
  3817. UPDATE_COEF(0x56, 0x0006, 0x0006),
  3818. UPDATE_COEF(0x66, 0x0008, 0),
  3819. UPDATE_COEF(0x67, 0x2000, 0),
  3820. {}
  3821. };
  3822. static struct coef_fw coef0292[] = {
  3823. WRITE_COEF(0x76, 0x000e),
  3824. WRITE_COEF(0x6c, 0x2400),
  3825. WRITE_COEF(0x6b, 0xc429),
  3826. WRITE_COEF(0x18, 0x7308),
  3827. {}
  3828. };
  3829. static struct coef_fw coef0293[] = {
  3830. UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
  3831. WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
  3832. UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
  3833. {}
  3834. };
  3835. static struct coef_fw coef0688[] = {
  3836. WRITE_COEF(0x11, 0x0041),
  3837. WRITE_COEF(0x15, 0x0d40),
  3838. WRITE_COEF(0xb7, 0x802b),
  3839. {}
  3840. };
  3841. static struct coef_fw coef0274[] = {
  3842. WRITE_COEF(0x45, 0x4289),
  3843. UPDATE_COEF(0x4a, 0x0010, 0x0010),
  3844. UPDATE_COEF(0x6b, 0x0f00, 0),
  3845. UPDATE_COEF(0x49, 0x0300, 0x0300),
  3846. {}
  3847. };
  3848. switch (codec->core.vendor_id) {
  3849. case 0x10ec0225:
  3850. case 0x10ec0295:
  3851. case 0x10ec0299:
  3852. alc_process_coef_fw(codec, alc225_pre_hsmode);
  3853. alc_process_coef_fw(codec, coef0225);
  3854. break;
  3855. case 0x10ec0255:
  3856. alc_process_coef_fw(codec, coef0255);
  3857. break;
  3858. case 0x10ec0236:
  3859. case 0x10ec0256:
  3860. alc_write_coef_idx(codec, 0x1b, 0x0e4b);
  3861. alc_write_coef_idx(codec, 0x45, 0xc089);
  3862. msleep(50);
  3863. alc_process_coef_fw(codec, coef0256);
  3864. break;
  3865. case 0x10ec0234:
  3866. case 0x10ec0274:
  3867. case 0x10ec0294:
  3868. alc_process_coef_fw(codec, coef0274);
  3869. break;
  3870. case 0x10ec0233:
  3871. case 0x10ec0283:
  3872. alc_process_coef_fw(codec, coef0233);
  3873. break;
  3874. case 0x10ec0286:
  3875. case 0x10ec0288:
  3876. case 0x10ec0298:
  3877. alc_process_coef_fw(codec, coef0288);
  3878. break;
  3879. case 0x10ec0292:
  3880. alc_process_coef_fw(codec, coef0292);
  3881. break;
  3882. case 0x10ec0293:
  3883. alc_process_coef_fw(codec, coef0293);
  3884. break;
  3885. case 0x10ec0668:
  3886. alc_process_coef_fw(codec, coef0688);
  3887. break;
  3888. case 0x10ec0867:
  3889. alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
  3890. break;
  3891. }
  3892. codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
  3893. }
  3894. /* Iphone type */
  3895. static void alc_headset_mode_ctia(struct hda_codec *codec)
  3896. {
  3897. int val;
  3898. static struct coef_fw coef0255[] = {
  3899. WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
  3900. WRITE_COEF(0x1b, 0x0c2b),
  3901. WRITE_COEFEX(0x57, 0x03, 0x8ea6),
  3902. {}
  3903. };
  3904. static struct coef_fw coef0256[] = {
  3905. WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
  3906. WRITE_COEF(0x1b, 0x0e6b),
  3907. {}
  3908. };
  3909. static struct coef_fw coef0233[] = {
  3910. WRITE_COEF(0x45, 0xd429),
  3911. WRITE_COEF(0x1b, 0x0c2b),
  3912. WRITE_COEF(0x32, 0x4ea3),
  3913. {}
  3914. };
  3915. static struct coef_fw coef0288[] = {
  3916. UPDATE_COEF(0x50, 0x2000, 0x2000),
  3917. UPDATE_COEF(0x56, 0x0006, 0x0006),
  3918. UPDATE_COEF(0x66, 0x0008, 0),
  3919. UPDATE_COEF(0x67, 0x2000, 0),
  3920. {}
  3921. };
  3922. static struct coef_fw coef0292[] = {
  3923. WRITE_COEF(0x6b, 0xd429),
  3924. WRITE_COEF(0x76, 0x0008),
  3925. WRITE_COEF(0x18, 0x7388),
  3926. {}
  3927. };
  3928. static struct coef_fw coef0293[] = {
  3929. WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
  3930. UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
  3931. {}
  3932. };
  3933. static struct coef_fw coef0688[] = {
  3934. WRITE_COEF(0x11, 0x0001),
  3935. WRITE_COEF(0x15, 0x0d60),
  3936. WRITE_COEF(0xc3, 0x0000),
  3937. {}
  3938. };
  3939. static struct coef_fw coef0225_1[] = {
  3940. UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
  3941. UPDATE_COEF(0x63, 3<<14, 2<<14),
  3942. {}
  3943. };
  3944. static struct coef_fw coef0225_2[] = {
  3945. UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
  3946. UPDATE_COEF(0x63, 3<<14, 1<<14),
  3947. {}
  3948. };
  3949. switch (codec->core.vendor_id) {
  3950. case 0x10ec0255:
  3951. alc_process_coef_fw(codec, coef0255);
  3952. break;
  3953. case 0x10ec0236:
  3954. case 0x10ec0256:
  3955. alc_process_coef_fw(codec, coef0256);
  3956. break;
  3957. case 0x10ec0234:
  3958. case 0x10ec0274:
  3959. case 0x10ec0294:
  3960. alc_write_coef_idx(codec, 0x45, 0xd689);
  3961. break;
  3962. case 0x10ec0233:
  3963. case 0x10ec0283:
  3964. alc_process_coef_fw(codec, coef0233);
  3965. break;
  3966. case 0x10ec0298:
  3967. val = alc_read_coef_idx(codec, 0x50);
  3968. if (val & (1 << 12)) {
  3969. alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
  3970. alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
  3971. msleep(300);
  3972. } else {
  3973. alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
  3974. alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
  3975. msleep(300);
  3976. }
  3977. break;
  3978. case 0x10ec0286:
  3979. case 0x10ec0288:
  3980. alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
  3981. msleep(300);
  3982. alc_process_coef_fw(codec, coef0288);
  3983. break;
  3984. case 0x10ec0292:
  3985. alc_process_coef_fw(codec, coef0292);
  3986. break;
  3987. case 0x10ec0293:
  3988. alc_process_coef_fw(codec, coef0293);
  3989. break;
  3990. case 0x10ec0668:
  3991. alc_process_coef_fw(codec, coef0688);
  3992. break;
  3993. case 0x10ec0225:
  3994. case 0x10ec0295:
  3995. case 0x10ec0299:
  3996. val = alc_read_coef_idx(codec, 0x45);
  3997. if (val & (1 << 9))
  3998. alc_process_coef_fw(codec, coef0225_2);
  3999. else
  4000. alc_process_coef_fw(codec, coef0225_1);
  4001. break;
  4002. case 0x10ec0867:
  4003. alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
  4004. break;
  4005. }
  4006. codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
  4007. }
  4008. /* Nokia type */
  4009. static void alc_headset_mode_omtp(struct hda_codec *codec)
  4010. {
  4011. static struct coef_fw coef0255[] = {
  4012. WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
  4013. WRITE_COEF(0x1b, 0x0c2b),
  4014. WRITE_COEFEX(0x57, 0x03, 0x8ea6),
  4015. {}
  4016. };
  4017. static struct coef_fw coef0256[] = {
  4018. WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
  4019. WRITE_COEF(0x1b, 0x0e6b),
  4020. {}
  4021. };
  4022. static struct coef_fw coef0233[] = {
  4023. WRITE_COEF(0x45, 0xe429),
  4024. WRITE_COEF(0x1b, 0x0c2b),
  4025. WRITE_COEF(0x32, 0x4ea3),
  4026. {}
  4027. };
  4028. static struct coef_fw coef0288[] = {
  4029. UPDATE_COEF(0x50, 0x2000, 0x2000),
  4030. UPDATE_COEF(0x56, 0x0006, 0x0006),
  4031. UPDATE_COEF(0x66, 0x0008, 0),
  4032. UPDATE_COEF(0x67, 0x2000, 0),
  4033. {}
  4034. };
  4035. static struct coef_fw coef0292[] = {
  4036. WRITE_COEF(0x6b, 0xe429),
  4037. WRITE_COEF(0x76, 0x0008),
  4038. WRITE_COEF(0x18, 0x7388),
  4039. {}
  4040. };
  4041. static struct coef_fw coef0293[] = {
  4042. WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
  4043. UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
  4044. {}
  4045. };
  4046. static struct coef_fw coef0688[] = {
  4047. WRITE_COEF(0x11, 0x0001),
  4048. WRITE_COEF(0x15, 0x0d50),
  4049. WRITE_COEF(0xc3, 0x0000),
  4050. {}
  4051. };
  4052. static struct coef_fw coef0225[] = {
  4053. UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
  4054. UPDATE_COEF(0x63, 3<<14, 2<<14),
  4055. {}
  4056. };
  4057. switch (codec->core.vendor_id) {
  4058. case 0x10ec0255:
  4059. alc_process_coef_fw(codec, coef0255);
  4060. break;
  4061. case 0x10ec0236:
  4062. case 0x10ec0256:
  4063. alc_process_coef_fw(codec, coef0256);
  4064. break;
  4065. case 0x10ec0234:
  4066. case 0x10ec0274:
  4067. case 0x10ec0294:
  4068. alc_write_coef_idx(codec, 0x45, 0xe689);
  4069. break;
  4070. case 0x10ec0233:
  4071. case 0x10ec0283:
  4072. alc_process_coef_fw(codec, coef0233);
  4073. break;
  4074. case 0x10ec0298:
  4075. alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
  4076. alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
  4077. msleep(300);
  4078. break;
  4079. case 0x10ec0286:
  4080. case 0x10ec0288:
  4081. alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
  4082. msleep(300);
  4083. alc_process_coef_fw(codec, coef0288);
  4084. break;
  4085. case 0x10ec0292:
  4086. alc_process_coef_fw(codec, coef0292);
  4087. break;
  4088. case 0x10ec0293:
  4089. alc_process_coef_fw(codec, coef0293);
  4090. break;
  4091. case 0x10ec0668:
  4092. alc_process_coef_fw(codec, coef0688);
  4093. break;
  4094. case 0x10ec0225:
  4095. case 0x10ec0295:
  4096. case 0x10ec0299:
  4097. alc_process_coef_fw(codec, coef0225);
  4098. break;
  4099. }
  4100. codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
  4101. }
  4102. static void alc_determine_headset_type(struct hda_codec *codec)
  4103. {
  4104. int val;
  4105. bool is_ctia = false;
  4106. struct alc_spec *spec = codec->spec;
  4107. static struct coef_fw coef0255[] = {
  4108. WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
  4109. WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
  4110. conteol) */
  4111. {}
  4112. };
  4113. static struct coef_fw coef0288[] = {
  4114. UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
  4115. {}
  4116. };
  4117. static struct coef_fw coef0298[] = {
  4118. UPDATE_COEF(0x50, 0x2000, 0x2000),
  4119. UPDATE_COEF(0x56, 0x0006, 0x0006),
  4120. UPDATE_COEF(0x66, 0x0008, 0),
  4121. UPDATE_COEF(0x67, 0x2000, 0),
  4122. UPDATE_COEF(0x19, 0x1300, 0x1300),
  4123. {}
  4124. };
  4125. static struct coef_fw coef0293[] = {
  4126. UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
  4127. WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
  4128. {}
  4129. };
  4130. static struct coef_fw coef0688[] = {
  4131. WRITE_COEF(0x11, 0x0001),
  4132. WRITE_COEF(0xb7, 0x802b),
  4133. WRITE_COEF(0x15, 0x0d60),
  4134. WRITE_COEF(0xc3, 0x0c00),
  4135. {}
  4136. };
  4137. static struct coef_fw coef0274[] = {
  4138. UPDATE_COEF(0x4a, 0x0010, 0),
  4139. UPDATE_COEF(0x4a, 0x8000, 0),
  4140. WRITE_COEF(0x45, 0xd289),
  4141. UPDATE_COEF(0x49, 0x0300, 0x0300),
  4142. {}
  4143. };
  4144. switch (codec->core.vendor_id) {
  4145. case 0x10ec0255:
  4146. alc_process_coef_fw(codec, coef0255);
  4147. msleep(300);
  4148. val = alc_read_coef_idx(codec, 0x46);
  4149. is_ctia = (val & 0x0070) == 0x0070;
  4150. break;
  4151. case 0x10ec0236:
  4152. case 0x10ec0256:
  4153. alc_write_coef_idx(codec, 0x1b, 0x0e4b);
  4154. alc_write_coef_idx(codec, 0x06, 0x6104);
  4155. alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
  4156. snd_hda_codec_write(codec, 0x21, 0,
  4157. AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
  4158. msleep(80);
  4159. snd_hda_codec_write(codec, 0x21, 0,
  4160. AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
  4161. alc_process_coef_fw(codec, coef0255);
  4162. msleep(300);
  4163. val = alc_read_coef_idx(codec, 0x46);
  4164. is_ctia = (val & 0x0070) == 0x0070;
  4165. alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
  4166. alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
  4167. snd_hda_codec_write(codec, 0x21, 0,
  4168. AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
  4169. msleep(80);
  4170. snd_hda_codec_write(codec, 0x21, 0,
  4171. AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
  4172. break;
  4173. case 0x10ec0234:
  4174. case 0x10ec0274:
  4175. case 0x10ec0294:
  4176. alc_process_coef_fw(codec, coef0274);
  4177. msleep(850);
  4178. val = alc_read_coef_idx(codec, 0x46);
  4179. is_ctia = (val & 0x00f0) == 0x00f0;
  4180. break;
  4181. case 0x10ec0233:
  4182. case 0x10ec0283:
  4183. alc_write_coef_idx(codec, 0x45, 0xd029);
  4184. msleep(300);
  4185. val = alc_read_coef_idx(codec, 0x46);
  4186. is_ctia = (val & 0x0070) == 0x0070;
  4187. break;
  4188. case 0x10ec0298:
  4189. snd_hda_codec_write(codec, 0x21, 0,
  4190. AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
  4191. msleep(100);
  4192. snd_hda_codec_write(codec, 0x21, 0,
  4193. AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
  4194. msleep(200);
  4195. val = alc_read_coef_idx(codec, 0x50);
  4196. if (val & (1 << 12)) {
  4197. alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
  4198. alc_process_coef_fw(codec, coef0288);
  4199. msleep(350);
  4200. val = alc_read_coef_idx(codec, 0x50);
  4201. is_ctia = (val & 0x0070) == 0x0070;
  4202. } else {
  4203. alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
  4204. alc_process_coef_fw(codec, coef0288);
  4205. msleep(350);
  4206. val = alc_read_coef_idx(codec, 0x50);
  4207. is_ctia = (val & 0x0070) == 0x0070;
  4208. }
  4209. alc_process_coef_fw(codec, coef0298);
  4210. snd_hda_codec_write(codec, 0x21, 0,
  4211. AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
  4212. msleep(75);
  4213. snd_hda_codec_write(codec, 0x21, 0,
  4214. AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
  4215. break;
  4216. case 0x10ec0286:
  4217. case 0x10ec0288:
  4218. alc_process_coef_fw(codec, coef0288);
  4219. msleep(350);
  4220. val = alc_read_coef_idx(codec, 0x50);
  4221. is_ctia = (val & 0x0070) == 0x0070;
  4222. break;
  4223. case 0x10ec0292:
  4224. alc_write_coef_idx(codec, 0x6b, 0xd429);
  4225. msleep(300);
  4226. val = alc_read_coef_idx(codec, 0x6c);
  4227. is_ctia = (val & 0x001c) == 0x001c;
  4228. break;
  4229. case 0x10ec0293:
  4230. alc_process_coef_fw(codec, coef0293);
  4231. msleep(300);
  4232. val = alc_read_coef_idx(codec, 0x46);
  4233. is_ctia = (val & 0x0070) == 0x0070;
  4234. break;
  4235. case 0x10ec0668:
  4236. alc_process_coef_fw(codec, coef0688);
  4237. msleep(300);
  4238. val = alc_read_coef_idx(codec, 0xbe);
  4239. is_ctia = (val & 0x1c02) == 0x1c02;
  4240. break;
  4241. case 0x10ec0225:
  4242. case 0x10ec0295:
  4243. case 0x10ec0299:
  4244. alc_process_coef_fw(codec, alc225_pre_hsmode);
  4245. alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
  4246. val = alc_read_coef_idx(codec, 0x45);
  4247. if (val & (1 << 9)) {
  4248. alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
  4249. alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
  4250. msleep(800);
  4251. val = alc_read_coef_idx(codec, 0x46);
  4252. is_ctia = (val & 0x00f0) == 0x00f0;
  4253. } else {
  4254. alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
  4255. alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
  4256. msleep(800);
  4257. val = alc_read_coef_idx(codec, 0x46);
  4258. is_ctia = (val & 0x00f0) == 0x00f0;
  4259. }
  4260. alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
  4261. alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
  4262. alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
  4263. break;
  4264. case 0x10ec0867:
  4265. is_ctia = true;
  4266. break;
  4267. }
  4268. codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
  4269. is_ctia ? "yes" : "no");
  4270. spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
  4271. }
  4272. static void alc_update_headset_mode(struct hda_codec *codec)
  4273. {
  4274. struct alc_spec *spec = codec->spec;
  4275. hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
  4276. hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
  4277. int new_headset_mode;
  4278. if (!snd_hda_jack_detect(codec, hp_pin))
  4279. new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
  4280. else if (mux_pin == spec->headset_mic_pin)
  4281. new_headset_mode = ALC_HEADSET_MODE_HEADSET;
  4282. else if (mux_pin == spec->headphone_mic_pin)
  4283. new_headset_mode = ALC_HEADSET_MODE_MIC;
  4284. else
  4285. new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
  4286. if (new_headset_mode == spec->current_headset_mode) {
  4287. snd_hda_gen_update_outputs(codec);
  4288. return;
  4289. }
  4290. switch (new_headset_mode) {
  4291. case ALC_HEADSET_MODE_UNPLUGGED:
  4292. alc_headset_mode_unplugged(codec);
  4293. spec->gen.hp_jack_present = false;
  4294. break;
  4295. case ALC_HEADSET_MODE_HEADSET:
  4296. if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
  4297. alc_determine_headset_type(codec);
  4298. if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
  4299. alc_headset_mode_ctia(codec);
  4300. else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
  4301. alc_headset_mode_omtp(codec);
  4302. spec->gen.hp_jack_present = true;
  4303. break;
  4304. case ALC_HEADSET_MODE_MIC:
  4305. alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
  4306. spec->gen.hp_jack_present = false;
  4307. break;
  4308. case ALC_HEADSET_MODE_HEADPHONE:
  4309. alc_headset_mode_default(codec);
  4310. spec->gen.hp_jack_present = true;
  4311. break;
  4312. }
  4313. if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
  4314. snd_hda_set_pin_ctl_cache(codec, hp_pin,
  4315. AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
  4316. if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
  4317. snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
  4318. PIN_VREFHIZ);
  4319. }
  4320. spec->current_headset_mode = new_headset_mode;
  4321. snd_hda_gen_update_outputs(codec);
  4322. }
  4323. static void alc_update_headset_mode_hook(struct hda_codec *codec,
  4324. struct snd_kcontrol *kcontrol,
  4325. struct snd_ctl_elem_value *ucontrol)
  4326. {
  4327. alc_update_headset_mode(codec);
  4328. }
  4329. static void alc_update_headset_jack_cb(struct hda_codec *codec,
  4330. struct hda_jack_callback *jack)
  4331. {
  4332. struct alc_spec *spec = codec->spec;
  4333. spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
  4334. snd_hda_gen_hp_automute(codec, jack);
  4335. alc_update_headset_mode(codec);
  4336. }
  4337. static void alc_probe_headset_mode(struct hda_codec *codec)
  4338. {
  4339. int i;
  4340. struct alc_spec *spec = codec->spec;
  4341. struct auto_pin_cfg *cfg = &spec->gen.autocfg;
  4342. /* Find mic pins */
  4343. for (i = 0; i < cfg->num_inputs; i++) {
  4344. if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
  4345. spec->headset_mic_pin = cfg->inputs[i].pin;
  4346. if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
  4347. spec->headphone_mic_pin = cfg->inputs[i].pin;
  4348. }
  4349. spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
  4350. spec->gen.automute_hook = alc_update_headset_mode;
  4351. spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
  4352. }
  4353. static void alc_fixup_headset_mode(struct hda_codec *codec,
  4354. const struct hda_fixup *fix, int action)
  4355. {
  4356. struct alc_spec *spec = codec->spec;
  4357. switch (action) {
  4358. case HDA_FIXUP_ACT_PRE_PROBE:
  4359. spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
  4360. break;
  4361. case HDA_FIXUP_ACT_PROBE:
  4362. alc_probe_headset_mode(codec);
  4363. break;
  4364. case HDA_FIXUP_ACT_INIT:
  4365. spec->current_headset_mode = 0;
  4366. alc_update_headset_mode(codec);
  4367. break;
  4368. }
  4369. }
  4370. static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
  4371. const struct hda_fixup *fix, int action)
  4372. {
  4373. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  4374. struct alc_spec *spec = codec->spec;
  4375. spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
  4376. }
  4377. else
  4378. alc_fixup_headset_mode(codec, fix, action);
  4379. }
  4380. static void alc255_set_default_jack_type(struct hda_codec *codec)
  4381. {
  4382. /* Set to iphone type */
  4383. static struct coef_fw alc255fw[] = {
  4384. WRITE_COEF(0x1b, 0x880b),
  4385. WRITE_COEF(0x45, 0xd089),
  4386. WRITE_COEF(0x1b, 0x080b),
  4387. WRITE_COEF(0x46, 0x0004),
  4388. WRITE_COEF(0x1b, 0x0c0b),
  4389. {}
  4390. };
  4391. static struct coef_fw alc256fw[] = {
  4392. WRITE_COEF(0x1b, 0x884b),
  4393. WRITE_COEF(0x45, 0xd089),
  4394. WRITE_COEF(0x1b, 0x084b),
  4395. WRITE_COEF(0x46, 0x0004),
  4396. WRITE_COEF(0x1b, 0x0c4b),
  4397. {}
  4398. };
  4399. switch (codec->core.vendor_id) {
  4400. case 0x10ec0255:
  4401. alc_process_coef_fw(codec, alc255fw);
  4402. break;
  4403. case 0x10ec0236:
  4404. case 0x10ec0256:
  4405. alc_process_coef_fw(codec, alc256fw);
  4406. break;
  4407. }
  4408. msleep(30);
  4409. }
  4410. static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
  4411. const struct hda_fixup *fix, int action)
  4412. {
  4413. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  4414. alc255_set_default_jack_type(codec);
  4415. }
  4416. alc_fixup_headset_mode(codec, fix, action);
  4417. }
  4418. static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
  4419. const struct hda_fixup *fix, int action)
  4420. {
  4421. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  4422. struct alc_spec *spec = codec->spec;
  4423. spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
  4424. alc255_set_default_jack_type(codec);
  4425. }
  4426. else
  4427. alc_fixup_headset_mode(codec, fix, action);
  4428. }
  4429. static void alc288_update_headset_jack_cb(struct hda_codec *codec,
  4430. struct hda_jack_callback *jack)
  4431. {
  4432. struct alc_spec *spec = codec->spec;
  4433. int present;
  4434. alc_update_headset_jack_cb(codec, jack);
  4435. /* Headset Mic enable or disable, only for Dell Dino */
  4436. present = spec->gen.hp_jack_present ? 0x40 : 0;
  4437. snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
  4438. present);
  4439. }
  4440. static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
  4441. const struct hda_fixup *fix, int action)
  4442. {
  4443. alc_fixup_headset_mode(codec, fix, action);
  4444. if (action == HDA_FIXUP_ACT_PROBE) {
  4445. struct alc_spec *spec = codec->spec;
  4446. spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
  4447. }
  4448. }
  4449. static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
  4450. const struct hda_fixup *fix, int action)
  4451. {
  4452. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  4453. struct alc_spec *spec = codec->spec;
  4454. spec->gen.auto_mute_via_amp = 1;
  4455. }
  4456. }
  4457. static void alc_no_shutup(struct hda_codec *codec)
  4458. {
  4459. }
  4460. static void alc_fixup_no_shutup(struct hda_codec *codec,
  4461. const struct hda_fixup *fix, int action)
  4462. {
  4463. if (action == HDA_FIXUP_ACT_PROBE) {
  4464. struct alc_spec *spec = codec->spec;
  4465. spec->shutup = alc_no_shutup;
  4466. }
  4467. }
  4468. static void alc_fixup_disable_aamix(struct hda_codec *codec,
  4469. const struct hda_fixup *fix, int action)
  4470. {
  4471. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  4472. struct alc_spec *spec = codec->spec;
  4473. /* Disable AA-loopback as it causes white noise */
  4474. spec->gen.mixer_nid = 0;
  4475. }
  4476. }
  4477. /* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
  4478. static void alc_fixup_tpt440_dock(struct hda_codec *codec,
  4479. const struct hda_fixup *fix, int action)
  4480. {
  4481. static const struct hda_pintbl pincfgs[] = {
  4482. { 0x16, 0x21211010 }, /* dock headphone */
  4483. { 0x19, 0x21a11010 }, /* dock mic */
  4484. { }
  4485. };
  4486. struct alc_spec *spec = codec->spec;
  4487. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  4488. spec->reboot_notify = snd_hda_gen_reboot_notify; /* reduce noise */
  4489. spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
  4490. codec->power_save_node = 0; /* avoid click noises */
  4491. snd_hda_apply_pincfgs(codec, pincfgs);
  4492. }
  4493. }
  4494. static void alc_fixup_tpt470_dock(struct hda_codec *codec,
  4495. const struct hda_fixup *fix, int action)
  4496. {
  4497. static const struct hda_pintbl pincfgs[] = {
  4498. { 0x17, 0x21211010 }, /* dock headphone */
  4499. { 0x19, 0x21a11010 }, /* dock mic */
  4500. { }
  4501. };
  4502. /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
  4503. * the speaker output becomes too low by some reason on Thinkpads with
  4504. * ALC298 codec
  4505. */
  4506. static hda_nid_t preferred_pairs[] = {
  4507. 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
  4508. 0
  4509. };
  4510. struct alc_spec *spec = codec->spec;
  4511. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  4512. spec->gen.preferred_dacs = preferred_pairs;
  4513. spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
  4514. snd_hda_apply_pincfgs(codec, pincfgs);
  4515. } else if (action == HDA_FIXUP_ACT_INIT) {
  4516. /* Enable DOCK device */
  4517. snd_hda_codec_write(codec, 0x17, 0,
  4518. AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
  4519. /* Enable DOCK device */
  4520. snd_hda_codec_write(codec, 0x19, 0,
  4521. AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
  4522. }
  4523. }
  4524. static void alc_shutup_dell_xps13(struct hda_codec *codec)
  4525. {
  4526. struct alc_spec *spec = codec->spec;
  4527. int hp_pin = spec->gen.autocfg.hp_pins[0];
  4528. /* Prevent pop noises when headphones are plugged in */
  4529. snd_hda_codec_write(codec, hp_pin, 0,
  4530. AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
  4531. msleep(20);
  4532. }
  4533. static void alc_fixup_dell_xps13(struct hda_codec *codec,
  4534. const struct hda_fixup *fix, int action)
  4535. {
  4536. struct alc_spec *spec = codec->spec;
  4537. struct hda_input_mux *imux = &spec->gen.input_mux;
  4538. int i;
  4539. switch (action) {
  4540. case HDA_FIXUP_ACT_PRE_PROBE:
  4541. /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
  4542. * it causes a click noise at start up
  4543. */
  4544. snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
  4545. break;
  4546. case HDA_FIXUP_ACT_PROBE:
  4547. spec->shutup = alc_shutup_dell_xps13;
  4548. /* Make the internal mic the default input source. */
  4549. for (i = 0; i < imux->num_items; i++) {
  4550. if (spec->gen.imux_pins[i] == 0x12) {
  4551. spec->gen.cur_mux[0] = i;
  4552. break;
  4553. }
  4554. }
  4555. break;
  4556. }
  4557. }
  4558. static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
  4559. const struct hda_fixup *fix, int action)
  4560. {
  4561. struct alc_spec *spec = codec->spec;
  4562. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  4563. spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
  4564. spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
  4565. /* Disable boost for mic-in permanently. (This code is only called
  4566. from quirks that guarantee that the headphone is at NID 0x1b.) */
  4567. snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
  4568. snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
  4569. } else
  4570. alc_fixup_headset_mode(codec, fix, action);
  4571. }
  4572. static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
  4573. const struct hda_fixup *fix, int action)
  4574. {
  4575. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  4576. alc_write_coef_idx(codec, 0xc4, 0x8000);
  4577. alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
  4578. snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
  4579. }
  4580. alc_fixup_headset_mode(codec, fix, action);
  4581. }
  4582. /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
  4583. static int find_ext_mic_pin(struct hda_codec *codec)
  4584. {
  4585. struct alc_spec *spec = codec->spec;
  4586. struct auto_pin_cfg *cfg = &spec->gen.autocfg;
  4587. hda_nid_t nid;
  4588. unsigned int defcfg;
  4589. int i;
  4590. for (i = 0; i < cfg->num_inputs; i++) {
  4591. if (cfg->inputs[i].type != AUTO_PIN_MIC)
  4592. continue;
  4593. nid = cfg->inputs[i].pin;
  4594. defcfg = snd_hda_codec_get_pincfg(codec, nid);
  4595. if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
  4596. continue;
  4597. return nid;
  4598. }
  4599. return 0;
  4600. }
  4601. static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
  4602. const struct hda_fixup *fix,
  4603. int action)
  4604. {
  4605. struct alc_spec *spec = codec->spec;
  4606. if (action == HDA_FIXUP_ACT_PROBE) {
  4607. int mic_pin = find_ext_mic_pin(codec);
  4608. int hp_pin = spec->gen.autocfg.hp_pins[0];
  4609. if (snd_BUG_ON(!mic_pin || !hp_pin))
  4610. return;
  4611. snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
  4612. }
  4613. }
  4614. static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
  4615. const struct hda_fixup *fix,
  4616. int action)
  4617. {
  4618. struct alc_spec *spec = codec->spec;
  4619. struct auto_pin_cfg *cfg = &spec->gen.autocfg;
  4620. int i;
  4621. /* The mic boosts on level 2 and 3 are too noisy
  4622. on the internal mic input.
  4623. Therefore limit the boost to 0 or 1. */
  4624. if (action != HDA_FIXUP_ACT_PROBE)
  4625. return;
  4626. for (i = 0; i < cfg->num_inputs; i++) {
  4627. hda_nid_t nid = cfg->inputs[i].pin;
  4628. unsigned int defcfg;
  4629. if (cfg->inputs[i].type != AUTO_PIN_MIC)
  4630. continue;
  4631. defcfg = snd_hda_codec_get_pincfg(codec, nid);
  4632. if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
  4633. continue;
  4634. snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
  4635. (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
  4636. (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
  4637. (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
  4638. (0 << AC_AMPCAP_MUTE_SHIFT));
  4639. }
  4640. }
  4641. static void alc283_hp_automute_hook(struct hda_codec *codec,
  4642. struct hda_jack_callback *jack)
  4643. {
  4644. struct alc_spec *spec = codec->spec;
  4645. int vref;
  4646. msleep(200);
  4647. snd_hda_gen_hp_automute(codec, jack);
  4648. vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
  4649. msleep(600);
  4650. snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
  4651. vref);
  4652. }
  4653. static void alc283_fixup_chromebook(struct hda_codec *codec,
  4654. const struct hda_fixup *fix, int action)
  4655. {
  4656. struct alc_spec *spec = codec->spec;
  4657. switch (action) {
  4658. case HDA_FIXUP_ACT_PRE_PROBE:
  4659. snd_hda_override_wcaps(codec, 0x03, 0);
  4660. /* Disable AA-loopback as it causes white noise */
  4661. spec->gen.mixer_nid = 0;
  4662. break;
  4663. case HDA_FIXUP_ACT_INIT:
  4664. /* MIC2-VREF control */
  4665. /* Set to manual mode */
  4666. alc_update_coef_idx(codec, 0x06, 0x000c, 0);
  4667. /* Enable Line1 input control by verb */
  4668. alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
  4669. break;
  4670. }
  4671. }
  4672. static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
  4673. const struct hda_fixup *fix, int action)
  4674. {
  4675. struct alc_spec *spec = codec->spec;
  4676. switch (action) {
  4677. case HDA_FIXUP_ACT_PRE_PROBE:
  4678. spec->gen.hp_automute_hook = alc283_hp_automute_hook;
  4679. break;
  4680. case HDA_FIXUP_ACT_INIT:
  4681. /* MIC2-VREF control */
  4682. /* Set to manual mode */
  4683. alc_update_coef_idx(codec, 0x06, 0x000c, 0);
  4684. break;
  4685. }
  4686. }
  4687. /* mute tablet speaker pin (0x14) via dock plugging in addition */
  4688. static void asus_tx300_automute(struct hda_codec *codec)
  4689. {
  4690. struct alc_spec *spec = codec->spec;
  4691. snd_hda_gen_update_outputs(codec);
  4692. if (snd_hda_jack_detect(codec, 0x1b))
  4693. spec->gen.mute_bits |= (1ULL << 0x14);
  4694. }
  4695. static void alc282_fixup_asus_tx300(struct hda_codec *codec,
  4696. const struct hda_fixup *fix, int action)
  4697. {
  4698. struct alc_spec *spec = codec->spec;
  4699. /* TX300 needs to set up GPIO2 for the speaker amp */
  4700. static const struct hda_verb gpio2_verbs[] = {
  4701. { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
  4702. { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
  4703. { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 },
  4704. {}
  4705. };
  4706. static const struct hda_pintbl dock_pins[] = {
  4707. { 0x1b, 0x21114000 }, /* dock speaker pin */
  4708. {}
  4709. };
  4710. switch (action) {
  4711. case HDA_FIXUP_ACT_PRE_PROBE:
  4712. snd_hda_add_verbs(codec, gpio2_verbs);
  4713. snd_hda_apply_pincfgs(codec, dock_pins);
  4714. spec->gen.auto_mute_via_amp = 1;
  4715. spec->gen.automute_hook = asus_tx300_automute;
  4716. snd_hda_jack_detect_enable_callback(codec, 0x1b,
  4717. snd_hda_gen_hp_automute);
  4718. break;
  4719. case HDA_FIXUP_ACT_BUILD:
  4720. /* this is a bit tricky; give more sane names for the main
  4721. * (tablet) speaker and the dock speaker, respectively
  4722. */
  4723. rename_ctl(codec, "Speaker Playback Switch",
  4724. "Dock Speaker Playback Switch");
  4725. rename_ctl(codec, "Bass Speaker Playback Switch",
  4726. "Speaker Playback Switch");
  4727. break;
  4728. }
  4729. }
  4730. static void alc290_fixup_mono_speakers(struct hda_codec *codec,
  4731. const struct hda_fixup *fix, int action)
  4732. {
  4733. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  4734. /* DAC node 0x03 is giving mono output. We therefore want to
  4735. make sure 0x14 (front speaker) and 0x15 (headphones) use the
  4736. stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
  4737. hda_nid_t conn1[2] = { 0x0c };
  4738. snd_hda_override_conn_list(codec, 0x14, 1, conn1);
  4739. snd_hda_override_conn_list(codec, 0x15, 1, conn1);
  4740. }
  4741. }
  4742. static void alc298_fixup_speaker_volume(struct hda_codec *codec,
  4743. const struct hda_fixup *fix, int action)
  4744. {
  4745. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  4746. /* The speaker is routed to the Node 0x06 by a mistake, as a result
  4747. we can't adjust the speaker's volume since this node does not has
  4748. Amp-out capability. we change the speaker's route to:
  4749. Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
  4750. Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
  4751. speaker's volume now. */
  4752. hda_nid_t conn1[1] = { 0x0c };
  4753. snd_hda_override_conn_list(codec, 0x17, 1, conn1);
  4754. }
  4755. }
  4756. /* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
  4757. static void alc295_fixup_disable_dac3(struct hda_codec *codec,
  4758. const struct hda_fixup *fix, int action)
  4759. {
  4760. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  4761. hda_nid_t conn[2] = { 0x02, 0x03 };
  4762. snd_hda_override_conn_list(codec, 0x17, 2, conn);
  4763. }
  4764. }
  4765. /* Hook to update amp GPIO4 for automute */
  4766. static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
  4767. struct hda_jack_callback *jack)
  4768. {
  4769. struct alc_spec *spec = codec->spec;
  4770. snd_hda_gen_hp_automute(codec, jack);
  4771. /* mute_led_polarity is set to 0, so we pass inverted value here */
  4772. alc_update_gpio_led(codec, 0x10, !spec->gen.hp_jack_present);
  4773. }
  4774. /* Manage GPIOs for HP EliteBook Folio 9480m.
  4775. *
  4776. * GPIO4 is the headphone amplifier power control
  4777. * GPIO3 is the audio output mute indicator LED
  4778. */
  4779. static void alc280_fixup_hp_9480m(struct hda_codec *codec,
  4780. const struct hda_fixup *fix,
  4781. int action)
  4782. {
  4783. struct alc_spec *spec = codec->spec;
  4784. static const struct hda_verb gpio_init[] = {
  4785. { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
  4786. { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
  4787. {}
  4788. };
  4789. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  4790. /* Set the hooks to turn the headphone amp on/off
  4791. * as needed
  4792. */
  4793. spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
  4794. spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
  4795. /* The GPIOs are currently off */
  4796. spec->gpio_led = 0;
  4797. /* GPIO3 is connected to the output mute LED,
  4798. * high is on, low is off
  4799. */
  4800. spec->mute_led_polarity = 0;
  4801. spec->gpio_mute_led_mask = 0x08;
  4802. /* Initialize GPIO configuration */
  4803. snd_hda_add_verbs(codec, gpio_init);
  4804. }
  4805. }
  4806. static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
  4807. const struct hda_fixup *fix,
  4808. int action)
  4809. {
  4810. alc_fixup_dual_codecs(codec, fix, action);
  4811. switch (action) {
  4812. case HDA_FIXUP_ACT_PRE_PROBE:
  4813. /* override card longname to provide a unique UCM profile */
  4814. strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
  4815. break;
  4816. case HDA_FIXUP_ACT_BUILD:
  4817. /* rename Capture controls depending on the codec */
  4818. rename_ctl(codec, "Capture Volume",
  4819. codec->addr == 0 ?
  4820. "Rear-Panel Capture Volume" :
  4821. "Front-Panel Capture Volume");
  4822. rename_ctl(codec, "Capture Switch",
  4823. codec->addr == 0 ?
  4824. "Rear-Panel Capture Switch" :
  4825. "Front-Panel Capture Switch");
  4826. break;
  4827. }
  4828. }
  4829. static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
  4830. const struct hda_fixup *fix, int action)
  4831. {
  4832. if (action != HDA_FIXUP_ACT_PRE_PROBE)
  4833. return;
  4834. codec->power_save_node = 1;
  4835. }
  4836. /* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
  4837. static void alc274_fixup_bind_dacs(struct hda_codec *codec,
  4838. const struct hda_fixup *fix, int action)
  4839. {
  4840. struct alc_spec *spec = codec->spec;
  4841. static hda_nid_t preferred_pairs[] = {
  4842. 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
  4843. 0
  4844. };
  4845. if (action != HDA_FIXUP_ACT_PRE_PROBE)
  4846. return;
  4847. spec->gen.preferred_dacs = preferred_pairs;
  4848. spec->gen.auto_mute_via_amp = 1;
  4849. codec->power_save_node = 0;
  4850. }
  4851. static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
  4852. const struct hda_fixup *fix, int action)
  4853. {
  4854. if (action == HDA_FIXUP_ACT_PRE_PROBE)
  4855. snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
  4856. }
  4857. /* for hda_fixup_thinkpad_acpi() */
  4858. #include "thinkpad_helper.c"
  4859. static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
  4860. const struct hda_fixup *fix, int action)
  4861. {
  4862. alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
  4863. hda_fixup_thinkpad_acpi(codec, fix, action);
  4864. }
  4865. /* for dell wmi mic mute led */
  4866. #include "dell_wmi_helper.c"
  4867. enum {
  4868. ALC269_FIXUP_SONY_VAIO,
  4869. ALC275_FIXUP_SONY_VAIO_GPIO2,
  4870. ALC269_FIXUP_DELL_M101Z,
  4871. ALC269_FIXUP_SKU_IGNORE,
  4872. ALC269_FIXUP_ASUS_G73JW,
  4873. ALC269_FIXUP_LENOVO_EAPD,
  4874. ALC275_FIXUP_SONY_HWEQ,
  4875. ALC275_FIXUP_SONY_DISABLE_AAMIX,
  4876. ALC271_FIXUP_DMIC,
  4877. ALC269_FIXUP_PCM_44K,
  4878. ALC269_FIXUP_STEREO_DMIC,
  4879. ALC269_FIXUP_HEADSET_MIC,
  4880. ALC269_FIXUP_QUANTA_MUTE,
  4881. ALC269_FIXUP_LIFEBOOK,
  4882. ALC269_FIXUP_LIFEBOOK_EXTMIC,
  4883. ALC269_FIXUP_LIFEBOOK_HP_PIN,
  4884. ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
  4885. ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
  4886. ALC269_FIXUP_AMIC,
  4887. ALC269_FIXUP_DMIC,
  4888. ALC269VB_FIXUP_AMIC,
  4889. ALC269VB_FIXUP_DMIC,
  4890. ALC269_FIXUP_HP_MUTE_LED,
  4891. ALC269_FIXUP_HP_MUTE_LED_MIC1,
  4892. ALC269_FIXUP_HP_MUTE_LED_MIC2,
  4893. ALC269_FIXUP_HP_MUTE_LED_MIC3,
  4894. ALC269_FIXUP_HP_GPIO_LED,
  4895. ALC269_FIXUP_HP_GPIO_MIC1_LED,
  4896. ALC269_FIXUP_HP_LINE1_MIC1_LED,
  4897. ALC269_FIXUP_INV_DMIC,
  4898. ALC269_FIXUP_LENOVO_DOCK,
  4899. ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
  4900. ALC269_FIXUP_NO_SHUTUP,
  4901. ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
  4902. ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
  4903. ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
  4904. ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
  4905. ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
  4906. ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
  4907. ALC269_FIXUP_HEADSET_MODE,
  4908. ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
  4909. ALC269_FIXUP_ASPIRE_HEADSET_MIC,
  4910. ALC269_FIXUP_ASUS_X101_FUNC,
  4911. ALC269_FIXUP_ASUS_X101_VERB,
  4912. ALC269_FIXUP_ASUS_X101,
  4913. ALC271_FIXUP_AMIC_MIC2,
  4914. ALC271_FIXUP_HP_GATE_MIC_JACK,
  4915. ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
  4916. ALC269_FIXUP_ACER_AC700,
  4917. ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
  4918. ALC269VB_FIXUP_ASUS_ZENBOOK,
  4919. ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
  4920. ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
  4921. ALC269VB_FIXUP_ORDISSIMO_EVE2,
  4922. ALC283_FIXUP_CHROME_BOOK,
  4923. ALC283_FIXUP_SENSE_COMBO_JACK,
  4924. ALC282_FIXUP_ASUS_TX300,
  4925. ALC283_FIXUP_INT_MIC,
  4926. ALC290_FIXUP_MONO_SPEAKERS,
  4927. ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
  4928. ALC290_FIXUP_SUBWOOFER,
  4929. ALC290_FIXUP_SUBWOOFER_HSJACK,
  4930. ALC269_FIXUP_THINKPAD_ACPI,
  4931. ALC269_FIXUP_DMIC_THINKPAD_ACPI,
  4932. ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
  4933. ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
  4934. ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  4935. ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
  4936. ALC255_FIXUP_HEADSET_MODE,
  4937. ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
  4938. ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
  4939. ALC292_FIXUP_TPT440_DOCK,
  4940. ALC292_FIXUP_TPT440,
  4941. ALC283_FIXUP_HEADSET_MIC,
  4942. ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED,
  4943. ALC282_FIXUP_ASPIRE_V5_PINS,
  4944. ALC280_FIXUP_HP_GPIO4,
  4945. ALC286_FIXUP_HP_GPIO_LED,
  4946. ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
  4947. ALC280_FIXUP_HP_DOCK_PINS,
  4948. ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
  4949. ALC280_FIXUP_HP_9480M,
  4950. ALC288_FIXUP_DELL_HEADSET_MODE,
  4951. ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
  4952. ALC288_FIXUP_DELL_XPS_13_GPIO6,
  4953. ALC288_FIXUP_DELL_XPS_13,
  4954. ALC288_FIXUP_DISABLE_AAMIX,
  4955. ALC292_FIXUP_DELL_E7X,
  4956. ALC292_FIXUP_DISABLE_AAMIX,
  4957. ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
  4958. ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
  4959. ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
  4960. ALC275_FIXUP_DELL_XPS,
  4961. ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE,
  4962. ALC293_FIXUP_LENOVO_SPK_NOISE,
  4963. ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
  4964. ALC255_FIXUP_DELL_SPK_NOISE,
  4965. ALC225_FIXUP_DISABLE_MIC_VREF,
  4966. ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
  4967. ALC295_FIXUP_DISABLE_DAC3,
  4968. ALC280_FIXUP_HP_HEADSET_MIC,
  4969. ALC221_FIXUP_HP_FRONT_MIC,
  4970. ALC292_FIXUP_TPT460,
  4971. ALC298_FIXUP_SPK_VOLUME,
  4972. ALC298_FIXUP_LENOVO_SPK_VOLUME,
  4973. ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
  4974. ALC269_FIXUP_ATIV_BOOK_8,
  4975. ALC221_FIXUP_HP_MIC_NO_PRESENCE,
  4976. ALC256_FIXUP_ASUS_HEADSET_MODE,
  4977. ALC256_FIXUP_ASUS_MIC,
  4978. ALC256_FIXUP_ASUS_AIO_GPIO2,
  4979. ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
  4980. ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
  4981. ALC233_FIXUP_LENOVO_MULTI_CODECS,
  4982. ALC294_FIXUP_LENOVO_MIC_LOCATION,
  4983. ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
  4984. ALC225_FIXUP_S3_POP_NOISE,
  4985. ALC700_FIXUP_INTEL_REFERENCE,
  4986. ALC274_FIXUP_DELL_BIND_DACS,
  4987. ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
  4988. ALC298_FIXUP_TPT470_DOCK,
  4989. ALC255_FIXUP_DUMMY_LINEOUT_VERB,
  4990. ALC255_FIXUP_DELL_HEADSET_MIC,
  4991. ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
  4992. ALC225_FIXUP_WYSE_AUTO_MUTE,
  4993. ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
  4994. };
  4995. static const struct hda_fixup alc269_fixups[] = {
  4996. [ALC269_FIXUP_SONY_VAIO] = {
  4997. .type = HDA_FIXUP_PINCTLS,
  4998. .v.pins = (const struct hda_pintbl[]) {
  4999. {0x19, PIN_VREFGRD},
  5000. {}
  5001. }
  5002. },
  5003. [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
  5004. .type = HDA_FIXUP_VERBS,
  5005. .v.verbs = (const struct hda_verb[]) {
  5006. {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
  5007. {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
  5008. {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
  5009. { }
  5010. },
  5011. .chained = true,
  5012. .chain_id = ALC269_FIXUP_SONY_VAIO
  5013. },
  5014. [ALC269_FIXUP_DELL_M101Z] = {
  5015. .type = HDA_FIXUP_VERBS,
  5016. .v.verbs = (const struct hda_verb[]) {
  5017. /* Enables internal speaker */
  5018. {0x20, AC_VERB_SET_COEF_INDEX, 13},
  5019. {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
  5020. {}
  5021. }
  5022. },
  5023. [ALC269_FIXUP_SKU_IGNORE] = {
  5024. .type = HDA_FIXUP_FUNC,
  5025. .v.func = alc_fixup_sku_ignore,
  5026. },
  5027. [ALC269_FIXUP_ASUS_G73JW] = {
  5028. .type = HDA_FIXUP_PINS,
  5029. .v.pins = (const struct hda_pintbl[]) {
  5030. { 0x17, 0x99130111 }, /* subwoofer */
  5031. { }
  5032. }
  5033. },
  5034. [ALC269_FIXUP_LENOVO_EAPD] = {
  5035. .type = HDA_FIXUP_VERBS,
  5036. .v.verbs = (const struct hda_verb[]) {
  5037. {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
  5038. {}
  5039. }
  5040. },
  5041. [ALC275_FIXUP_SONY_HWEQ] = {
  5042. .type = HDA_FIXUP_FUNC,
  5043. .v.func = alc269_fixup_hweq,
  5044. .chained = true,
  5045. .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
  5046. },
  5047. [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
  5048. .type = HDA_FIXUP_FUNC,
  5049. .v.func = alc_fixup_disable_aamix,
  5050. .chained = true,
  5051. .chain_id = ALC269_FIXUP_SONY_VAIO
  5052. },
  5053. [ALC271_FIXUP_DMIC] = {
  5054. .type = HDA_FIXUP_FUNC,
  5055. .v.func = alc271_fixup_dmic,
  5056. },
  5057. [ALC269_FIXUP_PCM_44K] = {
  5058. .type = HDA_FIXUP_FUNC,
  5059. .v.func = alc269_fixup_pcm_44k,
  5060. .chained = true,
  5061. .chain_id = ALC269_FIXUP_QUANTA_MUTE
  5062. },
  5063. [ALC269_FIXUP_STEREO_DMIC] = {
  5064. .type = HDA_FIXUP_FUNC,
  5065. .v.func = alc269_fixup_stereo_dmic,
  5066. },
  5067. [ALC269_FIXUP_HEADSET_MIC] = {
  5068. .type = HDA_FIXUP_FUNC,
  5069. .v.func = alc269_fixup_headset_mic,
  5070. },
  5071. [ALC269_FIXUP_QUANTA_MUTE] = {
  5072. .type = HDA_FIXUP_FUNC,
  5073. .v.func = alc269_fixup_quanta_mute,
  5074. },
  5075. [ALC269_FIXUP_LIFEBOOK] = {
  5076. .type = HDA_FIXUP_PINS,
  5077. .v.pins = (const struct hda_pintbl[]) {
  5078. { 0x1a, 0x2101103f }, /* dock line-out */
  5079. { 0x1b, 0x23a11040 }, /* dock mic-in */
  5080. { }
  5081. },
  5082. .chained = true,
  5083. .chain_id = ALC269_FIXUP_QUANTA_MUTE
  5084. },
  5085. [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
  5086. .type = HDA_FIXUP_PINS,
  5087. .v.pins = (const struct hda_pintbl[]) {
  5088. { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
  5089. { }
  5090. },
  5091. },
  5092. [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
  5093. .type = HDA_FIXUP_PINS,
  5094. .v.pins = (const struct hda_pintbl[]) {
  5095. { 0x21, 0x0221102f }, /* HP out */
  5096. { }
  5097. },
  5098. },
  5099. [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
  5100. .type = HDA_FIXUP_FUNC,
  5101. .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
  5102. },
  5103. [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
  5104. .type = HDA_FIXUP_FUNC,
  5105. .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
  5106. },
  5107. [ALC269_FIXUP_AMIC] = {
  5108. .type = HDA_FIXUP_PINS,
  5109. .v.pins = (const struct hda_pintbl[]) {
  5110. { 0x14, 0x99130110 }, /* speaker */
  5111. { 0x15, 0x0121401f }, /* HP out */
  5112. { 0x18, 0x01a19c20 }, /* mic */
  5113. { 0x19, 0x99a3092f }, /* int-mic */
  5114. { }
  5115. },
  5116. },
  5117. [ALC269_FIXUP_DMIC] = {
  5118. .type = HDA_FIXUP_PINS,
  5119. .v.pins = (const struct hda_pintbl[]) {
  5120. { 0x12, 0x99a3092f }, /* int-mic */
  5121. { 0x14, 0x99130110 }, /* speaker */
  5122. { 0x15, 0x0121401f }, /* HP out */
  5123. { 0x18, 0x01a19c20 }, /* mic */
  5124. { }
  5125. },
  5126. },
  5127. [ALC269VB_FIXUP_AMIC] = {
  5128. .type = HDA_FIXUP_PINS,
  5129. .v.pins = (const struct hda_pintbl[]) {
  5130. { 0x14, 0x99130110 }, /* speaker */
  5131. { 0x18, 0x01a19c20 }, /* mic */
  5132. { 0x19, 0x99a3092f }, /* int-mic */
  5133. { 0x21, 0x0121401f }, /* HP out */
  5134. { }
  5135. },
  5136. },
  5137. [ALC269VB_FIXUP_DMIC] = {
  5138. .type = HDA_FIXUP_PINS,
  5139. .v.pins = (const struct hda_pintbl[]) {
  5140. { 0x12, 0x99a3092f }, /* int-mic */
  5141. { 0x14, 0x99130110 }, /* speaker */
  5142. { 0x18, 0x01a19c20 }, /* mic */
  5143. { 0x21, 0x0121401f }, /* HP out */
  5144. { }
  5145. },
  5146. },
  5147. [ALC269_FIXUP_HP_MUTE_LED] = {
  5148. .type = HDA_FIXUP_FUNC,
  5149. .v.func = alc269_fixup_hp_mute_led,
  5150. },
  5151. [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
  5152. .type = HDA_FIXUP_FUNC,
  5153. .v.func = alc269_fixup_hp_mute_led_mic1,
  5154. },
  5155. [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
  5156. .type = HDA_FIXUP_FUNC,
  5157. .v.func = alc269_fixup_hp_mute_led_mic2,
  5158. },
  5159. [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
  5160. .type = HDA_FIXUP_FUNC,
  5161. .v.func = alc269_fixup_hp_mute_led_mic3,
  5162. },
  5163. [ALC269_FIXUP_HP_GPIO_LED] = {
  5164. .type = HDA_FIXUP_FUNC,
  5165. .v.func = alc269_fixup_hp_gpio_led,
  5166. },
  5167. [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
  5168. .type = HDA_FIXUP_FUNC,
  5169. .v.func = alc269_fixup_hp_gpio_mic1_led,
  5170. },
  5171. [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
  5172. .type = HDA_FIXUP_FUNC,
  5173. .v.func = alc269_fixup_hp_line1_mic1_led,
  5174. },
  5175. [ALC269_FIXUP_INV_DMIC] = {
  5176. .type = HDA_FIXUP_FUNC,
  5177. .v.func = alc_fixup_inv_dmic,
  5178. },
  5179. [ALC269_FIXUP_NO_SHUTUP] = {
  5180. .type = HDA_FIXUP_FUNC,
  5181. .v.func = alc_fixup_no_shutup,
  5182. },
  5183. [ALC269_FIXUP_LENOVO_DOCK] = {
  5184. .type = HDA_FIXUP_PINS,
  5185. .v.pins = (const struct hda_pintbl[]) {
  5186. { 0x19, 0x23a11040 }, /* dock mic */
  5187. { 0x1b, 0x2121103f }, /* dock headphone */
  5188. { }
  5189. },
  5190. .chained = true,
  5191. .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
  5192. },
  5193. [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
  5194. .type = HDA_FIXUP_FUNC,
  5195. .v.func = alc269_fixup_limit_int_mic_boost,
  5196. .chained = true,
  5197. .chain_id = ALC269_FIXUP_LENOVO_DOCK,
  5198. },
  5199. [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
  5200. .type = HDA_FIXUP_FUNC,
  5201. .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
  5202. .chained = true,
  5203. .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
  5204. },
  5205. [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
  5206. .type = HDA_FIXUP_PINS,
  5207. .v.pins = (const struct hda_pintbl[]) {
  5208. { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
  5209. { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
  5210. { }
  5211. },
  5212. .chained = true,
  5213. .chain_id = ALC269_FIXUP_HEADSET_MODE
  5214. },
  5215. [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
  5216. .type = HDA_FIXUP_PINS,
  5217. .v.pins = (const struct hda_pintbl[]) {
  5218. { 0x16, 0x21014020 }, /* dock line out */
  5219. { 0x19, 0x21a19030 }, /* dock mic */
  5220. { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
  5221. { }
  5222. },
  5223. .chained = true,
  5224. .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
  5225. },
  5226. [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
  5227. .type = HDA_FIXUP_PINS,
  5228. .v.pins = (const struct hda_pintbl[]) {
  5229. { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
  5230. { }
  5231. },
  5232. .chained = true,
  5233. .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
  5234. },
  5235. [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
  5236. .type = HDA_FIXUP_PINS,
  5237. .v.pins = (const struct hda_pintbl[]) {
  5238. { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
  5239. { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
  5240. { }
  5241. },
  5242. .chained = true,
  5243. .chain_id = ALC269_FIXUP_HEADSET_MODE
  5244. },
  5245. [ALC269_FIXUP_HEADSET_MODE] = {
  5246. .type = HDA_FIXUP_FUNC,
  5247. .v.func = alc_fixup_headset_mode,
  5248. .chained = true,
  5249. .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
  5250. },
  5251. [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
  5252. .type = HDA_FIXUP_FUNC,
  5253. .v.func = alc_fixup_headset_mode_no_hp_mic,
  5254. },
  5255. [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
  5256. .type = HDA_FIXUP_PINS,
  5257. .v.pins = (const struct hda_pintbl[]) {
  5258. { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
  5259. { }
  5260. },
  5261. .chained = true,
  5262. .chain_id = ALC269_FIXUP_HEADSET_MODE,
  5263. },
  5264. [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
  5265. .type = HDA_FIXUP_PINS,
  5266. .v.pins = (const struct hda_pintbl[]) {
  5267. { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
  5268. { }
  5269. },
  5270. .chained = true,
  5271. .chain_id = ALC269_FIXUP_HEADSET_MIC
  5272. },
  5273. [ALC269_FIXUP_ASUS_X101_FUNC] = {
  5274. .type = HDA_FIXUP_FUNC,
  5275. .v.func = alc269_fixup_x101_headset_mic,
  5276. },
  5277. [ALC269_FIXUP_ASUS_X101_VERB] = {
  5278. .type = HDA_FIXUP_VERBS,
  5279. .v.verbs = (const struct hda_verb[]) {
  5280. {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
  5281. {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
  5282. {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
  5283. { }
  5284. },
  5285. .chained = true,
  5286. .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
  5287. },
  5288. [ALC269_FIXUP_ASUS_X101] = {
  5289. .type = HDA_FIXUP_PINS,
  5290. .v.pins = (const struct hda_pintbl[]) {
  5291. { 0x18, 0x04a1182c }, /* Headset mic */
  5292. { }
  5293. },
  5294. .chained = true,
  5295. .chain_id = ALC269_FIXUP_ASUS_X101_VERB
  5296. },
  5297. [ALC271_FIXUP_AMIC_MIC2] = {
  5298. .type = HDA_FIXUP_PINS,
  5299. .v.pins = (const struct hda_pintbl[]) {
  5300. { 0x14, 0x99130110 }, /* speaker */
  5301. { 0x19, 0x01a19c20 }, /* mic */
  5302. { 0x1b, 0x99a7012f }, /* int-mic */
  5303. { 0x21, 0x0121401f }, /* HP out */
  5304. { }
  5305. },
  5306. },
  5307. [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
  5308. .type = HDA_FIXUP_FUNC,
  5309. .v.func = alc271_hp_gate_mic_jack,
  5310. .chained = true,
  5311. .chain_id = ALC271_FIXUP_AMIC_MIC2,
  5312. },
  5313. [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
  5314. .type = HDA_FIXUP_FUNC,
  5315. .v.func = alc269_fixup_limit_int_mic_boost,
  5316. .chained = true,
  5317. .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
  5318. },
  5319. [ALC269_FIXUP_ACER_AC700] = {
  5320. .type = HDA_FIXUP_PINS,
  5321. .v.pins = (const struct hda_pintbl[]) {
  5322. { 0x12, 0x99a3092f }, /* int-mic */
  5323. { 0x14, 0x99130110 }, /* speaker */
  5324. { 0x18, 0x03a11c20 }, /* mic */
  5325. { 0x1e, 0x0346101e }, /* SPDIF1 */
  5326. { 0x21, 0x0321101f }, /* HP out */
  5327. { }
  5328. },
  5329. .chained = true,
  5330. .chain_id = ALC271_FIXUP_DMIC,
  5331. },
  5332. [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
  5333. .type = HDA_FIXUP_FUNC,
  5334. .v.func = alc269_fixup_limit_int_mic_boost,
  5335. .chained = true,
  5336. .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
  5337. },
  5338. [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
  5339. .type = HDA_FIXUP_FUNC,
  5340. .v.func = alc269_fixup_limit_int_mic_boost,
  5341. .chained = true,
  5342. .chain_id = ALC269VB_FIXUP_DMIC,
  5343. },
  5344. [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
  5345. .type = HDA_FIXUP_VERBS,
  5346. .v.verbs = (const struct hda_verb[]) {
  5347. /* class-D output amp +5dB */
  5348. { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
  5349. { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
  5350. {}
  5351. },
  5352. .chained = true,
  5353. .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
  5354. },
  5355. [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
  5356. .type = HDA_FIXUP_FUNC,
  5357. .v.func = alc269_fixup_limit_int_mic_boost,
  5358. .chained = true,
  5359. .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
  5360. },
  5361. [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
  5362. .type = HDA_FIXUP_PINS,
  5363. .v.pins = (const struct hda_pintbl[]) {
  5364. { 0x12, 0x99a3092f }, /* int-mic */
  5365. { 0x18, 0x03a11d20 }, /* mic */
  5366. { 0x19, 0x411111f0 }, /* Unused bogus pin */
  5367. { }
  5368. },
  5369. },
  5370. [ALC283_FIXUP_CHROME_BOOK] = {
  5371. .type = HDA_FIXUP_FUNC,
  5372. .v.func = alc283_fixup_chromebook,
  5373. },
  5374. [ALC283_FIXUP_SENSE_COMBO_JACK] = {
  5375. .type = HDA_FIXUP_FUNC,
  5376. .v.func = alc283_fixup_sense_combo_jack,
  5377. .chained = true,
  5378. .chain_id = ALC283_FIXUP_CHROME_BOOK,
  5379. },
  5380. [ALC282_FIXUP_ASUS_TX300] = {
  5381. .type = HDA_FIXUP_FUNC,
  5382. .v.func = alc282_fixup_asus_tx300,
  5383. },
  5384. [ALC283_FIXUP_INT_MIC] = {
  5385. .type = HDA_FIXUP_VERBS,
  5386. .v.verbs = (const struct hda_verb[]) {
  5387. {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
  5388. {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
  5389. { }
  5390. },
  5391. .chained = true,
  5392. .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
  5393. },
  5394. [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
  5395. .type = HDA_FIXUP_PINS,
  5396. .v.pins = (const struct hda_pintbl[]) {
  5397. { 0x17, 0x90170112 }, /* subwoofer */
  5398. { }
  5399. },
  5400. .chained = true,
  5401. .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
  5402. },
  5403. [ALC290_FIXUP_SUBWOOFER] = {
  5404. .type = HDA_FIXUP_PINS,
  5405. .v.pins = (const struct hda_pintbl[]) {
  5406. { 0x17, 0x90170112 }, /* subwoofer */
  5407. { }
  5408. },
  5409. .chained = true,
  5410. .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
  5411. },
  5412. [ALC290_FIXUP_MONO_SPEAKERS] = {
  5413. .type = HDA_FIXUP_FUNC,
  5414. .v.func = alc290_fixup_mono_speakers,
  5415. },
  5416. [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
  5417. .type = HDA_FIXUP_FUNC,
  5418. .v.func = alc290_fixup_mono_speakers,
  5419. .chained = true,
  5420. .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
  5421. },
  5422. [ALC269_FIXUP_THINKPAD_ACPI] = {
  5423. .type = HDA_FIXUP_FUNC,
  5424. .v.func = alc_fixup_thinkpad_acpi,
  5425. .chained = true,
  5426. .chain_id = ALC269_FIXUP_SKU_IGNORE,
  5427. },
  5428. [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
  5429. .type = HDA_FIXUP_FUNC,
  5430. .v.func = alc_fixup_inv_dmic,
  5431. .chained = true,
  5432. .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
  5433. },
  5434. [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
  5435. .type = HDA_FIXUP_PINS,
  5436. .v.pins = (const struct hda_pintbl[]) {
  5437. { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
  5438. { }
  5439. },
  5440. .chained = true,
  5441. .chain_id = ALC255_FIXUP_HEADSET_MODE
  5442. },
  5443. [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
  5444. .type = HDA_FIXUP_PINS,
  5445. .v.pins = (const struct hda_pintbl[]) {
  5446. { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
  5447. { }
  5448. },
  5449. .chained = true,
  5450. .chain_id = ALC255_FIXUP_HEADSET_MODE
  5451. },
  5452. [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
  5453. .type = HDA_FIXUP_PINS,
  5454. .v.pins = (const struct hda_pintbl[]) {
  5455. { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
  5456. { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
  5457. { }
  5458. },
  5459. .chained = true,
  5460. .chain_id = ALC255_FIXUP_HEADSET_MODE
  5461. },
  5462. [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
  5463. .type = HDA_FIXUP_PINS,
  5464. .v.pins = (const struct hda_pintbl[]) {
  5465. { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
  5466. { }
  5467. },
  5468. .chained = true,
  5469. .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
  5470. },
  5471. [ALC255_FIXUP_HEADSET_MODE] = {
  5472. .type = HDA_FIXUP_FUNC,
  5473. .v.func = alc_fixup_headset_mode_alc255,
  5474. .chained = true,
  5475. .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
  5476. },
  5477. [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
  5478. .type = HDA_FIXUP_FUNC,
  5479. .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
  5480. },
  5481. [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
  5482. .type = HDA_FIXUP_PINS,
  5483. .v.pins = (const struct hda_pintbl[]) {
  5484. { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
  5485. { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
  5486. { }
  5487. },
  5488. .chained = true,
  5489. .chain_id = ALC269_FIXUP_HEADSET_MODE
  5490. },
  5491. [ALC292_FIXUP_TPT440_DOCK] = {
  5492. .type = HDA_FIXUP_FUNC,
  5493. .v.func = alc_fixup_tpt440_dock,
  5494. .chained = true,
  5495. .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
  5496. },
  5497. [ALC292_FIXUP_TPT440] = {
  5498. .type = HDA_FIXUP_FUNC,
  5499. .v.func = alc_fixup_disable_aamix,
  5500. .chained = true,
  5501. .chain_id = ALC292_FIXUP_TPT440_DOCK,
  5502. },
  5503. [ALC283_FIXUP_HEADSET_MIC] = {
  5504. .type = HDA_FIXUP_PINS,
  5505. .v.pins = (const struct hda_pintbl[]) {
  5506. { 0x19, 0x04a110f0 },
  5507. { },
  5508. },
  5509. },
  5510. [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = {
  5511. .type = HDA_FIXUP_FUNC,
  5512. .v.func = alc_fixup_dell_wmi,
  5513. },
  5514. [ALC282_FIXUP_ASPIRE_V5_PINS] = {
  5515. .type = HDA_FIXUP_PINS,
  5516. .v.pins = (const struct hda_pintbl[]) {
  5517. { 0x12, 0x90a60130 },
  5518. { 0x14, 0x90170110 },
  5519. { 0x17, 0x40000008 },
  5520. { 0x18, 0x411111f0 },
  5521. { 0x19, 0x01a1913c },
  5522. { 0x1a, 0x411111f0 },
  5523. { 0x1b, 0x411111f0 },
  5524. { 0x1d, 0x40f89b2d },
  5525. { 0x1e, 0x411111f0 },
  5526. { 0x21, 0x0321101f },
  5527. { },
  5528. },
  5529. },
  5530. [ALC280_FIXUP_HP_GPIO4] = {
  5531. .type = HDA_FIXUP_FUNC,
  5532. .v.func = alc280_fixup_hp_gpio4,
  5533. },
  5534. [ALC286_FIXUP_HP_GPIO_LED] = {
  5535. .type = HDA_FIXUP_FUNC,
  5536. .v.func = alc286_fixup_hp_gpio_led,
  5537. },
  5538. [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
  5539. .type = HDA_FIXUP_FUNC,
  5540. .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
  5541. },
  5542. [ALC280_FIXUP_HP_DOCK_PINS] = {
  5543. .type = HDA_FIXUP_PINS,
  5544. .v.pins = (const struct hda_pintbl[]) {
  5545. { 0x1b, 0x21011020 }, /* line-out */
  5546. { 0x1a, 0x01a1903c }, /* headset mic */
  5547. { 0x18, 0x2181103f }, /* line-in */
  5548. { },
  5549. },
  5550. .chained = true,
  5551. .chain_id = ALC280_FIXUP_HP_GPIO4
  5552. },
  5553. [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
  5554. .type = HDA_FIXUP_PINS,
  5555. .v.pins = (const struct hda_pintbl[]) {
  5556. { 0x1b, 0x21011020 }, /* line-out */
  5557. { 0x18, 0x2181103f }, /* line-in */
  5558. { },
  5559. },
  5560. .chained = true,
  5561. .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
  5562. },
  5563. [ALC280_FIXUP_HP_9480M] = {
  5564. .type = HDA_FIXUP_FUNC,
  5565. .v.func = alc280_fixup_hp_9480m,
  5566. },
  5567. [ALC288_FIXUP_DELL_HEADSET_MODE] = {
  5568. .type = HDA_FIXUP_FUNC,
  5569. .v.func = alc_fixup_headset_mode_dell_alc288,
  5570. .chained = true,
  5571. .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
  5572. },
  5573. [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
  5574. .type = HDA_FIXUP_PINS,
  5575. .v.pins = (const struct hda_pintbl[]) {
  5576. { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
  5577. { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
  5578. { }
  5579. },
  5580. .chained = true,
  5581. .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
  5582. },
  5583. [ALC288_FIXUP_DELL_XPS_13_GPIO6] = {
  5584. .type = HDA_FIXUP_VERBS,
  5585. .v.verbs = (const struct hda_verb[]) {
  5586. {0x01, AC_VERB_SET_GPIO_MASK, 0x40},
  5587. {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x40},
  5588. {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
  5589. { }
  5590. },
  5591. .chained = true,
  5592. .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
  5593. },
  5594. [ALC288_FIXUP_DISABLE_AAMIX] = {
  5595. .type = HDA_FIXUP_FUNC,
  5596. .v.func = alc_fixup_disable_aamix,
  5597. .chained = true,
  5598. .chain_id = ALC288_FIXUP_DELL_XPS_13_GPIO6
  5599. },
  5600. [ALC288_FIXUP_DELL_XPS_13] = {
  5601. .type = HDA_FIXUP_FUNC,
  5602. .v.func = alc_fixup_dell_xps13,
  5603. .chained = true,
  5604. .chain_id = ALC288_FIXUP_DISABLE_AAMIX
  5605. },
  5606. [ALC292_FIXUP_DISABLE_AAMIX] = {
  5607. .type = HDA_FIXUP_FUNC,
  5608. .v.func = alc_fixup_disable_aamix,
  5609. .chained = true,
  5610. .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
  5611. },
  5612. [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
  5613. .type = HDA_FIXUP_FUNC,
  5614. .v.func = alc_fixup_disable_aamix,
  5615. .chained = true,
  5616. .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
  5617. },
  5618. [ALC292_FIXUP_DELL_E7X] = {
  5619. .type = HDA_FIXUP_FUNC,
  5620. .v.func = alc_fixup_dell_xps13,
  5621. .chained = true,
  5622. .chain_id = ALC292_FIXUP_DISABLE_AAMIX
  5623. },
  5624. [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
  5625. .type = HDA_FIXUP_PINS,
  5626. .v.pins = (const struct hda_pintbl[]) {
  5627. { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
  5628. { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
  5629. { }
  5630. },
  5631. .chained = true,
  5632. .chain_id = ALC269_FIXUP_HEADSET_MODE
  5633. },
  5634. [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
  5635. .type = HDA_FIXUP_PINS,
  5636. .v.pins = (const struct hda_pintbl[]) {
  5637. { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
  5638. { }
  5639. },
  5640. .chained = true,
  5641. .chain_id = ALC269_FIXUP_HEADSET_MODE
  5642. },
  5643. [ALC275_FIXUP_DELL_XPS] = {
  5644. .type = HDA_FIXUP_VERBS,
  5645. .v.verbs = (const struct hda_verb[]) {
  5646. /* Enables internal speaker */
  5647. {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
  5648. {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
  5649. {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
  5650. {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
  5651. {}
  5652. }
  5653. },
  5654. [ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE] = {
  5655. .type = HDA_FIXUP_VERBS,
  5656. .v.verbs = (const struct hda_verb[]) {
  5657. /* Disable pass-through path for FRONT 14h */
  5658. {0x20, AC_VERB_SET_COEF_INDEX, 0x36},
  5659. {0x20, AC_VERB_SET_PROC_COEF, 0x1737},
  5660. {}
  5661. },
  5662. .chained = true,
  5663. .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
  5664. },
  5665. [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
  5666. .type = HDA_FIXUP_FUNC,
  5667. .v.func = alc_fixup_disable_aamix,
  5668. .chained = true,
  5669. .chain_id = ALC269_FIXUP_THINKPAD_ACPI
  5670. },
  5671. [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
  5672. .type = HDA_FIXUP_FUNC,
  5673. .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
  5674. },
  5675. [ALC255_FIXUP_DELL_SPK_NOISE] = {
  5676. .type = HDA_FIXUP_FUNC,
  5677. .v.func = alc_fixup_disable_aamix,
  5678. .chained = true,
  5679. .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
  5680. },
  5681. [ALC225_FIXUP_DISABLE_MIC_VREF] = {
  5682. .type = HDA_FIXUP_FUNC,
  5683. .v.func = alc_fixup_disable_mic_vref,
  5684. .chained = true,
  5685. .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
  5686. },
  5687. [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
  5688. .type = HDA_FIXUP_VERBS,
  5689. .v.verbs = (const struct hda_verb[]) {
  5690. /* Disable pass-through path for FRONT 14h */
  5691. { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
  5692. { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
  5693. {}
  5694. },
  5695. .chained = true,
  5696. .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
  5697. },
  5698. [ALC280_FIXUP_HP_HEADSET_MIC] = {
  5699. .type = HDA_FIXUP_FUNC,
  5700. .v.func = alc_fixup_disable_aamix,
  5701. .chained = true,
  5702. .chain_id = ALC269_FIXUP_HEADSET_MIC,
  5703. },
  5704. [ALC221_FIXUP_HP_FRONT_MIC] = {
  5705. .type = HDA_FIXUP_PINS,
  5706. .v.pins = (const struct hda_pintbl[]) {
  5707. { 0x19, 0x02a19020 }, /* Front Mic */
  5708. { }
  5709. },
  5710. },
  5711. [ALC292_FIXUP_TPT460] = {
  5712. .type = HDA_FIXUP_FUNC,
  5713. .v.func = alc_fixup_tpt440_dock,
  5714. .chained = true,
  5715. .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
  5716. },
  5717. [ALC298_FIXUP_SPK_VOLUME] = {
  5718. .type = HDA_FIXUP_FUNC,
  5719. .v.func = alc298_fixup_speaker_volume,
  5720. .chained = true,
  5721. .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
  5722. },
  5723. [ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
  5724. .type = HDA_FIXUP_FUNC,
  5725. .v.func = alc298_fixup_speaker_volume,
  5726. },
  5727. [ALC295_FIXUP_DISABLE_DAC3] = {
  5728. .type = HDA_FIXUP_FUNC,
  5729. .v.func = alc295_fixup_disable_dac3,
  5730. },
  5731. [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
  5732. .type = HDA_FIXUP_PINS,
  5733. .v.pins = (const struct hda_pintbl[]) {
  5734. { 0x1b, 0x90170151 },
  5735. { }
  5736. },
  5737. .chained = true,
  5738. .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
  5739. },
  5740. [ALC269_FIXUP_ATIV_BOOK_8] = {
  5741. .type = HDA_FIXUP_FUNC,
  5742. .v.func = alc_fixup_auto_mute_via_amp,
  5743. .chained = true,
  5744. .chain_id = ALC269_FIXUP_NO_SHUTUP
  5745. },
  5746. [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
  5747. .type = HDA_FIXUP_PINS,
  5748. .v.pins = (const struct hda_pintbl[]) {
  5749. { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
  5750. { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
  5751. { }
  5752. },
  5753. .chained = true,
  5754. .chain_id = ALC269_FIXUP_HEADSET_MODE
  5755. },
  5756. [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
  5757. .type = HDA_FIXUP_FUNC,
  5758. .v.func = alc_fixup_headset_mode,
  5759. },
  5760. [ALC256_FIXUP_ASUS_MIC] = {
  5761. .type = HDA_FIXUP_PINS,
  5762. .v.pins = (const struct hda_pintbl[]) {
  5763. { 0x13, 0x90a60160 }, /* use as internal mic */
  5764. { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
  5765. { }
  5766. },
  5767. .chained = true,
  5768. .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
  5769. },
  5770. [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
  5771. .type = HDA_FIXUP_VERBS,
  5772. .v.verbs = (const struct hda_verb[]) {
  5773. /* Set up GPIO2 for the speaker amp */
  5774. { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
  5775. { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
  5776. { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 },
  5777. {}
  5778. },
  5779. },
  5780. [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
  5781. .type = HDA_FIXUP_PINS,
  5782. .v.pins = (const struct hda_pintbl[]) {
  5783. { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
  5784. { }
  5785. },
  5786. .chained = true,
  5787. .chain_id = ALC269_FIXUP_HEADSET_MIC
  5788. },
  5789. [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
  5790. .type = HDA_FIXUP_VERBS,
  5791. .v.verbs = (const struct hda_verb[]) {
  5792. /* Enables internal speaker */
  5793. {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
  5794. {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
  5795. {}
  5796. },
  5797. .chained = true,
  5798. .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
  5799. },
  5800. [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
  5801. .type = HDA_FIXUP_FUNC,
  5802. .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
  5803. },
  5804. [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
  5805. .type = HDA_FIXUP_PINS,
  5806. .v.pins = (const struct hda_pintbl[]) {
  5807. /* Change the mic location from front to right, otherwise there are
  5808. two front mics with the same name, pulseaudio can't handle them.
  5809. This is just a temporary workaround, after applying this fixup,
  5810. there will be one "Front Mic" and one "Mic" in this machine.
  5811. */
  5812. { 0x1a, 0x04a19040 },
  5813. { }
  5814. },
  5815. },
  5816. [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
  5817. .type = HDA_FIXUP_PINS,
  5818. .v.pins = (const struct hda_pintbl[]) {
  5819. { 0x16, 0x0101102f }, /* Rear Headset HP */
  5820. { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
  5821. { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
  5822. { 0x1b, 0x02011020 },
  5823. { }
  5824. },
  5825. .chained = true,
  5826. .chain_id = ALC225_FIXUP_S3_POP_NOISE
  5827. },
  5828. [ALC225_FIXUP_S3_POP_NOISE] = {
  5829. .type = HDA_FIXUP_FUNC,
  5830. .v.func = alc225_fixup_s3_pop_noise,
  5831. .chained = true,
  5832. .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
  5833. },
  5834. [ALC700_FIXUP_INTEL_REFERENCE] = {
  5835. .type = HDA_FIXUP_VERBS,
  5836. .v.verbs = (const struct hda_verb[]) {
  5837. /* Enables internal speaker */
  5838. {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
  5839. {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
  5840. {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
  5841. {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
  5842. {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
  5843. {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
  5844. {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
  5845. {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
  5846. {}
  5847. }
  5848. },
  5849. [ALC274_FIXUP_DELL_BIND_DACS] = {
  5850. .type = HDA_FIXUP_FUNC,
  5851. .v.func = alc274_fixup_bind_dacs,
  5852. .chained = true,
  5853. .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
  5854. },
  5855. [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
  5856. .type = HDA_FIXUP_PINS,
  5857. .v.pins = (const struct hda_pintbl[]) {
  5858. { 0x1b, 0x0401102f },
  5859. { }
  5860. },
  5861. .chained = true,
  5862. .chain_id = ALC274_FIXUP_DELL_BIND_DACS
  5863. },
  5864. [ALC298_FIXUP_TPT470_DOCK] = {
  5865. .type = HDA_FIXUP_FUNC,
  5866. .v.func = alc_fixup_tpt470_dock,
  5867. .chained = true,
  5868. .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
  5869. },
  5870. [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
  5871. .type = HDA_FIXUP_PINS,
  5872. .v.pins = (const struct hda_pintbl[]) {
  5873. { 0x14, 0x0201101f },
  5874. { }
  5875. },
  5876. .chained = true,
  5877. .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
  5878. },
  5879. [ALC255_FIXUP_DELL_HEADSET_MIC] = {
  5880. .type = HDA_FIXUP_PINS,
  5881. .v.pins = (const struct hda_pintbl[]) {
  5882. { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
  5883. { }
  5884. },
  5885. .chained = true,
  5886. .chain_id = ALC269_FIXUP_HEADSET_MIC
  5887. },
  5888. [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
  5889. .type = HDA_FIXUP_PINS,
  5890. .v.pins = (const struct hda_pintbl[]) {
  5891. { 0x16, 0x01011020 }, /* Rear Line out */
  5892. { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
  5893. { }
  5894. },
  5895. .chained = true,
  5896. .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
  5897. },
  5898. [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
  5899. .type = HDA_FIXUP_FUNC,
  5900. .v.func = alc_fixup_auto_mute_via_amp,
  5901. .chained = true,
  5902. .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
  5903. },
  5904. [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
  5905. .type = HDA_FIXUP_FUNC,
  5906. .v.func = alc_fixup_disable_mic_vref,
  5907. .chained = true,
  5908. .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
  5909. },
  5910. };
  5911. static const struct snd_pci_quirk alc269_fixup_tbl[] = {
  5912. SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
  5913. SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
  5914. SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
  5915. SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
  5916. SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
  5917. SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
  5918. SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
  5919. SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
  5920. SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
  5921. SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
  5922. SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
  5923. SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
  5924. SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
  5925. SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
  5926. SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
  5927. SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
  5928. SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
  5929. SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
  5930. SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
  5931. SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
  5932. SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
  5933. SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
  5934. SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
  5935. SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
  5936. SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
  5937. SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
  5938. SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
  5939. SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
  5940. SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
  5941. SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
  5942. SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
  5943. SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
  5944. SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
  5945. SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
  5946. SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
  5947. SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
  5948. SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
  5949. SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
  5950. SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
  5951. SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
  5952. SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13 9350", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
  5953. SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
  5954. SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
  5955. SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
  5956. SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
  5957. SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
  5958. SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
  5959. SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
  5960. SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
  5961. SND_PCI_QUIRK(0x1028, 0x082a, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
  5962. SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
  5963. SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
  5964. SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
  5965. SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
  5966. SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
  5967. SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
  5968. SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
  5969. SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
  5970. SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
  5971. SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
  5972. SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
  5973. SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
  5974. SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
  5975. SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
  5976. /* ALC282 */
  5977. SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  5978. SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  5979. SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  5980. SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
  5981. SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
  5982. SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
  5983. SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
  5984. SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
  5985. SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  5986. SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  5987. SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  5988. SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  5989. SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
  5990. SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
  5991. SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
  5992. SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  5993. SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  5994. SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  5995. SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  5996. SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  5997. SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
  5998. SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
  5999. SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
  6000. /* ALC290 */
  6001. SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
  6002. SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
  6003. SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
  6004. SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
  6005. SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
  6006. SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
  6007. SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
  6008. SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
  6009. SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
  6010. SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
  6011. SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  6012. SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  6013. SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  6014. SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  6015. SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
  6016. SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
  6017. SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
  6018. SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  6019. SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  6020. SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  6021. SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  6022. SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  6023. SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  6024. SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  6025. SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  6026. SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  6027. SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  6028. SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  6029. SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
  6030. SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
  6031. SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
  6032. SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
  6033. SND_PCI_QUIRK(0x103c, 0x82bf, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
  6034. SND_PCI_QUIRK(0x103c, 0x82c0, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
  6035. SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
  6036. SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
  6037. SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
  6038. SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
  6039. SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
  6040. SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
  6041. SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
  6042. SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
  6043. SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
  6044. SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
  6045. SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
  6046. SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
  6047. SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
  6048. SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
  6049. SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
  6050. SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
  6051. SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
  6052. SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
  6053. SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
  6054. SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
  6055. SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
  6056. SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
  6057. SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
  6058. SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
  6059. SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
  6060. SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
  6061. SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
  6062. SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
  6063. SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
  6064. SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
  6065. SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
  6066. SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
  6067. SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
  6068. SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
  6069. SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
  6070. SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
  6071. SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
  6072. SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
  6073. SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
  6074. SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
  6075. SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
  6076. SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
  6077. SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
  6078. SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
  6079. SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
  6080. SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
  6081. SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
  6082. SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
  6083. SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
  6084. SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
  6085. SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
  6086. SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
  6087. SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
  6088. SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
  6089. SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
  6090. SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
  6091. SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
  6092. SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
  6093. SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
  6094. SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
  6095. SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
  6096. SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
  6097. SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
  6098. SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
  6099. SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
  6100. SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
  6101. SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
  6102. SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
  6103. SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
  6104. SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
  6105. SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
  6106. SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
  6107. SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
  6108. SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
  6109. SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
  6110. SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
  6111. SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
  6112. SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
  6113. SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
  6114. SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
  6115. SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
  6116. SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
  6117. SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
  6118. SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
  6119. SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
  6120. SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
  6121. SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
  6122. SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
  6123. SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
  6124. SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
  6125. SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
  6126. SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
  6127. SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),
  6128. SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
  6129. SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
  6130. SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
  6131. SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
  6132. SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
  6133. SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
  6134. SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
  6135. SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
  6136. SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
  6137. SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
  6138. SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
  6139. SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
  6140. SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
  6141. SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
  6142. SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
  6143. SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
  6144. SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
  6145. SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
  6146. SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
  6147. SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
  6148. SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
  6149. SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
  6150. SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
  6151. SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
  6152. #if 0
  6153. /* Below is a quirk table taken from the old code.
  6154. * Basically the device should work as is without the fixup table.
  6155. * If BIOS doesn't give a proper info, enable the corresponding
  6156. * fixup entry.
  6157. */
  6158. SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
  6159. ALC269_FIXUP_AMIC),
  6160. SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
  6161. SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
  6162. SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
  6163. SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
  6164. SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
  6165. SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
  6166. SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
  6167. SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
  6168. SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
  6169. SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
  6170. SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
  6171. SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
  6172. SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
  6173. SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
  6174. SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
  6175. SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
  6176. SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
  6177. SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
  6178. SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
  6179. SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
  6180. SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
  6181. SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
  6182. SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
  6183. SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
  6184. SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
  6185. SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
  6186. SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
  6187. SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
  6188. SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
  6189. SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
  6190. SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
  6191. SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
  6192. SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
  6193. SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
  6194. SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
  6195. SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
  6196. SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
  6197. SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
  6198. SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
  6199. #endif
  6200. {}
  6201. };
  6202. static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
  6203. SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
  6204. SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
  6205. SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
  6206. SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
  6207. {}
  6208. };
  6209. static const struct hda_model_fixup alc269_fixup_models[] = {
  6210. {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
  6211. {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
  6212. {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
  6213. {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
  6214. {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
  6215. {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
  6216. {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
  6217. {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
  6218. {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
  6219. {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
  6220. {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
  6221. {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
  6222. {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
  6223. {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
  6224. {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
  6225. {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
  6226. {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
  6227. {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
  6228. {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
  6229. {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
  6230. {}
  6231. };
  6232. #define ALC225_STANDARD_PINS \
  6233. {0x21, 0x04211020}
  6234. #define ALC256_STANDARD_PINS \
  6235. {0x12, 0x90a60140}, \
  6236. {0x14, 0x90170110}, \
  6237. {0x21, 0x02211020}
  6238. #define ALC282_STANDARD_PINS \
  6239. {0x14, 0x90170110}
  6240. #define ALC290_STANDARD_PINS \
  6241. {0x12, 0x99a30130}
  6242. #define ALC292_STANDARD_PINS \
  6243. {0x14, 0x90170110}, \
  6244. {0x15, 0x0221401f}
  6245. #define ALC295_STANDARD_PINS \
  6246. {0x12, 0xb7a60130}, \
  6247. {0x14, 0x90170110}, \
  6248. {0x21, 0x04211020}
  6249. #define ALC298_STANDARD_PINS \
  6250. {0x12, 0x90a60130}, \
  6251. {0x21, 0x03211020}
  6252. static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
  6253. SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
  6254. {0x12, 0x90a601c0},
  6255. {0x14, 0x90171120},
  6256. {0x21, 0x02211030}),
  6257. SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
  6258. {0x14, 0x90170110},
  6259. {0x1b, 0x90a70130},
  6260. {0x21, 0x03211020}),
  6261. SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
  6262. {0x1a, 0x90a70130},
  6263. {0x1b, 0x90170110},
  6264. {0x21, 0x03211020}),
  6265. SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
  6266. ALC225_STANDARD_PINS,
  6267. {0x12, 0xb7a60130},
  6268. {0x14, 0x901701a0}),
  6269. SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
  6270. ALC225_STANDARD_PINS,
  6271. {0x12, 0xb7a60130},
  6272. {0x14, 0x901701b0}),
  6273. SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
  6274. ALC225_STANDARD_PINS,
  6275. {0x12, 0xb7a60150},
  6276. {0x14, 0x901701a0}),
  6277. SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
  6278. ALC225_STANDARD_PINS,
  6279. {0x12, 0xb7a60150},
  6280. {0x14, 0x901701b0}),
  6281. SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
  6282. ALC225_STANDARD_PINS,
  6283. {0x12, 0xb7a60130},
  6284. {0x1b, 0x90170110}),
  6285. SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6286. {0x12, 0x90a60140},
  6287. {0x14, 0x90170110},
  6288. {0x21, 0x02211020}),
  6289. SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
  6290. {0x12, 0x90a60140},
  6291. {0x14, 0x90170110},
  6292. {0x19, 0x02a11030},
  6293. {0x21, 0x02211020}),
  6294. SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
  6295. {0x14, 0x90170110},
  6296. {0x19, 0x02a11030},
  6297. {0x1a, 0x02a11040},
  6298. {0x1b, 0x01014020},
  6299. {0x21, 0x0221101f}),
  6300. SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
  6301. {0x14, 0x90170110},
  6302. {0x19, 0x02a11030},
  6303. {0x1a, 0x02a11040},
  6304. {0x1b, 0x01011020},
  6305. {0x21, 0x0221101f}),
  6306. SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
  6307. {0x14, 0x90170110},
  6308. {0x19, 0x02a11020},
  6309. {0x1a, 0x02a11030},
  6310. {0x21, 0x0221101f}),
  6311. SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6312. {0x12, 0x90a60140},
  6313. {0x14, 0x90170150},
  6314. {0x21, 0x02211020}),
  6315. SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6316. {0x21, 0x02211020}),
  6317. SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6318. {0x12, 0x40000000},
  6319. {0x14, 0x90170110},
  6320. {0x21, 0x02211020}),
  6321. SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
  6322. {0x14, 0x90170110},
  6323. {0x21, 0x02211020}),
  6324. SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6325. {0x14, 0x90170130},
  6326. {0x21, 0x02211040}),
  6327. SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6328. {0x12, 0x90a60140},
  6329. {0x14, 0x90170110},
  6330. {0x21, 0x02211020}),
  6331. SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6332. {0x12, 0x90a60160},
  6333. {0x14, 0x90170120},
  6334. {0x21, 0x02211030}),
  6335. SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6336. {0x14, 0x90170110},
  6337. {0x1b, 0x02011020},
  6338. {0x21, 0x0221101f}),
  6339. SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6340. {0x14, 0x90170110},
  6341. {0x1b, 0x01011020},
  6342. {0x21, 0x0221101f}),
  6343. SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6344. {0x14, 0x90170130},
  6345. {0x1b, 0x01014020},
  6346. {0x21, 0x0221103f}),
  6347. SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6348. {0x14, 0x90170130},
  6349. {0x1b, 0x01011020},
  6350. {0x21, 0x0221103f}),
  6351. SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6352. {0x14, 0x90170130},
  6353. {0x1b, 0x02011020},
  6354. {0x21, 0x0221103f}),
  6355. SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6356. {0x14, 0x90170150},
  6357. {0x1b, 0x02011020},
  6358. {0x21, 0x0221105f}),
  6359. SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6360. {0x14, 0x90170110},
  6361. {0x1b, 0x01014020},
  6362. {0x21, 0x0221101f}),
  6363. SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6364. {0x12, 0x90a60160},
  6365. {0x14, 0x90170120},
  6366. {0x17, 0x90170140},
  6367. {0x21, 0x0321102f}),
  6368. SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6369. {0x12, 0x90a60160},
  6370. {0x14, 0x90170130},
  6371. {0x21, 0x02211040}),
  6372. SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6373. {0x12, 0x90a60160},
  6374. {0x14, 0x90170140},
  6375. {0x21, 0x02211050}),
  6376. SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6377. {0x12, 0x90a60170},
  6378. {0x14, 0x90170120},
  6379. {0x21, 0x02211030}),
  6380. SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6381. {0x12, 0x90a60170},
  6382. {0x14, 0x90170130},
  6383. {0x21, 0x02211040}),
  6384. SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6385. {0x12, 0x90a60170},
  6386. {0x14, 0x90171130},
  6387. {0x21, 0x02211040}),
  6388. SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6389. {0x12, 0x90a60170},
  6390. {0x14, 0x90170140},
  6391. {0x21, 0x02211050}),
  6392. SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6393. {0x12, 0x90a60180},
  6394. {0x14, 0x90170130},
  6395. {0x21, 0x02211040}),
  6396. SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6397. {0x12, 0x90a60180},
  6398. {0x14, 0x90170120},
  6399. {0x21, 0x02211030}),
  6400. SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6401. {0x1b, 0x01011020},
  6402. {0x21, 0x02211010}),
  6403. SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6404. {0x12, 0x90a60130},
  6405. {0x14, 0x90170110},
  6406. {0x1b, 0x01011020},
  6407. {0x21, 0x0221101f}),
  6408. SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6409. {0x12, 0x90a60160},
  6410. {0x14, 0x90170120},
  6411. {0x21, 0x02211030}),
  6412. SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6413. {0x12, 0x90a60170},
  6414. {0x14, 0x90170120},
  6415. {0x21, 0x02211030}),
  6416. SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell Inspiron 5468", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6417. {0x12, 0x90a60180},
  6418. {0x14, 0x90170120},
  6419. {0x21, 0x02211030}),
  6420. SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6421. {0x12, 0xb7a60130},
  6422. {0x14, 0x90170110},
  6423. {0x21, 0x02211020}),
  6424. SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6425. {0x12, 0x90a60130},
  6426. {0x14, 0x90170110},
  6427. {0x14, 0x01011020},
  6428. {0x21, 0x0221101f}),
  6429. SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6430. ALC256_STANDARD_PINS),
  6431. SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
  6432. {0x14, 0x90170110},
  6433. {0x1b, 0x01011020},
  6434. {0x21, 0x0221101f}),
  6435. SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
  6436. {0x14, 0x90170110},
  6437. {0x1b, 0x90a70130},
  6438. {0x21, 0x04211020}),
  6439. SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
  6440. {0x14, 0x90170110},
  6441. {0x1b, 0x90a70130},
  6442. {0x21, 0x03211020}),
  6443. SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
  6444. {0x12, 0xb7a60130},
  6445. {0x13, 0xb8a61140},
  6446. {0x16, 0x90170110},
  6447. {0x21, 0x04211020}),
  6448. SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
  6449. {0x12, 0x90a60130},
  6450. {0x14, 0x90170110},
  6451. {0x15, 0x0421101f},
  6452. {0x1a, 0x04a11020}),
  6453. SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
  6454. {0x12, 0x90a60140},
  6455. {0x14, 0x90170110},
  6456. {0x15, 0x0421101f},
  6457. {0x18, 0x02811030},
  6458. {0x1a, 0x04a1103f},
  6459. {0x1b, 0x02011020}),
  6460. SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
  6461. ALC282_STANDARD_PINS,
  6462. {0x12, 0x99a30130},
  6463. {0x19, 0x03a11020},
  6464. {0x21, 0x0321101f}),
  6465. SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
  6466. ALC282_STANDARD_PINS,
  6467. {0x12, 0x99a30130},
  6468. {0x19, 0x03a11020},
  6469. {0x21, 0x03211040}),
  6470. SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
  6471. ALC282_STANDARD_PINS,
  6472. {0x12, 0x99a30130},
  6473. {0x19, 0x03a11030},
  6474. {0x21, 0x03211020}),
  6475. SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
  6476. ALC282_STANDARD_PINS,
  6477. {0x12, 0x99a30130},
  6478. {0x19, 0x04a11020},
  6479. {0x21, 0x0421101f}),
  6480. SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
  6481. ALC282_STANDARD_PINS,
  6482. {0x12, 0x90a60140},
  6483. {0x19, 0x04a11030},
  6484. {0x21, 0x04211020}),
  6485. SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
  6486. ALC282_STANDARD_PINS,
  6487. {0x12, 0x90a60130},
  6488. {0x21, 0x0321101f}),
  6489. SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
  6490. {0x12, 0x90a60160},
  6491. {0x14, 0x90170120},
  6492. {0x21, 0x02211030}),
  6493. SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
  6494. ALC282_STANDARD_PINS,
  6495. {0x12, 0x90a60130},
  6496. {0x19, 0x03a11020},
  6497. {0x21, 0x0321101f}),
  6498. SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL_XPS_13_GPIO6,
  6499. {0x12, 0x90a60120},
  6500. {0x14, 0x90170110},
  6501. {0x21, 0x0321101f}),
  6502. SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
  6503. {0x12, 0xb7a60130},
  6504. {0x14, 0x90170110},
  6505. {0x21, 0x04211020}),
  6506. SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
  6507. ALC290_STANDARD_PINS,
  6508. {0x15, 0x04211040},
  6509. {0x18, 0x90170112},
  6510. {0x1a, 0x04a11020}),
  6511. SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
  6512. ALC290_STANDARD_PINS,
  6513. {0x15, 0x04211040},
  6514. {0x18, 0x90170110},
  6515. {0x1a, 0x04a11020}),
  6516. SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
  6517. ALC290_STANDARD_PINS,
  6518. {0x15, 0x0421101f},
  6519. {0x1a, 0x04a11020}),
  6520. SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
  6521. ALC290_STANDARD_PINS,
  6522. {0x15, 0x04211020},
  6523. {0x1a, 0x04a11040}),
  6524. SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
  6525. ALC290_STANDARD_PINS,
  6526. {0x14, 0x90170110},
  6527. {0x15, 0x04211020},
  6528. {0x1a, 0x04a11040}),
  6529. SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
  6530. ALC290_STANDARD_PINS,
  6531. {0x14, 0x90170110},
  6532. {0x15, 0x04211020},
  6533. {0x1a, 0x04a11020}),
  6534. SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
  6535. ALC290_STANDARD_PINS,
  6536. {0x14, 0x90170110},
  6537. {0x15, 0x0421101f},
  6538. {0x1a, 0x04a11020}),
  6539. SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
  6540. ALC292_STANDARD_PINS,
  6541. {0x12, 0x90a60140},
  6542. {0x16, 0x01014020},
  6543. {0x19, 0x01a19030}),
  6544. SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
  6545. ALC292_STANDARD_PINS,
  6546. {0x12, 0x90a60140},
  6547. {0x16, 0x01014020},
  6548. {0x18, 0x02a19031},
  6549. {0x19, 0x01a1903e}),
  6550. SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
  6551. ALC292_STANDARD_PINS,
  6552. {0x12, 0x90a60140}),
  6553. SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
  6554. ALC292_STANDARD_PINS,
  6555. {0x13, 0x90a60140},
  6556. {0x16, 0x21014020},
  6557. {0x19, 0x21a19030}),
  6558. SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
  6559. ALC292_STANDARD_PINS,
  6560. {0x13, 0x90a60140}),
  6561. SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
  6562. {0x14, 0x90170110},
  6563. {0x21, 0x04211020}),
  6564. SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
  6565. ALC295_STANDARD_PINS,
  6566. {0x17, 0x21014020},
  6567. {0x18, 0x21a19030}),
  6568. SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
  6569. ALC295_STANDARD_PINS,
  6570. {0x17, 0x21014040},
  6571. {0x18, 0x21a19050}),
  6572. SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
  6573. ALC295_STANDARD_PINS),
  6574. SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
  6575. ALC298_STANDARD_PINS,
  6576. {0x17, 0x90170110}),
  6577. SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
  6578. ALC298_STANDARD_PINS,
  6579. {0x17, 0x90170140}),
  6580. SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
  6581. ALC298_STANDARD_PINS,
  6582. {0x17, 0x90170150}),
  6583. SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
  6584. {0x12, 0xb7a60140},
  6585. {0x13, 0xb7a60150},
  6586. {0x17, 0x90170110},
  6587. {0x1a, 0x03011020},
  6588. {0x21, 0x03211030}),
  6589. SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
  6590. ALC225_STANDARD_PINS,
  6591. {0x12, 0xb7a60130},
  6592. {0x17, 0x90170110}),
  6593. SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
  6594. {0x14, 0x01014010},
  6595. {0x17, 0x90170120},
  6596. {0x18, 0x02a11030},
  6597. {0x19, 0x02a1103f},
  6598. {0x21, 0x0221101f}),
  6599. {}
  6600. };
  6601. static void alc269_fill_coef(struct hda_codec *codec)
  6602. {
  6603. struct alc_spec *spec = codec->spec;
  6604. int val;
  6605. if (spec->codec_variant != ALC269_TYPE_ALC269VB)
  6606. return;
  6607. if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
  6608. alc_write_coef_idx(codec, 0xf, 0x960b);
  6609. alc_write_coef_idx(codec, 0xe, 0x8817);
  6610. }
  6611. if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
  6612. alc_write_coef_idx(codec, 0xf, 0x960b);
  6613. alc_write_coef_idx(codec, 0xe, 0x8814);
  6614. }
  6615. if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
  6616. /* Power up output pin */
  6617. alc_update_coef_idx(codec, 0x04, 0, 1<<11);
  6618. }
  6619. if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
  6620. val = alc_read_coef_idx(codec, 0xd);
  6621. if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
  6622. /* Capless ramp up clock control */
  6623. alc_write_coef_idx(codec, 0xd, val | (1<<10));
  6624. }
  6625. val = alc_read_coef_idx(codec, 0x17);
  6626. if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
  6627. /* Class D power on reset */
  6628. alc_write_coef_idx(codec, 0x17, val | (1<<7));
  6629. }
  6630. }
  6631. /* HP */
  6632. alc_update_coef_idx(codec, 0x4, 0, 1<<11);
  6633. }
  6634. /*
  6635. */
  6636. static int patch_alc269(struct hda_codec *codec)
  6637. {
  6638. struct alc_spec *spec;
  6639. int err;
  6640. err = alc_alloc_spec(codec, 0x0b);
  6641. if (err < 0)
  6642. return err;
  6643. spec = codec->spec;
  6644. spec->gen.shared_mic_vref_pin = 0x18;
  6645. codec->power_save_node = 0;
  6646. #ifdef CONFIG_PM
  6647. codec->patch_ops.suspend = alc269_suspend;
  6648. codec->patch_ops.resume = alc269_resume;
  6649. #endif
  6650. spec->shutup = alc_default_shutup;
  6651. spec->init_hook = alc_default_init;
  6652. snd_hda_pick_fixup(codec, alc269_fixup_models,
  6653. alc269_fixup_tbl, alc269_fixups);
  6654. snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
  6655. snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
  6656. alc269_fixups);
  6657. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  6658. alc_auto_parse_customize_define(codec);
  6659. if (has_cdefine_beep(codec))
  6660. spec->gen.beep_nid = 0x01;
  6661. switch (codec->core.vendor_id) {
  6662. case 0x10ec0269:
  6663. spec->codec_variant = ALC269_TYPE_ALC269VA;
  6664. switch (alc_get_coef0(codec) & 0x00f0) {
  6665. case 0x0010:
  6666. if (codec->bus->pci &&
  6667. codec->bus->pci->subsystem_vendor == 0x1025 &&
  6668. spec->cdefine.platform_type == 1)
  6669. err = alc_codec_rename(codec, "ALC271X");
  6670. spec->codec_variant = ALC269_TYPE_ALC269VB;
  6671. break;
  6672. case 0x0020:
  6673. if (codec->bus->pci &&
  6674. codec->bus->pci->subsystem_vendor == 0x17aa &&
  6675. codec->bus->pci->subsystem_device == 0x21f3)
  6676. err = alc_codec_rename(codec, "ALC3202");
  6677. spec->codec_variant = ALC269_TYPE_ALC269VC;
  6678. break;
  6679. case 0x0030:
  6680. spec->codec_variant = ALC269_TYPE_ALC269VD;
  6681. break;
  6682. default:
  6683. alc_fix_pll_init(codec, 0x20, 0x04, 15);
  6684. }
  6685. if (err < 0)
  6686. goto error;
  6687. spec->shutup = alc269_shutup;
  6688. spec->init_hook = alc269_fill_coef;
  6689. alc269_fill_coef(codec);
  6690. break;
  6691. case 0x10ec0280:
  6692. case 0x10ec0290:
  6693. spec->codec_variant = ALC269_TYPE_ALC280;
  6694. break;
  6695. case 0x10ec0282:
  6696. spec->codec_variant = ALC269_TYPE_ALC282;
  6697. spec->shutup = alc282_shutup;
  6698. spec->init_hook = alc282_init;
  6699. break;
  6700. case 0x10ec0233:
  6701. case 0x10ec0283:
  6702. spec->codec_variant = ALC269_TYPE_ALC283;
  6703. spec->shutup = alc283_shutup;
  6704. spec->init_hook = alc283_init;
  6705. break;
  6706. case 0x10ec0284:
  6707. case 0x10ec0292:
  6708. spec->codec_variant = ALC269_TYPE_ALC284;
  6709. break;
  6710. case 0x10ec0293:
  6711. spec->codec_variant = ALC269_TYPE_ALC293;
  6712. break;
  6713. case 0x10ec0286:
  6714. case 0x10ec0288:
  6715. spec->codec_variant = ALC269_TYPE_ALC286;
  6716. spec->shutup = alc286_shutup;
  6717. break;
  6718. case 0x10ec0298:
  6719. spec->codec_variant = ALC269_TYPE_ALC298;
  6720. break;
  6721. case 0x10ec0235:
  6722. case 0x10ec0255:
  6723. spec->codec_variant = ALC269_TYPE_ALC255;
  6724. spec->shutup = alc256_shutup;
  6725. spec->init_hook = alc256_init;
  6726. break;
  6727. case 0x10ec0236:
  6728. case 0x10ec0256:
  6729. spec->codec_variant = ALC269_TYPE_ALC256;
  6730. spec->shutup = alc256_shutup;
  6731. spec->init_hook = alc256_init;
  6732. spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
  6733. break;
  6734. case 0x10ec0257:
  6735. spec->codec_variant = ALC269_TYPE_ALC257;
  6736. spec->shutup = alc256_shutup;
  6737. spec->init_hook = alc256_init;
  6738. spec->gen.mixer_nid = 0;
  6739. break;
  6740. case 0x10ec0215:
  6741. case 0x10ec0245:
  6742. case 0x10ec0285:
  6743. case 0x10ec0287:
  6744. case 0x10ec0289:
  6745. spec->codec_variant = ALC269_TYPE_ALC215;
  6746. spec->gen.mixer_nid = 0;
  6747. break;
  6748. case 0x10ec0225:
  6749. case 0x10ec0295:
  6750. spec->codec_variant = ALC269_TYPE_ALC225;
  6751. spec->gen.mixer_nid = 0; /* no loopback on ALC225 ALC295 */
  6752. break;
  6753. case 0x10ec0299:
  6754. spec->codec_variant = ALC269_TYPE_ALC225;
  6755. spec->gen.mixer_nid = 0; /* no loopback on ALC299 */
  6756. break;
  6757. case 0x10ec0234:
  6758. case 0x10ec0274:
  6759. case 0x10ec0294:
  6760. spec->codec_variant = ALC269_TYPE_ALC294;
  6761. spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
  6762. alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
  6763. spec->init_hook = alc294_init;
  6764. break;
  6765. case 0x10ec0300:
  6766. spec->codec_variant = ALC269_TYPE_ALC300;
  6767. spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
  6768. break;
  6769. case 0x10ec0623:
  6770. spec->codec_variant = ALC269_TYPE_ALC623;
  6771. break;
  6772. case 0x10ec0700:
  6773. case 0x10ec0701:
  6774. case 0x10ec0703:
  6775. case 0x10ec0711:
  6776. spec->codec_variant = ALC269_TYPE_ALC700;
  6777. spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
  6778. alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
  6779. spec->init_hook = alc294_init;
  6780. break;
  6781. }
  6782. if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
  6783. spec->has_alc5505_dsp = 1;
  6784. spec->init_hook = alc5505_dsp_init;
  6785. }
  6786. /* automatic parse from the BIOS config */
  6787. err = alc269_parse_auto_config(codec);
  6788. if (err < 0)
  6789. goto error;
  6790. if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid)
  6791. set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
  6792. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  6793. return 0;
  6794. error:
  6795. alc_free(codec);
  6796. return err;
  6797. }
  6798. /*
  6799. * ALC861
  6800. */
  6801. static int alc861_parse_auto_config(struct hda_codec *codec)
  6802. {
  6803. static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
  6804. static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
  6805. return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
  6806. }
  6807. /* Pin config fixes */
  6808. enum {
  6809. ALC861_FIXUP_FSC_AMILO_PI1505,
  6810. ALC861_FIXUP_AMP_VREF_0F,
  6811. ALC861_FIXUP_NO_JACK_DETECT,
  6812. ALC861_FIXUP_ASUS_A6RP,
  6813. ALC660_FIXUP_ASUS_W7J,
  6814. };
  6815. /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
  6816. static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
  6817. const struct hda_fixup *fix, int action)
  6818. {
  6819. struct alc_spec *spec = codec->spec;
  6820. unsigned int val;
  6821. if (action != HDA_FIXUP_ACT_INIT)
  6822. return;
  6823. val = snd_hda_codec_get_pin_target(codec, 0x0f);
  6824. if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
  6825. val |= AC_PINCTL_IN_EN;
  6826. val |= AC_PINCTL_VREF_50;
  6827. snd_hda_set_pin_ctl(codec, 0x0f, val);
  6828. spec->gen.keep_vref_in_automute = 1;
  6829. }
  6830. /* suppress the jack-detection */
  6831. static void alc_fixup_no_jack_detect(struct hda_codec *codec,
  6832. const struct hda_fixup *fix, int action)
  6833. {
  6834. if (action == HDA_FIXUP_ACT_PRE_PROBE)
  6835. codec->no_jack_detect = 1;
  6836. }
  6837. static const struct hda_fixup alc861_fixups[] = {
  6838. [ALC861_FIXUP_FSC_AMILO_PI1505] = {
  6839. .type = HDA_FIXUP_PINS,
  6840. .v.pins = (const struct hda_pintbl[]) {
  6841. { 0x0b, 0x0221101f }, /* HP */
  6842. { 0x0f, 0x90170310 }, /* speaker */
  6843. { }
  6844. }
  6845. },
  6846. [ALC861_FIXUP_AMP_VREF_0F] = {
  6847. .type = HDA_FIXUP_FUNC,
  6848. .v.func = alc861_fixup_asus_amp_vref_0f,
  6849. },
  6850. [ALC861_FIXUP_NO_JACK_DETECT] = {
  6851. .type = HDA_FIXUP_FUNC,
  6852. .v.func = alc_fixup_no_jack_detect,
  6853. },
  6854. [ALC861_FIXUP_ASUS_A6RP] = {
  6855. .type = HDA_FIXUP_FUNC,
  6856. .v.func = alc861_fixup_asus_amp_vref_0f,
  6857. .chained = true,
  6858. .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
  6859. },
  6860. [ALC660_FIXUP_ASUS_W7J] = {
  6861. .type = HDA_FIXUP_VERBS,
  6862. .v.verbs = (const struct hda_verb[]) {
  6863. /* ASUS W7J needs a magic pin setup on unused NID 0x10
  6864. * for enabling outputs
  6865. */
  6866. {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
  6867. { }
  6868. },
  6869. }
  6870. };
  6871. static const struct snd_pci_quirk alc861_fixup_tbl[] = {
  6872. SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
  6873. SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
  6874. SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
  6875. SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
  6876. SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
  6877. SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
  6878. SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
  6879. {}
  6880. };
  6881. /*
  6882. */
  6883. static int patch_alc861(struct hda_codec *codec)
  6884. {
  6885. struct alc_spec *spec;
  6886. int err;
  6887. err = alc_alloc_spec(codec, 0x15);
  6888. if (err < 0)
  6889. return err;
  6890. spec = codec->spec;
  6891. spec->gen.beep_nid = 0x23;
  6892. #ifdef CONFIG_PM
  6893. spec->power_hook = alc_power_eapd;
  6894. #endif
  6895. snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
  6896. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  6897. /* automatic parse from the BIOS config */
  6898. err = alc861_parse_auto_config(codec);
  6899. if (err < 0)
  6900. goto error;
  6901. if (!spec->gen.no_analog)
  6902. set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
  6903. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  6904. return 0;
  6905. error:
  6906. alc_free(codec);
  6907. return err;
  6908. }
  6909. /*
  6910. * ALC861-VD support
  6911. *
  6912. * Based on ALC882
  6913. *
  6914. * In addition, an independent DAC
  6915. */
  6916. static int alc861vd_parse_auto_config(struct hda_codec *codec)
  6917. {
  6918. static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
  6919. static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
  6920. return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
  6921. }
  6922. enum {
  6923. ALC660VD_FIX_ASUS_GPIO1,
  6924. ALC861VD_FIX_DALLAS,
  6925. };
  6926. /* exclude VREF80 */
  6927. static void alc861vd_fixup_dallas(struct hda_codec *codec,
  6928. const struct hda_fixup *fix, int action)
  6929. {
  6930. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  6931. snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
  6932. snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
  6933. }
  6934. }
  6935. static const struct hda_fixup alc861vd_fixups[] = {
  6936. [ALC660VD_FIX_ASUS_GPIO1] = {
  6937. .type = HDA_FIXUP_VERBS,
  6938. .v.verbs = (const struct hda_verb[]) {
  6939. /* reset GPIO1 */
  6940. {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
  6941. {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
  6942. {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
  6943. { }
  6944. }
  6945. },
  6946. [ALC861VD_FIX_DALLAS] = {
  6947. .type = HDA_FIXUP_FUNC,
  6948. .v.func = alc861vd_fixup_dallas,
  6949. },
  6950. };
  6951. static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
  6952. SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
  6953. SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
  6954. SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
  6955. {}
  6956. };
  6957. /*
  6958. */
  6959. static int patch_alc861vd(struct hda_codec *codec)
  6960. {
  6961. struct alc_spec *spec;
  6962. int err;
  6963. err = alc_alloc_spec(codec, 0x0b);
  6964. if (err < 0)
  6965. return err;
  6966. spec = codec->spec;
  6967. spec->gen.beep_nid = 0x23;
  6968. spec->shutup = alc_eapd_shutup;
  6969. snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
  6970. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  6971. /* automatic parse from the BIOS config */
  6972. err = alc861vd_parse_auto_config(codec);
  6973. if (err < 0)
  6974. goto error;
  6975. if (!spec->gen.no_analog)
  6976. set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
  6977. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  6978. return 0;
  6979. error:
  6980. alc_free(codec);
  6981. return err;
  6982. }
  6983. /*
  6984. * ALC662 support
  6985. *
  6986. * ALC662 is almost identical with ALC880 but has cleaner and more flexible
  6987. * configuration. Each pin widget can choose any input DACs and a mixer.
  6988. * Each ADC is connected from a mixer of all inputs. This makes possible
  6989. * 6-channel independent captures.
  6990. *
  6991. * In addition, an independent DAC for the multi-playback (not used in this
  6992. * driver yet).
  6993. */
  6994. /*
  6995. * BIOS auto configuration
  6996. */
  6997. static int alc662_parse_auto_config(struct hda_codec *codec)
  6998. {
  6999. static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
  7000. static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
  7001. static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
  7002. const hda_nid_t *ssids;
  7003. if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
  7004. codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
  7005. codec->core.vendor_id == 0x10ec0671)
  7006. ssids = alc663_ssids;
  7007. else
  7008. ssids = alc662_ssids;
  7009. return alc_parse_auto_config(codec, alc662_ignore, ssids);
  7010. }
  7011. static void alc272_fixup_mario(struct hda_codec *codec,
  7012. const struct hda_fixup *fix, int action)
  7013. {
  7014. if (action != HDA_FIXUP_ACT_PRE_PROBE)
  7015. return;
  7016. if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
  7017. (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
  7018. (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
  7019. (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
  7020. (0 << AC_AMPCAP_MUTE_SHIFT)))
  7021. codec_warn(codec, "failed to override amp caps for NID 0x2\n");
  7022. }
  7023. static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
  7024. { .channels = 2,
  7025. .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
  7026. { .channels = 4,
  7027. .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
  7028. SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
  7029. { }
  7030. };
  7031. /* override the 2.1 chmap */
  7032. static void alc_fixup_bass_chmap(struct hda_codec *codec,
  7033. const struct hda_fixup *fix, int action)
  7034. {
  7035. if (action == HDA_FIXUP_ACT_BUILD) {
  7036. struct alc_spec *spec = codec->spec;
  7037. spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
  7038. }
  7039. }
  7040. /* avoid D3 for keeping GPIO up */
  7041. static unsigned int gpio_led_power_filter(struct hda_codec *codec,
  7042. hda_nid_t nid,
  7043. unsigned int power_state)
  7044. {
  7045. struct alc_spec *spec = codec->spec;
  7046. if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_led)
  7047. return AC_PWRST_D0;
  7048. return power_state;
  7049. }
  7050. static void alc662_fixup_led_gpio1(struct hda_codec *codec,
  7051. const struct hda_fixup *fix, int action)
  7052. {
  7053. struct alc_spec *spec = codec->spec;
  7054. static const struct hda_verb gpio_init[] = {
  7055. { 0x01, AC_VERB_SET_GPIO_MASK, 0x01 },
  7056. { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01 },
  7057. {}
  7058. };
  7059. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  7060. spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
  7061. spec->gpio_led = 0;
  7062. spec->mute_led_polarity = 1;
  7063. spec->gpio_mute_led_mask = 0x01;
  7064. snd_hda_add_verbs(codec, gpio_init);
  7065. codec->power_filter = gpio_led_power_filter;
  7066. }
  7067. }
  7068. static void alc662_usi_automute_hook(struct hda_codec *codec,
  7069. struct hda_jack_callback *jack)
  7070. {
  7071. struct alc_spec *spec = codec->spec;
  7072. int vref;
  7073. msleep(200);
  7074. snd_hda_gen_hp_automute(codec, jack);
  7075. vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
  7076. msleep(100);
  7077. snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
  7078. vref);
  7079. }
  7080. static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
  7081. const struct hda_fixup *fix, int action)
  7082. {
  7083. struct alc_spec *spec = codec->spec;
  7084. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  7085. spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
  7086. spec->gen.hp_automute_hook = alc662_usi_automute_hook;
  7087. }
  7088. }
  7089. static struct coef_fw alc668_coefs[] = {
  7090. WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
  7091. WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
  7092. WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
  7093. WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
  7094. WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
  7095. WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
  7096. WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
  7097. WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
  7098. WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
  7099. WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
  7100. WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
  7101. WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
  7102. WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
  7103. WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
  7104. WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
  7105. WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
  7106. WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
  7107. WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
  7108. WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
  7109. WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
  7110. {}
  7111. };
  7112. static void alc668_restore_default_value(struct hda_codec *codec)
  7113. {
  7114. alc_process_coef_fw(codec, alc668_coefs);
  7115. }
  7116. enum {
  7117. ALC662_FIXUP_ASPIRE,
  7118. ALC662_FIXUP_LED_GPIO1,
  7119. ALC662_FIXUP_IDEAPAD,
  7120. ALC272_FIXUP_MARIO,
  7121. ALC662_FIXUP_CZC_P10T,
  7122. ALC662_FIXUP_SKU_IGNORE,
  7123. ALC662_FIXUP_HP_RP5800,
  7124. ALC662_FIXUP_ASUS_MODE1,
  7125. ALC662_FIXUP_ASUS_MODE2,
  7126. ALC662_FIXUP_ASUS_MODE3,
  7127. ALC662_FIXUP_ASUS_MODE4,
  7128. ALC662_FIXUP_ASUS_MODE5,
  7129. ALC662_FIXUP_ASUS_MODE6,
  7130. ALC662_FIXUP_ASUS_MODE7,
  7131. ALC662_FIXUP_ASUS_MODE8,
  7132. ALC662_FIXUP_NO_JACK_DETECT,
  7133. ALC662_FIXUP_ZOTAC_Z68,
  7134. ALC662_FIXUP_INV_DMIC,
  7135. ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
  7136. ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
  7137. ALC662_FIXUP_HEADSET_MODE,
  7138. ALC668_FIXUP_HEADSET_MODE,
  7139. ALC662_FIXUP_BASS_MODE4_CHMAP,
  7140. ALC662_FIXUP_BASS_16,
  7141. ALC662_FIXUP_BASS_1A,
  7142. ALC662_FIXUP_BASS_CHMAP,
  7143. ALC668_FIXUP_AUTO_MUTE,
  7144. ALC668_FIXUP_DELL_DISABLE_AAMIX,
  7145. ALC668_FIXUP_DELL_XPS13,
  7146. ALC662_FIXUP_ASUS_Nx50,
  7147. ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
  7148. ALC668_FIXUP_ASUS_Nx51,
  7149. ALC668_FIXUP_MIC_COEF,
  7150. ALC668_FIXUP_ASUS_G751,
  7151. ALC891_FIXUP_HEADSET_MODE,
  7152. ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
  7153. ALC662_FIXUP_ACER_VERITON,
  7154. ALC892_FIXUP_ASROCK_MOBO,
  7155. ALC662_FIXUP_USI_FUNC,
  7156. ALC662_FIXUP_USI_HEADSET_MODE,
  7157. ALC662_FIXUP_LENOVO_MULTI_CODECS,
  7158. };
  7159. static const struct hda_fixup alc662_fixups[] = {
  7160. [ALC662_FIXUP_ASPIRE] = {
  7161. .type = HDA_FIXUP_PINS,
  7162. .v.pins = (const struct hda_pintbl[]) {
  7163. { 0x15, 0x99130112 }, /* subwoofer */
  7164. { }
  7165. }
  7166. },
  7167. [ALC662_FIXUP_LED_GPIO1] = {
  7168. .type = HDA_FIXUP_FUNC,
  7169. .v.func = alc662_fixup_led_gpio1,
  7170. },
  7171. [ALC662_FIXUP_IDEAPAD] = {
  7172. .type = HDA_FIXUP_PINS,
  7173. .v.pins = (const struct hda_pintbl[]) {
  7174. { 0x17, 0x99130112 }, /* subwoofer */
  7175. { }
  7176. },
  7177. .chained = true,
  7178. .chain_id = ALC662_FIXUP_LED_GPIO1,
  7179. },
  7180. [ALC272_FIXUP_MARIO] = {
  7181. .type = HDA_FIXUP_FUNC,
  7182. .v.func = alc272_fixup_mario,
  7183. },
  7184. [ALC662_FIXUP_CZC_P10T] = {
  7185. .type = HDA_FIXUP_VERBS,
  7186. .v.verbs = (const struct hda_verb[]) {
  7187. {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
  7188. {}
  7189. }
  7190. },
  7191. [ALC662_FIXUP_SKU_IGNORE] = {
  7192. .type = HDA_FIXUP_FUNC,
  7193. .v.func = alc_fixup_sku_ignore,
  7194. },
  7195. [ALC662_FIXUP_HP_RP5800] = {
  7196. .type = HDA_FIXUP_PINS,
  7197. .v.pins = (const struct hda_pintbl[]) {
  7198. { 0x14, 0x0221201f }, /* HP out */
  7199. { }
  7200. },
  7201. .chained = true,
  7202. .chain_id = ALC662_FIXUP_SKU_IGNORE
  7203. },
  7204. [ALC662_FIXUP_ASUS_MODE1] = {
  7205. .type = HDA_FIXUP_PINS,
  7206. .v.pins = (const struct hda_pintbl[]) {
  7207. { 0x14, 0x99130110 }, /* speaker */
  7208. { 0x18, 0x01a19c20 }, /* mic */
  7209. { 0x19, 0x99a3092f }, /* int-mic */
  7210. { 0x21, 0x0121401f }, /* HP out */
  7211. { }
  7212. },
  7213. .chained = true,
  7214. .chain_id = ALC662_FIXUP_SKU_IGNORE
  7215. },
  7216. [ALC662_FIXUP_ASUS_MODE2] = {
  7217. .type = HDA_FIXUP_PINS,
  7218. .v.pins = (const struct hda_pintbl[]) {
  7219. { 0x14, 0x99130110 }, /* speaker */
  7220. { 0x18, 0x01a19820 }, /* mic */
  7221. { 0x19, 0x99a3092f }, /* int-mic */
  7222. { 0x1b, 0x0121401f }, /* HP out */
  7223. { }
  7224. },
  7225. .chained = true,
  7226. .chain_id = ALC662_FIXUP_SKU_IGNORE
  7227. },
  7228. [ALC662_FIXUP_ASUS_MODE3] = {
  7229. .type = HDA_FIXUP_PINS,
  7230. .v.pins = (const struct hda_pintbl[]) {
  7231. { 0x14, 0x99130110 }, /* speaker */
  7232. { 0x15, 0x0121441f }, /* HP */
  7233. { 0x18, 0x01a19840 }, /* mic */
  7234. { 0x19, 0x99a3094f }, /* int-mic */
  7235. { 0x21, 0x01211420 }, /* HP2 */
  7236. { }
  7237. },
  7238. .chained = true,
  7239. .chain_id = ALC662_FIXUP_SKU_IGNORE
  7240. },
  7241. [ALC662_FIXUP_ASUS_MODE4] = {
  7242. .type = HDA_FIXUP_PINS,
  7243. .v.pins = (const struct hda_pintbl[]) {
  7244. { 0x14, 0x99130110 }, /* speaker */
  7245. { 0x16, 0x99130111 }, /* speaker */
  7246. { 0x18, 0x01a19840 }, /* mic */
  7247. { 0x19, 0x99a3094f }, /* int-mic */
  7248. { 0x21, 0x0121441f }, /* HP */
  7249. { }
  7250. },
  7251. .chained = true,
  7252. .chain_id = ALC662_FIXUP_SKU_IGNORE
  7253. },
  7254. [ALC662_FIXUP_ASUS_MODE5] = {
  7255. .type = HDA_FIXUP_PINS,
  7256. .v.pins = (const struct hda_pintbl[]) {
  7257. { 0x14, 0x99130110 }, /* speaker */
  7258. { 0x15, 0x0121441f }, /* HP */
  7259. { 0x16, 0x99130111 }, /* speaker */
  7260. { 0x18, 0x01a19840 }, /* mic */
  7261. { 0x19, 0x99a3094f }, /* int-mic */
  7262. { }
  7263. },
  7264. .chained = true,
  7265. .chain_id = ALC662_FIXUP_SKU_IGNORE
  7266. },
  7267. [ALC662_FIXUP_ASUS_MODE6] = {
  7268. .type = HDA_FIXUP_PINS,
  7269. .v.pins = (const struct hda_pintbl[]) {
  7270. { 0x14, 0x99130110 }, /* speaker */
  7271. { 0x15, 0x01211420 }, /* HP2 */
  7272. { 0x18, 0x01a19840 }, /* mic */
  7273. { 0x19, 0x99a3094f }, /* int-mic */
  7274. { 0x1b, 0x0121441f }, /* HP */
  7275. { }
  7276. },
  7277. .chained = true,
  7278. .chain_id = ALC662_FIXUP_SKU_IGNORE
  7279. },
  7280. [ALC662_FIXUP_ASUS_MODE7] = {
  7281. .type = HDA_FIXUP_PINS,
  7282. .v.pins = (const struct hda_pintbl[]) {
  7283. { 0x14, 0x99130110 }, /* speaker */
  7284. { 0x17, 0x99130111 }, /* speaker */
  7285. { 0x18, 0x01a19840 }, /* mic */
  7286. { 0x19, 0x99a3094f }, /* int-mic */
  7287. { 0x1b, 0x01214020 }, /* HP */
  7288. { 0x21, 0x0121401f }, /* HP */
  7289. { }
  7290. },
  7291. .chained = true,
  7292. .chain_id = ALC662_FIXUP_SKU_IGNORE
  7293. },
  7294. [ALC662_FIXUP_ASUS_MODE8] = {
  7295. .type = HDA_FIXUP_PINS,
  7296. .v.pins = (const struct hda_pintbl[]) {
  7297. { 0x14, 0x99130110 }, /* speaker */
  7298. { 0x12, 0x99a30970 }, /* int-mic */
  7299. { 0x15, 0x01214020 }, /* HP */
  7300. { 0x17, 0x99130111 }, /* speaker */
  7301. { 0x18, 0x01a19840 }, /* mic */
  7302. { 0x21, 0x0121401f }, /* HP */
  7303. { }
  7304. },
  7305. .chained = true,
  7306. .chain_id = ALC662_FIXUP_SKU_IGNORE
  7307. },
  7308. [ALC662_FIXUP_NO_JACK_DETECT] = {
  7309. .type = HDA_FIXUP_FUNC,
  7310. .v.func = alc_fixup_no_jack_detect,
  7311. },
  7312. [ALC662_FIXUP_ZOTAC_Z68] = {
  7313. .type = HDA_FIXUP_PINS,
  7314. .v.pins = (const struct hda_pintbl[]) {
  7315. { 0x1b, 0x02214020 }, /* Front HP */
  7316. { }
  7317. }
  7318. },
  7319. [ALC662_FIXUP_INV_DMIC] = {
  7320. .type = HDA_FIXUP_FUNC,
  7321. .v.func = alc_fixup_inv_dmic,
  7322. },
  7323. [ALC668_FIXUP_DELL_XPS13] = {
  7324. .type = HDA_FIXUP_FUNC,
  7325. .v.func = alc_fixup_dell_xps13,
  7326. .chained = true,
  7327. .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
  7328. },
  7329. [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
  7330. .type = HDA_FIXUP_FUNC,
  7331. .v.func = alc_fixup_disable_aamix,
  7332. .chained = true,
  7333. .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
  7334. },
  7335. [ALC668_FIXUP_AUTO_MUTE] = {
  7336. .type = HDA_FIXUP_FUNC,
  7337. .v.func = alc_fixup_auto_mute_via_amp,
  7338. .chained = true,
  7339. .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
  7340. },
  7341. [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
  7342. .type = HDA_FIXUP_PINS,
  7343. .v.pins = (const struct hda_pintbl[]) {
  7344. { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
  7345. /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
  7346. { }
  7347. },
  7348. .chained = true,
  7349. .chain_id = ALC662_FIXUP_HEADSET_MODE
  7350. },
  7351. [ALC662_FIXUP_HEADSET_MODE] = {
  7352. .type = HDA_FIXUP_FUNC,
  7353. .v.func = alc_fixup_headset_mode_alc662,
  7354. },
  7355. [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
  7356. .type = HDA_FIXUP_PINS,
  7357. .v.pins = (const struct hda_pintbl[]) {
  7358. { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
  7359. { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
  7360. { }
  7361. },
  7362. .chained = true,
  7363. .chain_id = ALC668_FIXUP_HEADSET_MODE
  7364. },
  7365. [ALC668_FIXUP_HEADSET_MODE] = {
  7366. .type = HDA_FIXUP_FUNC,
  7367. .v.func = alc_fixup_headset_mode_alc668,
  7368. },
  7369. [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
  7370. .type = HDA_FIXUP_FUNC,
  7371. .v.func = alc_fixup_bass_chmap,
  7372. .chained = true,
  7373. .chain_id = ALC662_FIXUP_ASUS_MODE4
  7374. },
  7375. [ALC662_FIXUP_BASS_16] = {
  7376. .type = HDA_FIXUP_PINS,
  7377. .v.pins = (const struct hda_pintbl[]) {
  7378. {0x16, 0x80106111}, /* bass speaker */
  7379. {}
  7380. },
  7381. .chained = true,
  7382. .chain_id = ALC662_FIXUP_BASS_CHMAP,
  7383. },
  7384. [ALC662_FIXUP_BASS_1A] = {
  7385. .type = HDA_FIXUP_PINS,
  7386. .v.pins = (const struct hda_pintbl[]) {
  7387. {0x1a, 0x80106111}, /* bass speaker */
  7388. {}
  7389. },
  7390. .chained = true,
  7391. .chain_id = ALC662_FIXUP_BASS_CHMAP,
  7392. },
  7393. [ALC662_FIXUP_BASS_CHMAP] = {
  7394. .type = HDA_FIXUP_FUNC,
  7395. .v.func = alc_fixup_bass_chmap,
  7396. },
  7397. [ALC662_FIXUP_ASUS_Nx50] = {
  7398. .type = HDA_FIXUP_FUNC,
  7399. .v.func = alc_fixup_auto_mute_via_amp,
  7400. .chained = true,
  7401. .chain_id = ALC662_FIXUP_BASS_1A
  7402. },
  7403. [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
  7404. .type = HDA_FIXUP_FUNC,
  7405. .v.func = alc_fixup_headset_mode_alc668,
  7406. .chain_id = ALC662_FIXUP_BASS_CHMAP
  7407. },
  7408. [ALC668_FIXUP_ASUS_Nx51] = {
  7409. .type = HDA_FIXUP_PINS,
  7410. .v.pins = (const struct hda_pintbl[]) {
  7411. { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
  7412. { 0x1a, 0x90170151 }, /* bass speaker */
  7413. { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
  7414. {}
  7415. },
  7416. .chained = true,
  7417. .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
  7418. },
  7419. [ALC668_FIXUP_MIC_COEF] = {
  7420. .type = HDA_FIXUP_VERBS,
  7421. .v.verbs = (const struct hda_verb[]) {
  7422. { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
  7423. { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
  7424. {}
  7425. },
  7426. },
  7427. [ALC668_FIXUP_ASUS_G751] = {
  7428. .type = HDA_FIXUP_PINS,
  7429. .v.pins = (const struct hda_pintbl[]) {
  7430. { 0x16, 0x0421101f }, /* HP */
  7431. {}
  7432. },
  7433. .chained = true,
  7434. .chain_id = ALC668_FIXUP_MIC_COEF
  7435. },
  7436. [ALC891_FIXUP_HEADSET_MODE] = {
  7437. .type = HDA_FIXUP_FUNC,
  7438. .v.func = alc_fixup_headset_mode,
  7439. },
  7440. [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
  7441. .type = HDA_FIXUP_PINS,
  7442. .v.pins = (const struct hda_pintbl[]) {
  7443. { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
  7444. { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
  7445. { }
  7446. },
  7447. .chained = true,
  7448. .chain_id = ALC891_FIXUP_HEADSET_MODE
  7449. },
  7450. [ALC662_FIXUP_ACER_VERITON] = {
  7451. .type = HDA_FIXUP_PINS,
  7452. .v.pins = (const struct hda_pintbl[]) {
  7453. { 0x15, 0x50170120 }, /* no internal speaker */
  7454. { }
  7455. }
  7456. },
  7457. [ALC892_FIXUP_ASROCK_MOBO] = {
  7458. .type = HDA_FIXUP_PINS,
  7459. .v.pins = (const struct hda_pintbl[]) {
  7460. { 0x15, 0x40f000f0 }, /* disabled */
  7461. { 0x16, 0x40f000f0 }, /* disabled */
  7462. { }
  7463. }
  7464. },
  7465. [ALC662_FIXUP_USI_FUNC] = {
  7466. .type = HDA_FIXUP_FUNC,
  7467. .v.func = alc662_fixup_usi_headset_mic,
  7468. },
  7469. [ALC662_FIXUP_USI_HEADSET_MODE] = {
  7470. .type = HDA_FIXUP_PINS,
  7471. .v.pins = (const struct hda_pintbl[]) {
  7472. { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
  7473. { 0x18, 0x01a1903d },
  7474. { }
  7475. },
  7476. .chained = true,
  7477. .chain_id = ALC662_FIXUP_USI_FUNC
  7478. },
  7479. [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
  7480. .type = HDA_FIXUP_FUNC,
  7481. .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
  7482. },
  7483. };
  7484. static const struct snd_pci_quirk alc662_fixup_tbl[] = {
  7485. SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
  7486. SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
  7487. SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
  7488. SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
  7489. SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
  7490. SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
  7491. SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
  7492. SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
  7493. SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
  7494. SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
  7495. SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
  7496. SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
  7497. SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
  7498. SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
  7499. SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
  7500. SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
  7501. SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
  7502. SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
  7503. SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
  7504. SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
  7505. SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
  7506. SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
  7507. SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
  7508. SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
  7509. SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
  7510. SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
  7511. SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
  7512. SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
  7513. SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
  7514. SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
  7515. SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
  7516. SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
  7517. SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
  7518. SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
  7519. SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
  7520. SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
  7521. SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
  7522. SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
  7523. SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
  7524. SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
  7525. SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
  7526. SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
  7527. #if 0
  7528. /* Below is a quirk table taken from the old code.
  7529. * Basically the device should work as is without the fixup table.
  7530. * If BIOS doesn't give a proper info, enable the corresponding
  7531. * fixup entry.
  7532. */
  7533. SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
  7534. SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
  7535. SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
  7536. SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
  7537. SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
  7538. SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
  7539. SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
  7540. SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
  7541. SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
  7542. SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
  7543. SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
  7544. SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
  7545. SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
  7546. SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
  7547. SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
  7548. SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
  7549. SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
  7550. SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
  7551. SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
  7552. SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
  7553. SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
  7554. SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
  7555. SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
  7556. SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
  7557. SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
  7558. SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
  7559. SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
  7560. SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
  7561. SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
  7562. SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
  7563. SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
  7564. SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
  7565. SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
  7566. SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
  7567. SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
  7568. SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
  7569. SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
  7570. SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
  7571. SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
  7572. SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
  7573. SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
  7574. SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
  7575. SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
  7576. SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
  7577. SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
  7578. SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
  7579. SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
  7580. SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
  7581. SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
  7582. SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
  7583. #endif
  7584. {}
  7585. };
  7586. static const struct hda_model_fixup alc662_fixup_models[] = {
  7587. {.id = ALC272_FIXUP_MARIO, .name = "mario"},
  7588. {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
  7589. {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
  7590. {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
  7591. {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
  7592. {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
  7593. {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
  7594. {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
  7595. {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
  7596. {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
  7597. {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
  7598. {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
  7599. {}
  7600. };
  7601. static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
  7602. SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
  7603. {0x17, 0x02211010},
  7604. {0x18, 0x01a19030},
  7605. {0x1a, 0x01813040},
  7606. {0x21, 0x01014020}),
  7607. SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
  7608. {0x16, 0x01813030},
  7609. {0x17, 0x02211010},
  7610. {0x18, 0x01a19040},
  7611. {0x21, 0x01014020}),
  7612. SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
  7613. {0x14, 0x01014010},
  7614. {0x18, 0x01a19020},
  7615. {0x1a, 0x0181302f},
  7616. {0x1b, 0x0221401f}),
  7617. SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
  7618. {0x12, 0x99a30130},
  7619. {0x14, 0x90170110},
  7620. {0x15, 0x0321101f},
  7621. {0x16, 0x03011020}),
  7622. SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
  7623. {0x12, 0x99a30140},
  7624. {0x14, 0x90170110},
  7625. {0x15, 0x0321101f},
  7626. {0x16, 0x03011020}),
  7627. SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
  7628. {0x12, 0x99a30150},
  7629. {0x14, 0x90170110},
  7630. {0x15, 0x0321101f},
  7631. {0x16, 0x03011020}),
  7632. SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
  7633. {0x14, 0x90170110},
  7634. {0x15, 0x0321101f},
  7635. {0x16, 0x03011020}),
  7636. SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
  7637. {0x12, 0x90a60130},
  7638. {0x14, 0x90170110},
  7639. {0x15, 0x0321101f}),
  7640. {}
  7641. };
  7642. /*
  7643. */
  7644. static int patch_alc662(struct hda_codec *codec)
  7645. {
  7646. struct alc_spec *spec;
  7647. int err;
  7648. err = alc_alloc_spec(codec, 0x0b);
  7649. if (err < 0)
  7650. return err;
  7651. spec = codec->spec;
  7652. spec->shutup = alc_eapd_shutup;
  7653. /* handle multiple HPs as is */
  7654. spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
  7655. alc_fix_pll_init(codec, 0x20, 0x04, 15);
  7656. switch (codec->core.vendor_id) {
  7657. case 0x10ec0668:
  7658. spec->init_hook = alc668_restore_default_value;
  7659. break;
  7660. }
  7661. snd_hda_pick_fixup(codec, alc662_fixup_models,
  7662. alc662_fixup_tbl, alc662_fixups);
  7663. snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups);
  7664. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  7665. alc_auto_parse_customize_define(codec);
  7666. if (has_cdefine_beep(codec))
  7667. spec->gen.beep_nid = 0x01;
  7668. if ((alc_get_coef0(codec) & (1 << 14)) &&
  7669. codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
  7670. spec->cdefine.platform_type == 1) {
  7671. err = alc_codec_rename(codec, "ALC272X");
  7672. if (err < 0)
  7673. goto error;
  7674. }
  7675. /* automatic parse from the BIOS config */
  7676. err = alc662_parse_auto_config(codec);
  7677. if (err < 0)
  7678. goto error;
  7679. if (!spec->gen.no_analog && spec->gen.beep_nid) {
  7680. switch (codec->core.vendor_id) {
  7681. case 0x10ec0662:
  7682. set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
  7683. break;
  7684. case 0x10ec0272:
  7685. case 0x10ec0663:
  7686. case 0x10ec0665:
  7687. case 0x10ec0668:
  7688. set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
  7689. break;
  7690. case 0x10ec0273:
  7691. set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
  7692. break;
  7693. }
  7694. }
  7695. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  7696. return 0;
  7697. error:
  7698. alc_free(codec);
  7699. return err;
  7700. }
  7701. /*
  7702. * ALC680 support
  7703. */
  7704. static int alc680_parse_auto_config(struct hda_codec *codec)
  7705. {
  7706. return alc_parse_auto_config(codec, NULL, NULL);
  7707. }
  7708. /*
  7709. */
  7710. static int patch_alc680(struct hda_codec *codec)
  7711. {
  7712. int err;
  7713. /* ALC680 has no aa-loopback mixer */
  7714. err = alc_alloc_spec(codec, 0);
  7715. if (err < 0)
  7716. return err;
  7717. /* automatic parse from the BIOS config */
  7718. err = alc680_parse_auto_config(codec);
  7719. if (err < 0) {
  7720. alc_free(codec);
  7721. return err;
  7722. }
  7723. return 0;
  7724. }
  7725. /*
  7726. * patch entries
  7727. */
  7728. static const struct hda_device_id snd_hda_id_realtek[] = {
  7729. HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
  7730. HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
  7731. HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
  7732. HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
  7733. HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
  7734. HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
  7735. HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
  7736. HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
  7737. HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
  7738. HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
  7739. HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
  7740. HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
  7741. HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
  7742. HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
  7743. HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
  7744. HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
  7745. HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
  7746. HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
  7747. HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
  7748. HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
  7749. HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
  7750. HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
  7751. HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
  7752. HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
  7753. HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
  7754. HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
  7755. HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
  7756. HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
  7757. HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
  7758. HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
  7759. HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
  7760. HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
  7761. HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
  7762. HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
  7763. HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
  7764. HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
  7765. HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
  7766. HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
  7767. HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
  7768. HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
  7769. HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
  7770. HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
  7771. HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
  7772. HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
  7773. HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
  7774. HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
  7775. HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
  7776. HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
  7777. HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
  7778. HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
  7779. HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
  7780. HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
  7781. HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
  7782. HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
  7783. HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
  7784. HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
  7785. HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
  7786. HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
  7787. HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
  7788. HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
  7789. HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
  7790. HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
  7791. HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
  7792. HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
  7793. HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
  7794. HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
  7795. HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
  7796. HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
  7797. HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
  7798. HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
  7799. HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
  7800. HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
  7801. HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
  7802. HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
  7803. HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
  7804. HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
  7805. HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
  7806. {} /* terminator */
  7807. };
  7808. MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
  7809. MODULE_LICENSE("GPL");
  7810. MODULE_DESCRIPTION("Realtek HD-audio codec");
  7811. static struct hda_codec_driver realtek_driver = {
  7812. .id = snd_hda_id_realtek,
  7813. };
  7814. module_hda_codec_driver(realtek_driver);