patch_sigmatel.c 133 KB

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