aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-04-28 06:18:53 -0400
committerTakashi Iwai <tiwai@suse.de>2011-04-28 08:45:19 -0400
commitd922b51dabbe9b6aeee44e2e3a605323591e3707 (patch)
tree34c22e8a62f5b12d1ebc1a76402f61e36e9cba12 /sound/pci/hda/patch_realtek.c
parentce764ab22e40a046065c9417ee5f04ad2a816ac1 (diff)
ALSA: hda - Consolidate default automute functions for Realtek
There are two entry points for the headphone automute functions for Realtek, alc_automute_amp() and alc_automute_pin(). These call the same function in the end, so we can basically consolidate these with a flag in spec. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r--sound/pci/hda/patch_realtek.c260
1 files changed, 163 insertions, 97 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 4c4d51a220b3..5715b6f3e2a9 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -305,6 +305,11 @@ struct alc_multi_io {
305 unsigned int ctl_in; /* cached input-pin control value */ 305 unsigned int ctl_in; /* cached input-pin control value */
306}; 306};
307 307
308enum {
309 ALC_AUTOMUTE_PIN,
310 ALC_AUTOMUTE_AMP,
311};
312
308struct alc_spec { 313struct alc_spec {
309 /* codec parameterization */ 314 /* codec parameterization */
310 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ 315 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
@@ -388,11 +393,16 @@ struct alc_spec {
388 unsigned int jack_present: 1; 393 unsigned int jack_present: 1;
389 unsigned int master_sw: 1; 394 unsigned int master_sw: 1;
390 unsigned int auto_mic:1; 395 unsigned int auto_mic:1;
396 unsigned int automute:1; /* HP automute enabled */
391 397
392 /* other flags */ 398 /* other flags */
393 unsigned int no_analog :1; /* digital I/O only */ 399 unsigned int no_analog :1; /* digital I/O only */
394 unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ 400 unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */
395 unsigned int single_input_src:1; 401 unsigned int single_input_src:1;
402
403 /* auto-mute control */
404 int automute_mode;
405
396 int init_amp; 406 int init_amp;
397 int codec_variant; /* flag for other variants */ 407 int codec_variant; /* flag for other variants */
398 408
@@ -1062,13 +1072,16 @@ static int alc_init_jacks(struct hda_codec *codec)
1062 return 0; 1072 return 0;
1063} 1073}
1064 1074
1065static void alc_automute_speaker(struct hda_codec *codec, int pinctl) 1075static void alc_hp_automute(struct hda_codec *codec)
1066{ 1076{
1067 struct alc_spec *spec = codec->spec; 1077 struct alc_spec *spec = codec->spec;
1068 unsigned int mute; 1078 unsigned int mute;
1069 hda_nid_t nid; 1079 hda_nid_t nid;
1070 int i; 1080 int i;
1071 1081
1082 if (!spec->automute)
1083 return;
1084
1072 spec->jack_present = 0; 1085 spec->jack_present = 0;
1073 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { 1086 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1074 nid = spec->autocfg.hp_pins[i]; 1087 nid = spec->autocfg.hp_pins[i];
@@ -1084,7 +1097,7 @@ static void alc_automute_speaker(struct hda_codec *codec, int pinctl)
1084 nid = spec->autocfg.speaker_pins[i]; 1097 nid = spec->autocfg.speaker_pins[i];
1085 if (!nid) 1098 if (!nid)
1086 break; 1099 break;
1087 if (pinctl) { 1100 if (spec->automute_mode == ALC_AUTOMUTE_PIN) {
1088 snd_hda_codec_write(codec, nid, 0, 1101 snd_hda_codec_write(codec, nid, 0,
1089 AC_VERB_SET_PIN_WIDGET_CONTROL, 1102 AC_VERB_SET_PIN_WIDGET_CONTROL,
1090 spec->jack_present ? 0 : PIN_OUT); 1103 spec->jack_present ? 0 : PIN_OUT);
@@ -1095,11 +1108,6 @@ static void alc_automute_speaker(struct hda_codec *codec, int pinctl)
1095 } 1108 }
1096} 1109}
1097 1110
1098static void alc_automute_pin(struct hda_codec *codec)
1099{
1100 alc_automute_speaker(codec, 1);
1101}
1102
1103static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, 1111static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
1104 hda_nid_t nid) 1112 hda_nid_t nid)
1105{ 1113{
@@ -1195,7 +1203,7 @@ static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1195 res >>= 26; 1203 res >>= 26;
1196 switch (res) { 1204 switch (res) {
1197 case ALC880_HP_EVENT: 1205 case ALC880_HP_EVENT:
1198 alc_automute_pin(codec); 1206 alc_hp_automute(codec);
1199 break; 1207 break;
1200 case ALC880_MIC_EVENT: 1208 case ALC880_MIC_EVENT:
1201 alc_mic_automute(codec); 1209 alc_mic_automute(codec);
@@ -1205,7 +1213,7 @@ static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1205 1213
1206static void alc_inithook(struct hda_codec *codec) 1214static void alc_inithook(struct hda_codec *codec)
1207{ 1215{
1208 alc_automute_pin(codec); 1216 alc_hp_automute(codec);
1209 alc_mic_automute(codec); 1217 alc_mic_automute(codec);
1210} 1218}
1211 1219
@@ -1374,6 +1382,8 @@ static void alc_init_auto_hp(struct hda_codec *codec)
1374 snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0, 1382 snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0,
1375 AC_VERB_SET_UNSOLICITED_ENABLE, 1383 AC_VERB_SET_UNSOLICITED_ENABLE,
1376 AC_USRSP_EN | ALC880_HP_EVENT); 1384 AC_USRSP_EN | ALC880_HP_EVENT);
1385 spec->automute = 1;
1386 spec->automute_mode = ALC_AUTOMUTE_PIN;
1377 } 1387 }
1378 spec->unsol_event = alc_sku_unsol_event; 1388 spec->unsol_event = alc_sku_unsol_event;
1379} 1389}
@@ -1971,22 +1981,6 @@ static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1971 {} 1981 {}
1972}; 1982};
1973 1983
1974static void alc_automute_amp(struct hda_codec *codec)
1975{
1976 alc_automute_speaker(codec, 0);
1977}
1978
1979static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1980 unsigned int res)
1981{
1982 if (codec->vendor_id == 0x10ec0880)
1983 res >>= 28;
1984 else
1985 res >>= 26;
1986 if (res == ALC880_HP_EVENT)
1987 alc_automute_amp(codec);
1988}
1989
1990static void alc889_automute_setup(struct hda_codec *codec) 1984static void alc889_automute_setup(struct hda_codec *codec)
1991{ 1985{
1992 struct alc_spec *spec = codec->spec; 1986 struct alc_spec *spec = codec->spec;
@@ -1997,12 +1991,14 @@ static void alc889_automute_setup(struct hda_codec *codec)
1997 spec->autocfg.speaker_pins[2] = 0x17; 1991 spec->autocfg.speaker_pins[2] = 0x17;
1998 spec->autocfg.speaker_pins[3] = 0x19; 1992 spec->autocfg.speaker_pins[3] = 0x19;
1999 spec->autocfg.speaker_pins[4] = 0x1a; 1993 spec->autocfg.speaker_pins[4] = 0x1a;
1994 spec->automute = 1;
1995 spec->automute_mode = ALC_AUTOMUTE_AMP;
2000} 1996}
2001 1997
2002static void alc889_intel_init_hook(struct hda_codec *codec) 1998static void alc889_intel_init_hook(struct hda_codec *codec)
2003{ 1999{
2004 alc889_coef_init(codec); 2000 alc889_coef_init(codec);
2005 alc_automute_amp(codec); 2001 alc_hp_automute(codec);
2006} 2002}
2007 2003
2008static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) 2004static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
@@ -2013,6 +2009,8 @@ static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
2013 spec->autocfg.hp_pins[1] = 0x1b; /* hp */ 2009 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
2014 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ 2010 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
2015 spec->autocfg.speaker_pins[1] = 0x15; /* bass */ 2011 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
2012 spec->automute = 1;
2013 spec->automute_mode = ALC_AUTOMUTE_AMP;
2016} 2014}
2017 2015
2018/* 2016/*
@@ -2295,6 +2293,8 @@ static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
2295 spec->autocfg.speaker_pins[0] = 0x14; 2293 spec->autocfg.speaker_pins[0] = 0x14;
2296 spec->autocfg.speaker_pins[1] = 0x16; 2294 spec->autocfg.speaker_pins[1] = 0x16;
2297 spec->autocfg.speaker_pins[2] = 0x17; 2295 spec->autocfg.speaker_pins[2] = 0x17;
2296 spec->automute = 1;
2297 spec->automute_mode = ALC_AUTOMUTE_AMP;
2298} 2298}
2299 2299
2300static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) 2300static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
@@ -2305,6 +2305,8 @@ static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
2305 spec->autocfg.speaker_pins[0] = 0x14; 2305 spec->autocfg.speaker_pins[0] = 0x14;
2306 spec->autocfg.speaker_pins[1] = 0x16; 2306 spec->autocfg.speaker_pins[1] = 0x16;
2307 spec->autocfg.speaker_pins[2] = 0x17; 2307 spec->autocfg.speaker_pins[2] = 0x17;
2308 spec->automute = 1;
2309 spec->automute_mode = ALC_AUTOMUTE_AMP;
2308} 2310}
2309 2311
2310static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec) 2312static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec)
@@ -2315,6 +2317,8 @@ static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec)
2315 spec->autocfg.speaker_pins[0] = 0x14; 2317 spec->autocfg.speaker_pins[0] = 0x14;
2316 spec->autocfg.speaker_pins[1] = 0x16; 2318 spec->autocfg.speaker_pins[1] = 0x16;
2317 spec->autocfg.speaker_pins[2] = 0x17; 2319 spec->autocfg.speaker_pins[2] = 0x17;
2320 spec->automute = 1;
2321 spec->automute_mode = ALC_AUTOMUTE_AMP;
2318} 2322}
2319 2323
2320static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) 2324static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
@@ -2325,6 +2329,8 @@ static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
2325 spec->autocfg.speaker_pins[0] = 0x14; 2329 spec->autocfg.speaker_pins[0] = 0x14;
2326 spec->autocfg.speaker_pins[1] = 0x16; 2330 spec->autocfg.speaker_pins[1] = 0x16;
2327 spec->autocfg.speaker_pins[2] = 0x1b; 2331 spec->autocfg.speaker_pins[2] = 0x1b;
2332 spec->automute = 1;
2333 spec->automute_mode = ALC_AUTOMUTE_AMP;
2328} 2334}
2329 2335
2330/* 2336/*
@@ -3400,11 +3406,13 @@ static void alc880_uniwill_setup(struct hda_codec *codec)
3400 spec->autocfg.hp_pins[0] = 0x14; 3406 spec->autocfg.hp_pins[0] = 0x14;
3401 spec->autocfg.speaker_pins[0] = 0x15; 3407 spec->autocfg.speaker_pins[0] = 0x15;
3402 spec->autocfg.speaker_pins[0] = 0x16; 3408 spec->autocfg.speaker_pins[0] = 0x16;
3409 spec->automute = 1;
3410 spec->automute_mode = ALC_AUTOMUTE_AMP;
3403} 3411}
3404 3412
3405static void alc880_uniwill_init_hook(struct hda_codec *codec) 3413static void alc880_uniwill_init_hook(struct hda_codec *codec)
3406{ 3414{
3407 alc_automute_amp(codec); 3415 alc_hp_automute(codec);
3408 alc88x_simple_mic_automute(codec); 3416 alc88x_simple_mic_automute(codec);
3409} 3417}
3410 3418
@@ -3419,7 +3427,7 @@ static void alc880_uniwill_unsol_event(struct hda_codec *codec,
3419 alc88x_simple_mic_automute(codec); 3427 alc88x_simple_mic_automute(codec);
3420 break; 3428 break;
3421 default: 3429 default:
3422 alc_automute_amp_unsol_event(codec, res); 3430 alc_sku_unsol_event(codec, res);
3423 break; 3431 break;
3424 } 3432 }
3425} 3433}
@@ -3430,6 +3438,8 @@ static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3430 3438
3431 spec->autocfg.hp_pins[0] = 0x14; 3439 spec->autocfg.hp_pins[0] = 0x14;
3432 spec->autocfg.speaker_pins[0] = 0x15; 3440 spec->autocfg.speaker_pins[0] = 0x15;
3441 spec->automute = 1;
3442 spec->automute_mode = ALC_AUTOMUTE_AMP;
3433} 3443}
3434 3444
3435static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) 3445static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
@@ -3454,7 +3464,7 @@ static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3454 if ((res >> 28) == ALC880_DCVOL_EVENT) 3464 if ((res >> 28) == ALC880_DCVOL_EVENT)
3455 alc880_uniwill_p53_dcvol_automute(codec); 3465 alc880_uniwill_p53_dcvol_automute(codec);
3456 else 3466 else
3457 alc_automute_amp_unsol_event(codec, res); 3467 alc_sku_unsol_event(codec, res);
3458} 3468}
3459 3469
3460/* 3470/*
@@ -3698,6 +3708,8 @@ static void alc880_lg_setup(struct hda_codec *codec)
3698 3708
3699 spec->autocfg.hp_pins[0] = 0x1b; 3709 spec->autocfg.hp_pins[0] = 0x1b;
3700 spec->autocfg.speaker_pins[0] = 0x17; 3710 spec->autocfg.speaker_pins[0] = 0x17;
3711 spec->automute = 1;
3712 spec->automute_mode = ALC_AUTOMUTE_AMP;
3701} 3713}
3702 3714
3703/* 3715/*
@@ -3782,6 +3794,8 @@ static void alc880_lg_lw_setup(struct hda_codec *codec)
3782 3794
3783 spec->autocfg.hp_pins[0] = 0x1b; 3795 spec->autocfg.hp_pins[0] = 0x1b;
3784 spec->autocfg.speaker_pins[0] = 0x14; 3796 spec->autocfg.speaker_pins[0] = 0x14;
3797 spec->automute = 1;
3798 spec->automute_mode = ALC_AUTOMUTE_AMP;
3785} 3799}
3786 3800
3787static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { 3801static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
@@ -3829,7 +3843,7 @@ static struct hda_verb alc880_medion_rim_init_verbs[] = {
3829static void alc880_medion_rim_automute(struct hda_codec *codec) 3843static void alc880_medion_rim_automute(struct hda_codec *codec)
3830{ 3844{
3831 struct alc_spec *spec = codec->spec; 3845 struct alc_spec *spec = codec->spec;
3832 alc_automute_amp(codec); 3846 alc_hp_automute(codec);
3833 /* toggle EAPD */ 3847 /* toggle EAPD */
3834 if (spec->jack_present) 3848 if (spec->jack_present)
3835 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); 3849 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
@@ -3853,6 +3867,8 @@ static void alc880_medion_rim_setup(struct hda_codec *codec)
3853 3867
3854 spec->autocfg.hp_pins[0] = 0x14; 3868 spec->autocfg.hp_pins[0] = 0x14;
3855 spec->autocfg.speaker_pins[0] = 0x1b; 3869 spec->autocfg.speaker_pins[0] = 0x1b;
3870 spec->automute = 1;
3871 spec->automute_mode = ALC_AUTOMUTE_AMP;
3856} 3872}
3857 3873
3858#ifdef CONFIG_SND_HDA_POWER_SAVE 3874#ifdef CONFIG_SND_HDA_POWER_SAVE
@@ -4806,7 +4822,7 @@ static struct alc_config_preset alc880_presets[] = {
4806 .input_mux = &alc880_f1734_capture_source, 4822 .input_mux = &alc880_f1734_capture_source,
4807 .unsol_event = alc880_uniwill_p53_unsol_event, 4823 .unsol_event = alc880_uniwill_p53_unsol_event,
4808 .setup = alc880_uniwill_p53_setup, 4824 .setup = alc880_uniwill_p53_setup,
4809 .init_hook = alc_automute_amp, 4825 .init_hook = alc_hp_automute,
4810 }, 4826 },
4811 [ALC880_ASUS] = { 4827 [ALC880_ASUS] = {
4812 .mixers = { alc880_asus_mixer }, 4828 .mixers = { alc880_asus_mixer },
@@ -4897,7 +4913,7 @@ static struct alc_config_preset alc880_presets[] = {
4897 .input_mux = &alc880_capture_source, 4913 .input_mux = &alc880_capture_source,
4898 .unsol_event = alc880_uniwill_p53_unsol_event, 4914 .unsol_event = alc880_uniwill_p53_unsol_event,
4899 .setup = alc880_uniwill_p53_setup, 4915 .setup = alc880_uniwill_p53_setup,
4900 .init_hook = alc_automute_amp, 4916 .init_hook = alc_hp_automute,
4901 }, 4917 },
4902 [ALC880_FUJITSU] = { 4918 [ALC880_FUJITSU] = {
4903 .mixers = { alc880_fujitsu_mixer }, 4919 .mixers = { alc880_fujitsu_mixer },
@@ -4912,7 +4928,7 @@ static struct alc_config_preset alc880_presets[] = {
4912 .input_mux = &alc880_capture_source, 4928 .input_mux = &alc880_capture_source,
4913 .unsol_event = alc880_uniwill_p53_unsol_event, 4929 .unsol_event = alc880_uniwill_p53_unsol_event,
4914 .setup = alc880_uniwill_p53_setup, 4930 .setup = alc880_uniwill_p53_setup,
4915 .init_hook = alc_automute_amp, 4931 .init_hook = alc_hp_automute,
4916 }, 4932 },
4917 [ALC880_CLEVO] = { 4933 [ALC880_CLEVO] = {
4918 .mixers = { alc880_three_stack_mixer }, 4934 .mixers = { alc880_three_stack_mixer },
@@ -4937,9 +4953,9 @@ static struct alc_config_preset alc880_presets[] = {
4937 .channel_mode = alc880_lg_ch_modes, 4953 .channel_mode = alc880_lg_ch_modes,
4938 .need_dac_fix = 1, 4954 .need_dac_fix = 1,
4939 .input_mux = &alc880_lg_capture_source, 4955 .input_mux = &alc880_lg_capture_source,
4940 .unsol_event = alc_automute_amp_unsol_event, 4956 .unsol_event = alc_sku_unsol_event,
4941 .setup = alc880_lg_setup, 4957 .setup = alc880_lg_setup,
4942 .init_hook = alc_automute_amp, 4958 .init_hook = alc_hp_automute,
4943#ifdef CONFIG_SND_HDA_POWER_SAVE 4959#ifdef CONFIG_SND_HDA_POWER_SAVE
4944 .loopbacks = alc880_lg_loopbacks, 4960 .loopbacks = alc880_lg_loopbacks,
4945#endif 4961#endif
@@ -4954,9 +4970,9 @@ static struct alc_config_preset alc880_presets[] = {
4954 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), 4970 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4955 .channel_mode = alc880_lg_lw_modes, 4971 .channel_mode = alc880_lg_lw_modes,
4956 .input_mux = &alc880_lg_lw_capture_source, 4972 .input_mux = &alc880_lg_lw_capture_source,
4957 .unsol_event = alc_automute_amp_unsol_event, 4973 .unsol_event = alc_sku_unsol_event,
4958 .setup = alc880_lg_lw_setup, 4974 .setup = alc880_lg_lw_setup,
4959 .init_hook = alc_automute_amp, 4975 .init_hook = alc_hp_automute,
4960 }, 4976 },
4961 [ALC880_MEDION_RIM] = { 4977 [ALC880_MEDION_RIM] = {
4962 .mixers = { alc880_medion_rim_mixer }, 4978 .mixers = { alc880_medion_rim_mixer },
@@ -8629,6 +8645,8 @@ static void alc885_imac24_setup(struct hda_codec *codec)
8629 spec->autocfg.hp_pins[0] = 0x14; 8645 spec->autocfg.hp_pins[0] = 0x14;
8630 spec->autocfg.speaker_pins[0] = 0x18; 8646 spec->autocfg.speaker_pins[0] = 0x18;
8631 spec->autocfg.speaker_pins[1] = 0x1a; 8647 spec->autocfg.speaker_pins[1] = 0x1a;
8648 spec->automute = 1;
8649 spec->automute_mode = ALC_AUTOMUTE_AMP;
8632} 8650}
8633 8651
8634#define alc885_mb5_setup alc885_imac24_setup 8652#define alc885_mb5_setup alc885_imac24_setup
@@ -8641,6 +8659,8 @@ static void alc885_mba21_setup(struct hda_codec *codec)
8641 8659
8642 spec->autocfg.hp_pins[0] = 0x14; 8660 spec->autocfg.hp_pins[0] = 0x14;
8643 spec->autocfg.speaker_pins[0] = 0x18; 8661 spec->autocfg.speaker_pins[0] = 0x18;
8662 spec->automute = 1;
8663 spec->automute_mode = ALC_AUTOMUTE_AMP;
8644} 8664}
8645 8665
8646 8666
@@ -8651,6 +8671,8 @@ static void alc885_mbp3_setup(struct hda_codec *codec)
8651 8671
8652 spec->autocfg.hp_pins[0] = 0x15; 8672 spec->autocfg.hp_pins[0] = 0x15;
8653 spec->autocfg.speaker_pins[0] = 0x14; 8673 spec->autocfg.speaker_pins[0] = 0x14;
8674 spec->automute = 1;
8675 spec->automute_mode = ALC_AUTOMUTE_AMP;
8654} 8676}
8655 8677
8656static void alc885_imac91_setup(struct hda_codec *codec) 8678static void alc885_imac91_setup(struct hda_codec *codec)
@@ -8660,6 +8682,8 @@ static void alc885_imac91_setup(struct hda_codec *codec)
8660 spec->autocfg.hp_pins[0] = 0x14; 8682 spec->autocfg.hp_pins[0] = 0x14;
8661 spec->autocfg.speaker_pins[0] = 0x18; 8683 spec->autocfg.speaker_pins[0] = 0x18;
8662 spec->autocfg.speaker_pins[1] = 0x1a; 8684 spec->autocfg.speaker_pins[1] = 0x1a;
8685 spec->automute = 1;
8686 spec->automute_mode = ALC_AUTOMUTE_AMP;
8663} 8687}
8664 8688
8665static struct hda_verb alc882_targa_verbs[] = { 8689static struct hda_verb alc882_targa_verbs[] = {
@@ -8681,7 +8705,7 @@ static struct hda_verb alc882_targa_verbs[] = {
8681static void alc882_targa_automute(struct hda_codec *codec) 8705static void alc882_targa_automute(struct hda_codec *codec)
8682{ 8706{
8683 struct alc_spec *spec = codec->spec; 8707 struct alc_spec *spec = codec->spec;
8684 alc_automute_amp(codec); 8708 alc_hp_automute(codec);
8685 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, 8709 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8686 spec->jack_present ? 1 : 3); 8710 spec->jack_present ? 1 : 3);
8687} 8711}
@@ -8692,6 +8716,8 @@ static void alc882_targa_setup(struct hda_codec *codec)
8692 8716
8693 spec->autocfg.hp_pins[0] = 0x14; 8717 spec->autocfg.hp_pins[0] = 0x14;
8694 spec->autocfg.speaker_pins[0] = 0x1b; 8718 spec->autocfg.speaker_pins[0] = 0x1b;
8719 spec->automute = 1;
8720 spec->automute_mode = ALC_AUTOMUTE_AMP;
8695} 8721}
8696 8722
8697static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) 8723static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
@@ -8779,7 +8805,7 @@ static void alc885_macpro_init_hook(struct hda_codec *codec)
8779static void alc885_imac24_init_hook(struct hda_codec *codec) 8805static void alc885_imac24_init_hook(struct hda_codec *codec)
8780{ 8806{
8781 alc885_macpro_init_hook(codec); 8807 alc885_macpro_init_hook(codec);
8782 alc_automute_amp(codec); 8808 alc_hp_automute(codec);
8783} 8809}
8784 8810
8785/* 8811/*
@@ -9137,6 +9163,8 @@ static void alc883_medion_wim2160_setup(struct hda_codec *codec)
9137 9163
9138 spec->autocfg.hp_pins[0] = 0x1a; 9164 spec->autocfg.hp_pins[0] = 0x1a;
9139 spec->autocfg.speaker_pins[0] = 0x15; 9165 spec->autocfg.speaker_pins[0] = 0x15;
9166 spec->automute = 1;
9167 spec->automute_mode = ALC_AUTOMUTE_AMP;
9140} 9168}
9141 9169
9142static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { 9170static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
@@ -9289,6 +9317,8 @@ static void alc883_mitac_setup(struct hda_codec *codec)
9289 spec->autocfg.hp_pins[0] = 0x15; 9317 spec->autocfg.hp_pins[0] = 0x15;
9290 spec->autocfg.speaker_pins[0] = 0x14; 9318 spec->autocfg.speaker_pins[0] = 0x14;
9291 spec->autocfg.speaker_pins[1] = 0x17; 9319 spec->autocfg.speaker_pins[1] = 0x17;
9320 spec->automute = 1;
9321 spec->automute_mode = ALC_AUTOMUTE_AMP;
9292} 9322}
9293 9323
9294static struct hda_verb alc883_mitac_verbs[] = { 9324static struct hda_verb alc883_mitac_verbs[] = {
@@ -9453,6 +9483,8 @@ static void alc888_3st_hp_setup(struct hda_codec *codec)
9453 spec->autocfg.speaker_pins[0] = 0x14; 9483 spec->autocfg.speaker_pins[0] = 0x14;
9454 spec->autocfg.speaker_pins[1] = 0x16; 9484 spec->autocfg.speaker_pins[1] = 0x16;
9455 spec->autocfg.speaker_pins[2] = 0x18; 9485 spec->autocfg.speaker_pins[2] = 0x18;
9486 spec->automute = 1;
9487 spec->automute_mode = ALC_AUTOMUTE_AMP;
9456} 9488}
9457 9489
9458static struct hda_verb alc888_3st_hp_verbs[] = { 9490static struct hda_verb alc888_3st_hp_verbs[] = {
@@ -9541,6 +9573,8 @@ static void alc883_lenovo_nb0763_setup(struct hda_codec *codec)
9541 9573
9542 spec->autocfg.hp_pins[0] = 0x14; 9574 spec->autocfg.hp_pins[0] = 0x14;
9543 spec->autocfg.speaker_pins[0] = 0x15; 9575 spec->autocfg.speaker_pins[0] = 0x15;
9576 spec->automute = 1;
9577 spec->automute_mode = ALC_AUTOMUTE_AMP;
9544} 9578}
9545 9579
9546/* toggle speaker-output according to the hp-jack state */ 9580/* toggle speaker-output according to the hp-jack state */
@@ -9553,11 +9587,13 @@ static void alc883_clevo_m720_setup(struct hda_codec *codec)
9553 9587
9554 spec->autocfg.hp_pins[0] = 0x15; 9588 spec->autocfg.hp_pins[0] = 0x15;
9555 spec->autocfg.speaker_pins[0] = 0x14; 9589 spec->autocfg.speaker_pins[0] = 0x14;
9590 spec->automute = 1;
9591 spec->automute_mode = ALC_AUTOMUTE_AMP;
9556} 9592}
9557 9593
9558static void alc883_clevo_m720_init_hook(struct hda_codec *codec) 9594static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9559{ 9595{
9560 alc_automute_amp(codec); 9596 alc_hp_automute(codec);
9561 alc88x_simple_mic_automute(codec); 9597 alc88x_simple_mic_automute(codec);
9562} 9598}
9563 9599
@@ -9569,7 +9605,7 @@ static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9569 alc88x_simple_mic_automute(codec); 9605 alc88x_simple_mic_automute(codec);
9570 break; 9606 break;
9571 default: 9607 default:
9572 alc_automute_amp_unsol_event(codec, res); 9608 alc_sku_unsol_event(codec, res);
9573 break; 9609 break;
9574 } 9610 }
9575} 9611}
@@ -9581,6 +9617,8 @@ static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9581 9617
9582 spec->autocfg.hp_pins[0] = 0x14; 9618 spec->autocfg.hp_pins[0] = 0x14;
9583 spec->autocfg.speaker_pins[0] = 0x15; 9619 spec->autocfg.speaker_pins[0] = 0x15;
9620 spec->automute = 1;
9621 spec->automute_mode = ALC_AUTOMUTE_AMP;
9584} 9622}
9585 9623
9586static void alc883_haier_w66_setup(struct hda_codec *codec) 9624static void alc883_haier_w66_setup(struct hda_codec *codec)
@@ -9589,6 +9627,8 @@ static void alc883_haier_w66_setup(struct hda_codec *codec)
9589 9627
9590 spec->autocfg.hp_pins[0] = 0x1b; 9628 spec->autocfg.hp_pins[0] = 0x1b;
9591 spec->autocfg.speaker_pins[0] = 0x14; 9629 spec->autocfg.speaker_pins[0] = 0x14;
9630 spec->automute = 1;
9631 spec->automute_mode = ALC_AUTOMUTE_AMP;
9592} 9632}
9593 9633
9594static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) 9634static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
@@ -9626,6 +9666,8 @@ static void alc883_acer_aspire_setup(struct hda_codec *codec)
9626 spec->autocfg.hp_pins[0] = 0x14; 9666 spec->autocfg.hp_pins[0] = 0x14;
9627 spec->autocfg.speaker_pins[0] = 0x15; 9667 spec->autocfg.speaker_pins[0] = 0x15;
9628 spec->autocfg.speaker_pins[1] = 0x16; 9668 spec->autocfg.speaker_pins[1] = 0x16;
9669 spec->automute = 1;
9670 spec->automute_mode = ALC_AUTOMUTE_AMP;
9629} 9671}
9630 9672
9631static struct hda_verb alc883_acer_eapd_verbs[] = { 9673static struct hda_verb alc883_acer_eapd_verbs[] = {
@@ -9655,6 +9697,8 @@ static void alc888_6st_dell_setup(struct hda_codec *codec)
9655 spec->autocfg.speaker_pins[1] = 0x15; 9697 spec->autocfg.speaker_pins[1] = 0x15;
9656 spec->autocfg.speaker_pins[2] = 0x16; 9698 spec->autocfg.speaker_pins[2] = 0x16;
9657 spec->autocfg.speaker_pins[3] = 0x17; 9699 spec->autocfg.speaker_pins[3] = 0x17;
9700 spec->automute = 1;
9701 spec->automute_mode = ALC_AUTOMUTE_AMP;
9658} 9702}
9659 9703
9660static void alc888_lenovo_sky_setup(struct hda_codec *codec) 9704static void alc888_lenovo_sky_setup(struct hda_codec *codec)
@@ -9667,6 +9711,8 @@ static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9667 spec->autocfg.speaker_pins[2] = 0x16; 9711 spec->autocfg.speaker_pins[2] = 0x16;
9668 spec->autocfg.speaker_pins[3] = 0x17; 9712 spec->autocfg.speaker_pins[3] = 0x17;
9669 spec->autocfg.speaker_pins[4] = 0x1a; 9713 spec->autocfg.speaker_pins[4] = 0x1a;
9714 spec->automute = 1;
9715 spec->automute_mode = ALC_AUTOMUTE_AMP;
9670} 9716}
9671 9717
9672static void alc883_vaiott_setup(struct hda_codec *codec) 9718static void alc883_vaiott_setup(struct hda_codec *codec)
@@ -9676,6 +9722,8 @@ static void alc883_vaiott_setup(struct hda_codec *codec)
9676 spec->autocfg.hp_pins[0] = 0x15; 9722 spec->autocfg.hp_pins[0] = 0x15;
9677 spec->autocfg.speaker_pins[0] = 0x14; 9723 spec->autocfg.speaker_pins[0] = 0x14;
9678 spec->autocfg.speaker_pins[1] = 0x17; 9724 spec->autocfg.speaker_pins[1] = 0x17;
9725 spec->automute = 1;
9726 spec->automute_mode = ALC_AUTOMUTE_AMP;
9679} 9727}
9680 9728
9681static struct hda_verb alc888_asus_m90v_verbs[] = { 9729static struct hda_verb alc888_asus_m90v_verbs[] = {
@@ -9701,6 +9749,8 @@ static void alc883_mode2_setup(struct hda_codec *codec)
9701 spec->ext_mic.mux_idx = 0; 9749 spec->ext_mic.mux_idx = 0;
9702 spec->int_mic.mux_idx = 1; 9750 spec->int_mic.mux_idx = 1;
9703 spec->auto_mic = 1; 9751 spec->auto_mic = 1;
9752 spec->automute = 1;
9753 spec->automute_mode = ALC_AUTOMUTE_AMP;
9704} 9754}
9705 9755
9706static struct hda_verb alc888_asus_eee1601_verbs[] = { 9756static struct hda_verb alc888_asus_eee1601_verbs[] = {
@@ -9722,7 +9772,7 @@ static void alc883_eee1601_inithook(struct hda_codec *codec)
9722 9772
9723 spec->autocfg.hp_pins[0] = 0x14; 9773 spec->autocfg.hp_pins[0] = 0x14;
9724 spec->autocfg.speaker_pins[0] = 0x1b; 9774 spec->autocfg.speaker_pins[0] = 0x1b;
9725 alc_automute_pin(codec); 9775 alc_hp_automute(codec);
9726} 9776}
9727 9777
9728static struct hda_verb alc889A_mb31_verbs[] = { 9778static struct hda_verb alc889A_mb31_verbs[] = {
@@ -10043,9 +10093,9 @@ static struct alc_config_preset alc882_presets[] = {
10043 .channel_mode = alc885_mba21_ch_modes, 10093 .channel_mode = alc885_mba21_ch_modes,
10044 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), 10094 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10045 .input_mux = &alc882_capture_source, 10095 .input_mux = &alc882_capture_source,
10046 .unsol_event = alc_automute_amp_unsol_event, 10096 .unsol_event = alc_sku_unsol_event,
10047 .setup = alc885_mba21_setup, 10097 .setup = alc885_mba21_setup,
10048 .init_hook = alc_automute_amp, 10098 .init_hook = alc_hp_automute,
10049 }, 10099 },
10050 [ALC885_MBP3] = { 10100 [ALC885_MBP3] = {
10051 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, 10101 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
@@ -10059,9 +10109,9 @@ static struct alc_config_preset alc882_presets[] = {
10059 .input_mux = &alc882_capture_source, 10109 .input_mux = &alc882_capture_source,
10060 .dig_out_nid = ALC882_DIGOUT_NID, 10110 .dig_out_nid = ALC882_DIGOUT_NID,
10061 .dig_in_nid = ALC882_DIGIN_NID, 10111 .dig_in_nid = ALC882_DIGIN_NID,
10062 .unsol_event = alc_automute_amp_unsol_event, 10112 .unsol_event = alc_sku_unsol_event,
10063 .setup = alc885_mbp3_setup, 10113 .setup = alc885_mbp3_setup,
10064 .init_hook = alc_automute_amp, 10114 .init_hook = alc_hp_automute,
10065 }, 10115 },
10066 [ALC885_MB5] = { 10116 [ALC885_MB5] = {
10067 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, 10117 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
@@ -10074,9 +10124,9 @@ static struct alc_config_preset alc882_presets[] = {
10074 .input_mux = &mb5_capture_source, 10124 .input_mux = &mb5_capture_source,
10075 .dig_out_nid = ALC882_DIGOUT_NID, 10125 .dig_out_nid = ALC882_DIGOUT_NID,
10076 .dig_in_nid = ALC882_DIGIN_NID, 10126 .dig_in_nid = ALC882_DIGIN_NID,
10077 .unsol_event = alc_automute_amp_unsol_event, 10127 .unsol_event = alc_sku_unsol_event,
10078 .setup = alc885_mb5_setup, 10128 .setup = alc885_mb5_setup,
10079 .init_hook = alc_automute_amp, 10129 .init_hook = alc_hp_automute,
10080 }, 10130 },
10081 [ALC885_MACMINI3] = { 10131 [ALC885_MACMINI3] = {
10082 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, 10132 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
@@ -10089,9 +10139,9 @@ static struct alc_config_preset alc882_presets[] = {
10089 .input_mux = &macmini3_capture_source, 10139 .input_mux = &macmini3_capture_source,
10090 .dig_out_nid = ALC882_DIGOUT_NID, 10140 .dig_out_nid = ALC882_DIGOUT_NID,
10091 .dig_in_nid = ALC882_DIGIN_NID, 10141 .dig_in_nid = ALC882_DIGIN_NID,
10092 .unsol_event = alc_automute_amp_unsol_event, 10142 .unsol_event = alc_sku_unsol_event,
10093 .setup = alc885_macmini3_setup, 10143 .setup = alc885_macmini3_setup,
10094 .init_hook = alc_automute_amp, 10144 .init_hook = alc_hp_automute,
10095 }, 10145 },
10096 [ALC885_MACPRO] = { 10146 [ALC885_MACPRO] = {
10097 .mixers = { alc882_macpro_mixer }, 10147 .mixers = { alc882_macpro_mixer },
@@ -10115,7 +10165,7 @@ static struct alc_config_preset alc882_presets[] = {
10115 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), 10165 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10116 .channel_mode = alc882_ch_modes, 10166 .channel_mode = alc882_ch_modes,
10117 .input_mux = &alc882_capture_source, 10167 .input_mux = &alc882_capture_source,
10118 .unsol_event = alc_automute_amp_unsol_event, 10168 .unsol_event = alc_sku_unsol_event,
10119 .setup = alc885_imac24_setup, 10169 .setup = alc885_imac24_setup,
10120 .init_hook = alc885_imac24_init_hook, 10170 .init_hook = alc885_imac24_init_hook,
10121 }, 10171 },
@@ -10130,9 +10180,9 @@ static struct alc_config_preset alc882_presets[] = {
10130 .input_mux = &alc889A_imac91_capture_source, 10180 .input_mux = &alc889A_imac91_capture_source,
10131 .dig_out_nid = ALC882_DIGOUT_NID, 10181 .dig_out_nid = ALC882_DIGOUT_NID,
10132 .dig_in_nid = ALC882_DIGIN_NID, 10182 .dig_in_nid = ALC882_DIGIN_NID,
10133 .unsol_event = alc_automute_amp_unsol_event, 10183 .unsol_event = alc_sku_unsol_event,
10134 .setup = alc885_imac91_setup, 10184 .setup = alc885_imac91_setup,
10135 .init_hook = alc_automute_amp, 10185 .init_hook = alc_hp_automute,
10136 }, 10186 },
10137 [ALC882_TARGA] = { 10187 [ALC882_TARGA] = {
10138 .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, 10188 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
@@ -10148,7 +10198,7 @@ static struct alc_config_preset alc882_presets[] = {
10148 .channel_mode = alc882_3ST_6ch_modes, 10198 .channel_mode = alc882_3ST_6ch_modes,
10149 .need_dac_fix = 1, 10199 .need_dac_fix = 1,
10150 .input_mux = &alc882_capture_source, 10200 .input_mux = &alc882_capture_source,
10151 .unsol_event = alc882_targa_unsol_event, 10201 .unsol_event = alc_sku_unsol_event,
10152 .setup = alc882_targa_setup, 10202 .setup = alc882_targa_setup,
10153 .init_hook = alc882_targa_automute, 10203 .init_hook = alc882_targa_automute,
10154 }, 10204 },
@@ -10242,8 +10292,8 @@ static struct alc_config_preset alc882_presets[] = {
10242 .capsrc_nids = alc889_capsrc_nids, 10292 .capsrc_nids = alc889_capsrc_nids,
10243 .input_mux = &alc889_capture_source, 10293 .input_mux = &alc889_capture_source,
10244 .setup = alc889_automute_setup, 10294 .setup = alc889_automute_setup,
10245 .init_hook = alc_automute_amp, 10295 .init_hook = alc_hp_automute,
10246 .unsol_event = alc_automute_amp_unsol_event, 10296 .unsol_event = alc_sku_unsol_event,
10247 .need_dac_fix = 1, 10297 .need_dac_fix = 1,
10248 }, 10298 },
10249 [ALC889_INTEL] = { 10299 [ALC889_INTEL] = {
@@ -10263,7 +10313,7 @@ static struct alc_config_preset alc882_presets[] = {
10263 .input_mux = &alc889_capture_source, 10313 .input_mux = &alc889_capture_source,
10264 .setup = alc889_automute_setup, 10314 .setup = alc889_automute_setup,
10265 .init_hook = alc889_intel_init_hook, 10315 .init_hook = alc889_intel_init_hook,
10266 .unsol_event = alc_automute_amp_unsol_event, 10316 .unsol_event = alc_sku_unsol_event,
10267 .need_dac_fix = 1, 10317 .need_dac_fix = 1,
10268 }, 10318 },
10269 [ALC883_6ST_DIG] = { 10319 [ALC883_6ST_DIG] = {
@@ -10352,9 +10402,9 @@ static struct alc_config_preset alc882_presets[] = {
10352 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 10402 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10353 .channel_mode = alc883_3ST_2ch_modes, 10403 .channel_mode = alc883_3ST_2ch_modes,
10354 .input_mux = &alc883_capture_source, 10404 .input_mux = &alc883_capture_source,
10355 .unsol_event = alc_automute_amp_unsol_event, 10405 .unsol_event = alc_sku_unsol_event,
10356 .setup = alc883_acer_aspire_setup, 10406 .setup = alc883_acer_aspire_setup,
10357 .init_hook = alc_automute_amp, 10407 .init_hook = alc_hp_automute,
10358 }, 10408 },
10359 [ALC888_ACER_ASPIRE_4930G] = { 10409 [ALC888_ACER_ASPIRE_4930G] = {
10360 .mixers = { alc888_acer_aspire_4930g_mixer, 10410 .mixers = { alc888_acer_aspire_4930g_mixer,
@@ -10374,9 +10424,9 @@ static struct alc_config_preset alc882_presets[] = {
10374 .num_mux_defs = 10424 .num_mux_defs =
10375 ARRAY_SIZE(alc888_2_capture_sources), 10425 ARRAY_SIZE(alc888_2_capture_sources),
10376 .input_mux = alc888_2_capture_sources, 10426 .input_mux = alc888_2_capture_sources,
10377 .unsol_event = alc_automute_amp_unsol_event, 10427 .unsol_event = alc_sku_unsol_event,
10378 .setup = alc888_acer_aspire_4930g_setup, 10428 .setup = alc888_acer_aspire_4930g_setup,
10379 .init_hook = alc_automute_amp, 10429 .init_hook = alc_hp_automute,
10380 }, 10430 },
10381 [ALC888_ACER_ASPIRE_6530G] = { 10431 [ALC888_ACER_ASPIRE_6530G] = {
10382 .mixers = { alc888_acer_aspire_6530_mixer }, 10432 .mixers = { alc888_acer_aspire_6530_mixer },
@@ -10393,9 +10443,9 @@ static struct alc_config_preset alc882_presets[] = {
10393 .num_mux_defs = 10443 .num_mux_defs =
10394 ARRAY_SIZE(alc888_2_capture_sources), 10444 ARRAY_SIZE(alc888_2_capture_sources),
10395 .input_mux = alc888_acer_aspire_6530_sources, 10445 .input_mux = alc888_acer_aspire_6530_sources,
10396 .unsol_event = alc_automute_amp_unsol_event, 10446 .unsol_event = alc_sku_unsol_event,
10397 .setup = alc888_acer_aspire_6530g_setup, 10447 .setup = alc888_acer_aspire_6530g_setup,
10398 .init_hook = alc_automute_amp, 10448 .init_hook = alc_hp_automute,
10399 }, 10449 },
10400 [ALC888_ACER_ASPIRE_8930G] = { 10450 [ALC888_ACER_ASPIRE_8930G] = {
10401 .mixers = { alc889_acer_aspire_8930g_mixer, 10451 .mixers = { alc889_acer_aspire_8930g_mixer,
@@ -10416,9 +10466,9 @@ static struct alc_config_preset alc882_presets[] = {
10416 .num_mux_defs = 10466 .num_mux_defs =
10417 ARRAY_SIZE(alc889_capture_sources), 10467 ARRAY_SIZE(alc889_capture_sources),
10418 .input_mux = alc889_capture_sources, 10468 .input_mux = alc889_capture_sources,
10419 .unsol_event = alc_automute_amp_unsol_event, 10469 .unsol_event = alc_sku_unsol_event,
10420 .setup = alc889_acer_aspire_8930g_setup, 10470 .setup = alc889_acer_aspire_8930g_setup,
10421 .init_hook = alc_automute_amp, 10471 .init_hook = alc_hp_automute,
10422#ifdef CONFIG_SND_HDA_POWER_SAVE 10472#ifdef CONFIG_SND_HDA_POWER_SAVE
10423 .power_hook = alc_power_eapd, 10473 .power_hook = alc_power_eapd,
10424#endif 10474#endif
@@ -10439,9 +10489,9 @@ static struct alc_config_preset alc882_presets[] = {
10439 .need_dac_fix = 1, 10489 .need_dac_fix = 1,
10440 .const_channel_count = 6, 10490 .const_channel_count = 6,
10441 .input_mux = &alc883_capture_source, 10491 .input_mux = &alc883_capture_source,
10442 .unsol_event = alc_automute_amp_unsol_event, 10492 .unsol_event = alc_sku_unsol_event,
10443 .setup = alc888_acer_aspire_7730g_setup, 10493 .setup = alc888_acer_aspire_7730g_setup,
10444 .init_hook = alc_automute_amp, 10494 .init_hook = alc_hp_automute,
10445 }, 10495 },
10446 [ALC883_MEDION] = { 10496 [ALC883_MEDION] = {
10447 .mixers = { alc883_fivestack_mixer, 10497 .mixers = { alc883_fivestack_mixer,
@@ -10468,9 +10518,9 @@ static struct alc_config_preset alc882_presets[] = {
10468 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 10518 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10469 .channel_mode = alc883_3ST_2ch_modes, 10519 .channel_mode = alc883_3ST_2ch_modes,
10470 .input_mux = &alc883_capture_source, 10520 .input_mux = &alc883_capture_source,
10471 .unsol_event = alc_automute_amp_unsol_event, 10521 .unsol_event = alc_sku_unsol_event,
10472 .setup = alc883_medion_wim2160_setup, 10522 .setup = alc883_medion_wim2160_setup,
10473 .init_hook = alc_automute_amp, 10523 .init_hook = alc_hp_automute,
10474 }, 10524 },
10475 [ALC883_LAPTOP_EAPD] = { 10525 [ALC883_LAPTOP_EAPD] = {
10476 .mixers = { alc883_base_mixer }, 10526 .mixers = { alc883_base_mixer },
@@ -10532,9 +10582,9 @@ static struct alc_config_preset alc882_presets[] = {
10532 .channel_mode = alc883_3ST_2ch_modes, 10582 .channel_mode = alc883_3ST_2ch_modes,
10533 .need_dac_fix = 1, 10583 .need_dac_fix = 1,
10534 .input_mux = &alc883_lenovo_nb0763_capture_source, 10584 .input_mux = &alc883_lenovo_nb0763_capture_source,
10535 .unsol_event = alc_automute_amp_unsol_event, 10585 .unsol_event = alc_sku_unsol_event,
10536 .setup = alc883_lenovo_nb0763_setup, 10586 .setup = alc883_lenovo_nb0763_setup,
10537 .init_hook = alc_automute_amp, 10587 .init_hook = alc_hp_automute,
10538 }, 10588 },
10539 [ALC888_LENOVO_MS7195_DIG] = { 10589 [ALC888_LENOVO_MS7195_DIG] = {
10540 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, 10590 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
@@ -10558,9 +10608,9 @@ static struct alc_config_preset alc882_presets[] = {
10558 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 10608 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10559 .channel_mode = alc883_3ST_2ch_modes, 10609 .channel_mode = alc883_3ST_2ch_modes,
10560 .input_mux = &alc883_capture_source, 10610 .input_mux = &alc883_capture_source,
10561 .unsol_event = alc_automute_amp_unsol_event, 10611 .unsol_event = alc_sku_unsol_event,
10562 .setup = alc883_haier_w66_setup, 10612 .setup = alc883_haier_w66_setup,
10563 .init_hook = alc_automute_amp, 10613 .init_hook = alc_hp_automute,
10564 }, 10614 },
10565 [ALC888_3ST_HP] = { 10615 [ALC888_3ST_HP] = {
10566 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, 10616 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
@@ -10571,9 +10621,9 @@ static struct alc_config_preset alc882_presets[] = {
10571 .channel_mode = alc888_3st_hp_modes, 10621 .channel_mode = alc888_3st_hp_modes,
10572 .need_dac_fix = 1, 10622 .need_dac_fix = 1,
10573 .input_mux = &alc883_capture_source, 10623 .input_mux = &alc883_capture_source,
10574 .unsol_event = alc_automute_amp_unsol_event, 10624 .unsol_event = alc_sku_unsol_event,
10575 .setup = alc888_3st_hp_setup, 10625 .setup = alc888_3st_hp_setup,
10576 .init_hook = alc_automute_amp, 10626 .init_hook = alc_hp_automute,
10577 }, 10627 },
10578 [ALC888_6ST_DELL] = { 10628 [ALC888_6ST_DELL] = {
10579 .mixers = { alc883_base_mixer, alc883_chmode_mixer }, 10629 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
@@ -10585,9 +10635,9 @@ static struct alc_config_preset alc882_presets[] = {
10585 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), 10635 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10586 .channel_mode = alc883_sixstack_modes, 10636 .channel_mode = alc883_sixstack_modes,
10587 .input_mux = &alc883_capture_source, 10637 .input_mux = &alc883_capture_source,
10588 .unsol_event = alc_automute_amp_unsol_event, 10638 .unsol_event = alc_sku_unsol_event,
10589 .setup = alc888_6st_dell_setup, 10639 .setup = alc888_6st_dell_setup,
10590 .init_hook = alc_automute_amp, 10640 .init_hook = alc_hp_automute,
10591 }, 10641 },
10592 [ALC883_MITAC] = { 10642 [ALC883_MITAC] = {
10593 .mixers = { alc883_mitac_mixer }, 10643 .mixers = { alc883_mitac_mixer },
@@ -10597,9 +10647,9 @@ static struct alc_config_preset alc882_presets[] = {
10597 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 10647 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10598 .channel_mode = alc883_3ST_2ch_modes, 10648 .channel_mode = alc883_3ST_2ch_modes,
10599 .input_mux = &alc883_capture_source, 10649 .input_mux = &alc883_capture_source,
10600 .unsol_event = alc_automute_amp_unsol_event, 10650 .unsol_event = alc_sku_unsol_event,
10601 .setup = alc883_mitac_setup, 10651 .setup = alc883_mitac_setup,
10602 .init_hook = alc_automute_amp, 10652 .init_hook = alc_hp_automute,
10603 }, 10653 },
10604 [ALC883_FUJITSU_PI2515] = { 10654 [ALC883_FUJITSU_PI2515] = {
10605 .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, 10655 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
@@ -10611,9 +10661,9 @@ static struct alc_config_preset alc882_presets[] = {
10611 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 10661 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10612 .channel_mode = alc883_3ST_2ch_modes, 10662 .channel_mode = alc883_3ST_2ch_modes,
10613 .input_mux = &alc883_fujitsu_pi2515_capture_source, 10663 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10614 .unsol_event = alc_automute_amp_unsol_event, 10664 .unsol_event = alc_sku_unsol_event,
10615 .setup = alc883_2ch_fujitsu_pi2515_setup, 10665 .setup = alc883_2ch_fujitsu_pi2515_setup,
10616 .init_hook = alc_automute_amp, 10666 .init_hook = alc_hp_automute,
10617 }, 10667 },
10618 [ALC888_FUJITSU_XA3530] = { 10668 [ALC888_FUJITSU_XA3530] = {
10619 .mixers = { alc888_base_mixer, alc883_chmode_mixer }, 10669 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
@@ -10630,9 +10680,9 @@ static struct alc_config_preset alc882_presets[] = {
10630 .num_mux_defs = 10680 .num_mux_defs =
10631 ARRAY_SIZE(alc888_2_capture_sources), 10681 ARRAY_SIZE(alc888_2_capture_sources),
10632 .input_mux = alc888_2_capture_sources, 10682 .input_mux = alc888_2_capture_sources,
10633 .unsol_event = alc_automute_amp_unsol_event, 10683 .unsol_event = alc_sku_unsol_event,
10634 .setup = alc888_fujitsu_xa3530_setup, 10684 .setup = alc888_fujitsu_xa3530_setup,
10635 .init_hook = alc_automute_amp, 10685 .init_hook = alc_hp_automute,
10636 }, 10686 },
10637 [ALC888_LENOVO_SKY] = { 10687 [ALC888_LENOVO_SKY] = {
10638 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, 10688 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
@@ -10644,9 +10694,9 @@ static struct alc_config_preset alc882_presets[] = {
10644 .channel_mode = alc883_sixstack_modes, 10694 .channel_mode = alc883_sixstack_modes,
10645 .need_dac_fix = 1, 10695 .need_dac_fix = 1,
10646 .input_mux = &alc883_lenovo_sky_capture_source, 10696 .input_mux = &alc883_lenovo_sky_capture_source,
10647 .unsol_event = alc_automute_amp_unsol_event, 10697 .unsol_event = alc_sku_unsol_event,
10648 .setup = alc888_lenovo_sky_setup, 10698 .setup = alc888_lenovo_sky_setup,
10649 .init_hook = alc_automute_amp, 10699 .init_hook = alc_hp_automute,
10650 }, 10700 },
10651 [ALC888_ASUS_M90V] = { 10701 [ALC888_ASUS_M90V] = {
10652 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, 10702 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
@@ -10714,9 +10764,9 @@ static struct alc_config_preset alc882_presets[] = {
10714 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 10764 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10715 .channel_mode = alc883_3ST_2ch_modes, 10765 .channel_mode = alc883_3ST_2ch_modes,
10716 .input_mux = &alc883_capture_source, 10766 .input_mux = &alc883_capture_source,
10717 .unsol_event = alc_automute_amp_unsol_event, 10767 .unsol_event = alc_sku_unsol_event,
10718 .setup = alc883_vaiott_setup, 10768 .setup = alc883_vaiott_setup,
10719 .init_hook = alc_automute_amp, 10769 .init_hook = alc_hp_automute,
10720 }, 10770 },
10721}; 10771};
10722 10772
@@ -11347,6 +11397,8 @@ static void alc262_hp_t5735_setup(struct hda_codec *codec)
11347 11397
11348 spec->autocfg.hp_pins[0] = 0x15; 11398 spec->autocfg.hp_pins[0] = 0x15;
11349 spec->autocfg.speaker_pins[0] = 0x14; 11399 spec->autocfg.speaker_pins[0] = 0x14;
11400 spec->automute = 1;
11401 spec->automute_mode = ALC_AUTOMUTE_PIN;
11350} 11402}
11351 11403
11352static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { 11404static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
@@ -11580,6 +11632,8 @@ static void alc262_tyan_setup(struct hda_codec *codec)
11580 11632
11581 spec->autocfg.hp_pins[0] = 0x1b; 11633 spec->autocfg.hp_pins[0] = 0x1b;
11582 spec->autocfg.speaker_pins[0] = 0x15; 11634 spec->autocfg.speaker_pins[0] = 0x15;
11635 spec->automute = 1;
11636 spec->automute_mode = ALC_AUTOMUTE_AMP;
11583} 11637}
11584 11638
11585 11639
@@ -11723,6 +11777,8 @@ static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11723 spec->int_mic.pin = 0x12; 11777 spec->int_mic.pin = 0x12;
11724 spec->int_mic.mux_idx = 9; 11778 spec->int_mic.mux_idx = 9;
11725 spec->auto_mic = 1; 11779 spec->auto_mic = 1;
11780 spec->automute = 1;
11781 spec->automute_mode = ALC_AUTOMUTE_PIN;
11726} 11782}
11727 11783
11728/* 11784/*
@@ -12933,9 +12989,9 @@ static struct alc_config_preset alc262_presets[] = {
12933 .num_channel_mode = ARRAY_SIZE(alc262_modes), 12989 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12934 .channel_mode = alc262_modes, 12990 .channel_mode = alc262_modes,
12935 .input_mux = &alc262_capture_source, 12991 .input_mux = &alc262_capture_source,
12936 .unsol_event = alc_automute_amp_unsol_event, 12992 .unsol_event = alc_sku_unsol_event,
12937 .setup = alc262_tyan_setup, 12993 .setup = alc262_tyan_setup,
12938 .init_hook = alc_automute_amp, 12994 .init_hook = alc_hp_automute,
12939 }, 12995 },
12940}; 12996};
12941 12997
@@ -13349,6 +13405,8 @@ static void alc268_dell_setup(struct hda_codec *codec)
13349 spec->int_mic.pin = 0x19; 13405 spec->int_mic.pin = 0x19;
13350 spec->int_mic.mux_idx = 1; 13406 spec->int_mic.mux_idx = 1;
13351 spec->auto_mic = 1; 13407 spec->auto_mic = 1;
13408 spec->automute = 1;
13409 spec->automute_mode = ALC_AUTOMUTE_PIN;
13352} 13410}
13353 13411
13354static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { 13412static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
@@ -13379,6 +13437,8 @@ static void alc267_quanta_il1_setup(struct hda_codec *codec)
13379 spec->int_mic.pin = 0x19; 13437 spec->int_mic.pin = 0x19;
13380 spec->int_mic.mux_idx = 1; 13438 spec->int_mic.mux_idx = 1;
13381 spec->auto_mic = 1; 13439 spec->auto_mic = 1;
13440 spec->automute = 1;
13441 spec->automute_mode = ALC_AUTOMUTE_PIN;
13382} 13442}
13383 13443
13384/* 13444/*
@@ -16878,11 +16938,13 @@ static void alc861vd_lenovo_setup(struct hda_codec *codec)
16878 struct alc_spec *spec = codec->spec; 16938 struct alc_spec *spec = codec->spec;
16879 spec->autocfg.hp_pins[0] = 0x1b; 16939 spec->autocfg.hp_pins[0] = 0x1b;
16880 spec->autocfg.speaker_pins[0] = 0x14; 16940 spec->autocfg.speaker_pins[0] = 0x14;
16941 spec->automute = 1;
16942 spec->automute_mode = ALC_AUTOMUTE_AMP;
16881} 16943}
16882 16944
16883static void alc861vd_lenovo_init_hook(struct hda_codec *codec) 16945static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16884{ 16946{
16885 alc_automute_amp(codec); 16947 alc_hp_automute(codec);
16886 alc88x_simple_mic_automute(codec); 16948 alc88x_simple_mic_automute(codec);
16887} 16949}
16888 16950
@@ -16894,7 +16956,7 @@ static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16894 alc88x_simple_mic_automute(codec); 16956 alc88x_simple_mic_automute(codec);
16895 break; 16957 break;
16896 default: 16958 default:
16897 alc_automute_amp_unsol_event(codec, res); 16959 alc_sku_unsol_event(codec, res);
16898 break; 16960 break;
16899 } 16961 }
16900} 16962}
@@ -16951,6 +17013,8 @@ static void alc861vd_dallas_setup(struct hda_codec *codec)
16951 17013
16952 spec->autocfg.hp_pins[0] = 0x15; 17014 spec->autocfg.hp_pins[0] = 0x15;
16953 spec->autocfg.speaker_pins[0] = 0x14; 17015 spec->autocfg.speaker_pins[0] = 0x14;
17016 spec->automute = 1;
17017 spec->automute_mode = ALC_AUTOMUTE_AMP;
16954} 17018}
16955 17019
16956#ifdef CONFIG_SND_HDA_POWER_SAVE 17020#ifdef CONFIG_SND_HDA_POWER_SAVE
@@ -17075,9 +17139,9 @@ static struct alc_config_preset alc861vd_presets[] = {
17075 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), 17139 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17076 .channel_mode = alc861vd_3stack_2ch_modes, 17140 .channel_mode = alc861vd_3stack_2ch_modes,
17077 .input_mux = &alc861vd_dallas_capture_source, 17141 .input_mux = &alc861vd_dallas_capture_source,
17078 .unsol_event = alc_automute_amp_unsol_event, 17142 .unsol_event = alc_sku_unsol_event,
17079 .setup = alc861vd_dallas_setup, 17143 .setup = alc861vd_dallas_setup,
17080 .init_hook = alc_automute_amp, 17144 .init_hook = alc_hp_automute,
17081 }, 17145 },
17082 [ALC861VD_HP] = { 17146 [ALC861VD_HP] = {
17083 .mixers = { alc861vd_hp_mixer }, 17147 .mixers = { alc861vd_hp_mixer },
@@ -17088,9 +17152,9 @@ static struct alc_config_preset alc861vd_presets[] = {
17088 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), 17152 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17089 .channel_mode = alc861vd_3stack_2ch_modes, 17153 .channel_mode = alc861vd_3stack_2ch_modes,
17090 .input_mux = &alc861vd_hp_capture_source, 17154 .input_mux = &alc861vd_hp_capture_source,
17091 .unsol_event = alc_automute_amp_unsol_event, 17155 .unsol_event = alc_sku_unsol_event,
17092 .setup = alc861vd_dallas_setup, 17156 .setup = alc861vd_dallas_setup,
17093 .init_hook = alc_automute_amp, 17157 .init_hook = alc_hp_automute,
17094 }, 17158 },
17095 [ALC660VD_ASUS_V1S] = { 17159 [ALC660VD_ASUS_V1S] = {
17096 .mixers = { alc861vd_lenovo_mixer }, 17160 .mixers = { alc861vd_lenovo_mixer },
@@ -20081,20 +20145,22 @@ static void alc680_base_setup(struct hda_codec *codec)
20081 spec->autocfg.inputs[0].type = AUTO_PIN_MIC; 20145 spec->autocfg.inputs[0].type = AUTO_PIN_MIC;
20082 spec->autocfg.inputs[1].pin = 0x19; 20146 spec->autocfg.inputs[1].pin = 0x19;
20083 spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN; 20147 spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN;
20148 spec->automute = 1;
20149 spec->automute_mode = ALC_AUTOMUTE_AMP;
20084} 20150}
20085 20151
20086static void alc680_unsol_event(struct hda_codec *codec, 20152static void alc680_unsol_event(struct hda_codec *codec,
20087 unsigned int res) 20153 unsigned int res)
20088{ 20154{
20089 if ((res >> 26) == ALC880_HP_EVENT) 20155 if ((res >> 26) == ALC880_HP_EVENT)
20090 alc_automute_amp(codec); 20156 alc_hp_automute(codec);
20091 if ((res >> 26) == ALC880_MIC_EVENT) 20157 if ((res >> 26) == ALC880_MIC_EVENT)
20092 alc680_rec_autoswitch(codec); 20158 alc680_rec_autoswitch(codec);
20093} 20159}
20094 20160
20095static void alc680_inithook(struct hda_codec *codec) 20161static void alc680_inithook(struct hda_codec *codec)
20096{ 20162{
20097 alc_automute_amp(codec); 20163 alc_hp_automute(codec);
20098 alc680_rec_autoswitch(codec); 20164 alc680_rec_autoswitch(codec);
20099} 20165}
20100 20166