patch_analog.c 29 KB

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