alc880.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. //
  3. // Realtek ALC880 codec
  4. //
  5. #include <linux/init.h>
  6. #include <linux/module.h>
  7. #include "realtek.h"
  8. static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
  9. {
  10. /* For some reason, the res given from ALC880 is broken.
  11. Here we adjust it properly. */
  12. snd_hda_jack_unsol_event(codec, res >> 2);
  13. }
  14. static int alc880_parse_auto_config(struct hda_codec *codec)
  15. {
  16. static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
  17. static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
  18. return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
  19. }
  20. /*
  21. * ALC880 fix-ups
  22. */
  23. enum {
  24. ALC880_FIXUP_GPIO1,
  25. ALC880_FIXUP_GPIO2,
  26. ALC880_FIXUP_MEDION_RIM,
  27. ALC880_FIXUP_LG,
  28. ALC880_FIXUP_LG_LW25,
  29. ALC880_FIXUP_W810,
  30. ALC880_FIXUP_EAPD_COEF,
  31. ALC880_FIXUP_TCL_S700,
  32. ALC880_FIXUP_VOL_KNOB,
  33. ALC880_FIXUP_FUJITSU,
  34. ALC880_FIXUP_F1734,
  35. ALC880_FIXUP_UNIWILL,
  36. ALC880_FIXUP_UNIWILL_DIG,
  37. ALC880_FIXUP_Z71V,
  38. ALC880_FIXUP_ASUS_W5A,
  39. ALC880_FIXUP_3ST_BASE,
  40. ALC880_FIXUP_3ST,
  41. ALC880_FIXUP_3ST_DIG,
  42. ALC880_FIXUP_5ST_BASE,
  43. ALC880_FIXUP_5ST,
  44. ALC880_FIXUP_5ST_DIG,
  45. ALC880_FIXUP_6ST_BASE,
  46. ALC880_FIXUP_6ST,
  47. ALC880_FIXUP_6ST_DIG,
  48. ALC880_FIXUP_6ST_AUTOMUTE,
  49. };
  50. /* enable the volume-knob widget support on NID 0x21 */
  51. static void alc880_fixup_vol_knob(struct hda_codec *codec,
  52. const struct hda_fixup *fix, int action)
  53. {
  54. if (action == HDA_FIXUP_ACT_PROBE)
  55. snd_hda_jack_detect_enable_callback(codec, 0x21,
  56. alc_update_knob_master);
  57. }
  58. static const struct hda_fixup alc880_fixups[] = {
  59. [ALC880_FIXUP_GPIO1] = {
  60. .type = HDA_FIXUP_FUNC,
  61. .v.func = alc_fixup_gpio1,
  62. },
  63. [ALC880_FIXUP_GPIO2] = {
  64. .type = HDA_FIXUP_FUNC,
  65. .v.func = alc_fixup_gpio2,
  66. },
  67. [ALC880_FIXUP_MEDION_RIM] = {
  68. .type = HDA_FIXUP_VERBS,
  69. .v.verbs = (const struct hda_verb[]) {
  70. { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
  71. { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
  72. { }
  73. },
  74. .chained = true,
  75. .chain_id = ALC880_FIXUP_GPIO2,
  76. },
  77. [ALC880_FIXUP_LG] = {
  78. .type = HDA_FIXUP_PINS,
  79. .v.pins = (const struct hda_pintbl[]) {
  80. /* disable bogus unused pins */
  81. { 0x16, 0x411111f0 },
  82. { 0x18, 0x411111f0 },
  83. { 0x1a, 0x411111f0 },
  84. { }
  85. }
  86. },
  87. [ALC880_FIXUP_LG_LW25] = {
  88. .type = HDA_FIXUP_PINS,
  89. .v.pins = (const struct hda_pintbl[]) {
  90. { 0x1a, 0x0181344f }, /* line-in */
  91. { 0x1b, 0x0321403f }, /* headphone */
  92. { }
  93. }
  94. },
  95. [ALC880_FIXUP_W810] = {
  96. .type = HDA_FIXUP_PINS,
  97. .v.pins = (const struct hda_pintbl[]) {
  98. /* disable bogus unused pins */
  99. { 0x17, 0x411111f0 },
  100. { }
  101. },
  102. .chained = true,
  103. .chain_id = ALC880_FIXUP_GPIO2,
  104. },
  105. [ALC880_FIXUP_EAPD_COEF] = {
  106. .type = HDA_FIXUP_VERBS,
  107. .v.verbs = (const struct hda_verb[]) {
  108. /* change to EAPD mode */
  109. { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
  110. { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
  111. {}
  112. },
  113. },
  114. [ALC880_FIXUP_TCL_S700] = {
  115. .type = HDA_FIXUP_VERBS,
  116. .v.verbs = (const struct hda_verb[]) {
  117. /* change to EAPD mode */
  118. { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
  119. { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
  120. {}
  121. },
  122. .chained = true,
  123. .chain_id = ALC880_FIXUP_GPIO2,
  124. },
  125. [ALC880_FIXUP_VOL_KNOB] = {
  126. .type = HDA_FIXUP_FUNC,
  127. .v.func = alc880_fixup_vol_knob,
  128. },
  129. [ALC880_FIXUP_FUJITSU] = {
  130. /* override all pins as BIOS on old Amilo is broken */
  131. .type = HDA_FIXUP_PINS,
  132. .v.pins = (const struct hda_pintbl[]) {
  133. { 0x14, 0x0121401f }, /* HP */
  134. { 0x15, 0x99030120 }, /* speaker */
  135. { 0x16, 0x99030130 }, /* bass speaker */
  136. { 0x17, 0x411111f0 }, /* N/A */
  137. { 0x18, 0x411111f0 }, /* N/A */
  138. { 0x19, 0x01a19950 }, /* mic-in */
  139. { 0x1a, 0x411111f0 }, /* N/A */
  140. { 0x1b, 0x411111f0 }, /* N/A */
  141. { 0x1c, 0x411111f0 }, /* N/A */
  142. { 0x1d, 0x411111f0 }, /* N/A */
  143. { 0x1e, 0x01454140 }, /* SPDIF out */
  144. { }
  145. },
  146. .chained = true,
  147. .chain_id = ALC880_FIXUP_VOL_KNOB,
  148. },
  149. [ALC880_FIXUP_F1734] = {
  150. /* almost compatible with FUJITSU, but no bass and SPDIF */
  151. .type = HDA_FIXUP_PINS,
  152. .v.pins = (const struct hda_pintbl[]) {
  153. { 0x14, 0x0121401f }, /* HP */
  154. { 0x15, 0x99030120 }, /* speaker */
  155. { 0x16, 0x411111f0 }, /* N/A */
  156. { 0x17, 0x411111f0 }, /* N/A */
  157. { 0x18, 0x411111f0 }, /* N/A */
  158. { 0x19, 0x01a19950 }, /* mic-in */
  159. { 0x1a, 0x411111f0 }, /* N/A */
  160. { 0x1b, 0x411111f0 }, /* N/A */
  161. { 0x1c, 0x411111f0 }, /* N/A */
  162. { 0x1d, 0x411111f0 }, /* N/A */
  163. { 0x1e, 0x411111f0 }, /* N/A */
  164. { }
  165. },
  166. .chained = true,
  167. .chain_id = ALC880_FIXUP_VOL_KNOB,
  168. },
  169. [ALC880_FIXUP_UNIWILL] = {
  170. /* need to fix HP and speaker pins to be parsed correctly */
  171. .type = HDA_FIXUP_PINS,
  172. .v.pins = (const struct hda_pintbl[]) {
  173. { 0x14, 0x0121411f }, /* HP */
  174. { 0x15, 0x99030120 }, /* speaker */
  175. { 0x16, 0x99030130 }, /* bass speaker */
  176. { }
  177. },
  178. },
  179. [ALC880_FIXUP_UNIWILL_DIG] = {
  180. .type = HDA_FIXUP_PINS,
  181. .v.pins = (const struct hda_pintbl[]) {
  182. /* disable bogus unused pins */
  183. { 0x17, 0x411111f0 },
  184. { 0x19, 0x411111f0 },
  185. { 0x1b, 0x411111f0 },
  186. { 0x1f, 0x411111f0 },
  187. { }
  188. }
  189. },
  190. [ALC880_FIXUP_Z71V] = {
  191. .type = HDA_FIXUP_PINS,
  192. .v.pins = (const struct hda_pintbl[]) {
  193. /* set up the whole pins as BIOS is utterly broken */
  194. { 0x14, 0x99030120 }, /* speaker */
  195. { 0x15, 0x0121411f }, /* HP */
  196. { 0x16, 0x411111f0 }, /* N/A */
  197. { 0x17, 0x411111f0 }, /* N/A */
  198. { 0x18, 0x01a19950 }, /* mic-in */
  199. { 0x19, 0x411111f0 }, /* N/A */
  200. { 0x1a, 0x01813031 }, /* line-in */
  201. { 0x1b, 0x411111f0 }, /* N/A */
  202. { 0x1c, 0x411111f0 }, /* N/A */
  203. { 0x1d, 0x411111f0 }, /* N/A */
  204. { 0x1e, 0x0144111e }, /* SPDIF */
  205. { }
  206. }
  207. },
  208. [ALC880_FIXUP_ASUS_W5A] = {
  209. .type = HDA_FIXUP_PINS,
  210. .v.pins = (const struct hda_pintbl[]) {
  211. /* set up the whole pins as BIOS is utterly broken */
  212. { 0x14, 0x0121411f }, /* HP */
  213. { 0x15, 0x411111f0 }, /* N/A */
  214. { 0x16, 0x411111f0 }, /* N/A */
  215. { 0x17, 0x411111f0 }, /* N/A */
  216. { 0x18, 0x90a60160 }, /* mic */
  217. { 0x19, 0x411111f0 }, /* N/A */
  218. { 0x1a, 0x411111f0 }, /* N/A */
  219. { 0x1b, 0x411111f0 }, /* N/A */
  220. { 0x1c, 0x411111f0 }, /* N/A */
  221. { 0x1d, 0x411111f0 }, /* N/A */
  222. { 0x1e, 0xb743111e }, /* SPDIF out */
  223. { }
  224. },
  225. .chained = true,
  226. .chain_id = ALC880_FIXUP_GPIO1,
  227. },
  228. [ALC880_FIXUP_3ST_BASE] = {
  229. .type = HDA_FIXUP_PINS,
  230. .v.pins = (const struct hda_pintbl[]) {
  231. { 0x14, 0x01014010 }, /* line-out */
  232. { 0x15, 0x411111f0 }, /* N/A */
  233. { 0x16, 0x411111f0 }, /* N/A */
  234. { 0x17, 0x411111f0 }, /* N/A */
  235. { 0x18, 0x01a19c30 }, /* mic-in */
  236. { 0x19, 0x0121411f }, /* HP */
  237. { 0x1a, 0x01813031 }, /* line-in */
  238. { 0x1b, 0x02a19c40 }, /* front-mic */
  239. { 0x1c, 0x411111f0 }, /* N/A */
  240. { 0x1d, 0x411111f0 }, /* N/A */
  241. /* 0x1e is filled in below */
  242. { 0x1f, 0x411111f0 }, /* N/A */
  243. { }
  244. }
  245. },
  246. [ALC880_FIXUP_3ST] = {
  247. .type = HDA_FIXUP_PINS,
  248. .v.pins = (const struct hda_pintbl[]) {
  249. { 0x1e, 0x411111f0 }, /* N/A */
  250. { }
  251. },
  252. .chained = true,
  253. .chain_id = ALC880_FIXUP_3ST_BASE,
  254. },
  255. [ALC880_FIXUP_3ST_DIG] = {
  256. .type = HDA_FIXUP_PINS,
  257. .v.pins = (const struct hda_pintbl[]) {
  258. { 0x1e, 0x0144111e }, /* SPDIF */
  259. { }
  260. },
  261. .chained = true,
  262. .chain_id = ALC880_FIXUP_3ST_BASE,
  263. },
  264. [ALC880_FIXUP_5ST_BASE] = {
  265. .type = HDA_FIXUP_PINS,
  266. .v.pins = (const struct hda_pintbl[]) {
  267. { 0x14, 0x01014010 }, /* front */
  268. { 0x15, 0x411111f0 }, /* N/A */
  269. { 0x16, 0x01011411 }, /* CLFE */
  270. { 0x17, 0x01016412 }, /* surr */
  271. { 0x18, 0x01a19c30 }, /* mic-in */
  272. { 0x19, 0x0121411f }, /* HP */
  273. { 0x1a, 0x01813031 }, /* line-in */
  274. { 0x1b, 0x02a19c40 }, /* front-mic */
  275. { 0x1c, 0x411111f0 }, /* N/A */
  276. { 0x1d, 0x411111f0 }, /* N/A */
  277. /* 0x1e is filled in below */
  278. { 0x1f, 0x411111f0 }, /* N/A */
  279. { }
  280. }
  281. },
  282. [ALC880_FIXUP_5ST] = {
  283. .type = HDA_FIXUP_PINS,
  284. .v.pins = (const struct hda_pintbl[]) {
  285. { 0x1e, 0x411111f0 }, /* N/A */
  286. { }
  287. },
  288. .chained = true,
  289. .chain_id = ALC880_FIXUP_5ST_BASE,
  290. },
  291. [ALC880_FIXUP_5ST_DIG] = {
  292. .type = HDA_FIXUP_PINS,
  293. .v.pins = (const struct hda_pintbl[]) {
  294. { 0x1e, 0x0144111e }, /* SPDIF */
  295. { }
  296. },
  297. .chained = true,
  298. .chain_id = ALC880_FIXUP_5ST_BASE,
  299. },
  300. [ALC880_FIXUP_6ST_BASE] = {
  301. .type = HDA_FIXUP_PINS,
  302. .v.pins = (const struct hda_pintbl[]) {
  303. { 0x14, 0x01014010 }, /* front */
  304. { 0x15, 0x01016412 }, /* surr */
  305. { 0x16, 0x01011411 }, /* CLFE */
  306. { 0x17, 0x01012414 }, /* side */
  307. { 0x18, 0x01a19c30 }, /* mic-in */
  308. { 0x19, 0x02a19c40 }, /* front-mic */
  309. { 0x1a, 0x01813031 }, /* line-in */
  310. { 0x1b, 0x0121411f }, /* HP */
  311. { 0x1c, 0x411111f0 }, /* N/A */
  312. { 0x1d, 0x411111f0 }, /* N/A */
  313. /* 0x1e is filled in below */
  314. { 0x1f, 0x411111f0 }, /* N/A */
  315. { }
  316. }
  317. },
  318. [ALC880_FIXUP_6ST] = {
  319. .type = HDA_FIXUP_PINS,
  320. .v.pins = (const struct hda_pintbl[]) {
  321. { 0x1e, 0x411111f0 }, /* N/A */
  322. { }
  323. },
  324. .chained = true,
  325. .chain_id = ALC880_FIXUP_6ST_BASE,
  326. },
  327. [ALC880_FIXUP_6ST_DIG] = {
  328. .type = HDA_FIXUP_PINS,
  329. .v.pins = (const struct hda_pintbl[]) {
  330. { 0x1e, 0x0144111e }, /* SPDIF */
  331. { }
  332. },
  333. .chained = true,
  334. .chain_id = ALC880_FIXUP_6ST_BASE,
  335. },
  336. [ALC880_FIXUP_6ST_AUTOMUTE] = {
  337. .type = HDA_FIXUP_PINS,
  338. .v.pins = (const struct hda_pintbl[]) {
  339. { 0x1b, 0x0121401f }, /* HP with jack detect */
  340. { }
  341. },
  342. .chained_before = true,
  343. .chain_id = ALC880_FIXUP_6ST_BASE,
  344. },
  345. };
  346. static const struct hda_quirk alc880_fixup_tbl[] = {
  347. SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
  348. SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
  349. SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
  350. SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
  351. SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
  352. SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
  353. SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
  354. SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
  355. SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
  356. SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
  357. SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
  358. SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
  359. SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
  360. SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
  361. SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
  362. SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
  363. SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
  364. SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
  365. SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
  366. SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
  367. SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
  368. SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
  369. SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
  370. /* Below is the copied entries from alc880_quirks.c.
  371. * It's not quite sure whether BIOS sets the correct pin-config table
  372. * on these machines, thus they are kept to be compatible with
  373. * the old static quirks. Once when it's confirmed to work without
  374. * these overrides, it'd be better to remove.
  375. */
  376. SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
  377. SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
  378. SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
  379. SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
  380. SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
  381. SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
  382. SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
  383. SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
  384. SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
  385. SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
  386. SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
  387. SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
  388. SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
  389. SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
  390. SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
  391. SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
  392. SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
  393. SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
  394. SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
  395. SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
  396. SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
  397. SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
  398. SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
  399. SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
  400. SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
  401. SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
  402. SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
  403. SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
  404. SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
  405. SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
  406. SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
  407. SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
  408. SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
  409. /* default Intel */
  410. SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
  411. SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
  412. SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
  413. {}
  414. };
  415. static const struct hda_model_fixup alc880_fixup_models[] = {
  416. {.id = ALC880_FIXUP_3ST, .name = "3stack"},
  417. {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
  418. {.id = ALC880_FIXUP_5ST, .name = "5stack"},
  419. {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
  420. {.id = ALC880_FIXUP_6ST, .name = "6stack"},
  421. {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
  422. {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
  423. {}
  424. };
  425. /*
  426. * OK, here we have finally the probe for ALC880
  427. */
  428. static int alc880_probe(struct hda_codec *codec, const struct hda_device_id *id)
  429. {
  430. struct alc_spec *spec;
  431. int err;
  432. err = alc_alloc_spec(codec, 0x0b);
  433. if (err < 0)
  434. return err;
  435. spec = codec->spec;
  436. spec->gen.need_dac_fix = 1;
  437. spec->gen.beep_nid = 0x01;
  438. alc_pre_init(codec);
  439. snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
  440. alc880_fixups);
  441. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  442. /* automatic parse from the BIOS config */
  443. err = alc880_parse_auto_config(codec);
  444. if (err < 0)
  445. goto error;
  446. if (!spec->gen.no_analog) {
  447. err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
  448. if (err < 0)
  449. goto error;
  450. }
  451. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
  452. return 0;
  453. error:
  454. snd_hda_gen_remove(codec);
  455. return err;
  456. }
  457. static const struct hda_codec_ops alc880_codec_ops = {
  458. .probe = alc880_probe,
  459. .remove = snd_hda_gen_remove,
  460. .build_controls = alc_build_controls,
  461. .build_pcms = snd_hda_gen_build_pcms,
  462. .init = alc_init,
  463. .unsol_event = alc880_unsol_event,
  464. .resume = alc_resume,
  465. .suspend = alc_suspend,
  466. .check_power_status = snd_hda_gen_check_power_status,
  467. .stream_pm = snd_hda_gen_stream_pm,
  468. };
  469. /*
  470. * driver entries
  471. */
  472. static const struct hda_device_id snd_hda_id_alc880[] = {
  473. HDA_CODEC_ID(0x10ec0880, "ALC880"),
  474. {} /* terminator */
  475. };
  476. MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_alc880);
  477. MODULE_LICENSE("GPL");
  478. MODULE_DESCRIPTION("Realtek ALC880 HD-audio codec");
  479. MODULE_IMPORT_NS("SND_HDA_CODEC_REALTEK");
  480. static struct hda_codec_driver alc880_driver = {
  481. .id = snd_hda_id_alc880,
  482. .ops = &alc880_codec_ops,
  483. };
  484. module_hda_codec_driver(alc880_driver);