alc882_quirks.c 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874
  1. /*
  2. * ALC882/ALC883/ALC888/ALC889 quirk models
  3. * included by patch_realtek.c
  4. */
  5. /* ALC882 models */
  6. enum {
  7. ALC882_AUTO,
  8. ALC885_MBA21,
  9. ALC885_MBP3,
  10. ALC885_MB5,
  11. ALC885_MACMINI3,
  12. ALC885_IMAC91,
  13. ALC889A_MB31,
  14. ALC882_MODEL_LAST,
  15. };
  16. #define ALC882_DIGOUT_NID 0x06
  17. #define ALC882_DIGIN_NID 0x0a
  18. #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
  19. #define ALC883_DIGIN_NID ALC882_DIGIN_NID
  20. #define ALC1200_DIGOUT_NID 0x10
  21. static const struct hda_channel_mode alc882_ch_modes[1] = {
  22. { 8, NULL }
  23. };
  24. /* DACs */
  25. static const hda_nid_t alc882_dac_nids[4] = {
  26. /* front, rear, clfe, rear_surr */
  27. 0x02, 0x03, 0x04, 0x05
  28. };
  29. #define alc883_dac_nids alc882_dac_nids
  30. /* ADCs */
  31. static const hda_nid_t alc882_adc_nids[3] = {
  32. /* ADC0-2 */
  33. 0x07, 0x08, 0x09,
  34. };
  35. static const hda_nid_t alc882_adc_nids_alt[2] = {
  36. /* ADC1-2 */
  37. 0x08, 0x09,
  38. };
  39. #define alc883_adc_nids alc882_adc_nids_alt
  40. static const hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
  41. #define alc883_capsrc_nids alc882_capsrc_nids_alt
  42. /* input MUX */
  43. /* FIXME: should be a matrix-type input source selection */
  44. static const struct hda_input_mux alc882_capture_source = {
  45. .num_items = 4,
  46. .items = {
  47. { "Mic", 0x0 },
  48. { "Front Mic", 0x1 },
  49. { "Line", 0x2 },
  50. { "CD", 0x4 },
  51. },
  52. };
  53. #define alc883_capture_source alc882_capture_source
  54. static const struct hda_input_mux mb5_capture_source = {
  55. .num_items = 3,
  56. .items = {
  57. { "Mic", 0x1 },
  58. { "Line", 0x7 },
  59. { "CD", 0x4 },
  60. },
  61. };
  62. static const struct hda_input_mux macmini3_capture_source = {
  63. .num_items = 2,
  64. .items = {
  65. { "Line", 0x2 },
  66. { "CD", 0x4 },
  67. },
  68. };
  69. static const struct hda_input_mux alc883_3stack_6ch_intel = {
  70. .num_items = 4,
  71. .items = {
  72. { "Mic", 0x1 },
  73. { "Front Mic", 0x0 },
  74. { "Line", 0x2 },
  75. { "CD", 0x4 },
  76. },
  77. };
  78. static const struct hda_input_mux alc889A_mb31_capture_source = {
  79. .num_items = 2,
  80. .items = {
  81. { "Mic", 0x0 },
  82. /* Front Mic (0x01) unused */
  83. { "Line", 0x2 },
  84. /* Line 2 (0x03) unused */
  85. /* CD (0x04) unused? */
  86. },
  87. };
  88. static const struct hda_input_mux alc889A_imac91_capture_source = {
  89. .num_items = 2,
  90. .items = {
  91. { "Mic", 0x01 },
  92. { "Line", 0x2 }, /* Not sure! */
  93. },
  94. };
  95. /* Macbook Air 2,1 */
  96. static const struct hda_channel_mode alc885_mba21_ch_modes[1] = {
  97. { 2, NULL },
  98. };
  99. /*
  100. * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
  101. */
  102. /*
  103. * 2ch mode
  104. */
  105. static const struct hda_verb alc885_mbp_ch2_init[] = {
  106. { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
  107. { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  108. { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  109. { } /* end */
  110. };
  111. /*
  112. * 4ch mode
  113. */
  114. static const struct hda_verb alc885_mbp_ch4_init[] = {
  115. { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
  116. { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  117. { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
  118. { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  119. { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
  120. { } /* end */
  121. };
  122. static const struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
  123. { 2, alc885_mbp_ch2_init },
  124. { 4, alc885_mbp_ch4_init },
  125. };
  126. /*
  127. * 2ch
  128. * Speakers/Woofer/HP = Front
  129. * LineIn = Input
  130. */
  131. static const struct hda_verb alc885_mb5_ch2_init[] = {
  132. {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
  133. {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
  134. { } /* end */
  135. };
  136. /*
  137. * 6ch mode
  138. * Speakers/HP = Front
  139. * Woofer = LFE
  140. * LineIn = Surround
  141. */
  142. static const struct hda_verb alc885_mb5_ch6_init[] = {
  143. {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
  144. {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  145. {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
  146. { } /* end */
  147. };
  148. static const struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
  149. { 2, alc885_mb5_ch2_init },
  150. { 6, alc885_mb5_ch6_init },
  151. };
  152. #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
  153. /* Macbook Air 2,1 same control for HP and internal Speaker */
  154. static const struct snd_kcontrol_new alc885_mba21_mixer[] = {
  155. HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
  156. HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
  157. { }
  158. };
  159. static const struct snd_kcontrol_new alc885_mbp3_mixer[] = {
  160. HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
  161. HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
  162. HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
  163. HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
  164. HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
  165. HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
  166. HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
  167. HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
  168. HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
  169. HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
  170. HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
  171. { } /* end */
  172. };
  173. static const struct snd_kcontrol_new alc885_mb5_mixer[] = {
  174. HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
  175. HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
  176. HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
  177. HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
  178. HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
  179. HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
  180. HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
  181. HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
  182. HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
  183. HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
  184. HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
  185. HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
  186. HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
  187. HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT),
  188. { } /* end */
  189. };
  190. static const struct snd_kcontrol_new alc885_macmini3_mixer[] = {
  191. HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
  192. HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
  193. HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
  194. HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
  195. HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
  196. HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
  197. HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
  198. HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
  199. HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
  200. HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
  201. HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
  202. { } /* end */
  203. };
  204. static const struct snd_kcontrol_new alc885_imac91_mixer[] = {
  205. HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
  206. HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
  207. { } /* end */
  208. };
  209. static const struct snd_kcontrol_new alc882_chmode_mixer[] = {
  210. {
  211. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  212. .name = "Channel Mode",
  213. .info = alc_ch_mode_info,
  214. .get = alc_ch_mode_get,
  215. .put = alc_ch_mode_put,
  216. },
  217. { } /* end */
  218. };
  219. static const struct hda_verb alc882_base_init_verbs[] = {
  220. /* Front mixer: unmute input/output amp left and right (volume = 0) */
  221. {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  222. {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  223. /* Rear mixer */
  224. {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  225. {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  226. /* CLFE mixer */
  227. {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  228. {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  229. /* Side mixer */
  230. {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  231. {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  232. /* Front Pin: output 0 (0x0c) */
  233. {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
  234. {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  235. {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
  236. /* Rear Pin: output 1 (0x0d) */
  237. {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
  238. {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  239. {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
  240. /* CLFE Pin: output 2 (0x0e) */
  241. {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
  242. {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  243. {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
  244. /* Side Pin: output 3 (0x0f) */
  245. {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
  246. {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  247. {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
  248. /* Mic (rear) pin: input vref at 80% */
  249. {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
  250. {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
  251. /* Front Mic pin: input vref at 80% */
  252. {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
  253. {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
  254. /* Line In pin: input */
  255. {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
  256. {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
  257. /* Line-2 In: Headphone output (output 0 - 0x0c) */
  258. {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
  259. {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  260. {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
  261. /* CD pin widget for input */
  262. {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
  263. /* FIXME: use matrix-type input source selection */
  264. /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
  265. /* Input mixer2 */
  266. {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  267. /* Input mixer3 */
  268. {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  269. /* ADC2: mute amp left and right */
  270. {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  271. {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
  272. /* ADC3: mute amp left and right */
  273. {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  274. {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
  275. { }
  276. };
  277. #define alc883_init_verbs alc882_base_init_verbs
  278. /* Macbook 5,1 */
  279. static const struct hda_verb alc885_mb5_init_verbs[] = {
  280. /* DACs */
  281. {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  282. {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  283. {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  284. {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  285. /* Front mixer */
  286. {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  287. {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  288. {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  289. /* Surround mixer */
  290. {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  291. {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  292. {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  293. /* LFE mixer */
  294. {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  295. {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  296. {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  297. /* HP mixer */
  298. {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  299. {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  300. {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  301. /* Front Pin (0x0c) */
  302. {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
  303. {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  304. {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
  305. /* LFE Pin (0x0e) */
  306. {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
  307. {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  308. {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
  309. /* HP Pin (0x0f) */
  310. {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
  311. {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  312. {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
  313. {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
  314. /* Front Mic pin: input vref at 80% */
  315. {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
  316. {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
  317. /* Line In pin */
  318. {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
  319. {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
  320. {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
  321. {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
  322. {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
  323. { }
  324. };
  325. /* Macmini 3,1 */
  326. static const struct hda_verb alc885_macmini3_init_verbs[] = {
  327. /* DACs */
  328. {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  329. {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  330. {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  331. {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  332. /* Front mixer */
  333. {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  334. {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  335. {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  336. /* Surround mixer */
  337. {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  338. {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  339. {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  340. /* LFE mixer */
  341. {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  342. {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  343. {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  344. /* HP mixer */
  345. {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  346. {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  347. {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  348. /* Front Pin (0x0c) */
  349. {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
  350. {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  351. {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
  352. /* LFE Pin (0x0e) */
  353. {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
  354. {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  355. {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
  356. /* HP Pin (0x0f) */
  357. {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
  358. {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  359. {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
  360. {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
  361. /* Line In pin */
  362. {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
  363. {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
  364. {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
  365. {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
  366. {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
  367. {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
  368. { }
  369. };
  370. static const struct hda_verb alc885_mba21_init_verbs[] = {
  371. /*Internal and HP Speaker Mixer*/
  372. {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  373. {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  374. {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
  375. /*Internal Speaker Pin (0x0c)*/
  376. {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
  377. {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  378. {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
  379. /* HP Pin: output 0 (0x0e) */
  380. {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
  381. {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  382. {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
  383. {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC_HP_EVENT | AC_USRSP_EN)},
  384. /* Line in (is hp when jack connected)*/
  385. {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
  386. {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
  387. { }
  388. };
  389. /* Macbook Pro rev3 */
  390. static const struct hda_verb alc885_mbp3_init_verbs[] = {
  391. /* Front mixer: unmute input/output amp left and right (volume = 0) */
  392. {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  393. {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  394. {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  395. /* Rear mixer */
  396. {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  397. {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  398. {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  399. /* HP mixer */
  400. {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  401. {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  402. {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  403. /* Front Pin: output 0 (0x0c) */
  404. {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
  405. {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  406. {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
  407. /* HP Pin: output 0 (0x0e) */
  408. {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
  409. {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  410. {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
  411. {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
  412. /* Mic (rear) pin: input vref at 80% */
  413. {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
  414. {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
  415. /* Front Mic pin: input vref at 80% */
  416. {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
  417. {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
  418. /* Line In pin: use output 1 when in LineOut mode */
  419. {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
  420. {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
  421. {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
  422. /* FIXME: use matrix-type input source selection */
  423. /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
  424. /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
  425. {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  426. {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
  427. {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
  428. {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
  429. /* Input mixer2 */
  430. {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  431. {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
  432. {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
  433. {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
  434. /* Input mixer3 */
  435. {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  436. {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
  437. {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
  438. {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
  439. /* ADC1: mute amp left and right */
  440. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  441. {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
  442. /* ADC2: mute amp left and right */
  443. {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  444. {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
  445. /* ADC3: mute amp left and right */
  446. {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  447. {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
  448. { }
  449. };
  450. /* iMac 9,1 */
  451. static const struct hda_verb alc885_imac91_init_verbs[] = {
  452. /* Internal Speaker Pin (0x0c) */
  453. {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
  454. {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  455. {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
  456. {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
  457. {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  458. {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
  459. /* HP Pin: Rear */
  460. {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
  461. {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  462. {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
  463. {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC_HP_EVENT | AC_USRSP_EN)},
  464. /* Line in Rear */
  465. {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
  466. {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
  467. /* Front Mic pin: input vref at 80% */
  468. {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
  469. {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
  470. /* Rear mixer */
  471. {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  472. {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  473. {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  474. /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
  475. {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  476. {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  477. {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  478. /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
  479. {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  480. {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
  481. {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
  482. {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
  483. /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
  484. {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  485. {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
  486. {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
  487. {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
  488. /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
  489. {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  490. {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
  491. {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
  492. {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
  493. /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
  494. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  495. {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
  496. /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
  497. {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  498. {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
  499. /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
  500. {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  501. {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
  502. { }
  503. };
  504. /* Toggle speaker-output according to the hp-jack state */
  505. static void alc885_imac24_setup(struct hda_codec *codec)
  506. {
  507. struct alc_spec *spec = codec->spec;
  508. spec->autocfg.hp_pins[0] = 0x14;
  509. spec->autocfg.speaker_pins[0] = 0x18;
  510. spec->autocfg.speaker_pins[1] = 0x1a;
  511. alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
  512. }
  513. #define alc885_mb5_setup alc885_imac24_setup
  514. #define alc885_macmini3_setup alc885_imac24_setup
  515. /* Macbook Air 2,1 */
  516. static void alc885_mba21_setup(struct hda_codec *codec)
  517. {
  518. struct alc_spec *spec = codec->spec;
  519. spec->autocfg.hp_pins[0] = 0x14;
  520. spec->autocfg.speaker_pins[0] = 0x18;
  521. alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
  522. }
  523. static void alc885_mbp3_setup(struct hda_codec *codec)
  524. {
  525. struct alc_spec *spec = codec->spec;
  526. spec->autocfg.hp_pins[0] = 0x15;
  527. spec->autocfg.speaker_pins[0] = 0x14;
  528. alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
  529. }
  530. static void alc885_imac91_setup(struct hda_codec *codec)
  531. {
  532. struct alc_spec *spec = codec->spec;
  533. spec->autocfg.hp_pins[0] = 0x14;
  534. spec->autocfg.speaker_pins[0] = 0x18;
  535. spec->autocfg.speaker_pins[1] = 0x1a;
  536. alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
  537. }
  538. /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
  539. static const struct hda_verb alc889A_mb31_ch2_init[] = {
  540. {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
  541. {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
  542. {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
  543. {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
  544. { } /* end */
  545. };
  546. /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
  547. static const struct hda_verb alc889A_mb31_ch4_init[] = {
  548. {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
  549. {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
  550. {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
  551. {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
  552. { } /* end */
  553. };
  554. /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
  555. static const struct hda_verb alc889A_mb31_ch5_init[] = {
  556. {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
  557. {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
  558. {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
  559. {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
  560. { } /* end */
  561. };
  562. /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
  563. static const struct hda_verb alc889A_mb31_ch6_init[] = {
  564. {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
  565. {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
  566. {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
  567. {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
  568. { } /* end */
  569. };
  570. static const struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
  571. { 2, alc889A_mb31_ch2_init },
  572. { 4, alc889A_mb31_ch4_init },
  573. { 5, alc889A_mb31_ch5_init },
  574. { 6, alc889A_mb31_ch6_init },
  575. };
  576. static const struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
  577. HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
  578. HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
  579. HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
  580. HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
  581. HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
  582. HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
  583. HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
  584. HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
  585. HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
  586. HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
  587. HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
  588. HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
  589. HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
  590. HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
  591. HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
  592. HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
  593. HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
  594. HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
  595. HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
  596. { } /* end */
  597. };
  598. static const struct snd_kcontrol_new alc889A_mb31_mixer[] = {
  599. /* Output mixers */
  600. HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
  601. HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
  602. HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
  603. HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
  604. HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
  605. HDA_OUTPUT),
  606. HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
  607. HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
  608. HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
  609. /* Output switches */
  610. HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
  611. HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
  612. HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
  613. /* Boost mixers */
  614. HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
  615. HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
  616. /* Input mixers */
  617. HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
  618. HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
  619. HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
  620. HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
  621. { } /* end */
  622. };
  623. static const struct snd_kcontrol_new alc883_chmode_mixer[] = {
  624. {
  625. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  626. .name = "Channel Mode",
  627. .info = alc_ch_mode_info,
  628. .get = alc_ch_mode_get,
  629. .put = alc_ch_mode_put,
  630. },
  631. { } /* end */
  632. };
  633. static const struct hda_verb alc889A_mb31_verbs[] = {
  634. /* Init rear pin (used as headphone output) */
  635. {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
  636. {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
  637. {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
  638. /* Init line pin (used as output in 4ch and 6ch mode) */
  639. {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
  640. /* Init line 2 pin (used as headphone out by default) */
  641. {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
  642. {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
  643. { } /* end */
  644. };
  645. /* Mute speakers according to the headphone jack state */
  646. static void alc889A_mb31_automute(struct hda_codec *codec)
  647. {
  648. unsigned int present;
  649. /* Mute only in 2ch or 4ch mode */
  650. if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
  651. == 0x00) {
  652. present = snd_hda_jack_detect(codec, 0x15);
  653. snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
  654. HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
  655. snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
  656. HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
  657. }
  658. }
  659. static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
  660. {
  661. if ((res >> 26) == ALC_HP_EVENT)
  662. alc889A_mb31_automute(codec);
  663. }
  664. static void alc882_unsol_event(struct hda_codec *codec, unsigned int res)
  665. {
  666. alc_exec_unsol_event(codec, res >> 26);
  667. }
  668. /*
  669. * configuration and preset
  670. */
  671. static const char * const alc882_models[ALC882_MODEL_LAST] = {
  672. [ALC885_MB5] = "mb5",
  673. [ALC885_MACMINI3] = "macmini3",
  674. [ALC885_MBA21] = "mba21",
  675. [ALC885_MBP3] = "mbp3",
  676. [ALC885_IMAC91] = "imac91",
  677. [ALC889A_MB31] = "mb31",
  678. [ALC882_AUTO] = "auto",
  679. };
  680. /* codec SSID table for Intel Mac */
  681. static const struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
  682. SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
  683. SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
  684. SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
  685. SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
  686. SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
  687. SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
  688. SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
  689. SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
  690. SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
  691. SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
  692. SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
  693. SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
  694. /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
  695. * so apparently no perfect solution yet
  696. */
  697. SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
  698. SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
  699. SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
  700. {} /* terminator */
  701. };
  702. static const struct alc_config_preset alc882_presets[] = {
  703. [ALC885_MBA21] = {
  704. .mixers = { alc885_mba21_mixer },
  705. .init_verbs = { alc885_mba21_init_verbs, alc_gpio1_init_verbs },
  706. .num_dacs = 2,
  707. .dac_nids = alc882_dac_nids,
  708. .channel_mode = alc885_mba21_ch_modes,
  709. .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
  710. .input_mux = &alc882_capture_source,
  711. .unsol_event = alc882_unsol_event,
  712. .setup = alc885_mba21_setup,
  713. .init_hook = alc_hp_automute,
  714. },
  715. [ALC885_MBP3] = {
  716. .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
  717. .init_verbs = { alc885_mbp3_init_verbs,
  718. alc_gpio1_init_verbs },
  719. .num_dacs = 2,
  720. .dac_nids = alc882_dac_nids,
  721. .hp_nid = 0x04,
  722. .channel_mode = alc885_mbp_4ch_modes,
  723. .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
  724. .input_mux = &alc882_capture_source,
  725. .dig_out_nid = ALC882_DIGOUT_NID,
  726. .dig_in_nid = ALC882_DIGIN_NID,
  727. .unsol_event = alc882_unsol_event,
  728. .setup = alc885_mbp3_setup,
  729. .init_hook = alc_hp_automute,
  730. },
  731. [ALC885_MB5] = {
  732. .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
  733. .init_verbs = { alc885_mb5_init_verbs,
  734. alc_gpio1_init_verbs },
  735. .num_dacs = ARRAY_SIZE(alc882_dac_nids),
  736. .dac_nids = alc882_dac_nids,
  737. .channel_mode = alc885_mb5_6ch_modes,
  738. .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
  739. .input_mux = &mb5_capture_source,
  740. .dig_out_nid = ALC882_DIGOUT_NID,
  741. .dig_in_nid = ALC882_DIGIN_NID,
  742. .unsol_event = alc882_unsol_event,
  743. .setup = alc885_mb5_setup,
  744. .init_hook = alc_hp_automute,
  745. },
  746. [ALC885_MACMINI3] = {
  747. .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
  748. .init_verbs = { alc885_macmini3_init_verbs,
  749. alc_gpio1_init_verbs },
  750. .num_dacs = ARRAY_SIZE(alc882_dac_nids),
  751. .dac_nids = alc882_dac_nids,
  752. .channel_mode = alc885_macmini3_6ch_modes,
  753. .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
  754. .input_mux = &macmini3_capture_source,
  755. .dig_out_nid = ALC882_DIGOUT_NID,
  756. .dig_in_nid = ALC882_DIGIN_NID,
  757. .unsol_event = alc882_unsol_event,
  758. .setup = alc885_macmini3_setup,
  759. .init_hook = alc_hp_automute,
  760. },
  761. [ALC885_IMAC91] = {
  762. .mixers = {alc885_imac91_mixer},
  763. .init_verbs = { alc885_imac91_init_verbs,
  764. alc_gpio1_init_verbs },
  765. .num_dacs = ARRAY_SIZE(alc882_dac_nids),
  766. .dac_nids = alc882_dac_nids,
  767. .channel_mode = alc885_mba21_ch_modes,
  768. .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
  769. .input_mux = &alc889A_imac91_capture_source,
  770. .dig_out_nid = ALC882_DIGOUT_NID,
  771. .dig_in_nid = ALC882_DIGIN_NID,
  772. .unsol_event = alc882_unsol_event,
  773. .setup = alc885_imac91_setup,
  774. .init_hook = alc_hp_automute,
  775. },
  776. [ALC889A_MB31] = {
  777. .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
  778. .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
  779. alc_gpio1_init_verbs },
  780. .adc_nids = alc883_adc_nids,
  781. .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
  782. .capsrc_nids = alc883_capsrc_nids,
  783. .dac_nids = alc883_dac_nids,
  784. .num_dacs = ARRAY_SIZE(alc883_dac_nids),
  785. .channel_mode = alc889A_mb31_6ch_modes,
  786. .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
  787. .input_mux = &alc889A_mb31_capture_source,
  788. .dig_out_nid = ALC883_DIGOUT_NID,
  789. .unsol_event = alc889A_mb31_unsol_event,
  790. .init_hook = alc889A_mb31_automute,
  791. },
  792. };