patch_sigmatel.c 119 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476
  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. codec->power_filter = snd_hda_codec_eapd_power_filter;
  3427. snd_hda_add_verbs(codec, stac9200_eapd_init);
  3428. snd_hda_pick_fixup(codec, stac9200_models, stac9200_fixup_tbl,
  3429. stac9200_fixups);
  3430. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  3431. err = stac_parse_auto_config(codec);
  3432. if (err < 0) {
  3433. stac_free(codec);
  3434. return err;
  3435. }
  3436. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  3437. return 0;
  3438. }
  3439. static int patch_stac925x(struct hda_codec *codec)
  3440. {
  3441. struct sigmatel_spec *spec;
  3442. int err;
  3443. err = alloc_stac_spec(codec);
  3444. if (err < 0)
  3445. return err;
  3446. spec = codec->spec;
  3447. spec->linear_tone_beep = 1;
  3448. spec->gen.own_eapd_ctl = 1;
  3449. codec->patch_ops = stac_patch_ops;
  3450. snd_hda_add_verbs(codec, stac925x_core_init);
  3451. snd_hda_pick_fixup(codec, stac925x_models, stac925x_fixup_tbl,
  3452. stac925x_fixups);
  3453. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  3454. err = stac_parse_auto_config(codec);
  3455. if (err < 0) {
  3456. stac_free(codec);
  3457. return err;
  3458. }
  3459. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  3460. return 0;
  3461. }
  3462. static int patch_stac92hd73xx(struct hda_codec *codec)
  3463. {
  3464. struct sigmatel_spec *spec;
  3465. int err;
  3466. int num_dacs;
  3467. err = alloc_stac_spec(codec);
  3468. if (err < 0)
  3469. return err;
  3470. spec = codec->spec;
  3471. spec->linear_tone_beep = 0;
  3472. spec->gen.mixer_nid = 0x1d;
  3473. spec->have_spdif_mux = 1;
  3474. num_dacs = snd_hda_get_num_conns(codec, 0x0a) - 1;
  3475. if (num_dacs < 3 || num_dacs > 5) {
  3476. printk(KERN_WARNING "hda_codec: Could not determine "
  3477. "number of channels defaulting to DAC count\n");
  3478. num_dacs = 5;
  3479. }
  3480. switch (num_dacs) {
  3481. case 0x3: /* 6 Channel */
  3482. spec->aloopback_ctl = &stac92hd73xx_6ch_loopback;
  3483. break;
  3484. case 0x4: /* 8 Channel */
  3485. spec->aloopback_ctl = &stac92hd73xx_8ch_loopback;
  3486. break;
  3487. case 0x5: /* 10 Channel */
  3488. spec->aloopback_ctl = &stac92hd73xx_10ch_loopback;
  3489. break;
  3490. }
  3491. spec->aloopback_mask = 0x01;
  3492. spec->aloopback_shift = 8;
  3493. spec->digbeep_nid = 0x1c;
  3494. /* GPIO0 High = Enable EAPD */
  3495. spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
  3496. spec->gpio_data = 0x01;
  3497. spec->eapd_switch = 1;
  3498. spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids);
  3499. spec->pwr_nids = stac92hd73xx_pwr_nids;
  3500. spec->gen.own_eapd_ctl = 1;
  3501. spec->gen.power_down_unused = 1;
  3502. codec->patch_ops = stac_patch_ops;
  3503. snd_hda_pick_fixup(codec, stac92hd73xx_models, stac92hd73xx_fixup_tbl,
  3504. stac92hd73xx_fixups);
  3505. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  3506. if (!spec->volknob_init)
  3507. snd_hda_add_verbs(codec, stac92hd73xx_core_init);
  3508. err = stac_parse_auto_config(codec);
  3509. if (err < 0) {
  3510. stac_free(codec);
  3511. return err;
  3512. }
  3513. /* Don't GPIO-mute speakers if there are no internal speakers, because
  3514. * the GPIO might be necessary for Headphone
  3515. */
  3516. if (spec->eapd_switch && !has_builtin_speaker(codec))
  3517. spec->eapd_switch = 0;
  3518. codec->proc_widget_hook = stac92hd7x_proc_hook;
  3519. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  3520. return 0;
  3521. }
  3522. static void stac_setup_gpio(struct hda_codec *codec)
  3523. {
  3524. struct sigmatel_spec *spec = codec->spec;
  3525. if (spec->gpio_led) {
  3526. if (!spec->vref_mute_led_nid) {
  3527. spec->gpio_mask |= spec->gpio_led;
  3528. spec->gpio_dir |= spec->gpio_led;
  3529. spec->gpio_data |= spec->gpio_led;
  3530. } else {
  3531. codec->patch_ops.set_power_state =
  3532. stac_set_power_state;
  3533. }
  3534. }
  3535. if (spec->mic_mute_led_gpio) {
  3536. spec->gpio_mask |= spec->mic_mute_led_gpio;
  3537. spec->gpio_dir |= spec->mic_mute_led_gpio;
  3538. spec->mic_mute_led_on = true;
  3539. spec->gpio_data |= spec->mic_mute_led_gpio;
  3540. spec->gen.cap_sync_hook = stac_capture_led_hook;
  3541. }
  3542. }
  3543. static int patch_stac92hd83xxx(struct hda_codec *codec)
  3544. {
  3545. struct sigmatel_spec *spec;
  3546. int err;
  3547. err = alloc_stac_spec(codec);
  3548. if (err < 0)
  3549. return err;
  3550. codec->epss = 0; /* longer delay needed for D3 */
  3551. spec = codec->spec;
  3552. spec->linear_tone_beep = 0;
  3553. spec->gen.own_eapd_ctl = 1;
  3554. spec->gen.power_down_unused = 1;
  3555. spec->gen.mixer_nid = 0x1b;
  3556. spec->digbeep_nid = 0x21;
  3557. spec->pwr_nids = stac92hd83xxx_pwr_nids;
  3558. spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids);
  3559. spec->default_polarity = -1; /* no default cfg */
  3560. codec->patch_ops = stac_patch_ops;
  3561. snd_hda_add_verbs(codec, stac92hd83xxx_core_init);
  3562. snd_hda_pick_fixup(codec, stac92hd83xxx_models, stac92hd83xxx_fixup_tbl,
  3563. stac92hd83xxx_fixups);
  3564. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  3565. stac_setup_gpio(codec);
  3566. err = stac_parse_auto_config(codec);
  3567. if (err < 0) {
  3568. stac_free(codec);
  3569. return err;
  3570. }
  3571. codec->proc_widget_hook = stac92hd_proc_hook;
  3572. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  3573. return 0;
  3574. }
  3575. static const hda_nid_t stac92hd95_pwr_nids[] = {
  3576. 0x0a, 0x0b, 0x0c, 0x0d
  3577. };
  3578. static int patch_stac92hd95(struct hda_codec *codec)
  3579. {
  3580. struct sigmatel_spec *spec;
  3581. int err;
  3582. err = alloc_stac_spec(codec);
  3583. if (err < 0)
  3584. return err;
  3585. codec->epss = 0; /* longer delay needed for D3 */
  3586. spec = codec->spec;
  3587. spec->linear_tone_beep = 0;
  3588. spec->gen.own_eapd_ctl = 1;
  3589. spec->gen.power_down_unused = 1;
  3590. spec->digbeep_nid = 0x19;
  3591. spec->pwr_nids = stac92hd95_pwr_nids;
  3592. spec->num_pwrs = ARRAY_SIZE(stac92hd95_pwr_nids);
  3593. spec->default_polarity = -1; /* no default cfg */
  3594. codec->patch_ops = stac_patch_ops;
  3595. err = stac_parse_auto_config(codec);
  3596. if (err < 0) {
  3597. stac_free(codec);
  3598. return err;
  3599. }
  3600. codec->proc_widget_hook = stac92hd_proc_hook;
  3601. return 0;
  3602. }
  3603. static int patch_stac92hd71bxx(struct hda_codec *codec)
  3604. {
  3605. struct sigmatel_spec *spec;
  3606. const struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init;
  3607. int err;
  3608. err = alloc_stac_spec(codec);
  3609. if (err < 0)
  3610. return err;
  3611. spec = codec->spec;
  3612. spec->linear_tone_beep = 0;
  3613. spec->gen.own_eapd_ctl = 1;
  3614. spec->gen.power_down_unused = 1;
  3615. spec->gen.mixer_nid = 0x17;
  3616. spec->have_spdif_mux = 1;
  3617. codec->patch_ops = stac_patch_ops;
  3618. /* GPIO0 = EAPD */
  3619. spec->gpio_mask = 0x01;
  3620. spec->gpio_dir = 0x01;
  3621. spec->gpio_data = 0x01;
  3622. switch (codec->vendor_id) {
  3623. case 0x111d76b6: /* 4 Port without Analog Mixer */
  3624. case 0x111d76b7:
  3625. unmute_init++;
  3626. break;
  3627. case 0x111d7608: /* 5 Port with Analog Mixer */
  3628. if ((codec->revision_id & 0xf) == 0 ||
  3629. (codec->revision_id & 0xf) == 1)
  3630. spec->stream_delay = 40; /* 40 milliseconds */
  3631. /* disable VSW */
  3632. unmute_init++;
  3633. snd_hda_codec_set_pincfg(codec, 0x0f, 0x40f000f0);
  3634. snd_hda_codec_set_pincfg(codec, 0x19, 0x40f000f3);
  3635. break;
  3636. case 0x111d7603: /* 6 Port with Analog Mixer */
  3637. if ((codec->revision_id & 0xf) == 1)
  3638. spec->stream_delay = 40; /* 40 milliseconds */
  3639. break;
  3640. }
  3641. if (get_wcaps_type(get_wcaps(codec, 0x28)) == AC_WID_VOL_KNB)
  3642. snd_hda_add_verbs(codec, stac92hd71bxx_core_init);
  3643. if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP)
  3644. snd_hda_sequence_write_cache(codec, unmute_init);
  3645. spec->aloopback_ctl = &stac92hd71bxx_loopback;
  3646. spec->aloopback_mask = 0x50;
  3647. spec->aloopback_shift = 0;
  3648. spec->powerdown_adcs = 1;
  3649. spec->digbeep_nid = 0x26;
  3650. spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids);
  3651. spec->pwr_nids = stac92hd71bxx_pwr_nids;
  3652. snd_hda_pick_fixup(codec, stac92hd71bxx_models, stac92hd71bxx_fixup_tbl,
  3653. stac92hd71bxx_fixups);
  3654. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  3655. stac_setup_gpio(codec);
  3656. err = stac_parse_auto_config(codec);
  3657. if (err < 0) {
  3658. stac_free(codec);
  3659. return err;
  3660. }
  3661. codec->proc_widget_hook = stac92hd7x_proc_hook;
  3662. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  3663. return 0;
  3664. }
  3665. static int patch_stac922x(struct hda_codec *codec)
  3666. {
  3667. struct sigmatel_spec *spec;
  3668. int err;
  3669. err = alloc_stac_spec(codec);
  3670. if (err < 0)
  3671. return err;
  3672. spec = codec->spec;
  3673. spec->linear_tone_beep = 1;
  3674. spec->gen.own_eapd_ctl = 1;
  3675. codec->patch_ops = stac_patch_ops;
  3676. snd_hda_add_verbs(codec, stac922x_core_init);
  3677. /* Fix Mux capture level; max to 2 */
  3678. snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
  3679. (0 << AC_AMPCAP_OFFSET_SHIFT) |
  3680. (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
  3681. (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
  3682. (0 << AC_AMPCAP_MUTE_SHIFT));
  3683. snd_hda_pick_fixup(codec, stac922x_models, stac922x_fixup_tbl,
  3684. stac922x_fixups);
  3685. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  3686. err = stac_parse_auto_config(codec);
  3687. if (err < 0) {
  3688. stac_free(codec);
  3689. return err;
  3690. }
  3691. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  3692. return 0;
  3693. }
  3694. static const char * const stac927x_spdif_labels[] = {
  3695. "Digital Playback", "ADAT", "Analog Mux 1",
  3696. "Analog Mux 2", "Analog Mux 3", NULL
  3697. };
  3698. static int patch_stac927x(struct hda_codec *codec)
  3699. {
  3700. struct sigmatel_spec *spec;
  3701. int err;
  3702. err = alloc_stac_spec(codec);
  3703. if (err < 0)
  3704. return err;
  3705. spec = codec->spec;
  3706. spec->linear_tone_beep = 1;
  3707. spec->gen.own_eapd_ctl = 1;
  3708. spec->have_spdif_mux = 1;
  3709. spec->spdif_labels = stac927x_spdif_labels;
  3710. spec->digbeep_nid = 0x23;
  3711. /* GPIO0 High = Enable EAPD */
  3712. spec->eapd_mask = spec->gpio_mask = 0x01;
  3713. spec->gpio_dir = spec->gpio_data = 0x01;
  3714. spec->aloopback_ctl = &stac927x_loopback;
  3715. spec->aloopback_mask = 0x40;
  3716. spec->aloopback_shift = 0;
  3717. spec->eapd_switch = 1;
  3718. codec->patch_ops = stac_patch_ops;
  3719. snd_hda_pick_fixup(codec, stac927x_models, stac927x_fixup_tbl,
  3720. stac927x_fixups);
  3721. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  3722. if (!spec->volknob_init)
  3723. snd_hda_add_verbs(codec, stac927x_core_init);
  3724. err = stac_parse_auto_config(codec);
  3725. if (err < 0) {
  3726. stac_free(codec);
  3727. return err;
  3728. }
  3729. codec->proc_widget_hook = stac927x_proc_hook;
  3730. /*
  3731. * !!FIXME!!
  3732. * The STAC927x seem to require fairly long delays for certain
  3733. * command sequences. With too short delays (even if the answer
  3734. * is set to RIRB properly), it results in the silence output
  3735. * on some hardwares like Dell.
  3736. *
  3737. * The below flag enables the longer delay (see get_response
  3738. * in hda_intel.c).
  3739. */
  3740. codec->bus->needs_damn_long_delay = 1;
  3741. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  3742. return 0;
  3743. }
  3744. static int patch_stac9205(struct hda_codec *codec)
  3745. {
  3746. struct sigmatel_spec *spec;
  3747. int err;
  3748. err = alloc_stac_spec(codec);
  3749. if (err < 0)
  3750. return err;
  3751. spec = codec->spec;
  3752. spec->linear_tone_beep = 1;
  3753. spec->gen.own_eapd_ctl = 1;
  3754. spec->have_spdif_mux = 1;
  3755. spec->digbeep_nid = 0x23;
  3756. snd_hda_add_verbs(codec, stac9205_core_init);
  3757. spec->aloopback_ctl = &stac9205_loopback;
  3758. spec->aloopback_mask = 0x40;
  3759. spec->aloopback_shift = 0;
  3760. /* GPIO0 High = EAPD */
  3761. spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
  3762. spec->gpio_data = 0x01;
  3763. /* Turn on/off EAPD per HP plugging */
  3764. spec->eapd_switch = 1;
  3765. codec->patch_ops = stac_patch_ops;
  3766. snd_hda_pick_fixup(codec, stac9205_models, stac9205_fixup_tbl,
  3767. stac9205_fixups);
  3768. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  3769. err = stac_parse_auto_config(codec);
  3770. if (err < 0) {
  3771. stac_free(codec);
  3772. return err;
  3773. }
  3774. codec->proc_widget_hook = stac9205_proc_hook;
  3775. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  3776. return 0;
  3777. }
  3778. /*
  3779. * STAC9872 hack
  3780. */
  3781. static const struct hda_verb stac9872_core_init[] = {
  3782. {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
  3783. {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
  3784. {}
  3785. };
  3786. static const struct hda_pintbl stac9872_vaio_pin_configs[] = {
  3787. { 0x0a, 0x03211020 },
  3788. { 0x0b, 0x411111f0 },
  3789. { 0x0c, 0x411111f0 },
  3790. { 0x0d, 0x03a15030 },
  3791. { 0x0e, 0x411111f0 },
  3792. { 0x0f, 0x90170110 },
  3793. { 0x11, 0x411111f0 },
  3794. { 0x13, 0x411111f0 },
  3795. { 0x14, 0x90a7013e },
  3796. {}
  3797. };
  3798. static const struct hda_model_fixup stac9872_models[] = {
  3799. { .id = STAC_9872_VAIO, .name = "vaio" },
  3800. {}
  3801. };
  3802. static const struct hda_fixup stac9872_fixups[] = {
  3803. [STAC_9872_VAIO] = {
  3804. .type = HDA_FIXUP_PINS,
  3805. .v.pins = stac9872_vaio_pin_configs,
  3806. },
  3807. };
  3808. static const struct snd_pci_quirk stac9872_fixup_tbl[] = {
  3809. SND_PCI_QUIRK_MASK(0x104d, 0xfff0, 0x81e0,
  3810. "Sony VAIO F/S", STAC_9872_VAIO),
  3811. {} /* terminator */
  3812. };
  3813. static int patch_stac9872(struct hda_codec *codec)
  3814. {
  3815. struct sigmatel_spec *spec;
  3816. int err;
  3817. err = alloc_stac_spec(codec);
  3818. if (err < 0)
  3819. return err;
  3820. spec = codec->spec;
  3821. spec->linear_tone_beep = 1;
  3822. spec->gen.own_eapd_ctl = 1;
  3823. codec->patch_ops = stac_patch_ops;
  3824. snd_hda_add_verbs(codec, stac9872_core_init);
  3825. snd_hda_pick_fixup(codec, stac9872_models, stac9872_fixup_tbl,
  3826. stac9872_fixups);
  3827. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  3828. err = stac_parse_auto_config(codec);
  3829. if (err < 0) {
  3830. stac_free(codec);
  3831. return -EINVAL;
  3832. }
  3833. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  3834. return 0;
  3835. }
  3836. /*
  3837. * patch entries
  3838. */
  3839. static const struct hda_codec_preset snd_hda_preset_sigmatel[] = {
  3840. { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 },
  3841. { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x },
  3842. { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x },
  3843. { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x },
  3844. { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x },
  3845. { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x },
  3846. { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x },
  3847. { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x },
  3848. { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x },
  3849. { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x },
  3850. { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x },
  3851. { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x },
  3852. { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x },
  3853. { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x },
  3854. { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x },
  3855. { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x },
  3856. { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x },
  3857. { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x },
  3858. { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x },
  3859. { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x },
  3860. { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x },
  3861. { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x },
  3862. { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x },
  3863. { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x },
  3864. { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x },
  3865. { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x },
  3866. { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x },
  3867. { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x },
  3868. { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x },
  3869. { .id = 0x83847645, .name = "92HD206X", .patch = patch_stac927x },
  3870. { .id = 0x83847646, .name = "92HD206D", .patch = patch_stac927x },
  3871. /* The following does not take into account .id=0x83847661 when subsys =
  3872. * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
  3873. * currently not fully supported.
  3874. */
  3875. { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 },
  3876. { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 },
  3877. { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 },
  3878. { .id = 0x83847698, .name = "STAC9205", .patch = patch_stac9205 },
  3879. { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 },
  3880. { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 },
  3881. { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 },
  3882. { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 },
  3883. { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 },
  3884. { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 },
  3885. { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 },
  3886. { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 },
  3887. { .id = 0x111d7603, .name = "92HD75B3X5", .patch = patch_stac92hd71bxx},
  3888. { .id = 0x111d7604, .name = "92HD83C1X5", .patch = patch_stac92hd83xxx},
  3889. { .id = 0x111d76d4, .name = "92HD83C1C5", .patch = patch_stac92hd83xxx},
  3890. { .id = 0x111d7605, .name = "92HD81B1X5", .patch = patch_stac92hd83xxx},
  3891. { .id = 0x111d76d5, .name = "92HD81B1C5", .patch = patch_stac92hd83xxx},
  3892. { .id = 0x111d76d1, .name = "92HD87B1/3", .patch = patch_stac92hd83xxx},
  3893. { .id = 0x111d76d9, .name = "92HD87B2/4", .patch = patch_stac92hd83xxx},
  3894. { .id = 0x111d7666, .name = "92HD88B3", .patch = patch_stac92hd83xxx},
  3895. { .id = 0x111d7667, .name = "92HD88B1", .patch = patch_stac92hd83xxx},
  3896. { .id = 0x111d7668, .name = "92HD88B2", .patch = patch_stac92hd83xxx},
  3897. { .id = 0x111d7669, .name = "92HD88B4", .patch = patch_stac92hd83xxx},
  3898. { .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx},
  3899. { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx },
  3900. { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx },
  3901. { .id = 0x111d7676, .name = "92HD73E1X5", .patch = patch_stac92hd73xx },
  3902. { .id = 0x111d7695, .name = "92HD95", .patch = patch_stac92hd95 },
  3903. { .id = 0x111d76b0, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
  3904. { .id = 0x111d76b1, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
  3905. { .id = 0x111d76b2, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
  3906. { .id = 0x111d76b3, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
  3907. { .id = 0x111d76b4, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
  3908. { .id = 0x111d76b5, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
  3909. { .id = 0x111d76b6, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
  3910. { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
  3911. { .id = 0x111d76c0, .name = "92HD89C3", .patch = patch_stac92hd73xx },
  3912. { .id = 0x111d76c1, .name = "92HD89C2", .patch = patch_stac92hd73xx },
  3913. { .id = 0x111d76c2, .name = "92HD89C1", .patch = patch_stac92hd73xx },
  3914. { .id = 0x111d76c3, .name = "92HD89B3", .patch = patch_stac92hd73xx },
  3915. { .id = 0x111d76c4, .name = "92HD89B2", .patch = patch_stac92hd73xx },
  3916. { .id = 0x111d76c5, .name = "92HD89B1", .patch = patch_stac92hd73xx },
  3917. { .id = 0x111d76c6, .name = "92HD89E3", .patch = patch_stac92hd73xx },
  3918. { .id = 0x111d76c7, .name = "92HD89E2", .patch = patch_stac92hd73xx },
  3919. { .id = 0x111d76c8, .name = "92HD89E1", .patch = patch_stac92hd73xx },
  3920. { .id = 0x111d76c9, .name = "92HD89D3", .patch = patch_stac92hd73xx },
  3921. { .id = 0x111d76ca, .name = "92HD89D2", .patch = patch_stac92hd73xx },
  3922. { .id = 0x111d76cb, .name = "92HD89D1", .patch = patch_stac92hd73xx },
  3923. { .id = 0x111d76cc, .name = "92HD89F3", .patch = patch_stac92hd73xx },
  3924. { .id = 0x111d76cd, .name = "92HD89F2", .patch = patch_stac92hd73xx },
  3925. { .id = 0x111d76ce, .name = "92HD89F1", .patch = patch_stac92hd73xx },
  3926. { .id = 0x111d76df, .name = "92HD93BXX", .patch = patch_stac92hd83xxx},
  3927. { .id = 0x111d76e0, .name = "92HD91BXX", .patch = patch_stac92hd83xxx},
  3928. { .id = 0x111d76e3, .name = "92HD98BXX", .patch = patch_stac92hd83xxx},
  3929. { .id = 0x111d76e5, .name = "92HD99BXX", .patch = patch_stac92hd83xxx},
  3930. { .id = 0x111d76e7, .name = "92HD90BXX", .patch = patch_stac92hd83xxx},
  3931. { .id = 0x111d76e8, .name = "92HD66B1X5", .patch = patch_stac92hd83xxx},
  3932. { .id = 0x111d76e9, .name = "92HD66B2X5", .patch = patch_stac92hd83xxx},
  3933. { .id = 0x111d76ea, .name = "92HD66B3X5", .patch = patch_stac92hd83xxx},
  3934. { .id = 0x111d76eb, .name = "92HD66C1X5", .patch = patch_stac92hd83xxx},
  3935. { .id = 0x111d76ec, .name = "92HD66C2X5", .patch = patch_stac92hd83xxx},
  3936. { .id = 0x111d76ed, .name = "92HD66C3X5", .patch = patch_stac92hd83xxx},
  3937. { .id = 0x111d76ee, .name = "92HD66B1X3", .patch = patch_stac92hd83xxx},
  3938. { .id = 0x111d76ef, .name = "92HD66B2X3", .patch = patch_stac92hd83xxx},
  3939. { .id = 0x111d76f0, .name = "92HD66B3X3", .patch = patch_stac92hd83xxx},
  3940. { .id = 0x111d76f1, .name = "92HD66C1X3", .patch = patch_stac92hd83xxx},
  3941. { .id = 0x111d76f2, .name = "92HD66C2X3", .patch = patch_stac92hd83xxx},
  3942. { .id = 0x111d76f3, .name = "92HD66C3/65", .patch = patch_stac92hd83xxx},
  3943. {} /* terminator */
  3944. };
  3945. MODULE_ALIAS("snd-hda-codec-id:8384*");
  3946. MODULE_ALIAS("snd-hda-codec-id:111d*");
  3947. MODULE_LICENSE("GPL");
  3948. MODULE_DESCRIPTION("IDT/Sigmatel HD-audio codec");
  3949. static struct hda_codec_preset_list sigmatel_list = {
  3950. .preset = snd_hda_preset_sigmatel,
  3951. .owner = THIS_MODULE,
  3952. };
  3953. static int __init patch_sigmatel_init(void)
  3954. {
  3955. return snd_hda_add_codec_preset(&sigmatel_list);
  3956. }
  3957. static void __exit patch_sigmatel_exit(void)
  3958. {
  3959. snd_hda_delete_codec_preset(&sigmatel_list);
  3960. }
  3961. module_init(patch_sigmatel_init)
  3962. module_exit(patch_sigmatel_exit)