patch_sigmatel.c 119 KB

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