aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorKailang Yang <kailang@realtek.com>2008-08-26 08:03:29 -0400
committerJaroslav Kysela <perex@perex.cz>2008-08-29 04:06:04 -0400
commitf1d4e28b2dbd35191cc5097b716ec7fa49540b0b (patch)
tree7f81046c9a958e7f8fbbddd9408479137333fc46 /sound
parente2757d5efad01dae6986e1f84590898e47231964 (diff)
ALSA: hda - Add more ALC662/663 codec support
- Add support for ECS (1019:9087) - Delete G71V record from alc662_cfg_tbl[] The PCI SubsystemID was the same with M70V - Add more ASUS notebook support Signed-off-by: Kailang Yang <kailang@realtek.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/patch_realtek.c599
1 files changed, 591 insertions, 8 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index d748d19f1632..a50473221743 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -174,6 +174,13 @@ enum {
174 ALC663_ASUS_G71V, 174 ALC663_ASUS_G71V,
175 ALC663_ASUS_H13, 175 ALC663_ASUS_H13,
176 ALC663_ASUS_G50V, 176 ALC663_ASUS_G50V,
177 ALC662_ECS,
178 ALC663_ASUS_MODE1,
179 ALC662_ASUS_MODE2,
180 ALC663_ASUS_MODE3,
181 ALC663_ASUS_MODE4,
182 ALC663_ASUS_MODE5,
183 ALC663_ASUS_MODE6,
177 ALC662_AUTO, 184 ALC662_AUTO,
178 ALC662_MODEL_LAST, 185 ALC662_MODEL_LAST,
179}; 186};
@@ -14657,13 +14664,120 @@ static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
14657 { } /* end */ 14664 { } /* end */
14658}; 14665};
14659 14666
14667static struct hda_bind_ctls alc663_asus_bind_master_vol = {
14668 .ops = &snd_hda_bind_vol,
14669 .values = {
14670 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
14671 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
14672 0
14673 },
14674};
14675
14676static struct hda_bind_ctls alc663_asus_one_bind_switch = {
14677 .ops = &snd_hda_bind_sw,
14678 .values = {
14679 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14680 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
14681 0
14682 },
14683};
14684
14660static struct snd_kcontrol_new alc663_m51va_mixer[] = { 14685static struct snd_kcontrol_new alc663_m51va_mixer[] = {
14686 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14687 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
14688 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14689 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14690 { } /* end */
14691};
14692
14693static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
14694 .ops = &snd_hda_bind_sw,
14695 .values = {
14696 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14697 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
14698 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
14699 0
14700 },
14701};
14702
14703static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
14704 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14705 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
14706 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14707 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14708 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14709 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14710
14711 { } /* end */
14712};
14713
14714static struct hda_bind_ctls alc663_asus_four_bind_switch = {
14715 .ops = &snd_hda_bind_sw,
14716 .values = {
14717 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14718 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
14719 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
14720 0
14721 },
14722};
14723
14724static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
14725 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14726 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
14727 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14728 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14729 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14730 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14731 { } /* end */
14732};
14733
14734static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
14661 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), 14735 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14662 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), 14736 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14737 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14738 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14739 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14740 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14741 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14742 { } /* end */
14743};
14744
14745static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
14746 .ops = &snd_hda_bind_vol,
14747 .values = {
14748 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
14749 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
14750 0
14751 },
14752};
14753
14754static struct hda_bind_ctls alc663_asus_two_bind_switch = {
14755 .ops = &snd_hda_bind_sw,
14756 .values = {
14757 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14758 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
14759 0
14760 },
14761};
14762
14763static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
14764 HDA_BIND_VOL("Master Playback Volume",
14765 &alc663_asus_two_bind_master_vol),
14766 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
14767 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14663 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), 14768 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14664 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 14769 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14665 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 14770 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14666 HDA_CODEC_MUTE("DMic Playback Switch", 0x23, 0x9, HDA_INPUT), 14771 { } /* end */
14772};
14773
14774static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
14775 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14776 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
14777 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14778 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14779 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14780 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14667 { } /* end */ 14781 { } /* end */
14668}; 14782};
14669 14783
@@ -14848,14 +14962,81 @@ static struct hda_verb alc663_auto_init_verbs[] = {
14848}; 14962};
14849 14963
14850static struct hda_verb alc663_m51va_init_verbs[] = { 14964static struct hda_verb alc663_m51va_init_verbs[] = {
14965 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14966 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14851 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 14967 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14852 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 14968 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14853 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ 14969 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
14970 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14971 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
14972 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14973 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14974 {}
14975};
14976
14977static struct hda_verb alc663_21jd_amic_init_verbs[] = {
14978 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14979 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14980 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
14981 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14982 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14983 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14984 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14985 {}
14986};
14987
14988static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
14989 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14990 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14991 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14992 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
14993 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14994 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14995 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14996 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14997 {}
14998};
14854 14999
14855 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, 15000static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15001 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15002 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15003 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15004 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15005 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15006 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15007 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15008 {}
15009};
14856 15010
15011static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15012 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15013 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15014 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15015 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15016 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15017 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15018 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15019 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15020 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14857 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, 15021 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14858 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 15022 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15023 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15024 {}
15025};
15026
15027static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15028 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15029 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15030 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15031 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15032 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15033 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15034 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15035 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15036 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15037 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15038 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15039 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14859 {} 15040 {}
14860}; 15041};
14861 15042
@@ -14884,6 +15065,14 @@ static struct hda_verb alc663_g50v_init_verbs[] = {
14884 {} 15065 {}
14885}; 15066};
14886 15067
15068static struct hda_verb alc662_ecs_init_verbs[] = {
15069 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15070 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15071 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15072 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15073 {}
15074};
15075
14887/* capture mixer elements */ 15076/* capture mixer elements */
14888static struct snd_kcontrol_new alc662_capture_mixer[] = { 15077static struct snd_kcontrol_new alc662_capture_mixer[] = {
14889 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), 15078 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
@@ -14903,6 +15092,12 @@ static struct snd_kcontrol_new alc662_capture_mixer[] = {
14903 { } /* end */ 15092 { } /* end */
14904}; 15093};
14905 15094
15095static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15096 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15097 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15098 { } /* end */
15099};
15100
14906static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) 15101static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
14907{ 15102{
14908 unsigned int present; 15103 unsigned int present;
@@ -15011,11 +15206,108 @@ static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15011 unsigned char bits; 15206 unsigned char bits;
15012 15207
15013 present = snd_hda_codec_read(codec, 0x21, 0, 15208 present = snd_hda_codec_read(codec, 0x21, 0,
15014 AC_VERB_GET_PIN_SENSE, 0) 15209 AC_VERB_GET_PIN_SENSE, 0)
15015 & AC_PINSENSE_PRESENCE; 15210 & AC_PINSENSE_PRESENCE;
15016 bits = present ? HDA_AMP_MUTE : 0; 15211 bits = present ? HDA_AMP_MUTE : 0;
15017 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 15212 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15018 HDA_AMP_MUTE, bits); 15213 AMP_IN_MUTE(0), bits);
15214 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15215 AMP_IN_MUTE(0), bits);
15216}
15217
15218static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15219{
15220 unsigned int present;
15221 unsigned char bits;
15222
15223 present = snd_hda_codec_read(codec, 0x21, 0,
15224 AC_VERB_GET_PIN_SENSE, 0)
15225 & AC_PINSENSE_PRESENCE;
15226 bits = present ? HDA_AMP_MUTE : 0;
15227 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15228 AMP_IN_MUTE(0), bits);
15229 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15230 AMP_IN_MUTE(0), bits);
15231 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15232 AMP_IN_MUTE(0), bits);
15233 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15234 AMP_IN_MUTE(0), bits);
15235}
15236
15237static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15238{
15239 unsigned int present;
15240 unsigned char bits;
15241
15242 present = snd_hda_codec_read(codec, 0x15, 0,
15243 AC_VERB_GET_PIN_SENSE, 0)
15244 & AC_PINSENSE_PRESENCE;
15245 bits = present ? HDA_AMP_MUTE : 0;
15246 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15247 AMP_IN_MUTE(0), bits);
15248 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15249 AMP_IN_MUTE(0), bits);
15250 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15251 AMP_IN_MUTE(0), bits);
15252 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15253 AMP_IN_MUTE(0), bits);
15254}
15255
15256static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15257{
15258 unsigned int present;
15259 unsigned char bits;
15260
15261 present = snd_hda_codec_read(codec, 0x1b, 0,
15262 AC_VERB_GET_PIN_SENSE, 0)
15263 & AC_PINSENSE_PRESENCE;
15264 bits = present ? 0 : PIN_OUT;
15265 snd_hda_codec_write(codec, 0x14, 0,
15266 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15267}
15268
15269static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15270{
15271 unsigned int present1, present2;
15272
15273 present1 = snd_hda_codec_read(codec, 0x21, 0,
15274 AC_VERB_GET_PIN_SENSE, 0)
15275 & AC_PINSENSE_PRESENCE;
15276 present2 = snd_hda_codec_read(codec, 0x15, 0,
15277 AC_VERB_GET_PIN_SENSE, 0)
15278 & AC_PINSENSE_PRESENCE;
15279
15280 if (present1 || present2) {
15281 snd_hda_codec_write_cache(codec, 0x14, 0,
15282 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
15283 } else {
15284 snd_hda_codec_write_cache(codec, 0x14, 0,
15285 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
15286 }
15287}
15288
15289static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
15290{
15291 unsigned int present1, present2;
15292
15293 present1 = snd_hda_codec_read(codec, 0x1b, 0,
15294 AC_VERB_GET_PIN_SENSE, 0)
15295 & AC_PINSENSE_PRESENCE;
15296 present2 = snd_hda_codec_read(codec, 0x15, 0,
15297 AC_VERB_GET_PIN_SENSE, 0)
15298 & AC_PINSENSE_PRESENCE;
15299
15300 if (present1 || present2) {
15301 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15302 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15303 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15304 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15305 } else {
15306 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15307 AMP_IN_MUTE(0), 0);
15308 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15309 AMP_IN_MUTE(0), 0);
15310 }
15019} 15311}
15020 15312
15021static void alc663_m51va_mic_automute(struct hda_codec *codec) 15313static void alc663_m51va_mic_automute(struct hda_codec *codec)
@@ -15054,6 +15346,121 @@ static void alc663_m51va_inithook(struct hda_codec *codec)
15054 alc663_m51va_mic_automute(codec); 15346 alc663_m51va_mic_automute(codec);
15055} 15347}
15056 15348
15349/* ***************** Mode1 ******************************/
15350static void alc663_mode1_unsol_event(struct hda_codec *codec,
15351 unsigned int res)
15352{
15353 switch (res >> 26) {
15354 case ALC880_HP_EVENT:
15355 alc663_m51va_speaker_automute(codec);
15356 break;
15357 case ALC880_MIC_EVENT:
15358 alc662_eeepc_mic_automute(codec);
15359 break;
15360 }
15361}
15362
15363static void alc663_mode1_inithook(struct hda_codec *codec)
15364{
15365 alc663_m51va_speaker_automute(codec);
15366 alc662_eeepc_mic_automute(codec);
15367}
15368/* ***************** Mode2 ******************************/
15369static void alc662_mode2_unsol_event(struct hda_codec *codec,
15370 unsigned int res)
15371{
15372 switch (res >> 26) {
15373 case ALC880_HP_EVENT:
15374 alc662_f5z_speaker_automute(codec);
15375 break;
15376 case ALC880_MIC_EVENT:
15377 alc662_eeepc_mic_automute(codec);
15378 break;
15379 }
15380}
15381
15382static void alc662_mode2_inithook(struct hda_codec *codec)
15383{
15384 alc662_f5z_speaker_automute(codec);
15385 alc662_eeepc_mic_automute(codec);
15386}
15387/* ***************** Mode3 ******************************/
15388static void alc663_mode3_unsol_event(struct hda_codec *codec,
15389 unsigned int res)
15390{
15391 switch (res >> 26) {
15392 case ALC880_HP_EVENT:
15393 alc663_two_hp_m1_speaker_automute(codec);
15394 break;
15395 case ALC880_MIC_EVENT:
15396 alc662_eeepc_mic_automute(codec);
15397 break;
15398 }
15399}
15400
15401static void alc663_mode3_inithook(struct hda_codec *codec)
15402{
15403 alc663_two_hp_m1_speaker_automute(codec);
15404 alc662_eeepc_mic_automute(codec);
15405}
15406/* ***************** Mode4 ******************************/
15407static void alc663_mode4_unsol_event(struct hda_codec *codec,
15408 unsigned int res)
15409{
15410 switch (res >> 26) {
15411 case ALC880_HP_EVENT:
15412 alc663_21jd_two_speaker_automute(codec);
15413 break;
15414 case ALC880_MIC_EVENT:
15415 alc662_eeepc_mic_automute(codec);
15416 break;
15417 }
15418}
15419
15420static void alc663_mode4_inithook(struct hda_codec *codec)
15421{
15422 alc663_21jd_two_speaker_automute(codec);
15423 alc662_eeepc_mic_automute(codec);
15424}
15425/* ***************** Mode5 ******************************/
15426static void alc663_mode5_unsol_event(struct hda_codec *codec,
15427 unsigned int res)
15428{
15429 switch (res >> 26) {
15430 case ALC880_HP_EVENT:
15431 alc663_15jd_two_speaker_automute(codec);
15432 break;
15433 case ALC880_MIC_EVENT:
15434 alc662_eeepc_mic_automute(codec);
15435 break;
15436 }
15437}
15438
15439static void alc663_mode5_inithook(struct hda_codec *codec)
15440{
15441 alc663_15jd_two_speaker_automute(codec);
15442 alc662_eeepc_mic_automute(codec);
15443}
15444/* ***************** Mode6 ******************************/
15445static void alc663_mode6_unsol_event(struct hda_codec *codec,
15446 unsigned int res)
15447{
15448 switch (res >> 26) {
15449 case ALC880_HP_EVENT:
15450 alc663_two_hp_m2_speaker_automute(codec);
15451 break;
15452 case ALC880_MIC_EVENT:
15453 alc662_eeepc_mic_automute(codec);
15454 break;
15455 }
15456}
15457
15458static void alc663_mode6_inithook(struct hda_codec *codec)
15459{
15460 alc663_two_hp_m2_speaker_automute(codec);
15461 alc662_eeepc_mic_automute(codec);
15462}
15463
15057static void alc663_g71v_hp_automute(struct hda_codec *codec) 15464static void alc663_g71v_hp_automute(struct hda_codec *codec)
15058{ 15465{
15059 unsigned int present; 15466 unsigned int present;
@@ -15124,6 +15531,46 @@ static void alc663_g50v_inithook(struct hda_codec *codec)
15124 alc662_eeepc_mic_automute(codec); 15531 alc662_eeepc_mic_automute(codec);
15125} 15532}
15126 15533
15534/* bind hp and internal speaker mute (with plug check) */
15535static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
15536 struct snd_ctl_elem_value *ucontrol)
15537{
15538 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
15539 long *valp = ucontrol->value.integer.value;
15540 int change;
15541
15542 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
15543 HDA_AMP_MUTE,
15544 valp[0] ? 0 : HDA_AMP_MUTE);
15545 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
15546 HDA_AMP_MUTE,
15547 valp[1] ? 0 : HDA_AMP_MUTE);
15548 if (change)
15549 alc262_hippo1_automute(codec);
15550 return change;
15551}
15552
15553static struct snd_kcontrol_new alc662_ecs_mixer[] = {
15554 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15555 {
15556 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15557 .name = "Master Playback Switch",
15558 .info = snd_hda_mixer_amp_switch_info,
15559 .get = snd_hda_mixer_amp_switch_get,
15560 .put = alc662_ecs_master_sw_put,
15561 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15562 },
15563
15564 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
15565 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
15566 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
15567
15568 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15569 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15570 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15571 { } /* end */
15572};
15573
15127#ifdef CONFIG_SND_HDA_POWER_SAVE 15574#ifdef CONFIG_SND_HDA_POWER_SAVE
15128#define alc662_loopbacks alc880_loopbacks 15575#define alc662_loopbacks alc880_loopbacks
15129#endif 15576#endif
@@ -15146,21 +15593,60 @@ static const char *alc662_models[ALC662_MODEL_LAST] = {
15146 [ALC662_LENOVO_101E] = "lenovo-101e", 15593 [ALC662_LENOVO_101E] = "lenovo-101e",
15147 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", 15594 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
15148 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", 15595 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
15596 [ALC662_ECS] = "ecs",
15149 [ALC663_ASUS_M51VA] = "m51va", 15597 [ALC663_ASUS_M51VA] = "m51va",
15150 [ALC663_ASUS_G71V] = "g71v", 15598 [ALC663_ASUS_G71V] = "g71v",
15151 [ALC663_ASUS_H13] = "h13", 15599 [ALC663_ASUS_H13] = "h13",
15152 [ALC663_ASUS_G50V] = "g50v", 15600 [ALC663_ASUS_G50V] = "g50v",
15601 [ALC663_ASUS_MODE1] = "asus-mode1",
15602 [ALC662_ASUS_MODE2] = "asus-mode2",
15603 [ALC663_ASUS_MODE3] = "asus-mode3",
15604 [ALC663_ASUS_MODE4] = "asus-mode4",
15605 [ALC663_ASUS_MODE5] = "asus-mode5",
15606 [ALC663_ASUS_MODE6] = "asus-mode6",
15153 [ALC662_AUTO] = "auto", 15607 [ALC662_AUTO] = "auto",
15154}; 15608};
15155 15609
15156static struct snd_pci_quirk alc662_cfg_tbl[] = { 15610static struct snd_pci_quirk alc662_cfg_tbl[] = {
15157 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS G71V", ALC663_ASUS_G71V),
15158 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), 15611 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
15159 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V), 15612 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V),
15160 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), 15613 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
15161 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), 15614 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
15162 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), 15615 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
15616 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
15617 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),
15618 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
15619 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
15620 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
15621 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),
15622 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
15623 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
15624 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
15625 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
15626 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
15627 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
15628 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
15629 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
15630 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
15631 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
15632 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
15633 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
15634 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
15635 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
15636 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
15637 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
15638 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
15639 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
15640 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
15641 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
15642 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
15643 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
15644 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
15645 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
15646 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
15163 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), 15647 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
15648 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
15649 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
15164 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13), 15650 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13),
15165 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13), 15651 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13),
15166 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13), 15652 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13),
@@ -15251,6 +15737,18 @@ static struct alc_config_preset alc662_presets[] = {
15251 .unsol_event = alc662_eeepc_ep20_unsol_event, 15737 .unsol_event = alc662_eeepc_ep20_unsol_event,
15252 .init_hook = alc662_eeepc_ep20_inithook, 15738 .init_hook = alc662_eeepc_ep20_inithook,
15253 }, 15739 },
15740 [ALC662_ECS] = {
15741 .mixers = { alc662_ecs_mixer, alc662_capture_mixer },
15742 .init_verbs = { alc662_init_verbs,
15743 alc662_ecs_init_verbs },
15744 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15745 .dac_nids = alc662_dac_nids,
15746 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15747 .channel_mode = alc662_3ST_2ch_modes,
15748 .input_mux = &alc662_eeepc_capture_source,
15749 .unsol_event = alc662_eeepc_unsol_event,
15750 .init_hook = alc662_eeepc_inithook,
15751 },
15254 [ALC663_ASUS_M51VA] = { 15752 [ALC663_ASUS_M51VA] = {
15255 .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, 15753 .mixers = { alc663_m51va_mixer, alc662_capture_mixer},
15256 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, 15754 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
@@ -15298,6 +15796,91 @@ static struct alc_config_preset alc662_presets[] = {
15298 .unsol_event = alc663_g50v_unsol_event, 15796 .unsol_event = alc663_g50v_unsol_event,
15299 .init_hook = alc663_g50v_inithook, 15797 .init_hook = alc663_g50v_inithook,
15300 }, 15798 },
15799 [ALC663_ASUS_MODE1] = {
15800 .mixers = { alc663_m51va_mixer, alc662_auto_capture_mixer },
15801 .init_verbs = { alc662_init_verbs,
15802 alc663_21jd_amic_init_verbs },
15803 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15804 .hp_nid = 0x03,
15805 .dac_nids = alc662_dac_nids,
15806 .dig_out_nid = ALC662_DIGOUT_NID,
15807 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15808 .channel_mode = alc662_3ST_2ch_modes,
15809 .input_mux = &alc662_eeepc_capture_source,
15810 .unsol_event = alc663_mode1_unsol_event,
15811 .init_hook = alc663_mode1_inithook,
15812 },
15813 [ALC662_ASUS_MODE2] = {
15814 .mixers = { alc662_1bjd_mixer, alc662_auto_capture_mixer },
15815 .init_verbs = { alc662_init_verbs,
15816 alc662_1bjd_amic_init_verbs },
15817 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15818 .dac_nids = alc662_dac_nids,
15819 .dig_out_nid = ALC662_DIGOUT_NID,
15820 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15821 .channel_mode = alc662_3ST_2ch_modes,
15822 .input_mux = &alc662_eeepc_capture_source,
15823 .unsol_event = alc662_mode2_unsol_event,
15824 .init_hook = alc662_mode2_inithook,
15825 },
15826 [ALC663_ASUS_MODE3] = {
15827 .mixers = { alc663_two_hp_m1_mixer, alc662_auto_capture_mixer },
15828 .init_verbs = { alc662_init_verbs,
15829 alc663_two_hp_amic_m1_init_verbs },
15830 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15831 .hp_nid = 0x03,
15832 .dac_nids = alc662_dac_nids,
15833 .dig_out_nid = ALC662_DIGOUT_NID,
15834 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15835 .channel_mode = alc662_3ST_2ch_modes,
15836 .input_mux = &alc662_eeepc_capture_source,
15837 .unsol_event = alc663_mode3_unsol_event,
15838 .init_hook = alc663_mode3_inithook,
15839 },
15840 [ALC663_ASUS_MODE4] = {
15841 .mixers = { alc663_asus_21jd_clfe_mixer,
15842 alc662_auto_capture_mixer},
15843 .init_verbs = { alc662_init_verbs,
15844 alc663_21jd_amic_init_verbs},
15845 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15846 .hp_nid = 0x03,
15847 .dac_nids = alc662_dac_nids,
15848 .dig_out_nid = ALC662_DIGOUT_NID,
15849 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15850 .channel_mode = alc662_3ST_2ch_modes,
15851 .input_mux = &alc662_eeepc_capture_source,
15852 .unsol_event = alc663_mode4_unsol_event,
15853 .init_hook = alc663_mode4_inithook,
15854 },
15855 [ALC663_ASUS_MODE5] = {
15856 .mixers = { alc663_asus_15jd_clfe_mixer,
15857 alc662_auto_capture_mixer },
15858 .init_verbs = { alc662_init_verbs,
15859 alc663_15jd_amic_init_verbs },
15860 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15861 .hp_nid = 0x03,
15862 .dac_nids = alc662_dac_nids,
15863 .dig_out_nid = ALC662_DIGOUT_NID,
15864 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15865 .channel_mode = alc662_3ST_2ch_modes,
15866 .input_mux = &alc662_eeepc_capture_source,
15867 .unsol_event = alc663_mode5_unsol_event,
15868 .init_hook = alc663_mode5_inithook,
15869 },
15870 [ALC663_ASUS_MODE6] = {
15871 .mixers = { alc663_two_hp_m2_mixer, alc662_auto_capture_mixer },
15872 .init_verbs = { alc662_init_verbs,
15873 alc663_two_hp_amic_m2_init_verbs },
15874 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15875 .hp_nid = 0x03,
15876 .dac_nids = alc662_dac_nids,
15877 .dig_out_nid = ALC662_DIGOUT_NID,
15878 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15879 .channel_mode = alc662_3ST_2ch_modes,
15880 .input_mux = &alc662_eeepc_capture_source,
15881 .unsol_event = alc663_mode6_unsol_event,
15882 .init_hook = alc663_mode6_inithook,
15883 },
15301}; 15884};
15302 15885
15303 15886