alc882.c 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. //
  3. // Realtek ALC882/883/885/888/889 codec support
  4. //
  5. // ALC882 is almost identical with ALC880 but has cleaner and more flexible
  6. // configuration. Each pin widget can choose any input DACs and a mixer.
  7. // Each ADC is connected from a mixer of all inputs. This makes possible
  8. // 6-channel independent captures.
  9. //
  10. // In addition, an independent DAC for the multi-playback (not used in this
  11. // driver yet).
  12. //
  13. #include <linux/init.h>
  14. #include <linux/module.h>
  15. #include "realtek.h"
  16. /*
  17. * Pin config fixes
  18. */
  19. enum {
  20. ALC882_FIXUP_ABIT_AW9D_MAX,
  21. ALC882_FIXUP_LENOVO_Y530,
  22. ALC882_FIXUP_PB_M5210,
  23. ALC882_FIXUP_ACER_ASPIRE_7736,
  24. ALC882_FIXUP_ASUS_W90V,
  25. ALC889_FIXUP_CD,
  26. ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
  27. ALC889_FIXUP_VAIO_TT,
  28. ALC888_FIXUP_EEE1601,
  29. ALC886_FIXUP_EAPD,
  30. ALC882_FIXUP_EAPD,
  31. ALC883_FIXUP_EAPD,
  32. ALC883_FIXUP_ACER_EAPD,
  33. ALC882_FIXUP_GPIO1,
  34. ALC882_FIXUP_GPIO2,
  35. ALC882_FIXUP_GPIO3,
  36. ALC889_FIXUP_COEF,
  37. ALC882_FIXUP_ASUS_W2JC,
  38. ALC882_FIXUP_ACER_ASPIRE_4930G,
  39. ALC882_FIXUP_ACER_ASPIRE_8930G,
  40. ALC882_FIXUP_ASPIRE_8930G_VERBS,
  41. ALC885_FIXUP_MACPRO_GPIO,
  42. ALC889_FIXUP_DAC_ROUTE,
  43. ALC889_FIXUP_MBP_VREF,
  44. ALC889_FIXUP_IMAC91_VREF,
  45. ALC889_FIXUP_MBA11_VREF,
  46. ALC889_FIXUP_MBA21_VREF,
  47. ALC889_FIXUP_MP11_VREF,
  48. ALC889_FIXUP_MP41_VREF,
  49. ALC882_FIXUP_INV_DMIC,
  50. ALC882_FIXUP_NO_PRIMARY_HP,
  51. ALC887_FIXUP_ASUS_BASS,
  52. ALC887_FIXUP_BASS_CHMAP,
  53. ALC1220_FIXUP_GB_DUAL_CODECS,
  54. ALC1220_FIXUP_GB_X570,
  55. ALC1220_FIXUP_CLEVO_P950,
  56. ALC1220_FIXUP_CLEVO_PB51ED,
  57. ALC1220_FIXUP_CLEVO_PB51ED_PINS,
  58. ALC887_FIXUP_ASUS_AUDIO,
  59. ALC887_FIXUP_ASUS_HMIC,
  60. ALCS1200A_FIXUP_MIC_VREF,
  61. ALC888VD_FIXUP_MIC_100VREF,
  62. };
  63. static void alc889_fixup_coef(struct hda_codec *codec,
  64. const struct hda_fixup *fix, int action)
  65. {
  66. if (action != HDA_FIXUP_ACT_INIT)
  67. return;
  68. alc_update_coef_idx(codec, 7, 0, 0x2030);
  69. }
  70. /* set up GPIO at initialization */
  71. static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
  72. const struct hda_fixup *fix, int action)
  73. {
  74. struct alc_spec *spec = codec->spec;
  75. spec->gpio_write_delay = true;
  76. alc_fixup_gpio3(codec, fix, action);
  77. }
  78. /* Fix the connection of some pins for ALC889:
  79. * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
  80. * work correctly (bko#42740)
  81. */
  82. static void alc889_fixup_dac_route(struct hda_codec *codec,
  83. const struct hda_fixup *fix, int action)
  84. {
  85. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  86. /* fake the connections during parsing the tree */
  87. static const hda_nid_t conn1[] = { 0x0c, 0x0d };
  88. static const hda_nid_t conn2[] = { 0x0e, 0x0f };
  89. snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
  90. snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
  91. snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
  92. snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
  93. } else if (action == HDA_FIXUP_ACT_PROBE) {
  94. /* restore the connections */
  95. static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
  96. snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
  97. snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
  98. snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
  99. snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
  100. }
  101. }
  102. /* Set VREF on HP pin */
  103. static void alc889_fixup_mbp_vref(struct hda_codec *codec,
  104. const struct hda_fixup *fix, int action)
  105. {
  106. static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
  107. struct alc_spec *spec = codec->spec;
  108. int i;
  109. if (action != HDA_FIXUP_ACT_INIT)
  110. return;
  111. for (i = 0; i < ARRAY_SIZE(nids); i++) {
  112. unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
  113. if (get_defcfg_device(val) != AC_JACK_HP_OUT)
  114. continue;
  115. val = snd_hda_codec_get_pin_target(codec, nids[i]);
  116. val |= AC_PINCTL_VREF_80;
  117. snd_hda_set_pin_ctl(codec, nids[i], val);
  118. spec->gen.keep_vref_in_automute = 1;
  119. break;
  120. }
  121. }
  122. static void alc889_fixup_mac_pins(struct hda_codec *codec,
  123. const hda_nid_t *nids, int num_nids)
  124. {
  125. struct alc_spec *spec = codec->spec;
  126. int i;
  127. for (i = 0; i < num_nids; i++) {
  128. unsigned int val;
  129. val = snd_hda_codec_get_pin_target(codec, nids[i]);
  130. val |= AC_PINCTL_VREF_50;
  131. snd_hda_set_pin_ctl(codec, nids[i], val);
  132. }
  133. spec->gen.keep_vref_in_automute = 1;
  134. }
  135. /* Set VREF on speaker pins on imac91 */
  136. static void alc889_fixup_imac91_vref(struct hda_codec *codec,
  137. const struct hda_fixup *fix, int action)
  138. {
  139. static const hda_nid_t nids[] = { 0x18, 0x1a };
  140. if (action == HDA_FIXUP_ACT_INIT)
  141. alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
  142. }
  143. /* Set VREF on speaker pins on mba11 */
  144. static void alc889_fixup_mba11_vref(struct hda_codec *codec,
  145. const struct hda_fixup *fix, int action)
  146. {
  147. static const hda_nid_t nids[] = { 0x18 };
  148. if (action == HDA_FIXUP_ACT_INIT)
  149. alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
  150. }
  151. /* Set VREF on speaker pins on mba21 */
  152. static void alc889_fixup_mba21_vref(struct hda_codec *codec,
  153. const struct hda_fixup *fix, int action)
  154. {
  155. static const hda_nid_t nids[] = { 0x18, 0x19 };
  156. if (action == HDA_FIXUP_ACT_INIT)
  157. alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
  158. }
  159. /* Don't take HP output as primary
  160. * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
  161. * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
  162. */
  163. static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
  164. const struct hda_fixup *fix, int action)
  165. {
  166. struct alc_spec *spec = codec->spec;
  167. if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  168. spec->gen.no_primary_hp = 1;
  169. spec->gen.no_multi_io = 1;
  170. }
  171. }
  172. static void alc1220_fixup_gb_x570(struct hda_codec *codec,
  173. const struct hda_fixup *fix,
  174. int action)
  175. {
  176. static const hda_nid_t conn1[] = { 0x0c };
  177. static const struct coef_fw gb_x570_coefs[] = {
  178. WRITE_COEF(0x07, 0x03c0),
  179. WRITE_COEF(0x1a, 0x01c1),
  180. WRITE_COEF(0x1b, 0x0202),
  181. WRITE_COEF(0x43, 0x3005),
  182. {}
  183. };
  184. switch (action) {
  185. case HDA_FIXUP_ACT_PRE_PROBE:
  186. snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
  187. snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
  188. break;
  189. case HDA_FIXUP_ACT_INIT:
  190. alc_process_coef_fw(codec, gb_x570_coefs);
  191. break;
  192. }
  193. }
  194. static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
  195. const struct hda_fixup *fix,
  196. int action)
  197. {
  198. static const hda_nid_t conn1[] = { 0x0c };
  199. if (action != HDA_FIXUP_ACT_PRE_PROBE)
  200. return;
  201. alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
  202. /* We therefore want to make sure 0x14 (front headphone) and
  203. * 0x1b (speakers) use the stereo DAC 0x02
  204. */
  205. snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
  206. snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
  207. }
  208. static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
  209. const struct hda_fixup *fix,
  210. int action)
  211. {
  212. alc1220_fixup_clevo_p950(codec, fix, action);
  213. alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
  214. }
  215. static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
  216. struct hda_jack_callback *jack)
  217. {
  218. struct alc_spec *spec = codec->spec;
  219. unsigned int vref;
  220. snd_hda_gen_hp_automute(codec, jack);
  221. if (spec->gen.hp_jack_present)
  222. vref = AC_PINCTL_VREF_80;
  223. else
  224. vref = AC_PINCTL_VREF_HIZ;
  225. snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
  226. }
  227. static void alc887_fixup_asus_jack(struct hda_codec *codec,
  228. const struct hda_fixup *fix, int action)
  229. {
  230. struct alc_spec *spec = codec->spec;
  231. if (action != HDA_FIXUP_ACT_PROBE)
  232. return;
  233. snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
  234. spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
  235. }
  236. static const struct hda_fixup alc882_fixups[] = {
  237. [ALC882_FIXUP_ABIT_AW9D_MAX] = {
  238. .type = HDA_FIXUP_PINS,
  239. .v.pins = (const struct hda_pintbl[]) {
  240. { 0x15, 0x01080104 }, /* side */
  241. { 0x16, 0x01011012 }, /* rear */
  242. { 0x17, 0x01016011 }, /* clfe */
  243. { }
  244. }
  245. },
  246. [ALC882_FIXUP_LENOVO_Y530] = {
  247. .type = HDA_FIXUP_PINS,
  248. .v.pins = (const struct hda_pintbl[]) {
  249. { 0x15, 0x99130112 }, /* rear int speakers */
  250. { 0x16, 0x99130111 }, /* subwoofer */
  251. { }
  252. }
  253. },
  254. [ALC882_FIXUP_PB_M5210] = {
  255. .type = HDA_FIXUP_PINCTLS,
  256. .v.pins = (const struct hda_pintbl[]) {
  257. { 0x19, PIN_VREF50 },
  258. {}
  259. }
  260. },
  261. [ALC882_FIXUP_ACER_ASPIRE_7736] = {
  262. .type = HDA_FIXUP_FUNC,
  263. .v.func = alc_fixup_sku_ignore,
  264. },
  265. [ALC882_FIXUP_ASUS_W90V] = {
  266. .type = HDA_FIXUP_PINS,
  267. .v.pins = (const struct hda_pintbl[]) {
  268. { 0x16, 0x99130110 }, /* fix sequence for CLFE */
  269. { }
  270. }
  271. },
  272. [ALC889_FIXUP_CD] = {
  273. .type = HDA_FIXUP_PINS,
  274. .v.pins = (const struct hda_pintbl[]) {
  275. { 0x1c, 0x993301f0 }, /* CD */
  276. { }
  277. }
  278. },
  279. [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
  280. .type = HDA_FIXUP_PINS,
  281. .v.pins = (const struct hda_pintbl[]) {
  282. { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
  283. { }
  284. },
  285. .chained = true,
  286. .chain_id = ALC889_FIXUP_CD,
  287. },
  288. [ALC889_FIXUP_VAIO_TT] = {
  289. .type = HDA_FIXUP_PINS,
  290. .v.pins = (const struct hda_pintbl[]) {
  291. { 0x17, 0x90170111 }, /* hidden surround speaker */
  292. { }
  293. }
  294. },
  295. [ALC888_FIXUP_EEE1601] = {
  296. .type = HDA_FIXUP_VERBS,
  297. .v.verbs = (const struct hda_verb[]) {
  298. { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
  299. { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
  300. { }
  301. }
  302. },
  303. [ALC886_FIXUP_EAPD] = {
  304. .type = HDA_FIXUP_VERBS,
  305. .v.verbs = (const struct hda_verb[]) {
  306. /* change to EAPD mode */
  307. { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
  308. { 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
  309. { }
  310. }
  311. },
  312. [ALC882_FIXUP_EAPD] = {
  313. .type = HDA_FIXUP_VERBS,
  314. .v.verbs = (const struct hda_verb[]) {
  315. /* change to EAPD mode */
  316. { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
  317. { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
  318. { }
  319. }
  320. },
  321. [ALC883_FIXUP_EAPD] = {
  322. .type = HDA_FIXUP_VERBS,
  323. .v.verbs = (const struct hda_verb[]) {
  324. /* change to EAPD mode */
  325. { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
  326. { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
  327. { }
  328. }
  329. },
  330. [ALC883_FIXUP_ACER_EAPD] = {
  331. .type = HDA_FIXUP_VERBS,
  332. .v.verbs = (const struct hda_verb[]) {
  333. /* eanable EAPD on Acer laptops */
  334. { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
  335. { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
  336. { }
  337. }
  338. },
  339. [ALC882_FIXUP_GPIO1] = {
  340. .type = HDA_FIXUP_FUNC,
  341. .v.func = alc_fixup_gpio1,
  342. },
  343. [ALC882_FIXUP_GPIO2] = {
  344. .type = HDA_FIXUP_FUNC,
  345. .v.func = alc_fixup_gpio2,
  346. },
  347. [ALC882_FIXUP_GPIO3] = {
  348. .type = HDA_FIXUP_FUNC,
  349. .v.func = alc_fixup_gpio3,
  350. },
  351. [ALC882_FIXUP_ASUS_W2JC] = {
  352. .type = HDA_FIXUP_FUNC,
  353. .v.func = alc_fixup_gpio1,
  354. .chained = true,
  355. .chain_id = ALC882_FIXUP_EAPD,
  356. },
  357. [ALC889_FIXUP_COEF] = {
  358. .type = HDA_FIXUP_FUNC,
  359. .v.func = alc889_fixup_coef,
  360. },
  361. [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
  362. .type = HDA_FIXUP_PINS,
  363. .v.pins = (const struct hda_pintbl[]) {
  364. { 0x16, 0x99130111 }, /* CLFE speaker */
  365. { 0x17, 0x99130112 }, /* surround speaker */
  366. { }
  367. },
  368. .chained = true,
  369. .chain_id = ALC882_FIXUP_GPIO1,
  370. },
  371. [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
  372. .type = HDA_FIXUP_PINS,
  373. .v.pins = (const struct hda_pintbl[]) {
  374. { 0x16, 0x99130111 }, /* CLFE speaker */
  375. { 0x1b, 0x99130112 }, /* surround speaker */
  376. { }
  377. },
  378. .chained = true,
  379. .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
  380. },
  381. [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
  382. /* additional init verbs for Acer Aspire 8930G */
  383. .type = HDA_FIXUP_VERBS,
  384. .v.verbs = (const struct hda_verb[]) {
  385. /* Enable all DACs */
  386. /* DAC DISABLE/MUTE 1? */
  387. /* setting bits 1-5 disables DAC nids 0x02-0x06
  388. * apparently. Init=0x38 */
  389. { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
  390. { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
  391. /* DAC DISABLE/MUTE 2? */
  392. /* some bit here disables the other DACs.
  393. * Init=0x4900 */
  394. { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
  395. { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
  396. /* DMIC fix
  397. * This laptop has a stereo digital microphone.
  398. * The mics are only 1cm apart which makes the stereo
  399. * useless. However, either the mic or the ALC889
  400. * makes the signal become a difference/sum signal
  401. * instead of standard stereo, which is annoying.
  402. * So instead we flip this bit which makes the
  403. * codec replicate the sum signal to both channels,
  404. * turning it into a normal mono mic.
  405. */
  406. /* DMIC_CONTROL? Init value = 0x0001 */
  407. { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
  408. { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
  409. { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
  410. { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
  411. { }
  412. },
  413. .chained = true,
  414. .chain_id = ALC882_FIXUP_GPIO1,
  415. },
  416. [ALC885_FIXUP_MACPRO_GPIO] = {
  417. .type = HDA_FIXUP_FUNC,
  418. .v.func = alc885_fixup_macpro_gpio,
  419. },
  420. [ALC889_FIXUP_DAC_ROUTE] = {
  421. .type = HDA_FIXUP_FUNC,
  422. .v.func = alc889_fixup_dac_route,
  423. },
  424. [ALC889_FIXUP_MBP_VREF] = {
  425. .type = HDA_FIXUP_FUNC,
  426. .v.func = alc889_fixup_mbp_vref,
  427. .chained = true,
  428. .chain_id = ALC882_FIXUP_GPIO1,
  429. },
  430. [ALC889_FIXUP_IMAC91_VREF] = {
  431. .type = HDA_FIXUP_FUNC,
  432. .v.func = alc889_fixup_imac91_vref,
  433. .chained = true,
  434. .chain_id = ALC882_FIXUP_GPIO1,
  435. },
  436. [ALC889_FIXUP_MBA11_VREF] = {
  437. .type = HDA_FIXUP_FUNC,
  438. .v.func = alc889_fixup_mba11_vref,
  439. .chained = true,
  440. .chain_id = ALC889_FIXUP_MBP_VREF,
  441. },
  442. [ALC889_FIXUP_MBA21_VREF] = {
  443. .type = HDA_FIXUP_FUNC,
  444. .v.func = alc889_fixup_mba21_vref,
  445. .chained = true,
  446. .chain_id = ALC889_FIXUP_MBP_VREF,
  447. },
  448. [ALC889_FIXUP_MP11_VREF] = {
  449. .type = HDA_FIXUP_FUNC,
  450. .v.func = alc889_fixup_mba11_vref,
  451. .chained = true,
  452. .chain_id = ALC885_FIXUP_MACPRO_GPIO,
  453. },
  454. [ALC889_FIXUP_MP41_VREF] = {
  455. .type = HDA_FIXUP_FUNC,
  456. .v.func = alc889_fixup_mbp_vref,
  457. .chained = true,
  458. .chain_id = ALC885_FIXUP_MACPRO_GPIO,
  459. },
  460. [ALC882_FIXUP_INV_DMIC] = {
  461. .type = HDA_FIXUP_FUNC,
  462. .v.func = alc_fixup_inv_dmic,
  463. },
  464. [ALC882_FIXUP_NO_PRIMARY_HP] = {
  465. .type = HDA_FIXUP_FUNC,
  466. .v.func = alc882_fixup_no_primary_hp,
  467. },
  468. [ALC887_FIXUP_ASUS_BASS] = {
  469. .type = HDA_FIXUP_PINS,
  470. .v.pins = (const struct hda_pintbl[]) {
  471. {0x16, 0x99130130}, /* bass speaker */
  472. {}
  473. },
  474. .chained = true,
  475. .chain_id = ALC887_FIXUP_BASS_CHMAP,
  476. },
  477. [ALC887_FIXUP_BASS_CHMAP] = {
  478. .type = HDA_FIXUP_FUNC,
  479. .v.func = alc_fixup_bass_chmap,
  480. },
  481. [ALC1220_FIXUP_GB_DUAL_CODECS] = {
  482. .type = HDA_FIXUP_FUNC,
  483. .v.func = alc1220_fixup_gb_dual_codecs,
  484. },
  485. [ALC1220_FIXUP_GB_X570] = {
  486. .type = HDA_FIXUP_FUNC,
  487. .v.func = alc1220_fixup_gb_x570,
  488. },
  489. [ALC1220_FIXUP_CLEVO_P950] = {
  490. .type = HDA_FIXUP_FUNC,
  491. .v.func = alc1220_fixup_clevo_p950,
  492. },
  493. [ALC1220_FIXUP_CLEVO_PB51ED] = {
  494. .type = HDA_FIXUP_FUNC,
  495. .v.func = alc1220_fixup_clevo_pb51ed,
  496. },
  497. [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
  498. .type = HDA_FIXUP_PINS,
  499. .v.pins = (const struct hda_pintbl[]) {
  500. { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
  501. {}
  502. },
  503. .chained = true,
  504. .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
  505. },
  506. [ALC887_FIXUP_ASUS_AUDIO] = {
  507. .type = HDA_FIXUP_PINS,
  508. .v.pins = (const struct hda_pintbl[]) {
  509. { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
  510. { 0x19, 0x22219420 },
  511. {}
  512. },
  513. },
  514. [ALC887_FIXUP_ASUS_HMIC] = {
  515. .type = HDA_FIXUP_FUNC,
  516. .v.func = alc887_fixup_asus_jack,
  517. .chained = true,
  518. .chain_id = ALC887_FIXUP_ASUS_AUDIO,
  519. },
  520. [ALCS1200A_FIXUP_MIC_VREF] = {
  521. .type = HDA_FIXUP_PINCTLS,
  522. .v.pins = (const struct hda_pintbl[]) {
  523. { 0x18, PIN_VREF50 }, /* rear mic */
  524. { 0x19, PIN_VREF50 }, /* front mic */
  525. {}
  526. }
  527. },
  528. [ALC888VD_FIXUP_MIC_100VREF] = {
  529. .type = HDA_FIXUP_PINCTLS,
  530. .v.pins = (const struct hda_pintbl[]) {
  531. { 0x18, PIN_VREF100 }, /* headset mic */
  532. {}
  533. }
  534. },
  535. };
  536. static const struct hda_quirk alc882_fixup_tbl[] = {
  537. SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
  538. SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
  539. SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
  540. SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
  541. SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
  542. SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
  543. SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
  544. SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
  545. ALC882_FIXUP_ACER_ASPIRE_4930G),
  546. SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
  547. ALC882_FIXUP_ACER_ASPIRE_4930G),
  548. SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
  549. ALC882_FIXUP_ACER_ASPIRE_8930G),
  550. SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
  551. ALC882_FIXUP_ACER_ASPIRE_8930G),
  552. SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
  553. ALC882_FIXUP_ACER_ASPIRE_4930G),
  554. SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
  555. SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
  556. ALC882_FIXUP_ACER_ASPIRE_4930G),
  557. SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
  558. ALC882_FIXUP_ACER_ASPIRE_4930G),
  559. SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
  560. ALC882_FIXUP_ACER_ASPIRE_4930G),
  561. SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
  562. SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
  563. SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
  564. SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
  565. SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
  566. SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
  567. SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
  568. SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
  569. SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
  570. SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
  571. SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
  572. SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
  573. SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
  574. SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
  575. SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
  576. SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
  577. /* All Apple entries are in codec SSIDs */
  578. SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
  579. SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
  580. SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
  581. SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
  582. SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
  583. SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
  584. SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
  585. SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
  586. SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
  587. SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
  588. SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
  589. SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
  590. SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
  591. SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
  592. SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
  593. SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
  594. SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
  595. SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
  596. SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
  597. SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
  598. SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
  599. SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
  600. SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
  601. SND_PCI_QUIRK(0x10ec, 0x12d8, "iBase Elo Touch", ALC888VD_FIXUP_MIC_100VREF),
  602. SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
  603. SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
  604. SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
  605. SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
  606. SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
  607. SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
  608. SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
  609. SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
  610. SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
  611. SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
  612. SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
  613. SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
  614. SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
  615. SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
  616. SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
  617. SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
  618. SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
  619. SND_PCI_QUIRK(0x1558, 0x3702, "Clevo X370SN[VW]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
  620. SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
  621. SND_PCI_QUIRK(0x1558, 0x5802, "Clevo X58[05]WN[RST]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
  622. SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
  623. SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
  624. SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
  625. SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
  626. SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
  627. SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
  628. SND_PCI_QUIRK(0x1558, 0x66a2, "Clevo PE60RNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
  629. SND_PCI_QUIRK(0x1558, 0x66a6, "Clevo PE60SN[CDE]-[GS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
  630. SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
  631. SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
  632. SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
  633. SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
  634. SND_PCI_QUIRK(0x1558, 0x67f5, "Clevo PD70PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
  635. SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
  636. SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
  637. SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
  638. SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
  639. SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
  640. SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
  641. SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
  642. SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
  643. SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
  644. SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
  645. SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
  646. SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
  647. SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
  648. SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
  649. SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
  650. SND_PCI_QUIRK(0x1558, 0xd502, "Clevo PD50SNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
  651. SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
  652. SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
  653. SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
  654. SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
  655. {}
  656. };
  657. static const struct hda_model_fixup alc882_fixup_models[] = {
  658. {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
  659. {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
  660. {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
  661. {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
  662. {.id = ALC889_FIXUP_CD, .name = "cd"},
  663. {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
  664. {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
  665. {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
  666. {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
  667. {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
  668. {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
  669. {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
  670. {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
  671. {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
  672. {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
  673. {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
  674. {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
  675. {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
  676. {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
  677. {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
  678. {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
  679. {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
  680. {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
  681. {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
  682. {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
  683. {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
  684. {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
  685. {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
  686. {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
  687. {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
  688. {.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
  689. {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
  690. {}
  691. };
  692. static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
  693. SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
  694. {0x14, 0x01014010},
  695. {0x15, 0x01011012},
  696. {0x16, 0x01016011},
  697. {0x18, 0x01a19040},
  698. {0x19, 0x02a19050},
  699. {0x1a, 0x0181304f},
  700. {0x1b, 0x0221401f},
  701. {0x1e, 0x01456130}),
  702. SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
  703. {0x14, 0x01015010},
  704. {0x15, 0x01011012},
  705. {0x16, 0x01011011},
  706. {0x18, 0x01a11040},
  707. {0x19, 0x02a19050},
  708. {0x1a, 0x0181104f},
  709. {0x1b, 0x0221401f},
  710. {0x1e, 0x01451130}),
  711. {}
  712. };
  713. /*
  714. * BIOS auto configuration
  715. */
  716. /* almost identical with ALC880 parser... */
  717. static int alc882_parse_auto_config(struct hda_codec *codec)
  718. {
  719. static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
  720. static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
  721. return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
  722. }
  723. /*
  724. */
  725. static int alc882_probe(struct hda_codec *codec, const struct hda_device_id *id)
  726. {
  727. struct alc_spec *spec;
  728. int err;
  729. err = alc_alloc_spec(codec, 0x0b);
  730. if (err < 0)
  731. return err;
  732. spec = codec->spec;
  733. switch (codec->core.vendor_id) {
  734. case 0x10ec0882:
  735. case 0x10ec0885:
  736. case 0x10ec0900:
  737. case 0x10ec0b00:
  738. case 0x10ec1220:
  739. break;
  740. default:
  741. /* ALC883 and variants */
  742. alc_fix_pll_init(codec, 0x20, 0x0a, 10);
  743. break;
  744. }
  745. alc_pre_init(codec);
  746. snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
  747. alc882_fixups);
  748. snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
  749. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  750. alc_auto_parse_customize_define(codec);
  751. if (has_cdefine_beep(codec))
  752. spec->gen.beep_nid = 0x01;
  753. /* automatic parse from the BIOS config */
  754. err = alc882_parse_auto_config(codec);
  755. if (err < 0)
  756. goto error;
  757. if (!spec->gen.no_analog && spec->gen.beep_nid) {
  758. err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
  759. if (err < 0)
  760. goto error;
  761. }
  762. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  763. return 0;
  764. error:
  765. snd_hda_gen_remove(codec);
  766. return err;
  767. }
  768. static const struct hda_codec_ops alc882_codec_ops = {
  769. .probe = alc882_probe,
  770. .remove = snd_hda_gen_remove,
  771. .build_controls = alc_build_controls,
  772. .build_pcms = snd_hda_gen_build_pcms,
  773. .init = alc_init,
  774. .unsol_event = snd_hda_jack_unsol_event,
  775. .resume = alc_resume,
  776. .suspend = alc_suspend,
  777. .check_power_status = snd_hda_gen_check_power_status,
  778. .stream_pm = snd_hda_gen_stream_pm,
  779. };
  780. /*
  781. * driver entries
  782. */
  783. static const struct hda_device_id snd_hda_id_alc882[] = {
  784. HDA_CODEC_ID_REV(0x10ec0662, 0x100002, "ALC662 rev2"),
  785. HDA_CODEC_ID(0x10ec0882, "ALC882"),
  786. HDA_CODEC_ID(0x10ec0883, "ALC883"),
  787. HDA_CODEC_ID_REV(0x10ec0885, 0x100101, "ALC889A"),
  788. HDA_CODEC_ID_REV(0x10ec0885, 0x100103, "ALC889A"),
  789. HDA_CODEC_ID(0x10ec0885, "ALC885"),
  790. HDA_CODEC_ID(0x10ec0887, "ALC887"),
  791. HDA_CODEC_ID_REV(0x10ec0888, 0x100101, "ALC1200"),
  792. HDA_CODEC_ID(0x10ec0888, "ALC888"),
  793. HDA_CODEC_ID(0x10ec0889, "ALC889"),
  794. HDA_CODEC_ID(0x10ec0899, "ALC898"),
  795. HDA_CODEC_ID(0x10ec0900, "ALC1150"),
  796. HDA_CODEC_ID(0x10ec0b00, "ALCS1200A"),
  797. HDA_CODEC_ID(0x10ec1168, "ALC1220"),
  798. HDA_CODEC_ID(0x10ec1220, "ALC1220"),
  799. {} /* terminator */
  800. };
  801. MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_alc882);
  802. MODULE_LICENSE("GPL");
  803. MODULE_DESCRIPTION("Realtek ALC882 and compatible HD-audio codecs");
  804. MODULE_IMPORT_NS("SND_HDA_CODEC_REALTEK");
  805. static struct hda_codec_driver alc882_driver = {
  806. .id = snd_hda_id_alc882,
  807. .ops = &alc882_codec_ops,
  808. };
  809. module_hda_codec_driver(alc882_driver);