patch_sigmatel.c 114 KB

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