diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-08-11 12:17:46 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-08-11 12:17:46 -0400 |
commit | 4f5d17062085ee1c74ff44a37ffb09f94ab4db1c (patch) | |
tree | 17164d916d3b5644ce430d8213ffeb0aa65a54fd | |
parent | e9c364c04f59f7fb250f9689198eaa59872cf8af (diff) |
ALSA: hda - Clean up init and setup hooks for Realtek codecs
Move static codes to setup from init_hook for each model.
Also, use the common auto-mic selection helper for devices that support
auto-mic selection. They just need to set up ext_mic, int_mic and
auto_mic flag in the setup section.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 724 |
1 files changed, 310 insertions, 414 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index b2e097bdc59c..ac3207efe106 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -1537,7 +1537,7 @@ static void alc_automute_amp_unsol_event(struct hda_codec *codec, | |||
1537 | alc_automute_amp(codec); | 1537 | alc_automute_amp(codec); |
1538 | } | 1538 | } |
1539 | 1539 | ||
1540 | static void alc889_automute_init(struct hda_codec *codec) | 1540 | static void alc889_automute_setup(struct hda_codec *codec) |
1541 | { | 1541 | { |
1542 | struct alc_spec *spec = codec->spec; | 1542 | struct alc_spec *spec = codec->spec; |
1543 | 1543 | ||
@@ -1547,16 +1547,15 @@ static void alc889_automute_init(struct hda_codec *codec) | |||
1547 | spec->autocfg.speaker_pins[2] = 0x17; | 1547 | spec->autocfg.speaker_pins[2] = 0x17; |
1548 | spec->autocfg.speaker_pins[3] = 0x19; | 1548 | spec->autocfg.speaker_pins[3] = 0x19; |
1549 | spec->autocfg.speaker_pins[4] = 0x1a; | 1549 | spec->autocfg.speaker_pins[4] = 0x1a; |
1550 | alc_automute_amp(codec); | ||
1551 | } | 1550 | } |
1552 | 1551 | ||
1553 | static void alc889_intel_init_hook(struct hda_codec *codec) | 1552 | static void alc889_intel_init_hook(struct hda_codec *codec) |
1554 | { | 1553 | { |
1555 | alc889_coef_init(codec); | 1554 | alc889_coef_init(codec); |
1556 | alc889_automute_init(codec); | 1555 | alc_automute_amp(codec); |
1557 | } | 1556 | } |
1558 | 1557 | ||
1559 | static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec) | 1558 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
1560 | { | 1559 | { |
1561 | struct alc_spec *spec = codec->spec; | 1560 | struct alc_spec *spec = codec->spec; |
1562 | 1561 | ||
@@ -1564,7 +1563,6 @@ static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec) | |||
1564 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ | 1563 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
1565 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ | 1564 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
1566 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ | 1565 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
1567 | alc_automute_amp(codec); | ||
1568 | } | 1566 | } |
1569 | 1567 | ||
1570 | /* | 1568 | /* |
@@ -1763,16 +1761,15 @@ static struct snd_kcontrol_new alc888_base_mixer[] = { | |||
1763 | { } /* end */ | 1761 | { } /* end */ |
1764 | }; | 1762 | }; |
1765 | 1763 | ||
1766 | static void alc888_acer_aspire_4930g_init_hook(struct hda_codec *codec) | 1764 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
1767 | { | 1765 | { |
1768 | struct alc_spec *spec = codec->spec; | 1766 | struct alc_spec *spec = codec->spec; |
1769 | 1767 | ||
1770 | spec->autocfg.hp_pins[0] = 0x15; | 1768 | spec->autocfg.hp_pins[0] = 0x15; |
1771 | spec->autocfg.speaker_pins[0] = 0x14; | 1769 | spec->autocfg.speaker_pins[0] = 0x14; |
1772 | alc_automute_amp(codec); | ||
1773 | } | 1770 | } |
1774 | 1771 | ||
1775 | static void alc888_acer_aspire_6530g_init_hook(struct hda_codec *codec) | 1772 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
1776 | { | 1773 | { |
1777 | struct alc_spec *spec = codec->spec; | 1774 | struct alc_spec *spec = codec->spec; |
1778 | 1775 | ||
@@ -1780,10 +1777,9 @@ static void alc888_acer_aspire_6530g_init_hook(struct hda_codec *codec) | |||
1780 | spec->autocfg.speaker_pins[0] = 0x14; | 1777 | spec->autocfg.speaker_pins[0] = 0x14; |
1781 | spec->autocfg.speaker_pins[1] = 0x16; | 1778 | spec->autocfg.speaker_pins[1] = 0x16; |
1782 | spec->autocfg.speaker_pins[2] = 0x17; | 1779 | spec->autocfg.speaker_pins[2] = 0x17; |
1783 | alc_automute_amp(codec); | ||
1784 | } | 1780 | } |
1785 | 1781 | ||
1786 | static void alc889_acer_aspire_8930g_init_hook(struct hda_codec *codec) | 1782 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
1787 | { | 1783 | { |
1788 | struct alc_spec *spec = codec->spec; | 1784 | struct alc_spec *spec = codec->spec; |
1789 | 1785 | ||
@@ -1791,7 +1787,6 @@ static void alc889_acer_aspire_8930g_init_hook(struct hda_codec *codec) | |||
1791 | spec->autocfg.speaker_pins[0] = 0x14; | 1787 | spec->autocfg.speaker_pins[0] = 0x14; |
1792 | spec->autocfg.speaker_pins[1] = 0x16; | 1788 | spec->autocfg.speaker_pins[1] = 0x16; |
1793 | spec->autocfg.speaker_pins[2] = 0x1b; | 1789 | spec->autocfg.speaker_pins[2] = 0x1b; |
1794 | alc_automute_amp(codec); | ||
1795 | } | 1790 | } |
1796 | 1791 | ||
1797 | /* | 1792 | /* |
@@ -2771,13 +2766,17 @@ static void alc880_uniwill_mic_automute(struct hda_codec *codec) | |||
2771 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); | 2766 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
2772 | } | 2767 | } |
2773 | 2768 | ||
2774 | static void alc880_uniwill_init_hook(struct hda_codec *codec) | 2769 | static void alc880_uniwill_setup(struct hda_codec *codec) |
2775 | { | 2770 | { |
2776 | struct alc_spec *spec = codec->spec; | 2771 | struct alc_spec *spec = codec->spec; |
2777 | 2772 | ||
2778 | spec->autocfg.hp_pins[0] = 0x14; | 2773 | spec->autocfg.hp_pins[0] = 0x14; |
2779 | spec->autocfg.speaker_pins[0] = 0x15; | 2774 | spec->autocfg.speaker_pins[0] = 0x15; |
2780 | spec->autocfg.speaker_pins[0] = 0x16; | 2775 | spec->autocfg.speaker_pins[0] = 0x16; |
2776 | } | ||
2777 | |||
2778 | static void alc880_uniwill_init_hook(struct hda_codec *codec) | ||
2779 | { | ||
2781 | alc_automute_amp(codec); | 2780 | alc_automute_amp(codec); |
2782 | alc880_uniwill_mic_automute(codec); | 2781 | alc880_uniwill_mic_automute(codec); |
2783 | } | 2782 | } |
@@ -2798,13 +2797,12 @@ static void alc880_uniwill_unsol_event(struct hda_codec *codec, | |||
2798 | } | 2797 | } |
2799 | } | 2798 | } |
2800 | 2799 | ||
2801 | static void alc880_uniwill_p53_init_hook(struct hda_codec *codec) | 2800 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
2802 | { | 2801 | { |
2803 | struct alc_spec *spec = codec->spec; | 2802 | struct alc_spec *spec = codec->spec; |
2804 | 2803 | ||
2805 | spec->autocfg.hp_pins[0] = 0x14; | 2804 | spec->autocfg.hp_pins[0] = 0x14; |
2806 | spec->autocfg.speaker_pins[0] = 0x15; | 2805 | spec->autocfg.speaker_pins[0] = 0x15; |
2807 | alc_automute_amp(codec); | ||
2808 | } | 2806 | } |
2809 | 2807 | ||
2810 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) | 2808 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
@@ -3067,13 +3065,12 @@ static struct hda_verb alc880_lg_init_verbs[] = { | |||
3067 | }; | 3065 | }; |
3068 | 3066 | ||
3069 | /* toggle speaker-output according to the hp-jack state */ | 3067 | /* toggle speaker-output according to the hp-jack state */ |
3070 | static void alc880_lg_init_hook(struct hda_codec *codec) | 3068 | static void alc880_lg_setup(struct hda_codec *codec) |
3071 | { | 3069 | { |
3072 | struct alc_spec *spec = codec->spec; | 3070 | struct alc_spec *spec = codec->spec; |
3073 | 3071 | ||
3074 | spec->autocfg.hp_pins[0] = 0x1b; | 3072 | spec->autocfg.hp_pins[0] = 0x1b; |
3075 | spec->autocfg.speaker_pins[0] = 0x17; | 3073 | spec->autocfg.speaker_pins[0] = 0x17; |
3076 | alc_automute_amp(codec); | ||
3077 | } | 3074 | } |
3078 | 3075 | ||
3079 | /* | 3076 | /* |
@@ -3152,13 +3149,12 @@ static struct hda_verb alc880_lg_lw_init_verbs[] = { | |||
3152 | }; | 3149 | }; |
3153 | 3150 | ||
3154 | /* toggle speaker-output according to the hp-jack state */ | 3151 | /* toggle speaker-output according to the hp-jack state */ |
3155 | static void alc880_lg_lw_init_hook(struct hda_codec *codec) | 3152 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
3156 | { | 3153 | { |
3157 | struct alc_spec *spec = codec->spec; | 3154 | struct alc_spec *spec = codec->spec; |
3158 | 3155 | ||
3159 | spec->autocfg.hp_pins[0] = 0x1b; | 3156 | spec->autocfg.hp_pins[0] = 0x1b; |
3160 | spec->autocfg.speaker_pins[0] = 0x14; | 3157 | spec->autocfg.speaker_pins[0] = 0x14; |
3161 | alc_automute_amp(codec); | ||
3162 | } | 3158 | } |
3163 | 3159 | ||
3164 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { | 3160 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
@@ -3224,13 +3220,12 @@ static void alc880_medion_rim_unsol_event(struct hda_codec *codec, | |||
3224 | alc880_medion_rim_automute(codec); | 3220 | alc880_medion_rim_automute(codec); |
3225 | } | 3221 | } |
3226 | 3222 | ||
3227 | static void alc880_medion_rim_init_hook(struct hda_codec *codec) | 3223 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
3228 | { | 3224 | { |
3229 | struct alc_spec *spec = codec->spec; | 3225 | struct alc_spec *spec = codec->spec; |
3230 | 3226 | ||
3231 | spec->autocfg.hp_pins[0] = 0x14; | 3227 | spec->autocfg.hp_pins[0] = 0x14; |
3232 | spec->autocfg.speaker_pins[0] = 0x1b; | 3228 | spec->autocfg.speaker_pins[0] = 0x1b; |
3233 | alc880_medion_rim_automute(codec); | ||
3234 | } | 3229 | } |
3235 | 3230 | ||
3236 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 3231 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
@@ -4097,7 +4092,8 @@ static struct alc_config_preset alc880_presets[] = { | |||
4097 | .channel_mode = alc880_2_jack_modes, | 4092 | .channel_mode = alc880_2_jack_modes, |
4098 | .input_mux = &alc880_f1734_capture_source, | 4093 | .input_mux = &alc880_f1734_capture_source, |
4099 | .unsol_event = alc880_uniwill_p53_unsol_event, | 4094 | .unsol_event = alc880_uniwill_p53_unsol_event, |
4100 | .init_hook = alc880_uniwill_p53_init_hook, | 4095 | .setup = alc880_uniwill_p53_setup, |
4096 | .init_hook = alc_automute_amp, | ||
4101 | }, | 4097 | }, |
4102 | [ALC880_ASUS] = { | 4098 | [ALC880_ASUS] = { |
4103 | .mixers = { alc880_asus_mixer }, | 4099 | .mixers = { alc880_asus_mixer }, |
@@ -4174,6 +4170,7 @@ static struct alc_config_preset alc880_presets[] = { | |||
4174 | .need_dac_fix = 1, | 4170 | .need_dac_fix = 1, |
4175 | .input_mux = &alc880_capture_source, | 4171 | .input_mux = &alc880_capture_source, |
4176 | .unsol_event = alc880_uniwill_unsol_event, | 4172 | .unsol_event = alc880_uniwill_unsol_event, |
4173 | .setup = alc880_uniwill_setup, | ||
4177 | .init_hook = alc880_uniwill_init_hook, | 4174 | .init_hook = alc880_uniwill_init_hook, |
4178 | }, | 4175 | }, |
4179 | [ALC880_UNIWILL_P53] = { | 4176 | [ALC880_UNIWILL_P53] = { |
@@ -4186,7 +4183,8 @@ static struct alc_config_preset alc880_presets[] = { | |||
4186 | .channel_mode = alc880_threestack_modes, | 4183 | .channel_mode = alc880_threestack_modes, |
4187 | .input_mux = &alc880_capture_source, | 4184 | .input_mux = &alc880_capture_source, |
4188 | .unsol_event = alc880_uniwill_p53_unsol_event, | 4185 | .unsol_event = alc880_uniwill_p53_unsol_event, |
4189 | .init_hook = alc880_uniwill_p53_init_hook, | 4186 | .setup = alc880_uniwill_p53_setup, |
4187 | .init_hook = alc_automute_amp, | ||
4190 | }, | 4188 | }, |
4191 | [ALC880_FUJITSU] = { | 4189 | [ALC880_FUJITSU] = { |
4192 | .mixers = { alc880_fujitsu_mixer }, | 4190 | .mixers = { alc880_fujitsu_mixer }, |
@@ -4200,7 +4198,8 @@ static struct alc_config_preset alc880_presets[] = { | |||
4200 | .channel_mode = alc880_2_jack_modes, | 4198 | .channel_mode = alc880_2_jack_modes, |
4201 | .input_mux = &alc880_capture_source, | 4199 | .input_mux = &alc880_capture_source, |
4202 | .unsol_event = alc880_uniwill_p53_unsol_event, | 4200 | .unsol_event = alc880_uniwill_p53_unsol_event, |
4203 | .init_hook = alc880_uniwill_p53_init_hook, | 4201 | .setup = alc880_uniwill_p53_setup, |
4202 | .init_hook = alc_automute_amp, | ||
4204 | }, | 4203 | }, |
4205 | [ALC880_CLEVO] = { | 4204 | [ALC880_CLEVO] = { |
4206 | .mixers = { alc880_three_stack_mixer }, | 4205 | .mixers = { alc880_three_stack_mixer }, |
@@ -4226,7 +4225,8 @@ static struct alc_config_preset alc880_presets[] = { | |||
4226 | .need_dac_fix = 1, | 4225 | .need_dac_fix = 1, |
4227 | .input_mux = &alc880_lg_capture_source, | 4226 | .input_mux = &alc880_lg_capture_source, |
4228 | .unsol_event = alc_automute_amp_unsol_event, | 4227 | .unsol_event = alc_automute_amp_unsol_event, |
4229 | .init_hook = alc880_lg_init_hook, | 4228 | .setup = alc880_lg_setup, |
4229 | .init_hook = alc_automute_amp, | ||
4230 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 4230 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
4231 | .loopbacks = alc880_lg_loopbacks, | 4231 | .loopbacks = alc880_lg_loopbacks, |
4232 | #endif | 4232 | #endif |
@@ -4242,7 +4242,8 @@ static struct alc_config_preset alc880_presets[] = { | |||
4242 | .channel_mode = alc880_lg_lw_modes, | 4242 | .channel_mode = alc880_lg_lw_modes, |
4243 | .input_mux = &alc880_lg_lw_capture_source, | 4243 | .input_mux = &alc880_lg_lw_capture_source, |
4244 | .unsol_event = alc_automute_amp_unsol_event, | 4244 | .unsol_event = alc_automute_amp_unsol_event, |
4245 | .init_hook = alc880_lg_lw_init_hook, | 4245 | .setup = alc880_lg_lw_setup, |
4246 | .init_hook = alc_automute_amp, | ||
4246 | }, | 4247 | }, |
4247 | [ALC880_MEDION_RIM] = { | 4248 | [ALC880_MEDION_RIM] = { |
4248 | .mixers = { alc880_medion_rim_mixer }, | 4249 | .mixers = { alc880_medion_rim_mixer }, |
@@ -4256,7 +4257,8 @@ static struct alc_config_preset alc880_presets[] = { | |||
4256 | .channel_mode = alc880_2_jack_modes, | 4257 | .channel_mode = alc880_2_jack_modes, |
4257 | .input_mux = &alc880_medion_rim_capture_source, | 4258 | .input_mux = &alc880_medion_rim_capture_source, |
4258 | .unsol_event = alc880_medion_rim_unsol_event, | 4259 | .unsol_event = alc880_medion_rim_unsol_event, |
4259 | .init_hook = alc880_medion_rim_init_hook, | 4260 | .setup = alc880_medion_rim_setup, |
4261 | .init_hook = alc880_medion_rim_automute, | ||
4260 | }, | 4262 | }, |
4261 | #ifdef CONFIG_SND_DEBUG | 4263 | #ifdef CONFIG_SND_DEBUG |
4262 | [ALC880_TEST] = { | 4264 | [ALC880_TEST] = { |
@@ -7451,23 +7453,21 @@ static struct hda_verb alc885_imac24_init_verbs[] = { | |||
7451 | }; | 7453 | }; |
7452 | 7454 | ||
7453 | /* Toggle speaker-output according to the hp-jack state */ | 7455 | /* Toggle speaker-output according to the hp-jack state */ |
7454 | static void alc885_imac24_automute_init_hook(struct hda_codec *codec) | 7456 | static void alc885_imac24_setup(struct hda_codec *codec) |
7455 | { | 7457 | { |
7456 | struct alc_spec *spec = codec->spec; | 7458 | struct alc_spec *spec = codec->spec; |
7457 | 7459 | ||
7458 | spec->autocfg.hp_pins[0] = 0x14; | 7460 | spec->autocfg.hp_pins[0] = 0x14; |
7459 | spec->autocfg.speaker_pins[0] = 0x18; | 7461 | spec->autocfg.speaker_pins[0] = 0x18; |
7460 | spec->autocfg.speaker_pins[1] = 0x1a; | 7462 | spec->autocfg.speaker_pins[1] = 0x1a; |
7461 | alc_automute_amp(codec); | ||
7462 | } | 7463 | } |
7463 | 7464 | ||
7464 | static void alc885_mbp3_init_hook(struct hda_codec *codec) | 7465 | static void alc885_mbp3_setup(struct hda_codec *codec) |
7465 | { | 7466 | { |
7466 | struct alc_spec *spec = codec->spec; | 7467 | struct alc_spec *spec = codec->spec; |
7467 | 7468 | ||
7468 | spec->autocfg.hp_pins[0] = 0x15; | 7469 | spec->autocfg.hp_pins[0] = 0x15; |
7469 | spec->autocfg.speaker_pins[0] = 0x14; | 7470 | spec->autocfg.speaker_pins[0] = 0x14; |
7470 | alc_automute_amp(codec); | ||
7471 | } | 7471 | } |
7472 | 7472 | ||
7473 | 7473 | ||
@@ -7495,13 +7495,12 @@ static void alc882_targa_automute(struct hda_codec *codec) | |||
7495 | spec->jack_present ? 1 : 3); | 7495 | spec->jack_present ? 1 : 3); |
7496 | } | 7496 | } |
7497 | 7497 | ||
7498 | static void alc882_targa_init_hook(struct hda_codec *codec) | 7498 | static void alc882_targa_setup(struct hda_codec *codec) |
7499 | { | 7499 | { |
7500 | struct alc_spec *spec = codec->spec; | 7500 | struct alc_spec *spec = codec->spec; |
7501 | 7501 | ||
7502 | spec->autocfg.hp_pins[0] = 0x14; | 7502 | spec->autocfg.hp_pins[0] = 0x14; |
7503 | spec->autocfg.speaker_pins[0] = 0x1b; | 7503 | spec->autocfg.speaker_pins[0] = 0x1b; |
7504 | alc882_targa_automute(codec); | ||
7505 | } | 7504 | } |
7506 | 7505 | ||
7507 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) | 7506 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
@@ -7589,7 +7588,7 @@ static void alc885_macpro_init_hook(struct hda_codec *codec) | |||
7589 | static void alc885_imac24_init_hook(struct hda_codec *codec) | 7588 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
7590 | { | 7589 | { |
7591 | alc885_macpro_init_hook(codec); | 7590 | alc885_macpro_init_hook(codec); |
7592 | alc885_imac24_automute_init_hook(codec); | 7591 | alc_automute_amp(codec); |
7593 | } | 7592 | } |
7594 | 7593 | ||
7595 | /* | 7594 | /* |
@@ -8079,14 +8078,13 @@ static struct snd_kcontrol_new alc883_chmode_mixer[] = { | |||
8079 | }; | 8078 | }; |
8080 | 8079 | ||
8081 | /* toggle speaker-output according to the hp-jack state */ | 8080 | /* toggle speaker-output according to the hp-jack state */ |
8082 | static void alc883_mitac_init_hook(struct hda_codec *codec) | 8081 | static void alc883_mitac_setup(struct hda_codec *codec) |
8083 | { | 8082 | { |
8084 | struct alc_spec *spec = codec->spec; | 8083 | struct alc_spec *spec = codec->spec; |
8085 | 8084 | ||
8086 | spec->autocfg.hp_pins[0] = 0x15; | 8085 | spec->autocfg.hp_pins[0] = 0x15; |
8087 | spec->autocfg.speaker_pins[0] = 0x14; | 8086 | spec->autocfg.speaker_pins[0] = 0x14; |
8088 | spec->autocfg.speaker_pins[1] = 0x17; | 8087 | spec->autocfg.speaker_pins[1] = 0x17; |
8089 | alc_automute_amp(codec); | ||
8090 | } | 8088 | } |
8091 | 8089 | ||
8092 | /* auto-toggle front mic */ | 8090 | /* auto-toggle front mic */ |
@@ -8241,7 +8239,7 @@ static struct hda_verb alc883_vaiott_verbs[] = { | |||
8241 | { } /* end */ | 8239 | { } /* end */ |
8242 | }; | 8240 | }; |
8243 | 8241 | ||
8244 | static void alc888_3st_hp_init_hook(struct hda_codec *codec) | 8242 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
8245 | { | 8243 | { |
8246 | struct alc_spec *spec = codec->spec; | 8244 | struct alc_spec *spec = codec->spec; |
8247 | 8245 | ||
@@ -8249,7 +8247,6 @@ static void alc888_3st_hp_init_hook(struct hda_codec *codec) | |||
8249 | spec->autocfg.speaker_pins[0] = 0x14; | 8247 | spec->autocfg.speaker_pins[0] = 0x14; |
8250 | spec->autocfg.speaker_pins[1] = 0x16; | 8248 | spec->autocfg.speaker_pins[1] = 0x16; |
8251 | spec->autocfg.speaker_pins[2] = 0x18; | 8249 | spec->autocfg.speaker_pins[2] = 0x18; |
8252 | alc_automute_amp(codec); | ||
8253 | } | 8250 | } |
8254 | 8251 | ||
8255 | static struct hda_verb alc888_3st_hp_verbs[] = { | 8252 | static struct hda_verb alc888_3st_hp_verbs[] = { |
@@ -8346,13 +8343,12 @@ static struct hda_verb alc883_medion_md2_verbs[] = { | |||
8346 | }; | 8343 | }; |
8347 | 8344 | ||
8348 | /* toggle speaker-output according to the hp-jack state */ | 8345 | /* toggle speaker-output according to the hp-jack state */ |
8349 | static void alc883_medion_md2_init_hook(struct hda_codec *codec) | 8346 | static void alc883_medion_md2_setup(struct hda_codec *codec) |
8350 | { | 8347 | { |
8351 | struct alc_spec *spec = codec->spec; | 8348 | struct alc_spec *spec = codec->spec; |
8352 | 8349 | ||
8353 | spec->autocfg.hp_pins[0] = 0x14; | 8350 | spec->autocfg.hp_pins[0] = 0x14; |
8354 | spec->autocfg.speaker_pins[0] = 0x15; | 8351 | spec->autocfg.speaker_pins[0] = 0x15; |
8355 | alc_automute_amp(codec); | ||
8356 | } | 8352 | } |
8357 | 8353 | ||
8358 | /* toggle speaker-output according to the hp-jack state */ | 8354 | /* toggle speaker-output according to the hp-jack state */ |
@@ -8369,12 +8365,16 @@ static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) | |||
8369 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | 8365 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
8370 | } | 8366 | } |
8371 | 8367 | ||
8372 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) | 8368 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
8373 | { | 8369 | { |
8374 | struct alc_spec *spec = codec->spec; | 8370 | struct alc_spec *spec = codec->spec; |
8375 | 8371 | ||
8376 | spec->autocfg.hp_pins[0] = 0x15; | 8372 | spec->autocfg.hp_pins[0] = 0x15; |
8377 | spec->autocfg.speaker_pins[0] = 0x14; | 8373 | spec->autocfg.speaker_pins[0] = 0x14; |
8374 | } | ||
8375 | |||
8376 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) | ||
8377 | { | ||
8378 | alc_automute_amp(codec); | 8378 | alc_automute_amp(codec); |
8379 | alc883_clevo_m720_mic_automute(codec); | 8379 | alc883_clevo_m720_mic_automute(codec); |
8380 | } | 8380 | } |
@@ -8393,22 +8393,20 @@ static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, | |||
8393 | } | 8393 | } |
8394 | 8394 | ||
8395 | /* toggle speaker-output according to the hp-jack state */ | 8395 | /* toggle speaker-output according to the hp-jack state */ |
8396 | static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec) | 8396 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
8397 | { | 8397 | { |
8398 | struct alc_spec *spec = codec->spec; | 8398 | struct alc_spec *spec = codec->spec; |
8399 | 8399 | ||
8400 | spec->autocfg.hp_pins[0] = 0x14; | 8400 | spec->autocfg.hp_pins[0] = 0x14; |
8401 | spec->autocfg.speaker_pins[0] = 0x15; | 8401 | spec->autocfg.speaker_pins[0] = 0x15; |
8402 | alc_automute_amp(codec); | ||
8403 | } | 8402 | } |
8404 | 8403 | ||
8405 | static void alc883_haier_w66_init_hook(struct hda_codec *codec) | 8404 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
8406 | { | 8405 | { |
8407 | struct alc_spec *spec = codec->spec; | 8406 | struct alc_spec *spec = codec->spec; |
8408 | 8407 | ||
8409 | spec->autocfg.hp_pins[0] = 0x1b; | 8408 | spec->autocfg.hp_pins[0] = 0x1b; |
8410 | spec->autocfg.speaker_pins[0] = 0x14; | 8409 | spec->autocfg.speaker_pins[0] = 0x14; |
8411 | alc_automute_amp(codec); | ||
8412 | } | 8410 | } |
8413 | 8411 | ||
8414 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) | 8412 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
@@ -8447,14 +8445,13 @@ static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, | |||
8447 | } | 8445 | } |
8448 | 8446 | ||
8449 | /* toggle speaker-output according to the hp-jack state */ | 8447 | /* toggle speaker-output according to the hp-jack state */ |
8450 | static void alc883_acer_aspire_init_hook(struct hda_codec *codec) | 8448 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
8451 | { | 8449 | { |
8452 | struct alc_spec *spec = codec->spec; | 8450 | struct alc_spec *spec = codec->spec; |
8453 | 8451 | ||
8454 | spec->autocfg.hp_pins[0] = 0x14; | 8452 | spec->autocfg.hp_pins[0] = 0x14; |
8455 | spec->autocfg.speaker_pins[0] = 0x15; | 8453 | spec->autocfg.speaker_pins[0] = 0x15; |
8456 | spec->autocfg.speaker_pins[1] = 0x16; | 8454 | spec->autocfg.speaker_pins[1] = 0x16; |
8457 | alc_automute_amp(codec); | ||
8458 | } | 8455 | } |
8459 | 8456 | ||
8460 | static struct hda_verb alc883_acer_eapd_verbs[] = { | 8457 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
@@ -8475,7 +8472,7 @@ static struct hda_verb alc883_acer_eapd_verbs[] = { | |||
8475 | { } | 8472 | { } |
8476 | }; | 8473 | }; |
8477 | 8474 | ||
8478 | static void alc888_6st_dell_init_hook(struct hda_codec *codec) | 8475 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
8479 | { | 8476 | { |
8480 | struct alc_spec *spec = codec->spec; | 8477 | struct alc_spec *spec = codec->spec; |
8481 | 8478 | ||
@@ -8484,10 +8481,9 @@ static void alc888_6st_dell_init_hook(struct hda_codec *codec) | |||
8484 | spec->autocfg.speaker_pins[1] = 0x15; | 8481 | spec->autocfg.speaker_pins[1] = 0x15; |
8485 | spec->autocfg.speaker_pins[2] = 0x16; | 8482 | spec->autocfg.speaker_pins[2] = 0x16; |
8486 | spec->autocfg.speaker_pins[3] = 0x17; | 8483 | spec->autocfg.speaker_pins[3] = 0x17; |
8487 | alc_automute_amp(codec); | ||
8488 | } | 8484 | } |
8489 | 8485 | ||
8490 | static void alc888_lenovo_sky_init_hook(struct hda_codec *codec) | 8486 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
8491 | { | 8487 | { |
8492 | struct alc_spec *spec = codec->spec; | 8488 | struct alc_spec *spec = codec->spec; |
8493 | 8489 | ||
@@ -8497,17 +8493,15 @@ static void alc888_lenovo_sky_init_hook(struct hda_codec *codec) | |||
8497 | spec->autocfg.speaker_pins[2] = 0x16; | 8493 | spec->autocfg.speaker_pins[2] = 0x16; |
8498 | spec->autocfg.speaker_pins[3] = 0x17; | 8494 | spec->autocfg.speaker_pins[3] = 0x17; |
8499 | spec->autocfg.speaker_pins[4] = 0x1a; | 8495 | spec->autocfg.speaker_pins[4] = 0x1a; |
8500 | alc_automute_amp(codec); | ||
8501 | } | 8496 | } |
8502 | 8497 | ||
8503 | static void alc883_vaiott_init_hook(struct hda_codec *codec) | 8498 | static void alc883_vaiott_setup(struct hda_codec *codec) |
8504 | { | 8499 | { |
8505 | struct alc_spec *spec = codec->spec; | 8500 | struct alc_spec *spec = codec->spec; |
8506 | 8501 | ||
8507 | spec->autocfg.hp_pins[0] = 0x15; | 8502 | spec->autocfg.hp_pins[0] = 0x15; |
8508 | spec->autocfg.speaker_pins[0] = 0x14; | 8503 | spec->autocfg.speaker_pins[0] = 0x14; |
8509 | spec->autocfg.speaker_pins[1] = 0x17; | 8504 | spec->autocfg.speaker_pins[1] = 0x17; |
8510 | alc_automute_amp(codec); | ||
8511 | } | 8505 | } |
8512 | 8506 | ||
8513 | static struct hda_verb alc888_asus_m90v_verbs[] = { | 8507 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
@@ -8520,19 +8514,7 @@ static struct hda_verb alc888_asus_m90v_verbs[] = { | |||
8520 | { } /* end */ | 8514 | { } /* end */ |
8521 | }; | 8515 | }; |
8522 | 8516 | ||
8523 | static void alc883_nb_mic_automute(struct hda_codec *codec) | 8517 | static void alc883_mode2_setup(struct hda_codec *codec) |
8524 | { | ||
8525 | unsigned int present; | ||
8526 | |||
8527 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
8528 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
8529 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
8530 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | ||
8531 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
8532 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); | ||
8533 | } | ||
8534 | |||
8535 | static void alc883_M90V_init_hook(struct hda_codec *codec) | ||
8536 | { | 8518 | { |
8537 | struct alc_spec *spec = codec->spec; | 8519 | struct alc_spec *spec = codec->spec; |
8538 | 8520 | ||
@@ -8540,26 +8522,11 @@ static void alc883_M90V_init_hook(struct hda_codec *codec) | |||
8540 | spec->autocfg.speaker_pins[0] = 0x14; | 8522 | spec->autocfg.speaker_pins[0] = 0x14; |
8541 | spec->autocfg.speaker_pins[1] = 0x15; | 8523 | spec->autocfg.speaker_pins[1] = 0x15; |
8542 | spec->autocfg.speaker_pins[2] = 0x16; | 8524 | spec->autocfg.speaker_pins[2] = 0x16; |
8543 | alc_automute_pin(codec); | 8525 | spec->ext_mic.pin = 0x18; |
8544 | } | 8526 | spec->int_mic.pin = 0x19; |
8545 | 8527 | spec->ext_mic.mux_idx = 0; | |
8546 | static void alc883_mode2_unsol_event(struct hda_codec *codec, | 8528 | spec->int_mic.mux_idx = 1; |
8547 | unsigned int res) | 8529 | spec->auto_mic = 1; |
8548 | { | ||
8549 | switch (res >> 26) { | ||
8550 | case ALC880_MIC_EVENT: | ||
8551 | alc883_nb_mic_automute(codec); | ||
8552 | break; | ||
8553 | default: | ||
8554 | alc_sku_unsol_event(codec, res); | ||
8555 | break; | ||
8556 | } | ||
8557 | } | ||
8558 | |||
8559 | static void alc883_mode2_inithook(struct hda_codec *codec) | ||
8560 | { | ||
8561 | alc883_M90V_init_hook(codec); | ||
8562 | alc883_nb_mic_automute(codec); | ||
8563 | } | 8530 | } |
8564 | 8531 | ||
8565 | static struct hda_verb alc888_asus_eee1601_verbs[] = { | 8532 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
@@ -8890,7 +8857,8 @@ static struct alc_config_preset alc882_presets[] = { | |||
8890 | .dig_out_nid = ALC882_DIGOUT_NID, | 8857 | .dig_out_nid = ALC882_DIGOUT_NID, |
8891 | .dig_in_nid = ALC882_DIGIN_NID, | 8858 | .dig_in_nid = ALC882_DIGIN_NID, |
8892 | .unsol_event = alc_automute_amp_unsol_event, | 8859 | .unsol_event = alc_automute_amp_unsol_event, |
8893 | .init_hook = alc885_mbp3_init_hook, | 8860 | .setup = alc885_mbp3_setup, |
8861 | .init_hook = alc_automute_amp, | ||
8894 | }, | 8862 | }, |
8895 | [ALC885_MB5] = { | 8863 | [ALC885_MB5] = { |
8896 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, | 8864 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
@@ -8927,6 +8895,7 @@ static struct alc_config_preset alc882_presets[] = { | |||
8927 | .channel_mode = alc882_ch_modes, | 8895 | .channel_mode = alc882_ch_modes, |
8928 | .input_mux = &alc882_capture_source, | 8896 | .input_mux = &alc882_capture_source, |
8929 | .unsol_event = alc_automute_amp_unsol_event, | 8897 | .unsol_event = alc_automute_amp_unsol_event, |
8898 | .setup = alc885_imac24_setup, | ||
8930 | .init_hook = alc885_imac24_init_hook, | 8899 | .init_hook = alc885_imac24_init_hook, |
8931 | }, | 8900 | }, |
8932 | [ALC882_TARGA] = { | 8901 | [ALC882_TARGA] = { |
@@ -8944,7 +8913,8 @@ static struct alc_config_preset alc882_presets[] = { | |||
8944 | .need_dac_fix = 1, | 8913 | .need_dac_fix = 1, |
8945 | .input_mux = &alc882_capture_source, | 8914 | .input_mux = &alc882_capture_source, |
8946 | .unsol_event = alc882_targa_unsol_event, | 8915 | .unsol_event = alc882_targa_unsol_event, |
8947 | .init_hook = alc882_targa_init_hook, | 8916 | .setup = alc882_targa_setup, |
8917 | .init_hook = alc882_targa_automute, | ||
8948 | }, | 8918 | }, |
8949 | [ALC882_ASUS_A7J] = { | 8919 | [ALC882_ASUS_A7J] = { |
8950 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, | 8920 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
@@ -9035,7 +9005,8 @@ static struct alc_config_preset alc882_presets[] = { | |||
9035 | .channel_mode = alc889_8ch_intel_modes, | 9005 | .channel_mode = alc889_8ch_intel_modes, |
9036 | .capsrc_nids = alc889_capsrc_nids, | 9006 | .capsrc_nids = alc889_capsrc_nids, |
9037 | .input_mux = &alc889_capture_source, | 9007 | .input_mux = &alc889_capture_source, |
9038 | .init_hook = alc889_automute_init, | 9008 | .setup = alc889_automute_setup, |
9009 | .init_hook = alc_automute_amp, | ||
9039 | .unsol_event = alc_automute_amp_unsol_event, | 9010 | .unsol_event = alc_automute_amp_unsol_event, |
9040 | .need_dac_fix = 1, | 9011 | .need_dac_fix = 1, |
9041 | }, | 9012 | }, |
@@ -9054,6 +9025,7 @@ static struct alc_config_preset alc882_presets[] = { | |||
9054 | .channel_mode = alc889_8ch_intel_modes, | 9025 | .channel_mode = alc889_8ch_intel_modes, |
9055 | .capsrc_nids = alc889_capsrc_nids, | 9026 | .capsrc_nids = alc889_capsrc_nids, |
9056 | .input_mux = &alc889_capture_source, | 9027 | .input_mux = &alc889_capture_source, |
9028 | .setup = alc889_automute_setup, | ||
9057 | .init_hook = alc889_intel_init_hook, | 9029 | .init_hook = alc889_intel_init_hook, |
9058 | .unsol_event = alc_automute_amp_unsol_event, | 9030 | .unsol_event = alc_automute_amp_unsol_event, |
9059 | .need_dac_fix = 1, | 9031 | .need_dac_fix = 1, |
@@ -9081,7 +9053,8 @@ static struct alc_config_preset alc882_presets[] = { | |||
9081 | .need_dac_fix = 1, | 9053 | .need_dac_fix = 1, |
9082 | .input_mux = &alc883_capture_source, | 9054 | .input_mux = &alc883_capture_source, |
9083 | .unsol_event = alc883_targa_unsol_event, | 9055 | .unsol_event = alc883_targa_unsol_event, |
9084 | .init_hook = alc883_targa_init_hook, | 9056 | .setup = alc882_targa_setup, |
9057 | .init_hook = alc882_targa_automute, | ||
9085 | }, | 9058 | }, |
9086 | [ALC883_TARGA_2ch_DIG] = { | 9059 | [ALC883_TARGA_2ch_DIG] = { |
9087 | .mixers = { alc883_targa_2ch_mixer}, | 9060 | .mixers = { alc883_targa_2ch_mixer}, |
@@ -9096,7 +9069,8 @@ static struct alc_config_preset alc882_presets[] = { | |||
9096 | .channel_mode = alc883_3ST_2ch_modes, | 9069 | .channel_mode = alc883_3ST_2ch_modes, |
9097 | .input_mux = &alc883_capture_source, | 9070 | .input_mux = &alc883_capture_source, |
9098 | .unsol_event = alc883_targa_unsol_event, | 9071 | .unsol_event = alc883_targa_unsol_event, |
9099 | .init_hook = alc883_targa_init_hook, | 9072 | .setup = alc882_targa_setup, |
9073 | .init_hook = alc882_targa_automute, | ||
9100 | }, | 9074 | }, |
9101 | [ALC883_TARGA_8ch_DIG] = { | 9075 | [ALC883_TARGA_8ch_DIG] = { |
9102 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | 9076 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
@@ -9114,7 +9088,8 @@ static struct alc_config_preset alc882_presets[] = { | |||
9114 | .need_dac_fix = 1, | 9088 | .need_dac_fix = 1, |
9115 | .input_mux = &alc883_capture_source, | 9089 | .input_mux = &alc883_capture_source, |
9116 | .unsol_event = alc883_targa_unsol_event, | 9090 | .unsol_event = alc883_targa_unsol_event, |
9117 | .init_hook = alc883_targa_init_hook, | 9091 | .setup = alc882_targa_setup, |
9092 | .init_hook = alc882_targa_automute, | ||
9118 | }, | 9093 | }, |
9119 | [ALC883_ACER] = { | 9094 | [ALC883_ACER] = { |
9120 | .mixers = { alc883_base_mixer }, | 9095 | .mixers = { alc883_base_mixer }, |
@@ -9140,7 +9115,8 @@ static struct alc_config_preset alc882_presets[] = { | |||
9140 | .channel_mode = alc883_3ST_2ch_modes, | 9115 | .channel_mode = alc883_3ST_2ch_modes, |
9141 | .input_mux = &alc883_capture_source, | 9116 | .input_mux = &alc883_capture_source, |
9142 | .unsol_event = alc_automute_amp_unsol_event, | 9117 | .unsol_event = alc_automute_amp_unsol_event, |
9143 | .init_hook = alc883_acer_aspire_init_hook, | 9118 | .setup = alc883_acer_aspire_setup, |
9119 | .init_hook = alc_automute_amp, | ||
9144 | }, | 9120 | }, |
9145 | [ALC888_ACER_ASPIRE_4930G] = { | 9121 | [ALC888_ACER_ASPIRE_4930G] = { |
9146 | .mixers = { alc888_base_mixer, | 9122 | .mixers = { alc888_base_mixer, |
@@ -9160,7 +9136,8 @@ static struct alc_config_preset alc882_presets[] = { | |||
9160 | ARRAY_SIZE(alc888_2_capture_sources), | 9136 | ARRAY_SIZE(alc888_2_capture_sources), |
9161 | .input_mux = alc888_2_capture_sources, | 9137 | .input_mux = alc888_2_capture_sources, |
9162 | .unsol_event = alc_automute_amp_unsol_event, | 9138 | .unsol_event = alc_automute_amp_unsol_event, |
9163 | .init_hook = alc888_acer_aspire_4930g_init_hook, | 9139 | .setup = alc888_acer_aspire_4930g_setup, |
9140 | .init_hook = alc_automute_amp, | ||
9164 | }, | 9141 | }, |
9165 | [ALC888_ACER_ASPIRE_6530G] = { | 9142 | [ALC888_ACER_ASPIRE_6530G] = { |
9166 | .mixers = { alc888_acer_aspire_6530_mixer }, | 9143 | .mixers = { alc888_acer_aspire_6530_mixer }, |
@@ -9178,7 +9155,8 @@ static struct alc_config_preset alc882_presets[] = { | |||
9178 | ARRAY_SIZE(alc888_2_capture_sources), | 9155 | ARRAY_SIZE(alc888_2_capture_sources), |
9179 | .input_mux = alc888_acer_aspire_6530_sources, | 9156 | .input_mux = alc888_acer_aspire_6530_sources, |
9180 | .unsol_event = alc_automute_amp_unsol_event, | 9157 | .unsol_event = alc_automute_amp_unsol_event, |
9181 | .init_hook = alc888_acer_aspire_6530g_init_hook, | 9158 | .setup = alc888_acer_aspire_6530g_setup, |
9159 | .init_hook = alc_automute_amp, | ||
9182 | }, | 9160 | }, |
9183 | [ALC888_ACER_ASPIRE_8930G] = { | 9161 | [ALC888_ACER_ASPIRE_8930G] = { |
9184 | .mixers = { alc888_base_mixer, | 9162 | .mixers = { alc888_base_mixer, |
@@ -9199,7 +9177,8 @@ static struct alc_config_preset alc882_presets[] = { | |||
9199 | ARRAY_SIZE(alc889_capture_sources), | 9177 | ARRAY_SIZE(alc889_capture_sources), |
9200 | .input_mux = alc889_capture_sources, | 9178 | .input_mux = alc889_capture_sources, |
9201 | .unsol_event = alc_automute_amp_unsol_event, | 9179 | .unsol_event = alc_automute_amp_unsol_event, |
9202 | .init_hook = alc889_acer_aspire_8930g_init_hook, | 9180 | .setup = alc889_acer_aspire_8930g_setup, |
9181 | .init_hook = alc_automute_amp, | ||
9203 | }, | 9182 | }, |
9204 | [ALC883_MEDION] = { | 9183 | [ALC883_MEDION] = { |
9205 | .mixers = { alc883_fivestack_mixer, | 9184 | .mixers = { alc883_fivestack_mixer, |
@@ -9224,7 +9203,8 @@ static struct alc_config_preset alc882_presets[] = { | |||
9224 | .channel_mode = alc883_3ST_2ch_modes, | 9203 | .channel_mode = alc883_3ST_2ch_modes, |
9225 | .input_mux = &alc883_capture_source, | 9204 | .input_mux = &alc883_capture_source, |
9226 | .unsol_event = alc_automute_amp_unsol_event, | 9205 | .unsol_event = alc_automute_amp_unsol_event, |
9227 | .init_hook = alc883_medion_md2_init_hook, | 9206 | .setup = alc883_medion_md2_setup, |
9207 | .init_hook = alc_automute_amp, | ||
9228 | }, | 9208 | }, |
9229 | [ALC883_LAPTOP_EAPD] = { | 9209 | [ALC883_LAPTOP_EAPD] = { |
9230 | .mixers = { alc883_base_mixer }, | 9210 | .mixers = { alc883_base_mixer }, |
@@ -9245,6 +9225,7 @@ static struct alc_config_preset alc882_presets[] = { | |||
9245 | .channel_mode = alc883_3ST_2ch_modes, | 9225 | .channel_mode = alc883_3ST_2ch_modes, |
9246 | .input_mux = &alc883_capture_source, | 9226 | .input_mux = &alc883_capture_source, |
9247 | .unsol_event = alc883_clevo_m720_unsol_event, | 9227 | .unsol_event = alc883_clevo_m720_unsol_event, |
9228 | .setup = alc883_clevo_m720_setup, | ||
9248 | .init_hook = alc883_clevo_m720_init_hook, | 9229 | .init_hook = alc883_clevo_m720_init_hook, |
9249 | }, | 9230 | }, |
9250 | [ALC883_LENOVO_101E_2ch] = { | 9231 | [ALC883_LENOVO_101E_2ch] = { |
@@ -9270,7 +9251,8 @@ static struct alc_config_preset alc882_presets[] = { | |||
9270 | .need_dac_fix = 1, | 9251 | .need_dac_fix = 1, |
9271 | .input_mux = &alc883_lenovo_nb0763_capture_source, | 9252 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
9272 | .unsol_event = alc_automute_amp_unsol_event, | 9253 | .unsol_event = alc_automute_amp_unsol_event, |
9273 | .init_hook = alc883_medion_md2_init_hook, | 9254 | .setup = alc883_medion_md2_setup, |
9255 | .init_hook = alc_automute_amp, | ||
9274 | }, | 9256 | }, |
9275 | [ALC888_LENOVO_MS7195_DIG] = { | 9257 | [ALC888_LENOVO_MS7195_DIG] = { |
9276 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | 9258 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
@@ -9295,7 +9277,8 @@ static struct alc_config_preset alc882_presets[] = { | |||
9295 | .channel_mode = alc883_3ST_2ch_modes, | 9277 | .channel_mode = alc883_3ST_2ch_modes, |
9296 | .input_mux = &alc883_capture_source, | 9278 | .input_mux = &alc883_capture_source, |
9297 | .unsol_event = alc_automute_amp_unsol_event, | 9279 | .unsol_event = alc_automute_amp_unsol_event, |
9298 | .init_hook = alc883_haier_w66_init_hook, | 9280 | .setup = alc883_haier_w66_setup, |
9281 | .init_hook = alc_automute_amp, | ||
9299 | }, | 9282 | }, |
9300 | [ALC888_3ST_HP] = { | 9283 | [ALC888_3ST_HP] = { |
9301 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | 9284 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
@@ -9307,7 +9290,8 @@ static struct alc_config_preset alc882_presets[] = { | |||
9307 | .need_dac_fix = 1, | 9290 | .need_dac_fix = 1, |
9308 | .input_mux = &alc883_capture_source, | 9291 | .input_mux = &alc883_capture_source, |
9309 | .unsol_event = alc_automute_amp_unsol_event, | 9292 | .unsol_event = alc_automute_amp_unsol_event, |
9310 | .init_hook = alc888_3st_hp_init_hook, | 9293 | .setup = alc888_3st_hp_setup, |
9294 | .init_hook = alc_automute_amp, | ||
9311 | }, | 9295 | }, |
9312 | [ALC888_6ST_DELL] = { | 9296 | [ALC888_6ST_DELL] = { |
9313 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | 9297 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
@@ -9320,7 +9304,8 @@ static struct alc_config_preset alc882_presets[] = { | |||
9320 | .channel_mode = alc883_sixstack_modes, | 9304 | .channel_mode = alc883_sixstack_modes, |
9321 | .input_mux = &alc883_capture_source, | 9305 | .input_mux = &alc883_capture_source, |
9322 | .unsol_event = alc_automute_amp_unsol_event, | 9306 | .unsol_event = alc_automute_amp_unsol_event, |
9323 | .init_hook = alc888_6st_dell_init_hook, | 9307 | .setup = alc888_6st_dell_setup, |
9308 | .init_hook = alc_automute_amp, | ||
9324 | }, | 9309 | }, |
9325 | [ALC883_MITAC] = { | 9310 | [ALC883_MITAC] = { |
9326 | .mixers = { alc883_mitac_mixer }, | 9311 | .mixers = { alc883_mitac_mixer }, |
@@ -9331,7 +9316,8 @@ static struct alc_config_preset alc882_presets[] = { | |||
9331 | .channel_mode = alc883_3ST_2ch_modes, | 9316 | .channel_mode = alc883_3ST_2ch_modes, |
9332 | .input_mux = &alc883_capture_source, | 9317 | .input_mux = &alc883_capture_source, |
9333 | .unsol_event = alc_automute_amp_unsol_event, | 9318 | .unsol_event = alc_automute_amp_unsol_event, |
9334 | .init_hook = alc883_mitac_init_hook, | 9319 | .setup = alc883_mitac_setup, |
9320 | .init_hook = alc_automute_amp, | ||
9335 | }, | 9321 | }, |
9336 | [ALC883_FUJITSU_PI2515] = { | 9322 | [ALC883_FUJITSU_PI2515] = { |
9337 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, | 9323 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
@@ -9344,7 +9330,8 @@ static struct alc_config_preset alc882_presets[] = { | |||
9344 | .channel_mode = alc883_3ST_2ch_modes, | 9330 | .channel_mode = alc883_3ST_2ch_modes, |
9345 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | 9331 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
9346 | .unsol_event = alc_automute_amp_unsol_event, | 9332 | .unsol_event = alc_automute_amp_unsol_event, |
9347 | .init_hook = alc883_2ch_fujitsu_pi2515_init_hook, | 9333 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
9334 | .init_hook = alc_automute_amp, | ||
9348 | }, | 9335 | }, |
9349 | [ALC888_FUJITSU_XA3530] = { | 9336 | [ALC888_FUJITSU_XA3530] = { |
9350 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, | 9337 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
@@ -9362,7 +9349,8 @@ static struct alc_config_preset alc882_presets[] = { | |||
9362 | ARRAY_SIZE(alc888_2_capture_sources), | 9349 | ARRAY_SIZE(alc888_2_capture_sources), |
9363 | .input_mux = alc888_2_capture_sources, | 9350 | .input_mux = alc888_2_capture_sources, |
9364 | .unsol_event = alc_automute_amp_unsol_event, | 9351 | .unsol_event = alc_automute_amp_unsol_event, |
9365 | .init_hook = alc888_fujitsu_xa3530_init_hook, | 9352 | .setup = alc888_fujitsu_xa3530_setup, |
9353 | .init_hook = alc_automute_amp, | ||
9366 | }, | 9354 | }, |
9367 | [ALC888_LENOVO_SKY] = { | 9355 | [ALC888_LENOVO_SKY] = { |
9368 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, | 9356 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
@@ -9375,7 +9363,8 @@ static struct alc_config_preset alc882_presets[] = { | |||
9375 | .need_dac_fix = 1, | 9363 | .need_dac_fix = 1, |
9376 | .input_mux = &alc883_lenovo_sky_capture_source, | 9364 | .input_mux = &alc883_lenovo_sky_capture_source, |
9377 | .unsol_event = alc_automute_amp_unsol_event, | 9365 | .unsol_event = alc_automute_amp_unsol_event, |
9378 | .init_hook = alc888_lenovo_sky_init_hook, | 9366 | .setup = alc888_lenovo_sky_setup, |
9367 | .init_hook = alc_automute_amp, | ||
9379 | }, | 9368 | }, |
9380 | [ALC888_ASUS_M90V] = { | 9369 | [ALC888_ASUS_M90V] = { |
9381 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | 9370 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
@@ -9388,8 +9377,9 @@ static struct alc_config_preset alc882_presets[] = { | |||
9388 | .channel_mode = alc883_3ST_6ch_modes, | 9377 | .channel_mode = alc883_3ST_6ch_modes, |
9389 | .need_dac_fix = 1, | 9378 | .need_dac_fix = 1, |
9390 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | 9379 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
9391 | .unsol_event = alc883_mode2_unsol_event, | 9380 | .unsol_event = alc_sku_unsol_event, |
9392 | .init_hook = alc883_mode2_inithook, | 9381 | .setup = alc883_mode2_setup, |
9382 | .init_hook = alc_inithook, | ||
9393 | }, | 9383 | }, |
9394 | [ALC888_ASUS_EEE1601] = { | 9384 | [ALC888_ASUS_EEE1601] = { |
9395 | .mixers = { alc883_asus_eee1601_mixer }, | 9385 | .mixers = { alc883_asus_eee1601_mixer }, |
@@ -9442,7 +9432,8 @@ static struct alc_config_preset alc882_presets[] = { | |||
9442 | .channel_mode = alc883_3ST_2ch_modes, | 9432 | .channel_mode = alc883_3ST_2ch_modes, |
9443 | .input_mux = &alc883_capture_source, | 9433 | .input_mux = &alc883_capture_source, |
9444 | .unsol_event = alc_automute_amp_unsol_event, | 9434 | .unsol_event = alc_automute_amp_unsol_event, |
9445 | .init_hook = alc883_vaiott_init_hook, | 9435 | .setup = alc883_vaiott_setup, |
9436 | .init_hook = alc_automute_amp, | ||
9446 | }, | 9437 | }, |
9447 | }; | 9438 | }; |
9448 | 9439 | ||
@@ -9954,13 +9945,12 @@ static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { | |||
9954 | }; | 9945 | }; |
9955 | 9946 | ||
9956 | /* mute/unmute internal speaker according to the hp jack and mute state */ | 9947 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
9957 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) | 9948 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
9958 | { | 9949 | { |
9959 | struct alc_spec *spec = codec->spec; | 9950 | struct alc_spec *spec = codec->spec; |
9960 | 9951 | ||
9961 | spec->autocfg.hp_pins[0] = 0x15; | 9952 | spec->autocfg.hp_pins[0] = 0x15; |
9962 | spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ | 9953 | spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ |
9963 | alc_automute_amp(codec); | ||
9964 | } | 9954 | } |
9965 | 9955 | ||
9966 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { | 9956 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
@@ -10117,22 +10107,20 @@ static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) | |||
10117 | alc262_hippo_automute(codec); | 10107 | alc262_hippo_automute(codec); |
10118 | } | 10108 | } |
10119 | 10109 | ||
10120 | static void alc262_hippo_init_hook(struct hda_codec *codec) | 10110 | static void alc262_hippo_setup(struct hda_codec *codec) |
10121 | { | 10111 | { |
10122 | struct alc_spec *spec = codec->spec; | 10112 | struct alc_spec *spec = codec->spec; |
10123 | 10113 | ||
10124 | spec->autocfg.hp_pins[0] = 0x15; | 10114 | spec->autocfg.hp_pins[0] = 0x15; |
10125 | spec->autocfg.speaker_pins[0] = 0x14; | 10115 | spec->autocfg.speaker_pins[0] = 0x14; |
10126 | alc262_hippo_automute(codec); | ||
10127 | } | 10116 | } |
10128 | 10117 | ||
10129 | static void alc262_hippo1_init_hook(struct hda_codec *codec) | 10118 | static void alc262_hippo1_setup(struct hda_codec *codec) |
10130 | { | 10119 | { |
10131 | struct alc_spec *spec = codec->spec; | 10120 | struct alc_spec *spec = codec->spec; |
10132 | 10121 | ||
10133 | spec->autocfg.hp_pins[0] = 0x1b; | 10122 | spec->autocfg.hp_pins[0] = 0x1b; |
10134 | spec->autocfg.speaker_pins[0] = 0x14; | 10123 | spec->autocfg.speaker_pins[0] = 0x14; |
10135 | alc262_hippo_automute(codec); | ||
10136 | } | 10124 | } |
10137 | 10125 | ||
10138 | 10126 | ||
@@ -10189,13 +10177,12 @@ static struct hda_verb alc262_tyan_verbs[] = { | |||
10189 | }; | 10177 | }; |
10190 | 10178 | ||
10191 | /* unsolicited event for HP jack sensing */ | 10179 | /* unsolicited event for HP jack sensing */ |
10192 | static void alc262_tyan_init_hook(struct hda_codec *codec) | 10180 | static void alc262_tyan_setup(struct hda_codec *codec) |
10193 | { | 10181 | { |
10194 | struct alc_spec *spec = codec->spec; | 10182 | struct alc_spec *spec = codec->spec; |
10195 | 10183 | ||
10196 | spec->autocfg.hp_pins[0] = 0x1b; | 10184 | spec->autocfg.hp_pins[0] = 0x1b; |
10197 | spec->autocfg.speaker_pins[0] = 0x15; | 10185 | spec->autocfg.speaker_pins[0] = 0x15; |
10198 | alc_automute_amp(codec); | ||
10199 | } | 10186 | } |
10200 | 10187 | ||
10201 | 10188 | ||
@@ -10307,14 +10294,6 @@ static struct hda_verb alc262_sony_unsol_verbs[] = { | |||
10307 | {} | 10294 | {} |
10308 | }; | 10295 | }; |
10309 | 10296 | ||
10310 | static struct hda_input_mux alc262_dmic_capture_source = { | ||
10311 | .num_items = 2, | ||
10312 | .items = { | ||
10313 | { "Int DMic", 0x9 }, | ||
10314 | { "Mic", 0x0 }, | ||
10315 | }, | ||
10316 | }; | ||
10317 | |||
10318 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { | 10297 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
10319 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 10298 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
10320 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | 10299 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
@@ -10336,35 +10315,17 @@ static struct hda_verb alc262_toshiba_s06_verbs[] = { | |||
10336 | {} | 10315 | {} |
10337 | }; | 10316 | }; |
10338 | 10317 | ||
10339 | static void alc262_dmic_automute(struct hda_codec *codec) | 10318 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
10340 | { | ||
10341 | unsigned int present; | ||
10342 | |||
10343 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
10344 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
10345 | snd_hda_codec_write(codec, 0x22, 0, | ||
10346 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); | ||
10347 | } | ||
10348 | |||
10349 | |||
10350 | /* unsolicited event for HP jack sensing */ | ||
10351 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, | ||
10352 | unsigned int res) | ||
10353 | { | ||
10354 | if ((res >> 26) == ALC880_MIC_EVENT) | ||
10355 | alc262_dmic_automute(codec); | ||
10356 | else | ||
10357 | alc_sku_unsol_event(codec, res); | ||
10358 | } | ||
10359 | |||
10360 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) | ||
10361 | { | 10319 | { |
10362 | struct alc_spec *spec = codec->spec; | 10320 | struct alc_spec *spec = codec->spec; |
10363 | 10321 | ||
10364 | spec->autocfg.hp_pins[0] = 0x15; | 10322 | spec->autocfg.hp_pins[0] = 0x15; |
10365 | spec->autocfg.speaker_pins[0] = 0x14; | 10323 | spec->autocfg.speaker_pins[0] = 0x14; |
10366 | alc_automute_pin(codec); | 10324 | spec->ext_mic.pin = 0x18; |
10367 | alc262_dmic_automute(codec); | 10325 | spec->ext_mic.mux_idx = 0; |
10326 | spec->int_mic.pin = 0x12; | ||
10327 | spec->int_mic.mux_idx = 9; | ||
10328 | spec->auto_mic = 1; | ||
10368 | } | 10329 | } |
10369 | 10330 | ||
10370 | /* | 10331 | /* |
@@ -11337,7 +11298,8 @@ static struct alc_config_preset alc262_presets[] = { | |||
11337 | .channel_mode = alc262_modes, | 11298 | .channel_mode = alc262_modes, |
11338 | .input_mux = &alc262_capture_source, | 11299 | .input_mux = &alc262_capture_source, |
11339 | .unsol_event = alc262_hippo_unsol_event, | 11300 | .unsol_event = alc262_hippo_unsol_event, |
11340 | .init_hook = alc262_hippo_init_hook, | 11301 | .setup = alc262_hippo_setup, |
11302 | .init_hook = alc262_hippo_automute, | ||
11341 | }, | 11303 | }, |
11342 | [ALC262_HIPPO_1] = { | 11304 | [ALC262_HIPPO_1] = { |
11343 | .mixers = { alc262_hippo1_mixer }, | 11305 | .mixers = { alc262_hippo1_mixer }, |
@@ -11350,7 +11312,8 @@ static struct alc_config_preset alc262_presets[] = { | |||
11350 | .channel_mode = alc262_modes, | 11312 | .channel_mode = alc262_modes, |
11351 | .input_mux = &alc262_capture_source, | 11313 | .input_mux = &alc262_capture_source, |
11352 | .unsol_event = alc262_hippo_unsol_event, | 11314 | .unsol_event = alc262_hippo_unsol_event, |
11353 | .init_hook = alc262_hippo1_init_hook, | 11315 | .setup = alc262_hippo1_setup, |
11316 | .init_hook = alc262_hippo_automute, | ||
11354 | }, | 11317 | }, |
11355 | [ALC262_FUJITSU] = { | 11318 | [ALC262_FUJITSU] = { |
11356 | .mixers = { alc262_fujitsu_mixer }, | 11319 | .mixers = { alc262_fujitsu_mixer }, |
@@ -11413,7 +11376,8 @@ static struct alc_config_preset alc262_presets[] = { | |||
11413 | .channel_mode = alc262_modes, | 11376 | .channel_mode = alc262_modes, |
11414 | .input_mux = &alc262_capture_source, | 11377 | .input_mux = &alc262_capture_source, |
11415 | .unsol_event = alc_automute_amp_unsol_event, | 11378 | .unsol_event = alc_automute_amp_unsol_event, |
11416 | .init_hook = alc262_hp_t5735_init_hook, | 11379 | .setup = alc262_hp_t5735_setup, |
11380 | .init_hook = alc_automute_amp, | ||
11417 | }, | 11381 | }, |
11418 | [ALC262_HP_RP5700] = { | 11382 | [ALC262_HP_RP5700] = { |
11419 | .mixers = { alc262_hp_rp5700_mixer }, | 11383 | .mixers = { alc262_hp_rp5700_mixer }, |
@@ -11444,7 +11408,8 @@ static struct alc_config_preset alc262_presets[] = { | |||
11444 | .channel_mode = alc262_modes, | 11408 | .channel_mode = alc262_modes, |
11445 | .input_mux = &alc262_capture_source, | 11409 | .input_mux = &alc262_capture_source, |
11446 | .unsol_event = alc262_hippo_unsol_event, | 11410 | .unsol_event = alc262_hippo_unsol_event, |
11447 | .init_hook = alc262_hippo_init_hook, | 11411 | .setup = alc262_hippo_setup, |
11412 | .init_hook = alc262_hippo_automute, | ||
11448 | }, | 11413 | }, |
11449 | [ALC262_BENQ_T31] = { | 11414 | [ALC262_BENQ_T31] = { |
11450 | .mixers = { alc262_benq_t31_mixer }, | 11415 | .mixers = { alc262_benq_t31_mixer }, |
@@ -11457,7 +11422,8 @@ static struct alc_config_preset alc262_presets[] = { | |||
11457 | .channel_mode = alc262_modes, | 11422 | .channel_mode = alc262_modes, |
11458 | .input_mux = &alc262_capture_source, | 11423 | .input_mux = &alc262_capture_source, |
11459 | .unsol_event = alc262_hippo_unsol_event, | 11424 | .unsol_event = alc262_hippo_unsol_event, |
11460 | .init_hook = alc262_hippo_init_hook, | 11425 | .setup = alc262_hippo_setup, |
11426 | .init_hook = alc262_hippo_automute, | ||
11461 | }, | 11427 | }, |
11462 | [ALC262_ULTRA] = { | 11428 | [ALC262_ULTRA] = { |
11463 | .mixers = { alc262_ultra_mixer }, | 11429 | .mixers = { alc262_ultra_mixer }, |
@@ -11509,9 +11475,9 @@ static struct alc_config_preset alc262_presets[] = { | |||
11509 | .dig_out_nid = ALC262_DIGOUT_NID, | 11475 | .dig_out_nid = ALC262_DIGOUT_NID, |
11510 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | 11476 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
11511 | .channel_mode = alc262_modes, | 11477 | .channel_mode = alc262_modes, |
11512 | .input_mux = &alc262_dmic_capture_source, | 11478 | .unsol_event = alc_sku_unsol_event, |
11513 | .unsol_event = alc262_toshiba_s06_unsol_event, | 11479 | .setup = alc262_toshiba_s06_setup, |
11514 | .init_hook = alc262_toshiba_s06_init_hook, | 11480 | .init_hook = alc_inithook, |
11515 | }, | 11481 | }, |
11516 | [ALC262_TOSHIBA_RX1] = { | 11482 | [ALC262_TOSHIBA_RX1] = { |
11517 | .mixers = { alc262_toshiba_rx1_mixer }, | 11483 | .mixers = { alc262_toshiba_rx1_mixer }, |
@@ -11523,7 +11489,8 @@ static struct alc_config_preset alc262_presets[] = { | |||
11523 | .channel_mode = alc262_modes, | 11489 | .channel_mode = alc262_modes, |
11524 | .input_mux = &alc262_capture_source, | 11490 | .input_mux = &alc262_capture_source, |
11525 | .unsol_event = alc262_hippo_unsol_event, | 11491 | .unsol_event = alc262_hippo_unsol_event, |
11526 | .init_hook = alc262_hippo_init_hook, | 11492 | .setup = alc262_hippo_setup, |
11493 | .init_hook = alc262_hippo_automute, | ||
11527 | }, | 11494 | }, |
11528 | [ALC262_TYAN] = { | 11495 | [ALC262_TYAN] = { |
11529 | .mixers = { alc262_tyan_mixer }, | 11496 | .mixers = { alc262_tyan_mixer }, |
@@ -11536,7 +11503,8 @@ static struct alc_config_preset alc262_presets[] = { | |||
11536 | .channel_mode = alc262_modes, | 11503 | .channel_mode = alc262_modes, |
11537 | .input_mux = &alc262_capture_source, | 11504 | .input_mux = &alc262_capture_source, |
11538 | .unsol_event = alc_automute_amp_unsol_event, | 11505 | .unsol_event = alc_automute_amp_unsol_event, |
11539 | .init_hook = alc262_tyan_init_hook, | 11506 | .setup = alc262_tyan_setup, |
11507 | .init_hook = alc_automute_amp, | ||
11540 | }, | 11508 | }, |
11541 | }; | 11509 | }; |
11542 | 11510 | ||
@@ -11732,14 +11700,6 @@ static struct hda_verb alc268_toshiba_verbs[] = { | |||
11732 | { } /* end */ | 11700 | { } /* end */ |
11733 | }; | 11701 | }; |
11734 | 11702 | ||
11735 | static struct hda_input_mux alc268_acer_lc_capture_source = { | ||
11736 | .num_items = 2, | ||
11737 | .items = { | ||
11738 | { "i-Mic", 0x6 }, | ||
11739 | { "E-Mic", 0x0 }, | ||
11740 | }, | ||
11741 | }; | ||
11742 | |||
11743 | /* Acer specific */ | 11703 | /* Acer specific */ |
11744 | /* bind volumes of both NID 0x02 and 0x03 */ | 11704 | /* bind volumes of both NID 0x02 and 0x03 */ |
11745 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { | 11705 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
@@ -11858,7 +11818,8 @@ static struct hda_verb alc268_acer_verbs[] = { | |||
11858 | 11818 | ||
11859 | /* unsolicited event for HP jack sensing */ | 11819 | /* unsolicited event for HP jack sensing */ |
11860 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event | 11820 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
11861 | #define alc268_toshiba_init_hook alc262_hippo_init_hook | 11821 | #define alc268_toshiba_setup alc262_hippo_setup |
11822 | #define alc268_toshiba_automute alc262_hippo_automute | ||
11862 | 11823 | ||
11863 | static void alc268_acer_unsol_event(struct hda_codec *codec, | 11824 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
11864 | unsigned int res) | 11825 | unsigned int res) |
@@ -11888,30 +11849,33 @@ static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) | |||
11888 | AMP_IN_MUTE(0), bits); | 11849 | AMP_IN_MUTE(0), bits); |
11889 | } | 11850 | } |
11890 | 11851 | ||
11891 | |||
11892 | static void alc268_acer_mic_automute(struct hda_codec *codec) | ||
11893 | { | ||
11894 | unsigned int present; | ||
11895 | |||
11896 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
11897 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
11898 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, | ||
11899 | present ? 0x0 : 0x6); | ||
11900 | } | ||
11901 | |||
11902 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, | 11852 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
11903 | unsigned int res) | 11853 | unsigned int res) |
11904 | { | 11854 | { |
11905 | if ((res >> 26) == ALC880_HP_EVENT) | 11855 | switch (res >> 26) { |
11856 | case ALC880_HP_EVENT: | ||
11906 | alc268_aspire_one_speaker_automute(codec); | 11857 | alc268_aspire_one_speaker_automute(codec); |
11907 | if ((res >> 26) == ALC880_MIC_EVENT) | 11858 | break; |
11908 | alc268_acer_mic_automute(codec); | 11859 | case ALC880_MIC_EVENT: |
11860 | alc_mic_automute(codec); | ||
11861 | break; | ||
11862 | } | ||
11863 | } | ||
11864 | |||
11865 | static void alc268_acer_lc_setup(struct hda_codec *codec) | ||
11866 | { | ||
11867 | struct alc_spec *spec = codec->spec; | ||
11868 | spec->ext_mic.pin = 0x18; | ||
11869 | spec->ext_mic.mux_idx = 0; | ||
11870 | spec->int_mic.pin = 0x12; | ||
11871 | spec->int_mic.mux_idx = 6; | ||
11872 | spec->auto_mic = 1; | ||
11909 | } | 11873 | } |
11910 | 11874 | ||
11911 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) | 11875 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
11912 | { | 11876 | { |
11913 | alc268_aspire_one_speaker_automute(codec); | 11877 | alc268_aspire_one_speaker_automute(codec); |
11914 | alc268_acer_mic_automute(codec); | 11878 | alc_mic_automute(codec); |
11915 | } | 11879 | } |
11916 | 11880 | ||
11917 | static struct snd_kcontrol_new alc268_dell_mixer[] = { | 11881 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
@@ -11929,17 +11893,22 @@ static struct hda_verb alc268_dell_verbs[] = { | |||
11929 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 11893 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
11930 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 11894 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
11931 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | 11895 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
11896 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | ||
11932 | { } | 11897 | { } |
11933 | }; | 11898 | }; |
11934 | 11899 | ||
11935 | /* mute/unmute internal speaker according to the hp jack and mute state */ | 11900 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
11936 | static void alc268_dell_init_hook(struct hda_codec *codec) | 11901 | static void alc268_dell_setup(struct hda_codec *codec) |
11937 | { | 11902 | { |
11938 | struct alc_spec *spec = codec->spec; | 11903 | struct alc_spec *spec = codec->spec; |
11939 | 11904 | ||
11940 | spec->autocfg.hp_pins[0] = 0x15; | 11905 | spec->autocfg.hp_pins[0] = 0x15; |
11941 | spec->autocfg.speaker_pins[0] = 0x14; | 11906 | spec->autocfg.speaker_pins[0] = 0x14; |
11942 | alc_automute_pin(codec); | 11907 | spec->ext_mic.pin = 0x18; |
11908 | spec->ext_mic.mux_idx = 0; | ||
11909 | spec->int_mic.pin = 0x19; | ||
11910 | spec->int_mic.mux_idx = 1; | ||
11911 | spec->auto_mic = 1; | ||
11943 | } | 11912 | } |
11944 | 11913 | ||
11945 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { | 11914 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
@@ -11960,38 +11929,16 @@ static struct hda_verb alc267_quanta_il1_verbs[] = { | |||
11960 | { } | 11929 | { } |
11961 | }; | 11930 | }; |
11962 | 11931 | ||
11963 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) | 11932 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
11964 | { | ||
11965 | unsigned int present; | ||
11966 | |||
11967 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
11968 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
11969 | snd_hda_codec_write(codec, 0x23, 0, | ||
11970 | AC_VERB_SET_CONNECT_SEL, | ||
11971 | present ? 0x00 : 0x01); | ||
11972 | } | ||
11973 | |||
11974 | static void alc267_quanta_il1_init_hook(struct hda_codec *codec) | ||
11975 | { | 11933 | { |
11976 | struct alc_spec *spec = codec->spec; | 11934 | struct alc_spec *spec = codec->spec; |
11977 | |||
11978 | spec->autocfg.hp_pins[0] = 0x15; | 11935 | spec->autocfg.hp_pins[0] = 0x15; |
11979 | spec->autocfg.speaker_pins[0] = 0x14; | 11936 | spec->autocfg.speaker_pins[0] = 0x14; |
11980 | alc_automute_pin(codec); | 11937 | spec->ext_mic.pin = 0x18; |
11981 | alc267_quanta_il1_mic_automute(codec); | 11938 | spec->ext_mic.mux_idx = 0; |
11982 | } | 11939 | spec->int_mic.pin = 0x19; |
11983 | 11940 | spec->int_mic.mux_idx = 1; | |
11984 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, | 11941 | spec->auto_mic = 1; |
11985 | unsigned int res) | ||
11986 | { | ||
11987 | switch (res >> 26) { | ||
11988 | case ALC880_MIC_EVENT: | ||
11989 | alc267_quanta_il1_mic_automute(codec); | ||
11990 | break; | ||
11991 | default: | ||
11992 | alc_sku_unsol_event(codec, res); | ||
11993 | break; | ||
11994 | } | ||
11995 | } | 11942 | } |
11996 | 11943 | ||
11997 | /* | 11944 | /* |
@@ -12490,8 +12437,9 @@ static struct alc_config_preset alc268_presets[] = { | |||
12490 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | 12437 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
12491 | .channel_mode = alc268_modes, | 12438 | .channel_mode = alc268_modes, |
12492 | .input_mux = &alc268_capture_source, | 12439 | .input_mux = &alc268_capture_source, |
12493 | .unsol_event = alc267_quanta_il1_unsol_event, | 12440 | .unsol_event = alc_sku_unsol_event, |
12494 | .init_hook = alc267_quanta_il1_init_hook, | 12441 | .setup = alc267_quanta_il1_setup, |
12442 | .init_hook = alc_inithook, | ||
12495 | }, | 12443 | }, |
12496 | [ALC268_3ST] = { | 12444 | [ALC268_3ST] = { |
12497 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, | 12445 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
@@ -12523,7 +12471,8 @@ static struct alc_config_preset alc268_presets[] = { | |||
12523 | .channel_mode = alc268_modes, | 12471 | .channel_mode = alc268_modes, |
12524 | .input_mux = &alc268_capture_source, | 12472 | .input_mux = &alc268_capture_source, |
12525 | .unsol_event = alc268_toshiba_unsol_event, | 12473 | .unsol_event = alc268_toshiba_unsol_event, |
12526 | .init_hook = alc268_toshiba_init_hook, | 12474 | .setup = alc268_toshiba_setup, |
12475 | .init_hook = alc268_toshiba_automute, | ||
12527 | }, | 12476 | }, |
12528 | [ALC268_ACER] = { | 12477 | [ALC268_ACER] = { |
12529 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, | 12478 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
@@ -12573,8 +12522,8 @@ static struct alc_config_preset alc268_presets[] = { | |||
12573 | .hp_nid = 0x03, | 12522 | .hp_nid = 0x03, |
12574 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | 12523 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
12575 | .channel_mode = alc268_modes, | 12524 | .channel_mode = alc268_modes, |
12576 | .input_mux = &alc268_acer_lc_capture_source, | ||
12577 | .unsol_event = alc268_acer_lc_unsol_event, | 12525 | .unsol_event = alc268_acer_lc_unsol_event, |
12526 | .setup = alc268_acer_lc_setup, | ||
12578 | .init_hook = alc268_acer_lc_init_hook, | 12527 | .init_hook = alc268_acer_lc_init_hook, |
12579 | }, | 12528 | }, |
12580 | [ALC268_DELL] = { | 12529 | [ALC268_DELL] = { |
@@ -12587,8 +12536,8 @@ static struct alc_config_preset alc268_presets[] = { | |||
12587 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | 12536 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
12588 | .channel_mode = alc268_modes, | 12537 | .channel_mode = alc268_modes, |
12589 | .unsol_event = alc_sku_unsol_event, | 12538 | .unsol_event = alc_sku_unsol_event, |
12590 | .init_hook = alc268_dell_init_hook, | 12539 | .setup = alc268_dell_setup, |
12591 | .input_mux = &alc268_capture_source, | 12540 | .init_hook = alc_inithook, |
12592 | }, | 12541 | }, |
12593 | [ALC268_ZEPTO] = { | 12542 | [ALC268_ZEPTO] = { |
12594 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, | 12543 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
@@ -12605,8 +12554,8 @@ static struct alc_config_preset alc268_presets[] = { | |||
12605 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | 12554 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
12606 | .channel_mode = alc268_modes, | 12555 | .channel_mode = alc268_modes, |
12607 | .input_mux = &alc268_capture_source, | 12556 | .input_mux = &alc268_capture_source, |
12608 | .unsol_event = alc268_toshiba_unsol_event, | 12557 | .setup = alc268_toshiba_setup, |
12609 | .init_hook = alc268_toshiba_init_hook | 12558 | .init_hook = alc268_toshiba_automute, |
12610 | }, | 12559 | }, |
12611 | #ifdef CONFIG_SND_DEBUG | 12560 | #ifdef CONFIG_SND_DEBUG |
12612 | [ALC268_TEST] = { | 12561 | [ALC268_TEST] = { |
@@ -12750,22 +12699,6 @@ static hda_nid_t alc269_capsrc_nids[1] = { | |||
12750 | * not a mux! | 12699 | * not a mux! |
12751 | */ | 12700 | */ |
12752 | 12701 | ||
12753 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { | ||
12754 | .num_items = 2, | ||
12755 | .items = { | ||
12756 | { "i-Mic", 0x5 }, | ||
12757 | { "e-Mic", 0x0 }, | ||
12758 | }, | ||
12759 | }; | ||
12760 | |||
12761 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { | ||
12762 | .num_items = 2, | ||
12763 | .items = { | ||
12764 | { "i-Mic", 0x1 }, | ||
12765 | { "e-Mic", 0x0 }, | ||
12766 | }, | ||
12767 | }; | ||
12768 | |||
12769 | #define alc269_modes alc260_modes | 12702 | #define alc269_modes alc260_modes |
12770 | #define alc269_capture_source alc880_lg_lw_capture_source | 12703 | #define alc269_capture_source alc880_lg_lw_capture_source |
12771 | 12704 | ||
@@ -12927,16 +12860,6 @@ static void alc269_lifebook_speaker_automute(struct hda_codec *codec) | |||
12927 | AC_VERB_SET_PROC_COEF, 0x480); | 12860 | AC_VERB_SET_PROC_COEF, 0x480); |
12928 | } | 12861 | } |
12929 | 12862 | ||
12930 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) | ||
12931 | { | ||
12932 | unsigned int present; | ||
12933 | |||
12934 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
12935 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
12936 | snd_hda_codec_write(codec, 0x23, 0, | ||
12937 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); | ||
12938 | } | ||
12939 | |||
12940 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) | 12863 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
12941 | { | 12864 | { |
12942 | unsigned int present_laptop; | 12865 | unsigned int present_laptop; |
@@ -12963,10 +12886,14 @@ static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) | |||
12963 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, | 12886 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
12964 | unsigned int res) | 12887 | unsigned int res) |
12965 | { | 12888 | { |
12966 | if ((res >> 26) == ALC880_HP_EVENT) | 12889 | switch (res >> 26) { |
12890 | case ALC880_HP_EVENT: | ||
12967 | alc269_quanta_fl1_speaker_automute(codec); | 12891 | alc269_quanta_fl1_speaker_automute(codec); |
12968 | if ((res >> 26) == ALC880_MIC_EVENT) | 12892 | break; |
12969 | alc269_quanta_fl1_mic_automute(codec); | 12893 | case ALC880_MIC_EVENT: |
12894 | alc_mic_automute(codec); | ||
12895 | break; | ||
12896 | } | ||
12970 | } | 12897 | } |
12971 | 12898 | ||
12972 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, | 12899 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
@@ -12978,10 +12905,20 @@ static void alc269_lifebook_unsol_event(struct hda_codec *codec, | |||
12978 | alc269_lifebook_mic_autoswitch(codec); | 12905 | alc269_lifebook_mic_autoswitch(codec); |
12979 | } | 12906 | } |
12980 | 12907 | ||
12908 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) | ||
12909 | { | ||
12910 | struct alc_spec *spec = codec->spec; | ||
12911 | spec->ext_mic.pin = 0x18; | ||
12912 | spec->ext_mic.mux_idx = 0; | ||
12913 | spec->int_mic.pin = 0x19; | ||
12914 | spec->int_mic.mux_idx = 1; | ||
12915 | spec->auto_mic = 1; | ||
12916 | } | ||
12917 | |||
12981 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) | 12918 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
12982 | { | 12919 | { |
12983 | alc269_quanta_fl1_speaker_automute(codec); | 12920 | alc269_quanta_fl1_speaker_automute(codec); |
12984 | alc269_quanta_fl1_mic_automute(codec); | 12921 | alc_mic_automute(codec); |
12985 | } | 12922 | } |
12986 | 12923 | ||
12987 | static void alc269_lifebook_init_hook(struct hda_codec *codec) | 12924 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
@@ -13026,60 +12963,44 @@ static void alc269_speaker_automute(struct hda_codec *codec) | |||
13026 | AMP_IN_MUTE(0), bits); | 12963 | AMP_IN_MUTE(0), bits); |
13027 | } | 12964 | } |
13028 | 12965 | ||
13029 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) | ||
13030 | { | ||
13031 | unsigned int present; | ||
13032 | |||
13033 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
13034 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
13035 | snd_hda_codec_write(codec, 0x23, 0, | ||
13036 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); | ||
13037 | } | ||
13038 | |||
13039 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) | ||
13040 | { | ||
13041 | unsigned int present; | ||
13042 | |||
13043 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
13044 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
13045 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
13046 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | ||
13047 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
13048 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); | ||
13049 | } | ||
13050 | |||
13051 | /* unsolicited event for HP jack sensing */ | 12966 | /* unsolicited event for HP jack sensing */ |
13052 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, | 12967 | static void alc269_eeepc_unsol_event(struct hda_codec *codec, |
13053 | unsigned int res) | 12968 | unsigned int res) |
13054 | { | 12969 | { |
13055 | if ((res >> 26) == ALC880_HP_EVENT) | 12970 | switch (res >> 26) { |
12971 | case ALC880_HP_EVENT: | ||
13056 | alc269_speaker_automute(codec); | 12972 | alc269_speaker_automute(codec); |
13057 | 12973 | break; | |
13058 | if ((res >> 26) == ALC880_MIC_EVENT) | 12974 | case ALC880_MIC_EVENT: |
13059 | alc269_eeepc_dmic_automute(codec); | 12975 | alc_mic_automute(codec); |
12976 | break; | ||
12977 | } | ||
13060 | } | 12978 | } |
13061 | 12979 | ||
13062 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) | 12980 | static void alc269_eeepc_dmic_setup(struct hda_codec *codec) |
13063 | { | 12981 | { |
13064 | alc269_speaker_automute(codec); | 12982 | struct alc_spec *spec = codec->spec; |
13065 | alc269_eeepc_dmic_automute(codec); | 12983 | spec->ext_mic.pin = 0x18; |
12984 | spec->ext_mic.mux_idx = 0; | ||
12985 | spec->int_mic.pin = 0x12; | ||
12986 | spec->int_mic.mux_idx = 5; | ||
12987 | spec->auto_mic = 1; | ||
13066 | } | 12988 | } |
13067 | 12989 | ||
13068 | /* unsolicited event for HP jack sensing */ | 12990 | static void alc269_eeepc_amic_setup(struct hda_codec *codec) |
13069 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, | ||
13070 | unsigned int res) | ||
13071 | { | 12991 | { |
13072 | if ((res >> 26) == ALC880_HP_EVENT) | 12992 | struct alc_spec *spec = codec->spec; |
13073 | alc269_speaker_automute(codec); | 12993 | spec->ext_mic.pin = 0x18; |
13074 | 12994 | spec->ext_mic.mux_idx = 0; | |
13075 | if ((res >> 26) == ALC880_MIC_EVENT) | 12995 | spec->int_mic.pin = 0x19; |
13076 | alc269_eeepc_amic_automute(codec); | 12996 | spec->int_mic.mux_idx = 1; |
12997 | spec->auto_mic = 1; | ||
13077 | } | 12998 | } |
13078 | 12999 | ||
13079 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) | 13000 | static void alc269_eeepc_inithook(struct hda_codec *codec) |
13080 | { | 13001 | { |
13081 | alc269_speaker_automute(codec); | 13002 | alc269_speaker_automute(codec); |
13082 | alc269_eeepc_amic_automute(codec); | 13003 | alc_mic_automute(codec); |
13083 | } | 13004 | } |
13084 | 13005 | ||
13085 | /* | 13006 | /* |
@@ -13385,6 +13306,7 @@ static struct alc_config_preset alc269_presets[] = { | |||
13385 | .channel_mode = alc269_modes, | 13306 | .channel_mode = alc269_modes, |
13386 | .input_mux = &alc269_capture_source, | 13307 | .input_mux = &alc269_capture_source, |
13387 | .unsol_event = alc269_quanta_fl1_unsol_event, | 13308 | .unsol_event = alc269_quanta_fl1_unsol_event, |
13309 | .setup = alc269_quanta_fl1_setup, | ||
13388 | .init_hook = alc269_quanta_fl1_init_hook, | 13310 | .init_hook = alc269_quanta_fl1_init_hook, |
13389 | }, | 13311 | }, |
13390 | [ALC269_ASUS_EEEPC_P703] = { | 13312 | [ALC269_ASUS_EEEPC_P703] = { |
@@ -13397,9 +13319,9 @@ static struct alc_config_preset alc269_presets[] = { | |||
13397 | .hp_nid = 0x03, | 13319 | .hp_nid = 0x03, |
13398 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | 13320 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
13399 | .channel_mode = alc269_modes, | 13321 | .channel_mode = alc269_modes, |
13400 | .input_mux = &alc269_eeepc_amic_capture_source, | 13322 | .unsol_event = alc269_eeepc_unsol_event, |
13401 | .unsol_event = alc269_eeepc_amic_unsol_event, | 13323 | .setup = alc269_eeepc_amic_setup, |
13402 | .init_hook = alc269_eeepc_amic_inithook, | 13324 | .init_hook = alc269_eeepc_inithook, |
13403 | }, | 13325 | }, |
13404 | [ALC269_ASUS_EEEPC_P901] = { | 13326 | [ALC269_ASUS_EEEPC_P901] = { |
13405 | .mixers = { alc269_eeepc_mixer }, | 13327 | .mixers = { alc269_eeepc_mixer }, |
@@ -13411,9 +13333,9 @@ static struct alc_config_preset alc269_presets[] = { | |||
13411 | .hp_nid = 0x03, | 13333 | .hp_nid = 0x03, |
13412 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | 13334 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
13413 | .channel_mode = alc269_modes, | 13335 | .channel_mode = alc269_modes, |
13414 | .input_mux = &alc269_eeepc_dmic_capture_source, | 13336 | .unsol_event = alc269_eeepc_unsol_event, |
13415 | .unsol_event = alc269_eeepc_dmic_unsol_event, | 13337 | .setup = alc269_eeepc_dmic_setup, |
13416 | .init_hook = alc269_eeepc_dmic_inithook, | 13338 | .init_hook = alc269_eeepc_inithook, |
13417 | }, | 13339 | }, |
13418 | [ALC269_FUJITSU] = { | 13340 | [ALC269_FUJITSU] = { |
13419 | .mixers = { alc269_fujitsu_mixer }, | 13341 | .mixers = { alc269_fujitsu_mixer }, |
@@ -13425,9 +13347,9 @@ static struct alc_config_preset alc269_presets[] = { | |||
13425 | .hp_nid = 0x03, | 13347 | .hp_nid = 0x03, |
13426 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | 13348 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
13427 | .channel_mode = alc269_modes, | 13349 | .channel_mode = alc269_modes, |
13428 | .input_mux = &alc269_eeepc_dmic_capture_source, | 13350 | .unsol_event = alc269_eeepc_unsol_event, |
13429 | .unsol_event = alc269_eeepc_dmic_unsol_event, | 13351 | .setup = alc269_eeepc_dmic_setup, |
13430 | .init_hook = alc269_eeepc_dmic_inithook, | 13352 | .init_hook = alc269_eeepc_inithook, |
13431 | }, | 13353 | }, |
13432 | [ALC269_LIFEBOOK] = { | 13354 | [ALC269_LIFEBOOK] = { |
13433 | .mixers = { alc269_lifebook_mixer }, | 13355 | .mixers = { alc269_lifebook_mixer }, |
@@ -15044,12 +14966,15 @@ static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) | |||
15044 | HDA_AMP_MUTE, bits); | 14966 | HDA_AMP_MUTE, bits); |
15045 | } | 14967 | } |
15046 | 14968 | ||
15047 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) | 14969 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
15048 | { | 14970 | { |
15049 | struct alc_spec *spec = codec->spec; | 14971 | struct alc_spec *spec = codec->spec; |
15050 | |||
15051 | spec->autocfg.hp_pins[0] = 0x1b; | 14972 | spec->autocfg.hp_pins[0] = 0x1b; |
15052 | spec->autocfg.speaker_pins[0] = 0x14; | 14973 | spec->autocfg.speaker_pins[0] = 0x14; |
14974 | } | ||
14975 | |||
14976 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) | ||
14977 | { | ||
15053 | alc_automute_amp(codec); | 14978 | alc_automute_amp(codec); |
15054 | alc861vd_lenovo_mic_automute(codec); | 14979 | alc861vd_lenovo_mic_automute(codec); |
15055 | } | 14980 | } |
@@ -15113,13 +15038,12 @@ static struct hda_verb alc861vd_dallas_verbs[] = { | |||
15113 | }; | 15038 | }; |
15114 | 15039 | ||
15115 | /* toggle speaker-output according to the hp-jack state */ | 15040 | /* toggle speaker-output according to the hp-jack state */ |
15116 | static void alc861vd_dallas_init_hook(struct hda_codec *codec) | 15041 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
15117 | { | 15042 | { |
15118 | struct alc_spec *spec = codec->spec; | 15043 | struct alc_spec *spec = codec->spec; |
15119 | 15044 | ||
15120 | spec->autocfg.hp_pins[0] = 0x15; | 15045 | spec->autocfg.hp_pins[0] = 0x15; |
15121 | spec->autocfg.speaker_pins[0] = 0x14; | 15046 | spec->autocfg.speaker_pins[0] = 0x14; |
15122 | alc_automute_amp(codec); | ||
15123 | } | 15047 | } |
15124 | 15048 | ||
15125 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 15049 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
@@ -15233,6 +15157,7 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
15233 | .channel_mode = alc861vd_3stack_2ch_modes, | 15157 | .channel_mode = alc861vd_3stack_2ch_modes, |
15234 | .input_mux = &alc861vd_capture_source, | 15158 | .input_mux = &alc861vd_capture_source, |
15235 | .unsol_event = alc861vd_lenovo_unsol_event, | 15159 | .unsol_event = alc861vd_lenovo_unsol_event, |
15160 | .setup = alc861vd_lenovo_setup, | ||
15236 | .init_hook = alc861vd_lenovo_init_hook, | 15161 | .init_hook = alc861vd_lenovo_init_hook, |
15237 | }, | 15162 | }, |
15238 | [ALC861VD_DALLAS] = { | 15163 | [ALC861VD_DALLAS] = { |
@@ -15244,7 +15169,8 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
15244 | .channel_mode = alc861vd_3stack_2ch_modes, | 15169 | .channel_mode = alc861vd_3stack_2ch_modes, |
15245 | .input_mux = &alc861vd_dallas_capture_source, | 15170 | .input_mux = &alc861vd_dallas_capture_source, |
15246 | .unsol_event = alc_automute_amp_unsol_event, | 15171 | .unsol_event = alc_automute_amp_unsol_event, |
15247 | .init_hook = alc861vd_dallas_init_hook, | 15172 | .setup = alc861vd_dallas_setup, |
15173 | .init_hook = alc_automute_amp, | ||
15248 | }, | 15174 | }, |
15249 | [ALC861VD_HP] = { | 15175 | [ALC861VD_HP] = { |
15250 | .mixers = { alc861vd_hp_mixer }, | 15176 | .mixers = { alc861vd_hp_mixer }, |
@@ -15256,7 +15182,8 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
15256 | .channel_mode = alc861vd_3stack_2ch_modes, | 15182 | .channel_mode = alc861vd_3stack_2ch_modes, |
15257 | .input_mux = &alc861vd_hp_capture_source, | 15183 | .input_mux = &alc861vd_hp_capture_source, |
15258 | .unsol_event = alc_automute_amp_unsol_event, | 15184 | .unsol_event = alc_automute_amp_unsol_event, |
15259 | .init_hook = alc861vd_dallas_init_hook, | 15185 | .setup = alc861vd_dallas_setup, |
15186 | .init_hook = alc_automute_amp, | ||
15260 | }, | 15187 | }, |
15261 | [ALC660VD_ASUS_V1S] = { | 15188 | [ALC660VD_ASUS_V1S] = { |
15262 | .mixers = { alc861vd_lenovo_mixer }, | 15189 | .mixers = { alc861vd_lenovo_mixer }, |
@@ -15271,6 +15198,7 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
15271 | .channel_mode = alc861vd_3stack_2ch_modes, | 15198 | .channel_mode = alc861vd_3stack_2ch_modes, |
15272 | .input_mux = &alc861vd_capture_source, | 15199 | .input_mux = &alc861vd_capture_source, |
15273 | .unsol_event = alc861vd_lenovo_unsol_event, | 15200 | .unsol_event = alc861vd_lenovo_unsol_event, |
15201 | .setup = alc861vd_lenovo_setup, | ||
15274 | .init_hook = alc861vd_lenovo_init_hook, | 15202 | .init_hook = alc861vd_lenovo_init_hook, |
15275 | }, | 15203 | }, |
15276 | }; | 15204 | }; |
@@ -15660,14 +15588,6 @@ static struct hda_input_mux alc662_lenovo_101e_capture_source = { | |||
15660 | }, | 15588 | }, |
15661 | }; | 15589 | }; |
15662 | 15590 | ||
15663 | static struct hda_input_mux alc662_eeepc_capture_source = { | ||
15664 | .num_items = 2, | ||
15665 | .items = { | ||
15666 | { "i-Mic", 0x1 }, | ||
15667 | { "e-Mic", 0x0 }, | ||
15668 | }, | ||
15669 | }; | ||
15670 | |||
15671 | static struct hda_input_mux alc663_capture_source = { | 15591 | static struct hda_input_mux alc663_capture_source = { |
15672 | .num_items = 3, | 15592 | .num_items = 3, |
15673 | .items = { | 15593 | .items = { |
@@ -15677,23 +15597,7 @@ static struct hda_input_mux alc663_capture_source = { | |||
15677 | }, | 15597 | }, |
15678 | }; | 15598 | }; |
15679 | 15599 | ||
15680 | static struct hda_input_mux alc663_m51va_capture_source = { | 15600 | #if 0 /* set to 1 for testing other input sources below */ |
15681 | .num_items = 2, | ||
15682 | .items = { | ||
15683 | { "Ext-Mic", 0x0 }, | ||
15684 | { "D-Mic", 0x9 }, | ||
15685 | }, | ||
15686 | }; | ||
15687 | |||
15688 | #if 1 /* set to 0 for testing other input sources below */ | ||
15689 | static struct hda_input_mux alc272_nc10_capture_source = { | ||
15690 | .num_items = 2, | ||
15691 | .items = { | ||
15692 | { "Autoselect Mic", 0x0 }, | ||
15693 | { "Internal Mic", 0x1 }, | ||
15694 | }, | ||
15695 | }; | ||
15696 | #else | ||
15697 | static struct hda_input_mux alc272_nc10_capture_source = { | 15601 | static struct hda_input_mux alc272_nc10_capture_source = { |
15698 | .num_items = 16, | 15602 | .num_items = 16, |
15699 | .items = { | 15603 | .items = { |
@@ -16362,47 +16266,44 @@ static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, | |||
16362 | alc662_lenovo_101e_ispeaker_automute(codec); | 16266 | alc662_lenovo_101e_ispeaker_automute(codec); |
16363 | } | 16267 | } |
16364 | 16268 | ||
16365 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) | ||
16366 | { | ||
16367 | unsigned int present; | ||
16368 | |||
16369 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
16370 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
16371 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
16372 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | ||
16373 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
16374 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | ||
16375 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
16376 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); | ||
16377 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
16378 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); | ||
16379 | } | ||
16380 | |||
16381 | /* unsolicited event for HP jack sensing */ | 16269 | /* unsolicited event for HP jack sensing */ |
16382 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, | 16270 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
16383 | unsigned int res) | 16271 | unsigned int res) |
16384 | { | 16272 | { |
16385 | if ((res >> 26) == ALC880_MIC_EVENT) | 16273 | if ((res >> 26) == ALC880_MIC_EVENT) |
16386 | alc662_eeepc_mic_automute(codec); | 16274 | alc_mic_automute(codec); |
16387 | else | 16275 | else |
16388 | alc262_hippo_unsol_event(codec, res); | 16276 | alc262_hippo_unsol_event(codec, res); |
16389 | } | 16277 | } |
16390 | 16278 | ||
16279 | static void alc662_eeepc_setup(struct hda_codec *codec) | ||
16280 | { | ||
16281 | struct alc_spec *spec = codec->spec; | ||
16282 | |||
16283 | alc262_hippo1_setup(codec); | ||
16284 | spec->ext_mic.pin = 0x18; | ||
16285 | spec->ext_mic.mux_idx = 0; | ||
16286 | spec->int_mic.pin = 0x19; | ||
16287 | spec->int_mic.mux_idx = 1; | ||
16288 | spec->auto_mic = 1; | ||
16289 | } | ||
16290 | |||
16391 | static void alc662_eeepc_inithook(struct hda_codec *codec) | 16291 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
16392 | { | 16292 | { |
16393 | alc262_hippo1_init_hook(codec); | 16293 | alc262_hippo_automute(codec); |
16394 | alc662_eeepc_mic_automute(codec); | 16294 | alc_mic_automute(codec); |
16395 | } | 16295 | } |
16396 | 16296 | ||
16397 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) | 16297 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
16398 | { | 16298 | { |
16399 | struct alc_spec *spec = codec->spec; | 16299 | struct alc_spec *spec = codec->spec; |
16400 | 16300 | ||
16401 | spec->autocfg.hp_pins[0] = 0x14; | 16301 | spec->autocfg.hp_pins[0] = 0x14; |
16402 | spec->autocfg.speaker_pins[0] = 0x1b; | 16302 | spec->autocfg.speaker_pins[0] = 0x1b; |
16403 | alc262_hippo_master_update(codec); | ||
16404 | } | 16303 | } |
16405 | 16304 | ||
16305 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update | ||
16306 | |||
16406 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) | 16307 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
16407 | { | 16308 | { |
16408 | unsigned int present; | 16309 | unsigned int present; |
@@ -16513,23 +16414,6 @@ static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) | |||
16513 | } | 16414 | } |
16514 | } | 16415 | } |
16515 | 16416 | ||
16516 | static void alc663_m51va_mic_automute(struct hda_codec *codec) | ||
16517 | { | ||
16518 | unsigned int present; | ||
16519 | |||
16520 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
16521 | AC_VERB_GET_PIN_SENSE, 0) | ||
16522 | & AC_PINSENSE_PRESENCE; | ||
16523 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
16524 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | ||
16525 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
16526 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | ||
16527 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
16528 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); | ||
16529 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
16530 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); | ||
16531 | } | ||
16532 | |||
16533 | static void alc663_m51va_unsol_event(struct hda_codec *codec, | 16417 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
16534 | unsigned int res) | 16418 | unsigned int res) |
16535 | { | 16419 | { |
@@ -16538,36 +16422,32 @@ static void alc663_m51va_unsol_event(struct hda_codec *codec, | |||
16538 | alc663_m51va_speaker_automute(codec); | 16422 | alc663_m51va_speaker_automute(codec); |
16539 | break; | 16423 | break; |
16540 | case ALC880_MIC_EVENT: | 16424 | case ALC880_MIC_EVENT: |
16541 | alc663_m51va_mic_automute(codec); | 16425 | alc_mic_automute(codec); |
16542 | break; | 16426 | break; |
16543 | } | 16427 | } |
16544 | } | 16428 | } |
16545 | 16429 | ||
16430 | static void alc663_m51va_setup(struct hda_codec *codec) | ||
16431 | { | ||
16432 | struct alc_spec *spec = codec->spec; | ||
16433 | spec->ext_mic.pin = 0x18; | ||
16434 | spec->ext_mic.mux_idx = 0; | ||
16435 | spec->int_mic.pin = 0x12; | ||
16436 | spec->int_mic.mux_idx = 1; | ||
16437 | spec->auto_mic = 1; | ||
16438 | } | ||
16439 | |||
16546 | static void alc663_m51va_inithook(struct hda_codec *codec) | 16440 | static void alc663_m51va_inithook(struct hda_codec *codec) |
16547 | { | 16441 | { |
16548 | alc663_m51va_speaker_automute(codec); | 16442 | alc663_m51va_speaker_automute(codec); |
16549 | alc663_m51va_mic_automute(codec); | 16443 | alc_mic_automute(codec); |
16550 | } | 16444 | } |
16551 | 16445 | ||
16552 | /* ***************** Mode1 ******************************/ | 16446 | /* ***************** Mode1 ******************************/ |
16553 | static void alc663_mode1_unsol_event(struct hda_codec *codec, | 16447 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
16554 | unsigned int res) | 16448 | #define alc663_mode1_setup alc663_m51va_setup |
16555 | { | 16449 | #define alc663_mode1_inithook alc663_m51va_inithook |
16556 | switch (res >> 26) { | ||
16557 | case ALC880_HP_EVENT: | ||
16558 | alc663_m51va_speaker_automute(codec); | ||
16559 | break; | ||
16560 | case ALC880_MIC_EVENT: | ||
16561 | alc662_eeepc_mic_automute(codec); | ||
16562 | break; | ||
16563 | } | ||
16564 | } | ||
16565 | 16450 | ||
16566 | static void alc663_mode1_inithook(struct hda_codec *codec) | ||
16567 | { | ||
16568 | alc663_m51va_speaker_automute(codec); | ||
16569 | alc662_eeepc_mic_automute(codec); | ||
16570 | } | ||
16571 | /* ***************** Mode2 ******************************/ | 16451 | /* ***************** Mode2 ******************************/ |
16572 | static void alc662_mode2_unsol_event(struct hda_codec *codec, | 16452 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
16573 | unsigned int res) | 16453 | unsigned int res) |
@@ -16577,15 +16457,17 @@ static void alc662_mode2_unsol_event(struct hda_codec *codec, | |||
16577 | alc662_f5z_speaker_automute(codec); | 16457 | alc662_f5z_speaker_automute(codec); |
16578 | break; | 16458 | break; |
16579 | case ALC880_MIC_EVENT: | 16459 | case ALC880_MIC_EVENT: |
16580 | alc662_eeepc_mic_automute(codec); | 16460 | alc_mic_automute(codec); |
16581 | break; | 16461 | break; |
16582 | } | 16462 | } |
16583 | } | 16463 | } |
16584 | 16464 | ||
16465 | #define alc662_mode2_setup alc663_m51va_setup | ||
16466 | |||
16585 | static void alc662_mode2_inithook(struct hda_codec *codec) | 16467 | static void alc662_mode2_inithook(struct hda_codec *codec) |
16586 | { | 16468 | { |
16587 | alc662_f5z_speaker_automute(codec); | 16469 | alc662_f5z_speaker_automute(codec); |
16588 | alc662_eeepc_mic_automute(codec); | 16470 | alc_mic_automute(codec); |
16589 | } | 16471 | } |
16590 | /* ***************** Mode3 ******************************/ | 16472 | /* ***************** Mode3 ******************************/ |
16591 | static void alc663_mode3_unsol_event(struct hda_codec *codec, | 16473 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
@@ -16596,15 +16478,17 @@ static void alc663_mode3_unsol_event(struct hda_codec *codec, | |||
16596 | alc663_two_hp_m1_speaker_automute(codec); | 16478 | alc663_two_hp_m1_speaker_automute(codec); |
16597 | break; | 16479 | break; |
16598 | case ALC880_MIC_EVENT: | 16480 | case ALC880_MIC_EVENT: |
16599 | alc662_eeepc_mic_automute(codec); | 16481 | alc_mic_automute(codec); |
16600 | break; | 16482 | break; |
16601 | } | 16483 | } |
16602 | } | 16484 | } |
16603 | 16485 | ||
16486 | #define alc663_mode3_setup alc663_m51va_setup | ||
16487 | |||
16604 | static void alc663_mode3_inithook(struct hda_codec *codec) | 16488 | static void alc663_mode3_inithook(struct hda_codec *codec) |
16605 | { | 16489 | { |
16606 | alc663_two_hp_m1_speaker_automute(codec); | 16490 | alc663_two_hp_m1_speaker_automute(codec); |
16607 | alc662_eeepc_mic_automute(codec); | 16491 | alc_mic_automute(codec); |
16608 | } | 16492 | } |
16609 | /* ***************** Mode4 ******************************/ | 16493 | /* ***************** Mode4 ******************************/ |
16610 | static void alc663_mode4_unsol_event(struct hda_codec *codec, | 16494 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
@@ -16615,15 +16499,17 @@ static void alc663_mode4_unsol_event(struct hda_codec *codec, | |||
16615 | alc663_21jd_two_speaker_automute(codec); | 16499 | alc663_21jd_two_speaker_automute(codec); |
16616 | break; | 16500 | break; |
16617 | case ALC880_MIC_EVENT: | 16501 | case ALC880_MIC_EVENT: |
16618 | alc662_eeepc_mic_automute(codec); | 16502 | alc_mic_automute(codec); |
16619 | break; | 16503 | break; |
16620 | } | 16504 | } |
16621 | } | 16505 | } |
16622 | 16506 | ||
16507 | #define alc663_mode4_setup alc663_m51va_setup | ||
16508 | |||
16623 | static void alc663_mode4_inithook(struct hda_codec *codec) | 16509 | static void alc663_mode4_inithook(struct hda_codec *codec) |
16624 | { | 16510 | { |
16625 | alc663_21jd_two_speaker_automute(codec); | 16511 | alc663_21jd_two_speaker_automute(codec); |
16626 | alc662_eeepc_mic_automute(codec); | 16512 | alc_mic_automute(codec); |
16627 | } | 16513 | } |
16628 | /* ***************** Mode5 ******************************/ | 16514 | /* ***************** Mode5 ******************************/ |
16629 | static void alc663_mode5_unsol_event(struct hda_codec *codec, | 16515 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
@@ -16634,15 +16520,17 @@ static void alc663_mode5_unsol_event(struct hda_codec *codec, | |||
16634 | alc663_15jd_two_speaker_automute(codec); | 16520 | alc663_15jd_two_speaker_automute(codec); |
16635 | break; | 16521 | break; |
16636 | case ALC880_MIC_EVENT: | 16522 | case ALC880_MIC_EVENT: |
16637 | alc662_eeepc_mic_automute(codec); | 16523 | alc_mic_automute(codec); |
16638 | break; | 16524 | break; |
16639 | } | 16525 | } |
16640 | } | 16526 | } |
16641 | 16527 | ||
16528 | #define alc663_mode5_setup alc663_m51va_setup | ||
16529 | |||
16642 | static void alc663_mode5_inithook(struct hda_codec *codec) | 16530 | static void alc663_mode5_inithook(struct hda_codec *codec) |
16643 | { | 16531 | { |
16644 | alc663_15jd_two_speaker_automute(codec); | 16532 | alc663_15jd_two_speaker_automute(codec); |
16645 | alc662_eeepc_mic_automute(codec); | 16533 | alc_mic_automute(codec); |
16646 | } | 16534 | } |
16647 | /* ***************** Mode6 ******************************/ | 16535 | /* ***************** Mode6 ******************************/ |
16648 | static void alc663_mode6_unsol_event(struct hda_codec *codec, | 16536 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
@@ -16653,15 +16541,17 @@ static void alc663_mode6_unsol_event(struct hda_codec *codec, | |||
16653 | alc663_two_hp_m2_speaker_automute(codec); | 16541 | alc663_two_hp_m2_speaker_automute(codec); |
16654 | break; | 16542 | break; |
16655 | case ALC880_MIC_EVENT: | 16543 | case ALC880_MIC_EVENT: |
16656 | alc662_eeepc_mic_automute(codec); | 16544 | alc_mic_automute(codec); |
16657 | break; | 16545 | break; |
16658 | } | 16546 | } |
16659 | } | 16547 | } |
16660 | 16548 | ||
16549 | #define alc663_mode6_setup alc663_m51va_setup | ||
16550 | |||
16661 | static void alc663_mode6_inithook(struct hda_codec *codec) | 16551 | static void alc663_mode6_inithook(struct hda_codec *codec) |
16662 | { | 16552 | { |
16663 | alc663_two_hp_m2_speaker_automute(codec); | 16553 | alc663_two_hp_m2_speaker_automute(codec); |
16664 | alc662_eeepc_mic_automute(codec); | 16554 | alc_mic_automute(codec); |
16665 | } | 16555 | } |
16666 | 16556 | ||
16667 | static void alc663_g71v_hp_automute(struct hda_codec *codec) | 16557 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
@@ -16703,16 +16593,18 @@ static void alc663_g71v_unsol_event(struct hda_codec *codec, | |||
16703 | alc663_g71v_front_automute(codec); | 16593 | alc663_g71v_front_automute(codec); |
16704 | break; | 16594 | break; |
16705 | case ALC880_MIC_EVENT: | 16595 | case ALC880_MIC_EVENT: |
16706 | alc662_eeepc_mic_automute(codec); | 16596 | alc_mic_automute(codec); |
16707 | break; | 16597 | break; |
16708 | } | 16598 | } |
16709 | } | 16599 | } |
16710 | 16600 | ||
16601 | #define alc663_g71v_setup alc663_m51va_setup | ||
16602 | |||
16711 | static void alc663_g71v_inithook(struct hda_codec *codec) | 16603 | static void alc663_g71v_inithook(struct hda_codec *codec) |
16712 | { | 16604 | { |
16713 | alc663_g71v_front_automute(codec); | 16605 | alc663_g71v_front_automute(codec); |
16714 | alc663_g71v_hp_automute(codec); | 16606 | alc663_g71v_hp_automute(codec); |
16715 | alc662_eeepc_mic_automute(codec); | 16607 | alc_mic_automute(codec); |
16716 | } | 16608 | } |
16717 | 16609 | ||
16718 | static void alc663_g50v_unsol_event(struct hda_codec *codec, | 16610 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
@@ -16723,15 +16615,17 @@ static void alc663_g50v_unsol_event(struct hda_codec *codec, | |||
16723 | alc663_m51va_speaker_automute(codec); | 16615 | alc663_m51va_speaker_automute(codec); |
16724 | break; | 16616 | break; |
16725 | case ALC880_MIC_EVENT: | 16617 | case ALC880_MIC_EVENT: |
16726 | alc662_eeepc_mic_automute(codec); | 16618 | alc_mic_automute(codec); |
16727 | break; | 16619 | break; |
16728 | } | 16620 | } |
16729 | } | 16621 | } |
16730 | 16622 | ||
16623 | #define alc663_g50v_setup alc663_m51va_setup | ||
16624 | |||
16731 | static void alc663_g50v_inithook(struct hda_codec *codec) | 16625 | static void alc663_g50v_inithook(struct hda_codec *codec) |
16732 | { | 16626 | { |
16733 | alc663_m51va_speaker_automute(codec); | 16627 | alc663_m51va_speaker_automute(codec); |
16734 | alc662_eeepc_mic_automute(codec); | 16628 | alc_mic_automute(codec); |
16735 | } | 16629 | } |
16736 | 16630 | ||
16737 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { | 16631 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
@@ -16935,8 +16829,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
16935 | .dac_nids = alc662_dac_nids, | 16829 | .dac_nids = alc662_dac_nids, |
16936 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 16830 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
16937 | .channel_mode = alc662_3ST_2ch_modes, | 16831 | .channel_mode = alc662_3ST_2ch_modes, |
16938 | .input_mux = &alc662_eeepc_capture_source, | ||
16939 | .unsol_event = alc662_eeepc_unsol_event, | 16832 | .unsol_event = alc662_eeepc_unsol_event, |
16833 | .setup = alc662_eeepc_setup, | ||
16940 | .init_hook = alc662_eeepc_inithook, | 16834 | .init_hook = alc662_eeepc_inithook, |
16941 | }, | 16835 | }, |
16942 | [ALC662_ASUS_EEEPC_EP20] = { | 16836 | [ALC662_ASUS_EEEPC_EP20] = { |
@@ -16950,6 +16844,7 @@ static struct alc_config_preset alc662_presets[] = { | |||
16950 | .channel_mode = alc662_3ST_6ch_modes, | 16844 | .channel_mode = alc662_3ST_6ch_modes, |
16951 | .input_mux = &alc662_lenovo_101e_capture_source, | 16845 | .input_mux = &alc662_lenovo_101e_capture_source, |
16952 | .unsol_event = alc662_eeepc_unsol_event, | 16846 | .unsol_event = alc662_eeepc_unsol_event, |
16847 | .setup = alc662_eeepc_ep20_setup, | ||
16953 | .init_hook = alc662_eeepc_ep20_inithook, | 16848 | .init_hook = alc662_eeepc_ep20_inithook, |
16954 | }, | 16849 | }, |
16955 | [ALC662_ECS] = { | 16850 | [ALC662_ECS] = { |
@@ -16960,8 +16855,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
16960 | .dac_nids = alc662_dac_nids, | 16855 | .dac_nids = alc662_dac_nids, |
16961 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 16856 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
16962 | .channel_mode = alc662_3ST_2ch_modes, | 16857 | .channel_mode = alc662_3ST_2ch_modes, |
16963 | .input_mux = &alc662_eeepc_capture_source, | ||
16964 | .unsol_event = alc662_eeepc_unsol_event, | 16858 | .unsol_event = alc662_eeepc_unsol_event, |
16859 | .setup = alc662_eeepc_setup, | ||
16965 | .init_hook = alc662_eeepc_inithook, | 16860 | .init_hook = alc662_eeepc_inithook, |
16966 | }, | 16861 | }, |
16967 | [ALC663_ASUS_M51VA] = { | 16862 | [ALC663_ASUS_M51VA] = { |
@@ -16972,8 +16867,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
16972 | .dig_out_nid = ALC662_DIGOUT_NID, | 16867 | .dig_out_nid = ALC662_DIGOUT_NID, |
16973 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 16868 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
16974 | .channel_mode = alc662_3ST_2ch_modes, | 16869 | .channel_mode = alc662_3ST_2ch_modes, |
16975 | .input_mux = &alc663_m51va_capture_source, | ||
16976 | .unsol_event = alc663_m51va_unsol_event, | 16870 | .unsol_event = alc663_m51va_unsol_event, |
16871 | .setup = alc663_m51va_setup, | ||
16977 | .init_hook = alc663_m51va_inithook, | 16872 | .init_hook = alc663_m51va_inithook, |
16978 | }, | 16873 | }, |
16979 | [ALC663_ASUS_G71V] = { | 16874 | [ALC663_ASUS_G71V] = { |
@@ -16984,8 +16879,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
16984 | .dig_out_nid = ALC662_DIGOUT_NID, | 16879 | .dig_out_nid = ALC662_DIGOUT_NID, |
16985 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 16880 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
16986 | .channel_mode = alc662_3ST_2ch_modes, | 16881 | .channel_mode = alc662_3ST_2ch_modes, |
16987 | .input_mux = &alc662_eeepc_capture_source, | ||
16988 | .unsol_event = alc663_g71v_unsol_event, | 16882 | .unsol_event = alc663_g71v_unsol_event, |
16883 | .setup = alc663_g71v_setup, | ||
16989 | .init_hook = alc663_g71v_inithook, | 16884 | .init_hook = alc663_g71v_inithook, |
16990 | }, | 16885 | }, |
16991 | [ALC663_ASUS_H13] = { | 16886 | [ALC663_ASUS_H13] = { |
@@ -16995,7 +16890,6 @@ static struct alc_config_preset alc662_presets[] = { | |||
16995 | .dac_nids = alc662_dac_nids, | 16890 | .dac_nids = alc662_dac_nids, |
16996 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 16891 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
16997 | .channel_mode = alc662_3ST_2ch_modes, | 16892 | .channel_mode = alc662_3ST_2ch_modes, |
16998 | .input_mux = &alc663_m51va_capture_source, | ||
16999 | .unsol_event = alc663_m51va_unsol_event, | 16893 | .unsol_event = alc663_m51va_unsol_event, |
17000 | .init_hook = alc663_m51va_inithook, | 16894 | .init_hook = alc663_m51va_inithook, |
17001 | }, | 16895 | }, |
@@ -17009,6 +16903,7 @@ static struct alc_config_preset alc662_presets[] = { | |||
17009 | .channel_mode = alc662_3ST_6ch_modes, | 16903 | .channel_mode = alc662_3ST_6ch_modes, |
17010 | .input_mux = &alc663_capture_source, | 16904 | .input_mux = &alc663_capture_source, |
17011 | .unsol_event = alc663_g50v_unsol_event, | 16905 | .unsol_event = alc663_g50v_unsol_event, |
16906 | .setup = alc663_g50v_setup, | ||
17012 | .init_hook = alc663_g50v_inithook, | 16907 | .init_hook = alc663_g50v_inithook, |
17013 | }, | 16908 | }, |
17014 | [ALC663_ASUS_MODE1] = { | 16909 | [ALC663_ASUS_MODE1] = { |
@@ -17022,8 +16917,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
17022 | .dig_out_nid = ALC662_DIGOUT_NID, | 16917 | .dig_out_nid = ALC662_DIGOUT_NID, |
17023 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 16918 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17024 | .channel_mode = alc662_3ST_2ch_modes, | 16919 | .channel_mode = alc662_3ST_2ch_modes, |
17025 | .input_mux = &alc662_eeepc_capture_source, | ||
17026 | .unsol_event = alc663_mode1_unsol_event, | 16920 | .unsol_event = alc663_mode1_unsol_event, |
16921 | .setup = alc663_mode1_setup, | ||
17027 | .init_hook = alc663_mode1_inithook, | 16922 | .init_hook = alc663_mode1_inithook, |
17028 | }, | 16923 | }, |
17029 | [ALC662_ASUS_MODE2] = { | 16924 | [ALC662_ASUS_MODE2] = { |
@@ -17036,8 +16931,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
17036 | .dig_out_nid = ALC662_DIGOUT_NID, | 16931 | .dig_out_nid = ALC662_DIGOUT_NID, |
17037 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 16932 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17038 | .channel_mode = alc662_3ST_2ch_modes, | 16933 | .channel_mode = alc662_3ST_2ch_modes, |
17039 | .input_mux = &alc662_eeepc_capture_source, | ||
17040 | .unsol_event = alc662_mode2_unsol_event, | 16934 | .unsol_event = alc662_mode2_unsol_event, |
16935 | .setup = alc662_mode2_setup, | ||
17041 | .init_hook = alc662_mode2_inithook, | 16936 | .init_hook = alc662_mode2_inithook, |
17042 | }, | 16937 | }, |
17043 | [ALC663_ASUS_MODE3] = { | 16938 | [ALC663_ASUS_MODE3] = { |
@@ -17051,8 +16946,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
17051 | .dig_out_nid = ALC662_DIGOUT_NID, | 16946 | .dig_out_nid = ALC662_DIGOUT_NID, |
17052 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 16947 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17053 | .channel_mode = alc662_3ST_2ch_modes, | 16948 | .channel_mode = alc662_3ST_2ch_modes, |
17054 | .input_mux = &alc662_eeepc_capture_source, | ||
17055 | .unsol_event = alc663_mode3_unsol_event, | 16949 | .unsol_event = alc663_mode3_unsol_event, |
16950 | .setup = alc663_mode3_setup, | ||
17056 | .init_hook = alc663_mode3_inithook, | 16951 | .init_hook = alc663_mode3_inithook, |
17057 | }, | 16952 | }, |
17058 | [ALC663_ASUS_MODE4] = { | 16953 | [ALC663_ASUS_MODE4] = { |
@@ -17066,8 +16961,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
17066 | .dig_out_nid = ALC662_DIGOUT_NID, | 16961 | .dig_out_nid = ALC662_DIGOUT_NID, |
17067 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 16962 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17068 | .channel_mode = alc662_3ST_2ch_modes, | 16963 | .channel_mode = alc662_3ST_2ch_modes, |
17069 | .input_mux = &alc662_eeepc_capture_source, | ||
17070 | .unsol_event = alc663_mode4_unsol_event, | 16964 | .unsol_event = alc663_mode4_unsol_event, |
16965 | .setup = alc663_mode4_setup, | ||
17071 | .init_hook = alc663_mode4_inithook, | 16966 | .init_hook = alc663_mode4_inithook, |
17072 | }, | 16967 | }, |
17073 | [ALC663_ASUS_MODE5] = { | 16968 | [ALC663_ASUS_MODE5] = { |
@@ -17081,8 +16976,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
17081 | .dig_out_nid = ALC662_DIGOUT_NID, | 16976 | .dig_out_nid = ALC662_DIGOUT_NID, |
17082 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 16977 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17083 | .channel_mode = alc662_3ST_2ch_modes, | 16978 | .channel_mode = alc662_3ST_2ch_modes, |
17084 | .input_mux = &alc662_eeepc_capture_source, | ||
17085 | .unsol_event = alc663_mode5_unsol_event, | 16979 | .unsol_event = alc663_mode5_unsol_event, |
16980 | .setup = alc663_mode5_setup, | ||
17086 | .init_hook = alc663_mode5_inithook, | 16981 | .init_hook = alc663_mode5_inithook, |
17087 | }, | 16982 | }, |
17088 | [ALC663_ASUS_MODE6] = { | 16983 | [ALC663_ASUS_MODE6] = { |
@@ -17096,8 +16991,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
17096 | .dig_out_nid = ALC662_DIGOUT_NID, | 16991 | .dig_out_nid = ALC662_DIGOUT_NID, |
17097 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 16992 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17098 | .channel_mode = alc662_3ST_2ch_modes, | 16993 | .channel_mode = alc662_3ST_2ch_modes, |
17099 | .input_mux = &alc662_eeepc_capture_source, | ||
17100 | .unsol_event = alc663_mode6_unsol_event, | 16994 | .unsol_event = alc663_mode6_unsol_event, |
16995 | .setup = alc663_mode6_setup, | ||
17101 | .init_hook = alc663_mode6_inithook, | 16996 | .init_hook = alc663_mode6_inithook, |
17102 | }, | 16997 | }, |
17103 | [ALC272_DELL] = { | 16998 | [ALC272_DELL] = { |
@@ -17111,8 +17006,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
17111 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), | 17006 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
17112 | .capsrc_nids = alc272_capsrc_nids, | 17007 | .capsrc_nids = alc272_capsrc_nids, |
17113 | .channel_mode = alc662_3ST_2ch_modes, | 17008 | .channel_mode = alc662_3ST_2ch_modes, |
17114 | .input_mux = &alc663_m51va_capture_source, | ||
17115 | .unsol_event = alc663_m51va_unsol_event, | 17009 | .unsol_event = alc663_m51va_unsol_event, |
17010 | .setup = alc663_m51va_setup, | ||
17116 | .init_hook = alc663_m51va_inithook, | 17011 | .init_hook = alc663_m51va_inithook, |
17117 | }, | 17012 | }, |
17118 | [ALC272_DELL_ZM1] = { | 17013 | [ALC272_DELL_ZM1] = { |
@@ -17126,8 +17021,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
17126 | .num_adc_nids = 1, | 17021 | .num_adc_nids = 1, |
17127 | .capsrc_nids = alc662_capsrc_nids, | 17022 | .capsrc_nids = alc662_capsrc_nids, |
17128 | .channel_mode = alc662_3ST_2ch_modes, | 17023 | .channel_mode = alc662_3ST_2ch_modes, |
17129 | .input_mux = &alc663_m51va_capture_source, | ||
17130 | .unsol_event = alc663_m51va_unsol_event, | 17024 | .unsol_event = alc663_m51va_unsol_event, |
17025 | .setup = alc663_m51va_setup, | ||
17131 | .init_hook = alc663_m51va_inithook, | 17026 | .init_hook = alc663_m51va_inithook, |
17132 | }, | 17027 | }, |
17133 | [ALC272_SAMSUNG_NC10] = { | 17028 | [ALC272_SAMSUNG_NC10] = { |
@@ -17138,8 +17033,9 @@ static struct alc_config_preset alc662_presets[] = { | |||
17138 | .dac_nids = alc272_dac_nids, | 17033 | .dac_nids = alc272_dac_nids, |
17139 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 17034 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17140 | .channel_mode = alc662_3ST_2ch_modes, | 17035 | .channel_mode = alc662_3ST_2ch_modes, |
17141 | .input_mux = &alc272_nc10_capture_source, | 17036 | /*.input_mux = &alc272_nc10_capture_source,*/ |
17142 | .unsol_event = alc663_mode4_unsol_event, | 17037 | .unsol_event = alc663_mode4_unsol_event, |
17038 | .setup = alc663_mode4_setup, | ||
17143 | .init_hook = alc663_mode4_inithook, | 17039 | .init_hook = alc663_mode4_inithook, |
17144 | }, | 17040 | }, |
17145 | }; | 17041 | }; |