patch_sigmatel.c 135 KB

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