patch_analog.c 29 KB

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