alc882_quirks.c 31 KB

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