aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r--sound/pci/hda/patch_realtek.c176
1 files changed, 167 insertions, 9 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 6ec56c62cb18..f52e271edd57 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -230,6 +230,7 @@ enum {
230 ALC883_MITAC, 230 ALC883_MITAC,
231 ALC883_CLEVO_M720, 231 ALC883_CLEVO_M720,
232 ALC883_FUJITSU_PI2515, 232 ALC883_FUJITSU_PI2515,
233 ALC888_FUJITSU_XA3530,
233 ALC883_3ST_6ch_INTEL, 234 ALC883_3ST_6ch_INTEL,
234 ALC888_ASUS_M90V, 235 ALC888_ASUS_M90V,
235 ALC888_ASUS_EEE1601, 236 ALC888_ASUS_EEE1601,
@@ -1156,6 +1157,141 @@ static void alc_fix_pincfg(struct hda_codec *codec,
1156} 1157}
1157 1158
1158/* 1159/*
1160 * ALC888
1161 */
1162
1163/*
1164 * 2ch mode
1165 */
1166static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1167/* Mic-in jack as mic in */
1168 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1169 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1170/* Line-in jack as Line in */
1171 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1172 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1173/* Line-Out as Front */
1174 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1175 { } /* end */
1176};
1177
1178/*
1179 * 4ch mode
1180 */
1181static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1182/* Mic-in jack as mic in */
1183 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1184 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1185/* Line-in jack as Surround */
1186 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1187 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1188/* Line-Out as Front */
1189 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1190 { } /* end */
1191};
1192
1193/*
1194 * 6ch mode
1195 */
1196static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1197/* Mic-in jack as CLFE */
1198 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1199 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1200/* Line-in jack as Surround */
1201 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1202 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1203/* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1204 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1205 { } /* end */
1206};
1207
1208/*
1209 * 8ch mode
1210 */
1211static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1212/* Mic-in jack as CLFE */
1213 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1214 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1215/* Line-in jack as Surround */
1216 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1217 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1218/* Line-Out as Side */
1219 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1220 { } /* end */
1221};
1222
1223static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1224 { 2, alc888_4ST_ch2_intel_init },
1225 { 4, alc888_4ST_ch4_intel_init },
1226 { 6, alc888_4ST_ch6_intel_init },
1227 { 8, alc888_4ST_ch8_intel_init },
1228};
1229
1230/*
1231 * ALC888 Fujitsu Siemens Amillo xa3530
1232 */
1233
1234static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1235/* Front Mic: set to PIN_IN (empty by default) */
1236 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1237/* Connect Internal HP to Front */
1238 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1239 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1240 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1241/* Connect Bass HP to Front */
1242 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1243 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1244 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1245/* Connect Line-Out side jack (SPDIF) to Side */
1246 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1247 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1248 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1249/* Connect Mic jack to CLFE */
1250 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1251 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1252 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1253/* Connect Line-in jack to Surround */
1254 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1255 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1256 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1257/* Connect HP out jack to Front */
1258 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1259 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1260 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1261/* Enable unsolicited event for HP jack and Line-out jack */
1262 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1263 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1264 {}
1265};
1266
1267static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec)
1268{
1269 unsigned int present;
1270 unsigned int bits;
1271 /* Line out presence */
1272 present = snd_hda_codec_read(codec, 0x17, 0,
1273 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1274 /* HP out presence */
1275 present = present || snd_hda_codec_read(codec, 0x1b, 0,
1276 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1277 bits = present ? HDA_AMP_MUTE : 0;
1278 /* Toggle internal speakers muting */
1279 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1280 HDA_AMP_MUTE, bits);
1281 /* Toggle internal bass muting */
1282 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1283 HDA_AMP_MUTE, bits);
1284}
1285
1286static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec,
1287 unsigned int res)
1288{
1289 if (res >> 26 == ALC880_HP_EVENT)
1290 alc888_fujitsu_xa3530_automute(codec);
1291}
1292
1293
1294/*
1159 * ALC888 Acer Aspire 4930G model 1295 * ALC888 Acer Aspire 4930G model
1160 */ 1296 */
1161 1297
@@ -1164,7 +1300,7 @@ static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1164 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1300 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1165/* Unselect Front Mic by default in input mixer 3 */ 1301/* Unselect Front Mic by default in input mixer 3 */
1166 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, 1302 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1167/* enable unsolicited event fpr HP jack */ 1303/* Enable unsolicited event for HP jack */
1168 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 1304 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1169/* Connect Internal HP to front */ 1305/* Connect Internal HP to front */
1170 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1306 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
@@ -1177,7 +1313,7 @@ static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1177 { } 1313 { }
1178}; 1314};
1179 1315
1180static struct hda_input_mux alc888_acer_aspire_4930g_capture_source[2] = { 1316static struct hda_input_mux alc888_2_capture_sources[2] = {
1181 /* Front mic only available on one ADC */ 1317 /* Front mic only available on one ADC */
1182 { 1318 {
1183 .num_items = 4, 1319 .num_items = 4,
@@ -1198,7 +1334,7 @@ static struct hda_input_mux alc888_acer_aspire_4930g_capture_source[2] = {
1198 } 1334 }
1199}; 1335};
1200 1336
1201static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = { 1337static struct snd_kcontrol_new alc888_base_mixer[] = {
1202 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 1338 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1203 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 1339 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1204 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 1340 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
@@ -1225,11 +1361,12 @@ static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
1225static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec) 1361static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec)
1226{ 1362{
1227 unsigned int present; 1363 unsigned int present;
1364 unsigned int bits;
1228 present = snd_hda_codec_read(codec, 0x15, 0, 1365 present = snd_hda_codec_read(codec, 0x15, 0,
1229 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1366 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1230 /* Toggle the internal HP PIN (regular muting doesn't work) */ 1367 bits = present ? HDA_AMP_MUTE : 0;
1231 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 1368 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1232 (present ? 0x0 : PIN_OUT)); 1369 HDA_AMP_MUTE, bits);
1233} 1370}
1234 1371
1235static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec, 1372static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec,
@@ -8286,6 +8423,7 @@ static const char *alc883_models[ALC883_MODEL_LAST] = {
8286 [ALC883_MITAC] = "mitac", 8423 [ALC883_MITAC] = "mitac",
8287 [ALC883_CLEVO_M720] = "clevo-m720", 8424 [ALC883_CLEVO_M720] = "clevo-m720",
8288 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", 8425 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8426 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8289 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", 8427 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8290 [ALC1200_ASUS_P5Q] = "asus-p5q", 8428 [ALC1200_ASUS_P5Q] = "asus-p5q",
8291 [ALC883_AUTO] = "auto", 8429 [ALC883_AUTO] = "auto",
@@ -8346,6 +8484,8 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
8346 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), 8484 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8347 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), 8485 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8348 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), 8486 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
8487 SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530",
8488 ALC888_FUJITSU_XA3530),
8349 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), 8489 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8350 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), 8490 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8351 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), 8491 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
@@ -8472,7 +8612,7 @@ static struct alc_config_preset alc883_presets[] = {
8472 .init_hook = alc883_acer_aspire_automute, 8612 .init_hook = alc883_acer_aspire_automute,
8473 }, 8613 },
8474 [ALC888_ACER_ASPIRE_4930G] = { 8614 [ALC888_ACER_ASPIRE_4930G] = {
8475 .mixers = { alc888_acer_aspire_4930g_mixer, 8615 .mixers = { alc888_base_mixer,
8476 alc883_chmode_mixer }, 8616 alc883_chmode_mixer },
8477 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, 8617 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8478 alc888_acer_aspire_4930g_verbs }, 8618 alc888_acer_aspire_4930g_verbs },
@@ -8486,8 +8626,8 @@ static struct alc_config_preset alc883_presets[] = {
8486 .channel_mode = alc883_3ST_6ch_modes, 8626 .channel_mode = alc883_3ST_6ch_modes,
8487 .need_dac_fix = 1, 8627 .need_dac_fix = 1,
8488 .num_mux_defs = 8628 .num_mux_defs =
8489 ARRAY_SIZE(alc888_acer_aspire_4930g_capture_source), 8629 ARRAY_SIZE(alc888_2_capture_sources),
8490 .input_mux = alc888_acer_aspire_4930g_capture_source, 8630 .input_mux = alc888_2_capture_sources,
8491 .unsol_event = alc888_acer_aspire_4930g_unsol_event, 8631 .unsol_event = alc888_acer_aspire_4930g_unsol_event,
8492 .init_hook = alc888_acer_aspire_4930g_automute, 8632 .init_hook = alc888_acer_aspire_4930g_automute,
8493 }, 8633 },
@@ -8634,6 +8774,24 @@ static struct alc_config_preset alc883_presets[] = {
8634 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, 8774 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8635 .init_hook = alc883_2ch_fujitsu_pi2515_automute, 8775 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8636 }, 8776 },
8777 [ALC888_FUJITSU_XA3530] = {
8778 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
8779 .init_verbs = { alc883_init_verbs,
8780 alc888_fujitsu_xa3530_verbs },
8781 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8782 .dac_nids = alc883_dac_nids,
8783 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8784 .adc_nids = alc883_adc_nids_rev,
8785 .capsrc_nids = alc883_capsrc_nids_rev,
8786 .dig_out_nid = ALC883_DIGOUT_NID,
8787 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
8788 .channel_mode = alc888_4ST_8ch_intel_modes,
8789 .num_mux_defs =
8790 ARRAY_SIZE(alc888_2_capture_sources),
8791 .input_mux = alc888_2_capture_sources,
8792 .unsol_event = alc888_fujitsu_xa3530_unsol_event,
8793 .init_hook = alc888_fujitsu_xa3530_automute,
8794 },
8637 [ALC888_LENOVO_SKY] = { 8795 [ALC888_LENOVO_SKY] = {
8638 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, 8796 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
8639 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, 8797 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},