patch_sigmatel.c 119 KB

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