alc268_quirks.c 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. /*
  2. * ALC267/ALC268 quirk models
  3. * included by patch_realtek.c
  4. */
  5. /* ALC268 models */
  6. enum {
  7. ALC268_AUTO,
  8. ALC267_QUANTA_IL1,
  9. ALC268_3ST,
  10. #ifdef CONFIG_SND_DEBUG
  11. ALC268_TEST,
  12. #endif
  13. ALC268_MODEL_LAST /* last tag */
  14. };
  15. /*
  16. * ALC268 channel source setting (2 channel)
  17. */
  18. #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
  19. #define alc268_modes alc260_modes
  20. static const hda_nid_t alc268_dac_nids[2] = {
  21. /* front, hp */
  22. 0x02, 0x03
  23. };
  24. static const hda_nid_t alc268_adc_nids[2] = {
  25. /* ADC0-1 */
  26. 0x08, 0x07
  27. };
  28. static const hda_nid_t alc268_adc_nids_alt[1] = {
  29. /* ADC0 */
  30. 0x08
  31. };
  32. static const hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
  33. static const struct snd_kcontrol_new alc268_base_mixer[] = {
  34. /* output mixer control */
  35. HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
  36. HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
  37. HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
  38. HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
  39. HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
  40. HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
  41. HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
  42. { }
  43. };
  44. static const struct hda_verb alc268_eapd_verbs[] = {
  45. {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
  46. {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
  47. { }
  48. };
  49. static const struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
  50. HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
  51. HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
  52. HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
  53. HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
  54. HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
  55. HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
  56. HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
  57. HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
  58. { }
  59. };
  60. static const struct hda_verb alc267_quanta_il1_verbs[] = {
  61. {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
  62. {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_MIC_EVENT | AC_USRSP_EN},
  63. { }
  64. };
  65. static void alc267_quanta_il1_setup(struct hda_codec *codec)
  66. {
  67. struct alc_spec *spec = codec->spec;
  68. spec->autocfg.hp_pins[0] = 0x15;
  69. spec->autocfg.speaker_pins[0] = 0x14;
  70. spec->ext_mic_pin = 0x18;
  71. spec->int_mic_pin = 0x19;
  72. spec->auto_mic = 1;
  73. spec->automute = 1;
  74. spec->automute_mode = ALC_AUTOMUTE_PIN;
  75. }
  76. /*
  77. * generic initialization of ADC, input mixers and output mixers
  78. */
  79. static const struct hda_verb alc268_base_init_verbs[] = {
  80. /* Unmute DAC0-1 and set vol = 0 */
  81. {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  82. {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  83. /*
  84. * Set up output mixers (0x0c - 0x0e)
  85. */
  86. /* set vol=0 to output mixers */
  87. {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  88. {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
  89. {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  90. {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  91. {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
  92. {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
  93. {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
  94. {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
  95. {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
  96. {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
  97. {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
  98. {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
  99. {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
  100. {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
  101. {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
  102. {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
  103. {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
  104. /* set PCBEEP vol = 0, mute connections */
  105. {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  106. {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  107. {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  108. /* Unmute Selector 23h,24h and set the default input to mic-in */
  109. {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
  110. {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  111. {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
  112. {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  113. { }
  114. };
  115. /* only for model=test */
  116. #ifdef CONFIG_SND_DEBUG
  117. /*
  118. * generic initialization of ADC, input mixers and output mixers
  119. */
  120. static const struct hda_verb alc268_volume_init_verbs[] = {
  121. /* set output DAC */
  122. {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  123. {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  124. {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
  125. {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
  126. {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
  127. {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
  128. {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
  129. {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  130. {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  131. {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  132. {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
  133. {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
  134. { }
  135. };
  136. #endif /* CONFIG_SND_DEBUG */
  137. static const struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
  138. HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
  139. HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
  140. { } /* end */
  141. };
  142. static const struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
  143. HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
  144. HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
  145. _DEFINE_CAPSRC(1),
  146. { } /* end */
  147. };
  148. static const struct snd_kcontrol_new alc268_capture_mixer[] = {
  149. HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
  150. HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
  151. HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
  152. HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
  153. _DEFINE_CAPSRC(2),
  154. { } /* end */
  155. };
  156. static const struct hda_input_mux alc268_capture_source = {
  157. .num_items = 4,
  158. .items = {
  159. { "Mic", 0x0 },
  160. { "Front Mic", 0x1 },
  161. { "Line", 0x2 },
  162. { "CD", 0x3 },
  163. },
  164. };
  165. #ifdef CONFIG_SND_DEBUG
  166. static const struct snd_kcontrol_new alc268_test_mixer[] = {
  167. /* Volume widgets */
  168. HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
  169. HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
  170. HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
  171. HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
  172. HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
  173. HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
  174. HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
  175. HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
  176. HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
  177. HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
  178. HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
  179. HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
  180. HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
  181. /* The below appears problematic on some hardwares */
  182. /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
  183. HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
  184. HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
  185. HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
  186. HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
  187. /* Modes for retasking pin widgets */
  188. ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
  189. ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
  190. ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
  191. ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
  192. /* Controls for GPIO pins, assuming they are configured as outputs */
  193. ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
  194. ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
  195. ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
  196. ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
  197. /* Switches to allow the digital SPDIF output pin to be enabled.
  198. * The ALC268 does not have an SPDIF input.
  199. */
  200. ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
  201. /* A switch allowing EAPD to be enabled. Some laptops seem to use
  202. * this output to turn on an external amplifier.
  203. */
  204. ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
  205. ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
  206. { } /* end */
  207. };
  208. #endif
  209. /*
  210. * configuration and preset
  211. */
  212. static const char * const alc268_models[ALC268_MODEL_LAST] = {
  213. [ALC267_QUANTA_IL1] = "quanta-il1",
  214. [ALC268_3ST] = "3stack",
  215. #ifdef CONFIG_SND_DEBUG
  216. [ALC268_TEST] = "test",
  217. #endif
  218. [ALC268_AUTO] = "auto",
  219. };
  220. static const struct snd_pci_quirk alc268_cfg_tbl[] = {
  221. SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
  222. SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
  223. {}
  224. };
  225. static const struct alc_config_preset alc268_presets[] = {
  226. [ALC267_QUANTA_IL1] = {
  227. .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
  228. .cap_mixer = alc268_capture_nosrc_mixer,
  229. .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
  230. alc267_quanta_il1_verbs },
  231. .num_dacs = ARRAY_SIZE(alc268_dac_nids),
  232. .dac_nids = alc268_dac_nids,
  233. .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
  234. .adc_nids = alc268_adc_nids_alt,
  235. .hp_nid = 0x03,
  236. .num_channel_mode = ARRAY_SIZE(alc268_modes),
  237. .channel_mode = alc268_modes,
  238. .unsol_event = alc_sku_unsol_event,
  239. .setup = alc267_quanta_il1_setup,
  240. .init_hook = alc_inithook,
  241. },
  242. [ALC268_3ST] = {
  243. .mixers = { alc268_base_mixer, alc268_beep_mixer },
  244. .cap_mixer = alc268_capture_alt_mixer,
  245. .init_verbs = { alc268_base_init_verbs },
  246. .num_dacs = ARRAY_SIZE(alc268_dac_nids),
  247. .dac_nids = alc268_dac_nids,
  248. .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
  249. .adc_nids = alc268_adc_nids_alt,
  250. .capsrc_nids = alc268_capsrc_nids,
  251. .hp_nid = 0x03,
  252. .dig_out_nid = ALC268_DIGOUT_NID,
  253. .num_channel_mode = ARRAY_SIZE(alc268_modes),
  254. .channel_mode = alc268_modes,
  255. .input_mux = &alc268_capture_source,
  256. },
  257. #ifdef CONFIG_SND_DEBUG
  258. [ALC268_TEST] = {
  259. .mixers = { alc268_test_mixer },
  260. .cap_mixer = alc268_capture_mixer,
  261. .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
  262. alc268_volume_init_verbs,
  263. alc268_beep_init_verbs },
  264. .num_dacs = ARRAY_SIZE(alc268_dac_nids),
  265. .dac_nids = alc268_dac_nids,
  266. .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
  267. .adc_nids = alc268_adc_nids_alt,
  268. .capsrc_nids = alc268_capsrc_nids,
  269. .hp_nid = 0x03,
  270. .dig_out_nid = ALC268_DIGOUT_NID,
  271. .num_channel_mode = ARRAY_SIZE(alc268_modes),
  272. .channel_mode = alc268_modes,
  273. .input_mux = &alc268_capture_source,
  274. },
  275. #endif
  276. };