patch_sigmatel.c 119 KB

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