patch_analog.c 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156
  1. /*
  2. * HD audio interface patch for AD1882, AD1884, AD1981HD, AD1983, AD1984,
  3. * AD1986A, AD1988
  4. *
  5. * Copyright (c) 2005-2007 Takashi Iwai <tiwai@suse.de>
  6. *
  7. * This driver is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This driver is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. */
  21. #include <linux/init.h>
  22. #include <linux/slab.h>
  23. #include <linux/pci.h>
  24. #include <linux/module.h>
  25. #include <sound/core.h>
  26. #include "hda_codec.h"
  27. #include "hda_local.h"
  28. #include "hda_auto_parser.h"
  29. #include "hda_beep.h"
  30. #include "hda_jack.h"
  31. #include "hda_generic.h"
  32. struct ad198x_spec {
  33. struct hda_gen_spec gen;
  34. /* for auto parser */
  35. int smux_paths[4];
  36. unsigned int cur_smux;
  37. hda_nid_t eapd_nid;
  38. unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
  39. };
  40. #ifdef CONFIG_SND_HDA_INPUT_BEEP
  41. /* additional beep mixers; the actual parameters are overwritten at build */
  42. static const struct snd_kcontrol_new ad_beep_mixer[] = {
  43. HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_OUTPUT),
  44. HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_OUTPUT),
  45. { } /* end */
  46. };
  47. #define set_beep_amp(spec, nid, idx, dir) \
  48. ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 1, idx, dir)) /* mono */
  49. #else
  50. #define set_beep_amp(spec, nid, idx, dir) /* NOP */
  51. #endif
  52. #ifdef CONFIG_SND_HDA_INPUT_BEEP
  53. static int create_beep_ctls(struct hda_codec *codec)
  54. {
  55. struct ad198x_spec *spec = codec->spec;
  56. const struct snd_kcontrol_new *knew;
  57. if (!spec->beep_amp)
  58. return 0;
  59. for (knew = ad_beep_mixer ; knew->name; knew++) {
  60. int err;
  61. struct snd_kcontrol *kctl;
  62. kctl = snd_ctl_new1(knew, codec);
  63. if (!kctl)
  64. return -ENOMEM;
  65. kctl->private_value = spec->beep_amp;
  66. err = snd_hda_ctl_add(codec, 0, kctl);
  67. if (err < 0)
  68. return err;
  69. }
  70. return 0;
  71. }
  72. #else
  73. #define create_beep_ctls(codec) 0
  74. #endif
  75. static void ad198x_power_eapd_write(struct hda_codec *codec, hda_nid_t front,
  76. hda_nid_t hp)
  77. {
  78. if (snd_hda_query_pin_caps(codec, front) & AC_PINCAP_EAPD)
  79. snd_hda_codec_write(codec, front, 0, AC_VERB_SET_EAPD_BTLENABLE,
  80. !codec->inv_eapd ? 0x00 : 0x02);
  81. if (snd_hda_query_pin_caps(codec, hp) & AC_PINCAP_EAPD)
  82. snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_EAPD_BTLENABLE,
  83. !codec->inv_eapd ? 0x00 : 0x02);
  84. }
  85. static void ad198x_power_eapd(struct hda_codec *codec)
  86. {
  87. /* We currently only handle front, HP */
  88. switch (codec->vendor_id) {
  89. case 0x11d41882:
  90. case 0x11d4882a:
  91. case 0x11d41884:
  92. case 0x11d41984:
  93. case 0x11d41883:
  94. case 0x11d4184a:
  95. case 0x11d4194a:
  96. case 0x11d4194b:
  97. case 0x11d41988:
  98. case 0x11d4198b:
  99. case 0x11d4989a:
  100. case 0x11d4989b:
  101. ad198x_power_eapd_write(codec, 0x12, 0x11);
  102. break;
  103. case 0x11d41981:
  104. case 0x11d41983:
  105. ad198x_power_eapd_write(codec, 0x05, 0x06);
  106. break;
  107. case 0x11d41986:
  108. ad198x_power_eapd_write(codec, 0x1b, 0x1a);
  109. break;
  110. }
  111. }
  112. static void ad198x_shutup(struct hda_codec *codec)
  113. {
  114. snd_hda_shutup_pins(codec);
  115. ad198x_power_eapd(codec);
  116. }
  117. #ifdef CONFIG_PM
  118. static int ad198x_suspend(struct hda_codec *codec)
  119. {
  120. ad198x_shutup(codec);
  121. return 0;
  122. }
  123. #endif
  124. /* follow EAPD via vmaster hook */
  125. static void ad_vmaster_eapd_hook(void *private_data, int enabled)
  126. {
  127. struct hda_codec *codec = private_data;
  128. struct ad198x_spec *spec = codec->spec;
  129. if (!spec->eapd_nid)
  130. return;
  131. snd_hda_codec_update_cache(codec, spec->eapd_nid, 0,
  132. AC_VERB_SET_EAPD_BTLENABLE,
  133. enabled ? 0x02 : 0x00);
  134. }
  135. /*
  136. * Automatic parse of I/O pins from the BIOS configuration
  137. */
  138. static int ad198x_auto_build_controls(struct hda_codec *codec)
  139. {
  140. int err;
  141. err = snd_hda_gen_build_controls(codec);
  142. if (err < 0)
  143. return err;
  144. err = create_beep_ctls(codec);
  145. if (err < 0)
  146. return err;
  147. return 0;
  148. }
  149. static const struct hda_codec_ops ad198x_auto_patch_ops = {
  150. .build_controls = ad198x_auto_build_controls,
  151. .build_pcms = snd_hda_gen_build_pcms,
  152. .init = snd_hda_gen_init,
  153. .free = snd_hda_gen_free,
  154. .unsol_event = snd_hda_jack_unsol_event,
  155. #ifdef CONFIG_PM
  156. .check_power_status = snd_hda_gen_check_power_status,
  157. .suspend = ad198x_suspend,
  158. #endif
  159. .reboot_notify = ad198x_shutup,
  160. };
  161. static int ad198x_parse_auto_config(struct hda_codec *codec)
  162. {
  163. struct ad198x_spec *spec = codec->spec;
  164. struct auto_pin_cfg *cfg = &spec->gen.autocfg;
  165. int err;
  166. codec->spdif_status_reset = 1;
  167. codec->no_trigger_sense = 1;
  168. codec->no_sticky_stream = 1;
  169. spec->gen.indep_hp = 1;
  170. err = snd_hda_parse_pin_defcfg(codec, cfg, NULL, 0);
  171. if (err < 0)
  172. return err;
  173. err = snd_hda_gen_parse_auto_config(codec, cfg);
  174. if (err < 0)
  175. return err;
  176. codec->patch_ops = ad198x_auto_patch_ops;
  177. return 0;
  178. }
  179. /*
  180. * AD1986A specific
  181. */
  182. static int alloc_ad_spec(struct hda_codec *codec)
  183. {
  184. struct ad198x_spec *spec;
  185. spec = kzalloc(sizeof(*spec), GFP_KERNEL);
  186. if (!spec)
  187. return -ENOMEM;
  188. codec->spec = spec;
  189. snd_hda_gen_spec_init(&spec->gen);
  190. return 0;
  191. }
  192. /*
  193. * AD1986A fixup codes
  194. */
  195. /* Lenovo N100 seems to report the reversed bit for HP jack-sensing */
  196. static void ad_fixup_inv_jack_detect(struct hda_codec *codec,
  197. const struct hda_fixup *fix, int action)
  198. {
  199. struct ad198x_spec *spec = codec->spec;
  200. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  201. codec->inv_jack_detect = 1;
  202. spec->gen.keep_eapd_on = 1;
  203. spec->gen.vmaster_mute.hook = ad_vmaster_eapd_hook;
  204. spec->eapd_nid = 0x1b;
  205. }
  206. }
  207. enum {
  208. AD1986A_FIXUP_INV_JACK_DETECT,
  209. AD1986A_FIXUP_ULTRA,
  210. AD1986A_FIXUP_SAMSUNG,
  211. AD1986A_FIXUP_3STACK,
  212. AD1986A_FIXUP_LAPTOP,
  213. AD1986A_FIXUP_LAPTOP_IMIC,
  214. };
  215. static const struct hda_fixup ad1986a_fixups[] = {
  216. [AD1986A_FIXUP_INV_JACK_DETECT] = {
  217. .type = HDA_FIXUP_FUNC,
  218. .v.func = ad_fixup_inv_jack_detect,
  219. },
  220. [AD1986A_FIXUP_ULTRA] = {
  221. .type = HDA_FIXUP_PINS,
  222. .v.pins = (const struct hda_pintbl[]) {
  223. { 0x1b, 0x90170110 }, /* speaker */
  224. { 0x1d, 0x90a7013e }, /* int mic */
  225. {}
  226. },
  227. },
  228. [AD1986A_FIXUP_SAMSUNG] = {
  229. .type = HDA_FIXUP_PINS,
  230. .v.pins = (const struct hda_pintbl[]) {
  231. { 0x1b, 0x90170110 }, /* speaker */
  232. { 0x1d, 0x90a7013e }, /* int mic */
  233. { 0x20, 0x411111f0 }, /* N/A */
  234. { 0x24, 0x411111f0 }, /* N/A */
  235. {}
  236. },
  237. },
  238. [AD1986A_FIXUP_3STACK] = {
  239. .type = HDA_FIXUP_PINS,
  240. .v.pins = (const struct hda_pintbl[]) {
  241. { 0x1a, 0x02214021 }, /* headphone */
  242. { 0x1b, 0x01014011 }, /* front */
  243. { 0x1c, 0x01013012 }, /* surround */
  244. { 0x1d, 0x01019015 }, /* clfe */
  245. { 0x1e, 0x411111f0 }, /* N/A */
  246. { 0x1f, 0x02a190f0 }, /* mic */
  247. { 0x20, 0x018130f0 }, /* line-in */
  248. {}
  249. },
  250. },
  251. [AD1986A_FIXUP_LAPTOP] = {
  252. .type = HDA_FIXUP_PINS,
  253. .v.pins = (const struct hda_pintbl[]) {
  254. { 0x1a, 0x02214021 }, /* headphone */
  255. { 0x1b, 0x90170110 }, /* speaker */
  256. { 0x1c, 0x411111f0 }, /* N/A */
  257. { 0x1d, 0x411111f0 }, /* N/A */
  258. { 0x1e, 0x411111f0 }, /* N/A */
  259. { 0x1f, 0x02a191f0 }, /* mic */
  260. { 0x20, 0x411111f0 }, /* N/A */
  261. {}
  262. },
  263. },
  264. [AD1986A_FIXUP_LAPTOP_IMIC] = {
  265. .type = HDA_FIXUP_PINS,
  266. .v.pins = (const struct hda_pintbl[]) {
  267. { 0x1d, 0x90a7013e }, /* int mic */
  268. {}
  269. },
  270. .chained_before = 1,
  271. .chain_id = AD1986A_FIXUP_LAPTOP,
  272. },
  273. };
  274. static const struct snd_pci_quirk ad1986a_fixup_tbl[] = {
  275. SND_PCI_QUIRK(0x103c, 0x30af, "HP B2800", AD1986A_FIXUP_LAPTOP_IMIC),
  276. SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8100, "ASUS P5", AD1986A_FIXUP_3STACK),
  277. SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8200, "ASUS M2", AD1986A_FIXUP_3STACK),
  278. SND_PCI_QUIRK(0x10de, 0xcb84, "ASUS A8N-VM", AD1986A_FIXUP_3STACK),
  279. SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_FIXUP_LAPTOP),
  280. SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc000, "Samsung", AD1986A_FIXUP_SAMSUNG),
  281. SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_FIXUP_ULTRA),
  282. SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo N100", AD1986A_FIXUP_INV_JACK_DETECT),
  283. SND_PCI_QUIRK(0x17aa, 0x1011, "Lenovo M55", AD1986A_FIXUP_3STACK),
  284. SND_PCI_QUIRK(0x17aa, 0x1017, "Lenovo A60", AD1986A_FIXUP_3STACK),
  285. {}
  286. };
  287. static const struct hda_model_fixup ad1986a_fixup_models[] = {
  288. { .id = AD1986A_FIXUP_3STACK, .name = "3stack" },
  289. { .id = AD1986A_FIXUP_LAPTOP, .name = "laptop" },
  290. { .id = AD1986A_FIXUP_LAPTOP_IMIC, .name = "laptop-imic" },
  291. { .id = AD1986A_FIXUP_LAPTOP_IMIC, .name = "laptop-eapd" }, /* alias */
  292. {}
  293. };
  294. /*
  295. */
  296. static int patch_ad1986a(struct hda_codec *codec)
  297. {
  298. int err;
  299. struct ad198x_spec *spec;
  300. err = alloc_ad_spec(codec);
  301. if (err < 0)
  302. return err;
  303. spec = codec->spec;
  304. /* AD1986A has the inverted EAPD implementation */
  305. codec->inv_eapd = 1;
  306. spec->gen.mixer_nid = 0x07;
  307. spec->gen.beep_nid = 0x19;
  308. set_beep_amp(spec, 0x18, 0, HDA_OUTPUT);
  309. /* AD1986A has a hardware problem that it can't share a stream
  310. * with multiple output pins. The copy of front to surrounds
  311. * causes noisy or silent outputs at a certain timing, e.g.
  312. * changing the volume.
  313. * So, let's disable the shared stream.
  314. */
  315. spec->gen.multiout.no_share_stream = 1;
  316. snd_hda_pick_fixup(codec, ad1986a_fixup_models, ad1986a_fixup_tbl,
  317. ad1986a_fixups);
  318. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  319. err = ad198x_parse_auto_config(codec);
  320. if (err < 0) {
  321. snd_hda_gen_free(codec);
  322. return err;
  323. }
  324. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  325. return 0;
  326. }
  327. /*
  328. * AD1983 specific
  329. */
  330. /*
  331. * SPDIF mux control for AD1983 auto-parser
  332. */
  333. static int ad1983_auto_smux_enum_info(struct snd_kcontrol *kcontrol,
  334. struct snd_ctl_elem_info *uinfo)
  335. {
  336. struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  337. struct ad198x_spec *spec = codec->spec;
  338. static const char * const texts2[] = { "PCM", "ADC" };
  339. static const char * const texts3[] = { "PCM", "ADC1", "ADC2" };
  340. hda_nid_t dig_out = spec->gen.multiout.dig_out_nid;
  341. int num_conns = snd_hda_get_num_conns(codec, dig_out);
  342. if (num_conns == 2)
  343. return snd_hda_enum_helper_info(kcontrol, uinfo, 2, texts2);
  344. else if (num_conns == 3)
  345. return snd_hda_enum_helper_info(kcontrol, uinfo, 3, texts3);
  346. else
  347. return -EINVAL;
  348. }
  349. static int ad1983_auto_smux_enum_get(struct snd_kcontrol *kcontrol,
  350. struct snd_ctl_elem_value *ucontrol)
  351. {
  352. struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  353. struct ad198x_spec *spec = codec->spec;
  354. ucontrol->value.enumerated.item[0] = spec->cur_smux;
  355. return 0;
  356. }
  357. static int ad1983_auto_smux_enum_put(struct snd_kcontrol *kcontrol,
  358. struct snd_ctl_elem_value *ucontrol)
  359. {
  360. struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  361. struct ad198x_spec *spec = codec->spec;
  362. unsigned int val = ucontrol->value.enumerated.item[0];
  363. hda_nid_t dig_out = spec->gen.multiout.dig_out_nid;
  364. int num_conns = snd_hda_get_num_conns(codec, dig_out);
  365. if (val >= num_conns)
  366. return -EINVAL;
  367. if (spec->cur_smux == val)
  368. return 0;
  369. spec->cur_smux = val;
  370. snd_hda_codec_write_cache(codec, dig_out, 0,
  371. AC_VERB_SET_CONNECT_SEL, val);
  372. return 1;
  373. }
  374. static struct snd_kcontrol_new ad1983_auto_smux_mixer = {
  375. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  376. .name = "IEC958 Playback Source",
  377. .info = ad1983_auto_smux_enum_info,
  378. .get = ad1983_auto_smux_enum_get,
  379. .put = ad1983_auto_smux_enum_put,
  380. };
  381. static int ad1983_add_spdif_mux_ctl(struct hda_codec *codec)
  382. {
  383. struct ad198x_spec *spec = codec->spec;
  384. hda_nid_t dig_out = spec->gen.multiout.dig_out_nid;
  385. int num_conns;
  386. if (!dig_out)
  387. return 0;
  388. num_conns = snd_hda_get_num_conns(codec, dig_out);
  389. if (num_conns != 2 && num_conns != 3)
  390. return 0;
  391. if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &ad1983_auto_smux_mixer))
  392. return -ENOMEM;
  393. return 0;
  394. }
  395. static int patch_ad1983(struct hda_codec *codec)
  396. {
  397. struct ad198x_spec *spec;
  398. int err;
  399. err = alloc_ad_spec(codec);
  400. if (err < 0)
  401. return err;
  402. spec = codec->spec;
  403. spec->gen.beep_nid = 0x10;
  404. set_beep_amp(spec, 0x10, 0, HDA_OUTPUT);
  405. err = ad198x_parse_auto_config(codec);
  406. if (err < 0)
  407. goto error;
  408. err = ad1983_add_spdif_mux_ctl(codec);
  409. if (err < 0)
  410. goto error;
  411. return 0;
  412. error:
  413. snd_hda_gen_free(codec);
  414. return err;
  415. }
  416. /*
  417. * AD1981 HD specific
  418. */
  419. static void ad1981_fixup_hp_eapd(struct hda_codec *codec,
  420. const struct hda_fixup *fix, int action)
  421. {
  422. struct ad198x_spec *spec = codec->spec;
  423. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  424. spec->gen.vmaster_mute.hook = ad_vmaster_eapd_hook;
  425. spec->eapd_nid = 0x05;
  426. }
  427. }
  428. /* set the upper-limit for mixer amp to 0dB for avoiding the possible
  429. * damage by overloading
  430. */
  431. static void ad1981_fixup_amp_override(struct hda_codec *codec,
  432. const struct hda_fixup *fix, int action)
  433. {
  434. if (action == HDA_FIXUP_ACT_PRE_PROBE)
  435. snd_hda_override_amp_caps(codec, 0x11, HDA_INPUT,
  436. (0x17 << AC_AMPCAP_OFFSET_SHIFT) |
  437. (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) |
  438. (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) |
  439. (1 << AC_AMPCAP_MUTE_SHIFT));
  440. }
  441. enum {
  442. AD1981_FIXUP_AMP_OVERRIDE,
  443. AD1981_FIXUP_HP_EAPD,
  444. };
  445. static const struct hda_fixup ad1981_fixups[] = {
  446. [AD1981_FIXUP_AMP_OVERRIDE] = {
  447. .type = HDA_FIXUP_FUNC,
  448. .v.func = ad1981_fixup_amp_override,
  449. },
  450. [AD1981_FIXUP_HP_EAPD] = {
  451. .type = HDA_FIXUP_FUNC,
  452. .v.func = ad1981_fixup_hp_eapd,
  453. .chained = true,
  454. .chain_id = AD1981_FIXUP_AMP_OVERRIDE,
  455. },
  456. };
  457. static const struct snd_pci_quirk ad1981_fixup_tbl[] = {
  458. SND_PCI_QUIRK_VENDOR(0x1014, "Lenovo", AD1981_FIXUP_AMP_OVERRIDE),
  459. SND_PCI_QUIRK_VENDOR(0x103c, "HP", AD1981_FIXUP_HP_EAPD),
  460. SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", AD1981_FIXUP_AMP_OVERRIDE),
  461. /* HP nx6320 (reversed SSID, H/W bug) */
  462. SND_PCI_QUIRK(0x30b0, 0x103c, "HP nx6320", AD1981_FIXUP_HP_EAPD),
  463. {}
  464. };
  465. static int patch_ad1981(struct hda_codec *codec)
  466. {
  467. struct ad198x_spec *spec;
  468. int err;
  469. err = alloc_ad_spec(codec);
  470. if (err < 0)
  471. return -ENOMEM;
  472. spec = codec->spec;
  473. spec->gen.mixer_nid = 0x0e;
  474. spec->gen.beep_nid = 0x10;
  475. set_beep_amp(spec, 0x0d, 0, HDA_OUTPUT);
  476. snd_hda_pick_fixup(codec, NULL, ad1981_fixup_tbl, ad1981_fixups);
  477. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  478. err = ad198x_parse_auto_config(codec);
  479. if (err < 0)
  480. goto error;
  481. err = ad1983_add_spdif_mux_ctl(codec);
  482. if (err < 0)
  483. goto error;
  484. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  485. return 0;
  486. error:
  487. snd_hda_gen_free(codec);
  488. return err;
  489. }
  490. /*
  491. * AD1988
  492. *
  493. * Output pins and routes
  494. *
  495. * Pin Mix Sel DAC (*)
  496. * port-A 0x11 (mute/hp) <- 0x22 <- 0x37 <- 03/04/06
  497. * port-B 0x14 (mute/hp) <- 0x2b <- 0x30 <- 03/04/06
  498. * port-C 0x15 (mute) <- 0x2c <- 0x31 <- 05/0a
  499. * port-D 0x12 (mute/hp) <- 0x29 <- 04
  500. * port-E 0x17 (mute/hp) <- 0x26 <- 0x32 <- 05/0a
  501. * port-F 0x16 (mute) <- 0x2a <- 06
  502. * port-G 0x24 (mute) <- 0x27 <- 05
  503. * port-H 0x25 (mute) <- 0x28 <- 0a
  504. * mono 0x13 (mute/amp)<- 0x1e <- 0x36 <- 03/04/06
  505. *
  506. * DAC0 = 03h, DAC1 = 04h, DAC2 = 05h, DAC3 = 06h, DAC4 = 0ah
  507. * (*) DAC2/3/4 are swapped to DAC3/4/2 on AD198A rev.2 due to a h/w bug.
  508. *
  509. * Input pins and routes
  510. *
  511. * pin boost mix input # / adc input #
  512. * port-A 0x11 -> 0x38 -> mix 2, ADC 0
  513. * port-B 0x14 -> 0x39 -> mix 0, ADC 1
  514. * port-C 0x15 -> 0x3a -> 33:0 - mix 1, ADC 2
  515. * port-D 0x12 -> 0x3d -> mix 3, ADC 8
  516. * port-E 0x17 -> 0x3c -> 34:0 - mix 4, ADC 4
  517. * port-F 0x16 -> 0x3b -> mix 5, ADC 3
  518. * port-G 0x24 -> N/A -> 33:1 - mix 1, 34:1 - mix 4, ADC 6
  519. * port-H 0x25 -> N/A -> 33:2 - mix 1, 34:2 - mix 4, ADC 7
  520. *
  521. *
  522. * DAC assignment
  523. * 6stack - front/surr/CLFE/side/opt DACs - 04/06/05/0a/03
  524. * 3stack - front/surr/CLFE/opt DACs - 04/05/0a/03
  525. *
  526. * Inputs of Analog Mix (0x20)
  527. * 0:Port-B (front mic)
  528. * 1:Port-C/G/H (line-in)
  529. * 2:Port-A
  530. * 3:Port-D (line-in/2)
  531. * 4:Port-E/G/H (mic-in)
  532. * 5:Port-F (mic2-in)
  533. * 6:CD
  534. * 7:Beep
  535. *
  536. * ADC selection
  537. * 0:Port-A
  538. * 1:Port-B (front mic-in)
  539. * 2:Port-C (line-in)
  540. * 3:Port-F (mic2-in)
  541. * 4:Port-E (mic-in)
  542. * 5:CD
  543. * 6:Port-G
  544. * 7:Port-H
  545. * 8:Port-D (line-in/2)
  546. * 9:Mix
  547. *
  548. * Proposed pin assignments by the datasheet
  549. *
  550. * 6-stack
  551. * Port-A front headphone
  552. * B front mic-in
  553. * C rear line-in
  554. * D rear front-out
  555. * E rear mic-in
  556. * F rear surround
  557. * G rear CLFE
  558. * H rear side
  559. *
  560. * 3-stack
  561. * Port-A front headphone
  562. * B front mic
  563. * C rear line-in/surround
  564. * D rear front-out
  565. * E rear mic-in/CLFE
  566. *
  567. * laptop
  568. * Port-A headphone
  569. * B mic-in
  570. * C docking station
  571. * D internal speaker (with EAPD)
  572. * E/F quad mic array
  573. */
  574. #ifdef ENABLE_AD_STATIC_QUIRKS
  575. static int ad198x_ch_mode_info(struct snd_kcontrol *kcontrol,
  576. struct snd_ctl_elem_info *uinfo)
  577. {
  578. struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  579. struct ad198x_spec *spec = codec->spec;
  580. return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
  581. spec->num_channel_mode);
  582. }
  583. static int ad198x_ch_mode_get(struct snd_kcontrol *kcontrol,
  584. struct snd_ctl_elem_value *ucontrol)
  585. {
  586. struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  587. struct ad198x_spec *spec = codec->spec;
  588. return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
  589. spec->num_channel_mode, spec->multiout.max_channels);
  590. }
  591. static int ad198x_ch_mode_put(struct snd_kcontrol *kcontrol,
  592. struct snd_ctl_elem_value *ucontrol)
  593. {
  594. struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  595. struct ad198x_spec *spec = codec->spec;
  596. int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
  597. spec->num_channel_mode,
  598. &spec->multiout.max_channels);
  599. if (err >= 0 && spec->need_dac_fix)
  600. spec->multiout.num_dacs = spec->multiout.max_channels / 2;
  601. return err;
  602. }
  603. #endif /* ENABLE_AD_STATIC_QUIRKS */
  604. static int ad1988_auto_smux_enum_info(struct snd_kcontrol *kcontrol,
  605. struct snd_ctl_elem_info *uinfo)
  606. {
  607. struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  608. static const char * const texts[] = {
  609. "PCM", "ADC1", "ADC2", "ADC3",
  610. };
  611. int num_conns = snd_hda_get_num_conns(codec, 0x0b) + 1;
  612. if (num_conns > 4)
  613. num_conns = 4;
  614. return snd_hda_enum_helper_info(kcontrol, uinfo, num_conns, texts);
  615. }
  616. static int ad1988_auto_smux_enum_get(struct snd_kcontrol *kcontrol,
  617. struct snd_ctl_elem_value *ucontrol)
  618. {
  619. struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  620. struct ad198x_spec *spec = codec->spec;
  621. ucontrol->value.enumerated.item[0] = spec->cur_smux;
  622. return 0;
  623. }
  624. static int ad1988_auto_smux_enum_put(struct snd_kcontrol *kcontrol,
  625. struct snd_ctl_elem_value *ucontrol)
  626. {
  627. struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  628. struct ad198x_spec *spec = codec->spec;
  629. unsigned int val = ucontrol->value.enumerated.item[0];
  630. struct nid_path *path;
  631. int num_conns = snd_hda_get_num_conns(codec, 0x0b) + 1;
  632. if (val >= num_conns)
  633. return -EINVAL;
  634. if (spec->cur_smux == val)
  635. return 0;
  636. mutex_lock(&codec->control_mutex);
  637. codec->cached_write = 1;
  638. path = snd_hda_get_path_from_idx(codec,
  639. spec->smux_paths[spec->cur_smux]);
  640. if (path)
  641. snd_hda_activate_path(codec, path, false, true);
  642. path = snd_hda_get_path_from_idx(codec, spec->smux_paths[val]);
  643. if (path)
  644. snd_hda_activate_path(codec, path, true, true);
  645. spec->cur_smux = val;
  646. codec->cached_write = 0;
  647. mutex_unlock(&codec->control_mutex);
  648. snd_hda_codec_flush_cache(codec); /* flush the updates */
  649. return 1;
  650. }
  651. static struct snd_kcontrol_new ad1988_auto_smux_mixer = {
  652. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  653. .name = "IEC958 Playback Source",
  654. .info = ad1988_auto_smux_enum_info,
  655. .get = ad1988_auto_smux_enum_get,
  656. .put = ad1988_auto_smux_enum_put,
  657. };
  658. static int ad1988_auto_init(struct hda_codec *codec)
  659. {
  660. struct ad198x_spec *spec = codec->spec;
  661. int i, err;
  662. err = snd_hda_gen_init(codec);
  663. if (err < 0)
  664. return err;
  665. if (!spec->gen.autocfg.dig_outs)
  666. return 0;
  667. for (i = 0; i < 4; i++) {
  668. struct nid_path *path;
  669. path = snd_hda_get_path_from_idx(codec, spec->smux_paths[i]);
  670. if (path)
  671. snd_hda_activate_path(codec, path, path->active, false);
  672. }
  673. return 0;
  674. }
  675. static int ad1988_add_spdif_mux_ctl(struct hda_codec *codec)
  676. {
  677. struct ad198x_spec *spec = codec->spec;
  678. int i, num_conns;
  679. /* we create four static faked paths, since AD codecs have odd
  680. * widget connections regarding the SPDIF out source
  681. */
  682. static struct nid_path fake_paths[4] = {
  683. {
  684. .depth = 3,
  685. .path = { 0x02, 0x1d, 0x1b },
  686. .idx = { 0, 0, 0 },
  687. .multi = { 0, 0, 0 },
  688. },
  689. {
  690. .depth = 4,
  691. .path = { 0x08, 0x0b, 0x1d, 0x1b },
  692. .idx = { 0, 0, 1, 0 },
  693. .multi = { 0, 1, 0, 0 },
  694. },
  695. {
  696. .depth = 4,
  697. .path = { 0x09, 0x0b, 0x1d, 0x1b },
  698. .idx = { 0, 1, 1, 0 },
  699. .multi = { 0, 1, 0, 0 },
  700. },
  701. {
  702. .depth = 4,
  703. .path = { 0x0f, 0x0b, 0x1d, 0x1b },
  704. .idx = { 0, 2, 1, 0 },
  705. .multi = { 0, 1, 0, 0 },
  706. },
  707. };
  708. /* SPDIF source mux appears to be present only on AD1988A */
  709. if (!spec->gen.autocfg.dig_outs ||
  710. get_wcaps_type(get_wcaps(codec, 0x1d)) != AC_WID_AUD_MIX)
  711. return 0;
  712. num_conns = snd_hda_get_num_conns(codec, 0x0b) + 1;
  713. if (num_conns != 3 && num_conns != 4)
  714. return 0;
  715. for (i = 0; i < num_conns; i++) {
  716. struct nid_path *path = snd_array_new(&spec->gen.paths);
  717. if (!path)
  718. return -ENOMEM;
  719. *path = fake_paths[i];
  720. if (!i)
  721. path->active = 1;
  722. spec->smux_paths[i] = snd_hda_get_path_idx(codec, path);
  723. }
  724. if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &ad1988_auto_smux_mixer))
  725. return -ENOMEM;
  726. codec->patch_ops.init = ad1988_auto_init;
  727. return 0;
  728. }
  729. /*
  730. */
  731. enum {
  732. AD1988_FIXUP_6STACK_DIG,
  733. };
  734. static const struct hda_fixup ad1988_fixups[] = {
  735. [AD1988_FIXUP_6STACK_DIG] = {
  736. .type = HDA_FIXUP_PINS,
  737. .v.pins = (const struct hda_pintbl[]) {
  738. { 0x11, 0x02214130 }, /* front-hp */
  739. { 0x12, 0x01014010 }, /* line-out */
  740. { 0x14, 0x02a19122 }, /* front-mic */
  741. { 0x15, 0x01813021 }, /* line-in */
  742. { 0x16, 0x01011012 }, /* line-out */
  743. { 0x17, 0x01a19020 }, /* mic */
  744. { 0x1b, 0x0145f1f0 }, /* SPDIF */
  745. { 0x24, 0x01016011 }, /* line-out */
  746. { 0x25, 0x01012013 }, /* line-out */
  747. { }
  748. }
  749. },
  750. };
  751. static const struct hda_model_fixup ad1988_fixup_models[] = {
  752. { .id = AD1988_FIXUP_6STACK_DIG, .name = "6stack-dig" },
  753. {}
  754. };
  755. static int patch_ad1988(struct hda_codec *codec)
  756. {
  757. struct ad198x_spec *spec;
  758. int err;
  759. err = alloc_ad_spec(codec);
  760. if (err < 0)
  761. return err;
  762. spec = codec->spec;
  763. spec->gen.mixer_nid = 0x20;
  764. spec->gen.mixer_merge_nid = 0x21;
  765. spec->gen.beep_nid = 0x10;
  766. set_beep_amp(spec, 0x10, 0, HDA_OUTPUT);
  767. snd_hda_pick_fixup(codec, ad1988_fixup_models, NULL, ad1988_fixups);
  768. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  769. err = ad198x_parse_auto_config(codec);
  770. if (err < 0)
  771. goto error;
  772. err = ad1988_add_spdif_mux_ctl(codec);
  773. if (err < 0)
  774. goto error;
  775. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  776. return 0;
  777. error:
  778. snd_hda_gen_free(codec);
  779. return err;
  780. }
  781. /*
  782. * AD1884 / AD1984
  783. *
  784. * port-B - front line/mic-in
  785. * port-E - aux in/out
  786. * port-F - aux in/out
  787. * port-C - rear line/mic-in
  788. * port-D - rear line/hp-out
  789. * port-A - front line/hp-out
  790. *
  791. * AD1984 = AD1884 + two digital mic-ins
  792. *
  793. * AD1883 / AD1884A / AD1984A / AD1984B
  794. *
  795. * port-B (0x14) - front mic-in
  796. * port-E (0x1c) - rear mic-in
  797. * port-F (0x16) - CD / ext out
  798. * port-C (0x15) - rear line-in
  799. * port-D (0x12) - rear line-out
  800. * port-A (0x11) - front hp-out
  801. *
  802. * AD1984A = AD1884A + digital-mic
  803. * AD1883 = equivalent with AD1984A
  804. * AD1984B = AD1984A + extra SPDIF-out
  805. */
  806. /* set the upper-limit for mixer amp to 0dB for avoiding the possible
  807. * damage by overloading
  808. */
  809. static void ad1884_fixup_amp_override(struct hda_codec *codec,
  810. const struct hda_fixup *fix, int action)
  811. {
  812. if (action == HDA_FIXUP_ACT_PRE_PROBE)
  813. snd_hda_override_amp_caps(codec, 0x20, HDA_INPUT,
  814. (0x17 << AC_AMPCAP_OFFSET_SHIFT) |
  815. (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) |
  816. (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) |
  817. (1 << AC_AMPCAP_MUTE_SHIFT));
  818. }
  819. /* toggle GPIO1 according to the mute state */
  820. static void ad1884_vmaster_hp_gpio_hook(void *private_data, int enabled)
  821. {
  822. struct hda_codec *codec = private_data;
  823. struct ad198x_spec *spec = codec->spec;
  824. if (spec->eapd_nid)
  825. ad_vmaster_eapd_hook(private_data, enabled);
  826. snd_hda_codec_update_cache(codec, 0x01, 0,
  827. AC_VERB_SET_GPIO_DATA,
  828. enabled ? 0x00 : 0x02);
  829. }
  830. static void ad1884_fixup_hp_eapd(struct hda_codec *codec,
  831. const struct hda_fixup *fix, int action)
  832. {
  833. struct ad198x_spec *spec = codec->spec;
  834. static const struct hda_verb gpio_init_verbs[] = {
  835. {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
  836. {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
  837. {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
  838. {},
  839. };
  840. switch (action) {
  841. case HDA_FIXUP_ACT_PRE_PROBE:
  842. spec->gen.vmaster_mute.hook = ad1884_vmaster_hp_gpio_hook;
  843. snd_hda_sequence_write_cache(codec, gpio_init_verbs);
  844. break;
  845. case HDA_FIXUP_ACT_PROBE:
  846. if (spec->gen.autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
  847. spec->eapd_nid = spec->gen.autocfg.line_out_pins[0];
  848. else
  849. spec->eapd_nid = spec->gen.autocfg.speaker_pins[0];
  850. break;
  851. }
  852. }
  853. static void ad1884_fixup_thinkpad(struct hda_codec *codec,
  854. const struct hda_fixup *fix, int action)
  855. {
  856. struct ad198x_spec *spec = codec->spec;
  857. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  858. spec->gen.keep_eapd_on = 1;
  859. spec->gen.vmaster_mute.hook = ad_vmaster_eapd_hook;
  860. spec->eapd_nid = 0x12;
  861. }
  862. }
  863. /* set magic COEFs for dmic */
  864. static const struct hda_verb ad1884_dmic_init_verbs[] = {
  865. {0x01, AC_VERB_SET_COEF_INDEX, 0x13f7},
  866. {0x01, AC_VERB_SET_PROC_COEF, 0x08},
  867. {}
  868. };
  869. enum {
  870. AD1884_FIXUP_AMP_OVERRIDE,
  871. AD1884_FIXUP_HP_EAPD,
  872. AD1884_FIXUP_DMIC_COEF,
  873. AD1884_FIXUP_THINKPAD,
  874. AD1884_FIXUP_HP_TOUCHSMART,
  875. };
  876. static const struct hda_fixup ad1884_fixups[] = {
  877. [AD1884_FIXUP_AMP_OVERRIDE] = {
  878. .type = HDA_FIXUP_FUNC,
  879. .v.func = ad1884_fixup_amp_override,
  880. },
  881. [AD1884_FIXUP_HP_EAPD] = {
  882. .type = HDA_FIXUP_FUNC,
  883. .v.func = ad1884_fixup_hp_eapd,
  884. .chained = true,
  885. .chain_id = AD1884_FIXUP_AMP_OVERRIDE,
  886. },
  887. [AD1884_FIXUP_DMIC_COEF] = {
  888. .type = HDA_FIXUP_VERBS,
  889. .v.verbs = ad1884_dmic_init_verbs,
  890. },
  891. [AD1884_FIXUP_THINKPAD] = {
  892. .type = HDA_FIXUP_FUNC,
  893. .v.func = ad1884_fixup_thinkpad,
  894. .chained = true,
  895. .chain_id = AD1884_FIXUP_DMIC_COEF,
  896. },
  897. [AD1884_FIXUP_HP_TOUCHSMART] = {
  898. .type = HDA_FIXUP_VERBS,
  899. .v.verbs = ad1884_dmic_init_verbs,
  900. .chained = true,
  901. .chain_id = AD1884_FIXUP_HP_EAPD,
  902. },
  903. };
  904. static const struct snd_pci_quirk ad1884_fixup_tbl[] = {
  905. SND_PCI_QUIRK(0x103c, 0x2a82, "HP Touchsmart", AD1884_FIXUP_HP_TOUCHSMART),
  906. SND_PCI_QUIRK_VENDOR(0x103c, "HP", AD1884_FIXUP_HP_EAPD),
  907. SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo Thinkpad", AD1884_FIXUP_THINKPAD),
  908. {}
  909. };
  910. static int patch_ad1884(struct hda_codec *codec)
  911. {
  912. struct ad198x_spec *spec;
  913. int err;
  914. err = alloc_ad_spec(codec);
  915. if (err < 0)
  916. return err;
  917. spec = codec->spec;
  918. spec->gen.mixer_nid = 0x20;
  919. spec->gen.beep_nid = 0x10;
  920. set_beep_amp(spec, 0x10, 0, HDA_OUTPUT);
  921. snd_hda_pick_fixup(codec, NULL, ad1884_fixup_tbl, ad1884_fixups);
  922. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  923. err = ad198x_parse_auto_config(codec);
  924. if (err < 0)
  925. goto error;
  926. err = ad1983_add_spdif_mux_ctl(codec);
  927. if (err < 0)
  928. goto error;
  929. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  930. return 0;
  931. error:
  932. snd_hda_gen_free(codec);
  933. return err;
  934. }
  935. /*
  936. * AD1882 / AD1882A
  937. *
  938. * port-A - front hp-out
  939. * port-B - front mic-in
  940. * port-C - rear line-in, shared surr-out (3stack)
  941. * port-D - rear line-out
  942. * port-E - rear mic-in, shared clfe-out (3stack)
  943. * port-F - rear surr-out (6stack)
  944. * port-G - rear clfe-out (6stack)
  945. */
  946. static int patch_ad1882(struct hda_codec *codec)
  947. {
  948. struct ad198x_spec *spec;
  949. int err;
  950. err = alloc_ad_spec(codec);
  951. if (err < 0)
  952. return err;
  953. spec = codec->spec;
  954. spec->gen.mixer_nid = 0x20;
  955. spec->gen.mixer_merge_nid = 0x21;
  956. spec->gen.beep_nid = 0x10;
  957. set_beep_amp(spec, 0x10, 0, HDA_OUTPUT);
  958. err = ad198x_parse_auto_config(codec);
  959. if (err < 0)
  960. goto error;
  961. err = ad1988_add_spdif_mux_ctl(codec);
  962. if (err < 0)
  963. goto error;
  964. return 0;
  965. error:
  966. snd_hda_gen_free(codec);
  967. return err;
  968. }
  969. /*
  970. * patch entries
  971. */
  972. static const struct hda_codec_preset snd_hda_preset_analog[] = {
  973. { .id = 0x11d4184a, .name = "AD1884A", .patch = patch_ad1884 },
  974. { .id = 0x11d41882, .name = "AD1882", .patch = patch_ad1882 },
  975. { .id = 0x11d41883, .name = "AD1883", .patch = patch_ad1884 },
  976. { .id = 0x11d41884, .name = "AD1884", .patch = patch_ad1884 },
  977. { .id = 0x11d4194a, .name = "AD1984A", .patch = patch_ad1884 },
  978. { .id = 0x11d4194b, .name = "AD1984B", .patch = patch_ad1884 },
  979. { .id = 0x11d41981, .name = "AD1981", .patch = patch_ad1981 },
  980. { .id = 0x11d41983, .name = "AD1983", .patch = patch_ad1983 },
  981. { .id = 0x11d41984, .name = "AD1984", .patch = patch_ad1884 },
  982. { .id = 0x11d41986, .name = "AD1986A", .patch = patch_ad1986a },
  983. { .id = 0x11d41988, .name = "AD1988", .patch = patch_ad1988 },
  984. { .id = 0x11d4198b, .name = "AD1988B", .patch = patch_ad1988 },
  985. { .id = 0x11d4882a, .name = "AD1882A", .patch = patch_ad1882 },
  986. { .id = 0x11d4989a, .name = "AD1989A", .patch = patch_ad1988 },
  987. { .id = 0x11d4989b, .name = "AD1989B", .patch = patch_ad1988 },
  988. {} /* terminator */
  989. };
  990. MODULE_ALIAS("snd-hda-codec-id:11d4*");
  991. MODULE_LICENSE("GPL");
  992. MODULE_DESCRIPTION("Analog Devices HD-audio codec");
  993. static struct hda_codec_preset_list analog_list = {
  994. .preset = snd_hda_preset_analog,
  995. .owner = THIS_MODULE,
  996. };
  997. static int __init patch_analog_init(void)
  998. {
  999. return snd_hda_add_codec_preset(&analog_list);
  1000. }
  1001. static void __exit patch_analog_exit(void)
  1002. {
  1003. snd_hda_delete_codec_preset(&analog_list);
  1004. }
  1005. module_init(patch_analog_init)
  1006. module_exit(patch_analog_exit)