patch_analog.c 29 KB

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